---
# System prepended metadata

title: Install Nvidia GPU and CUDA  LINUX
tags: [GPU, CUDA, Nvidia]

---

# Install Nvidia GPU and CUDA 
## 1. Install Graphic Cards Drivers Nvidia:

```bash 
sudo apt-get remove --purge '^nvidia-.*'
sudo apt-get --purge remove nvidia*
sudo apt-get --purge remove "*cublas*" "cuda*"
sudo apt remove nvidia-*
sudo apt-get --purge remove "*nvidia*"
sudo apt autoremove -y
sudo apt-get update && sudo apt-get full-upgrade
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get install -y nvidia-open
```

### In case of GTX

```bash
sudo apt-get install -y cuda-drivers
echo "options nvidia NVreg_OpenRmEnableUnsupportedGpus=1" | sudo tee /etc/modprobe.d/nvidia-gsp.conf
```

## 2 Install CUDA

```bash
sudo apt-get -y install cuda-toolkit cudnn tensorrt nvidia-gds
```
Add PATH to .bashrc
```bash
sudo gedit ~/.bashrc
```
```bash
export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
```
```bash
source ~/.bashrc
```

## 3. Install Anaconda

```bash
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
```


### Optional: Install Pytorch

```bash
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
```

-----------------------------------------------------------

## FIX NUMA ERROR
```bash
sudo echo 0 | sudo tee -a /sys/bus/pci/devices/0000\:01\:00.0/numa_node
```

### Monitoring CPU && GPU
```bash 
sudo apt-get install htop btop nvtop nvitop
```
