如何在 Fedora Linux 上安装 RPM 文件
RPM

> 
> 这篇初学者文章介绍如何在 Fedora 和 Red Hat Linux 上安装 RPM 软件包。它也随后向你展示如何移除这些 RPM 软件包。
> 
> 
> 


![](/data/attachment/album/202012/26/182851bxi1lstdz13siuif.jpg)


当你开始使用 Red Hat 系的 Fedora Linux 时，你早晚会偶然发现 .rpm 文件。就像在 Windows 中的 .exe 文件，以及在 Ubuntu 和 Debian 中的 .deb 文件一样，一个 rpm 文件能够使你在 [Fedora](https://getfedora.org/) 上快速安装一个软件。


你可以从软件中心中找到并安装大量的软件，特别是 [如果你在 Fedora 中启用附加的存储库的话](https://itsfoss.com/fedora-third-party-repos/)。但是有时你会在它们的网站上找到可用的 RPM 格式的软件包。


就像在 Windows 中的 .exe 文件一样，你可以通过 **下载 .rpm 文件并双击它来安装**。不用担心，我将向你展示详细的步骤。


### 在 Fedora 和 Red Hat Linux 上安装 RPM 文件


我将向你展示安装 RPM 文件的三个方法：


* [使用软件中心安装 RPM 文件](file:///Users/xingyuwang/develop/TranslateProject-wxy/translated/tech/tmp.TvkJtlRJ6T#gui-method)（GUI 方法）
* [使用 DNF 命令安装 RPM 文件](file:///Users/xingyuwang/develop/TranslateProject-wxy/translated/tech/tmp.TvkJtlRJ6T#use-dnf)（CLI 方法）
* [使用 Yum 命令安装 RPM 文件](file:///Users/xingyuwang/develop/TranslateProject-wxy/translated/tech/tmp.TvkJtlRJ6T#use-yum)（Red Hat 的 CLI 方法）


#### 方法 1: 使用软件中心


在 Fedora 中使用默认的软件中心是最简单的方法。它真地很简单。转到你下载的 .rpm 文件的文件夹位置。它通常在 “Downloads” 文件夹。


只需要 **双击 RPM 文件，它将会在软件中心中打开**。


或者，你可以在 RPM 文件上右键单击并选择通过软件中心来安装它。


![或者双击或者右键并选择软件安装](/data/attachment/album/202012/26/182904r8zjjox8tb8bt4fz.png)


当它在软件中心打开时，你应该会看到“安装”选项。只需要点击“安装”按钮并在提示时输入你的账号密码。


![通过 Fedora 软件中心安装 RPM](/data/attachment/album/202012/26/182904r3qdd2ii3tgqdqpd.jpg)


它很简单，对吗？


#### 方法 2: 使用 DNF 命令来安装 RPM 文件


这是命令行方法。Fedora 使用新的 `dnf` [软件包管理器](https://itsfoss.com/package-manager/) ，你也可以使用它来安装下载的 RPM 文件。


打开一个终端并切换到你下载 RPM 文件的目录下。你也可以通过到 RPM 文件的路径。像这样使用 `dnf` 命令：



```
sudo dnf install rpm_file_name

```

这是一个我 [在 Fedora 上使用 dnf 命令安装 Google Chrome](https://itsfoss.com/install-google-chrome-fedora/) 屏幕截图：


![使用 DNF 命令安装 RPM 文件](/data/attachment/album/202012/26/182905n5t05irh0sz13kxw.jpg)


#### 方法 3: 在 Red Hat 中使用 Yum 命令安装 RPM 文件


不像 Fedora ，Red Hat 仍然使用很好的旧式的 Yum 软件包管理器。在这里你还不能找到 `dnf` 命令。


这个过程与 `dnf` 命令相同。转到 RPM 文件所在的目录或提供它的路径。



```
sudo yum install path_to_RPM_file

```

就是这样。没有一点异常花哨的东西。


### 如何移除 RPM 软件包


移除一个 RPM 软件包也不是一个什么大的问题。并且，你不需要原始的用来安装程序的 rpm 文件。


你可以在软件中心中找到已安装的软件包，并从其中移除应用程序。


![移除 RPM 软件包](/data/attachment/album/202012/26/182905n7uxgepdqxk83j31.jpg)


或者，你可以使用带有 `remove` 选项的 `dnf` 或 `yum` 命令。


使用 `dnf` ，使用这个命令：



```
sudo dnf remove rpm_package_name

```

使用 `yum` ，使用这个命令：



```
sudo yum remove rpm_package_name

```

你可能不记得准确的软件包名称，没有关系。你可以做的是输入软件包的前几个字母，然后敲击 `tab` 按键。这是假设你已经启用 `tab` 按键补全，通常是这样的。


这就是你需要做的全部。相当简单，对吧？作为一个初学者，你可能会为这样一个简单的任务而挣扎，我希望像这样的快速教程会让你对 Fedora 更自信一些。




---


via: <https://itsfoss.com/install-rpm-files-fedora/>


作者：[Abhishek Prakash](https://itsfoss.com/author/abhishek/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[robsean](https://github.com/robsean) 校对：[wxy](https://github.com/wxy)


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


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


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

When you start using Fedora Linux in the Red Hat domain, sooner or later, you’ll come across .rpm files. Like .exe files in Windows and .deb files in Ubuntu and Debian, .rpm files enable you to quickly install a software from it on [Fedora](https://getfedora.org/?ref=itsfoss.com).

You could find and install plenty of software from the software center, especially [if you enable additional repositories in Fedora](https://itsfoss.com/fedora-third-party-repos/). But sometimes, you’ll find software available on their website in RPM format.

Like .exe files in Windows, you **download the .rpm file and double click on it to install it**. Don’t worry, I’ll show you the detailed steps.

## Installing RPM files on Fedora and Red Hat Linux

I’ll be showing you three ways to install RPM files:

[Install RPM files with software center](https://itsfoss.com/install-rpm-files-fedora/#gui-method)(GUI method)[Install RPM files using DNF command](https://itsfoss.com/install-rpm-files-fedora/#use-dnf)(CLI method)[Install RPM files using Yum command](https://itsfoss.com/install-rpm-files-fedora/#use-yum)(CLI method for Red Hat)

### Method 1: Use software center

The simplest method is to use the default software center in Fedora. It’s really simple. Go to the folder where you downloaded the .rpm file. It is usually the Downloads folder.

Just **double click on the RPM file and it will be opened in the software center**.

Alternatively, you can right click on the file and choose to install it via Software Center.

![Installing Rpm File Fedora](https://itsfoss.com/content/images/wordpress/2020/12/installing-rpm-file-fedora.png)

When it is opened in the software center, you should see the installation option. Just hit the install button and enter your account’s password when prompted for it.

![Install Rpm Fedora Software Center](https://itsfoss.com/content/images/wordpress/2020/12/install-rpm-fedora-software-center.jpg)

It’s easy, right?

### Method 2: Use DNF command to install RPM file

This is the command line method. Fedora uses the new DNF [package manager](https://itsfoss.com/package-manager/) and you can use it to install downloaded RPM files as well.

Open a terminal and switch to the directory where you have the RPM file downloaded. You can also provide the path to the RPM file. Use the DNF command like this:

`sudo dnf install rpm_file_name`


Here’s a screenshot where I installed [Google Chrome on Fedora with dnf command](https://itsfoss.com/install-google-chrome-fedora/):

![Installing RPM files using DNF command](https://itsfoss.com/content/images/wordpress/2020/12/install-rpm-using-dnf-install-800x474.jpg)

### Method 3: Install RPM files in Red Hat using Yum command

Unlike Fedora, Red Hat still uses the good old Yum package manager. You won’t find the DNF command here, yet.

The process is the same as DNF command. You go to the directory where the RPM file is located or provide its path.

`sudo yum install path_to_RPM_file`


That’s it. Nothing fancier.

## How to remove RPM packages

Removing a RPM package isn’t a big deal either. And no, you don’t need the original rpm file that you used to install the program.

You may find the installed package in the software center and remove application from there.

![Removing RPM Package in Fedora using Software Center](https://itsfoss.com/content/images/wordpress/2020/12/remove-rpm-package-fedora.jpg)

Alternatively, you can use the DNF or YUM command with `remove`

option.

With DNF, use this command:

`sudo dnf remove rpm_package_name`


With Yum, use this command:

`sudo yum remove rpm_package_name`


You probably won’t remember the exact package name and that’s fine. What you can do is to type the first few letters of the package and then hit tab. This is assuming that you have tab completion enabled which usually is.

## More on packages and Fedora

And that’s all you need to do here. Pretty simple, right? Being a beginner, you may struggle with a simple task like this and I hope you feel more confident with Fedora thanks to quick tutorials like this.

If you are new to Fedora, you'll find this a good place to get started with it.

[Getting Started With FedoraCollection of useful tutorials for new Fedora users.](https://itsfoss.com/fedora-tutorials/)![](https://itsfoss.com/content/images/2023/01/fedora-tutorials.png)


![](https://itsfoss.com/content/images/2023/01/fedora-tutorials.png)

Did you know you can get access to huge number of third-party software by [enabling the RPM Fusion repository in Fedora](https://itsfoss.com/fedora-third-party-repos/)?

[How to Add Third-Party Repositories in Fedora and Get Access to a Huge Number of Additional SoftwareAfter you install Fedora, you may discover that some of the popular Linux software that you want to install are not available in the software store. This is because Fedora enforces the following guidelines when it comes to packages: * If it is proprietary, it cannot be included in Fedora…](https://itsfoss.com/fedora-third-party-repos/)![](https://itsfoss.com/content/images/wordpress/2020/12/fedora-Third-party-Repositories.png)


![](https://itsfoss.com/content/images/wordpress/2020/12/fedora-Third-party-Repositories.png)

Enjoy Fedora :)