Installing the Nvidia Proprietary Drivers for your Ubuntu Server 18.04 are necessary for proper GPU accelerated processing and CUDA. The following instructions will show how to install the latest drivers.
1: Add the repository for the Nvidia drivers
sudo add-apt-repository ppa:graphics-drivers/ppa
2. Update to read the packages available
sudo apt update
3. You can also run the following commands to make sure that whenever the kernel is updated dkms rebuilds the Nvidia driver for the new kernel too.
sudo apt install dkms build-essential
4. Install the driver. At the time of writing 430 was the latest. One thing to note is that this will install a GUI for the server. But if you have it set up as a headless server, it will still function the same way and you will be able to connect through ssh.
sudo apt install nvidia-driver-430
5. Reboot your system
sudo reboot
6. Once your system has rebooted, then run the following command to check if everything is working.
nvidia-smi
7. You should get the following output: I have a GTX 1070 and that’s what shows below. Yours may be different.
And that should be it. Your driver is now installed and ready to go.