如何在 Fedora Linux 中安装 Nvidia 驱动
![](/data/attachment/album/202006/10/094702c7of7scjyucmc5f1.jpg)


与大多数 Linux 发行版一样，[Fedora](https://getfedora.org/ "https://getfedora.org/") 并未默认安装专有的 [Nvidia](https://www.nvidia.com/en-us/ "https://www.nvidia.com/en-us/") 驱动。


默认的开源 [Nouveau 驱动](https://en.wikipedia.org/wiki/Nouveau_(software) "https://en.wikipedia.org/wiki/Nouveau_(software)")在大多数情况下都可以使用，但是你可能会遇到屏幕撕裂等问题。


![](/data/attachment/album/202006/10/095406ysara5absarl6sz0.jpg)


如果遇到此类图形/视频问题，那么可能需要在 Fedora 中安装官方专有的 Nvidia 驱动。让我告诉你如何安装。


### 在 Fedora 中安装 Nvidia 驱动


我在本教程中使用 [Fedora 32](https://itsfoss.com/fedora-32/ "https://itsfoss.com/fedora-32/")，但它应适用于其他 Fedora 版本。


#### 步骤 1


在做其他任何操作之前，请先确保你的系统是最新的。你可以使用软件中心，也可以在终端中使用以下命令：



```
`sudo dnf update`
```

#### 步骤 2


由于 Fedora 没有提供 Nvidia 驱动，因此你需要在系统中添加 [RPMFusion 仓库](https://rpmfusion.org/RPM%20Fusion "https://rpmfusion.org/RPM%20Fusion")。你可以在终端中使用以下命令：



```
`sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm`
```


> 
> 不喜欢终端么？那使用 GUI 的方法添加 RPMFusion 仓库。
> 
> 
> 如果你使用 Firefox，那么还可以从浏览器添加 RPMFusion 仓库。进入这个[配置页面](https://rpmfusion.org/Configuration "https://rpmfusion.org/Configuration")，然后向下滚动到 “Graphical Setup via Firefox web browser”。单击自由和非自由仓库的链接。这将下载 .rpm 文件，并安装仓库。
> 
> 
> ![](/data/attachment/album/202006/10/095458vcw1cwuddebw51wx.png)
> 
> 
> 你可以双击下载的 RPM 文件进行安装。
> 
> 
> ![](/data/attachment/album/202006/10/095516m41btg2p5ma5yzcc.png)
> 
> 
> 


#### 步骤 3


现在，你需要确定 [Linux 系统中有哪些显卡（或芯片）](https://itsfoss.com/check-graphics-card-linux/ "https://itsfoss.com/check-graphics-card-linux/")。打开终端并输入以下命令：



```
`lspci -vnn | grep VGA`
```

![](/data/attachment/album/202006/10/095544pdtenrtnj79nnej6.png)


接下来，你需要查找与该芯片对应的驱动。你可以在[此处](https://us.download.nvidia.com/XFree86/Linux-x86/367.57/README/supportedchips.html "https://us.download.nvidia.com/XFree86/Linux-x86/367.57/README/supportedchips.html")找到 Nvidia 芯片的列表。你也可以使用[此工具](https://www.nvidia.com/Download/index.aspx?lang=en-us "https://www.nvidia.com/Download/index.aspx?lang=en-us")搜索设备。


**注意**：请记住，即使 Nvidia 列表显示了更多驱动，但也只有三个驱动可以安装。Nvidia 驱动支持最新的显卡。nvidia-390 和 nvidia-340 驱动支持旧设备。


#### 步骤 4


要安装所需的驱动，请在终端中输入以下一个命令。下面的命令是用于我的显卡的命令。根据你的系统相应调整。



```
`sudo dnf install akmod-nvidia sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx`
```

![](/data/attachment/album/202006/10/095605r5upgp7dposncdsv.png)


#### 步骤 5


要使更改生效，请重启系统。你的系统重启可能需要比较长的时间，因为它将 Nvidia 驱动注入到 Linux 内核中。


重启并登录系统后，你会看到更好的视觉效果，并且不会出现屏幕撕裂的情况。


![](/data/attachment/album/202006/10/095624m2rzrzm6c3ryb6x5.jpg)


### 额外的提示


这是可选步骤，但建议这样做。添加 RPMFusion 仓库时，你可以访问常规仓库中不可用的多媒体包。


此命令将为使用 [gstreamer](https://en.wikipedia.org/wiki/GStreamer "https://en.wikipedia.org/wiki/GStreamer") 的应用安装软件包：



```
`sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin`
```

此命令将安装声音和视频软件包所需的包：



```
`sudo dnf groupupdate sound-and-video`
```

希望本教程对在 Fedora 上安装 Nvidia 驱动很有用。




---


via: [https://itsfoss.com/install-nvidia-drivers-fedora/](https://itsfoss.com/install-nvidia-drivers-fedora/ "https://itsfoss.com/install-nvidia-drivers-fedora/")


作者：[John Paul](https://itsfoss.com/author/john/ "https://itsfoss.com/author/john/") 选题：[lujun9972](https://github.com/lujun9972 "https://github.com/lujun9972") 译者：[geekpi](https://github.com/geekpi "https://github.com/geekpi") 校对：[wxy](https://github.com/wxy "https://github.com/wxy")


本文由 [LCTT](https://github.com/LCTT/TranslateProject "https://github.com/LCTT/TranslateProject") 原创编译，[Linux中国](https://linux.cn/ "https://linux.cn/") 荣誉推出


OK
![Warp Terminal](/assets/images/warp-terminal.webp)


![Warp Terminal](/assets/images/warp-terminal.webp)

Like most Linux distributions, [Fedora](https://getfedora.org/?ref=itsfoss.com) does not come with the proprietary [Nvidia](https://www.nvidia.com/en-us/?ref=itsfoss.com) drivers installed by default.

The default open source [Nouveau driver](https://en.wikipedia.org/wiki/Nouveau_(software)?ref=itsfoss.com) works in most situations, but you may encounter issues like screen tearing and some stutters.

![Fedora with Nouveau driver](https://itsfoss.com/content/images/wordpress/2020/05/fedora-nouveau-800x500.jpg)

If you encounter such graphics/video issues, you may want to install the official proprietary Nvidia drivers in Fedora. Let me show you how to do that.

## Installing Nvidia drivers in Fedora

I am using **Fedora 39** in this tutorial, but it should be applicable to other Fedora versions.

### Step 1

Before you do anything else, make sure that your system is up-to-date. You can either use the Software Center or use the following command in the terminal:

` sudo dnf update`


### Step 2

While Fedora does not ship with the Nvidia driver, you have the option to **enable third-party repositories** during its installation onboarding steps.

If you have not enabled it during setup, you can head to GNOME Software and head to manage the “**Software Repositories**”** **from the menu to proceed to enable the RPM Fusion repository for NVIDIA drivers.

![RPM fusion for NVIDIA driver](https://itsfoss.com/content/images/2023/11/nvidia-rpm-fusion.png)

Of course, you can manually [add the RPMFusion repos to your Fedora system](https://itsfoss.com/fedora-third-party-repos/) to install more programs like VLC or additional multimedia codecs as well.

For that, you can use the following command in the terminal:

`sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm`


### Step 3

Now you need to determine [what graphics card (or chip) you have in your Linux system](https://itsfoss.com/check-graphics-card-linux/). Pull up the terminal and enter the following command:

`lspci -vnn | grep VGA`


![Video Card Lookup Fedora](https://itsfoss.com/content/images/2023/11/nvidia-graphics-card.png)

### Step 4

To proceed to install the latest NVIDIA graphics driver available in the RPM Fusion repo for the Fedora version you are using, enter the following command in the terminal:

`sudo dnf install akmod-nvidia`


![installing nvidia driver via the terminal](https://itsfoss.com/content/images/2023/11/install-nvidia-driver.png)

Once you confirm it by hitting "y", it will download the packages and again ask for another confirmation. Approve it to proceed installing.

![](https://itsfoss.com/content/images/2023/11/finalize-installing-nvidia-drivers.png)

Optionally, you can enable CUDA support for the driver, which lets you check the stats for your NVIDIA card from the terminal using **nvidia-smi**:

![nvidia smi](https://itsfoss.com/content/images/2023/11/nvidia-smi.png)

The command for it is:

```
sudo dnf install xorg-x11-drv-nvidia-cuda
```


### Step 5

To make the changes take effect, reboot your system and login.

![Fedora with Nvidia driver](https://itsfoss.com/content/images/2023/11/fedora-39-homescreen.png)

## For Legacy Graphics Card

You can look up what driver corresponds to a specific chip. You can find a list of the Nvidia chips [here](https://us.download.nvidia.com/XFree86/Linux-x86/367.57/README/supportedchips.html?ref=itsfoss.com). Furthermore, you can also use [this tool](https://www.nvidia.com/Download/index.aspx?lang=en-us&ref=itsfoss.com) to search for your device.

To install the required driver, enter one of the commands into the terminal. The following command is the one I had to use for my card. Update as appropriate for your system.

`sudo dnf install akmod-nvidia sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx`


![Nvidia terminal installation](https://itsfoss.com/content/images/wordpress/2020/05/nvidia-cli-install-800x500.png)

## Bonus Tip

This is an optional step but it is recommended. When you add the RPMFusion repos, you get access to multimedia packages that are not available in the regular repos.

This command will install packages for applications that use [gstreamer](https://en.wikipedia.org/wiki/GStreamer?ref=itsfoss.com):

`sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin`


This command will install packages needed by sound and video packages:

`sudo dnf groupupdate sound-and-video`


Hopefully, you find this tutorial useful in installing Nvidia drivers on Fedora. What other Fedora tutorials would you like to see on It’s FOSS?