Fedora 安装 NVIDIA 显卡驱动

╰半橙微兮° 2023-08-17 16:26 249阅读 0赞

Fedora 安装 NVIDIA 显卡驱动

外界对于 双显卡的笔记本安装驱动的说法各种各样,但是没有一个说的是特别全面的,今天亲自在自己的游戏本上安装了 Fedora ,经历了各种各样的问题,因此特写下来

  1. NVIDIA 官网下载符合自己的显卡驱动
  2. 按这个网站的建议一步步执行https://www.if-not-true-then-false.com/2015/fedora-nvidia-guide/

    • 查看自己电脑的显卡

    lspci |grep -E “VGA|3D”

    • 给下载好的 .run结尾的驱动添加执行权限

    文件名太长,我就简略写了

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

    • 切换到root

    sudo su

    • 将系统更新到最新版本

    dnf update

    安装完成后重启电脑

    reboot

    • 安装必须的依赖

    Fedora 30/29/28/27/26/25/24/23

    dnf install kernel-devel kernel-headers gcc make dkms acpid libglvnd-glx libglvnd-opengl libglvnd-devel pkgconfig

    • Disable nouveau (这个是默认的驱动,之后好多地方都会遇到他)

    echo “blacklist nouveau” >> /etc/modprobe.d/blacklist.conf

    • Edit(编辑这个文件) /etc/sysconfig/grub

    sudo gedit /etc/default/grub

做如下更改
‘GRUB_CMDLINE_LINUX=”…”‘. 后面追加 ‘rd.driver.blacklist=nouveau’

  1. # 这是个例子
  2. GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rhgb quiet rd.driver.blacklist=nouveau"
  • 更新 grub2 conf

    BIOS

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

    UEFI

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

  • 删除 xorg-x11-drv-nouveau

    dnf remove xorg-x11-drv-nouveau

之后找到 /etc/dnf/dnf.conf 这个文件,编辑它如果有下面的内容,将这个东西删掉,其余的保留

  1. exclude=xorg-x11*
  • 2.6.5 Generate 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)

  • Reboot to runlevel 3 将系统切换到 多用户模式

    systemctl set-default multi-user.target

    更改后重启,我们就可以准备安装了

    reboot

  • 用root 用户登录,执行下载好的安装文件

    ./NVIDIA-Linux-*.run

Nvidia Installer Register the Kernel Source Modules with DKMS —> yes
Nvidia Installer 32-bit Compatibility Libraries —> yes
Nvidia Installer Installing Drivers and Building kernel module —> yes
Nvidia Installer Automatic Xorg Config and Backup —> yes
nVidia Drivers Installation Complete —> ok

  • 系统状态还原,之后重启

    systemctl set-default graphical.target

    reboot

  • VDPAU/VAAPI support

    Fedora 30/29/28/27/26/25/24/23

    dnf install vdpauinfo libva-vdpau-driver libva-utils

这样基本就安装完了,可以在控制台看看是不是好了

  1. nvidia-installer -v |grep version
  2. uname -a
  3. lspci |grep -E "VGA|3D"

到这里,我的电脑是没有好的,所以又干了之后的事
安装大黄蜂 NVIDIA Optimus Bumblebee

  • To install the NVIDIA drivers, first add the RPM Fusion repository:

    sudo dnf install fedora-workstation-repositories

    sudo dnf config-manager rpmfusion-nonfree-nvidia-driver —set-enabled

  • 安装依赖

    sudo dnf install akmod-nvidia acpi

  • 启用这个仓库 https://copr.fedorainfracloud.org/coprs/chenxiaolong/bumblebee/ chenxiaolong/bumblebee [Copr repository]:

    dnf copr enable chenxiaolong/bumblebee

  • Next, install the bbswitch driver, and the bumblebee and primus packages.

    dnf install akmod-bbswitch bumblebee primus

  • For the optirun and primusrun commands to work, the current user must be added to the bumblebee group.

    gpasswd -a $USER bumblebee

  • Enable the bumblebeed service and disable the nvidia-fallback service. This service comes from the packaged drivers and will attempt to load nouveau if nvidia fails to load. However, when using Bumblebee, neither one should load at boot.

    systemctl enable bumblebeed

    systemctl mask nvidia-fallback

到这里,大黄蜂就安装完毕了

但是到这里之后我的电脑还没有好,我又用命令安装了 NVIDIA 驱动

  1. dnf install bumblebee-nvidia
  • 之后我们又要修改之前修改的那个文件

    sudo gedit /etc/default/grub

在打开文件中找到

GRUB_CMDLINE_LINUX=””

改成

  1. GRUB_CMDLINE_LINUX="acpi_backlight=vendor"
  2. # 在这个行中找到所有的 nouveau 字段,把它们都删掉
  • 升级 grub

    sudo update-grub

安装完成后重新启动电脑,这样应该就完事了,我的电脑到这一步就完全正常了

发表评论

表情:
评论列表 (有 0 条评论,249人围观)

还没有评论,来说两句吧...

相关阅读