赞
踩
sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential cmake
图形界面相关
sudo apt install -y lightdm
注:在弹出对话框选择"lightdm"
打开ubuntu系统的“软件和更新”,点击“附加驱动”,选择“使用 NVIDIA driver metapackage 来自 nvidia-driver-535(专有)”,点击“应用更改”按钮,等待完成即可。
完成后验证指令:
nvidia-smi
弹出如下信息代表安装成功:
Thu Oct 12 11:19:09 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.113.01 Driver Version: 535.113.01 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:01:00.0 On | N/A |
| N/A 33C P8 6W / 60W | 70MiB / 4096MiB | 3% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 945 G /usr/lib/xorg/Xorg 65MiB |
+---------------------------------------------------------------------------------------+
进入如下网址:
https://www.nvidia.cn/
图:
点击右上角“驱动程序”,根据显卡型号需要选择相应选项:
图:
点击“搜索按钮”:
图:
点击“下载”按钮:
图:
点击“同意并开始下载”按钮,等待下载完成即可。下载得到“NVIDIA-Linux-x86_64-535.113.01.run”文件,将文件复制到英文路径的目录中,如:“/home/heqingchun/soft/nvidia”
sudo apt remove --purge nvidia*
sudo cp /etc/modprobe.d/blacklist.conf /etc/modprobe.d/blacklist.conf.backup
sudo gedit /etc/modprobe.d/blacklist.conf
在文件末尾添加如下内容
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
保存后关闭文件
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
reboot
执行以下内容,没有任何输出内容则为成功禁用
lsmod | grep nouveau
注意此时小键盘不可用,先输入用户名,再输入密码
sudo service lightdm stop
cd /home/heqingchun/soft/nvidia
chmod 755 NVIDIA-Linux-x86_64-535.113.01.run
-no-x-check:安装驱动时关闭X服务
-no-nouveau-check:安装驱动时禁用nouveau
-no-opengl-files:只安装驱动文件,不安装OpenGL文件
sudo ./NVIDIA-Linux-x86_64-535.113.01.run -no-x-check -no-nouveau-check -no-opengl-files
安装过程中一些选项选择:
1.
An alternate method of installing the NVIDIA driver was detected.(This is usually a package provided by your distributor.) A driver installed via that method may integrate better with you system than a driver installed by
naidia-installer.
Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:
Continue installation Abort installtion
The NVIDIA driver provided by Ubuntu can be installed by launching the "Software & Updates" application,and by selecting the NVIDIA driver from the "Additional Drivers" tab.
选择"Continue installation"
2.
Install NVIDIA's 32-bit compatibility libraries?
选择"No"
3.
Would you like to run the nvidia-xconfig utility to automatically update you X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.
选择"Yes"
4.
Your X configuration file has been successfully updated. Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64 (version:535.113.01) is now complete.
说明安装驱动成功。
注:重启后进入bios设置,确认:1.设置独显直连 2.关闭安全启动
sudo service lightdm start && reboot
终端输入以下命令
nvidia-smi
显示如下:
Thu Oct 12 11:19:09 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.113.01 Driver Version: 535.113.01 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:01:00.0 On | N/A |
| N/A 33C P8 6W / 60W | 70MiB / 4096MiB | 3% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 945 G /usr/lib/xorg/Xorg 65MiB |
+---------------------------------------------------------------------------------------+
网址
https://developer.nvidia.com/cuda-toolkit-archive
依次点击
在"Installation Instructions:"下方为下载安装指令
下载指令(文件需下载到英文路径),如:
cd /home/heqingchun/soft/nvidia
wget https://developer.download.nvidia.com/compute/cuda/11.6.2/local_installers/cuda_11.6.2_510.47.03_linux.run
在“/home/heqingchun/soft/nvidia”路径中下载得到“cuda_11.6.2_510.47.03_linux.run”文件
以下是安装时使用的指令
sudo sh cuda_11.6.2_510.47.03_linux.run
sudo apt remove --purge nvidia*
sudo cp /etc/modprobe.d/blacklist.conf /etc/modprobe.d/blacklist.conf.backup
sudo gedit /etc/modprobe.d/blacklist.conf
在文件末尾添加如下内容
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
保存后关闭文件
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
sudo update-initramfs -u
reboot
执行以下内容,没有任何输出内容则为成功禁用
lsmod | grep nouveau
注意此时小键盘不可用,先输入用户名,在输入密码
sudo service lightdm stop
chmod 755 cuda_11.6.2_510.47.03_linux.run
sudo sh cuda_11.6.2_510.47.03_linux.run
期间会弹出对话框,需手动输入"accept"回车
CUDA Installer │
│ - [X ] Driver │
│ [X ] 510.47.03 │
│ + [X] CUDA Toolkit 11.6 │
│ [X] CUDA Samples 11.6 │
│ [X] CUDA Demo Suite 11.6 │
│ [X] CUDA Documentation 11.6 │
│ Options │
│ Install
向下选择"install"后等待安装完毕即可。
注:重启后进入bios设置,确认:1.设置独显直连 2.关闭安全启动
sudo service lightdm start && reboot
终端输入以下命令
nvidia-smi
显示如下:
Thu Oct 12 11:19:09 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.113.01 Driver Version: 535.113.01 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:01:00.0 On | N/A |
| N/A 33C P8 6W / 60W | 70MiB / 4096MiB | 3% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 945 G /usr/lib/xorg/Xorg 65MiB |
+---------------------------------------------------------------------------------------+
ubuntu系统下安装nvidia显卡驱动3种方法-完毕
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。