# Linux dependencies

*Note: Don't follow this step if you plan to run BlurIt OP on Windows.* [*Go there*](https://doc-op.blurit.io/2.0.8/blurit-on-premise/installation/windows-dependencies-wsl) *instead.*

## Choice 1 : use our dependencies installation script (recommended)

#### Prerequisites Before Installation

Before starting the installation, ensure you have received the archive containing all necessary documents. This archive will be shared via a secured link protected by a password.

**Contents of the Archive**

**Main Archive**: `client_name_YYYYMMDD.tar.gz`

The archive will include the following files:

1. **License File**: `license_client_name_YYYYMMDD_YYYYMMDD`
   * The license file specifies the validity period (start and end dates).
2. **Registry Login**: `login_registry.txt`
   * Contains the credentials to access the registry.
3. **Installation Script**: `linux_installation_script`
   * A script compatible only with Linux systems.
4. **Custom Configuration File** (if applicable): `blurit_stack.yml`

This script will install the software requirements to run BlurIt On-Premise on your server. It will install Nvidia drivers, Docker CE, and Nvidia-docker on Ubuntu, Debian, and RHEL/CentOS. If you are installing BlurIt on an old server and want to maintain specific version dependencies, we don't recommend to use this script but rather to [manually install everything](#manual-dependencies-installation).

To begin, extract the BlurIt OP archive using the following command:

{% code lineNumbers="true" %}

```bash
tar -xzf filename.tar.gz
cd blurit-op
```

{% endcode %}

Replace "filename" with the actual name of the archive that was provided to you.

To start the script, execute the following command:

{% code lineNumbers="true" %}

```sh
sudo ./install_dependencies.sh
```

{% endcode %}

:rotating\_light: After execution of the script, please reboot the server to load the Nvidia drivers and go to the [Configuration](https://doc-op.blurit.io/2.0.8/blurit-on-premise/installation/configuration) page. :rotating\_light:

## Choice 2 : manual dependencies installation

### Nvidia drivers Installation

1. Download the NVIDIA driver >= 470 runfile from: <https://www.nvidia.com/Download/index.aspx?lang=en-us>
2. Open a terminal and navigate to the directory where the downloaded runfile is located.
3. `$ chmod +x <filename>.run` \
   Replace `<filename>` with the actual name of the downloaded runfile.
4. `$ sudo ./<filename>.run`&#x20;
5. `$ sudo reboot`&#x20;

### Docker Installation

The Docker installation documentation is [here](https://docs.docker.com/engine/install/).

{% tabs %}
{% tab title="Ubuntu" %}
{% code lineNumbers="true" fullWidth="false" %}

```bash
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin
```

{% endcode %}
{% endtab %}

{% tab title="Debian" %}
{% code lineNumbers="true" %}

```bash
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
```

{% endcode %}
{% endtab %}

{% tab title="Centos" %}
{% code lineNumbers="true" %}

```bash
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
```

{% endcode %}
{% endtab %}

{% tab title="RHEL" %}
{% code lineNumbers="true" %}

```bash
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### Post-install docker linux (required):&#x20;

{% code lineNumbers="true" %}

```bash
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
```

{% endcode %}

### Nvidia-docker installation

Nvidia-docker installation documentation is [here](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).

{% tabs %}
{% tab title="Ubuntu / Debian" %}
{% code lineNumbers="true" %}

```bash
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/stable/deb/nvidia-container-toolkit.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
```

{% endcode %}
{% endtab %}

{% tab title="Centos / RHEL" %}
{% code lineNumbers="true" %}

```bash
curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | \
  sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo

sudo yum clean expire-cache
sudo yum install -y nvidia-container-toolkit
```

{% endcode %}
{% endtab %}
{% endtabs %}

Configure the Docker daemon to recognize the NVIDIA Container Runtime:

{% code lineNumbers="true" %}

```bash
sudo nvidia-ctk runtime configure --runtime=docker
```

{% endcode %}

Restart the Docker daemon to complete the installation after setting the default runtime:

{% code lineNumbers="true" %}

```bash
sudo systemctl restart docker
```

{% endcode %}

Test if Nvidia-docker is installed:

{% code lineNumbers="true" %}

```bash
sudo docker run --rm --runtime=nvidia --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi
```

{% endcode %}

This should result in a console output shown below:

```
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.51.06    Driver Version: 470.51.06    CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            On   | 00000000:00:1E.0 Off |                    0 |
| N/A   34C    P8     9W /  70W |      0MiB / 15109MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
```

### Configuring daemon.json

Open `/etc/docker/daemon.json` with your favorite text editor.

Add `"default-runtime": "nvidia",`  to the json. Exemple:

{% code title="/etc/docker/daemon.json" lineNumbers="true" %}

```json
{
  "default-runtime": "nvidia",
  "runtimes": {
    "nvidia": {
      "args": [],
      "path": "nvidia-container-runtime
    }
  }
}
```

{% endcode %}

### Blurit CLI Installation

The **Blurit CLI** enables you to easily **configure**, **start**, and **interact** with Blurit. It provides a command-line interface to manage features and streamline platform usage.

Start these commands from WSL:

```bash
wget https://cloud.wassa.io/s/Kuj5MDgqkMCdjRv/download --output-document=blurit
chmod +x blurit
sudo mv blurit /usr/bin
```
