FreeBSD: add example for jails in poudriere.md

Fri, 08 Sep 2017 09:34:13 +0200

author
David Demelier <markand@malikania.fr>
date
Fri, 08 Sep 2017 09:34:13 +0200
changeset 12
56b6b50c0d7e
parent 11
bab404096fd3
child 13
8970cbf95e7e

FreeBSD: add example for jails in poudriere.md

FreeBSD/poudriere.md file | annotate | diff | comparison | revisions
--- a/FreeBSD/poudriere.md	Thu Sep 07 15:27:04 2017 +0200
+++ b/FreeBSD/poudriere.md	Fri Sep 08 09:34:13 2017 +0200
@@ -186,3 +186,54 @@
 Then install our own packages:
 
     pkg install vim zsh
+
+### Enable repository in your jails (optional)
+
+If you have followed the **jails.md** howto, you may want to use your package
+repository in your own jails.
+
+This chapter assumes that you have built your jails in **/jails** and we will
+use the **template** jail.
+
+#### Mount package repository
+
+First, we need to mount the packages as read-only, we will use **/usr/packages**
+as destination.
+
+Edit your **/etc/jail.conf** to update your jail, you need to do this for each
+of your jails:
+
+    # /etc/jail.conf
+    template {
+        host.hostname="template.local";
+        ip4.addr="10.0.0.30";
+        mount.fstab="/etc/fstab.template";
+    }
+
+And create **/etc/fstab.template**:
+
+    # /etc/fstab.template
+    /poudriere/data/packages/FreeBSD-11-1-default /jails/template/usr/packages nullfs ro 0 0
+
+If your jail is **running**, you can mount using:
+
+    mount -t nullfs -r /poudriere/data/packages/FreeBSD-11-1-default /jails/template/usr/packages
+
+Otherwise, it will be mounted using:
+
+    service jail start template
+
+#### Create repository file
+
+Now create the repository file in the jail:
+
+    # /jails/template/etc/pkg/local.conf
+    local: {
+      url: "file:///usr/packages"
+    }
+
+You can now use `pkg` in your jail!
+
+    pkg -j template update -f
+    pkg -j template upgrade
+    pkg -j template install your_packages

mercurial