Skip to content

Instantly share code, notes, and snippets.

@hav4ik
Created December 11, 2018 21:30
Show Gist options
  • Save hav4ik/d806511c8240a85ce73de60dd15ff7bc to your computer and use it in GitHub Desktop.
Save hav4ik/d806511c8240a85ce73de60dd15ff7bc to your computer and use it in GitHub Desktop.
InstallingGuide

Install Nvidia drivers the right way

You don't want Xorg to use your NVIDIA gpu. Need to blacklist nouveau and nvidia-drm. In the created file /etc/modprobe.d/blacklist-nouveau.conf:

blacklist nouveau
options nouveau modeset=0

In the file /etc/modprobe.d/blacklist-nvidia-drm.conf:

blacklist nvidia-drm
alias nvidia-drm off

Check the available drivers:

$ sudo apt-add-repository ppa:graphics-drivers
$ sudo apt update
$ ubuntu-drivers devices

Install recommended drivers (mine is nvidia-driver-396):

$ sudo apt install nvidia-driver-396

Now reboot your computer, then run nvidia-smi to check if drivers were installed correctly

(Optional) install CUDA manually

$ sudo ./cuda_9.0.176_384.81_linux-run --override --no-opengl-libs

Do you accept the previously read EULA?
accept

You are attempting to install on an unsupported configuration. Do you wish to continue?
yes

Install NVIDIA Accelerated Graphics Driver for Linux-...?
no

Install the CUDA 9.0 Toolkit?
yes

Enter Toolkit Location
[default]

Do you want to install a symbolic link at /usr/local/cuda?
yes

Install the CUDA 9.0 Samples?
yes

Enter CUDA Samples Location
/usr/local/cuda-9.0

Add following to .bashrc:

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

copy cuDNN files to cuda location.

@ditwoo
Copy link

ditwoo commented Jun 10, 2019

Here is a short summary for blacklist part:

Note:
You should run this commands with sudo.

add-apt-repository ppa:graphics-drivers/ppa
apt update
apt upgrade

# for checking available drivers use:
#   ubuntu-drivers list

apt install nvidia-driver-430  # or any other available driver

echo 'blacklist nouveau
options nouveau modeset=0' > /etc/modprobe.d/blacklist-nouveau.conf

echo 'blacklist nvidia-drm
alias nvidia-drm off' > /etc/modprobe.d/blacklist-nvidia-drm.conf

reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment