Fedora 24 如何安装 Nvidia 显卡驱动

wenxiHuang 2016-06-30

关于 Nvidia 驱动,我们就不再过多赘述了,本文教大家如何在 Fedora 24 上安装 Nvidia 显卡驱动。

首先我们需要安装 kernel-devel 和 kernel-headers,如下命令:

[root@localhost ~]# dnf install kernel-devel kernel-headers
Last metadata expiration check: 0:53:22 ago on Tue Jun 28 09:45:14 2016.
Dependencies resolved.
=========================================================================
Package              Arch       Version            Repository     Size
=========================================================================
Installing:
kernel-devel         x86_64     4.5.7-300.fc24     updates         10 M
kernel-headers       x86_64     4.5.7-300.fc24     updates        1.0 M
Transaction Summary
=========================================================================
Install  2 Packages
Total download size: 11 M
Installed size: 42 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): kernel-headers-4.5.7-300.fc24.x86_64.rpm  84 kB/s | 1.0 MB   00:12
(2/2): kernel-devel-4.5.7-300.fc24.x86_64.rpm   191 kB/s |  10 MB   00:55
-------------------------------------------------------------------------
Total                                           202 kB/s |  11 MB   00:57
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Installing  : kernel-headers-4.5.7-300.fc24.x86_64                 1/2
Installing  : kernel-devel-4.5.7-300.fc24.x86_64                   2/2
Verifying   : kernel-devel-4.5.7-300.fc24.x86_64                   1/2
Verifying   : kernel-headers-4.5.7-300.fc24.x86_64                 2/2
Installed:
kernel-devel.x86_64 4.5.7-300.fc24    kernel-headers.x86_64 4.5.7-300.fc24
Complete!

安装 gcc, dkms 和 acpid,命令如下:

[root@localhost ~]#dnf install gcc dkms acpid

官方网站下载驱动文件包,  NVIDIA-Linux-x86_64-367.27.run:

[root@localhost ~]# wget http://in.download.nvidia.com/XFree86/Linux-x86_64/367.27/NVIDIA-Linux-x86_64-367.27.run
--2016-06-28 10:19:16--  http://in.download.nvidia.com/XFree86/Linux-x86_64/367.27/NVIDIA-Linux-x86_64-367.27.run
Resolving in.download.nvidia.com (in.download.nvidia.com)... 117.239.240.42, 117.239.240.32
Connecting to in.download.nvidia.com (in.download.nvidia.com)|117.239.240.42|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 76945324 (73M) [application/octet-stream]
Saving to: ‘NVIDIA-Linux-x86_64-367.27.run’
NVIDIA-Linux-x86_64 100%[===================>]  73.38M  1.16MB/s    in 91s
2016-06-28 10:20:49 (825 KB/s) - ‘NVIDIA-Linux-x86_64-367.27.run’ saved [76945324/76945324]

修改 NVIDIA-Linux-x86_64-367.27.run 权限并安装:

[root@localhost ~]#chmod +x NVIDIA-Linux-x86_64-367.27.run

关闭 X-server 显卡驱动并修改驱动链接:

[root@localhost ~]#rm /etc/systemd/system/default.target
rm: remove symbolic link '/etc/systemd/system/default.target'? y
[root@localhost ~]#ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

在上面的命令中,我们使用第一个命令来删除默认的运行级别,并在下一个命令中,我们改变了运行级别为多用户(这是等于运行3级(多用户与文本模式))。

Blacklist nouveau at Boot Time and Post Boot

我们将创建一个文件disable-noveau.conf在/etc/modprobe.d/目录如下:

[root@localhost ~]#echo 'blacklist nouveau' >> /etc/modprobe.d/disable-nouveau.conf
[root@localhost ~]#echo 'nouveau modeset=0' >> /etc/modprobe.d/disable-nouveau.conf

编辑 /boot/grub2/grub.cfg 文件:

linux16 /vmlinuz-4.5.7-300.fc24.x86_64+debug root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet LANG=en_US.UTF-

在rdblacklist=nouveau 按照下面内容添加:

linux16 /vmlinuz-4.5.7-300.fc24.x86_64+debug root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rdblacklist=nouveau rhgb quiet LANG=en_US.UTF-8

重启系统:

[root@localhost ~]#reboot

使用 root 账户登录系统:

Fedora 24 如何安装 Nvidia 显卡驱动

如下图,安装驱动:

Fedora 24 如何安装 Nvidia 显卡驱动

选择 Accept:

Fedora 24 如何安装 Nvidia 显卡驱动

选择“yes”:
Fedora 24 如何安装 Nvidia 显卡驱动

选择“yes”:
Fedora 24 如何安装 Nvidia 显卡驱动

Fedora 24 如何安装 Nvidia 显卡驱动

Fedora 24 如何安装 Nvidia 显卡驱动

成功安装后,修改默认:

[root@localhost ~]#rm /etc/systemd/system/default.target
[root@localhost ~]#ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

设置:

Fedora 24 如何安装 Nvidia 显卡驱动

相关推荐