I will give a bit more troubleshooting instructions.
First, ensure you have "Secure boot" in your BIOS->Security menu set to Disabled.
Then, from the accepted answer:
sudo apt purge "*nvidia*"
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update -y
sudo apt-get install aptitude
sudo aptitude install -y nvidia-driver-XXX
where XXX stands for the driver version you can find on this webpage: https://www.nvidia.com/Download/index.aspx?lang=en-us.
At this moment, you could try the following:
sudo modprobe nvidia
If this command produces no output, you can reboot first or straightaway check your installation with the following:
nvidia-smi
If the modprobe command fails, welcome to the jungle.
If it is something like:
modprobe: ERROR: could not insert 'nvidia': Key was rejected by service
The issue is "Secure boot" is set to Enabled. Otherwise, copy your problem in Google and browse official Nvidia forums for support.
Keep in mind:
- installing a driver from the official Nvidia download webpage is not recommended. Your distribution should know which driver version it should use by default.