FreeBSD: add beginning of jails.md

Fri, 25 Aug 2017 16:49:18 +0200

author
David Demelier <markand@malikania.fr>
date
Fri, 25 Aug 2017 16:49:18 +0200
changeset 2
68e126f0eed0
parent 1
bbf887728d76
child 3
1fcfc84724ca

FreeBSD: add beginning of jails.md

FreeBSD/jails.md file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FreeBSD/jails.md	Fri Aug 25 16:49:18 2017 +0200
@@ -0,0 +1,85 @@
+FreeBSD jails howto
+===================
+
+This guide will let you create your own jails for FreeBSD.
+
+In this guide, we will build jails from sources.
+
+What are jails?
+===============
+
+Jails are confined environments that run on host kernels. They are similar to
+chroots but have much more features.
+
+Fetching source tree
+====================
+
+You need to install `devel/subversion` package to continue.
+
+In this guide we will assume that we are running FreeBSD 11.1-RELEASE, to fetch
+the source tree, you need this following URL:
+
+    svn://svn.FreeBSD.org/base/releng/<VERSION>
+
+In our case:
+
+    svn co svn://svn.FreeBSD.org/base/releng/11.1 /usr/src
+
+Customizing the build
+=====================
+
+The source tree can be built with and without a lot of options. This is tweaked
+in the `src.conf(5)` file.
+
+Removing options will let you build lighter jails, for example I use the
+following one:
+
+    # /etc/src.conf
+    WITHOUT_APM=yes
+    WITHOUT_AMD=yes
+    WITHOUT_AUTHPF=yes
+    WITHOUT_BLUETOOTH=yes
+    WITHOUT_CTM=yes
+    WITHOUT_FLOPPY=yes
+    WITHOUT_GAMES=yes
+    WITHOUT_IPFILTER=yes
+    WITHOUT_IPFW=yes
+    WITHOUT_IPX=yes
+    WITHOUT_NDIS=yes
+    WITHOUT_OBJC=yes
+    WITHOUT_PORTSNAP=yes
+    WITHOUT_PPP=yes
+    WITHOUT_PROFILE=yes
+    WITHOUT_RESCUE=yes
+    WITHOUT_WIRELESS=yes
+
+See the manual page to know what they control.
+
+Build the source
+================
+
+To build the source, use these commands:
+
+    cd /usr/src
+    make buildworld
+
+Note: this only builds the source tree and does not install anything.
+
+The jail template
+=================
+
+To avoid doing the same step again and again each time we build a jail, we will
+create a template one that we will clone.
+
+We will create that jail in **/jails/template** dataset.
+
+    zfs create zroot/jails
+    zfs create zroot/jails/template
+
+And now install everything in that template directory.
+
+    cd /usr/src
+    make DESTDIR=/jails/template installworld
+    make DESTDIR=/jails/template distribution
+
+

mercurial