Skip to content
Search

Nvidia:HowToInstall

lastmod 2026-01-02created 2016-06-0817 edits

Notes on how to install the NVIDIA Driver.

WARNING

If you plan to install CUDA, you should install the driver using the CUDA Toolkit. When using CUDA, a mismatched driver version may prevent it from starting properly.

How to install NVIDIA in CentOS

How to install NVIDIA on CentOS is as follows:

## 우선, 그래픽모드 종료를 위해 <code>Ctrl + Alt + F2</code>를 입력.
$ /sbin/init 3
$ modprobe -r nouveau

## nouveau가 종료되었는지 확인:
$ lsmod | grep nouv               ## 아무것도 출력되지 않아야 한다!

$ yum install -y kernel-devel gcc
$ chmod +x NVIDIA~.run

How to install NVIDIA in Ubuntu

How to install NVIDIA on Ubuntu is as follows: 1

## ppa:graphics-drivers/ppa: 최신형 nVidia 그래픽 카드 드라이버 지원.
## https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa
$ sudo apt-add-repository -y ppa:graphics-drivers/ppa
$ sudo apt-cache search nvidia

## 설치.
$ sudo apt-get install nvidia-352 nvidia-352-dev

## 재부팅.
$ sudo reboot

Or

$ sudo ubuntu-drivers autoinstall

Troubleshooting

Screen Blanks/Monitor Turns Off

A black screen appears after installation. You can install it manually as below.

For reference, in my case I used the Geforce GTX 750 ti Driver, and since it did not install properly, I proceeded as follows.

$ sudo apt-get purge nvidia*
$ sudo apt-get purge xserver-xorg-video-nouveau

Add the following to the end of the /etc/modprobe.d/blacklist.conf file.

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

For reference, check the list of installed modules with the following command:

lsmod | grep -i -E '(nouv|vga|nvidia|riva)'

If the NVIDIA graphics card does not work or performs poorly, add the following to the end of the /etc/default/grub file. 2

## Find it!
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
## And change it to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

Update GRUB.

$ sudo update-grub

(For reference, the GRUB setting above can be reverted after installing the NVIDIA graphics card driver.)

Stop the service related to the graphics card currently in use and reboot.

## 관련 서비스가 뭔지 확인한다. -> gdm, gdm3, lightdm 같은 것들
sudo service --status-all

## Stop service.
$ sudo gdm service stop
## or
$ sudo service gdm3 stop
## or
$ sudo service lightdm stop

After installing the graphics card driver, edit xorg.profile to suit your setup and reboot.

If the screen still turns off, refer to this page and try the following.

  1. Switch to the console by using ctrl+alt+F1, or reboot and select recovery mode from the GRUB menu.
  2. Open and edit xorg.conf like this: sudo nano /etc/X11/xorg.conf.
  3. Find the line that says: Section "Screen"
  4. Insert a new line that says: Option "UseDisplayDevice" "DFP".
  5. Save the file. If you had to restart into recovery mode, type reboot, otherwise restart your display using sudo /etc/init.d/gdm restart.3

Bash script in Ubuntu 14.04

#!/bin/bash

if [[ $(id -u) -ne 0 ]]; then
    echo "Please run as root."
    exit 1
fi

apt-get purge -y nvidia*
apt-get purge -y xserver-xorg-video-nouveau

BLACKLIST_PATH=/etc/modprobe.d/blacklist.conf
GRUB_PATH=/etc/default/grub

echo "Update $BLACKLIST_PATH"
echo "blacklist vga16fb"  >> $BLACKLIST_PATH
echo "blacklist nouveau"  >> $BLACKLIST_PATH
echo "blacklist rivafb"   >> $BLACKLIST_PATH
echo "blacklist nvidiafb" >> $BLACKLIST_PATH
echo "blacklist rivatv"   >> $BLACKLIST_PATH

echo "Update $GRUB_PATH"
sed -i.temp 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=.*\)"$/\1 nomodeset"/g' $GRUB_PATH
update-grub

echo "Run reboot."

Next step:

#!/bin/bash

if [[ $(id -u) -ne 0 ]]; then
    echo "Please run as root."
    exit 1
fi

service lightdm stop

if [[ $? -ne 0 ]]; then
    echo "Fail service lightdm stop."
    exit 1
fi

echo "Download NVIDIA Linux driver."
curl -O http://kr.download.nvidia.com/XFree86/Linux-x86_64/361.45.11/NVIDIA-Linux-x86_64-361.45.11.run
if [[ $? -ne 0 ]]; then
    echo "Fail download."
    exit 1
fi

