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
相关推荐
小林up8 分钟前
github push:ssh: connect to host github.com port 22
运维·ssh·github
梁bk3 小时前
[Nginx]反向代理和负载均衡
运维·nginx·负载均衡
2401_826097628 小时前
JavaEE-Linux环境部署
java·linux·java-ee
(:满天星:)9 小时前
第31篇:块设备与字符设备管理深度解析(基于OpenEuler 24.03)
linux·运维·服务器·网络·centos
小陶来咯9 小时前
【仿muduo库实现并发服务器】Acceptor模块
运维·服务器
爱莉希雅&&&9 小时前
shell编程之awk命令详解
linux·服务器·git
笑稀了的野生俊9 小时前
在服务器中下载 HuggingFace 模型:终极指南
linux·服务器·python·bash·gpu算力
cui_hao_nan9 小时前
Docker后端部署
运维·docker·容器
渡我白衣9 小时前
Linux操作系统之文件(四):文件系统(上)
linux
ZZH1120KQ10 小时前
Linux系统安全及应用
linux·运维·系统安全