INSTALLING NVIDIA DRIVERS ON RHEL OR CENTOS 7

本文详细介绍了如何在Linux系统上安装NVIDIA显卡驱动,并禁用自带的nouveau驱动,确保驱动与最新内核兼容。包括更新系统、安装必要软件包、下载驱动、编辑配置文件、重建初始化映像等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Most users of NVIDIA graphics cards prefer to use the drivers provided by NVIDIA. These more fully support the capabilities of the card when compared to the nouveau driver that is included with the distribution. These are the steps to install the NVIDIA driver and disable the nouveau driver.

Prepare your machine

yum -y update
yum -y groupinstall "GNOME Desktop" "Development Tools"
yum -y install kernel-devel

Download the latest NVIDIA driver for unix.
==> http://www.nvidia.com/object/unix.html ==> Latest Long Lived Branch version
Note: If using a recently released, top end GTX or Tesla you may get more support with the Latest Short Lived Branch instead.

In order to have the NVIDIA drivers rebuilt automatically with future kernel updates you can also install the EPEL repository and the DKMS package. This is optional.

yum -y install epel-release
yum -y install dkms

Reboot your machine to make sure you are running the newest kernel

Edit /etc/default/grub. Append the following to “GRUB_CMDLINE_LINUX

rd.driver.blacklist=nouveau nouveau.modeset=0

Generate a new grub configuration to include the above changes.

grub2-mkconfig -o /boot/grub2/grub.cfg

Edit/create /etc/modprobe.d/blacklist.conf and append:

blacklist nouveau

Backup your old initramfs and then build a new one

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)

Reboot your machine

If your machine doesn’t boot to a login prompt disconnect your monitor from the graphics card and plug directly into the onboard VGA port. Alternatively SSH directly into the machine.

The NVIDIA installer will not run while X is running so switch to text mode:

systemctl isolate multi-user.target

Run the NVIDIA driver installer and enter yes to all options.

sh NVIDIA-Linux-x86_64-*.run

Reboot your machine

Optionally install NVIDIA’s CUDA Toolkit
Download the latest CUDA Toolkit (runfile installer option, not the rpm download)
==> https://developer.nvidia.com/cuda-downloads ==> Linux ==> x86_64 ==> RHEL/CentOS ==> 7 ==> runfile (local)

Run the CUDA installer.

sh cuda_*.run

Say no to installing the NVIDIA driver. The standalone driver you already installed is typically newer than what is packaged with CUDA. Use the default option for all other choices.

To add CUDA to your environment add the following files.

Create /etc/profile.d/cuda.sh
PATH=$PATH:/usr/local/cuda/bin
export PATH

Create /etc/profile.d/cuda.csh
set path = ( $path /usr/local/cuda/bin )

Create /etc/ld.so.conf.d/cuda.conf
/usr/local/cuda/lib64
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值