# Server Setup

## Prerequisite

Use the following script to set up an on-premises server service.

1. Install the docker.

```javascript
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
#add docker to user group
sudo gpasswd -a $USER docker
#now restart your terminal for accessing docker without sudo
```

2. Run the "docker ps" to confirm the installation of the docker.

```javascript
ubuntu@ip-172-31-35-153:~$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
```

3. Install the docker-compose. Make sure that the latest version of docker-compose is installed.

```javascript
sudo apt-get remove docker-compose
sudo rm /usr/local/bin/docker-compose
pip uninstall docker-compose


VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')
DESTINATION=/usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
sudo chmod 755 $DESTINATION
```

4. Run the “docker-compose --version” to confirm the installation of the docker-compose.

```javascript
ubuntu@ip-172-31-35-153:~$ docker-compose --version
Docker Compose version v2.17.2
```

{% hint style="info" %}
**Attention**:

Perform steps 5 through 8 for GPU processing only.
{% endhint %}

5. Install the nvidia drivers for GPU processing.

```javascript
sudo apt update
sudo apt upgrade -y
sudo apt install nvidia-driver-515 nvidia-dkms-515 -y
[reboot required after this step]
```

6. Run the “nvidia-smi” to confirm the installation of the nvidia drivers.

```javascript
ubuntu@ip-172-31-35-153:~$ nvidia-smi
Tue Apr 18 10:11:41 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.105.01   Driver Version: 515.105.01   CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| 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            Off  | 00000000:00:1E.0 Off |                    0 |
| N/A   46C    P0    26W /  70W |      2MiB / 15360MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

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

7. Install the nvidia-cuda-runtime.

```javascript
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu20.04/nvidia-docker.list >> nvidia-docker.list
sudo mv nvidia-docker.list /etc/apt/sources.list.d/nvidia-docker.list
sudo apt update
sudo apt -y install nvidia-container-toolkit
sudo systemctl restart docker
```

8. Run the “nvidia-container-toolkit --version” to confirm the installation of the nvidia-cuda-runtime.

```javascript
ubuntu@ip-172-31-35-153:~$ nvidia-container-toolkit --version
NVIDIA Container Runtime Hook version 1.13.0
commit: b7079454b5b8fed1390ce78ca5a3343748f62657
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.qure.ai/api/platform-api/on-premises-deployment-specifications/server-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
