Preparations
This document describes how to compile the kernel source code on the default OS Ubuntu 20.04.3 (kernel version: 5.4.0-81-generic).
Before the compilation, configure the network environment, software source, and system time of the server for downloading the related compilation dependencies.
- During the compilation, use the root user to log in and perform operations.
- Disable the warning "your kernel does not support swap memory limit...".
Edit the /etc/default/grub file and change the value of GRUB_CMDLINE_LINUX.
1 2
# vim /etc/default/grub GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
- Disable SELinux.Edit the /etc/selinux/config file. If there is no such a file, create one and then set SELINUX to disabled.
1 2
# vim /etc/selinux/config SELINUX=disabled
- When multiple Kbox containers are started, the file access workload is heavy on the host. In this case, you need to adjust the maximum number of inotify instances that can be created.In the /etc/sysctl.conf file, add the value of fs.inotify.max_user_instances.
1 2
# vim /etc/sysctl.conf fs.inotify.max_user_instances = 8192
- Update boot settings and reboot the OS for the settings to take effect.
1 2
# update-grub # reboot
- Install base dependencies.
1 2
# apt install dpkg dpkg-dev libncurses5-dev libssl-dev libpciaccess0 # apt install libdrm-amdgpu1 xserver-xorg-video-amdgpu lxc
If a package fails to be obtained during the installation, manually obtain the package based on the address provided in the message and install it. After the installation is successful, continue to install the remaining dependence packages.
- Install Docker. If you have installed Docker in customized mode, skip this step.
Download the Docker static installation package using the link provided in Software Environment. The following uses docker-19.03.15.tgz as an example.
- Upload the installation package to the server, for example, to the /root directory of the server, and decompress the package.
# cd ~ # tar xvpf docker-19.03.15.tgz
- After the decompression is complete, a docker folder is generated in the root directory. Copy all the content in the docker folder to the /usr/bin folder.
# cp -p docker/* /usr/bin
- Run the following commands to configure the docker.service file.
cat >/usr/lib/systemd/system/docker.service <<EOF [Unit] Description=Docker Application Container Engine Documentation=http://docs.docker.com After=network.target docker.socket [Service] Type=notify EnvironmentFile=-/run/flannel/docker WorkingDirectory=/usr/local/bin ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --selinux-enabled=false --log-opt max-size=1g ExecReload=/bin/kill -s HUP $MAINPID # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process Restart=on-failure [Install] WantedBy=multi-user.target EOF
Pay attention to the format of the code copied to the terminal. The following is an example:

- Start the Docker service and configure it to start upon system startup.
# systemctl daemon-reload # systemctl restart docker # systemctl enable docker
If Docker fails to automatically start upon the server restart, run the preceding commands.
- Upload the installation package to the server, for example, to the /root directory of the server, and decompress the package.
- Upgrade linux-firmware. If the firmware has been upgraded, skip this step.
Download the linux-firmware-20210919.tar.gz package using the link provided in Software Environment.
Upload the installation package to the server, for example, to the /root directory of the server, and decompress the package.# cd ~ # tar -xvpf linux-firmware-20210919.tar.gz
After the decompression, the linux-firmware-20210919 folder is generated in the root directory. Copy the firmware file to the standard Linux firmware directory.# cp -ar linux-firmware-20210919/*gpu /usr/lib/firmware/