首先找到显卡型号:
[root@localhost ~]# lspci |grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation G84GLM [Quadro FX 570M] (rev a1)
再详细列出使用驱动:
[kras@localhost ~]$ lspci -v -s 1:00
01:00.0 VGA compatible controller: NVIDIA Corporation G84GLM [Quadro FX 570M] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Lenovo ThinkPad T61p
Flags: bus master, fast devsel, latency 0, IRQ 50
Memory at d6000000 (32-bit, non-prefetchable) [size=16M]
Memory at e0000000 (64-bit, prefetchable) [size=256M]
Memory at d4000000 (64-bit, non-prefetchable) [size=32M]
I/O ports at 2000 [size=128]
Expansion ROM at <unassigned> [disabled]
Capabilities: <access denied>
Kernel driver in use: nouveau
我们剩下的工作就是屏蔽掉系统自带的nouveau驱动,装上NVIDIA驱动。
接着找与系统版本相对应的驱动版本,怎么相对应就是“你猜,猜,猜,猜!”难怪Linus Torvalds 会对NVIDIA比中指,say “FUCK!”
一般是去官网找长效稳定版,我的运气还不错,系统是centos 7 3.10.0-123.el7.x86_64 一下就找对了用 NVIDIA-Linux-x86_64-340.32.run。
而FC17上我只能用kmod-nvidia-310.XX-x86_64.rpm安装成功过,内核还必须是最新。
具体安装方法如下:
1、 从 kernel initramfs 中移除/禁止 nouveau 驱动,重建initramfs镜像文件.
[root@localhost ~]# mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
[root@localhost ~]#dracut /boot/initramfs-$(uname -r).img $(uname -r)
2、从启动内核参数禁用nouveau驱动(实测这项有用)
[root@localhost ~]# vi /etc/grub2/grub.cfg
kernel /vmlinuz-2.6.31.1-56.fc12.i686.PAE ro root=UUID=0a86cf1f-ea02-4016-9c15-c9c537489eaf LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet rdblacklist=nouveau
3、进入init 3模式安装NVIDIA-Linux-x86_64-340.32.run,选择nvidia auto-xconfig模式,会生成几个配置文件:
[root@localhost ~]# cat /usr/lib/modprobe.d/nvidia-installer-disable-nouveau.conf
# generated by nvidia-installer
blacklist nouveau
options nouveau modeset=0
[root@localhost ~]# cat /etc/modprobe.d/nvidia-installer-disable-nouveau.conf
# generated by nvidia-installer
blacklist nouveau
options nouveau modeset=0
~
[root@localhost ~]# cat /etc/X11/xorg.conf
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 340.32 (buildmeister@swio-display-x64-rhel04-01) Tue Aug 5 21:15:33 PDT 2014
Section “Device”
Identifier “Device0″
Driver “nvidia”
VendorName “NVIDIA Corporation”
EndSection
4、有可能需要重启系统加载驱动,检验一下:
[kras@localhost ~]$ lspci -v -s 1:00
01:00.0 VGA compatible controller: NVIDIA Corporation G84GLM [Quadro FX 570M] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Lenovo ThinkPad T61p
Flags: bus master, fast devsel, latency 0, IRQ 50
Memory at d6000000 (32-bit, non-prefetchable) [size=16M]
Memory at e0000000 (64-bit, prefetchable) [size=256M]
Memory at d4000000 (64-bit, non-prefetchable) [size=32M]
I/O ports at 2000 [size=128]
Expansion ROM at <unassigned> [disabled]
Capabilities: <access denied>
Kernel driver in use: nvidia