Ubuntu Server Preparation
To prepare a server on Ubuntu for the FindFace Server deployment, follow the instructions below minding the sequence.
Note
For other platforms, please refer to the following resources:
In this section:
GPU: Install NVIDIA Drivers
The first step of the server preparation is the NVIDIA driver installation. It’s applicable only for the GPU configuration. Go straight to the Docker installation if your configuration is CPU-accelerated.
With the GPU-accelerated FindFace Server, you’ll need the NVIDIA driver version 535
or above. Add the NVIDIA repository and install an applicable driver from it.
Warning
We do not recommend using a .run
installer from NVIDIA Driver Downloads instead, as its drivers may conflict with the drivers installed by packages.
To install the 535
driver from a repository, do the following:
Install the repository signature key:
arch=$(uname -m); version=$(. /etc/os-release; echo $ID$VERSION_ID | sed -r 's/\.//g'); sudo bash -c \ "sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$ID$version/$arch/3bf863cc.pub \ && apt update"
Install
aptitude
:sudo apt-get install aptitude
Tip
You may receive the following errors when running
sudo apt-get install \
:E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?
There are two ways to resolve them:
Forcibly terminate all the
apt-get
processes currently running in the system.sudo killall apt apt-get
If the previous command didn’t help, run the set of commands below. It’s fine if some of the to-be-deleted directories do not exist — just keep going.
sudo rm /var/lib/apt/lists/lock sudo rm /var/cache/apt/archives/lock sudo rm /var/lib/dpkg/lock sudo rm /var/lib/dpkg/lock-frontend sudo dpkg --configure -a
Install
nvidia-driver-535
:sudo aptitude install nvidia-driver-535
Note
If you’re using Ubuntu 18.04, please install the
530
nvidia driver.Reboot the system:
sudo reboot
Install Docker Products
Docker products must be installed on both CPU and GPU servers. Do the following:
Update the
apt
package index and install packages to allowapt
to use a repository over HTTPS.sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
Add the Docker’s official GPG key (GNU Privacy Guard key) to the host.
sudo mkdir -m 0755 -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Set up the Docker repository.
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update the
apt
package index one more time.sudo apt-get update
Tip
If you have received a GPG error when running this command, try granting read permission for the Docker public key file before updating the package index.
sudo chmod a+r /etc/apt/keyrings/docker.gpg sudo apt-get update
Install the latest versions of Docker products.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
Check whether the Docker installation was a success. The following command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
sudo docker run --rm hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:aa0cc8055b82dc2509bed2e19b275c8f463506616377219d9642221ab53cf9fe Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
Perform the Docker Engine post-installation procedures to ease your future work with Docker and FindFace Server containers. Once you can manage Docker as a non-root user, you don’t have to apply
sudo
in the commands related to Docker.sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
Configure the Docker network.
BIP=10.$((RANDOM % 256)).$((RANDOM % 256)).1 sudo tee /etc/docker/daemon.json <<EOF { "bip": "$BIP/24", "fixed-cidr": "$BIP/24" } EOF
GPU: Install NVIDIA Container Runtime
To deploy containerized GPU-accelerated FindFace Server, you need NVIDIA Container Runtime. We recommend installing NVIDIA Container Toolkit that includes this runtime. Do the following:
Specify the repository and install NVIDIA Container Toolkit from it by executing the following commands.
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker
Configure the Docker network. Configure usage of the NVIDIA Container Runtime installed along with NVIDIA Container Toolkit.
BIP=10.$((RANDOM % 256)).$((RANDOM % 256)) sudo tee /etc/docker/daemon.json <<EOF { "default-address-pools": [ {"base":"$BIP.0/16","size":24} ], "bip": "$BIP.1/24", "fixed-cidr": "$BIP.0/24", "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } }, "default-runtime": "nvidia" } EOF
Restart Docker.
systemctl restart docker
Now you are all set to install FindFace Server.