Skip to content

Instantly share code, notes, and snippets.

@nanmi
Last active May 13, 2022 07:25
Show Gist options
  • Save nanmi/750c8906a4552508d2caa9e46a4752df to your computer and use it in GitHub Desktop.
Save nanmi/750c8906a4552508d2caa9e46a4752df to your computer and use it in GitHub Desktop.
Install nvidia driver

NV显卡驱动安装

卸载驱动

cd /usr/bin
./nvidia-uninstall
sudo apt-get --purge remove "*nvidia*"
sudo apt autoremove

# To remove CUDA Toolkit:
sudo apt-get --purge remove "*cublas*" "cuda*"

禁用nouveau

安装nvidia显卡驱动首先需要禁用nouveau,不然会碰到冲突的问题,导致无法安装nvidia显卡驱动

/etc/modprobe.d/blacklist.conf末尾添加

blacklist nouveau
options nouveau modeset=0

更新系统修改

sudo update-initramfs -u
sudo rmmod nouveau

输入指令后重启系统(一定要重启),确保到位

验证nouveau是否已禁用

lsmod | grep nouveau

下载驱动文件并指令安装

关闭图形界面(不执行后面会出错)

sudo service lightdm stop

安装依赖

sudo apt install build-essential
# 该命令将安装一堆新包,包括gcc,g ++和make。

安装

sudo chmod  a+x NVIDIA-Linux-x86_64-396.18.run
sudo ./NVIDIA-Linux-x86_64-396.18.run -no-x-check -no-nouveau-check -no-opengl-files

#The distribution-provided pre-install script failed! Are you sure you want to continue? 
#选择 yes 继续。

#Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later?  
#选择 No 继续。

#Install NVIDIA's 32-bit compatibility libraries? 
#选择 No 继续。

#Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up. 
#选择 Yes 继续
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment