lanzh_syf的博客

探索是一个人的天性!

Fedora 27/26/25 NVIDIA 驱动安装

这篇教程适用于GeForce 6/7/8/9/200/300/400/500/600/700/800/900/10 系列的显卡;


测试驱动程序为304.xx,340.xx ,381.xx,384.xx,387.xx;


1、在安装之前我们先来看看你的电脑是否支持NVIDIA显卡:

lspci |grep -E "VGA|3D"

## Example outputs ##
01:00.0 VGA compatible controller: NVIDIA Corporation GF119 [GeForce GT 610] (rev a1)


查看支持的显卡列表,如果你的显卡在340.xx之前,则用387.xx.384.xx或者381.xx驱动,如果介于340.xx和304.xx之间则选用340.xx驱动,如果在304.xx之后,则选用304.xx的驱动。

在终端输入 lspci |grep -E “VGA|3D”显示以下结果

00:02.0 VGA compatible controller: Intel Corporation 2n Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: nVidia Corporation GF106 [GeForce GT 555M SDDR3] (rev a1)

或者

00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 3D controller: NVIDIA Corporation GK107M [GeForce GT 750M] (rev a1)

如果你的电脑是双显卡,请先在bois中禁用双显,如果不支持禁用双显,没测试过,使用此方法后果自负

2.1、首先去NVIDIA官网下载驱动文件

NVIDIA官网:http://www.nvidia.cn/Download/index.aspx?lang=cn 选择相应的显卡驱动文件,格式为NVIDIA-Linux-xxxxx.run,下载保存到本地

测试版本:

Fedora 27 Fedora 26 Fedora 25 Fedora 24/23/22/21
387.34 (November 24, 2017) 387.34 (November 24, 2017) 387.34 (November 24, 2017) 387.34 (November 24, 2017)
384.98 (November 2, 2017) 384.98 (November 2, 2017) 384.98 (November 2, 2017) 384.98 (November 2, 2017)
381.22 (May 9, 2017) 381.22 (May 9, 2017) 381.22 (May 9, 2017) 381.22 (May 9, 2017)
375.82 (July 24, 2017) 375.82 (July 24, 2017) 375.82 (July 24, 2017) 375.82 (July 24, 2017)
340.104 (September 19, 2017) 340.104 (September 19, 2017) 340.104 (September 19, 2017) 340.104 (September 19, 2017)
304.137 (September 19, 2017) 304.137 (September 19, 2017) 304.137 (September 19, 2017) 304.137 (September 19, 2017)

注:340.104在Fedora27/26/25 内核版本为4.13/4.12/4.11安装时需要下载安装补丁,见后文,个别版本在gnome3.26/3.24/3.22/3.20/3.18上不能正常工作。

2.2 在root权限下给NVIDIA-Linux-*.run 添加可执行权限

chmod +x /path/to/NVIDIA-Linux-*.run

2.3 升级系统软件和内核,使其保持最新:

如果在/etc/dnf/dnf.conf文件中有exclude=xorg-x11*这行文字,删除它,并更新xorg

重启系统使其在最新的内核上工作


## Fedora 27/26/25/24/23/22 ##
dnf update

## Fedora 21 ##
yum update

reboot

2.4、安装所需的依赖文件

## Fedora 27/26/25/24/23/22 ##
dnf install kernel-devel kernel-headers gcc dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

## Fedora 21 ##
yum install kernel-devel kernel-headers gcc dkms acpid

2.5禁用开源驱动 nouveau

2.5.1 创建/etc/modprobe.d/blacklist.conf文件 在里面写入 blacklist nouveau 或者用以下命令直接写入

echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf

2.6.2编辑grub文件 

在GRUB_CMDLINE_LINUX=""里面添加rd.driver.blacklist=nouveau(注意是双引号里面的后面空格隔开)

## Example row ##
GRUB_CMDLINE_LINUX="rhgb quiet rd.driver.blacklist=nouveau"

2.6.3 更新grub2配置文件

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

