mkjail.sh

File List
Login

The union of all files from all check-ins in the top-level directory


mkjail

This needs a bit of work yet but I have plans to extend it to make jail creation easy without bloating up features. Fat jails, not ezjail style jails. And it should permit upgrading them too, as well as fectching dists.

I'll clean it up soon. I promise.

howto

This script assumes you're using ZFS. mkjail.sh should be in the same root dir as everything else you create below. (yeah, i know...)

  1. get mkjail.sh

  2. make a dir for the version you want

    # mkdir 10.3-RELEASE
    
  3. fetch the dists you need (edit mkjail.sh to configure the sets="" you want)

    # fetch -o 10.3-RELEASE/base.txz ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/10.3-RELEASE-RELEASE/base.txz
    
  4. make a flavour if you want

    # mkdir -p flavours/default
    # mkdir flavours/default/etc
    # vi flavours/default/etc/resolv.conf
    
  5. make your jail. The -j is the name you want your jail to be.

    # ./mkjail.sh -v 10.3-RELEASE -j testjail -f default
    Creating zroot/jails/testjail...
    Extracting base into /zroot/jails/testjail...
    Extracting doc into /zroot/jails/testjail...
    Extracting games into /zroot/jails/testjail...
    Extracting lib32 into /zroot/jails/testjail...
    Copying in our configs...
    
    Now put something like the following in /etc/jail.conf:
    
    exec.start = "/bin/sh /etc/rc";
    exec.stop = "/bin/sh /etc/rc.shutdown";
    exec.clean;
    mount.devfs;
    path = /zroot/jails/$name;
    
    testjail {
        host.hostname = "testjail";
        ip4.addr = 172.16.1.122;
        ip6.addr = 2602:100:4475:7e4e::2;
    }
    
    and then you can start the jail like so:
    
    # service jail start testjail
    
  6. Put the recommendation into your /etc/jail.conf

  7. sysrc jail_enable=YES

  8. service jail start testjail

Have fun.