当前位置: 首页 > news >正文

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

文章目录

  • 前言
  • 下载英伟达NVIDIA官方驱动
  • 安装NVIDIA驱动
    • 远程安装关闭交互界面
    • 设置权限(自己确认版本号5×××)
    • 安装(自己确认版本号5×××)
    • 打开交互界面,并重启系统
    • 验证是否安装成功
  • 异常处理
    • 问题1
    • 问题2
    • 问题3(可能没解决)
    • 问题4
    • 问题5
    • 问题6:
  • 删除NVIDIA驱动
    • 停止NVIDIA服务
    • 删除驱动程序
      • 对于基于Debian的系统(如Ubuntu):
      • 对于基于Red Hat的系统(如Fedora):
      • 或者对于旧版本:
      • 对于基于Arch Linux的系统:
      • 清理配置文件(可选)
      • 重启计算机

前言

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

  • 有何疑问欢迎加好友咨询
    在这里插入图片描述

下载英伟达NVIDIA官方驱动

  • https://www.nvidia.cn/drivers/lookup/
  • 按各自的型号查找相应的驱动
    在这里插入图片描述
  • 点击“查看”
    在这里插入图片描述
    点击“下载”
    在这里插入图片描述
  • 下载后将文件传输到服务器
    在这里插入图片描述
    在这里插入图片描述

安装NVIDIA驱动

  1. 远程安装关闭交互界面

sudo systemctl set-default multi-user.target
sudo reboot
  1. 设置权限(自己确认版本号5×××)

sudo chmod a+x NVIDIA-Linux-x86_64-5xxx.run
  1. 安装(自己确认版本号5×××)

sudo ./NVIDIA-Linux-x86_64-5×××.run
  • 进入安装页面,点击ok
    在这里插入图片描述
  • 点击Continue installation在这里插入图片描述
  • 点击ok
    在这里插入图片描述
  • 点击Continue installation
    在这里插入图片描述
    -等待安装
    在这里插入图片描述
  • 点击No,不安装32bit的兼容版,肯定要64位的高性能
    在这里插入图片描述
  • 点击No,不主动更新
    在这里插入图片描述
  • 安装完成
    在这里插入图片描述
  • 提示重启
    在这里插入图片描述
  1. 打开交互界面,并重启系统

sudo systemctl set-default graphical.target
sudo reboot
  1. 验证是否安装成功

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.

  • 解决
sudo apt install build-essential
  • 验证GCC安装
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.

  • 解决
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

  • 解决:
sudo apt-get install --reinstall xserver-xorg xserver-xorg-core
  • 验证模块路径
pkg-config --variable=moduledir xorg-server
  • 如果返回的路径不存在,您可能需要创建这个路径:
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.

  • 解决:
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.

  • 解决:
sudo apt update
sudo apt install vulkan-loader

验证安装

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.

  • 解决
sudo apt install libglvnd-dev

删除NVIDIA驱动

仅作备用,可不要安装完驱动就删除了
在Linux系统中删除NVIDIA驱动,你可以按照以下步骤操作:

停止NVIDIA服务

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

sudo systemctl stop nvidia

删除驱动程序

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

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

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):

sudo dnf remove nvidia*

或者对于旧版本:

sudo yum remove nvidia*

对于基于Arch Linux的系统:

sudo pacman -R nvidia

清理配置文件(可选)

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

sudo rm /etc/X11/xorg.conf
sudo rm /etc/X11/xorg.conf.d/nvidia*

重启计算机

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

sudo reboot

http://www.mrgr.cn/news/14833.html

相关文章:

  • Web3与人工智能的完美结合:如何重塑数字未来
  • vue3如何监听reactive对象是哪个属性发生的变化
  • 11.舵机控制
  • Gitlab迁移到新的服务器后点击Integrations报500错误的解决方法
  • 第8章 Android数据存储与I/O
  • 【C#】【EXCEL】Bumblebee/Classes/ExWorksheet.cs
  • 【附源码】Python :三棱锥建模
  • IO进程线程 0828作业
  • Threejs之WebGLRenderer渲染器
  • InstantID: Zero-shot Identity-Preserving Generation in Seconds
  • 【leetcode】C++_string 917.仅仅反转字母
  • PyTest测试框架学习日记
  • 【SQL】关注者数量
  • 单片机的主流编程语言是什么
  • 学习大数据DAY43 Sqoop 安装,配置环境和使用
  • Leetcode 216.组合总和Ⅲ 回溯+剪枝 C++实现
  • k8s集群环境搭建(一主二从--kubeadm安装)
  • 分享5款支持论文写作网站先稿后付的网站!
  • [000-01-001].第04节:Shell中的内置命令
  • Android架构组件:MVVM模式的实战应用与数据绑定技巧