本篇为安装CUDA作准备
1.删除原有NVIDIA驱动
sudo apt-get remove –purge nvidia*
2.在BIOS的security选项中禁用secure boot
3.禁用nouveau
sudo gedit /etc/modprobe.d/blacklist.conf
在最后一行添加
blacklist nouveau
执行
sudo update-initramfs -u
重启,
lsmod | grep nouveau # 没输出代表禁用生效
4.查询自己的显卡型号
lshw -numeric -C display
WARNING: you should run this program as super-user.
*-display
description: VGA compatible controller
product: HD Graphics 5500 [8086:1616]
vendor: Intel Corporation [8086]
physical id: 2
bus info: pci@0000:00:02.0
version: 09
width: 64 bits
clock: 33MHz
capabilities: vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:49 memory:a1000000-a1ffffff memory:b0000000-bfffffff ioport:5000(size=64) memory:c0000-dffff
*-display
description: 3D controller
product: GM107M [GeForce 940M] [10DE:139C]
vendor: NVIDIA Corporation [10DE]
physical id: 0
bus info: pci@0000:04:00.0
version: a2
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list rom
configuration: driver=nvidia latency=0
resources: irq:16 memory:a2000000-a2ffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:3000(size=128) memory:a3000000-a307ffff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.
我的笔记本的显卡是940M
从Nvidia驱动下载页面下载对因显卡型号和系统的驱动文件。
5.安装
sudo chmod a+x NVIDIA-Linux-x86_64-418.43.run
sudo ./NVIDIA-Linux-x86_64-418.43.run --no-opengl-files --no-x-check --no-nouveau-check
- –no-opengl-files 只安装驱动文件,不安装OpenGL文件。这个参数最重要
- –no-x-check 安装驱动时不检查X服务
- –no-nouveau-check 安装驱动时不检查nouveau
如果遇到./nvidia-installer: unrecognized option:
sudo ./NVIDIA-Linux-x86_64-418.43.run -A #查询高级选项
返回
-v, --version
Print the nvidia-installer version and exit.
-h, --help
Print usage information for the common commandline options and exit.
-A, --advanced-options
Print usage information for the common commandline options as well as the
advanced options, and then exit.
-a, --accept-license
This option is obsolete and ignored by nvidia-installer. It is provided
for compatibility with older versions of nvidia-installer, which required
this option for explicit license acceptance. Use of the NVIDIA driver
implies acceptance of the NVIDIA Software License Agreement, contained in
the file 'LICENSE' (in the top level directory of the driver package).
-i, --driver-info
Print information about the currently installed NVIDIA driver version.
--uninstall
Uninstall the currently installed NVIDIA driver.
--skip-module-unload
When uninstalling the driver, skip unloading of the NVIDIA kernel module.
This option is ignored when the driver is being installed.
--sanity
Perform basic sanity tests on an existing NVIDIA driver installation.
-e, --expert
Enable 'expert' installation mode; more detailed questions will be asked,
and more verbose output will be printed; intended for expert users. The
questions may be suppressed with the '--no-questions' commandline
option.
-q, --no-questions
Do not ask any questions; the default (normally 'yes') is assumed for all
yes/no questions, and the default string is assumed in any situation
where the user is prompted for string input.
-s, --silent
Run silently; no questions are asked and no output is printed, except for
error messages to stderr. This option implies '--ui=none
--no-questions'.
--x-prefix=X-PREFIX
The prefix under which the X components of the NVIDIA driver will be
installed; the default is '/usr/X11R6' unless nvidia-installer detects
that X.Org >= 7.0 is installed, in which case the default is '/usr'.
Only under rare circumstances should this option be used.
--xfree86-prefix=XFREE86-PREFIX
This is a deprecated synonym for --x-prefix.
--x-module-path=X-MODULE-PATH
The path under which the NVIDIA X server modules will be installed. If
this option is not specified, nvidia-installer uses the following search
order and selects the first valid directory it finds: 1) `X
-showDefaultModulePath`, 2) `pkg-config --variable=moduledir
xorg-server`, or 3) the X library path (see the '--x-library-path'
option) plus either 'modules' (for X servers older than X.Org 7.0) or
'xorg/modules' (for X.Org 7.0 or later).
--x-library-path=X-LIBRARY-PATH
The path under which the NVIDIA X libraries will be installed. If this
option is not specified, nvidia-installer uses the following search order
and selects the first valid directory it finds: 1) `X
-showDefaultLibPath`, 2) `pkg-config --variable=libdir xorg-server`, or
3) the X prefix (see the '--x-prefix' option) plus 'lib' on 32bit
systems, and either 'lib64' or 'lib' on 64bit systems, depending on the
installed Linux distribution.
--x-sysconfig-path=X-SYSCONFIG-PA