centos nvidia驱动安装

1预先准备

1、Linux查看显卡信息:(ps:若找不到lspci命令,可以安装 yum install pciutils)
lspci | grep -i vga
2、使用nvidia GPU可以:
lspci | grep -i nvidia
3、查看显卡驱动
cat /proc/driver/nvidia/version

一、前提准备

1.安装依赖环境:

yum install kernel-devel gcc -y

2.检查内核版本和源码版本,保证一致

ls /boot | grep vmlinu

rpm -aq | grep kernel-devel

image

3.屏蔽系统自带的nouveau

查看命令:
lsmod | grep nouveau

修改dist-blacklist.conf文件:
vim /lib/modprobe.d/dist-blacklist.conf

将nvidiafb注释掉:
#blacklist nvidiafb 

然后添加以下语句:
blacklist nouveau
options nouveau modeset=0

屏蔽前

image

屏蔽后

image

4.重建initramfs image步骤

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

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

5.修改运行级别为文本模式

systemctl set-default multi-user.target

6.重新启动

reboot

二、本地安装

1.在NVIDIA官网下载驱动

网址:https://www.nvidia.cn/Download/index.aspx?lang=cn

image
image

2.安装过程

chmod +x NVIDIA-Linux-x86_64-440.64.run

./NVIDIA-Linux-x86_64-440.64.run

安装过程中的一些选项

The distribution-provided pre-install script failed! Are you sure you want to continue? 选择 yes 继续。
Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later?  选择 No 继续。
问题没记住,选项是:install without signing
问题大概是:Nvidia's 32-bit compatibility libraries? 选择 No 继续。
Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up.  选择 Yes  继续

这些选项如果选择错误可能会导致安装失败,没关系,只要前面不出错,多尝试几次就好。

3.如果报错 unable to find the kernel source tree for the currently running kernel.........,使用下面命令安装,3.10.0-1062.18.1.el7.x86_64需要改成自己的目录

4.安装成功

nvidia-smi
image

5.重新切回默认图形模式

systemctl set-default graphical.target

你可能感兴趣的:(centos nvidia驱动安装)