第一步:查看显卡类型
[root@localhost ~]# lshw -numeric -C display
显示显卡类型:product: GK107 [GeForce GTX 650] [10DE:FC6]
显示驱动是nouveau:configuration: driver=nouveau latency=0
Nouveau是第三方为NVIDIA显卡开发的一个开源3D驱动,没有得到NVIDIA的认可与支持。
第二步:到nvidia官网下载对应驱动 https://www.nvidia.com/Download/index.aspx#
NVIDIA-Linux-x86_64-440.44.run
第三步:安装驱动所依赖的软件包
# yum groupinstall "Development Tools"
# yum install kernel-devel epel-release
# yum install dkms
第四步:禁用nouveau,通过修改配置 /etc/default/grub
[root@localhost ~]# vi /etc/default/grub
原来的设置
1 GRUB_TIMEOUT=5 2 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" 3 GRUB_DEFAULT=saved 4 GRUB_DISABLE_SUBMENU=true 5 GRUB_TERMINAL_OUTPUT="console" 6 GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet" 7 GRUB_DISABLE_RECOVERY="true" 8 GRUB_ENABLE_BLSCFG=true
新的设置
1 GRUB_TIMEOUT=5 2 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" 3 GRUB_DEFAULT=saved 4 GRUB_DISABLE_SUBMENU=true 5 GRUB_TERMINAL_OUTPUT="console" 6 GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet nouveau.modeset=0" 7 GRUB_DISABLE_RECOVERY="true" 8 GRUB_ENABLE_BLSCFG=true
执行
grub2-mkconfig -o /boot/grub2/grub.cfggrub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
使配置生效
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Adding boot menu entry for EFI firmware configuration done [root@localhost ~]# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg Generating grub configuration file ... Adding boot menu entry for EFI firmware configuration done
第五步:重启centos,确认配置生效,nouveau不再使用
[root@localhost ~]# lshw -numeric -C display *-display UNCLAIMED description: VGA compatible controller product: GK107 [GeForce GTX 650] [10DE:FC6] vendor: NVIDIA Corporation [10DE] physical id: 0 bus info: pci@0000:02:00.0 version: a1 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress vga_controller bus_master cap_list configuration: latency=0 resources: memory:fa000000-faffffff memory:e0000000-efffffff memory:f0000000-f1ffffff ioport:e000(size=128) memory:c0000-dffff
第六步:安装Nvidia驱动时,必须停止Xorg服务,转成text模式
[root@localhost ~]# systemctl isolate multi-user.target
第七步:安装,运行命令:bash NVIDIA-Linux-x86_64-440.44.run,一路yes
[root@localhost ~]# ls
公共 视频 文档 音乐 anaconda-ks.cfg eye.txt hello index.php learning_log NVIDIA-Linux-x86_64-440.44.run
模板 图片 下载 桌面 a.out git hello.c initial-setup-ks.cfg mysql80-community-release-el8-1.noarch.rpm scikit_learn_data
[root@localhost ~]# bash NVIDIA-Linux-x86_64-440.44.run
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 440.44........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
[root@localhost ~]#
第八步:重启后,进入终端运行:nvidia-settings
进入 NVIDIA X Server Settings
来源:https://www.cnblogs.com/ttrrpp/p/12175322.html