1. 下载最新版本Linux版本驱动程序, 下载地址:https://www.geforce.cn/drivers
得到下载页面:https://www.geforce.cn/drivers/results/153226
驱动下载地址:https://us.download.nvidia.com/XFree86/Linux-x86_64/440.31/NVIDIA-Linux-x86_64-440.31.run
2. 更新内核
[yeqiang@localhost ~]$ sudo dnf update kernel -y
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for yeqiang:
Fedora Modular 31 - x86_64 3.0 MB/s | 5.2 MB 00:01
Fedora Modular 31 - x86_64 - Updates 1.6 MB/s | 3.1 MB 00:01
Fedora 31 - x86_64 - Updates 1.4 MB/s | 6.4 MB 00:04
Fedora 31 - x86_64 7.3 MB/s | 71 MB 00:09
Last metadata expiration check: 0:00:01 ago on Mon 11 Nov 2019 02:03:05 AM EST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing dependencies:
kernel x86_64 5.3.8-300.fc31 updates 39 k
kernel-core x86_64 5.3.8-300.fc31 updates 30 M
kernel-modules x86_64 5.3.8-300.fc31 updates 28 M
Transaction Summary
================================================================================
Install 3 Packages
Total download size: 58 M
Installed size: 95 M
Downloading Packages:
(1/3): kernel-5.3.8-300.fc31.x86_64.rpm 34 kB/s | 39 kB 00:01
(2/3): kernel-modules-5.3.8-300.fc31.x86_64.rpm 8.2 MB/s | 28 MB 00:03
(3/3): kernel-core-5.3.8-300.fc31.x86_64.rpm 2.0 MB/s | 30 MB 00:14
--------------------------------------------------------------------------------
Total 3.7 MB/s | 58 MB 00:15
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : kernel-core-5.3.8-300.fc31.x86_64 1/3
Running scriptlet: kernel-core-5.3.8-300.fc31.x86_64 1/3
Installing : kernel-modules-5.3.8-300.fc31.x86_64 2/3
Running scriptlet: kernel-modules-5.3.8-300.fc31.x86_64 2/3
Installing : kernel-5.3.8-300.fc31.x86_64 3/3
Running scriptlet: kernel-core-5.3.8-300.fc31.x86_64 3/3
Running scriptlet: kernel-5.3.8-300.fc31.x86_64 3/3
Verifying : kernel-5.3.8-300.fc31.x86_64 1/3
Verifying : kernel-core-5.3.8-300.fc31.x86_64 2/3
Verifying : kernel-modules-5.3.8-300.fc31.x86_64 3/3
Installed:
kernel-5.3.8-300.fc31.x86_64 kernel-core-5.3.8-300.fc31.x86_64
kernel-modules-5.3.8-300.fc31.x86_64
Complete!
3. 安装内核开发库,编译器
[yeqiang@localhost ~]$ sudo dnf install kernel-devel gcc gcc-c++ -y
[sudo] password for yeqiang:
Last metadata expiration check: 0:11:14 ago on Mon 11 Nov 2019 02:03:05 AM EST.
Package gcc-9.2.1-1.fc31.x86_64 is already installed.
Dependencies resolved.
==============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================================================
Installing:
kernel-devel x86_64 5.3.8-300.fc31 updates 12 M
gcc-c++ x86_64 9.2.1-1.fc31 fedora 12 M
Installing dependencies:
libstdc++-devel x86_64 9.2.1-1.fc31 fedora 1.9 M
Transaction Summary
==============================================================================================================================================================================================================================================
Install 3 Packages
Total download size: 26 M
Installed size: 95 M
Downloading Packages:
(1/3): kernel-devel-5.3.8-300.fc31.x86_64.rpm 6.1 MB/s | 12 MB 00:01
(2/3): libstdc++-devel-9.2.1-1.fc31.x86_64.rpm 319 kB/s | 1.9 MB 00:06
(3/3): gcc-c++-9.2.1-1.fc31.x86_64.rpm 1.7 MB/s | 12 MB 00:06
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 2.3 MB/s | 26 MB 00:11
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : libstdc++-devel-9.2.1-1.fc31.x86_64 1/3
Installing : gcc-c++-9.2.1-1.fc31.x86_64 2/3
Installing : kernel-devel-5.3.8-300.fc31.x86_64 3/3
Running scriptlet: kernel-devel-5.3.8-300.fc31.x86_64 3/3
Verifying : kernel-devel-5.3.8-300.fc31.x86_64 1/3
Verifying : gcc-c++-9.2.1-1.fc31.x86_64 2/3
Verifying : libstdc++-devel-9.2.1-1.fc31.x86_64 3/3
Installed:
kernel-devel-5.3.8-300.fc31.x86_64 gcc-c++-9.2.1-1.fc31.x86_64 libstdc++-devel-9.2.1-1.fc31.x86_64
Complete!
4. 禁用系统自带的nouveau驱动
[yeqiang@localhost ~]$ sudo su
[root@localhost yeqiang]# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
编辑/etc/sysconfig/grub,将 ‘rd.driver.blacklist=nouveau’ 配置写在 ‘GRUB_CMDLINE_LINUX=”…”‘后面
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet rd.driver.blacklist=nouveau"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
5. 更新 grub2 配置
[root@localhost fedora]# cp grub.cfg grub.cfg.bak
[root@localhost fedora]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Generating grub configuration file ...
Found Windows Boot Manager on /dev/nvme0n1p2@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done
6. 删除xorg-x11-drv-nouveau
[root@localhost fedora]# dnf remove xorg-x11-drv-nouveau
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
xorg-x11-drv-nouveau x86_64 1:1.0.15-8.fc31 @anaconda 232 k
Transaction Summary
================================================================================
Remove 1 Package
Freed space: 232 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Erasing : xorg-x11-drv-nouveau-1:1.0.15-8.fc31.x86_64 1/1
Running scriptlet: xorg-x11-drv-nouveau-1:1.0.15-8.fc31.x86_64 1/1
Verifying : xorg-x11-drv-nouveau-1:1.0.15-8.fc31.x86_64 1/1
Removed:
xorg-x11-drv-nouveau-1:1.0.15-8.fc31.x86_64
Complete!
7. 重新生成initramfs
[root@localhost boot]# mv initramfs-5.3.8-300.fc31.x86_64.img initramfs-5.3.8-300.fc31.x86_64.img.bak
[root@localhost boot]# dracut /boot/initramfs-$(uname -r).img $(uname -r)
8. 重启到level3
[root@localhost boot]# systemctl set-default multi-user.target
Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
[root@localhost boot]# reboot
9. 安装驱动程序
[yeqiang@localhost Downloads]$ sudo ./NVIDIA-Linux-x86_64-440.31.run
10. 重启到图形界面
systemctl set-default graphical.target
reboot
参考文档:https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/