User Tools

Site Tools


freebsd:jails

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
freebsd:jails [2020/10/01 00:49] sleepyfreebsd:jails [2025/07/07 23:10] (current) – external edit 127.0.0.1
Line 44: Line 44:
 ====== Configure zfs jail base ====== ====== Configure zfs jail base ======
 <code bash> <code bash>
-touch /jails/BASE/etc/fstab+touch /jails/BASE/etc/fstab /jails/BASE/etc/rc.conf 
 +mkdir -p /jails/BASE/usr/local/etc/pkg/repos 
 +cp /usr/local/etc/pkg/repos/FreeBSD.conf /jails/BASE/usr/local/etc/pkg/repos
 cp /etc/localtime /jails/BASE/etc/ cp /etc/localtime /jails/BASE/etc/
 cp /etc/resolv.conf /jails/BASE/etc/ cp /etc/resolv.conf /jails/BASE/etc/
-touch /jails/BASE/etc/rc.conf 
 echo 'sendmail_enable="NO"' >> /jails/BASE/etc/rc.conf echo 'sendmail_enable="NO"' >> /jails/BASE/etc/rc.conf
 echo 'ntpd_enable="NO"' >> /jails/BASE/etc/rc.conf echo 'ntpd_enable="NO"' >> /jails/BASE/etc/rc.conf
Line 63: Line 64:
 ==== install typical packages, add user, install dotfiles, copy keys.==== ==== install typical packages, add user, install dotfiles, copy keys.====
 <cli green uppercase> <cli green uppercase>
-mkdir -p /jails/BASE/usr/local/etc/pkg/repos +pkg -BASE install nano zsh git-lite python37 py37-pip
-cp /usr/local/etc/pkg/repos/FreeBSD.conf /jails/BASE/usr/local/etc/pkg/repos +
-jexec -BASE pkg install nano zsh git-lite python37 py37-pip+
 jexec -l BASE adduser jexec -l BASE adduser
 jexec -l -U sleepy BASE git clone https://gitlab.com/ikiryuta/dotfiles.git jexec -l -U sleepy BASE git clone https://gitlab.com/ikiryuta/dotfiles.git
Line 90: Line 89:
 }</code> }</code>
   * add entry to **/etc/rc.conf** new jail ip alias <code bash /etc/rc.conf>ifconfig_igb0_alias2="inet 10.0.0.50 netmask 255.255.255.0"</code> or <code bash /etc/rc.conf>ifconfig_igb0_aliases="inet 10.0.0.49-69 netmask 255.255.255.0"</code>   * add entry to **/etc/rc.conf** new jail ip alias <code bash /etc/rc.conf>ifconfig_igb0_alias2="inet 10.0.0.50 netmask 255.255.255.0"</code> or <code bash /etc/rc.conf>ifconfig_igb0_aliases="inet 10.0.0.49-69 netmask 255.255.255.0"</code>
- 
  
 ---- ----
 +====== Updating jails ======
 +===== using source =====
 +assuming you have already built and installed world and kernel. Stop the running jail(s) first.
 +<code>cd /usr/make
 +make installworld DESTDIR=/jails/path
 +mergemaster -iFU -D /jails/path
 +</code>
 +==== jails_update.sh ====
 +Script to automate the updates, just make sure to update the jails paths.
 +<code bash jails_update.sh>
 +jails="/jails/postgres /jails/python /jails/nginx /jails/bitbot"
  
 +cd /usr/src
 +
 +for jail in $jails
 +do
 +    make installworld DESTDIR=$jail
 +    mergemaster -iFU -D $jail
 +done
 +</code>
 +
 +===== using freebsd-update binaries =====
 +<code bash>
 +freebsd-update -b /jails/path fetch
 +freebsd-update -b /jails/path install
 +</code>
 +----
 ====== To Do ====== ====== To Do ======
-  * create ZFS dataset with 20% reserve quota  +  * create ZFS dataset with 20% reserve quota <code bash>zfs create -o quota=300G -o mountpoint=/jails zroot/jails</code> 
-    * **zfs create -o quota=300G -o mountpoint=/jails zroot/jails**+  replace hardcoded jail paths with variable<code bash>export jail=/jails/BASE 
 +echo $jail</code> 
 +  add UTF8 configuration to BASE jail 
 +  * need to create alias for jail ip on hosts network interface during jail creation. 
 +    * using ''ifconfig'' for one-time use <code bash>ifconfig igb0 alias 10.0.0.92 netmask 255.255.255.0</code> 
 +    * permanent using ''rc.conf'' <code bash /etc/rc.conf>ifconfig_igb0_alias2="10.0.0.92 netmask 255.255.255.0"</code>
freebsd/jails.1601513347.txt.gz · Last modified: (external edit)