Tuesday, August 26, 2025

Installing Nvidia drivers and toolkit

 

#!/bin/bash



### steps ####

# verify the system has a cuda-capable gpu

# download and install the nvidia cuda toolkit and cudnn

# setup environmental variables

# verify the installation

###



### to verify your gpu is cuda enable check

lspci | grep -i nvidia



### If you have previous installation remove it first.

sudo apt purge nvidia* -y

sudo apt remove nvidia-* -y

sudo rm /etc/apt/sources.list.d/cuda*

sudo apt autoremove -y && sudo apt autoclean -y

sudo rm -rf /usr/local/cuda*



# system update

sudo apt update && sudo apt upgrade -y


#autoinstall the latest driver, although it is deprecated

sudo ubuntu-drivers autoinstall


# reboot

sudo reboot now


#this two lines might be optional but not sure yet

curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-cuda-keyring.gpg


echo "deb [signed-by=/usr/share/keyrings/nvidia-cuda-keyring.gpg] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /" | sudo tee /etc/apt/sources.list.d/cuda-repository.list


#sudo apt update



wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/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 -y install cuda-toolkit-12-9 #sometimes you can just do sudo apt-get -y install cuda but sometimes you have to be specific

Nvcc #you should see an error message


Tuesday, December 17, 2024

Installing latest nvidia driver on Linux

 ##UBUNTU 2204

 

umask 022
cd /tmp/
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo apt install /tmp/cuda-keyring_1.1-1_all.deb
sudo apt update
nvidia-detector
apt install -y `nvidia-detector` cuda-12-6 #check if later is available
systemctl isolate graphical.target
sudo apt install cuda-toolkit
/linux/configs/scripts/update nv
reboot

 

##ubuntu 2004

 

 

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
dpkg -i cuda-keyring_1.0-1_all.deb
apt-get update
nvidia-detector
apt install -y `nvidia-detector` cuda-12-6 #check if later is available
systemctl isolate graphical.target
/linux/configs/scripts/update nv
reboot

Saturday, January 16, 2021

How to copy a public key to a server

 First make sure you have a public key and an authorized_keys file under you ~/.ssh folder

If you don't have a public key (id_rsa.pub) a file under the .ssh directory, then you can run the ssh-keygen command

ssh-keygen

Just press enter and use the default values for the key. 

Also, create the authorized_keys file to put in there the public keys of the other computers

cat ~/.ssh/id_rsa.pub | ssh ip.address 'cat >> .ssh/authorized_keys'

Wednesday, June 5, 2019

How to install XRDP and ssh on Ubuntu 16.04

Follow this link to get XRDP installed on Ubuntu 16.04

For ssh simply install
sudo apt-get install openssh-server

How to install CUDA and 4xx driver on Ubuntu XX.04

Download and install the drivers using the apt-get commands as such:

sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update

You can check which drivers you can install by doing:

ubuntu-drivers list

Install the driver:

sudo apt-get install nvidia-4xx

Reboot your system:

sudo reboot

Check the driver is working with

nvidia-smi

You should see the GPU and memory use

Download the CUDA 1x.0 toolkit and install it following the steps on the script. Skip the step that asks to install the drivers.
https://developer.nvidia.com/cuda-10.0-download-archive

make sure that you also have your cuda and compiler and static libraries on your path and ld library path as explained in the Nvidia documentation. In essence, make sure you have these variables on updated on your ~/.bashrc file

export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64

Try to compile one of the examples from CUDA.
In case you have problems compiling some of the CUDA examples,
install mesa-utils to get glxinfo working to see if your GPU is working with CUDA
and any other updates such as
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev
libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
libglfw3-dev libgles2-mesa-dev

Download cuDNN tar file under cuDNN Linux and install it following the instruction:
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

Basically:
$ tar -xzvf cudnn-10.0-linux-x64-v7.tgz

Copy the following files into the CUDA Toolkit directory, and change the file permissions.

$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*





Saturday, May 11, 2019

How to install GPU Quadro P600 drivers and CUDA 10.0 on Ubuntu 18.04

You can download and install the drivers first:
Here is a link that explains how to do so
https://www.mvps.net/docs/install-nvidia-drivers-ubuntu-18-04-lts-bionic-beaver-linux/

Or you can also download CUDA installer and it will ask you if you want to install the drivers.
I did installed the drivers first.

Make sure you have the correct drivers on your list before you install them
You can check which drivers you can install by doing
ubuntu-drivers list

Check the driver is working with

nvidia-smi

You should see the GPU and memory use

Download the CUDA 10.0 toolkit and install it following the steps on the script.
https://developer.nvidia.com/cuda-10.0-download-archive



Download cuDNN tar file under cuDNN Linux and install it following the instruction:
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

Basically:
$ tar -xzvf cudnn-10.0-linux-x64-v7.tgz

Copy the following files into the CUDA Toolkit directory, and change the file permissions.

$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

make sure that you also have your cuda and compiler and static libraries on your path and ld library path as explained in the Nvidia documentation. In essence, make sure you have these variables on updated on your ~/.bashrc file

export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64

In case you have problems compiling some of the CUDA examples,
install mesa-utils to get glxinfo working to see if your GPU is working with CUDA
and any other updates such as
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev
libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
libglfw3-dev libgles2-mesa-dev




Friday, January 18, 2019

How to kill and free tensorboard port

fuser -k -n tcp 6006