Ubuntu22.04 安装显卡驱动

目录

参考:

1. 修改软件源

2. 查看可安装的驱动版本

3. 下载NVIDIA驱动

4. 安装驱动前一定要更新软件列表和安装必要软件、依赖(必须)

5. 禁用 nouveau

5.1. 打开文件blacklist.conf

5.2. 向文件中写入以下两行内容

5.3. 更新系统

5.4. 验证是否禁用成功

6. 卸载原有驱动

7. 安装

7.1. 进入命令行界面[1]

7.2. 关闭显示服务[1]

7.3. 给安装文件赋予权限,然后运行安装[2]

7.4. 安装过程的一些选项:[2]

7.4.1. An alternate method of installing the NVIDIA driver was detected. (xxxxxxxxxxxxx).Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:

7.4.2. Install NVIDIA's 32-bit compatibility libraries?

7.4.3. Would you like to run the nvidia-xconfig utility to aotumatically update your 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.

7.5. 打开显示服务[1]

8. 验证


参考:

1.ubuntu22.04安装nvidia显卡驱动——超详细、最简单 - 知乎

2.ubuntu18.04重新安装nvidia驱动_an alternate method of installing the nvidia drive_weixin_44842237的博客-CSDN博客

1. 修改软件源

打开 应用程序 —— 软件和更新,在 Ubuntu 软件 界面,点下载自的下拉菜单,选阿里云的源

2. 查看可安装的驱动版本

打开终端,输入

sudo ubuntu-drivers devices

最新的有点太新了,为了避免之后很多的问题,选个第二新的就行,所以选525的。

3. 下载NVIDIA驱动

在 NVIDIA 官网下载适合自己电脑的驱动 NVIDIA GeForce 驱动程序 - N 卡驱动 | NVIDIA

我的设备参数对应如下图:

选择下图525版本,小数点后面一般找个新一点的,获取下载

4. 安装驱动前一定要更新软件列表和安装必要软件、依赖(必须)

参考[1].

sudo apt-get update #更新软件列表

sudo apt-get install g++

sudo apt-get install gcc

sudo apt-get install make

5. 禁用 nouveau

参考[2]。

nouveau是Ubuntu自带的显卡驱动,但他是核显,我这里想安装独显,就得把他禁掉。

5.1. 打开文件blacklist.conf

sudo gedit /etc/modprobe.d/blacklist-nouveau.conf

5.2. 向文件中写入以下两行内容

blacklist nouveau
options nouveau modeset=0

5.3. 更新系统

sudo update-initramfs -u

5.4. 验证是否禁用成功

lsmod | grep nouveau

若没有任何输出,则禁用成功。

6. 卸载原有驱动

参考[2].

sudo apt-get remove nvidia-*

卸载完后如图:(这个图是网上找的)

7. 安装

7.1. 进入命令行界面[1]

sudo telinit 3

(这时进入了黑色的命令行界面,不要慌,先会输入用户名和密码)

7.2. 关闭显示服务[1]

Ubuntu22.04的显示是gdm3,老版本Ubuntu的显示是lightdm

sudo service gdm3 stop

7.3. 给安装文件赋予权限,然后运行安装[2]

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

注:只有禁用opengl这样安装才不会出现循环登陆的问题

-no-x-check:安装驱动时关闭X服务
-no-nouveau-check:安装驱动时禁用nouveau
-no-opengl-files:只安装驱动文件,不安装OpenGL文件

7.4. 安装过程的一些选项:[2]

7.4.1. An alternate method of installing the NVIDIA driver was detected. (xxxxxxxxxxxxx).Please review the message provided by the maintainer of this alternate installation method and decide how to proceed:

选 continue installation

7.4.2. Install NVIDIA's 32-bit compatibility libraries?

选 no

7.4.3. Would you like to run the nvidia-xconfig utility to aotumatically update your 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.

选 no

7.5. 打开显示服务[1]

sudo service gdm3 start

8. 验证

nvidia-smi

猜你喜欢

转载自blog.csdn.net/qq_45461410/article/details/131605719