Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu Wang 2020-12-20 09:22:22 +08:00
commit 4b111ef527
8 changed files with 627 additions and 295 deletions

View File

@ -0,0 +1,158 @@
[#]: collector: (lujun9972)
[#]: translator: (zxp93)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12935-1.html)
[#]: subject: (How I use Python to map the global spread of COVID-19)
[#]: via: (https://opensource.com/article/20/4/python-map-covid-19)
[#]: author: (AnuragGupta https://opensource.com/users/999anuraggupta)
如何使用 Python 绘制 COVID-19 的全球扩散图
======
> 使用这些开源框架创建一个彩色地图,显示病毒的可能的传播路径。
![](https://img.linux.net.cn/data/attachment/album/202012/20/005146t8voetski8ocm5c2.jpg)
对于一个全球旅行司空见惯的世界来说,疾病的传播是一个真正令人担忧的问题。一些组织会跟踪重大的流行病(还有所有普遍的流行病),并将他们的跟踪工作获得的数据公开出来。不过,这些原始的数据对人来说可能很难处理,这就是为什么数据科学如此重要的原因。比如,用 Python 和 Pandas 可视化 COVID-19 在全球范围内的传播路径可能对这些数据的分析有所帮助。
最开始,当面对如此大数量的原始数据时可能难以下手。但当你开始处理数据之后,慢慢地就会发现一些处理数据的方式。下面是用于处理 COVID-19 数据的一些常见的情况:
1. 从 GitHub 上下载 COVID-19 的国家每日传播数据,保存为一个 Pandas 中的 DataFrame 对象。这时你需要使用 Python 中的 Pandas 库。
2. 处理并清理下载好的数据,使其满足可视化数据的输入格式。所下载的数据的情况很好(数据规整)。这个数据有一个问题是它用国家的名字来标识国家,但最好是使用三位数的 ISO 3 码(国家代码表)来标识国家。为了生成 ISO 3 码,可是使用 `pycountry` 这个 Python 库。生成了这些代码之后,可以在原有的 DataFrame 上增加一列,然后用这些代码填充进去。
3. 最后为了实现可视化,使用 Plotly 库中的 `express` 模块。这篇文章是使用名为choropleth 的地图(可在 Plotly 库中获得)来可视化该疾病在全球的传播。
### 第一步Corona 数据
从下面这个网站上下载最新的 corona 数据LCTT 译注2020-12-14 仍可访问,有墙):
- <https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv>
我们之间将这个下载好的数据载入为 Pandas 的 DataFrame。Pandas 提供了一个函数, `read_csv()`,可以直接使用 URL 读取数据,并返回一个 DataFrame 对象,具体如下所示:
```
import pycountry
import plotly.express as px
import pandas as pd
URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv'
df1 = pd.read_csv(URL_DATASET)
print(df1.head(3))  # Get first 3 entries in the dataframe
print(df1.tail(3))  # Get last 3 entries in the dataframe
```
在 Jupyter 上的输出截图:
![Jupyter screenshot][2]
从这个输出可以看到这个 DataFrame`df1`)包括以下几列数据:
1. `Date`
2. `Country`
3. `Confirmed`
4. `Recovered`
5. `Dead`
之后还可以看到 `Date` 这一列包含了从 1 月 22 日到 3 月 31 日的条目信息。这个数据是每天更新的,所以你会得到你当天的值。
### 第二步:清理和修改 DataFrame
我们要往这个 DataFrame 中增加一列数据,就是那个包含了 ISO 3 编码。可以通过以下三步完成这个任务:
1. 创建一个包含所有国家的列表。因为在 `df1``Country` 列中,国家都是每个日期就重复一次。所以实际上 `Country` 列中对每个国家就会有多个条目。我使用 `unique().tolist()` 函数完成这个任务。
2. 我使用 `d_country_code` 字典对象(初始为空),然后将其键设置为国家的名称,然后它的值设置为其对应的 ISO 3 编码。
3. 我使用 `pycountry.countries.search_fuzzy(country)` 为每个国家生成 ISO 3 编码。你需要明白的是这个函数的返回值是一个 `Country` 对象的列表。我将这个函数的返回值赋给 `country_data` 对象。以这个对象的第一个元素(序号 `0`)为例。这个 `\` 对象有一个 `alpha_3` 属性。所以我使用 `country_data[0].alpha_3` 就能“获得”第一个元素的 ISO 3 编码。然而,在这个 DataFrame 中有些国家的名称可能没有对应的 ISO 3 编码(比如有争议的领土)。那么对这些“国家/地区”,我就用一个空白字符串来替代 ISO 3 编码。你也可以用一个 `try-except` 代码来替换这部分。`except` 中的语句可以写:`print(could not add ISO 3 code for ->', country)`。这样就能在找不到这些“国家/地区”对应的 ISO 3 编码时给出一个输出提示。实际上,你会发现这些“国家/地区”会在最后的输出中用白色来表示。
4. 在获得了每个国家的 ISO 3 编码(有些是空白字符串)之后,我把这些国家的名称(作为键)还有国家对应的 ISO 3 编码(作为值)添加到之前的字典 `d_country_code` 中。可以使用 Python 中字典对象的 `update()` 方法来完成这个任务。
5. 在创建好了一个包含国家名称和对应 ISO 3 编码的字典之后,我使用一个简单的循环将他们加入到 DataFrame 中。
### 第三步:使用 Plotly 可视化传播路径
choropleth 地图是一个由彩色多边形组成的地图。它常常用来表示一个变量在空间中的变化。我们使用 Plotly 中的 `px` 模块来创建 choropleth 图,具体函数为:`px.choropleth`。
这个函数的所包含的参数如下:
```
plotly.express.choropleth(data_frame=None, lat=None, lon=None, locations=None, locationmode=None, geojson=None, featureidkey=None, color=None, hover_name=None, hover_data=None, custom_data=None, animation_frame=None, animation_group=None, category_orders={}, labels={}, color_discrete_sequence=None, color_discrete_map={}, color_continuous_scale=None, range_color=None, color_continuous_midpoint=None, projection=None, scope=None, center=None, title=None, template=None, width=None, height=None)
```
`choropleth()` 这个函数还有几点需要注意:
1. `geojson` 是一个 `geometry` 对象(上面函数第六个参数)。这个对象有点让人困扰,因为在函数文档中没有明确地提到这个对象。你可以提供,也可以不提供 `geojson` 对象。如果你提供了 `geojson` 对象,那么这个对象就会被用来绘制地球特征,如果不提供 `geojson` 对象,那这个函数默认就会使用一个内建的 `geometry` 对象。(在我们的实验中,我们使用内建的 `geometry` 对象,因此我们不会为 `geojson` 参数提供值)
2. DataFrame 对象有一个 `data_frame` 属性,在这里我们先前就提供了一个我们创建好的`df1`。
3. 我们用 `Confirmed`(确诊数)来决定每个国家多边形的颜色。
4. 最后,我们 `Date` 列创建一个 `animation_frame`。这样我们就能通过日期来划分数据,国家的颜色会随着 `Confirmed` 的变化而变化。
最后完整的代码如下:
```
import pycountry
import plotly.express as px
import pandas as pd
# ----------- Step 1 ------------
URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv'
df1 = pd.read_csv(URL_DATASET)
# print(df1.head) # Uncomment to see what the dataframe is like
# ----------- Step 2 ------------
list_countries = df1['Country'].unique().tolist()
# print(list_countries) # Uncomment to see list of countries
d_country_code = {} # To hold the country names and their ISO
for country in list_countries:
try:
country_data = pycountry.countries.search_fuzzy(country)
# country_data is a list of objects of class pycountry.db.Country
# The first item ie at index 0 of list is best fit
# object of class Country have an alpha_3 attribute
country_code = country_data[0].alpha_3
d_country_code.update({country: country_code})
except:
print('could not add ISO 3 code for ->', country)
# If could not find country, make ISO code ' '
d_country_code.update({country: ' '})
# print(d_country_code) # Uncomment to check dictionary
# create a new column iso_alpha in the df
# and fill it with appropriate iso 3 code
for k, v in d_country_code.items():
df1.loc[(df1.Country == k), 'iso_alpha'] = v
# print(df1.head) # Uncomment to confirm that ISO codes added
# ----------- Step 3 ------------
fig = px.choropleth(data_frame = df1,
locations= "iso_alpha",
color= "Confirmed", # value in column 'Confirmed' determines color
hover_name= "Country",
color_continuous_scale= 'RdYlGn', # color scale red, yellow green
animation_frame= "Date")
fig.show()
```
这段代码的输出就是下面这个图的内容:
![Map][3]
你可以从这里下载并运行[完整代码][4]。
最后,这里还有一些关于 Plotly 绘制 choropleth 图的不错的资源。
* <https://github.com/plotly/plotly.py/blob/master/doc/python/choropleth-maps.md>
* <https://plotly.com/python/reference/#choropleth>
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/python-map-covid-19
作者:[AnuragGupta][a]
选题:[lujun9972][b]
译者:[zhangxiangping](https://github.com/zxp93)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/999anuraggupta
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds)
[2]: https://opensource.com/sites/default/files/uploads/jupyter_screenshot.png (Jupyter screenshot)
[3]: https://opensource.com/sites/default/files/uploads/map_2.png (Map)
[4]: https://github.com/ag999git/jupyter_notebooks/blob/master/corona_spread_visualization
[5]: tmp.azs72dmHFd#choropleth

View File

@ -1,24 +1,26 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12933-1.html)
[#]: subject: (Optimize your GNOME experience with the Gedit text editor)
[#]: via: (https://opensource.com/article/20/12/gedit)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 Gedit 文本编辑器优化你的 GNOME 体验
使用 gedit 文本编辑器优化你的 GNOME 体验
======
它是一个可以完成工作的简约编辑器,并以隐藏的增强功能使得事情更简单。
![Working from home at a laptop][1]
作为默认的文本编辑器是一项吃力不讨好的工作。人们通常把默认文本编辑器几乎看作是一个演示应用,一个稍微好一点的 “hello World” 示例,说明应用在该平台上的是如何运行的。在极少数情况下,当用户需要将一些文本保存到一个可能永远不会再看的文件中时,用户会找到默认文本编辑器。对于“严肃”的工作,他们会转向文字处理器或 IDE或终端中的编辑器或者至少是一个不同的文本编辑器必须像“真正的”应用一样下载和安装
> 它是一个可以完成工作的简约编辑器,并以隐藏的增强功能使得事情更简单。
很奇怪,默认的文本编辑器很难被人重视,然而 GNOME 桌面的编辑器 Gedit 却被广泛认为是一个真正有价值的文本编辑器,超越了它所在的桌面。它被用作网页设计课程的必备文本编辑器,是新手开发者和系统管理员的推荐工具,也是许多桌面 Linux 用户最喜欢的可靠伙伴。
![](https://img.linux.net.cn/data/attachment/album/202012/19/110419snchihpnjn8juxqc.jpg)
作为默认的文本编辑器是一项吃力不讨好的工作。人们通常把默认文本编辑器几乎看作是一个演示应用、一个稍微好一点的 “hello World” 示例,说明应用在该平台上的是如何运行的。在极少数情况下,当用户需要将一些文本保存到一个可能永远不会再看的文件中时,用户会找到默认文本编辑器。对于“严肃”的工作,他们会转向文字处理器或 IDE或终端中的编辑器或者至少是一个不同的文本编辑器必须像“真正的”应用一样下载和安装。
很奇怪,默认的文本编辑器很难被人重视,然而 GNOME 桌面的编辑器 gedit 却被广泛认为是一个真正有价值的文本编辑器,超越了它所在的桌面。它被用作网页设计课程的必备文本编辑器,是新手开发者和系统管理员的推荐工具,也是许多桌面 Linux 用户最喜欢的可靠伙伴。
### 安装 gedit
如果你运行的是 GNOME 桌面,你可能已经安装了 gedit尽管它可能只作为“文本编辑器”出现在你的应用菜单中。如果你不确定只需在你的活动界面中输入 **gedit**,然后在打开的文本编辑器中进入**关于**菜单项。
如果你运行的是 GNOME 桌面,你可能已经安装了 gedit尽管它可能只作为“文本编辑器”出现在你的应用菜单中。如果你不确定只需在你的活动界面中输入 `gedit`,然后在打开的文本编辑器中进入 “About” 菜单项。
![gedit terminal box with black background and white letters][2]
@ -28,7 +30,7 @@
### 使用 gedit
当你第一次启动 gedit 时,你会看到一个简约的界面,包括一个文本输入面板、一个标题栏和一个位于窗口底部的状态面板。底部的状态面板提供了一些常用的设置:你想使用哪种语法高亮模式、你喜欢的标签宽度、以及一些流行的偏好,如行号、文本换行等等。这些选项中的大部分也可以在“首选项”菜单中进行全局设置,它可在应用程序右上角的“汉堡”样式的菜单中找到。
当你第一次启动 gedit 时,你会看到一个简约的界面,包括一个文本输入面板、一个标题栏和一个位于窗口底部的状态面板。底部的状态面板提供了一些常用的设置:你想使用哪种语法高亮模式、你喜欢的制表符宽度、以及一些流行的偏好,如行号、文本换行等等。这些选项中的大部分也可以在 “Preferences” 菜单中进行全局设置,它可在应用程序右上角的 “汉堡” 样式的菜单中找到。
### gedit 的隐藏功能
@ -36,19 +38,17 @@
这些键盘功能在 gedit 中并没有被记录下来:
* **Ctrl+D** 删除当前行。这对于编码者或以 markdown 格式(如 Asciidoc、reST 或 CommonMark写作的人特别有用。
* **Ctrl+I** 会弹出 **Go to Line** 下拉框。输入一个数字,你就会立即跳到该行。
* **Alt+向上箭头** 或 **Alt+向下箭头** 会抓取当前行,并将它在文档中向上或向下移动。
* **Alt+向左箭头** 或 **Alt+向右箭头** 抓取最近的单词(在光标左侧)并将其向左或向右移动。
* 要输入特殊的 Unicode 字符,请按下并松开 **Shift+Ctrl+U**,然后输入 Unicode 字符代码。你通常必须查找字符代码(除非你已经记住了一些,但谁有记性来记住这些字符代码?)例如,要打出一只企鹅,按下然后松开 **Shift+Ctrl+U**。当你松开按键后,你会看到一个带下划线的 U然后输入 **1F427**,后面跟一个空格,你的 Unicode 字符就会变成一个友好的 🐧。诚然,这并不完全是 gedit 所独有的,但这是个很有用的技巧,而且它在 gedit 中也确实有效。
* `Ctrl+D` 删除当前行。这对于编码者或以标记格式(如 Asciidoc、reST 或 CommonMark写作的人特别有用。
* `Ctrl+I` 会弹出 “Go to Line” 下拉框。输入一个数字,你就会立即跳到该行。
* `Alt+向上箭头``Alt+向下箭头` 会抓取当前行,并将它在文档中向上或向下移动。
* `Alt+向左箭头``Alt+向右箭头` 抓取最近的单词(在光标左侧)并将其向左或向右移动。
* 要输入特殊的 Unicode 字符,请按下 `Shift+Ctrl+U` 并松开,然后输入 Unicode 字符代码。你通常必须查找字符代码(除非你已经记住了一些,但谁有记性来记住这些字符代码?)例如,要打出一只企鹅,按下 `Shift+Ctrl+U` 然后松开。当你松开按键后,你会看到一个带下划线的 U然后输入 `1F427`,后面跟一个空格,你的 Unicode 字符就会变成一个友好的 `🐧`。诚然,这并不完全是 gedit 所独有的,但这是个很有用的技巧,而且它在 gedit 中也确实有效。
### 稳定简单
Gedit 很像 GNOME 本身。它客观上比许多同类软件(比如 KDE 的 Kate更简单但它仍然能够满足你日常 80% 或 90% 的期望。
当然,可能会有一些任务 gedit 不是最佳工具。你可能会发现自己要深入研究一些独特的日志文件,或者需要一个精确的解析器或代码检查器,你会转向专门的应用。这没关系。Gedit 并不意味着对所有用户都适用。但对于那些需要文本编辑器的人来说,它是一个很好的文本编辑器,有时这就是所需要的。在 Linux 或者在任何你正在使用的平台上,试一下 gedit因为它很有可能是一个比默认的更好的选择。
当然,可能会有一些任务 gedit 不是最佳工具。你可能会发现自己要深入研究一些独特的日志文件,或者需要一个精确的解析器或代码检查器,你会转向专门的应用。这没关系。gedit 并不意味着对所有用户都适用。但对于那些需要文本编辑器的人来说,它是一个很好的文本编辑器,有时这就是所需要的。在 Linux 或者在任何你正在使用的平台上,试一下 gedit因为它很有可能是一个比默认应用的更好的选择。
--------------------------------------------------------------------------------
@ -57,7 +57,7 @@ via: https://opensource.com/article/20/12/gedit
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,70 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Find out how your text will be read with Norka)
[#]: via: (https://opensource.com/article/20/12/norka)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Find out how your text will be read with Norka
======
This is a no-frills text editor designed to provide insight into how
your writing will be read and understood.
![Reading a book, selfcare][1]
Some text editors are designed for programming, others for specialized text formats, others for document design. The Norka text editor is designed for reading. It might seem strange to create a text editor designed for _reading_, but actually, it makes a lot of sense if you think about it. Your text is written once or thrice, depending on your personal tolerance for iteration, but its meant to be read for years to come. Norka makes it easy for you to focus on how your writing is going to get read.
### Installing
The Norka text editor is licensed with an MIT license and can be [installed as a Flatpak on Linux][2]. It is open source, so if you want to try your hand at installing it on a different platform, you may [clone its Github repository][3].
### Norka interface
The Norka interface is simple—a button back to your Norka document collection, an export button, and a preference menu. The rest of the window is blank space for you to write text into, and in the bottom right corner, theres a read time calculator to help you understand how long it might take for readers to get through what youve written.
![Dark Norka terminal box with green and white text][4]
Thats nearly all there is to Norka. There are no page breaks or line numbers, no code-folding or regex searches. This is an editor meant for text writing words, not styling documents or keeping track of a complex data schema.
There are, of course, some extra features. Copy and paste work as expected with **Ctrl+C** and **Ctrl+V**. You can undo with **Ctrl+Z** and find with **Ctrl+F**. You can even insert emoji with **Ctrl+:**.
![Norka terminal box with pop up box of emoji search menu][5]
#### Styling text
While Norka definitely has no interest in helping you design, say, a brochure or flyer, it does have some ability to indicate how you want your text styled. It does this through [Markdown][6], a simple convention for writing in plain text but with special notation to indicate how the text should be rendered later in HTML or EPUB or PDF or whatever your destination may be.
In most editors, you have to know Markdown to use Markdown, but Norka translates common word processor keyboard shortcuts to produce Markdown for you. For instance, to make a word bold, you can press **Ctrl+B**, which inserts four asterisks on either side of your cursor. When you type the next word, its surrounded on either side with two asterisks, which is the Markdown notation for strong (rendered in boldface by default) text. You can view all Markdown shortcuts in the hamburger menu in the upper-right corner of the Norka window.
#### Saving and exporting
You can think of Norka like a notebook. All of the documents you start in Norka remain in Norkas internal database, and everything is saved automatically by default. To work with a file outside of Norka, you use the **Share** button in the top right corner of your open document. Alternately, you can right-click on any document from Norka's file view and select **Export**. You can export (or _share_—Norka uses both terms interchangeably) a document to **Text**, **HTML**, or **Markdown**.
### Try Norka
Norka is easy to try and easy to use. It helps you focus on writing by keeping its interface simple, almost to the point of restriction. But restrictions can be a powerful creative tool, sometimes.
Norka might not be your best choice for heavy revisions or text processing. It doesnt have exciting features like case conversion, integrated **sed** commands, character swapping, and so on. Its a text writer for readers. If that makes sense to you, then you may be just the audience Norka is seeking.
Thanks for spending two minutes and 39 seconds reading this article!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/norka
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/reading_book_selfcare_wfh_learning_education_520.png?itok=H6satV2u (Reading a book, selfcare)
[2]: https://flathub.org/apps/details/com.github.tenderowl.norka
[3]: https://github.com/TenderOwl/Norka
[4]: https://opensource.com/sites/default/files/uploads/norka-31_days-norka-opensource.png (Dark Norka terminal box with green and white text)
[5]: https://opensource.com/sites/default/files/uploads/norka_emoji-31_days-norka-opensource.png (Norka terminal box with pop up box of emoji search menu)
[6]: https://opensource.com/article/19/9/introduction-markdown

View File

@ -1,122 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install RPM Files on Fedora Linux [Beginners Tutorial])
[#]: via: (https://itsfoss.com/install-rpm-files-fedora/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Install RPM Files on Fedora Linux [Beginners Tutorial]
======
_**This beginner article explains how to install RPM packages on Fedora and Red Hat Linux. It also shows you how to remove those RPM packages afterwards.**_
When you start using Fedora Linux in the Red Hat domain, sooner or later, youll 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][1].
You could find and install plenty of software from the software center, specially [if you enable additional repositories in Fedora][2]. But sometimes youll 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**. Dont worry, Ill show you the detailed steps.
### Installing RPM files on Fedora and Red Hat Linux
Ill be showing you three ways to install RPM files:
* [Install RPM files with software center][3] (GUI method)
* [Install RPM files using DNF command][4] (CLI method)
* [Install RPM files using Yum command][5] (CLI method for Red Hat)
#### Method 1: Use software center
The simplest method is to use the default software center in Fedora. Its 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.
![Either double click or right click and choose Software Install][6]
When it is opened in the software center, you should see the installation option. Just hit the install button and enter your accounts password when prompted for it.
![Install RPM via Fedora Software Center][7]
Its easy, right?
#### Method 2: Use DNF command to install RPM file
This is the command line method. Fedora uses the new DNF [package manager][8] 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
```
Heres a screenshot where I installed [Google Chrome on Fedora with dnf command][9]:
![Installing RPM files using DNF command][10]
#### Method 3: Install RPM files in Red Hat using Yum command
Unlike Fedora, Red Hat still uses the good old Yum package manager. You wont 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
```
Thats it. Nothing fancier.
### How to remove RPM packages
Removing a RPM package isnt a big deal either. And no, you dont 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][11]
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 wont remember the exact package name and thats 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.
And thats 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.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-rpm-files-fedora/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://getfedora.org/
[2]: https://itsfoss.com/fedora-third-party-repos/
[3]: tmp.TvkJtlRJ6T#gui-method
[4]: tmp.TvkJtlRJ6T#use-dnf
[5]: tmp.TvkJtlRJ6T#use-yum
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/installing-rpm-file-fedora.png?resize=800%2C449&ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/install-rpm-fedora-software-center.jpg?resize=799%2C193&ssl=1
[8]: https://itsfoss.com/package-manager/
[9]: https://itsfoss.com/install-google-chrome-fedora/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/install-rpm-using-dnf-install.jpg?resize=800%2C474&ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/remove-rpm-package-fedora.jpg?resize=790%2C190&ssl=1

View File

@ -0,0 +1,68 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The role of empathy in DevOps)
[#]: via: (https://opensource.com/article/20/12/empathy-devops)
[#]: author: (Will Kelly https://opensource.com/users/willkelly)
The role of empathy in DevOps
======
DevOps is all about people, and people need empathy to thrive and be
productive. Here's how to build it into your team.
![Teamwork starts with communication across silos][1]
DevOps teams dig in their heels for strength as they face stress and challenges at work and home. Its not something covered in the [DevOps manifesto][2]. Theres also no software you can integrate into your toolchain to help either. What needs to happen is your DevOps teams need to put empathy before tools.
In his book, _[The DevOps Paradox][3]_, Viktor Farcic reasons, if DevOps is, at a fundamental level, about getting different teams to collaborate, you could say that DevOps is a discipline that promotes empathy.
### Recognizing DevOps is a people game
If you agree with Farcic, you see DevOps, at its roots, as a people game. When I was coming up in the tech industry as a technical writer, I realized that development and operations teams spoke different languages. They also had their own cultures. These differences were at the root of arguments between those teams.
"Over the last few decades, though, the notion that empathy cannot co-exist with critical thinking has been slowly diminishing, but not fast enough to have a widespread impact within our industry," according to _[InfoQ][4]_.
Empathy becomes part of the DevOps equation as you develop [more partnerships][5] across your software delivery and business organizations. The silos that arise during waterfall software development include those between software developers, security, and operations. Cultural stereotypes abound between departments. Some software developers are OK with breaking things. The security team is the department of "no." Operations teams want to maintain a pristine operational state, never taking risks, while abiding by their service level agreements (SLAs). Lets not forget that business stakeholders may be out of touch with all those operations. Poking and jabbing at each others real or perceived competence is counterproductive. Talking to each other and learning the other teams processes, appreciating what keeps them up at night, is a powerful step to understanding each other.
The cross-team relationships prevalent in DevOps make empathy necessary. Theres no room in a DevOps toolchain for the stereotypical animosity between developers, operations, and security. Keep your communications channels open. Encourage a culture where making mistakes is about learning and change, not recriminations.
### Practicing empathy in DevOps
Promoting empathy throughout the team is a must for DevOps managers. As a manager, you need to look for opportunities to embed technologists across your business units for one. Getting people to talk across teams is another crucial goal for managers. While DevOps aims to break down silos, it doesnt mean that old rivalries from your pre-DevOps world will go away overnight.
Building empathy as a team isnt about watching an online training video and clicking through a quiz to receive a PDF of a certificate of completion. It starts with relationship building. Look for opportunities to cross-train team members in other jobs. Its not about preparing them to do the job; its about showing them the challenges their other team members face and facilitating knowledge transfer. Manage change in iterations and give your team—developers and sysadmins alike—a feedback channel where problems, challenges, and victories can get the ear of management and their team members.
Empathy powers productivity because it gives your team members a sense of safety, which is a feeling that may be in short supply right now for some team members. Empathy and a little understanding can take some pressure off team members, giving them some more fuel to focus on their tasks at hand.
### Providing empathy as a developer
You also must treat your customer conversations with empathy. Whether your DevOps team is serving internal or external customers, youre bound to notice some personal and business changes in the customer. Leading organizations create value and show empathy in several ways: streamlining or simplifying the customer experience, reacting to the market and environmental changes in near real-time, and predicting customer needs ahead of time, according to _[The Enterprisers Project][6]_.
Other industry watchers see that developers with empathy are best prepared for the rise of artificial intelligence (AI) and empathy helps DevOps teams adjust to more agile forms of thinking.
### Empathy and remote DevOps during COVID-19
Providing empathy during this time starts with remembering that you dont know what somebody is going through when the web conferencing camera is off. Its something Ive had to remind myself a bunch of times since the beginning of the pandemic.
The next steps for remote work are different for all of us. Some DevOps teams will return to their offices at some point in 2021. Some may find themselves in hybrid working arrangements while other groups may remain remote. Unfortunately, some DevOps teams may split up as their employers conduct layoffs, and lucky coworkers land new positions with other employers. As in our personal lives, each unique and developing work situation requires a measure of empathy to help steer the team through change.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/empathy-devops
作者:[Will Kelly][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/willkelly
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/happy-team-sticker-laptop.png?itok=91K77IgE (Teamwork starts with communication across silos)
[2]: https://sites.google.com/a/jezhumble.net/devops-manifesto/
[3]: https://www.amazon.com/DevOps-Paradox-truth-about-people/dp/1789133637
[4]: https://www.infoq.com/articles/guide-empathy-boost-career/
[5]: https://enterprisersproject.com/article/2020/8/it-leadership-how-build-empathy
[6]: https://enterprisersproject.com/article/2020/7/customer-experience-how-develop-empathy

View File

@ -0,0 +1,190 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using pods with Podman on Fedora)
[#]: via: (https://fedoramagazine.org/podman-pods-fedora-containers/)
[#]: author: (Darshna Das https://fedoramagazine.org/author/climoiselle/)
Using pods with Podman on Fedora
======
![Using Pods with Podman][1]
Photo by [Dick Martin][2] on [Unsplash][3]
This article shows the reader how easy it is to get started using pods with Podman on Fedora. But what is Podman? Well, we will start by saying that Podman is a container engine developed by Red Hat, and yes, if you thought about Docker when reading container engine, you are on the right track. A whole new revolution of containerization started with Docker, and Kubernetes added the concept of pods in the area of container orchestration when dealing with containers that share some common resources. But hold on! Do you really think it is worth sticking with Docker alone by assuming its the only effective way of containerization? Podman can also manage pods on Fedora as well as the containers used in those pods.
> [Podman][4] is a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative ([OCI][5]) [Containers][6] and [Container Images][7].
>
> From the official Podman documentation at <http://docs.podman.io/en/latest/>
### Why should we switch to Podman?
Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. Containers can either be run as root or in rootless mode. Podman directly interacts with an image registry, containers and image storage.
### Install Podman:
```
sudo dnf -y install podman
```
### Creating a Pod:
To start using the pod we first need to create it and for that we have a basic command structure
```
```
$ podman pod create
```
```
![][8]
The command above contains no arguments and hence it will create a pod with a randomly generated name. You might however, want to give your pod a relevant name. For that you just need to modify the above command a bit.
```
```
$ podman pod create --name climoiselle
```
```
![][9]
The pod will be created and will report back to you the ID of the pod. In the example shown the pod was given the name climoiselle. To view the newly created pod is easy by using the command shown below:
```
```
$ podman pod list
```
```
![Newly created pods have been deployed][10]
As you can see, there are two pods listed here, one named darshna and the one created from the example named climoiselle. No doubt you notice that both pods already include one container, yet we sisnt deploy a container to the pods yet. What is that extra container inside the pod? This randomly generated container is an infra container. Every podman pod includes this infra container and in practice these containers do nothing but go to sleep. Their purpose is to hold the namespaces associated with the pod and to allow Podman to connect other containers to the pod. The other purpose of the infra container is to allow the pod to keep running when all associated containers have been stopped.
You can also view the individual containers within a pod with the command:
```
```
$ podman ps -a --pod
```
```
![][11]
### Add a container
The cool thing is, you can add more containers to your newly deployed pod. Always remember the name of your pod. Its important as youll need that name in order to deploy the container in that pod. Well use the official ubuntu image and deploy a container using it running the top command.
```
```
$ podman run -dt --pod climoiselle ubuntu top
```
```
![][12]
### Everything in a Single Command:
Podman has an agile characteristic when it comes to deploying a container in a pod which you created. You can create a pod and deploy a container to the said pod with a single command using Podman. Lets say you want to deploy an NGINX container, exposing external port 8080 to internal port 80 to a new pod named test_server.
```
```
$ podman run -dt --pod new:test_server -p 8080:80 nginx
```
```
![Created a new pod and deployed a container together][13]
Lets check all pods that have been created and the number of containers running in each of them …
```
```
$ podman pod list
```
```
![List of the containers, their state and number of containers running into them][14]
Do you want to know a detailed configuration of the pods which are running? Just type in the command shown below:
```
```
podman pod inspect [pod's name/id]
```
```
![][15]
### Make it stop!
To stop the pods, we need to use the name or ID of the pod. With the information from podmans pod list command, we can view the pods and their infra id. Simply use podman with the command stop and give the particular name/infra id of the pod.
```
```
$ podman pod stop climoiselle
```
```
![][16]
### Hey take a look!
![My pod climoiselle stopped][17]
After following this short tutorial, you can see how quickly you can use pods with podman on fedora. Its an easy and convenient way to use containers that share resources and interact together.
### Further reading
The fedora Classrom article <https://fedoramagazine.org/fedora-classroom-containers-101-podman/>. A good starting point for beginners <https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/>. An article on capabilities and podman <https://fedoramagazine.org/podman-with-capabilities-on-fedora/>. Podmans documentation site <http://docs.podman.io/en/latest/>.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/podman-pods-fedora-containers/
作者:[Darshna Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/climoiselle/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/12/using-pods-w-podman-816x346.png
[2]: https://unsplash.com/@dick42420?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/seals-in-canada?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: http://podman.io
[5]: https://www.opencontainers.org/
[6]: https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.j2uq93kgxe0e
[7]: https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.dqlu6589ootw
[8]: https://fedoramagazine.org/wp-content/uploads/2020/12/Podman0-1-1-1024x328.png
[9]: https://fedoramagazine.org/wp-content/uploads/2020/12/Podman1-1-1024x355.png
[10]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman3-1024x334.png
[11]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman4-1-1024x221.png
[12]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman8-1024x739.png
[13]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman9-1024x348.png
[14]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman10-1024x341.png
[15]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman5-808x1024.png
[16]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman11-1024x279.png
[17]: https://fedoramagazine.org/wp-content/uploads/2020/12/podman12-1024x362.png

View File

@ -1,154 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (zhangxiangping)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How I use Python to map the global spread of COVID-19)
[#]: via: (https://opensource.com/article/20/4/python-map-covid-19)
[#]: author: (AnuragGupta https://opensource.com/users/999anuraggupta)
如何使用Python绘制COVID-19的全球扩散图
======
使用这些开源框架创建一个彩色地图,显示病毒的可能的传播路径。![Globe up in the clouds][1]
在全球范围内的旅行中疾病的传播是一个令人担忧的问题。一些组织会跟踪重大的流行病还有所有普遍的流行病并将他们的跟踪工作获得的数据公开出来。这些原生的数据对人来说可能很难处理这就是为什么数据科学如此重要的原因。比如将COVID-19在全球范围内的传播路径用Python和Pandas进行可视化可能对这些数据的分析有所帮助。
最开始当面对如此大数量的原始数据时可能难以下手。但当你开始处理数据之后慢慢地就会发现一些处理数据的方式。下面是用于处理COVID-19数据的一些常见的情况
1. 从Github上下载COVID-19的国际间每日传播数据保存为一个Pandas中的DataFrame对象。这时你需要使用Python中的Pandas库。
2. 处理并清理下载好的数据使其满足可视化数据的输入格式。所下载的数据的情况很好数据规整。这个数据有一个问题是它用国家的名字来标识国家但最好是使用ISO 3码国家代码表来标识国家。为了生成三位ISO 3码可是使用pycountry这个Python库。生成了这些代码之后可以在原有的DataFrame上增加一列然后用这些代码填充进去。
3. 最后为了可视化使用Plotly库中的**express**模块。这篇文章是使用choropleth maps在Plotly库中来对疾病在全球的传播进行可视化的。
### 第一步Corona数据
从下面这个网站上下载最新的corona数据译者注2020-12-14仍可访问有墙
<https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv>
我们之间将这个下载好的数据载入为Pandas的DataFrame。Pandas提供了一个函数 **read_csv()**可以直接使用URL读取数据并返回一个DataFrame对象具体如下所示
```
import pycountry
import plotly.express as px
import pandas as pd
URL_DATASET = r'<https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv>'
df1 = pd.read_csv(URL_DATASET)
print(df1.head(3))  # Get first 3 entries in the dataframe
print(df1.tail(3))  # Get last 3 entries in the dataframe
```
在Jupyter上的输出截图
![Jupyter screenshot][2]
从这个输出可以看到这个DataFramedf1包括以下几列数据
1. Date
2. Country
3. Confirmed
4. Recovered
5. Dead
之后还可以看到**Date**这一列包含了从1月22日到3月31日的条目信息。这个数据是每天更新的所以你会得到你当天的值。
### 第二步:清理和修改数据框
我们要往这个DataFrame中增加一列数据就是那个包含了ISO 3编码。可以通过以下三步完成这个任务
1. 创建一个包含所有国家的list。因为在**df**的**Country**列中,国家都是每个日期就重复一次。所以实际上**Country**列中对每个国家就会有多个条目。我使用**unique().tolist()**函数完成这个任务。
2. 我使用**d_country_code**字典对象初始为空然后将其键设置为国家的名称然后它的值设置为其对应的ISO 3编码。
3. 我使用**pycountry.countries.search_fuzzy(country)**为每个国家生成ISO 3编码。你需要明白的是这个函数的返回值是一个**Country**对象的list。我将这个函数的返回值赋给country_data对象。之以这个对象的第一个元素序号0为例。这个**\**对象有一个**alpha_3**属性。所以我使用**country_data[0].alpha_3**就能"获得"第一个元素的ISO 3编码。然而在这个DataFrame中有些国家的名称可能没有对应的ISO 3编码比如有争议的领土。那么对这些“国家”我就用一个空白字符串来替代ISO编码。你也可以用一个try-except代码来替换这部分。except中的语句可以写**print(_could not add ISO 3 code for -&gt;'_, country)**。这样就能在找不到这些“国家”对应的ISO 3编码时给出一个输出提示。实际上你会发现这些“国家”会在最后的输出中用白色来表示。
4. 在获得了每个国家的ISO 3编码有些是空白字符串之后我把这些国家的名称作为键还有国家对应的ISO 3编码作为值添加到之前的字典**d_country_code**中。可以使用Python中字典对象的**update()**方法来完成这个任务。
5. 在创建好了一个包含国家名称和对应ISO 3编码的字典之后我使用一个简单的循环将他们加入到DataFrame中。
### 第三步使用Plotly可视化传播路径
choropleth图是一个由彩色多边形组成的图。它常常用来表示一个变量在空间中的变化。我们使用Plotly中的**px**模块来创建choropleth图具体函数为**px.choropleth**。
这个函数的所包含的参数如下:
```
`plotly.express.choropleth(data_frame=None, lat=None, lon=None, locations=None, locationmode=None, geojson=None, featureidkey=None, color=None, hover_name=None, hover_data=None, custom_data=None, animation_frame=None, animation_group=None, category_orders={}, labels={}, color_discrete_sequence=None, color_discrete_map={}, color_continuous_scale=None, range_color=None, color_continuous_midpoint=None, projection=None, scope=None, center=None, title=None, template=None, width=None, height=None)`
```
**choropleth()**这个函数还有几点需要注意:
1. **geojson**是一个geometry对象上面函数第六个参数。这个对象有点让人困扰因为在函数文档中没有明确地提到这个对象。你可以提供也可以不提供**geojson**对象。如果你提供了**geojson**对象,那么这个对象就会被用来绘制地球特征,如果不提供**geojson**对象那这个函数默认就会使用一个内建的geometry对象。在我们的实验中我们使用内建的geometry对象因此我们不会为**geojson**参数提供值)
2. DataFrame对象有一个**data_frame**属性,在这里我们先前就提供了一个我们创建好的**df1**。
3. 我们用**Confirmed**(确诊)来决定每个国家多边形的颜色。
4. 最后,我们**Date**列创建一个**animation_frame**。这样我们就能通过日期来划分数据,国家的颜色会随着**Confirmed**的变化而变化。
最后完整的代码如下:
```
import pycountry
import plotly.express as px
import pandas as pd
# ----------- Step 1 ------------
URL_DATASET = r'<https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv>'
df1 = pd.read_csv(URL_DATASET)
# print(df1.head) # Uncomment to see what the dataframe is like
# ----------- Step 2 ------------
list_countries = df1['Country'].unique().tolist()
# print(list_countries) # Uncomment to see list of countries
d_country_code = {}  # To hold the country names and their ISO
for country in list_countries:
    try:
        country_data = pycountry.countries.search_fuzzy(country)
        # country_data is a list of objects of class pycountry.db.Country
        # The first item  ie at index 0 of list is best fit
        # object of class Country have an alpha_3 attribute
        country_code = country_data[0].alpha_3
        d_country_code.update({country: country_code})
    except:
        print('could not add ISO 3 code for -&gt;', country)
        # If could not find country, make ISO code ' '
        d_country_code.update({country: ' '})
# print(d_country_code) # Uncomment to check dictionary  
# create a new column iso_alpha in the df
# and fill it with appropriate iso 3 code
for k, v in d_country_code.items():
    df1.loc[(df1.Country == k), 'iso_alpha'] = v
# print(df1.head)  # Uncomment to confirm that ISO codes added
# ----------- Step 3 ------------
fig = px.choropleth(data_frame = df1,
                    locations= "iso_alpha",
                    color= "Confirmed",  # value in column 'Confirmed' determines color
                    hover_name= "Country",
                    color_continuous_scale= 'RdYlGn',  #  color scale red, yellow green
                    animation_frame= "Date")
fig.show()
```
这段代码的输出就是下面这个图的内容:
![Map][3]
你可以从这里下载并运行完整代码[complete code][4]。
最后这里还有一些关于Plotly绘制choropleth图的不错的资源。
* <https://github.com/plotly/plotly.py/blob/master/doc/python/choropleth-maps.md>
* [https://plotly.com/python/reference/#choropleth][5]
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/4/python-map-covid-19
作者:[AnuragGupta][a]
选题:[lujun9972][b]
译者:[zhangxiangping](https://github.com/zxp93)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/999anuraggupta
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds)
[2]: https://opensource.com/sites/default/files/uploads/jupyter_screenshot.png (Jupyter screenshot)
[3]: https://opensource.com/sites/default/files/uploads/map_2.png (Map)
[4]: https://github.com/ag999git/jupyter_notebooks/blob/master/corona_spread_visualization
[5]: tmp.azs72dmHFd#choropleth

View File

@ -0,0 +1,122 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install RPM Files on Fedora Linux [Beginners Tutorial])
[#]: via: (https://itsfoss.com/install-rpm-files-fedora/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何在 Fedora Linux 上安装 RPM 文件 [初学者教程]
======
_**这篇初学者文章介绍如何在 Fedora 和 Red Hat Linux 上安装 RPM 软件包。它也随后向你展示如何移除这些 RPM 软件包。**_
当你开始使用 Red Hat 系的 Fedora Linux 时,你早晚会偶然发现 .rpm 文件。就像在 Windows 中的 .exe 文件,以及在 Ubuntu 和 Debian 中的 .deb 文件一样,一个 rpm 文件能够使你在 [Fedora][1] 上快速安装一个软件。
你可以从软件中心中找到并安装大量的软件,特别是 [如果你在 Fedora 中启用附加的存储库的话][2]。但是有时你会在它们的网站上找到可用的 RPM 格式的软件包。
就像在 Windows 中的 .exe 文件一样,你可以通过 **下载 .rpm 文件并双击它来安装**。不用担心,我将向你展示详细的步骤。
### 在 Fedora 和 Red Hat Linux 上安装 RPM 文件
我将向你展示安装 RPM 文件的三个方法:
* [使用软件中心安装 RPM 文件][3] (GUI 方法)
* [使用 DNF 命令安装 RPM 文件][4] (CLI 方法)
* [使用 Yum 命令安装 RPM 文件][5] (Red Hat 的 CLI 方法)
#### 方法 1: 使用软件中心
在 Fedora 中使用默认的软件中心是最简单的方法。它真地很简单。转到你下载的 .rpm 文件的文件夹位置。它通常在 Downloads 文件夹。
只需要 **双击 RPM 文件,它将会在软件中心中打开**
或者,你可以在 RPM 文件上右键单击并选择通过软件中心来安装它。
![或者双击或者右键并选择软件安装][6]
当它在软件中心打开时,你应该会看到安装选项。只需要点击安装按钮并在提示时输入你的账号密码。
![通过 Fedora 软件中心安装 RPM][7]
它很简单,对吗?
#### 方法 2: 使用 DNF 命令来安装 RPM 文件
这是命令行方法。Fedora 使用新的 DNF [软件包管理器][8] ,你也可以使用它来安装下载的 RPM 文件。
打开一个终端并切换到你下载 RPM 文件的目录下。你也可以通过到 RPM 文件的路径。像这样使用 DNF 命令:
```
sudo dnf install rpm_file_name
```
这是一个我 [在 Fedora 上使用 dnf 命令安装 Google Chrome][9] 屏幕截图:
![使用 DNF 命令安装 RPM 文件][10]
#### 方法 3: 在 Red Hat 中使用 Yum 命令安装 RPM 文件
不像 Fedora Red Hat 仍然使用很好的旧式的 Yum 软件包管理器。在这里你还不能找到 DNF 命令。
这个过程与 DNF 命令相同。转到 RPM 文件所在的目录或提供它的路径。
```
sudo yum install path_to_RPM_file
```
就是这样。没有一点异常花哨的东西。
### 如何移除 RPM 软件包
移除一个 RPM 软件包也不是一个什么大的问题。并且,你不需要原始的用来安装程序的 rpm 文件。
你可以在软件中心中找到已安装的软件包,并从其中移除应用程序。
![移除 RPM 软件包][11]
或者,你可以使用带有 `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][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://getfedora.org/
[2]: https://itsfoss.com/fedora-third-party-repos/
[3]: tmp.TvkJtlRJ6T#gui-method
[4]: tmp.TvkJtlRJ6T#use-dnf
[5]: tmp.TvkJtlRJ6T#use-yum
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/installing-rpm-file-fedora.png?resize=800%2C449&ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/install-rpm-fedora-software-center.jpg?resize=799%2C193&ssl=1
[8]: https://itsfoss.com/package-manager/
[9]: https://itsfoss.com/install-google-chrome-fedora/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/install-rpm-using-dnf-install.jpg?resize=800%2C474&ssl=1
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/remove-rpm-package-fedora.jpg?resize=790%2C190&ssl=1