linux系统,ubuntu安装英伟达NVIDIA4090显卡驱动
本人系统是使用ubuntu24.04,本来是安装centos7的,但由于核显和显卡版本太高,centos不支持,而且centos7后续也不更新了,所以选择了ubuntuubuntu系统安装。
文章目录
前言
本人系统是使用ubuntu24.04,本来是安装centos7的,但由于核显和显卡版本太高,centos不支持,而且centos7后续也不更新了,所以选择了ubuntu
对于ubuntu系统的安装可以查看:ubuntu系统安装
- 有何疑问欢迎加好友咨询
下载英伟达NVIDIA官方驱动
- https://www.nvidia.cn/drivers/lookup/
- 按各自的型号查找相应的驱动
- 点击“查看”
点击“下载”
- 下载后将文件传输到服务器
安装NVIDIA驱动
sudo systemctl set-default multi-user.target
sudo reboot
sudo chmod a+x NVIDIA-Linux-x86_64-5xxx.run
sudo ./NVIDIA-Linux-x86_64-5×××.run
- 进入安装页面,点击ok
- 点击Continue installation
- 点击ok
- 点击Continue installation
-等待安装
- 点击No,不安装32bit的兼容版,肯定要64位的高性能
- 点击No,不主动更新
- 安装完成
- 提示重启
sudo systemctl set-default graphical.target
sudo reboot
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
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)