第一步卸载原有驱动
sudo apt-get remove --purge nvidia*
#若安装失败是这样卸载
./NVIDIA-Linux-x86_64****.run --uninstall #确保卸载干净。
第二步安装可能需要的依赖
sudo apt-get update
sudo apt-get install dkms build-essential linux-headers-generic
sudo apt-get install gcc-multilib xorg-dev
sudo apt-get install freeglut3-dev libx11-dev libxmu-dev install libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
第三步禁用noueau驱动
sudo vi /etc/modprobe.d/blacklist-nouveau.conf
#在文件 blacklist-nouveau.conf 中加入如下内容:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
#保存 :wq
#禁用nouveau 内核模块
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
reboot #重启
lsmod |grep nouveau #无显示则成功 当然驱动没了你的桌面分辨率会比较大。
桌面分辨率大无需调整,安装完驱动后会恢复
第四步安装驱动
sudo chmod a+x NVIDIA-Linux-x86_64-460.32.03.run
sudo ./NVIDIA-Linux-x86_64-460.32.03.run -no-x-check -no-nouveau-check -no-opengl-files
安装驱动时报错:
WARNING: Unable to find a suitable destination to install 32-bit compatibility libraries. Your system may not be set up for 32-bit compatibility. 32-bit compatibility files will not be installed; if you wish to install them, re-run the installation and set a valid directory with the --compat32-libdir option
.
解决:
sudo aptitude install ia32-libs
又报错:
未发现 ia32-libs 的候选版本
未发现 ia32-libs 的候选版本
再次解决:
sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1
需要卸载驱动重新安装,成功!
参考:https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
sudo sh cuda_10.1.243_418.87.00_linux.run
输入:accept
安装cuda时一定要把驱动的减号关掉
安装完成后,添加路径在.bashrc文件中
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH12
更新环境
source ~/.bashrc
tar zxvf cudnn-10.1-linux-x64-v8.0.3.33.tgz
sudo cp cuda/include/cudnn_version.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -d
sudo chmod a+r /usr/local/cuda/include/cudnn_version.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
查看cudnn的版本
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
brach Anaconda3-2020.02-Linux-x86_64.sh
报错:RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /pytorch/aten/src/THC/THCGeneral.cpp:50
驱动挂了(输入nvidia-smi检查)
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver
解决:
卸载驱动(卸载后需重启电脑)
sudo /usr/bin/nvidia-uninstall
sudo reboot
安装驱动:
sudo chmod a+x NVIDIA-Linux-x86_64-460.32.03.run
sudo ./NVIDIA-Linux-x86_64-460.32.03.run -no-x-check -no-nouveau-check -no-opengl-files
检查ssh是否安装
ssh localhost
显示:ssh: connect to host localhost port 22: Connection refused
安装ssh步骤
sudo apt-get install openssh-server
启动ssh
sudo /etc/init.d/ssh start
检查ssh是否打开
ps -e|grep ssh