From 223814ae018ddeee3b5e81cc05be86ce05a1e5e4 Mon Sep 17 00:00:00 2001 From: Steven Spencer Date: Mon, 8 Aug 2022 15:54:53 -0500 Subject: [PATCH] Fixes for the release of ZFS for 9.0 * just minor fixes because the ZFS repository for 9 has now been released --- docs/books/lxd_server/00-toc.md | 12 +---- docs/books/lxd_server/01-install.md | 16 +++--- docs/books/lxd_server/02-zfs_setup.md | 6 +-- docs/books/lxd_server/03-lxdinit.md | 56 +-------------------- docs/books/lxd_server/07-configurations.md | 4 ++ docs/books/lxd_server/09-snapshot_server.md | 2 +- 6 files changed, 19 insertions(+), 77 deletions(-) diff --git a/docs/books/lxd_server/00-toc.md b/docs/books/lxd_server/00-toc.md index c856d069b0..c5de392d78 100644 --- a/docs/books/lxd_server/00-toc.md +++ b/docs/books/lxd_server/00-toc.md @@ -10,16 +10,6 @@ tags: # Creating a full LXD Server -!!! note "A note about Rocky Linux 9.0" - - Days after the research for implementing this procedure in Rocky Linux 9.0 was completed, and after the documents were rewritten, the repository for ZFS was released for 9. This means that there are some needed edits to this procedure. For now, just know if you want to use ZFS and Rocky Linux 9, you simply need to substute this URL for the ZFS repository: - - ``` - https://github.com/zfsonlinux/zfsonlinux.github.com/blob/master/epel/zfs-release-2-2.el9.noarch.rpm - ``` - - and then go ahead and follow the ZFS Setup. An edit of this procedure to take advantage of the changes will happen soon. - ## Introduction LXD is best described on the [official website](https://linuxcontainers.org/lxd/introduction/), but think of it as a container system that provides the benefits of virtual servers in a container, or a container on steroids. @@ -44,7 +34,7 @@ For those wanting to use LXD as a lab environment on their own laptops or workst ## Synopsis * **Chapter 1: Install and Configuration** deals with the installation of the primary server. In general, the proper way to do LXD in production is to have both a primary server and a snapshot server. -* **Chapter 2: (8.6 Only) ZFS Setup** deals with the setup and configuration of the ZFS. ZFS is an open-source logical volume manager and file system created by Sun Microsystems, originally for its Solaris operating system. It is technically possible for you to build ZFS from source for 9.0, however ZFS is complicated, so if you really want to use it on 9.0, your best bet is to wait for the ZFS repository to be updated. +* **Chapter 2: ZFS Setup** deals with the setup and configuration of the ZFS. ZFS is an open-source logical volume manager and file system created by Sun Microsystems, originally for its Solaris operating system. It is technically possible for you to build ZFS from source for 9.0, however ZFS is complicated, so if you really want to use it on 9.0, your best bet is to wait for the ZFS repository to be updated. * **Chapter 3: LXD Initialization and User Setup** Deals with the base initialization and options and covers both Rocky Linux 8.6 and 9.0. It also deals with the setup of our unprivileged user that we will use throughout most of the rest of the process. * **Chapter 4: Firewall Setup** deals with both `iptables` and `firewalld` setup options, but we recommend that you use `firewalld`for both 8.6 and 9.0. * **Chapter 5: Setting Up and Managing Images** describes the process for installing OS images to a container and configuring them. It discusses the challenges of using `macvlan` for IP addressing on 9.0 and outlines a workaround procedure for doing so. diff --git a/docs/books/lxd_server/01-install.md b/docs/books/lxd_server/01-install.md index 7ce0661e4b..bc43ed4b84 100644 --- a/docs/books/lxd_server/01-install.md +++ b/docs/books/lxd_server/01-install.md @@ -13,7 +13,7 @@ tags: Throughout this section you will need to be the root user or you will need to be able to _sudo_ to root. -## Install EPEL and OpenZFS (8.6 Only) Repositories +## Install EPEL and OpenZFS Repositories LXD requires the EPEL (Extra Packages for Enterprise Linux) repository, which is easy to install using: @@ -24,13 +24,17 @@ dnf install epel-release Once installed, check for updates: ``` -dnf update +dnf upgrade ``` -If you're using ZFS, install the OpenZFS repository with: +If there were any kernel updates during the upgrade process, reboot the server. + +### OpenZFS Repository for 8.6 and 9.0 + +Install the OpenZFS repository with: ``` -dnf install https://zfsonlinux.org/epel/zfs-release.el8_6.noarch.rpm +dnf install https://zfsonlinux.org/epel/zfs-release-2-2$(rpm --eval "%{dist}").noarch.rpm ``` We also need the GPG key, so use this command to get that: @@ -39,8 +43,6 @@ We also need the GPG key, so use this command to get that: gpg --import --import-options show-only /etc/pki/rpm-gpg/RPM-GPG-KEY-zfsonlinux ``` -If there were kernel updates during the update process above, reboot your server - ## Install snapd, dkms, vim, and kernel-devel LXD must be installed from a snap for Rocky Linux. For this reason, we need to install `snapd` (and a few other useful programs) with: @@ -71,7 +73,7 @@ Installing LXD requires the use of the snap command. At this point, we are just snap install lxd ``` -## Install OpenZFS (8.6 Only) +## Install OpenZFS ``` dnf install zfs diff --git a/docs/books/lxd_server/02-zfs_setup.md b/docs/books/lxd_server/02-zfs_setup.md index 762dddc812..0a6d990070 100644 --- a/docs/books/lxd_server/02-zfs_setup.md +++ b/docs/books/lxd_server/02-zfs_setup.md @@ -1,15 +1,15 @@ --- -title: 2 ZFS Setup (8.6 Only) +title: 2 ZFS Setup author: Steven Spencer contributors: Ezequiel Bruni -tested with: 8.5, 8.6 +tested with: 8.5, 8.6, 9.0 tags: - lxd - enterprise - lxd zfs --- -# Chapter 2: ZFS Setup (8.6 Only) +# Chapter 2: ZFS Setup If you are using Rocky Linux 8.6 and have already installed ZFS, this section will walk you through ZFS setup. diff --git a/docs/books/lxd_server/03-lxdinit.md b/docs/books/lxd_server/03-lxdinit.md index ab9a76c4d7..28e5fa9d1f 100644 --- a/docs/books/lxd_server/03-lxdinit.md +++ b/docs/books/lxd_server/03-lxdinit.md @@ -14,7 +14,7 @@ tags: There are separate procedures for Rocky Linux 8.6 and 9.0 below, with the 8.6 version assuming that you are using a ZFS storage pool. -##LXD Initialization +## LXD Initialization Now that the environment is all set up, we are ready to initialize LXD. This is an automated script that asks a series of questions to get your LXD instance up and running: @@ -22,8 +22,6 @@ Now that the environment is all set up, we are ready to initialize LXD. This is lxd init ``` -### For Rocky Linux 8.6 - Here are the questions and our answers for the script, with a little explanation where warranted: ``` @@ -92,64 +90,12 @@ Would you like stale cached images to be updated automatically? (yes/no) [defaul Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: ``` -### For Rocky Linux 9.0 - -Here are the questions and our answers for the script, with a little explanation where warranted: - -``` -Would you like to use LXD clustering? (yes/no) [default=no]: -``` - -If you are interested in clustering, do some additional research on that [here](https://lxd.readthedocs.io/en/latest/clustering/) - -``` -Do you want to configure a new storage pool? (yes/no) [default=yes]: -Name of the new storage pool [default=default]: storage -``` - -Optionally, you can accept the default. Since we aren't using ZFS, it really is just a choice. - -``` -Name of the storage backend to use (btrfs, dir, lvm, ceph) [default=btrfs]: dir -``` - -Note that dir is somewhat slower than btrfs. If you have the forsight to leave a disk empty, you can use that device (example: /dev/sdb) as the btrfs device and then choose btrfs. dir will work fine - -``` -Would you like to connect to a MAAS server? (yes/no) [default=no]: -``` - -Metal As A Service (MAAS) is outside the scope of this document. - -``` -Would you like to create a new local network bridge? (yes/no) [default=yes]: -What should the new bridge be called? [default=lxdbr0]: -What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: -What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: none -``` - -If you want to use IPv6 on your LXD containers, you can turn on this option. That is up to you. - -``` -Would you like the LXD server to be available over the network? (yes/no) [default=no]: yes -``` - -This is necessary to snapshot the server, so answer "yes" here. - -``` -Address to bind LXD to (not including port) [default=all]: -Port to bind LXD to [default=8443]: Trust password for new clients: Again: ``` This trust password is how you will connect to the snapshot server or back from the snapshot server, so set this with something that makes sense in your environment. Save this entry to a secure location, such as a password manager. -``` -Would you like stale cached images to be updated automatically? (yes/no) [default=yes] -Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: -``` - ## Setting Up User Privileges Before we continue on, we need to create our "lxdadmin" user and make sure that it has the privileges it needs. We need the "lxdadmin" user to be able to _sudo_ to root and we need it to be a member of the lxd group. To add the user and make sure it is a member of both groups do: diff --git a/docs/books/lxd_server/07-configurations.md b/docs/books/lxd_server/07-configurations.md index 8e9b086aca..706d2e6631 100644 --- a/docs/books/lxd_server/07-configurations.md +++ b/docs/books/lxd_server/07-configurations.md @@ -96,6 +96,10 @@ lxc config set ubuntu-test limits.cpu 2 That says to limit the number of cpu cores that the container can use to 2. +!!! note + + When this document was rewritten for Rocky Linux 9.0, the ZFS repository for 9 was not available. For this reason all of our test containers were built using "dir" in the init process. That is why the example below shows a "dir" instead of "zfs" storage pool. + Remember when we set up our storage pool in the ZFS chapter? We named the pool "storage," but we could have named it anything. If we want to look at this, we can use this command, which works equally well for any of the other pool types too (as shown for dir): ``` diff --git a/docs/books/lxd_server/09-snapshot_server.md b/docs/books/lxd_server/09-snapshot_server.md index 8ee7c9eadd..3eac16d241 100644 --- a/docs/books/lxd_server/09-snapshot_server.md +++ b/docs/books/lxd_server/09-snapshot_server.md @@ -13,7 +13,7 @@ tags: As noted at the beginning, the snapshot server for LXD should be a mirror of the production server in every way possible. The reason is that you may need to take it to production in the event of a hardware failure, and having not only backups, but a quick way to bring up production containers, keeps those systems administrator panic phone calls and text messages to a minimum. THAT is ALWAYS good! -So the process of building the snapshot server is exactly like the production server. To fully emulate our production server set up, do all of Chapters 1-4 again on ther snapshot server, and when completed, return to this spot. +So the process of building the snapshot server is exactly like the production server. To fully emulate our production server set up, do all of **Chapters 1-4** again on the snapshot server, and when completed, return to this spot. You're back!! Congratulations, this must mean that you have successfully completed the basic install for the snapshot server. That's great news!!