linux系统,ubuntu安装英伟达NVIDIA4090显卡驱动

文章目录

前言

本人系统是使用ubuntu24.04,本来是安装centos7的,但由于核显和显卡版本太高,centos不支持,而且centos7后续也不更新了,所以选择了ubuntu

对于ubuntu系统的安装可以查看:ubuntu系统安装

  • 有何疑问欢迎加好友咨询

下载英伟达NVIDIA官方驱动

安装NVIDIA驱动

远程安装关闭交互界面

shell 复制代码
sudo systemctl set-default multi-user.target
sudo reboot

设置权限(自己确认版本号5×××)

shell 复制代码
sudo chmod a+x NVIDIA-Linux-x86_64-5xxx.run

安装(自己确认版本号5×××)

shell 复制代码
sudo ./NVIDIA-Linux-x86_64-5×××.run
  • 进入安装页面,点击ok
  • 点击Continue installation
  • 点击ok
  • 点击Continue installation

    -等待安装
  • 点击No,不安装32bit的兼容版,肯定要64位的高性能
  • 点击No,不主动更新
  • 安装完成
  • 提示重启

打开交互界面,并重启系统

shell 复制代码
sudo systemctl set-default graphical.target
sudo reboot

验证是否安装成功

shell 复制代码
nvidia-smi
  • 此处可以看到你的驱动版本,CUDA版本,显卡型号,显存,和实际一直即可

异常处理

问题1

ERROR: Unable to find the development tool cc in your path; please make sure that you have the package 'gcc' installed.

If gcc is installed on your system, then please check that cc is in your PATH.

  • 解决
shell 复制代码
sudo apt install build-essential
  • 验证GCC安装
shell 复制代码
gcc --version

问题2

WARNING: nvidia-installer was forced to guess the X library path '/usr/lib' and X module path '/usr/lib/xorg/modules'; these

paths were not queryable from the system. If X fails to find the NVIDIA X driver module, please install the
pkg-config utility and the X.Org SDK/development package for your distribution and reinstall the driver.

  • 解决
shell 复制代码
sudo apt-get install pkg-config
sudo apt-get install xorg-dev

问题3(可能没解决)

WARNING: You appear to be using a modular X.Org release, but the X module installation path, '/usr/lib/xorg/modules',

reported by /usr/bin/pkg-config --variable=moduledir xorg-server does not exist. Please check yo

  • 解决:
shell 复制代码
sudo apt-get install --reinstall xserver-xorg xserver-xorg-core
  • 验证模块路径
shell 复制代码
pkg-config --variable=moduledir xorg-server
  • 如果返回的路径不存在,您可能需要创建这个路径:
shell 复制代码
sudo mkdir -p /usr/lib/xorg/modules

问题4

WARNING: You appear to be using a modular X.Org release, but the X module installation path, '/usr/lib/xorg/modules',

reported by /usr/bin/pkg-config --variable=moduledir xorg-server does not exist. Please check your X.Org

installation.

  • 解决:
shell 复制代码
sudo apt-get install xserver-xorg-video-all

问题5

WARNING: This NVIDIA driver package includes Vulkan components, but no Vulkan ICD loader was detected on this system. The

NVIDIA Vulkan ICD will not function without the loader. Most distributions package the Vulkan loader; try

installing the "vulkan-loader", "vulkan-icd-loader", or "libvulkan1" package.

  • 解决:
shell 复制代码
sudo apt update
sudo apt install vulkan-loader

验证安装

shell 复制代码
vulkaninfo

问题6:

WARNING: Unable to determine the path to install the libglvnd EGL vendor library config files. Check that you have

pkg-config and the libglvnd development libraries installed, or specify a path with --glvnd-egl-config-path.

  • 解决
shell 复制代码
sudo apt install libglvnd-dev

删除NVIDIA驱动

仅作备用,可不要安装完驱动就删除了

在Linux系统中删除NVIDIA驱动,你可以按照以下步骤操作:

停止NVIDIA服务

首先,你需要停止正在运行的NVIDIA相关服务。

sh 复制代码
sudo systemctl stop nvidia

删除驱动程序

然后,你可以使用包管理器来卸载NVIDIA驱动。以下是针对不同包管理器的命令:

对于基于Debian的系统(如Ubuntu):

sh 复制代码
sudo apt purge nvidia* -y
sudo apt remove nvidia-* -y
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt autoremove -y && sudo apt autoclean -y
sudo rm -rf /usr/local/cuda*

对于基于Red Hat的系统(如Fedora):

sh 复制代码
sudo dnf remove nvidia*

或者对于旧版本:

sh 复制代码
sudo yum remove nvidia*

对于基于Arch Linux的系统:

sh 复制代码
sudo pacman -R nvidia

清理配置文件(可选)

如果你想彻底删除NVIDIA驱动,也可以选择删除相关的配置文件:

sh 复制代码
sudo rm /etc/X11/xorg.conf
sudo rm /etc/X11/xorg.conf.d/nvidia*

重启计算机

完成以上步骤后,重启计算机:

sh 复制代码
sudo reboot
相关推荐
芊言芊语2 分钟前
CentOS详细解析及其配置方法
linux
杨~friendship6 分钟前
Ubuntu上使用qt和opencv显示图像
linux·开发语言·c++·qt·opencv·ubuntu
镭速16 分钟前
远程跨境传输大文件如何做到安全又稳定?
运维·服务器·安全
laizhenghua30 分钟前
Linux定时启动jar应用shell脚本分享
linux
Flying_Fish_roe31 分钟前
linux-安全管理-SSH 安全管理
linux·安全·ssh
没有名字的小羊1 小时前
fastjson漏洞
运维·网络·web安全·中间件
成都古河云2 小时前
智慧园区:解析集成运维的未来之路
大数据·运维·人工智能·科技·5g·安全
ZH_qaq2 小时前
Linux 常用指令
linux·运维·服务器
码哝小鱼2 小时前
Openssl升级
linux·运维·服务器
Dragon_qu·x2 小时前
Certbot 生成 SSL 证书并配置自动续期
运维·网络协议·https·ssl