Installing CUDA
Procedure
- Use PuTTY to log in to the server as the root user.
- Check whether the Nouveau driver is disabled.
lsmod |grep nouveau
- If a command output is displayed, the Nouveau driver is not disabled. In this case, perform 3.
- If no command output is displayed, the Nouveau driver is disabled. No further action is required.
- Disable the Nouveau driver.
- Create a disable-nouveau.conf file.
vi /etc/modprobe.d/disable-nouveau.conf
- Press i to enter the insert mode and add the following content:
blacklist nouveau options nouveau modeset=0
- Press Esc, type wq!, and press Enter to save the file and exit.
- Create a disable-nouveau.conf file.
- Back up the initramfs file and create a new one.
cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img dracut -f /boot/initramfs-$(uname -r).img $(uname -r)
- Restart the computer.
reboot
- Check whether the Nouveau driver is disabled (no command output is displayed).
lsmod |grep nouveau
- Install NVIDIA CUDA.
wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux_sbsa.run sudo sh cuda_11.4.0_470.42.01_linux_sbsa.run
- Set the environment variables.
export CUDA_HOME=/usr/local/cuda export PATH=$CUDA_HOME/bin:$PATH export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
- Verify the version.
nvcc -V
If the following information is displayed, the installation is successful:

Parent topic: Configuring the Compilation Environment