We need to run 16.04 for a consulting project that we're working on. Since I don't setup operating systems super often, I tend to forget most of the steps so the next time it takes longer than it has to. So I'm going to drop this here for my own benefit for next time I have to do it... and maybe to help someone else, too.
Note that this is mostly a rehashing of a super wonderful resource here. The differences are that a) it's modified for Ubuntu 16.04 vs 18.04, and b) it's tailored for my specific hardware. Obviously your hardware might be different than mine, so... the above article is probably far more useful to you than this one.
All of this is from a fresh 16.04 install. At this point you're probably looking at a 640x480 (or some nonsense) screen, so it's extra important to be able to quickly copy and paste instructions into the terminal at least up until the point where you get the nvidia driver installed.
Just to be safe.
sudo apt-get update
sudo apt-get upgrade
Nvidia 410
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-410
sudo apt-mark hold nvidia-410
sudo reboot
Note that the above driver name is nvidia-driver-410
on ubuntu 18.04 but just nvidia-410
on 16.04. That took me a few frustrating minutes to figure out.
Okay now your monitor should be in its native resolution. Yay!
Now... do you want Cuda 9 or 10? Instructions are provided for both. But don't do both of these! Pick one.
Cuda 9
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
sudo apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
sudo apt-mark hold cuda
nano .bashrc
- Add
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
to end of file, save, and open new terminal session.
cuDNN for Cuda 9
- Go to https://developer.nvidia.com/rdp/cudnn-download and create an account if you don't already have one. It's free.
- Click
Download cuDNN v7.5.1 (April 22, 2019), for CUDA 9.0
- Download all 3 files with
16.04
in the name. Specifically the runtime library, developer library, and code samples.
cd Downloads
sudo dpkg -i libcudnn7_7.5.1.10-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.5.1.10-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-doc_7.5.1.10-1+cuda9.0_amd64.deb
Cuda 10
wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64
sudo dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64
sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
sudo apt-mark hold cuda
nano .bashrc
- Add
export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
to end of file, save, and open new terminal session.
cuDNN for Cuda 10
- Go to https://developer.nvidia.com/rdp/cudnn-download and create an account if you don't already have one. It's free.
- Click
Download cuDNN v7.5.1 (April 22, 2019), for CUDA 10.0
- Download all 3 files with
16.04
in the name. Specifically the runtime library, developer library, and code samples.
cd Downloads
sudo dpkg -i libcudnn7_7.5.1.10-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.5.1.10-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-doc_7.5.1.10-1+cuda10.0_amd64.deb