How to Easily Install Nvidia Drivers on Ubuntu | Complete Guide

How to Install Nvidia Drivers on Ubuntu

1. Introduction: Why Use Nvidia Drivers on Ubuntu?

Ubuntu provides an open-source Nouveau driver by default, but installing the official Nvidia driver can deliver significantly better performance. This is especially important for tasks that rely on GPUs, such as gaming, 3D modeling, and AI development, as Nvidia drivers offer superior stability and functionality. Additionally, if you need CUDA support, the official driver is essential. By installing Nvidia drivers on Ubuntu, you can fully leverage your hardware’s potential.

2. How to Check Your Nvidia Driver

Before installing Nvidia drivers, it’s crucial to check your Nvidia GPU model and the recommended driver version. This is the first step to ensuring you select the correct driver. Follow these steps to check:

  1. Open the Terminal
  • Use the shortcut Ctrl + Alt + T to open the terminal.
  1. Enter the command
  • Run the following command:
    bash ubuntu-drivers devices
  1. Check the recommended driver
  • The output will display available drivers and the recommended one. Use this information to install the optimal driver.

3. How to Install Nvidia Drivers

There are two ways to install Nvidia drivers on Ubuntu. For beginners, automatic installation is recommended, but manual installation is also possible.

1. Automatic Installation

  1. Open the terminal and run the following command:
   sudo ubuntu-drivers autoinstall
  1. This command will automatically install the recommended driver.

2. Manual Installation

  1. If you want to install a specific driver version manually, use the following command:
   sudo apt install nvidia-driver-XXX

※ Replace “XXX” with the driver version number you want to install.

After installation, restart your system to apply the changes. Both methods are easy to execute, but manual installation is useful when you need a specific version.

4. Installing Beta Drivers

In addition to stable drivers, Nvidia provides beta drivers with the latest features. To install them, you need to add the PPA repository. Follow these steps:

  1. Add the PPA repository
    Run the following command in the terminal:
   sudo add-apt-repository ppa:graphics-drivers/ppa
   sudo apt update
  1. Install the driver
    Just like with standard drivers, install the beta driver using the command:
   sudo apt install nvidia-driver-XXX

Beta drivers are useful for users who want to test new features, but they may be less stable. Be sure to restart your system after installation.

5. Troubleshooting

After installing the Nvidia driver, you may experience issues such as system instability or the driver not working correctly. Below are common problems and their solutions.

1. Screen Goes Black

  • The driver may not be loading correctly. Check the Nvidia driver status using the following command in the terminal:
    bash sudo systemctl status nvidia

2. Driver Not Installed Correctly

  • If the driver is not working as expected, you can remove all Nvidia-related packages and reinstall them using:
    sudo apt purge nvidia-*

3. Disabling the Nouveau Driver

  • Ubuntu includes the open-source Nouveau driver by default, which can conflict with the Nvidia driver. Disable it using the following commands:
    bash echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
    sudo update-initramfs -u
    sudo reboot

These steps should resolve most issues. If you continue to experience problems, carefully review the installation steps and check for compatibility issues.

6. Summary & Next Steps

Installing Nvidia drivers is an essential process for Ubuntu users. By understanding both automatic and manual installation methods, along with beta driver usage and troubleshooting techniques, you can maximize the performance of your system.

As a next step, consider configuring the Nvidia X Server settings to optimize your GPU performance. Additionally, if you plan to use CUDA-based applications, setting up the CUDA environment will be beneficial. Regular maintenance will ensure system stability and peak performance.

侍エンジニア塾