In a previous article I shared with you a general method to install the AMD drivers on our system, now it's the turn for the Nvidia drivers. And with that we will share with you a general method to install these drivers in Linux.
Before starting the installation it is necessary that we know the model of our video card in order to download the appropriate driver from the official Nvidia website.
Just open the terminal and run the following command in it:
lspci | grep VGA
And we will receive the model on the screen.
Now also to download the driver we must know the architecture of our system, which we can know by typing in the terminal:
uname -m
Once this is done, we can go to the official Nvidia website and download the appropriate driver for our model, the link is this.
Driver Download
Generally, the version of the driver is usually the same for everyone and I say this speaking if our card is more or less recent, taking into account the last 5 years.
Entonces we can install a more current version of the long-support driver at this time, just type the following command in terminal, in case your system is 32-bit:
wget http://us.download.nvidia.com/XFree86/Linux-x86/390.77/NVIDIA-Linux-x86-390.77.run -O nvidia.run
If your system is 64-bit, the command to download the version for your architecture is:
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/390.77/NVIDIA-Linux-x86_64-390.77.run -O nvidia.run
Also we may be using a more current short-lived version of the driver at this time, We do this by typing in terminal in case of having a 32-bit system:
wget http://us.download.nvidia.com/XFree86/Linux-x86/396.24/NVIDIA-Linux-x86-396.24.run -O nvidia.run
And if your system is 64 bits must type the following:
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/396.24/NVIDIA-Linux-x86_64-396.24.run -O nvidia.run
Installing the Nvdia video driver on Linux
Once the download is done, it is important that we remember where the file was downloaded, as we will have to stop the graphical user session to install the driver on the system.
To stop the graphical session of the system, for this we must type one of the following commands depending on the manager that we are using and we must execute the following combination of keys, Ctrl + Alt + F1-F4.

Here we will be asked for our system login credentials, we log in and execute:
LightDM
sudo service lightdm stop
o
sudo /etc/init.d/lightdm stop
GDM
sudo service gdm stop
o
sudo /etc/init.d/gdm stop
MDM
sudo service mdm stop
o
sudo /etc/init.d/kdm stop
KDM
sudo service kdm stop
o
sudo /etc/init.d/mdm stop
Now We must position ourselves in the folder where the file was downloaded and we give it execution permissions with:
sudo chmod +x nvidia.run
Y finally we must run the installer with:
sudo sh nvidia-linux.run
At the end of the installation we must re-enable the session with:
LightDM
sudo service lightdm start
o
sudo /etc/init.d/lightdm start
GDM
sudo service gdm start
o
sudo /etc/init.d/gdm start
MDM
sudo service mdm start
o
sudo /etc/init.d/kdm start
KDM
sudo service kdm start
o
sudo /etc/init.d/mdm start
You can also choose to restart the computer so that the new changes and the driver are loaded and executed at system startup.
How to uninstall the NVIDIA driver on Linux?
In case we have to uninstall the Nvidia video driver from our systems, either because you had problems with the driver or you simply prefer to go back to using the open source video drivers.
For this It is necessary that we keep the file that we downloaded because it will support us with the process of uninstalling the system.
We just have to execute the following command.
sudo sh nvidia-linux.run --uninstall
You must remember that you have to stop the graphical session, so you must do it with the commands described above.
After uninstalling, we must re-enable the graphical session, with one of the commands described above and we can verify that we no longer have the driver installed.
You can also choose to just reboot the system so that the new changes are loaded at system startup.