.. _deploy-prepare-server: Ubuntu Server Preparation --------------------------------------------------------------- To prepare a server on Ubuntu for the FindFace Multi deployment, follow the instructions below minding the sequence. .. note:: For other platforms, please refer to the following resources: * `NVIDIA drivers `__ * `Docker Engine `__ * `Docker Compose `__ * `NVIDIA Container Toolkit `__ .. rubric:: In this section: .. contents:: :local: 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 :ref:`Docker installation ` if your configuration is CPU-accelerated. With the GPU-accelerated FindFace Multi, you'll need the NVIDIA driver version ``530`` 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 ``530`` driver from a repository, do the following: #. Install the repository signature key: .. code:: 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``: .. code:: sudo apt-get install aptitude #. Install ``nvidia-driver-530``: .. code:: sudo aptitude install nvidia-driver-530 #. Reboot the system: .. code:: sudo reboot .. _docker: 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 allow ``apt`` to use a repository over HTTPS. .. code:: sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release .. tip:: You may receive the following errors when running ``sudo apt-get install \``: .. code:: 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. .. code:: 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. .. code:: 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 #. Add the Docker’s official GPG key (GNU Privacy Guard key) to the host. .. code:: 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. .. code:: 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. .. code:: 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. .. code:: sudo chmod a+r /etc/apt/keyrings/docker.gpg sudo apt-get update #. Install ``24.*`` versions of Docker products. .. code:: sudo apt-get install docker-ce=5:24* docker-ce-cli=5:24* 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. .. code:: sudo docker run 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/ #. Install ``docker-compose``. .. code:: sudo curl -SL https://github.com/docker/compose/releases/download/v2.15.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose #. Perform the `Docker Engine post-installation procedures `__ to ease your future work with Docker and :ref:`FindFace Multi containers `. Once you can manage Docker as a non-root user, you don't have to apply ``sudo`` in the commands related to Docker. .. code:: sudo groupadd docker sudo usermod -aG docker $USER newgrp docker #. Configure the Docker network. .. code:: sudo su BIP=10.$((RANDOM % 256)).$((RANDOM % 256)).1 cat > /etc/docker/daemon.json < /etc/docker/daemon.json <