chmod +x NVIDIA-Linux-x86_64-361.45.11.run
./NVIDIA-Linux-x86_64-361.45.11.run

in CentOS

First, update the kernel.

$ sudo yum update -y
$ sudo yum install -y kernel-devel kernel-headers gcc make

If Nouveau exists5, add it to the Blacklist.

  • Add the rdblacklist=nouveau argument to the GRUB_CMDLINE_LINUX attribute in the /etc/default/grub file.
  • Add blacklist nouveau to the /etc/modprobe.d/blacklist.conf file.

Now just update GRUB. For this too, choose one of the two methods. 6

$ sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

Fails to boot normally after a kernel patch

In this case, reinstalling the NVIDIA graphics driver may fix it. Proceed in the following order.

  1. Add the nomodeset option to grub.
  2. Update grub again using update-grub.
  3. Stop the lightdm service.
  4. Reinstall the NVIDIA graphics driver.

An alternate method of installing the NVIDIA driver was detected

                                  NVIDIA Accelerated Graphics Driver for Linux-x86_64 (580.105.08)


  An alternate method of installing the NVIDIA driver was detected. (This is usually a package provided by your distributor.) A
  driver installed via that method may integrate better with your system than a driver installed by nvidia-installer.

  Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:

                                  Continue installation                       Abort installation

 The NVIDIA driver provided by Ubuntu can be installed by launching the "Software & Updates" application, and by selecting the
 NVIDIA driver from the "Additional Drivers" tab.

Translation:

  • NVIDIA Accelerated Graphics Driver (for Linux-x86_64) (580.105.08)
  • Another method of installing the NVIDIA driver was detected. (This is usually a package provided by the distribution.)
  • A driver installed this way may integrate better with the system than a driver installed with nvidia-installer.
  • Review the message provided by the maintainer of this alternate installation method and choose one of the following.
  • The NVIDIA driver provided by Ubuntu can be installed by launching the "Software & Updates" application
  • and selecting the NVIDIA driver in the "Additional Drivers" tab.

Bottom line: just press the "Continue" button.

ERROR: An error occurred while performing the step

  ERROR: An error occurred while performing the step: "Building kernel modules". See /var/log/nvidia-installer.log for details.
  • Error: An error occurred while performing the "Building kernel modules" step. See the /var/log/nvidia-installer.log file for details.
  ERROR: An error occurred while performing the step: "Checking to see whether the nvidia kernel module was successfully built".
         See /var/log/nvidia-installer.log for details.
  • Error: An error occurred while performing the "Checking whether the NVIDIA kernel module was successfully built" step. See the /var/log/nvidia-installer.log file for details.

Bottom line: check the /var/log/nvidia-installer.log file.

=== error: unrecognized command-line option '-ftrivial-auto-var-init=zero' ===

cc: error: unrecognized command-line option '-ftrivial-auto-var-init=zero'
 290    make[3]: *** [scripts/Makefile.build:243: /tmp/makeself.YWzjR1r1/NVIDIA-Linux-x86_64-580.105.08/kernel/nvidia/nv-platform.o] Error 1
...

This feature requires GCC 12 or later. Check with the gcc --version command.

See Alternatives#GCC 12 for details.

WARNING: Unable to determine the path to install the libglvnd EGL vendor library config files

  WARNING: Unable to determine the path to install the libglvnd EGL vendor library config files. Check that you have pkg-config and the libglvnd development libraries installed, or specify a path with --glvnd-egl-config-path.
  • Warning: Unable to determine the installation path for the libglvnd EGL vendor library configuration files. Check that pkg-config and the libglvnd development libraries are installed, or specify a path with the --glvnd-egl-config-path option.

Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X?

  Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X?  Any pre-existing X configuration file will be backed up.
  • Would you like to run the nvidia-xconfig utility to automatically update the X configuration file so that the NVIDIA X driver is used when X restarts? The existing X configuration file will be backed up.

See also

Favorite site

References


  1. (For reference, after installing it properly this way, the issue where only a black screen appeared when switching to a virtual console was resolved) ↩

  2. For a detailed explanation of the added nomodeset, see here. ↩

  3. LightDM command: sudo service lightdm restart ↩

  4. How_to_install_Nvidia_drivers_in_CentOS_7_-_Tutorial.pdf ↩

  5. Can be checked with lsmod | grep nouveau ↩

  6. If the grub.cfg file below does not exist, use the sudo grub2-mkconfig -o /boot/grub2/grub.cfg command instead. ↩

  7. How_to_install_nvidia_graphic_driver_from_the_Ubuntu_and_Mint.pdf ↩

author Zer0 sitemap