NVIDIA驱动安装:
一. 英伟达官网下载驱动程序(选择对应自己显卡型号的驱动程序下载)
https://www.nvidia.cn/Download/index.aspx?lang=cn
二. 禁用nouveau第三方驱动
1. 打开编辑配置文件:
sudo gedit /etc/modprobe.d/blacklist.conf
2. 在最后一行添加(关闭Nouveau):
blacklist nouveau
3. 改好后执行命令:
sudo update-initramfs -u
4. 重启使之生效:
reboot
三. 安装驱动
1. 重启后按Ctrl+Alt+F1 进入命令行界面
2. 执行命令(若不出现什么东西代表nouveau禁用成功):
lsmod | grep nouveau
3. 禁用X服务:
sudo service lightdm stop
4. 进入runlevel 3:
sudo init 3
5. cd到驱动文件所在的路径,给驱动run文件赋予可执行权限:
sudo chmod +x ./your-nvidia-file.run
6. 安装:
sudo ./your-nvidia-file.run -no-opengl-files –no-x-check –no-nouveau-check
- –no-opengl-files 只安装驱动文件,不安装OpenGL文件。这个参数最重要(不添加可能出现无法进入桌面的问题)
- –no-x-check 安装驱动时不检查X服务
- –no-nouveau-check 安装驱动时不检查nouveau
安装过程中出现:
- The distribution-provided pre-install script failed! Are you sure you want to continue?
- The target kernel has CONFIG_MODULE_SIG set, which means that it supports cryptographic signatures on kernel modules. .....................
- ERROR: The kernel module failed to load, because it was not signed by a key that is trusted by the kernel .Please try installing the driver again, and sign the kernel module when prompted to do so.
- ERROR: Unable to load the kernel module 'nvidia.ko'. This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if another driver, such as nouveau, is present and prevents the NVIDIA kernel module from obtainning ownership of the NVIDIA GPU(s), or no NVIDIA GPU installed in this system is supported ...............
说明你的主板设置了安全启动项,需要进入bios关闭它。
参考:https://blog.youkuaiyun.com/qq_29650553/article/details/81028739
正常安装过程出现:
- “sources with DKMS?This will allow DKMS to auomatically build a new module,if you install a different kernel later”:选择NO
- 是否使用nv的xconfig文件:选择YES
- 其他部分默认选项就好
7. 开启X服务:
sudo /etc/init.d/lightdm start
cuda安装
cuda下载:
cuda安装教程:
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions
(ps:cuda卸载命令 :sudo apt-get --purge remove cuda )
cudnn
下载(需要注册账号获得):https://developer.nvidia.com/rdp/cudnn-archive
安装教程1(需要注册账号获得):
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
或者参考我copy下来的教程:
安装教程2:https://blog.youkuaiyun.com/qq_29650553/article/details/81032564
oepncv
下载:https://opencv.org/releases.html
安装教程:https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
附:opencv配置环境变量
$sudo vi /etc/ld.so.conf.d/opencv.conf
加上/usr/local/lib
$sudo ldconfig
$vi ~/.bashrc
在文件后加上
PKG_CONFIG_PATH=$PKG_COFNIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
ffmpeg
安装: