mirror of
https://git.freebsd.org/doc.git
synced 2026-01-11 19:56:47 +00:00
Use betarel-current variable in commands to use latest FreeBSD version
It is always tedious to change hardcoded version numbers in the documentation. Use the betarel-current variable in the jails chapter to always use the latest release version in the examples. Event: EuroBSDcon Devsummit 2025 Differential Revision: https://reviews.freebsd.org/D52729
This commit is contained in:
parent
b31ed853b3
commit
dbac0b5f52
1 changed files with 53 additions and 53 deletions
|
|
@ -361,19 +361,19 @@ The userland for the jail can be obtained from the official FreeBSD download ser
|
|||
|
||||
Execute the following command to download the userland:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/14.2-RELEASE/base.txz -o /usr/local/jails/media/14.2-RELEASE-base.txz
|
||||
# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/{betarel-current}-RELEASE/base.txz -o /usr/local/jails/media/{betarel-current}-RELEASE-base.txz
|
||||
....
|
||||
|
||||
Once the download is complete, it will be necessary to extract the contents into the jail directory.
|
||||
|
||||
Execute the following commands to extract the userland into the jail's directory:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# mkdir -p /usr/local/jails/containers/classic
|
||||
# tar -xf /usr/local/jails/media/14.2-RELEASE-base.txz -C /usr/local/jails/containers/classic --unlink
|
||||
# tar -xf /usr/local/jails/media/{betarel-current}-RELEASE-base.txz -C /usr/local/jails/containers/classic --unlink
|
||||
....
|
||||
|
||||
With the userland extracted in the jail directory, it will be necessary to copy the timezone and DNS server files:
|
||||
|
|
@ -449,56 +449,56 @@ For this reason they are created in "read-only" mode so that jails are created w
|
|||
|
||||
To create the dataset for the template, execute the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# zfs create -p zroot/jails/templates/14.2-RELEASE
|
||||
# zfs create -p zroot/jails/templates/{betarel-current}-RELEASE
|
||||
....
|
||||
|
||||
Then execute the following command to download the userland:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/14.2-RELEASE/base.txz -o /usr/local/jails/media/14.2-RELEASE-base.txz
|
||||
# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/{betarel-current}-RELEASE/base.txz -o /usr/local/jails/media/{betarel-current}-RELEASE-base.txz
|
||||
....
|
||||
|
||||
Once the download is complete, it will be necessary to extract the contents in the template directory by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# tar -xf /usr/local/jails/media/14.2-RELEASE-base.txz -C /usr/local/jails/templates/14.2-RELEASE --unlink
|
||||
# tar -xf /usr/local/jails/media/{betarel-current}-RELEASE-base.txz -C /usr/local/jails/templates/{betarel-current}-RELEASE --unlink
|
||||
....
|
||||
|
||||
With the userland extracted in the templates directory, it will be necessary to copy the timezone and DNS server files to the template directory by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# cp /etc/resolv.conf /usr/local/jails/templates/14.2-RELEASE/etc/resolv.conf
|
||||
# cp /etc/localtime /usr/local/jails/templates/14.2-RELEASE/etc/localtime
|
||||
# cp /etc/resolv.conf /usr/local/jails/templates/{betarel-current}-RELEASE/etc/resolv.conf
|
||||
# cp /etc/localtime /usr/local/jails/templates/{betarel-current}-RELEASE/etc/localtime
|
||||
....
|
||||
|
||||
The next thing to do is update to the latest patch level by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# freebsd-update -b /usr/local/jails/templates/14.2-RELEASE/ fetch install
|
||||
# freebsd-update -b /usr/local/jails/templates/{betarel-current}-RELEASE/ fetch install
|
||||
....
|
||||
|
||||
Once the update is finished, the template is ready.
|
||||
|
||||
To create an OpenZFS Snapshot from the template, execute the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# zfs snapshot zroot/jails/templates/14.2-RELEASE@base
|
||||
# zfs snapshot zroot/jails/templates/{betarel-current}-RELEASE@base
|
||||
....
|
||||
|
||||
Once the OpenZFS Snapshot has been created, infinite jails can be created using the OpenZFS clone function.
|
||||
|
||||
To create a Thin Jail named `thinjail`, execute the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# zfs clone zroot/jails/templates/14.2-RELEASE@base zroot/jails/containers/thinjail
|
||||
# zfs clone zroot/jails/templates/{betarel-current}-RELEASE@base zroot/jails/containers/thinjail
|
||||
....
|
||||
|
||||
The last step is to configure the jail.
|
||||
|
|
@ -546,45 +546,45 @@ A jail can be created with reduced duplication of system files by using the Thin
|
|||
|
||||
The first step is to create the dataset to save the template, execute the following command if using OpenZFS:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# zfs create -p zroot/jails/templates/14.2-RELEASE-base
|
||||
# zfs create -p zroot/jails/templates/{betarel-current}-RELEASE-base
|
||||
....
|
||||
|
||||
Or this one if using UFS:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# mkdir /usr/local/jails/templates/14.2-RELEASE-base
|
||||
# mkdir /usr/local/jails/templates/{betarel-current}-RELEASE-base
|
||||
....
|
||||
|
||||
Then execute the following command to download the userland:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/14.2-RELEASE/base.txz -o /usr/local/jails/media/14.2-RELEASE-base.txz
|
||||
# fetch https://download.freebsd.org/ftp/releases/amd64/amd64/{betarel-current}-RELEASE/base.txz -o /usr/local/jails/media/{betarel-current}-RELEASE-base.txz
|
||||
....
|
||||
|
||||
Once the download is complete, it will be necessary to extract the contents in the template directory by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# tar -xf /usr/local/jails/media/14.2-RELEASE-base.txz -C /usr/local/jails/templates/14.2-RELEASE-base --unlink
|
||||
# tar -xf /usr/local/jails/media/{betarel-current}-RELEASE-base.txz -C /usr/local/jails/templates/{betarel-current}-RELEASE-base --unlink
|
||||
....
|
||||
|
||||
Once the userland is extracted in the templates directory, it will be necessary to copy the timezone and DNS server files to the template directory by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# cp /etc/resolv.conf /usr/local/jails/templates/14.2-RELEASE-base/etc/resolv.conf
|
||||
# cp /etc/localtime /usr/local/jails/templates/14.2-RELEASE-base/etc/localtime
|
||||
# cp /etc/resolv.conf /usr/local/jails/templates/{betarel-current}-RELEASE-base/etc/resolv.conf
|
||||
# cp /etc/localtime /usr/local/jails/templates/{betarel-current}-RELEASE-base/etc/localtime
|
||||
....
|
||||
|
||||
With the files moved to the template, the next thing to do is update to the latest patch level by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# freebsd-update -b /usr/local/jails/templates/14.2-RELEASE-base/ fetch install
|
||||
# freebsd-update -b /usr/local/jails/templates/{betarel-current}-RELEASE-base/ fetch install
|
||||
....
|
||||
|
||||
In addition to the base template, it is also necessary to create a directory where the `skeleton` will be located.
|
||||
|
|
@ -592,16 +592,16 @@ Some directories will be copied from the template to the `skeleton`.
|
|||
|
||||
Execute the following command to create the dataset for the `skeleton` in case of using OpenZFS:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# zfs create -p zroot/jails/templates/14.2-RELEASE-skeleton
|
||||
# zfs create -p zroot/jails/templates/{betarel-current}-RELEASE-skeleton
|
||||
....
|
||||
|
||||
Or this one in case of using UFS:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# mkdir /usr/local/jails/templates/14.2-RELEASE-skeleton
|
||||
# mkdir /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton
|
||||
....
|
||||
|
||||
Then create the `skeleton` directories.
|
||||
|
|
@ -609,22 +609,22 @@ The `skeleton` directories will hold the local directories of the jails.
|
|||
|
||||
Execute the following commands to create the directories:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# mkdir -p /usr/local/jails/templates/14.2-RELEASE-skeleton/home
|
||||
# mkdir -p /usr/local/jails/templates/14.2-RELEASE-skeleton/usr
|
||||
# mv /usr/local/jails/templates/14.2-RELEASE-base/etc /usr/local/jails/templates/14.2-RELEASE-skeleton/etc
|
||||
# mv /usr/local/jails/templates/14.2-RELEASE-base/usr/local /usr/local/jails/templates/14.2-RELEASE-skeleton/usr/local
|
||||
# mv /usr/local/jails/templates/14.2-RELEASE-base/tmp /usr/local/jails/templates/14.2-RELEASE-skeleton/tmp
|
||||
# mv /usr/local/jails/templates/14.2-RELEASE-base/var /usr/local/jails/templates/14.2-RELEASE-skeleton/var
|
||||
# mv /usr/local/jails/templates/14.2-RELEASE-base/root /usr/local/jails/templates/14.2-RELEASE-skeleton/root
|
||||
# mkdir -p /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/home
|
||||
# mkdir -p /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/usr
|
||||
# mv /usr/local/jails/templates/{betarel-current}-RELEASE-base/etc /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/etc
|
||||
# mv /usr/local/jails/templates/{betarel-current}-RELEASE-base/usr/local /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/usr/local
|
||||
# mv /usr/local/jails/templates/{betarel-current}-RELEASE-base/tmp /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/tmp
|
||||
# mv /usr/local/jails/templates/{betarel-current}-RELEASE-base/var /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/var
|
||||
# mv /usr/local/jails/templates/{betarel-current}-RELEASE-base/root /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton/root
|
||||
....
|
||||
|
||||
The next step is to create the symlinks to the `skeleton` by executing the following commands:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# cd /usr/local/jails/templates/14.2-RELEASE-base/
|
||||
# cd /usr/local/jails/templates/{betarel-current}-RELEASE-base/
|
||||
# mkdir skeleton
|
||||
# ln -s skeleton/etc etc
|
||||
# ln -s skeleton/home home
|
||||
|
|
@ -638,17 +638,17 @@ With the `skeleton` ready, it will be necessary to copy the data to the jail dir
|
|||
|
||||
In case of using OpenZFS, OpenZFS snapshots can be used to easily create as many jails as necessary by executing the following commands:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# zfs snapshot zroot/jails/templates/14.2-RELEASE-skeleton@base
|
||||
# zfs clone zroot/jails/templates/14.2-RELEASE-skeleton@base zroot/jails/containers/thinjail
|
||||
# zfs snapshot zroot/jails/templates/{betarel-current}-RELEASE-skeleton@base
|
||||
# zfs clone zroot/jails/templates/{betarel-current}-RELEASE-skeleton@base zroot/jails/containers/thinjail
|
||||
....
|
||||
|
||||
In case of using UFS the man:cp[1] program can be used by executing the following command:
|
||||
|
||||
[source,shell]
|
||||
[source,shell,subs=attributes]
|
||||
....
|
||||
# cp -R /usr/local/jails/templates/14.2-RELEASE-skeleton /usr/local/jails/containers/thinjail
|
||||
# cp -R /usr/local/jails/templates/{betarel-current}-RELEASE-skeleton /usr/local/jails/containers/thinjail
|
||||
....
|
||||
|
||||
Then create the directory in which the base template and the skeleton will be mounted:
|
||||
|
|
@ -688,9 +688,9 @@ thinjail {
|
|||
|
||||
Then the create the [.filename]#/usr/local/jails/thinjail-nullfs-base.fstab# file as follows:
|
||||
|
||||
[.programlisting]
|
||||
[.programlisting,subs=attributes]
|
||||
....
|
||||
/usr/local/jails/templates/14.2-RELEASE-base /usr/local/jails/thinjail-nullfs-base/ nullfs ro 0 0
|
||||
/usr/local/jails/templates/{betarel-current}-RELEASE-base /usr/local/jails/thinjail-nullfs-base/ nullfs ro 0 0
|
||||
/usr/local/jails/containers/thinjail /usr/local/jails/thinjail-nullfs-base/skeleton nullfs rw 0 0
|
||||
....
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue