CentOS 7 install NVIDIA graphics driver

There are two main ways to install NVIDIA graphics drivers for CentOS 7:

  1. Installed through the EPEL
  2. Installed through the NVIDIA official installation package

I first tried install through the EPEL warehouse. Although there was no problem during the installation process, the NVIDIA driver did not take effect, and it has not been successful although I tried different methods. Finally, through the second: NVIDIA official installation package installed successfully!

CentOS 7 Installing NVIDIA Graphics Driver

Shield nouveau driver

Nouveau is a display driver that comes with the system and needs to be disabled before proceeding to the next step.
uncomment nvidiafb in /lib/modprobe.d/dist-blacklist.conf :

#blacklist nvidiafb

Then add the configuration in the next line:

blacklist nouveau  
options nouveau modeset=0 

Finally the whole file looks like this:

[root@test ]# vi /lib/modprobe.d/dist-blacklist.conf 

# Listing a module here prevents the hotplug scripts from loading it.
# Usually that'd be so that some other driver will bind it instead,
# no matter which driver happens to get probed first.  Sometimes user
# mode tools can also control driver binding.
# Syntax: see modprobe.conf(5).

# watchdog drivers
blacklist i8xx_tco

# framebuffer drivers
blacklist aty128fb
blacklist atyfb
blacklist radeonfb
blacklist i810fb
blacklist cirrusfb
blacklist intelfb
blacklist kyrofb
blacklist i2c-matroxfb
blacklist hgafb
#blacklist nvidiafb
blacklist nouveau
options nouveau modeset=0 
blacklist rivafb
blacklist savagefb
blacklist sstfb
blacklist neofb
blacklist tridentfb
blacklist tdfxfb
blacklist virgefb
blacklist vga16fb
blacklist viafb

# ISDN - see bugs 154799, 159068
blacklist hisax
blacklist hisax_fcpcipnp

Rebuilding initramfs image

If the /boot partition is not large enough, you can back up to another directory

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak  
dracut /boot/initramfs-$(uname -r).img $(uname -r) 

Change to terminal mode

If you have previously operated in the graphical interface, you need to change to terminal mode, and the runlevel is changed to 3.

systemctl set-default multi-user.target

Install kernel-devel

Need kernel-devel support.

yum install kernel-devel -y

If you upgraded the kernel via elrepo, then install it with the following command:

yum install kernel-ml-devel.x86_64 -y

Kill X related processes

ps -ax | grep X

The output examples are as follows:

[root@nvss239 jstnvr]# ps -ax | grep X
 1201 ?        Ss     0:00 /usr/bin/abrt-watch-log -F Backtrace /var/log/Xorg.0.log -- /usr/bin/abrt-dump-xorg -xD
 1557 tty1     Ssl+   8:39 /usr/bin/X :0 -background none -noreset -audit 4 -verbose -auth /run/gdm/auth-for-gdm-EVsyyE/database -seat seat0 -nolisten tcp vt1
 9863 pts/0    Sl     0:00 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop nvss239:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5901 -rfbwait 30000
10043 ?        Ss     0:00 /usr/bin/ssh-agent /etc/X11/xinit/Xclients
14742 pts/0    S+     0:00 grep --color=auto X

Then kill all related processes by the following command:

kill 1201 1557 9863 10043

Installing NVIDIA Graphics Driver

  1. First go to the official website to download the driver corresponding to your graphics card.
  2. Then execute the following command to start the installation of the NVIDIA graphics driver:
bash ./NVIDIA-Linux-x86_64-430.40.run -k $(uname -r)

Must be preceded by the -k parameter or the installation will fail.

Enable desktop mode

Previously we changed the operating mode to terminal mode and now change back to desktop mode.

systemctl set-default graphical.target

Reboot the system


Check the driver installation

Execute NVIDIA official tools to detect driver installation:


The sample output is as follows:

[root@test ]# nvidia-smi 
Tue Aug 20 21:19:31 2019       
| NVIDIA-SMI 390.42                 Driver Version: 390.42                    |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|   0  GeForce GT 1030     Off  | 00000000:01:00.0 Off |                  N/A |
| 34%   42C    P8    N/A /  30W |   1118MiB /  2001MiB |      0%      Default |
At this point, we have completed the installation of NVIDIA graphics driver under CentOS 7 system!
0 0 vote
Article Rating
赞(1) 打赏
未经允许不得转载:iemblog » CentOS 7 install NVIDIA graphics driver
Notify of
Inline Feedbacks
View all comments





Would love your thoughts, please comment.x