# ezjail.flavour.example script will not install packages



## Smith_oo4 (May 25, 2016)

First of all, I am new to FreeBSD and only play around with Linux a little in the past so please bear with me if I ask something stupid.

I am trying to learn how to uses ezjail and flavors. Right now I am trying to get the ezjail.flavour.example script to install some packages (e.g. sudo) when a jail is first started. In the “Postinstall” section of the example script there is:

`# pkg_add -r pico`

This I am assuming is to install package `pico`. However, it is my understanding that `pkg_add` has been replaced with `pkg install`. I have tried adding both lines to the script to install `sudo` and other packages with no luck.

`pkg_add -r sudo`
and
`pkg install sudo`

I have also tried adding the line to building pkg from a port first, this get `pkg install` but no `sudo`.


```
cd /usr/ports/ports-mgmt/pkg/ && make install clean
pkg install sudo
```

I have also tried adding a line to bootstrap pkg but never got that to work.

How do I get the ezjail.flavour.example script to install package when the jail is first started?

On a side question I can’t get the script to install `sudo` from ports.

`cd /usr/ports/security/sudo/ && make install clean`
That is adding the above line does not seem to work, however I can get this method to work for other ports. Does anyone know why this maybe?


----------



## SirDice (May 25, 2016)

The pkg_add(8) tools have been deprecated a long time ago.

And "It doesn't work" doesn't tell us much. What are the errors?


----------



## Smith_oo4 (May 25, 2016)

When I create or start a jail for the first time that was based on a flavor that includes this script no errors are printed on the terminal.  Is there a log I could look at to get more info?


Basically what I am asking is how do I edit the /usr/jails/flavours/example/etc/rc.d/ezjail.flavour.example script so that when a jail is created based on a flavor that includes this script it will have packages pre-installed?


----------



## icecoke (Jun 1, 2016)

To install the latest phpmyadmin on jail creation, you can do something like this:


```
LOGFILE=/tmp/installlog
echo '##start ezjail.flavour!##' >> $LOGFILE 2>&1
cd /usr/ports/databases/phpmyadmin && make -DBATCH install clean >> $LOGFILE 2>&1
```

after it runs, you can have a look into /tmp/installlog to see what happend.


----------