## UEFI ##
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

2.6.4移除xorg-x11-drv-nouveau

## Fedora 27/26/25/24/23/22 ##
dnf remove xorg-x11-drv-nouveau

## Fedora 21 ##
yum remove xorg-x11-drv-nouveau

2.6.5生成initramfs

## Backup old initramfs nouveau image ##
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
 
## Create new initramfs image ##
dracut /boot/initramfs-$(uname -r).img $(uname -r)

2.7 改变运行级别为3(运行级别为三,输入密码时不要用小键盘输入,此时不识别小键盘)


systemctl set-default multi-user.target

reboot

2.8 安装驱动(登陆后请以root权限安装)

cd到驱动文件所在的文件夹执行安装指令


./NVIDIA-Linux-*.run

## 完整的路径和完整的文件名(可以用TAB键补全) ##

./NVIDIA-Linux-x86_64-375.66.run

/path/to/NVIDIA-Linux-x86_64-381.22.run

/path/to/NVIDIA-Linux-x86_64-340.102-patched.run

/home/<username>/Downdloads/NVIDIA-Linux-x86_64-304.135-patched.run

2.8.1安装界面



2.8.4安装驱动并用DKMS注册内核源代码



2.8.5安装界面




2.8.8安装完成界面,中间还有一些,鉴于网速不好,就不上传了;


2.9改回系统的运行权限


systemctl set-default graphical.target

reboot
10安装视频加速支持组件

## Fedora 27/26/25/24/23/22 ##
dnf install vdpauinfo libva-vdpau-driver libva-utils

## Fedora 21 ##
yum install vdpauinfo libva-vdpau-driver libva-utils

如何解决安装过程中 libglvnd出现的错误


试试以下命令

ls -la /usr/lib64/libGL.so.1*
lrwxrwxrwx. 1 root root     14 Jul  6 11:12 /usr/lib64/libGL.so.1 -> libGL.so.1.0.0
-rwxr-xr-x. 1 root root 581840 Jul  6 11:12 /usr/lib64/libGL.so.1.0.0

rm -rf /usr/lib64/libGL.so.1.0.0

dnf reinstall libglvnd-glx

## Should be installed already on step 2.5 Install needed dependencies ##
dnf install libglvnd-opengl libgl-devel pkgconfig
下载安装内核4.12 和4.13的补丁

wget http://rpms.if-not-true-then-false.com/nvidia/NVIDIA-Linux-x86_64-340.104-patched-fedora-26-kernel-4.13.run

提取驱动文件

## 64-bit ##
./NVIDIA-Linux-x86_64-304.135.run --extract-only

## 32-bit ##
./NVIDIA-Linux-x86-304.135.run --extract-only

下载补丁

wget https://media.if-not-true-then-false.com/files/nvidia_mtrr_k4_3.patch
将补丁应用当驱动安装程序中

## 64-bit ##
patch NVIDIA-Linux-x86_64-304.135/kernel/nv-linux.h < nvidia_mtrr_k4_3.patch

## 32-bit ##
patch NVIDIA-Linux-x86-304.135/kernel/nv-linux.h < nvidia_mtrr_k4_3.patch
创建驱动安装程序和补丁

## 64-bit ##
./NVIDIA-Linux-x86_64-304.135/makeself.sh --target-os Linux --target-arch x86_64 NVIDIA-Linux-x86_64-304.135 NVIDIA-Linux-x86_64-304.135-patched.run "NVIDIA driver 304.135 patched for kernel 4.3+" ./nvidia-installer

## 32-bit ##
./NVIDIA-Linux-x86-304.135/makeself.sh --target-os Linux --target-arch x86 NVIDIA-Linux-x86-304.135 NVIDIA-Linux-x86-304.135-patched.run "NVIDIA driver 304.135 patched for kernel 4.3+" ./nvidia-installer
运行以上文件补丁和打了补丁的驱动文件
阅读更多
个人分类: Fedora 27
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