Home / How to install NVIDIA Tesla drivers on Linux

How to install NVIDIA Tesla drivers on Linux

Nvidia CUDA

This section includes instructions for installing the NVIDIA driver on CentOS 8 using the package manager.

  • Install additional dependencies that are required for installing the NVIDIA drivers.

# dnf install -y tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-devel

  • Enable the PowerTools repo and set up the external dependency on EPEL for DKMS.

#dnf config-manager --set-enabled PowerTools

# dnf install -y epel-release

  • Install the CUDA repository public GPG key.

# distribution=rhel8

  • Setup the CUDA network repository.

# ARCH=$( /bin/arch )

# dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/$distribution/${ARCH}/cuda-$distribution.repo

  • The kernel headers and development packages for the current version of the kernel must be installed when the NVIDIA driver is installed, as well as anytime the driver is rebuilt. For example, if your system runs kernel version 4.4.0, you’ll need to install the 4.4.0 kernel headers and development packages.
  • Check that the system has the correct Linux kernel sources from the CentOS repositories for CentOS 8.

# sudo dnf install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)

  • Note that in some cases, you may have to update the running kernel as a pre-requisite:

# sudo dnf install -y kernel kernel-core kernel-modules

  • The choice of the driver package depends on the stream and profile to be used as shown below:

# dnf module install nvidia-driver:<stream>/<profile>

  • stream is determined by the kind and branch of the driver (e.g. precompiled). Choose the latest-dkms driver stream to install the most recent driver. Refer to the support matrix for more information on the supported streams.
  • profile by default is “default” and does not need to be specified. Supported profiles can be chosen based on the use-case:
  • Update the repository cache and install the driver using the nvidia-driver meta-package. In this example, we use the default profile. For NVSwitch systems, use nvidia-driver:latest-dkms/fm.

# dnf clean all

# dnf -y module install nvidia-driver:latest-dkms

  • The PATH variable should include $ export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}. Nsight Compute has moved to /opt/nvidia/nsight-compute/ only in rpm/deb installation method. When using .run installer it is still located under /usr/local/cuda-11.6/.
  • To add this path to the PATH variable:

export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}

  • In addition, when using the runfile installation method, the LD_LIBRARY_PATH variable needs to contain /usr/local/cuda-11.6/lib64 on a 64-bit system, or /usr/local/cuda-11.6/lib on a 32-bit system
  • To change the environment variables for 64-bit operating systems.

export LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib64

  • To change the environment variables for 32-bit operating systems.

export LD_LIBRARY_PATH=/usr/local/cuda-11.6/lib

  • Verify that the correct version of the driver is loaded if you installed it. The driver version can be found by running the command once the driver has been loaded.

# cat /proc/driver/nvidia/version

To verify installation after compilation, download https://github.com/nvidia/cuda-samples and run device query with command ./deviceQuery. The output for deviceQuery should look something like below if the CUDA program is installed and set correctly.

  • You may need to temporarily disable SELinux on systems with this security feature installed in order to run command device_Query

# setenforce 0

  • The bandwidthTest application verifies that the system and the CUDA-capable device are communicating properly.

  • If the tests fail, double-check that your system has a CUDA-capable NVIDIA GPU and that it is correctly installed.

Leave a Reply