在Fedora上安装nVidia显卡驱动程序

Posted on Jan 24, 2013

自从Linus骂了nVidia一顿之后,似乎起到了点作用。前不久nVidia还和Steam联手,致力提高Linux下的游戏体验,发布了据说性能提升十分显著的R300驱动,不管是否如此,对桌面用户也是大有裨益的。本文参考了nVidia官方安装文档,结合本人的安装R310.19的经历整理而成。

系统需求

软件需求

Software Element Supported versions Check With… Linux kernel 2.4.22 and newer cat /proc/version XFree86* 4.0.1 and newer XFree86 -version X.Org* 1.0 - 1.13 Xorg -version Kernel modutils 2.1.121 and newer insmod –version glibc 2.0 ls /lib/libc.so.* > 6

硬件需求

当然是你的显卡要在驱动的支持列表内;

参见 Supported NVIDIA GPU Products

安装步骤

禁用nouveau

blacklist

  1. 操作前保证有足够的权限,打开文件

vi /etc/modprobe.d/balcklist.conf

  1. 找到 nvidiafb这一行,注释掉

#blacklist nvidiafb

  1. (可跳过,驱动会自动创建)新建文件 vi /etc/modprobe.d/disable-nouveau.conf,添加以下:

blacklist nouveau options nouveau modeset=0

grub2参数

Fedora 18内核已经包含Nouveau,因此必须禁用才能继续安装:

  1. 修改grub默认参数

vi /etc/default/grub

  1. “GRUB_CMDLINE_LINUX” 末尾添加 nouveau.modeset=0; GRUB_CMDLINE_LINUX="… nouveau.modeset=0"
  2. 重新生成grub.conf

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

  1. 检查参数是否已经添加

cat /etc/grub2.cfg |grep nouveau.modeset=0

使用上面这种方式的好处是,内核更新了,也会自动添加"nouveau.modeset=0"的启动参数,如果不设置则无法启动Gnome桌面系统。内核升级后也会无法启动Gnome桌面系统,届时只要在grub启动界面,手动设置启动参数,即在上述参数后加 3,进系统后再重新安装驱动即可。

开始安装

设置运行级别

su - root
init 3

运行安装包

sh NVIDIA-Linux-x86-310.19.run
安装很简单,安装包已经很自动化了,只要按照提示基本没有什么问题。如果提示nouveau正在运行,无法安装,则要重新启动,进入系统后重复开始安装这个步骤。安装过程中会提示是否自动创建屏蔽nouveau的blacklist配置,是否更新X设置,都选是即可。

安装完毕之后重新启动桌面系统

init 5 安装完成!

.run安装包的其它选项

–info

Print embedded info about the .run file and exit.

–check

Check integrity of the archive and exit.

–extract-only

Extract the contents of ./NVIDIA-Linux-x86-310.19.run, but do not run nvidia-installer.

–help

Print usage information for the common commandline options and exit.

–advanced-options

Print usage information for common command line options as well as the advanced options, and then exit.

总结

实际上安装驱动并不是很麻烦,主要是安装前的设置比较繁复,尤其是要在修改grub里的启动参数,Fedora更新太快,内核隔三岔五地更新。一不小心没设置"nouveau.modeset=0",就启动不了Gnome,还要花时间查找原因,浪费时间和精力。


参考资料

  1. http://us.download.nvidia.com/XFree86/Linux-x86/310.19/README/installationandconfiguration.html
  2. http://fedoraproject.org/wiki/GRUB_2/zh-cn
  3. http://us.download.nvidia.com/XFree86/Linux-x86/310.19/README/supportedchips.html