Step 1:
Create a directory for the flavour you want to have available. This setup will have one "vanilla" jail that all other jails will be built from. This vanilla jail is built from the example.local jail in the previous post.
cp -R /usr/jails/example.local /usr/jails/flavours/vanilla
Step 2:
Create a new jail using the "vanilla" flavour. Be sure to add the necessary ip address to rc.conf, and restart the netif service.
echo 'ifconfig_em0_alias1="inet 10.0.2.21 netmask 255.0.0.0"' > > /etc/rc.conf /etc/rc.d/netif restart ezjail-admin create -f vanilla nginx01.local 10.0.2.21
Step 3:
Console in to the newly created jail and add the necessary packages and make any changes for the nginx flavour.
ezjail-admin console nginx01.local pkg install nginx echo 'nginx_enable="YES"' >> /etc/rc.conf'
Step 4:
Exit and stop the jail. Copy the directory of the nginx01.local jail to a new directory under flavours, in this case, webserver-nginx. Delete the original jail. Note that 10.0.2.21 is now available for re-use in another jail.
ezjail-admin stop nginx01.local cp -R nginx01.local flavours/webserver-nginx ezjail-admin delete -w -f nginx01.local
Step 5:
You now have a "webserver-nginx" flavour available for easy creation. The next time you need a jail for hosting nginx, be sure to have a free ip and execute
ezjail-admin create -f webserver-nginx nginx02.local 10.0.2.21 ezjail-admin start nginx02.local
No comments:
Post a Comment