How to install the NVIDIA drivers on CentOS 7 Linux

The CentOS 7’s support for Nvidia video graphic cards comes in a form of an open source nouveau driver. In case the nouveau driver is not a sufficient solution, users can install the official Nvidia driver as a proprietary alternative. This step by steps tutorial will guide you through the entire process on Nvidia driver installation.

To install Nvidia driver on other Linux distributions, follow our Nvidia Linux Driver guide.

Installed Nvidia drivers on CentOS 7 Linux GNOME desktop

Installed Nvidia drivers on CentOS 7 Linux GNOME desktop.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Criteria Requirements
Operating System CentOS 7.5 or higher
Software Existing Desktop installation such as GNOME, KDE etc.
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install the official NVIDIA drivers on CentOS 7 Linux step by step instructions

The installation of Nvidia drivers consits of multile steps. First, we identify the model number of the Nvidia VGA card available, prepare the system by installation of all package prerequisites and download the official Nvidia driver.

The next step will be to disable the default nouveau driver and install the proprietary Nvidia driver. Let’s get started:

  1. Open up terminal and identify your Nvidia graphic card model by executing:
    #  lshw -numeric -C display
           description: VGA compatible controller
           product: GP106 [GeForce GTX 1060 6GB] [10DE:1C03]
           vendor: NVIDIA Corporation [10DE]
           physical id: 0
           bus info: pci@0000:01:00.0
           version: a1
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
           configuration: driver=nouveau latency=0
           resources: irq:126 memory:d2000000-d2ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:4000(size=128) memory:d3000000-d307ffff

    The above command provides information about the Nvidia card’s model number. Also note that the open source nouveau nvidia driver is currently in use.

  2. Download the Nvidia driver package from using search criteria based on your Nvidia card model and Linux operating system.Alternatively, if you know what you are doing you can download the driver directly from the Nvidia Linux driver list. Once ready you should end up with a file similar to the one shown below:
    $ ls NVIDIA-Linux-x86_64-*
  3. Install all prerequisites for a successful Nvidia driver compilation and installation.
    # yum groupinstall "Development Tools"
    # yum install kernel-devel epel-release
    # yum install dkms

    The dkms package is optional. However, this package will ensure continuous Nvidia kernel module compilation and installation in the event of new kernel update.

  4. Disable nouveau driver by changing the configuration /etc/default/grub file. Add the nouveau.modeset=0 into line starting with GRUB_CMDLINE_LINUX. Below you can find example of grub configuration file reflecting the previously suggested change:
    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"                                                                                   
    GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet nouveau.modeset=0"                                                                                  

    The above line 6 ensures that the nouveau driver is disabled the next time you boot your CentOS 7 Linux system. Once ready execute the following command to apply the new GRUB configuration change:

    $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    $ sudo grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
  5. Reboot your CentOS 7 Linux System. Once the boot is finished confirm that the nouveau open source Nvidia driver is no longer in use:
    # lshw -numeric -C display

    Compare the output of the lshw command with the above Step 1.

  6. The Nvidia drivers must be installed while Xorg server is stopped. Switch to text mode by:
    # systemctl isolate
  7. Install the Nvidia driver by executing the following command:
    # bash NVIDIA-Linux-x86_64-*

    When prompted answer YES to installation of NVIDIA’s 32-bit compatibility libraries and automatic update of your X configuration file.

  8. All done. The Nvidia driver should now be installed on your CentOS 7 Linux system. Reboot your system now, login and run nvidia-settings to further configure your Nvidia graphic card settings.

    Now you can optionally run Nvidia graphic card test by following our Benchmark Your Graphics Card On Linux guide.