The following post is a HOWTO guide that describes how to install the NVIDIA proprietary graphics driver on CentOS 7.4
I followed another HOWTO guide but run into some problems, so I decided to write this HOWTO, as the
nouveau open source NVIDIA driver does not like my machine anymore in CentOS 7.4 (and borked my system in 7.3, when I updated it) I figured that given I installed the most up-to-date kernel from the "elrepo" site, I may as well have the most recent driver binary blob from NVIDIA. So far, so good too - no more of my kernel log being flooded with error messages from the open source driver.
Some Notes Before You Start:
- I have *only* tested this on CentOS 7.4 and have not tested this guide on any previous versions of CentOS, or any other Linux distributions. I dare say it will probably work on all CentOS 7.x versions. I would think that a lot of the steps below would be very similar/same on other Linux distributions.
- This HOWTO guide may not cover all NVIDIA graphics hardware configurations. This guide has been written based on only NVIDIA hardware being used. (eg. just NVIDIA hardware (GPU) - like the GeForce GTX * series, etc) That is fully supported by the NVIDIA driver, that has been downloaded from NVIDIA's website. NVIDIA + Intel graphics/Nvidia optimus/etc graphics configurations require more steps than this guide lists, for that hardware configuration to work under Linux. See this to check which drivers you need, and do this first.
- If you are new to Linux, you may wish to use a different Linux distro instead of CentOS. As, the following guide assumes you have at least some command-line/terminal experience. You can also install the proprietary driver from NVIDIA themselves via the packages in the "elrepo" repository - the only catch is that it might not be the very latest version.
- This guide assumes that you wish to use the latest version of the Linux kernel on CentOS, I have not tested it with the default kernel that ships with CentOS. (kernel version 3.x - at the time of this post)
- This guide also assumes that you have NOT already installed the kernel-ml* packages yet. If you have installed any kernel-ml* packages from the "elrepo" repository, un-install them.
- You should also update your system before attempting this guide.
- Remember that you will have to repeat the process below, if you update your kernel version to a newer version. As, the following guide will build the module for the kernel version it's been built against and therefore it will not work with a different version of the Linux kernel.
Preparing Your System:
You need the following packages installed on your system, so that the NVIDIA kernel module can be built;
gcc make kernel-devel kernel-headers
You would need to install the
kernel-ml-devel kernel-ml-headers packages, instead of the
kernel-devel kernel-headers packages if you're using the latest version of the Linux kernel, downloaded from the "elrepo" site.
The versions the
kernel*,
kernel-devel* and the
kernel-headers* packages
must be the same, or the driver will not build.
1) Download the latest driver from the NVIDIA website's drivers page. It should have the
.run file extension.
2) If you want the latest version of the Linux kernel and haven't installed the "elrepo" repository yet, visit the following site:
http://elrepo.org/tiki/tiki-index.php
Have a look under the "Get started" section and follow the directions for your version of CentOS.
3) To install the
kernel-ml* packages you need to use the following command:
Code:
yum --enablerepo=elrepo-kernel install kernel-ml*
You can either replace
kernel-ml* with the actual package names or just run the above as-is.
If you get package conflicts in
yum when trying to install any kernel-ml* packages, run the following command to remove the default version(s) that ship with/are in the CentOS default repositories:
Code:
rpm -e --nodeps package_name
Replace
package_name with the actual package name, that
yum is saying is conflicting with
kernel-ml*.
4) Then as root, give the downloaded file "execute" permission, so you can run it later on and NOT before.
Navigate to where you downloaded the driver from NVIDIA's website and run the following command:
Replace
file_name with the actual name of the
.run file you downloaded before.
You can also add the following to your
/etc/modprobe.d/blacklist.conf file (if it exists - didn't in my install) as root, but this may not stop the
nouveau driver from being loaded at system start-up. (as explained later on in this guide)
Restart the system.
You can use the GUI to do this or run the following command:
Install The NVIDIA Driver:
5) At the GRUB screen, make sure the menu option to start the kernel you are going to build the driver against, is selected and then press "e". Use the keyboard's arrow keys to go to to the end of the kernel's command-line and type "
rdblacklist=nouveau", then press
CTRL+X to start the system with that kernel parameter.
You'll see something similar to what's written below:
Code:
linux16 /boot/vmlinuz-4.15.9-1.el7.elrepo.x86_64 root=UUID=14ea7d36-8c7a-4269-a1f1-cb2ec439addb ro
(there maybe different version numbers and/or more kernel parameters for your machine)
It needs to look something like below, with "
rdblacklist=nouveau" at the end of the kernel command-line:
Code:
linux16 /boot/vmlinuz-4.15.9-1.el7.elrepo.x86_64 root=UUID=14ea7d36-8c7a-4269-a1f1-cb2ec439addb ro rdblacklist=nouveau
6) Press
CTRL+ALT+F2 to enter a virtual console/tty and then login as root. Then run the following command:
If the system freezes on you, just goto another virtual console/tty and continue.
7) Navigate to where you have downloaded the driver from NVIDIA's website and then, run the driver's installer program from the "
.run" file you downloaded before.
For example;
Code:
./NVIDIA-Linux-x86_64-390.42.run
(the version in the file name above, will probably be different for you)
8) You
must run the following command, as if you don't, the system may still load the
nouveau open source driver as well. This will cause a conflict with the proprietary NVIDIA driver and thus your GUI will fail to start.
The above command will rebuild the "initrd" and therefore will hopefully stop the
nouveau driver from being loaded.
Then restart you're machine and that should be it!
NOTE: Assuming the above guide has worked for you, don't worry if the splash screen changes to what looks like a "fallback" screen. As, it does not mean that the installation has not worked. You can press
ESC to check for any error messages from the kernel, as you're system is starting up.
Let me know if I've missed anything or if there is any problems.