Skip to content
Home » Guide » [Ubuntu 22.04]How to install Nvidia Driver?

[Ubuntu 22.04]How to install Nvidia Driver?

Installing the Nvidia driver on Ubuntu 22.04 can improve your system’s graphics performance significantly, especially if you’re using an Nvidia graphics card for gaming, work, or other GPU-intensive tasks. This guide will walk you through the steps required to download, install, and configure Nvidia drivers on your system, ensuring smooth and reliable performance.

Step 1: Download Nvidia Driver from Official Website

Before we dive into installation, you need to download the right Nvidia driver for your GPU. You can find the official drivers on Nvidia’s website. Here’s how you do it:

•Go to the Official Advanced Driver Search page on Nvidia’s website.

•Select the appropriate driver for your graphics card based on the model and operating system version.

Important: Make sure you download the driver file to a directory with an English path to avoid any potential issues.

Step 2: Update Software List and Install Necessary Dependencies

Once the driver is downloaded, you’ll need to make sure your system is up to date and install some required packages and dependencies. Open your terminal and run the following commands:

				
					sudo apt-get update
sudo apt-get install g++
sudo apt-get install gcc
sudo apt-get install make
				
			

These commands will ensure that your system has the necessary development tools to install and build the Nvidia driver.

Step 3: Disable the Default Nouveau Driver

Ubuntu comes with the open-source Nouveau driver pre-installed, which can conflict with the Nvidia proprietary driver. Therefore, we need to disable it before proceeding with the Nvidia driver installation.

1.Open the blacklist.conf file by entering the following command in your terminal:

				
					sudo gedit /etc/modprobe.d/blacklist.conf
				
			

Alternatively, you can create a new configuration file specifically for disabling Nouveau:

				
					sudo gedit /etc/modprobe.d/blacklist-nouveau.conf
				
			

2.At the end of the file, add these two lines:

				
					blacklist nouveau
options nouveau modeset=0
				
			

3. Save the file and update your system’s initramfs image with the following command:

				
					sudo update-initramfs -u
				
			

After completing these steps, restart your computer. To check if Nouveau is disabled, run the following command:

				
					lsmod | grep nouveau
				
			

If no output is returned, it means Nouveau has been successfully disabled.

Step 4: Enter TTY Mode

At this point, we need to exit the graphical interface and enter TTY mode for the driver installation process.

1.To switch to TTY mode, run the following command:

				
					sudo telinit 3
				
			

2. If you want to return to the graphical interface later, you can use:

				
					sudo telinit 5
				
			

3. After switching to TTY mode, you will be prompted to log in. Enter your username and password. If you don’t remember your username, you can check it in the /home directory.

4.Now, stop the X-window service to prepare for the installation:

				
					sudo service gdm3 stop
				
			

Step 5: Install the Nvidia Driver

Now you’re ready to install the Nvidia driver you downloaded earlier. First, navigate to the directory where the driver file is located:

				
					cd /path/to/driver
				
			

Use the ls command to ensure that the driver file is in the current directory. Then, execute the following commands to give the driver file executable permissions and start the installation:

				
					sudo chmod 777 NVIDIA-Linux-x86_64-525.53.run
sudo ./NVIDIA-Linux-x86_64-525.53.run --no-opengl-files --no-x-check
				
			

Explanation of Options:

–no-opengl-files: Installs only the Nvidia driver files without OpenGL files.

–no-x-check: Disables the X service check during installation, preventing potential installation failures.

During the installation, you’ll be prompted with a couple of questions. Here’s how to answer:

Install Nvidia’s 32-bit compatibility libraries? – Choose No.

Would you like to run the nvidia-xconfig utility to automatically update your X configuration file? – Choose Yes.

This will complete the installation of the Nvidia driver.

Step 6: Return to the Graphical Interface

After the installation is finished, you’ll need to restart the X-window service to return to the graphical interface.

Run this command to start the service:

				
					sudo service gdm3 start
				
			

Once you’re back in the graphical interface, verify that the Nvidia driver is installed correctly by running:

				
					nvidia-smi
				
			

If everything is working as expected, you should see information about your Nvidia GPU and its status, confirming the successful installation of the driver.

Step 7: Common Issues You Might Encounter

1. TTY Mode Display Issues

If you enter TTY mode and see garbled text (especially if you’re not using an English system), you can fix this by setting the language environment variables:

				
					export LANG="UTF-8"
export LANGUAGE="UTF-8"
				
			

2. Black Screen After Returning to the Graphical Interface

If your screen goes black after returning to the graphical interface, check whether your HDMI cable is connected to the correct port. It should be connected to the GPU, not the motherboard’s HDMI port.

With these steps, you should have the Nvidia driver properly installed on your Ubuntu 22.04 system. If you face any other issues, consider visiting the official Nvidia forums or checking the logs for further troubleshooting.