Easily install and run Apache in a jail.

This is how you can quickly install and run Apache in a jail.
This is just a prototype but wanted to share it with anyone interested.

It obviously needs embellishing.

Code:
JAIL='temp'
cat <<EOF > $JAIL.json
{
    "pkgs": [
    "apache24"
    ]
}
EOF
iocage create -r latest -p ./$JAIL.json -n $JAIL vnet=on dhcp=on
iocage start $JAIL
iocage exec $JAIL service apache24 onestart

Then just go to whatever IP address was assigned and see if 'It works!'
 
sh:
JAIL='temp'
cat <<EOF > $JAIL.json
{
    "pkgs": [
    "apache24"
    ]
}
EOF
iocage create -r latest -p ./$JAIL.json -n $JAIL vnet=on dhcp=on
iocage start $JAIL

iocage exec $JAIL sed -i '' 's/works/works in a jail/' /usr/local/www/apache24/data/index.html

iocage exec $JAIL service apache24 onestart
 
Back
Top