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
相关推荐
likfishdn10 分钟前
Linux的文件与目录管理
linux·运维·服务器
chian-ocean30 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=32 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
若云止水41 分钟前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_init_cycle 函数 - 详解(4)
数据库·nginx·ubuntu
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos
北京耐用通信1 小时前
航空装配自动化神器Ethercat转profient网关搭配机器人精准控制
运维·机器人·自动化
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net