# Install Driver NVIDIA

{% hint style="danger" %}
Before installing the driver, you are required to hold the kernel version so that there is no version upgrade, which can cause NVIDIA driver problems. If you want to upgrade the kernel, you can do before installing the NVIDIA driver. For further explanation regarding the temporary suspension of kernel version upgrades, please click [link ini](https://docs.cloudeka.ai/miscellaneous/troubleshooting/nvidia-driver-not-detected-after-upgrade-kernel#prevention).
{% endhint %}

At the end of this guide is installing the NVIDIA drivers. The NVIDIA driver that will be installed is driver version 550 with CUDA version 12.4. Create the NVIDIA driver installation file by running the following command.

```
nano nvidia-install.sh
```

Insert the following lines into the nvidia-install.sh file

```bash
#!/bin/bash


# Pastikan script dijalankan sebagai root
if [[ $EUID -ne 0 ]]; then
   echo "Script ini harus dijalankan dengan sudo atau sebagai root." 
   exit 1
fi


echo "Mengunduh dan menginstal keyring CUDA..."
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
dpkg -i cuda-keyring_1.1-1_all.deb
apt-get update


echo "Menginstal driver NVIDIA versi 550..."
apt install -y cuda-drivers-550


echo "Menginstal CUDA Toolkit versi 12.4..."
apt-get -y install cuda-toolkit-12-4


echo "Menambahkan PATH CUDA ke file /etc/profile.d/cuda.sh..."
cat <<EOF > /etc/profile.d/cuda.sh
export PATH=\$PATH:/usr/local/cuda/bin
EOF


echo "Menambahkan PATH CUDA ke file ~/.bashrc..."
echo "export PATH=\$PATH:/usr/local/cuda/bin" >> ~/.bashrc


echo "Memuat ulang profile..."
source /etc/profile.d/cuda.sh
source ~/.bashrc


echo "Memeriksa instalasi NVCC..."
nvcc --version || { echo "Gagal menjalankan nvcc. Pastikan CUDA Toolkit terinstal dengan benar."; exit 1; }


echo "Memeriksa instalasi NVIDIA-SMI..."
if ! nvidia-smi; then
    echo
    echo "Gagal menjalankan nvidia-smi. Periksa instalasi driver NVIDIA."
    echo
    echo "CATATAN:"
    echo "- Jika driver NVIDIA belum terdeteksi, silakan reboot perangkat Anda dan coba lagi."
    exit 1
fi


echo "Proses instalasi selesai."
```

Give permission to run the NVIDIA driver.

```
sudo chmod +x nvidia-install.sh
```

Run the nvidia-install file by running the following command.

```
sudo .nvidia-install.sh
```

Wait until the installation process is complete. If the driver is still not detected, the VM needs to be rebooted.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXftDbVvf9oMJf0QVpYBnaPrMZ6BA-akllaIEb8GoQ1KRseHZI1aCPTkDU4ct2CB3OU3wFCCWDeZC9AxxbwsWwIJPonOcwTaRI6l9aPIGv1wHW-G84EK3MjzLyKFBAFQO79ueltjyQ?key=6sGwqPfgeqzrgLIei0ESSA" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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://docs.cloudeka.ai/reference/how-to-add-gpu-in-vm/install-driver-nvidia.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.
