1 Install and Configuration
Throughout this chapter, you must be the root user or able to use sudo to run commands as root.
Install EPEL and OpenZFS repositories¶
Incus requires the EPEL (Extra Packages for Enterprise Linux) repository, which is easy to install using:
dnf install epel-release -y
When installed, verify that there are no updates:
dnf upgrade
If the upgrade installed kernel updates, reboot the server.
OpenZFS repository¶
Install the OpenZFS repository with:
dnf install https://zfsonlinux.org/epel/zfs-release-2-8$(rpm --eval "%{dist}").noarch.rpm
Install dkms, vim, and kernel-devel¶
Install some needed packages:
dnf install dkms vim kernel-devel bash-completion
Install Incus¶
You will need the CRB repository for some build packages and the COPR (Cool Other Package Repo):
dnf config-manager --enable crb
dnf copr enable ligenix/enterprise-qemu-spice
dnf upgrade
dnf install incus incus-tools
Alternatively, you can install the complete set of packages from the COPR with:
dnf install virt-manager
Enable and start the service:
systemctl enable incus --now
Reboot the server before continuing here.
Install OpenZFS¶
dnf install zfs
Environment set up¶
You need to modify kernel server settings to run many containers at the same time. If you assume from the beginning that you will use your server in production, you need to make these changes up front to avoid errors such as "Too many open files" from occurring.
Luckily, tweaking Incus settings is not hard, with a few file modifications and a reboot.
Modifying limits.conf¶
The first file you must change is limits.conf. This file is self-documented. Review the comments to understand what this file does. To make your modifications, enter:
vi /etc/security/limits.conf
This entire file consists of comments and, at the bottom, shows the current default settings. Add our custom settings in the blank space above the end-of-file marker (#End of file). The end of the file will look like this when completed:
# Modifications made for incus
* soft nofile 1048576
* hard nofile 1048576
root soft nofile 1048576
root hard nofile 1048576
* soft memlock unlimited
* hard memlock unlimited
Save your changes and exit (Shift+:+w+q+! for vi).
Modifying sysctl.conf with 90-incus-override.conf¶
With systemd, you can change your system's overall configuration and kernel options without modifying the main configuration file. Instead, put your settings in a separate file that overrides the specific settings you need.
To make these kernel changes, you will create a file called 90-incus-override.conf in /etc/sysctl.d. To do this, run:
vi /etc/sysctl.d/90-incus-override.conf
Place the following content in that file. Note that if you are wondering what you are doing here, the file content is self-documenting:
## The following changes have been made for incus ##
# fs.inotify.max_queued_events specifies an upper limit on the number of events that can be queued to the corresponding inotify instance (default is 16384)
fs.inotify.max_queued_events = 1048576
# fs.inotify.max_user_instances This specifies an upper limit on the number of inotify instances that can be created per real user ID - (default value is 128)
fs.inotify.max_user_instances = 1048576
# fs.inotify.max_user_watches specifies an upper limit on the number of watches that can be created per real user ID - (default is 8192)
fs.inotify.max_user_watches = 1048576
# vm.max_map_count contains the maximum number of memory map areas a process may have. Memory map areas are used as a side-effect of calling malloc, directly by mmap and mprotect, and also when loading shared libraries (default is 65530)
vm.max_map_count = 262144
# kernel.dmesg_restrict denies container access to the messages in the kernel ring buffer. Please note that this will also deny access to non-root users on the host system (default is 0)
kernel.dmesg_restrict = 1
# This is the maximum number of entries in ARP table (IPv4). You should increase this if you create over 1024 containers.
net.ipv4.neigh.default.gc_thresh3 = 8192
# This is the maximum number of entries in the ARP table (IPv6). You should increase this if you plan to create over 1024 containers. Not needed if not using IPv6, but...
net.ipv6.neigh.default.gc_thresh3 = 8192
# This is a limit on the size of eBPF JIT allocations, which is usually set to PAGE_SIZE * 40000. Set this to 1000000000 if you are running Rocky Linux 9.x
net.core.bpf_jit_limit = 1000000000
# This is the maximum number of keys a non-root user can use; it should be higher than the number of containers
kernel.keys.maxkeys = 2000
# This is the maximum size of the keyring non-root users can use
kernel.keys.maxbytes = 2000000
# This is the maximum number of concurrent async I/O operations. You might need to increase it further if you have a lot of workloads that use the AIO subsystem (e.g., MySQL)
fs.aio-max-nr = 524288
Save your changes and exit.
Now reboot the server.
Checking sysctl.conf values¶
After the reboot, log back in as the root user. Check that your override file has actually completed the job.
There is no need to verify every setting unless you want to, but checking a few will verify that the settings have changed. Do this with the sysctl command:
sysctl net.core.bpf_jit_limit
This will show you:
net.core.bpf_jit_limit = 1000000000
Do the same with a few other settings in the override file to verify the changes.
Author: Steven Spencer
Contributors: Ezequiel Bruni, Ganna Zhyrnova