Merge pull request #2 from LCTT/master

Updated
This commit is contained in:
chenmu-kk 2020-11-18 19:00:33 +08:00 committed by GitHub
commit d7cffbef9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 2129 additions and 344 deletions

View File

@ -1,13 +1,13 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12834-1.html)
[#]: subject: (KDE Neon vs Kubuntu: Whats the Difference Between the Two KDE Distribution?)
[#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
KDE Neon vs Kubuntu两款 KDE 发行版有什么区别?
KDE Neon vs Kubuntu两款 KDE 发行版有什么区别?
======
当你发现两款基于 [Ubuntu][1] 并由 [KDE][2] 驱动的 Linux 发行版,你会选择哪一个?
@ -15,19 +15,17 @@ KDE Neon vs Kubuntu两款 KDE 发行版有什么区别?
* [Kubuntu][3] 是 Ubuntu 的官方 KDE 版本。
* [KDE Neon][4] 是 KDE 自己发布的基于 Ubuntu 的发行版。
我知道这常常会让人感到困惑,尤其是当你从来没有使用过这两个版本,但得到了使用它们的建议。因此,为了帮助你做出决定,我想整理了一份 KDE Neon 和 Kubuntu 的区别(和相似之处)。
我知道这常常会让人感到困惑,尤其是当你从来没有使用过这两个版本,但有人推荐你使用它们。因此,为了帮助你做出决定,我想整理一份 KDE Neon 和 Kubuntu 的区别(和相似之处)。
让我们先开始了解相似之处,然后再继续了解不同之处。
**注:**_根据你的系统,你对这两个发行版的体验可能有所不同。所以,请把这篇文章作为一个参考,而不是一个”哪个更好“的比较。_
注:根据你的系统,你对这两个发行版的体验可能有所不同。所以,请把这篇文章作为一个参考,而不是一个”哪个更好“的比较。
### KDE Neon vs Kubuntu功能上的比较
![][5]
比较发行版相似性来总是好的。所以,从理论上,我试图把最重要的区别写下来。
基于相似性比较发行版是一个不错的做法。所以,从理论上,我试图把最重要的区别写下来。
然而,值得注意的是,发行版的兼容性、性能和稳定性会根据你的硬件而有所不同,而这里没有考虑到这一点。
@ -37,9 +35,9 @@ KDE Neon vs Kubuntu两款 KDE 发行版有什么区别?
是的,这两个 Linux 发行版都是基于 Ubuntu 的,但 KDE Neon 只基于最新的 Ubuntu LTS 版本,而 Kubuntu 则提供了基于 Ubuntu LTS 的版本和非 LTS 版本。
所以,如果使用 KDE Neon你可以期望在下一个 Ubuntu LTS 版本2 年)的几个月后就能用上最新的 Ubuntu 功能。但是,对于 Kubuntu 来说,你可以选择一个非 LTS 版本,并尝试使用最新 Ubuntu 版本的 6 个月的软件更新
所以,如果使用 KDE Neon你可以期望在下一个 Ubuntu LTS 版本(2 年)的几个月后就能用上最新的 Ubuntu 功能。但是,对于 Kubuntu 来说,你可以选择一个非 LTS 版本,并尝试使用带有 6 个月的软件更新的最新 Ubuntu 版本。
KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试预发布的 KDE 软件。
KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试预发布的 KDE 软件而提供的
#### KDE Plasma 桌面
@ -47,34 +45,33 @@ KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试
尽管这两个发行版都采用了 KDE plasma 桌面,而且你可以获得相同程度的定制,但 KDE Neon 会首先获得最新的 KDE Plasma 桌面。
如果你还不知道KDE Neon 是由 KDE 官方团队开发的,由 Jonathan RiddellKubuntu 创始人)在[被 Canonical 强制退出 Kubuntu][8] 后宣布的。
如果你还不知道KDE Neon 是由 KDE 官方团队开发的,由 Jonathan RiddellKubuntu 创始人)在[被 Canonical 强制出 Kubuntu][8] 后宣布的。
所以,不仅仅局限于最新的 Plasma 桌面,如果你想尽快获得最新最好的 KDEKDE Neon 是最佳选择。
所以,不仅限于最新的 Plasma 桌面,如果你想尽快获得最新最好的 KDEKDE Neon 是最佳选择。
Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如果你不太确定最新的 KDE 软件/桌面,而你需要的只是一个稳定的 KDE 系统,你应该选择 Kubuntu LTS 版本。
Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如果你不太确定需要最新的 KDE 软件/桌面,而只是需要一个稳定的 KDE 系统,你应该选择 Kubuntu LTS 版本。
#### 预装软件
开箱即用,你会发现 Kubuntu 已经预装了一些必要的工具和应用程序,但是,对于 KDE Neon你需要找到并安装一些应用和工具。
为了给你一些视角,与 Kubuntu 相比KDE Neon 可能是一个轻量级的发行版。然而,对于新的 Linux 用户来说,他们可能会发现 Kubuntu 是一个易于使用的体验,并预装了更多必要的软件和工具。
从某些方面看,与 Kubuntu 相比KDE Neon 可能是一个轻量级的发行版。然而,对于新的 Linux 用户来说,他们可能会发现 Kubuntu 是一个易于使用的体验,并预装了更多必要的软件和工具。
#### 软件更新
如果你没有使用按流量计费的连接,这可能根本不重要。但是,我应该提一下,考虑到常规的 Ubuntu LTS 修复/更新以及 KDE 软件更新KDE Neon 会得到更多的软件更新。
如果你没有使用按流量计费的连接,这可能根本不重要。但是,我应该提一下,考虑到常规的 Ubuntu LTS 修复/更新以及 KDE 软件更新KDE Neon 会更多的软件更新。
对于 Kubuntu你只会得到 Ubuntu LTS 的更新(除非你使用的是非 LTS 版本)。所以,从技术上讲,你会得到更少的更新数量。
对于 Kubuntu你只会得到 Ubuntu LTS 的更新(除非你使用的是非 LTS 版本)。所以,从技术上讲,你会更少的更新数量。
#### Ubuntu KDE 版与 Plasma 的体验差异
![][11]
我知道如果你没有尝试过这两个版本你可能会认为它们很相似。但是Kubuntu 是 Ubuntu 的官方版本,它更注重在 KDE 桌面环境上使用 Ubuntu 的体验。
我知道如果你没有尝试过这两个版本你可能会认为它们很相似。但是Kubuntu 是 Ubuntu 的官方版本,它更注重 Ubuntu 在 KDE 桌面环境上使用体验。
而 KDE Neon 在技术上是一样的,但它的目的是为了获得一流的 Plasma 桌面体验,并搭载最新的东西。
尽管这两个发行版开箱即可完美工作,但它们有不同的愿景,而开发也相应地进行。你只需要决定你自己想要什么,然后选择其中之一。
尽管这两个发行版开箱即可完美工作,但它们有不同的愿景和相应的开发工作。你只需要决定你自己想要什么,然后选择其中之一。
#### 硬件兼容性
@ -84,7 +81,7 @@ Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如
只需要记住,如果你尝试 KDE Neon但由于某些原因不能工作。你知道该怎么做。
**总结**
### 总结
那么你会选择哪个呢KDE Neon 还是 Kubuntu这完全是你的选择。
@ -99,7 +96,7 @@ via: https://itsfoss.com/kde-neon-vs-kubuntu/
作者:[Ankush Das][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

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: ( )
[#]: url: ( )
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12830-1.html)
[#]: subject: (4 reasons why JavaScript is so popular)
[#]: via: (https://opensource.com/article/20/11/javascript-popular)
[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha)
@ -12,7 +12,7 @@ JavaScript 如此受欢迎的 4 个原因
> JavaScript 之所以能在编程语言中名列前茅,是有充分的理由的。
![JavaScript in Vim][1]
![](https://img.linux.net.cn/data/attachment/album/202011/17/102936u1hghm95bbu7xjxg.jpg)
如 GitHub 的 [The State of the Octoverse][2] 报告的这张图所示,如果按 GitHub 上项目的贡献者数量统计,[JavaScript][3] 一直是最受欢迎的编程语言。
@ -30,15 +30,15 @@ JavaScript 不需要任何环境设置,只要打开浏览器,比如 Chrome
console.log("Hello World");
```
JavaScript 的灵活性最适合中级开发人员。该语言只是通过让开发人员专注于解决问题来帮助完成任务。开发者可以混合使用插件和自己的代码片段来让一个应用程序工作。
JavaScript 的灵活性最适合中级开发人员。该语言通过让开发人员专注于解决问题来帮助完成任务。开发者可以混合使用插件和自己的代码片段来让一个应用程序工作。
虽然 JavaScript 比较容易上手,但它并不是一下子就能掌握的。如果你想达到高级水平,这里有一些你需要了解的概念:
虽然 JavaScript 比较容易上手,但它并不是一下子就能掌握的。如果你想达到高级水平,这里有一些你需要了解的概念:
* **JavaScript 的[多范式][8]特性:** JavaScript 同时支持函数式编程和面向对象编程OOP
* **在 JavaScript 中应用[设计模式][9]** 模型-视图-*[MV*][10])设计模式一直是最流行的模式之一,并促成了[多个现代框架][11]的发展。
* **[带原型链的继承][12]** JavaScript 由于其动态的特性,无法实现传统的 Java 基于类的模式下的 OOP。JavaScript 中的 OOP 是通过原型继承模型实现的。
* **[闭包][13]** 闭包可以从内部函数中访问外部函数的作用域。
* **[Currying][14]** Currying 是函数的一种转换,它将函数从 `f(a, b, c)` 的调用形式转换为 `f(a)(b)(c)` 调用形式。
* **<ruby>[柯里化][14]<rt>Currying</rt></ruby>** 柯里化是函数的一种转换,它将函数从 `f(a, b, c)` 的调用形式转换为 `f(a)(b)(c)` 调用形式。
* **[Promises][15] 和 [Observables][16]** 这些可以帮助你处理异步函数。
* **[TypeScript][17]** 在 JavaScript 中添加了静态类型。
@ -63,7 +63,7 @@ JavaScript 已经存在了 25 年,背后有一个庞大的社区。开发者
### 未来
JavaScript 是永恒的。全栈开发和现代前端框架继续帮助 JavaScript 巩固其作为最受欢迎的编程语言之一的地位。
JavaScript 将长期存在。全栈开发和现代前端框架继续帮助 JavaScript 巩固其作为最受欢迎的编程语言之一的地位。
JavaScript 的[下一波][26]可能会将焦点放在。
@ -88,7 +88,7 @@ via: https://opensource.com/article/20/11/javascript-popular
[2]: https://octoverse.github.com/
[3]: https://en.wikipedia.org/wiki/JavaScript
[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report)
[5]: https://opensource.com/article/20/10/javascript-part-1
[5]: https://linux.cn/article-12813-1.html
[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39
[7]: https://developers.google.com/web/tools/chrome-devtools
[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12835-1.html)
[#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt)
[#]: via: (https://itsfoss.com/timekpr-next/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
@ -10,7 +10,9 @@
有孩子吗?使用 Timekpr-nExt 限制 Linux 中每个账户的电脑使用
======
_**本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用于限制 Linux 系统中某些账户的电脑使用。对于不想让孩子花太多时间在电脑上的父母来说,这是一个方便的工具。**_
![](https://img.linux.net.cn/data/attachment/album/202011/18/004039svxva9wrvva2xias.jpg)
> 本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用于限制 Linux 系统中某些账户的电脑使用。对于不想让孩子花太多时间在电脑上的父母来说,这是一个方便的工具。
### 使用 Timekpr-nExt 在 Linux 上限制电脑使用
@ -20,33 +22,29 @@ _**本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用
![][1]
给定的时间超过后,用户会自动注销,直到满足限制条件才可以重新登录。
给定的时间超过后,用户会自动登出,直到满足限制条件才可以重新登录。
![][2]
当然,这意味着你需要为孩子们单独设置非管理员(无 sudo 权限)账户。如果孩子们的账户也有管理员权限,他们可以很容易地改变设置。孩子们很聪明,你知道的。
当然,这意味着你需要为孩子们单独设置非管理员(无 `sudo` 权限)账户。如果孩子们的账户也有管理员权限,他们可以很容易地改变设置。孩子们很聪明,你知道的。
### Timekpr-nExt 的功能
除了一个令人讨厌的风格化的名字Timekpr-nExt 有以下功能:
* 将系统使用限制设置为日智能限制、每日限制、每周或每月限制
* 将系统使用限制设置为日智能限制、每日、每周或每月限制
* 你还可以根据时间和小时设置访问限制
* 用户可以看到关于他们还剩多少时间的通知
* 设置锁定动作(终止会话、关闭、暂停或锁定屏幕)
* 追踪账户的时间使用情况
请注意以下事项:
* 仔细检查你正在配置的账户。_**不要把自己锁定**_。
* 每次更改配置时,请点击应用或设置按钮,否则更改将不会被设置
* 儿童帐户不应该有管理员操作,否则他们会覆盖设置
* 仔细检查你正在配置的账户。**不要把自己锁定**
* 每次更改配置时,请点击应用或设置按钮,否则更改将不会被设置
* 儿童帐户不应该有管理员操作,否则他们会覆盖设置
阅读[关于使用 Timekpr-nExt 的更多信息的文档][3]。
这里阅读[关于使用 Timekpr-nExt 的更多信息的文档][3]。
### 在 Linux 中安装 Timekpr-nExt
@ -60,9 +58,9 @@ sudo apt install timekpr-next
Arch Linux 用户可以[在 AUR 中找到它][5]。对于其他用户,请检查你的发行版仓库。如果没有这样的包,你可以尝试使用源码。
[Timekpr-nExt 源码][6]
- [Timekpr-nExt 源码][6]
_**再说一次,不要在主账户中使用 Timekpr-nExt。你可能会把自己锁在外面。**_
**再说一次,不要在主账户中使用 Timekpr-nExt。你可能会把自己锁在外面。**
你会看到两个应用的实例。使用开头有 SU 的那个。
@ -95,7 +93,7 @@ via: https://itsfoss.com/timekpr-next/
作者:[Abhishek Prakash][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

@ -1,66 +1,64 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-12831-1.html)
[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods])
[#]: via: (https://itsfoss.com/check-free-disk-space-linux/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何在 Linux 上检查可用的磁盘空间 [终端和 GUI 方法]
如何在 Linux 上检查可用的磁盘空间
======
_**我已经使用了多少磁盘空间?**_
![](https://img.linux.net.cn/data/attachment/album/202011/17/111346h0vrdvldsy6hlhlh.jpg)
在 Linux 上查找可用磁盘空间的最简单的方法是 [使用 df 命令][1] 。df 命令从字面意思上代表着可用空间,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。
> 我已经使用了多少磁盘空间?
在 Linux 上查找可用磁盘空间的最简单的方法是[使用 df 命令][1] 。`df` 命令从字面意思上代表着<ruby>磁盘可用空间<rt>disk free</rt></ruby>,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。
```
df -h
```
使用 `-h` 选项,它将以人类可读的格式 (MB 和 GB) 来显示磁盘空间。
使用 `-h` 选项,它将以人类可读的格式MB 和 GB来显示磁盘空间。
这里是针对我 Dell XPS 系统的 df 命令的输出,它使用了加密磁盘并且只安装了 Linux :
这里是针对我 Dell XPS 系统的 `df` 命令的输出,它使用了加密磁盘并且只安装了 Linux
![在 Linux 中使用 df 命令检查可用磁盘空间][2]
如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。_**我也将为桌面 Linux 用户展示 GUI 方法。**_
如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。我也将为桌面 Linux 用户展示 GUI 方法。
### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出)
### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出)
当你使用 df 命令来检查磁盘空间时,它将显示一组 ‘文件系统’,包括它们的大小,使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个:
当你使用 `df` 命令来检查磁盘空间时,它将显示一组“文件系统”,包括它们的大小、使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个:
* /dev/sda
* /dev/sdb
* /dev/nvme0n1p
* `/dev/sda`
* `/dev/sdb`
* `/dev/nvme0n1p`
这不是硬性的标准,但是它可以给予你一个指示,它可以让你能够很容易地从一堆文字中辨别出真正的磁盘。
你的 Linux 系统在你的磁盘上可能有一些用于引导 分区、EFI 分区、根分区、交换分区、家目录等的分区。在这种情况下,这些分区在“磁盘名称”的结尾处使用一个数字来标示,像 `/dev/sda1`、`/dev/nvme0n1p2` 等等。
这不是硬性的标准,但是它给予你一个标志,它可以让你能够很容易地从一堆文字中辨别出真正是磁盘
你可以从它们的挂载点来辨认出哪个分区是用于做什么的。根分区挂载在 `/`、EFI 分区在 `/boot/EFI` 等等
你的 Linux 系统在你的磁盘上可能有一些用于 boot, EFI, root, swap, home 等的分区。在这种情况下,这些分区在 ‘磁盘名称’ 的结尾处使用一个数字来标示,像 /dev/sda1, /dev/nvme0n1p2 等等。
你可以从它们的挂载点来辨认出哪个分区是用于做什么的。Root 挂载在 /, EFI 在 /boot/EFI 等等。
就我的情况来说,我已经使用了 root 分区下磁盘空间 ( 232 GB ) 的 41% 。如果你有 2 到 3 个大分区(像 root, home 等等),你将不得不在这里计算一下已使用的磁盘空间。
就我的情况来说我已经使用了根分区下磁盘空间232 GB的 41% 。如果你有 2 到 3 个大分区(像根分区、家目录分区等等),你将不得不在这里计算一下已使用的磁盘空间。
![理解 df 命令输出][3]
* **tmpfs**: [tmpfs][4] (临时文件系统) 用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。
* **udev**: [udev 文件系统][5] 用于存储插入到你系统的设备(像 USB网卡CD ROM 等等) 的相关信息。你也可以忽略它。
* **/dev/loop**: 它们是 loop 设备。由于 snap 应用程序,在 Ubuntu 中查磁盘时,你将看到很多的这样的设备。loop 设备是虚拟设备,它们允许普通文件作为块设备文件来访问。使用 loop 设备snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在 root 下,但是你不需要单独计算它们使用的磁盘空间。
* `tmpfs`[tmpfs][4](临时文件系统)用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。
* `udev`[udev 文件系统][5] 用于存储插入到你系统的设备(像 USB、网卡、CD ROM 等等)的相关信息。你也可以忽略它。
* `/dev/loop`: 它们是环回设备。由于 snap 应用程序,在 Ubuntu 中查磁盘时,你将看到很多的这样的设备。环回设备是虚拟设备它们允许普通文件作为块设备文件来访问。使用环回设备snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在根分区下,但是你不需要单独计算它们使用的磁盘空间。
#### 丢失了磁盘空间?检查你是否挂载了所有是磁盘和分区
记住,`df` 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版(或者多个操作系统),或者在你的系统上有多个磁盘,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。
#### 丢失磁盘空间?检查你是否挂载了所有是磁盘和分区
记住df 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版 (或者多个操作系统),或者在你的系统上有多个磁盘 ,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。
例如,我的 [Intel NUC][6] 有两个 SSD 磁盘并且在其上有4个或5个 Linux 分区。仅当我明确地挂载它们时df 命令才会显示附加的磁盘。
例如,我的 [Intel NUC][6] 有两个 SSD 磁盘,并且在其上有 4 个或 5 个 Linux 分区。仅当我明确地挂载它们时,`df` 命令才会显示更多磁盘。
![][7]
你可以使用 lsblk 命令来查看在你系统上的所有磁盘和分区。
你可以使用 `lsblk` 命令来查看在你系统上的所有磁盘和分区。
![][8]
@ -74,7 +72,7 @@ sudo mount /dev/sdb2 /mnt
### 方法 2: 在 GUI 下检查可用磁盘使用情况
在 Ubuntu 中使用 Disk Usage Analyzer 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。
在 Ubuntu 中使用 Disk Usage Analyzer 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。
![Disk Usage Analyzer 工具][9]
@ -88,15 +86,15 @@ sudo mount /dev/sdb2 /mnt
![GNOME 的 Disks 工具][11]
启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 play 图标来挂载它。
启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 “▶” 图标来挂载它。
![检查 Ubuntu 的桌面版本的可用磁盘空间][12]
我认为在 Linux 上的所有主要桌面环境都有某种图形工具来检查磁盘使用情况。你可以在你是桌面 Linux 系统的菜单中搜索它。
**结束语**
### 结束语
当然,这里可能有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。
当然,有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。
我也解释一些可能会让你很难理解磁盘使用情况的东西。希望你喜欢它。
@ -109,7 +107,7 @@ via: https://itsfoss.com/check-free-disk-space-linux/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者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,67 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (3 ways managers build team culture around open source)
[#]: via: (https://opensource.com/article/20/11/selfless-culture)
[#]: author: (Shishir Kamboj https://opensource.com/users/shishirkamboj)
3 ways managers build team culture around open source
======
Contributing to open source prevents complacency and teaches people the
value of giving to the greater good.
![Teammates shaking hands and smiling in an office][1]
Whether you are a senior leader or an individual contributor, you make decisions based on your personal, peers', and colleagues' experiences and feedback. If the people around you are evolving, you will grow with them, as will the organization you support. If the backgrounds and knowledge of the people around you are diverse and changing, you and your team will benefit.
I've noticed that my skillset and contributions give diminishing returns if I am not challenged. Human beings tend to get into their comfort zones quickly. We get used to working a certain way, and we start to depend on key people to make decisions for us. This leads to complacency, which does not change unless we are challenged due to market shifts or other external forces.
A selfless approach contributes to growth in career and skillsets as well as helps others grow. When we not only promote ourselves but the right person for the right job, we can be better team players. Our focus becomes what is right for the organization, not what is right for us. It helps both individuals and organizations when we are more flexible and ready for change.
The big question is: How can you create opportunities for change and create a selfless approach on your team? It may be difficult to ask your employees to be completely selfless. But as leaders, we can align our teams' and employees' growth to the organization's development. The following are a few ways to achieve this.
### 1\. Help employees create a career
Invest in your teams. Set a career path for each team member. You may find employees who are happy working on the same things year after year. While I agree that it is essential to have expertise, this can easily lead to complacency and hoarding. I see these as significant concerns.
When you like what you do, you can excel at it. You should achieve consistent improvement in the knowledge and exposure you get. It helps if you have a forte in an area where you are a point person across the board. At the same time, it's essential to move forward while looking for new avenues to contribute. Working on open source software is an excellent way to make that happen.
In one of my earlier roles, I led an infrastructure services team. For a long time, this group focused on data center design, hardware, and network engineering. As cloud services started emerging, the team found itself in an identity crisis. The group had not added any new skill sets over the previous few years. The team's motivation scores were at an all-time low. Work became more limited as deployments shrunk to legacy applications.
It was imperative to invest in the team to help boost morale and connect with the company's vision. The team members needed to see how they added to the company's growth while gaining knowledge and new skills.
As we investigated our customers' pain points and their needs, we realized an open source strategy around cloud computing would be an ideal investment area. The team's experience made the transition challenging, but the members were ready for the change. The group swiftly jumped on the initiative and brought much success to themselves and the organization.
Carving out time for your team to work on open source software and contribute upstream is a great way to put your team members out there and help them gain different experiences while working with the broader community. It is imperative for leadership to move team members around to transition them to something new. It is also necessary to remind your team that every initiative, technology, or project follows a curve that starts with innovation, then shows heightened expectation, goes into a growth phase, and eventually declines.
This point is even more critical for managers and leaders. Sometimes I see leaders who are stuck in the status quo. A leader's attitude can impact a team's culture—negatively or positively.
### 2\. Correlate the team's success with the organization's success
Leaders can motivate teams by showing appreciation to contributors. It is critical for teams to understand the impact their work has on customers and the world. It's also vital for them to correlate their role with the company's success. Every employee should know the value they bring to the table.
Understanding the financial value your team brings to the company is part of this. Share how the product or service your team provides contributes to revenue. This will show how your team how critical their product or service is for your customers and how it impacts the customer experience. This has really worked for me and the teams I lead.
### 3\. Bring pride to what you do
Bringing pride to your work is a crucial element in developing ownership. If you take pride in what you do, you will enjoy it more. Employees who are proud of their work will be more eager to share and also look for ways to improve. As a manager or leader, it is your responsibility to bring visibility to your team's work. Appreciation for your team goes a long way, especially if you show your gratitude in front of the broader organization.
Open source community participation can provide opportunities to contribute to a greater good, give visibility to your work, challenge your thought process, and drive you to think out of the box. What suggestions do you have to helping teams overcome complacency and become more selfless? Please share your thoughts in the comments. 
Learn how companies can get started in contributing to open source projects, including encouraging...
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/selfless-culture
作者:[Shishir Kamboj][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/shishirkamboj
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/handshake_teamwork_meeting_office_space.png?itok=6H0GEyoc (Community and team smiling)

View File

@ -0,0 +1,60 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to create trust in artificial intelligence using open source)
[#]: via: (https://opensource.com/article/20/11/ai-open-source)
[#]: author: (Rebecca Whitworth https://opensource.com/users/rsimmond)
How to create trust in artificial intelligence using open source
======
Opening up the "black box" helps remove uncertainties about AI outcomes,
providing insight into the modeling process and identifying biases and
errors.
![Brain on a computer screen][1]
Artificial intelligence (AI) is being used more frequently in our daily lives, with systems such as Siri and Alexa becoming commonplace in many households. Many households themselves are "smart," powered by devices that can control your lights, heating and air, and even the music playing. And those music players are powered by AI that recommends songs and artists you may like.
However, these systems are often referred to as "black box" systems because we do not know how the data is processed—how do the users know why the model has made that prediction? The advent and widespread adoption of deep neural networks, while providing impressive results, made this even more critical, since humans can't logically interpret how information is processed within thousands of neurons.
A more safety-critical example of AI systems is when doctors use them to reduce stress loads. These systems do this by quickly ingesting data at a rapid rate; for example, thousands of medical journals could be read and parsed by AI exponentially faster than by a human. This data can then be used to train predictive models, which are used to help doctors diagnose patients, this time armed with far more data points than were available before and in a quicker time. People assume that, with all this information, a machine can make "better" decisions than humans. However, how can we trust a machine to make such critical decisions when we do not fully understand the data processing techniques?
Open source supports many methods and applications that can lead to better trust in AI systems. In this article, we will explore some of those open source projects as well as the open source mentality, and how by becoming part of the open source community, you can gain more trust in your AI.
Projects like [LIME][2] and [SHAP][3], which are open source, can explain the outcome of a prediction. To illustrate how this works, let's look at a loan request use case. Based on an AI outcome, a bank rejects a customer who has made a loan request, but why did the algorithm return that outcome? Projects like these aim to make the model more explainable by showing feature importance graphs, i.e., which features were significant to the outcome of the model. Features are the inputs that generate the prediction. In this example, if an important feature used to reject the loan had been "gender," then this would mean the model is biased or incorrect. If the model is known to be wrong, then retraining it will give improved predictions.
These projects help to build trust in AI systems by explaining the black box model and introspecting decision-making. By open sourcing projects such as this, we can ensure confidence in the system due to the openness of the predictive modeling process. It can give stakeholders confidence that the model is correct and that its recommendations can be trusted, so there is less business risk.
Open source can stop unfairness, such as the gender-bias example above, by iteratively testing the system's potential outcomes quickly and effectively. If the model is biased, then a notification to the community can be made in a timely fashion, as there are more developers in the community than there would be if the project was closed source. Therefore, if there is trust in the community, then there can be trust in the system.
Open source platforms leverage ideas from a broad group of peers and offer greater opportunity to innovate and create worthwhile features in a system. These ideas focus the project in a user-driven direction, and improvements come from the developers/users themselves. The system is trustworthy because it has a user-centric design pattern and fosters knowledge of system development and execution. Essentially, the people who have made the system can trust the system.
When an AI system fails, people may be offended or misled. The project or organization loses people's confidence, and it creates distrust of the system overall. Credibility can be protected by making an AI project open source, because with more testers in the community, the more the data and performance can be verified.
By leveraging the community-focused nature of open source, we can also ensure that more people with a wider variety of skill sets routinely check the codebase. Predictive models are very good at recognizing patterns; however, they can fail when faced with an outlier. Humans, on the other hand, are very good at being able to recognize and respond to anomalies and nuance. Therefore, having humans involved in the AI system is integral to stopping mistakes, which, in the example use case of the doctor, could actually be deadly. It is essential to have domain experts to check the system's outcomes, and the more, the better.
Community-focused feature development can also improve trust by ensuring that the project meets company regulations. The community can include stakeholders from the business who can then lead the development focus and reduce business risk.
A closed approach to AI can lead to inadequate feature design choices that are not relevant to the current needs of the community and businesses. Such features can be harmful to the system; for example, if a medical system's patient diagnostic function has poor accuracy due to lack of testing, then this will mean more human intervention and, ultimately, less trust.
A closed approach can also stifle creativity and freedom to develop innovative ideas, and it stops the feedback loop on ideas from community users or people outside of the company. A feedback loop is useful, as the people who are developing it have a greater knowledge of the system and how it works, and if the community knows it works, then they are more likely to use it.
Trusting AI can be hard when people use black box models, due to the lack of understanding of what they are doing and how they work. Open source mentality and models help users and developers to create more trust in AI by opening up the black box, encouraging iterative and collaborative development, and using the community to ensure proper functionality and fewer bugs. Open source allows AI to reach its potential in a trustworthy and meaningful way for users.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/ai-open-source
作者:[Rebecca Whitworth][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/rsimmond
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen)
[2]: https://github.com/marcotcr/lime
[3]: https://github.com/slundberg/shap

View File

@ -0,0 +1,147 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The state of the art of microservices in 2020)
[#]: via: (https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/)
[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/)
The state of the art of microservices in 2020
======
### _“The microservice architectural style is an approach to developing a_ _**single application**_ _as a suite of_ _**small services**_*, each running in its* _**own process and communicating with lightweight mechanisms**_*, often an HTTP resource API. These services are* _**built around business capabilities**_ _and_ _**independently deployable**_ _by_ _**fully automated deployment machinery**_*. There is a bare minimum of centralized management of these services, which may be written in* _**different programming languages**_ _and_ _**use different data storage technologies.**__“_
### James Lewis and Martin Fowler (2014) [6]
## Introduction
It is expected that in 2020, the global cloud microservices market will grow at a rate of 22.5%, with the US market projected to maintain a growth rate of 27.4% [5]. The tendency is that developers will move away from locally hosted applications and shift into the cloud. Consequently, this will help businesses minimize downtime, optimize resources, and reduce infrastructure costs. Experts also predict that by 2022, 90% of all applications will be developed using microservices architecture [5]. This article will help you to learn what microservices are and how companies have been using it nowadays. 
## What are microservices?
Microservices have been widely used around the world. But what are microservices? Microservice is an architectural pattern in which the application is based on many small interconnected services. They are based on the **single responsibility principle**, which according to Robert C. Martin is “gathering things that change for the same reason, and separate those things that change for different reasons” [2]. The microservices architecture is also extended to the **loosely coupled services** that can be **developed, deployed, and maintained independently** [2]. 
## Moving away from monolithic architectures
Microservices are often compared to traditional monolithic software architecture. In a monolithic architecture, a software is designed to be self-contained, i.e., the programs components are interconnected and interdependent rather than loosely coupled. In a tightly-coupled architecture (monolithic), each component and its associated components must be present in order for the code to be executed or compiled [7]. Additionally, if any component needs to be updated, the whole application needs to be rewritten.
Thats not the case for applications using the microservices architecture. Since each module is independent, it can be changed without affecting other parts of the program. Consequently, reducing the risk that a change made to one component will create unanticipated changes in other components. 
Companies might run in trouble if they cannot scale a monolithic architecture if their architecture is difficult to upgrade or the maintenance is too complex and costly [4]. Breaking down a complex task into smaller components that work independently from each other is the solution to this problem.
![Monolithic vs. microservices architecture. Image extracted from \[3\].][1]
## How developers around the world build their microservices
Microservices are well known for improving _scalability_ and _performance_. However, are those the main reasons that developers around the world build their microservices? The State of Microservices 2020 research project [1] has found out how developers worldwide build their microservices and what they think about it. The report was created with the help of 660 microservice experts from Europe, North America, Central and South America, the Middle East, South-East Asia, Australia, and New Zealand. The table below presents the average rating on questions related to the maturity of microservices [1]. 
**Category** | **Average rating (out of 5)**
---|---
Setting up a new project | 3.8
Maintenance and debugging | 3.4
Efficiency of work | 3.9
Solving scalability issues | 4.3
Solving performance issues | 3.9
Teamwork | 3.9
 
As observed on the table, most experts are happy with microservices for solving scalability issues. On the contrary, maintenance and debugging seem to be a challenge for them.
According to their architectures leading technologies, most experts reported that they use Javascript/Typescript (almost ⅔ of microservices are built on those languages). In the second place, they mostly use Java.
Although there are plenty of options to choose to deploy microservices, most experts use Amazon Web Services (49%), followed by their own server. Additionally, 62% prefer AWS Lambda as a serverless solution.
Most microservices used by the experts use HTTP for communication, followed by events and gRPC. Additionally, most experts use RabbitMQ for message-brokers, followed by Kafka and Redis.
Also, most people work with microservices continuous integration (CI). In the report, 87% of the respondents use CI solutions such as GitLab CI, Jenkins, or GitHub Actions.
The most popular debugging solution among 86% of the respondents was logging, in which 27% of the respondents ONLY use logs. 
Finally, most people think that microservice architecture will become either a standard for more complex systems or backend development.
## Successful use cases of Microservices
Many companies have changed from a monolithic architecture to microservices. 
### Amazon
In 2001, development delays, coding challenges, and service interdependencies didnt allow Amazon to address its growing user bases scalability requirements. With the need to refactor their monolithic architecture from scratch, Amazon broke its monolithic applications into small, independent, and service-specific applications [3][9].
In 2001, Amazon decided to change to microservices, which was years before the term came into fashion. This change led Amazon to develop several solutions to support microservices architectures, such as Amazon AWS. With the rapid growth and adaptation to microservices, Amazon became the most valuable company globally, valued by market cap at $1.433 trillion on July 1st, 2020 [8].
### Netflix
Netflix started its movie-streaming service in 2007, and by 2008 it was suffering scaling challenges. They experienced a major database corruption, and for three days, they could not ship DVDs to their members [10]. This was the starting point when they realized the need to move away from single points of failure (e.g., relational databases) towards a more scalable and reliable distributed system in the cloud. In 2009, Netflix started to refactor its monolithic architecture into microservices. They began by migrating its non-customer-facing, movie-coding platform to run on the cloud as an independent microservices [11]. Changing to microservices allowed Netflix to overcome its scaling challenges and service outages. Despite that, it allowed them to reduce costs by having cloud costs per streaming instead of costs with a data center [10]. Today, Netflix streams approximately 250 million hours of content daily to over 139 million subscribers in 190 countries [11].
### Uber
After launching Uber, they struggled to develop and launch new features, fix bugs, and rapidly integrate new changes. Thus, they decided to change to microservices, and they broke the application structure into cloud-based microservices. In other words, Uber created one microservice for each function, such as passenger management and trip management. Moving to microservices brought Uber many benefits, such as having a clear idea of each service ownership. This boosted speed and quality, facilitating fast scaling by allowing teams to focus only on the services they needed to scale, updating virtual services without disrupting other services, and achieving more reliable fault tolerance [11].
## Its all about scalability!
A good example of how to provide scalability is by looking at China. With its vast number of inhabitants, China had to adapt by creating and testing new solutions to solve new challenges at scale. Statistics show that China serves roughly 900 million Internet users nowadays [14]. During the 2019 Singles Day (the equivalent of Black Friday in China), the peak transaction of Alibabas various shopping platforms was 544,00 transactions per second. The total amount of data processed on Alibaba Cloud was around 970 petabytes [15]. So, whats the implication of these numbers of users in technology?
Many technologies have emerged from the need to address scalability. For example, [Tars][2] was created in 2008 by Tencent and [contributed to the Linux Foundation in 2018][3]. Its being used at scale and enhanced for ten years [12]. Tars is open source, and many organizations are significantly contributing and extending the frameworks features and value [12]. Tars supports multiple programming languages, including C++, Golang, Java, Node.js, PHP, and Python; and it can quickly build systems and automatically generate code, allowing the developer to focus on the business logic to improve operational efficiency effectively. Tars has been widely used in Tencents QQ, WeChat social network, financial services, edge computing, automotive, video, online games, maps, application market, security, and many other core businesses. [In March of 2020, the Tars project transitioned into the TARS Foundation][4], an open source microservice foundation to support the rapid growth of contributions and membership for a community focused on building an open microservices platform [12].
**Be sure to check out the Linux Foundations new free training course,** [Building Microservice Platforms with TARS][5]
*About the authors: *
_Isabella Ferreira is an Advocate at TARS Foundation,_ a cloud-native open-source microservice foundation under the Linux Foundation*. *
*Mark Shan is Chairman at Tencent Open Source Alliance and also Board Chair at TARS Foundation. *
**References:**
[1] <https://tsh.io/state-of-microservices/#ebook>
[2]<https://medium.com/hashmapinc/the-what-why-and-how-of-a-microservices-architecture-4179579423a9>
[3] <https://www.plutora.com/blog/understanding-microservices>
[4] <https://www.leanix.net/en/blog/a-brief-history-of-microservices>
[5] <https://www.charterglobal.com/five-microservices-trends-in-2020/>
[6] <https://martinfowler.com/articles/microservices.html#footnote-etymology>
[7] <https://whatis.techtarget.com/definition/monolithic-architecture>
[8] <https://ycharts.com/companies/AMZN/market_cap>
[9] <https://thenewstack.io/led-amazon-microservices-architecture/>
[10] <https://media.netflix.com/en/company-blog/completing-the-netflix-cloud-migration>
[11] <https://blog.dreamfactory.com/microservices-examples/>
[12] <https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/>
[13] <https://medium.com/microservices-architecture/top-10-microservices-framework-for-2020-eefb5e66d1a2>
[14] <https://www.statista.com/statistics/265140/number-of-internet-users-in-china/>
[15] <https://interconnected.blog/china-scale-technology-sandbox/>
#### _This Linux Foundation Platinum Sponsor content was contributed by Tencent._
--------------------------------------------------------------------------------
via: https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/
作者:[Linux.com Editorial Staff][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://www.linux.com/author/linuxdotcom/
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/wp-content/uploads/2020/11/microservices_diagram_a.png
[2]: https://tarscloud.org/foundation/index
[3]: https://www.linuxfoundation.org/press-release/2018/06/tars-and-tseer-form-open-source-project-communities-under-the-linux-foundation-to-expand-adoption-and-pace-of-development/
[4]: https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/
[5]: https://www.edx.org/course/building-microservice-platforms-with-tars

View File

@ -0,0 +1,57 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How I channel my inner Star Trek character at work)
[#]: via: (https://opensource.com/article/20/11/inner-star-trek)
[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike)
How I channel my inner Star Trek character at work
======
I am more of a Deanna Troi in my role as a community manager. How about
you?
![Open source stars.][1]
In a recent [Twitter thread][2], I self-identified as "some days Deanna, some days Riker." Others shared their own "Star Trek Spectrum," from Worf to O'Brien and McCoy to Neelix. That led me to think more about Deanna Troi: the half-human, half-Betazoid empath who served as Lieutenant Commander and the ship's counselor for most of _Star Trek: The Next Generation_.
Ever since my middle school days, I felt a kinship with her as I watched her observe and respond to situations and the people in them. Today, as an open source community manager, I think about how these traits are vital to the role of nurturing and guiding a group of people. Here's how I channel my inner Deanna Troi at work.
![][3]
opensource.com
### Holding space
Instead of speaking the next word, I take a breath. I try not to rush in with something to say in response to the things that happen and in response to conversations with the people that make up our community. I listen, and then when the time is right, I speak. That can be hard especially when I am feeling confident in how to move forward and am eager to show the way. I've learned that taking a beat and slowing down, rarely does harm if coupled with clarity around the situation. Sometimes it is important to act quickly, to step in and guide the community around an issue, but even swift action can be accompanied with thoughtful deliberation. 
To achieve this, also give yourself space to think and slow down. If you need to think through something, go for a walk, make a tea or meal, and say no to that next meeting to give yourself the time you need to do your job with integrity. 
### Radical empathy
Truly hearing and listening to others, then digesting that information, often leads to empathy. Even when we don't feel the same way—often due to differing perspectives—we can get closer to empathizing with others when we listen closely and fully. And why would we want to do that? Because understanding someone allows us to relate to them, and then we can find a solid place from which to nurture and guide them.
Getting to know each person individually is something I recommend, and if the community you are a part of is too big for that, don't shut down the idea of reaching out at all. Start from where you are, and connect with the next closest person—you have a meeting set up to onboard them, you interacted on social media, you fixed a bug they submitted, etc. This kind of growth is authentic and sustainable.
### Tapping into intuition
At first glance, it may seem that those best fit for a role at the helm are those who identify as extroverted and easily heard, however, I've found those who know how to silence the noise and follow their own inner certainty are those who can inspire others to do the same. And that is where the power is, inside all of us, not just one of us.
Open source communities are continuing to be called upon to innovate, act, and lead, and these traits are important not just for leaders to cultivate but for everyone involved in working together as a group to achieve a goal or collaborate on a project.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/inner-star-trek
作者:[Jen Wike Huger][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/jen-wike
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcestars.png?itok=hnrMETFh (Open source stars.)
[2]: https://twitter.com/JenWike/status/1318188923298906113
[3]: https://opensource.com/sites/default/files/pictures/deannacover001.jpg

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (chenmu-kk)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: (lihongjie224)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,88 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What I love about the newest GNOME desktop)
[#]: via: (https://opensource.com/article/20/11/new-gnome)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
What I love about the newest GNOME desktop
======
Check out the top new features in the GNOME 3.38 desktop.
![Digital images of a computer desktop][1]
Fedora 33 [just came out][2], and I installed it right away. Among the many features in this new version of the Linux distribution is the latest GNOME desktop. GNOME 3.38 was released in September 2020, and I'm loving it.
### Why I love GNOME 3.38
The [GNOME 3.38 release notes][3] list some great new features in this update. Among other things, the Welcome Tour for new users received a major facelift and is now much easier to use and provides more useful information if you're new to GNOME.
![The new "Welcome GNOME"][4]
([GNOME][5], [CC BY-SA 4.0][6])
I also love that I can drag to reorder application icons in the GNOME Application Overview. This makes it a breeze to organize the applications I use all the time under GNOME. You can even drag and drop icons together to automatically put them into folders.
![GNOME 3.38 Application Overview][7]
([GNOME][5], [CC BY-SA 4.0][6])
I have family in different time zones, and the updated GNOME Clocks makes it much easier to add new world clocks, so I don't have to figure out what time it is when I call a family member. Are they an hour ahead or an hour behind? I just check the GNOME clock, and I can see everyone's local times at a glance. And while I don't use the alarms feature very often, I like that I can set my own ring duration and default "snooze" time on each alarm.
![Adding a new world clock in GNOME Clocks][8]
([GNOME][5], [CC BY-SA 4.0][6])
Aside from all the feature updates, the biggest improvement in GNOME 3.38 is performance. As GNOME developer Emmanuele Bassi [explained earlier this year][9], there's been "lots of work by everyone in GNOME to make things faster, even for people running on more limited systems like the Raspberry Pi. There's been a lot of work to get GNOME to perform better … because people really care about it." And that shows in the new release! The GNOME desktop feels much more responsive.
![Applications running on GNOME 3.38][10]
([GNOME][5], [CC BY-SA 4.0][6])
As part of my consulting and training business, I regularly flip between several open applications, including LibreOffice, GIMP, Inkscape, a web browser, and others. Starting a new application or switching between open applications just feels faster in GNOME 3.38.
### Except one thing
If there's one thing I'm not fond of in the new version of GNOME, it's the redesigned Screenshot tool. I use this all the time to grab a portion of what's on the screen and insert it into my presentations and training documents.
![GNOME Screenshot tool][11]
(Jim Hall, [CC BY-SA 4.0][6])
When I read a user interface or computer screen, I naturally navigate as I would a book or magazine: left to right and top to bottom. When I make screenshots with the new Screenshot tool, I start in the upper-left and make my selections as I go. Most of the time, I only need to change the capture area for a selection, so I click that button and then look for the button that will take a screenshot. But it always takes me a moment to find the **Take Screenshot** button in the upper-left corner. It's not at the bottom of the window, where I expect to find it.
![GNOME Screenshot tool][12]
(Jim Hall, [CC BY-SA 4.0][6])
So far, that seems to be my only annoyance in GNOME 3.38. Overall, I'm very excited for the new GNOME. And I hope you are, too!
To learn more about GNOME 3.38, visit the [GNOME website][13] or read the [GNOME 3.38 announcement][5].
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/new-gnome
作者:[Jim Hall][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/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop)
[2]: https://fedoramagazine.org/announcing-fedora-33/
[3]: https://help.gnome.org/misc/release-notes/3.38/
[4]: https://opensource.com/sites/default/files/uploads/welcome-tour.png (The new "Welcome GNOME" )
[5]: https://www.gnome.org/news/2020/09/gnome-3-38-released/
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://opensource.com/sites/default/files/uploads/app-overview.png (GNOME 3.38 Application Overview)
[8]: https://opensource.com/sites/default/files/uploads/world-clocks.png (Adding a new world clock in GNOME Clocks)
[9]: https://opensource.com/article/20/7/new-gnome-features
[10]: https://opensource.com/sites/default/files/uploads/desktop-busy.png (Applications running on GNOME 3.38)
[11]: https://opensource.com/sites/default/files/uploads/gnome-screenshot-tool.png (GNOME Screenshot tool)
[12]: https://opensource.com/sites/default/files/uploads/screenshot-tool-path.png (GNOME Screenshot tool)
[13]: https://www.gnome.org/

View File

@ -1,126 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install Google Chrome on Fedora [Beginners Tutorial])
[#]: via: (https://itsfoss.com/install-google-chrome-fedora/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
How to Install Google Chrome on Fedora [Beginners Tutorial]
======
Fedora comes with Firefox as the default web browser. Despite it being an excellent web browser, you may prefer the popular Google Chrome browser.
If you are wondering how to install Google Chrome on Fedora, let me show you two ways of installing Google Chrome, graphical method and command line method.
* [GUI method 1: Install Chrome from the software center by enabling Fedora third-party repository][1]
* [GUI method 2: Download RPM file from Google Chromes website][2]
* [CLI method: Install Chrome from the Fedora third-party repository, everything using commands (same as GUI method 1)][3]
It is up to you which method you prefer. Your Google Chrome on [Fedora][4] will be getting regular updates via the system updates in all the three methods.
### Method 1: Install Google Chrome on Fedora from the Software Center
Fedora provides a third-party repository that contains some popular proprietary software, graphics driver. Google Chrome is one of them.
First step, make sure to enable third-party repositories in Fedora. You should see this option in the software center itself.
![Step1: Fedora Third Party Repositories][5]
Once you have it enabled, simply search for Chrome in the software center:
![Step 2: Search for Chrome In Fedora Software Center][6]
And install it from there:
![Step 3: Install Chrome Fedora][7]
Can it be any easier than this? I dont think either :)
### Method 2: Installing Google Chrome on Fedora from Chrome website
If you do not want to enable the third-party repository, thats okay. You dont have to. You can download the RPM file from Chromes website, double-click on it and install it.
Visit Google Chromes website and click on the download button.
[Get Google Chrome][8]
![][9]
Then select the .rpm package and click on “Accept and Install”.
![][10]
Once the download is over, double click on the file and click install when prompted at the package manager. Type your password and wait until the process is done.
![][11]
Thats super easy, right? Lets see somewhat complicated method (if you are not a terminal fan).
### Method 3: Install Chrome on Fedora using command line
Firstly, you need to add extra Fedora repositories (that you saw in method 1):
```
sudo dnf install fedora-workstation-repositories
```
And then enable Google Chrome repository.
```
sudo dnf config-manager --set-enabled google-chrome
```
![][12]
To install the Google Chrome stable release, run the following command at your terminal.
```
sudo dnf install google-chrome-stable
```
You should get a warning for importing the GPG key, enter y to continue.
![][13]
You are adding the Google Chrome repository. The package comes from this repository, directly from Google.
#### Conclusion
Installing Google chrome on Fedora is fairly easy, even if you use the command line. Its pretty much the [same as installing Chrome on Ubuntu][14] except the third-party repository part.
Now that you have installed it, you may want to [check our list of Google Chrome keyboard shortcuts][15] to use the browser faster.
Dont forget to subscribe, to get the latest news and tutorials about Fedora, and if you have any questions please leave a comment below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-google-chrome-fedora/
作者:[Dimitrios Savvopoulos][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/dimitrios/
[b]: https://github.com/lujun9972
[1]: tmp.VFVwBw56ac#gui-method-1
[2]: tmp.VFVwBw56ac#gui-method-2
[3]: tmp.VFVwBw56ac#cli-method
[4]: https://getfedora.org/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repositories.jpg?resize=800%2C400&ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/chrome-in-fedora.png?resize=800%2C400&ssl=1
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/installing-chrome-fedora.png?resize=800%2C400&ssl=1
[8]: https://www.google.com/chrome/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-1.jpeg?resize=800%2C374&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3.-download-rpm-chrome.png?resize=800%2C600&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/4.-install-chrome-fedora.png?resize=800%2C550&ssl=1
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/1.-Fedora-extra-repos.png?resize=800%2C550&ssl=1
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2.-Fedora-GPG-key.png?resize=800%2C550&ssl=1
[14]: https://itsfoss.com/install-chrome-ubuntu/
[15]: https://itsfoss.com/google-chrome-shortcuts/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,275 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing])
[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]
======
If you are curious about Fedora Linux, there are several ways to try it.
The easiest way that wont affect your current operating system is to [create a live USB of Fedora.][1]
An alternative way to try Fedora, is to get advantage of virtualization technology through an installation in VirtualBox. This way, you use Fedora like an application on your current operating system.
This way, you can perform more thorough testing without messing up your current operating system.
You can even copy your virtual setup and re-install it on some other system. Sounds handy? Let me show you how to do it.
### Installing Fedora in VirtualBox
![][2]
Lets see the steps for installing Fedora Linux in Oracle VirtualBox.
#### Step 1: Install VirtualBox
If you havent already installed VirtualBox on your system, you can download it from the official website. You can find instructions for Windows, Mac OS and Linux. [Ubuntu users can refer to this detailed tutorial on installing VirtualBox][3].
![][4]
[Download VirtualBox][5]
#### **Step 2: Download the Fedora ISO**
If you are not familiar with fedora, there are a few images to be aware of.
[Fedora IoT][6] is to be used for scalable infrastructure, [Fedora workstation][7] is an image with a set of tools oriented for a desktop in a vanilla GNOME desktop environment and [Fedora server][8] as its name reveals, is tailored for a server or data center.
If GNOME isnt your first choice, you can download a [spin][9] of Fedora desktop with an alternative desktop environment. For this tutorial, I chose [Fedora 33][10] with the GNOME desktop environment.
[Download Fedora][11]
#### Step 3: Create an empty virtual machine and configure it
Fedora requires a minimum of 20GB disk space &amp; 2GB RAM, to install and run successfully. Although double those amounts is recommended for a smoother user experience. Based on that I will create and configure the virtual machine.
Start Virtual Box and click on New.
![Create a new virtual machine][12]
The most important option to pay attention, is the **type to be set to Linux and the version to Fedora (64-bit)**. If you start typing Fedora at the name prompt, VirtualBox will automatically pick the correct settings for you. Although the name doesnt have to be Fedora, it can be anything you like.
_If you have access to 32-bit version only, you need to enable virtualization technology on BIOS, if you have an AMD CPU it is called SVM. Worst-case scenario is that your CPU doesnt support virtualization technology. If you are not sure, check this first._
Once you have similar settings with me, click on the create button.
![Name your VM and assign it at least 3 GB RAM][13]
As mentioned before, you need at least 20 GB of disk space to be able to install Fedora. I have 32 GB of RAM on my system so I assigned 8 GB here. You should be fine with 3 GB of RAM.
A word about RAM consumption, the RAM will only be consumed by the virtual machine when you are running it. Otherwise, it will be available for regular usage.
Make sure that the rest of the settings match the example and click Create.
![Assign 15-20 GB of disk space in VDI format][14]
Before you click the start button of your virtual machine, you need to load the ISO as shown below [Optical Drive].
![Add the Fedora ISO to optical drive storage][15]
As your virtual hard drive is empty, the virtual machine will boot from this ISO. Think of it as using a live USB or disk for installing Linux.
![Go to Settings and add ISO as optical drive][16]
Then, if you have a multi-core CPU it is recommended to assign 2 or more cores for your virtual machine. You may find the CPU cores under the system tab. When you configure your system click ok and start the virtual machine.
![Optional step: Assign number of CPU cores][17]
Once you have configured everything, click on the start button to begin the installation.
#### Step 4: Install Fedora in VirtualBox
If you have followed the process correctly, when you start the virtual machine you will boot directly from the ISO file. When you see a similar to below screen select Start Fedora, and press the enter key.
![Fedora running in live environment in virtual machine][18]
To start the installation dialog box, click on Install to Hard Drive.
![Click on “install to hard drive”][19]
Before you proceed to the installation, it is essential to define your keyboard layout, your timezone and finally where the operating system will be installed.
![Choose keyboard, time and date and then go to Installation Destination][20]
The partitioning process is straight forward. You made some free space as VDI earlier. It should be automatically recognized.
Select your disk and set the storage configuration to automatic. Click on Done to go to the previous dialog box.
![Disk should be automatically recognized][21]
Once you have configured the above, click on “Begin Installation”.
![Begin installation of Fedora][22]
Now you just need to wait for five-six minutes for installation completion. Click on the “Finish installation” button when installation is finished.
As a last step, you need to power off your system. If you are unfamiliar with the GNOME desktop environment you can do it like so.
![Turn off Fedora live environment after installation][23]
You have to manually unload the ISO file that you loaded at the initial steps.
![Remove Fedora ISO From Optical Drive][24]
The next time you start the virtual machine with Fedora, you will be prompted to create a user account and set your password for Fedora Linux.
### Use VirtualBox guest additions for additional features like clipboard sharing, folder sharing and more
[Guest Additions][25] are designed to be installed inside a virtual machine post installation of the guest operating system. They contain device drivers and system applications that optimize the guest operating system for better performance and usability.
The Guest Additions ISO file is mounted as a virtual CD-ROM in order to be installed.
This is a straightforward process. Simply click on the devices tab and then click on “Insert Guest Additions CD image”
![][26]
You will be prompted to download the guest additions image, when prompt click on Download.
![Install VirtualBox Guest Additions][27]
#### **Shared clipboard**
At some point youll need to move some content between your virtual machine and the host operating system. The shared clipboard/drag and drop support will allow you to copy items on one platform and paste them on the other.
To enable this feature, choose **Settings** on the VirtualBox home page and follow the instructions as below. I find the **Bidirectional** option the most convenient.
![Enable clipboard sharing between guest and host systems][28]
#### **Shared folders**
There are two types of shares:
* Permanent shares, that are saved with the Virtual Machine settings.
* Transient shares, that are disappear when the Virtual Machine is powered off. These can be created using a checkbox in the VirtualBox Manager.
In this tutorial, I will make a permanent shared folder. In the VM settings add the host system folder you want to share and choose the name that you want to appear at your VM.
![][29]
The next time you start the virtual machine, the folder should appear as a network drive.
![][30]
#### **Better video support**
While the virtual graphics card which Oracle VirtualBox provides all the basic features, the custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes, as well as accelerated video performance.
Using Guest Additions, the guest OSs resolution will dynamically resize as you adjust the VirtualBox window on your computer.
Finally, Guest Additions can take advantage of your computers graphics card. If youre a gamer or using productivity software in a WM, this makes a huge difference.
#### USB and Network Devices sharing
With VirtualBox, users have the ability to use a fully-functional operating system, without having to do the setup on different hardware. However, sharing USB and network devices between the host and guest machine is not as straightforward as it should be.
To access USB devices, you will need to install [the VirtualBox extension pack][31].
![Install VirtualBox Extensions pack][32]
_**This is for Linux only**_ because I am using all this in Linux.
In order for VirtualBox to have access to the USB subsystem, the user (on host system) running VirtualBox must belong to the vboxuser group. To do this, open up a terminal and issue the following command:
```
sudo usermod -aG vboxusers 'your username'
```
Once you run the command, you should either log out and log back in, or restart your host machine.
At this step, plug in your USB stick and through your VM settings you should be able to find and add the medium as shown at the example.
![][33]
Your USB will be accessible the next time you start your virtual machine.
![][34]
### Bonus Tip: Save and export the Virtual Machine so that you can use it later on any system
You may want to use your virtual machine to another computer or it is time to build a new machine and you need to keep your virtual machine as it is. You can easily export your current setup and import it to another machine at a few easy steps.
At the VirtualBox home panel, click on file and the export appliance. If you prefer keyboard shortcuts, you can simply click **Ctrl+E**.
![][35]
Choose the virtual machine you want to export and click on next.
![][36]
The Format option needs some attention. There are three different options of Open Virtualization Format 0.9, 1.0 and 2.0, which can be either ovf or ova extensions.
With ovf extension, several files will be written separately, compared to ova extension, which combines all the files into one Open Virtualization Format archive.
The default format, Open Virtualization Format 1.0, should be fine.
![][37]
To finish the process, click next and at the next dialog box click export.
#### Conclusion
By using a virtual machine you cant just test an operating system but deploy a fully functioning system, equally comparable to a physical machine. Nowadays, hardware has become so powerful and affordable that most of its power is not being utilized.
Through virtualization technology, you can use those wasted resources. The need for physical machines is reduced, and consequently the energy consumption is less. You can save money both from hardware and reduced running costs.
On a larger scale, server virtualization is more of a basic requirement than an advanced concept.
I hope you found this tutorial helpful in installing Fedora Linux in VirtualBox. If you face any issues, please let me know in the comments.
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-fedora-in-virtualbox/
作者:[Dimitrios Savvopoulos][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/dimitrios/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1
[3]: https://itsfoss.com/install-virtualbox-ubuntu/
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1
[5]: https://www.virtualbox.org/
[6]: https://getfedora.org/en/iot/
[7]: https://getfedora.org/en/workstation/
[8]: https://getfedora.org/en/server/
[9]: https://spins.fedoraproject.org/
[10]: https://itsfoss.com/fedora-33/
[11]: https://getfedora.org/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1
[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1
[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1
[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1
[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1
[25]: https://www.virtualbox.org/manual/ch04.html
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1
[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1
[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1
[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1
[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack
[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1
[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1
[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1
[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1
[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1
[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1

View File

@ -0,0 +1,158 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Woothee (HTTP User Agent Parser))
[#]: via: (https://theartofmachinery.com/2020/11/14/woothee.html)
[#]: author: (Simon Arneaud https://theartofmachinery.com)
Woothee (HTTP User Agent Parser)
======
Ive written [a D implementation of the Project Woothee multi-language HTTP user agent parser][1]. Here are some notes about what its useful for, and few things special about the D implementation.
### Project Woothee
HTTP clients (like normal browsers and search engine crawlers) usually identify themselves to web servers with a user agent string. These strings often contain interesting information like the client name, client version and operating system, but the HTTP spec makes no rules about how this information should be structured (its free-form text). Parsing them requires a bunch of rules based on what real clients use in the wild.
Theres a project called [ua-parser][2] that maintains a list of (currently) ~1000 regular expressions for parsing user agent strings. Project Woothee is another project thats less comprehensive, but faster than testing 1000 regexes. Sometimes you want a more comprehensive parser, but sometimes it doesnt really help. For example, suppose you want to estimate the proportion of your users running Firefox versus Chrome versus whatever by processing a big web log dump. The answer will never be 100% accurate (even with 100% accurate parsing) because bots pretending to be Chrome browsers will skew the results a bit anyway.
Woothee has some quirks (e.g., it doesnt distinguish RSS reader clients) but it has uses, too.
### The D version
I wanted to keep the D version code simple so that it can be easily updated when the upstream project data gets updated. I took some easy opportunities to make it faster, though. In a quick, unscientific test, it parsed ~1M strings from a web log on a five-year-old laptop in about 5s. Im sure it could be made faster, but thats good enough for me right now.
#### Preprocessing regexes and HTTP client data
Woothee still uses some regexes (about 50). In most languages, these are strings that need to be processed at runtime, every time the program is run. I dont know if [Boost Xpressive][3] was the first to support compile-time regex parsing, but I remember being impressed by it at the time. The downside is having to use an operator overloading hack that manages to make regexes even harder to read:
```
sregex re = '$' >> +_d >> '.' >> _d >> _d;
```
Weve come a long way since 2007. [Ds standard library has a compile-time regex][4], but its not even needed. This works:
```
void foo()
{
import std.regex;
static immutable re = regex(`\$\d+\.\d\d`);
// ...
}
```
If youre wondering: `static` puts the `re` into the same storage space as a global variable would be in (instead of the stack, which is run time only), while `immutable` allows the compiler to avoid copying the variable into thread-local storage for every thread. If youre from C++, you might expect that `regex()` will still get called once at run time to initialise `re`, but thanks to [CTFE][5] its processed at compile time and turned into normal data in the compiled binary.
Theres one big downside: this kind of complex CTFE is still slow. Compiling all the regexes using DMD takes ~10s, long enough to be annoying. So I added a [version flag][6] `WootheePrecompute`. Switching regex CTFE is simpler because the regex matching functions in `std.regex` also have overloads that take plain strings for regexes (which then get compiled and passed to the overload that takes a pre-compiled regex). `woothee-d` uses a helper function defined like this:
```
version(WootheePrecompute)
{
auto buildRegex(string r)
{
return regex(r);
}
}
else
{
auto buildRegex(string r)
{
return r;
}
}
```
Then regexes get used in the code like this:
```
static immutable version_re = buildRegex(`Sleipnir/([.0-9]+)`);
const caps = _agent.matchFirst(version_re);
```
Without `WootheePrecompute`, `buildRegex()` has no effect, and `version_re` is just a plain string that gets compiled on use. With `WootheePrecompute` enabled, `buildRegex()` actually compiles the regex using CTFE.
`WootheePrecompute` also enables processing the Project Woothee HTTP client data at compile time instead of at startup.
#### More precomputation for faster string searching
Woothee requires a lot of searching for strings inside the user agent string. Heres a small sample:
```
if (contains!"Yahoo" || contains!"help.yahoo.co.jp/help/jp/" || contains!"listing.yahoo.co.jp/support/faq/")
{
if (contains!"compatible; Yahoo! Slurp") return populateDataset("YahooSlurp");
if (contains!"YahooFeedSeekerJp" || contains!"YahooFeedSeekerBetaJp" || contains!"crawler (http://listing.yahoo.co.jp/support/faq/" || contains!"crawler (http://help.yahoo.co.jp/help/jp/" || contains!"Y!J-BRZ/YATSHA crawler" || contains!"Y!J-BRY/YATSH crawler") return populateDataset("YahooJP");
if (contains!"Yahoo Pipes") return populateDataset("YahooPipes");
}
```
You may have noticed that `contains` is a template function taking the “needle” string as compile-time parameter. There are many famous ways to make searching for a “needle” string in a “haystack” string faster if you can preprocess either one. The Boyer-Moore algorithm is one algorithm, and theres actually [an implementation in Phobos][7], but sadly it doesnt work in CTFE.
I tried another trick thats simple and fast for short strings. The key idea is that theres no point searching for a needle like “foo” if the haystack doesnt even contain both the letters “f” and “o” in the first place. We can create a 64b hash of both strings that lets us do an approximate character subset test with a super-fast bitwise operation (like a [bloom filter][8]). The hashes for all the needle strings can be calculated at compile time, and the hash for the haystack (the user agent string) only needs to calculated once.
The hash is super simple. Each byte in the string just sets one of the 64 bits of the output. Specifically, the hash takes each byte in the string, calculates the value modulo 64 (equivalently, takes the lower 6 bits), then sets the corresponding bit of the 64b output. Heres the code:
```
ulong bloomHashOf(string s) pure
{
ulong ret;
foreach (char c; s)
{
ret |= 1UL << (c & 63);
}
return ret;
}
```
Heres an example with the string, “X11; FreeBSD ”:
![Bloom-filter-style 64b hash of the string “X11; FreeBSD ”. The string starts with the letter “X”, which has ASCII code 88, which is 64 + 24, which is why bit #24 is set.][9]
Note that the hash doesnt count occurrences of a character; it just flags whether a particular character occurs at all. It also loses all information about order. Its still useful for avoiding a lot of futile searches. For example, “Tiny Tiny RSS/20.05-c8243b0 (<http://tt-rss.org/)> doesnt contain the character “X”, so theres no way it can contain the string “X11; FreeBSD ”, as is easily detected by the hashes:
![Hashes of the string “Tiny Tiny RSS/20.05-c8243b0 \(http://tt-rss.org/\)” and the string “X11; FreeBSD ”. The first hash doesn't have bit #24 set, proving that the first string can't contain a letter “X”, proving that the second string can't be contained inside it.][10]
Heres the D code. It does a quick bitwise op to check if _all_ the bits set in the needle hash are also set in the (previously calculated) user agent string hash. `bloomHashOf(needle)` is calculated as a constant at compile time. In fact, LDC with `-O2` inlines very sensibly, basically putting some bit ops with a 64b constant in front of a conditional jump in front of the call to `canFind()`. This precomputation is dirt cheap, so I didnt even bother putting a `version(WootheePrecompute)` in there, as you can see for yourself:
```
bool contains(string needle)()
{
import std.algorithm.searching : canFind;
enum needle_bloom = bloomHashOf(needle);
if ((needle_bloom & _agent_bloom) != needle_bloom) return false;
return _agent.canFind(needle);
}
```
The quick check is one sided. If it fails, we know we dont need to search. If it passes, that doesnt prove we have a substring match because the hash doesnt account for repeated characters, or character order, and can also have different characters colliding to set the same bit value.
Simply taking the bottom 6 bits is a pretty unsophisticated hashing technique, but if you look at an ASCII chart (`man ascii`), most of the characters that typically appear in HTTP user agents are in the range 64-127, which all have different values in the bottom 6 bits. So collisions arent a real problem, and actually [most pseuodorandom hashes would do a worse job][11].
In a simple test with real HTTP user agents from a log, 89% of potential `canFind()` calls were skipped thanks to the quick check, 9% were followed but failed and 2% were followed and found a real match. Overall, the quick check made `woothee-d` almost twice as fast, which is a nice win for some cheap precomputation. I think theres more performance that could be gained, but it looks like most of the low-hanging fruit for string search has been taken.
--------------------------------------------------------------------------------
via: https://theartofmachinery.com/2020/11/14/woothee.html
作者:[Simon Arneaud][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://theartofmachinery.com
[b]: https://github.com/lujun9972
[1]: https://gitlab.com/sarneaud/woothee-d
[2]: https://github.com/ua-parser
[3]: https://www.boost.org/doc/libs/1_74_0/doc/html/xpressive/user_s_guide.html#boost_xpressive.user_s_guide.creating_a_regex_object.static_regexes
[4]: https://dlang.org/phobos/std_regex.html#ctRegex
[5]: https://tour.dlang.org/tour/en/gems/compile-time-function-evaluation-ctfe
[6]: https://dlang.org/spec/version.html
[7]: https://dlang.org/phobos/std_algorithm_searching.html#boyerMooreFinder
[8]: https://en.wikipedia.org/wiki/Bloom_filter
[9]: https://theartofmachinery.com/images/woothee/bloom.svg
[10]: https://theartofmachinery.com/images/woothee/bloom_mismatch.svg
[11]: https://theartofmachinery.com/2020/01/27/systems_programming_probability.html

View File

@ -0,0 +1,258 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to use Serializers in the Django Python web framework)
[#]: via: (https://opensource.com/article/20/11/django-rest-framework-serializers)
[#]: author: (Renato Oliveira https://opensource.com/users/renato-oliveira)
How to use Serializers in the Django Python web framework
======
Serialization transforms data into a format that can be stored or
transmitted and then reconstructs it for use. DRF has the best-known
serializers.
![Net catching 1s and 0s or data in the clouds][1]
Serialization is the process of transforming data into a format that can be stored or transmitted and then reconstructing it. It's used all the time when developing applications or storing data in databases, in memory, or converting it into files.
I recently helped two junior developers at [Labcodes][2] understand serializers, and I thought it would be good to share my approach with Opensource.com readers.
Suppose you're creating software for an e-commerce site and you have an Order that registers the purchase of a single product, by someone, at a price, on a date:
```
class Order:
    def __init__(self, product, customer, price, date):
        self.product = product
        self.customer = customer
        self.price = price
        self.date = date
```
Now, imagine you want to store and retrieve order data from a key-value database. Luckily, its interface accepts and return dictionaries, so you need to convert your object into a dictionary:
```
def serialize_order(order):
    return {
        'product': order.product,
        'customer': order.customer,
        'price': order.price,
        'date': order.date
    }
```
And if you want to get some data from that database, you can get the dict data and turn that into your Order object:
```
def deserialize_order(order_data):
    return Order(
        product=order_data['product'],
        customer=order_data['customer'],
        price=order_data['price'],
        date=order_data['date'],
    )
```
This is pretty straightforward to do with simple data, but when you need to deal with complex objects made of complex attributes, this approach doesn't scale well. You also need to handle the validation of different types of fields, and that's a lot of work to do manually.
That's where frameworks' serializers are handy. They allow you to create serializers with little boilerplates that will work for your complex cases.
[Django][3] comes with a serialization module that allows you to "translate" Models into other formats:
```
from django.core import serializers
serializers.serialize('json', Order.objects.all())
```
It covers the most-used cases for web applications, such as JSON, YAML, and XML. But you can also use third-party serializers or create your own. You just need to register it in your settings.py file:
```
# settings.py
SERIALIZATION_MODULES = {
    'my_format': appname.serializers.MyFormatSerializer,
}
```
To create your own `MyFormatSerializer`, you need to implement the `.serialize()` method and accept a queryset and extra options as params:
```
class MyFormatSerializer:
    def serialize(self, queryset, **options):
        # serious serialization happening
```
Now you can serialize your queryset to your new format:
```
from django.core import serializers
serializers.serialize('my_format', Order.objects.all())
```
You can use the options parameters to define the behavior of your serializer. For example, if you want to define that you're going to work with nested serialization when dealing with `ForeignKeys` or you just want that data to return its primary keys, you can pass a `flat=True` param as an option and deal with that within your method:
```
class MyFormatSerializer:
    def serializer(self, queryset, **options):
        if options.get('flat', False):
            # don't recursively serialize relationships
        # recursively serialize relationships
```
One way to use Django serialization is with the `loaddata` and `dumpdata` management commands.
### DRF serializers
In the Django community, the [Django REST framework][4] (DRF) offers the best-known serializers. Although you can use Django's serializers to build the JSON you'll respond to in your API, the one from the REST framework comes with nice features that help you deal with and easily validate complex data.
In the Order example, you could create a serializer like this:
```
from restframework import serializers
class OrderSerializer(serializers.Serializer):
    product = serializers.CharField(max_length=255)
    customer = serializers.CharField(max_lenght=255)
    price = serializers.DecimalField(max_digits=5, decimal_places=2)
    date = serializers.DateField()
```
And easily serialize its data:
```
order = Order('pen', 'renato', 10.50, date.today())
serializer = OrderSerializer(order)
serializer.data
# {'product': 'pen', 'customer': 'renato', 'price': '10.50', 'date': '2020-08-16'}
```
To be able to return an instance from data, you need to implement two methods—create and update:
```
from rest_framework import serializers
class OrderSerializer(serializers.Serializer):
    product = serializers.CharField(max_length=255)
    customer = serializers.CharField(max_length=255)
    price = serializers.DecimalField(max_digits=5, decimal_places=2)
    date = serializers.DateField()
    def create(self, validated_data):
        # perform order creation
        return order
    def update(self, instance, validated_data):
       # perform instance update
       return instance
```
After that, you can create or update instances by calling `is_valid()` to validate the data and `save()` to create or update an instance:
```
serializer = OrderSerializer(**data)
## to validate data, mandatory before calling save
serializer.is_valid()
serializer.save()
```
### Model serializers
When serializing data, you often need to do it from a database, therefore, from your models. A ModelSerializer, like a ModelForm, provides an API to create serializers from your models. Suppose you have an Order model:
```
from django.db import models
class Order(models.Model):
    product = models.CharField(max_length=255)
    customer = models.CharField(max_length=255)
    price = models.DecimalField(max_digits=5, decimal_places=2)
    date = models.DateField()    
```
You can create a serializer for it like this:
```
from rest_framework import serializers
class OrderSerializer(serializers.ModelSerializer):
    class Meta:
        model = Order
        fields = '__all__'
```
Django automatically includes all model fields in the serializer and creates the `create` and `update` methods.
### Using serializers in class-based views (CBVs)
Like Forms with Django's CBVs, serializers integrate well with DRFs. You can set the `serializer_class` attribute so that the serializer will be available to the view:
```
from rest_framework import generics
class OrderListCreateAPIView(generics.ListCreateAPIView):
    queryset = Order.objects.all()
    serializer_class = OrderSerializer
```
You can also define the `get_serializer_class()` method:
```
from rest_framework import generics
class OrderListCreateAPIView(generics.ListCreateAPIView):
    queryset = Order.objects.all()
   
    def get_serializer_class(self):
        if is_free_order():
            return FreeOrderSerializer
        return OrderSerializer
```
There are other methods in CBVs that interact with serializers. For example, [get_serializer()][5] returns an already-instantiated serializer, while [get_serializer_context()][6] returns the arguments you'll pass to the serializer when creating its instance. For views that create or update data, there are `create` and `update` that validate the data with the `is_valid` method to be saved, and [perform_create][7] and [perform_update][8] that call the serializer's save method.
### Learn more
For other resources, see my friend André Ericson's [Classy Django REST Framework][9] website. It is a [Classy Class-Based Views][10] REST Framework version that gives you an in-depth inspection of the classes that compose DRF. Of course, the official [documentation][11] is an awesome resource.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/django-rest-framework-serializers
作者:[Renato Oliveira][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/renato-oliveira
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds)
[2]: http://www.labcodes.com.br
[3]: https://www.djangoproject.com/
[4]: https://www.django-rest-framework.org/
[5]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#get_serializer
[6]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#get_serializer_context
[7]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#perform_create
[8]: http://www.cdrf.co/3.9/rest_framework.generics/RetrieveUpdateAPIView.html#perform_update
[9]: http://www.cdrf.co/
[10]: https://ccbv.co.uk/
[11]: https://www.django-rest-framework.org/api-guide/serializers/#serializers

View File

@ -0,0 +1,130 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Linux Jargon Buster: What is Grub in Linux? What is it Used for?)
[#]: via: (https://itsfoss.com/what-is-grub/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Linux Jargon Buster: What is Grub in Linux? What is it Used for?
======
If you ever used a desktop Linux system, you must have seen this screen. This is called the GRUB screen. Yes, it is written in all capital letters.
![Remember this screen? This is GRUB][1]
In this chapter of the Linux Jargon Buster series, Ill tell you what is Grub and what is it used for. Ill also briefly touch upon the configuration and customization part.
### What is GRUB?
[GRUB][2] is complete program for loading and managing boot. It is the most common bootloader for Linux distributions. A bootloader is the first software that runs when a computer starts. It loads the [kernel of the operating system][3] and then the kernel initializes the rest of the operating systems (shell, [display manager][4], [desktop environment][5] etc).
#### Boot loader vs boot manager
I didnt want to confuse you at this stage but I see no option to avoid bringing this topic. There is a blur line between a bootloader and a boot manager.
You already know that bootloader starts first and then loads the kernel into memory and executes it. A boot manager program allows you to choose between operating systems (if there are more than one OS on your system). A boot manager doesnt load the OS directly,
With Linux kernel version 3.3, the [Linux kernel includes a built-in EFI bootloader][6]. In fact, any operating system that is capable of working [EFI system includes an EFI bootloader][7]. In EFI capable systems, the firmware reads the EFI System Partition (ESP) for the EFI files for boot information.
_**Insert Image: Show partition table with ESP partition.**_
![][8]
GRUB is both a bootloader and a boot manager. Ill come back to GRUB in a moment. Lets see other GRUB like programs.
Trivia
GRUB is acronym for **GR**and **U**nified **B**ootloader.
### What are some other boot managing programs like GRUB?
GRUB is the most popular boot manager for Linux. But it is not the only one. There is this highly customizable [rEFInd boot manager][9] that some Linux users love to use.
![Customized rEFInd Boot Manager Screen | Image Credit][10]
There is [systemd-boot][11] text-based boot manager. You can guess that this is exclusively for systemd-based Linux distributions. Some distributions like Pop OS use the systemd-boot.
![systemd-Boot in Pop OS | Image Credit][12]
### Accessing or editing GRUB
The usual GRUB screen you see is its menu interface. It allows you to choose the operating systems if there are more than one operating system. You can also choose to load a different kernel if your Linux distribution as more than one kernel installed.
Depending upon the configuration set by the Linux distribution, you may have some other entries on the GRUB menu.
You can edit GRUB menu entry by pressing the key `e`. This way, you can change the kernel parameters before loading it. For example, in some cases, [disabling the graphics driver from the kernel helps you with Linux system stuck at boot][13].
![][14]
You can also enter the command line menu of GRUB using the key `c` at the GRUB menu interface.
#### GRUB configuration file
Any changes you make to the GRUB from the menu interface is temporary. If you want to make some permanent changes to GRUB like changing the default timeout, you can change the configuration file after you boot into your Linux system.
The default GRUB configuration file is located at /etc/default/grub. There is also a /etc/default/grub.d directory. You may edit the /etc/default/grub file directly, however it is advised to make additional changes by adding config files (.cfg files) in this directory.
![Default GRUB Config File][15]
You must [update GRUB for the changes to take into effect][16].
#### GRUB customizer in Ubuntu
If you think [editing file with a text editor in the terminal][17] is not something you feel comfortable with, you can [use a graphical tool called GRUB Customizer][18].
![][19]
It allows you to change the boot order, default timeout etc. You can also use it to change the background of GRUB with a custom wallpaper.
This tool is unfortunately available for Ubuntu-based Linux distributions only.
### Conclusion
I have touched everything on the surface. EFI, boot loading and GRUB itself is detailed and complicated topic and not in the scope of this article. This article intended to give you a high level overview of GRUB boot program.
Perhaps Ill write a detailed guide on GRUB explaining the low level details. For now, if you want to learn more on GRUB, you can access the GRUB documentation in your Linux terminal using `info grub` command.
![GRUB Manual can be accessed via Terminal][20]
I hope you have a tad bit better understanding of what is GRUB now. Heres a GIF to humor you.
![What Is GRUB? UEFI dont hurt me, no more… :\)][21]
I may not have answered all questions you have about GRUB. Please feel free to let me know in the comment section. I may update the article with your questions or suggestions.
--------------------------------------------------------------------------------
via: https://itsfoss.com/what-is-grub/
作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/grub-screen-linux.png?resize=800%2C450&ssl=1
[2]: https://www.gnu.org/software/grub/
[3]: https://itsfoss.com/what-is-linux/
[4]: https://itsfoss.com/display-manager/
[5]: https://itsfoss.com/what-is-desktop-environment/
[6]: https://www.rodsbooks.com/efi-bootloaders/efistub.html
[7]: https://jdebp.eu/FGA/efi-boot-process.html
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-partition-gparted.png?resize=744%2C385&ssl=1
[9]: https://www.rodsbooks.com/refind/
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/refind-boot-manager.png?resize=800%2C602&ssl=1
[11]: https://wiki.gentoo.org/wiki/Systemd-boot
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/systemd-boot.png?resize=714%2C333&ssl=1
[13]: https://itsfoss.com/fix-ubuntu-freezing/
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/editing-grub-to-fix-nvidia-issue.jpg?resize=800%2C343&ssl=1
[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/default-grub-config-file.png?resize=759%2C437&ssl=1
[16]: https://itsfoss.com/update-grub/
[17]: https://itsfoss.com/command-line-text-editors-linux/
[18]: https://itsfoss.com/grub-customizer-ubuntu/
[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2013/05/make-windows-default-grub-2.jpeg?resize=799%2C435&ssl=1
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/grub-manual-Linux-terminal.png?resize=800%2C462&ssl=1
[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/what_is_GRUB.gif?resize=500%2C343&ssl=1

View File

@ -0,0 +1,262 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Manage multiple Terraform versions with tfenv)
[#]: via: (https://opensource.com/article/20/11/tfenv)
[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb)
Manage multiple Terraform versions with tfenv
======
If you use multiple Terraform versions in your environment, tfenv will
make your life much easier.
![Computer screen with files or windows open][1]
In my [Terraform for Kubernetes beginners][2] article, I used Terraform 11, and in an upcoming article, I'll cover upgrading from Terraform 11 to 12. To prepare for that, in this article, I'll show you how to use [tfenv][3], a tool that makes it much easier to convert from one version to another, as well as to manage multiple Terraform versions in your work environment.
### Install tfenv
Many coding languages have tools that allow you to go back and forth between versions based on environmental rules. One example (which tfenv is based on) is [rbenv][4], which allows you to choose which version of [Ruby][5] you want to work with.
tfenv works on Linux, macOS, and Windows; I'll cover the Linux installation using Ubuntu 18.04, but the tool's GitHub repository has [installation instructions][6] for the other operating systems.
The Linux installation uses some Git commands (check out the [intro to Git][7] series if you're not already familiar with it).
First, create a `.tfenv` folder in your `${HOME}` directory:
```
`jess@Athena:~$ mkdir .tfenv`
```
Clone the `tfenv` repository:
```
jess@Athena:~$ git clone <https://github.com/tfutils/tfenv.git> ~/.tfenv
Cloning into '/home/jess/.tfenv'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 1105 (delta 8), reused 10 (delta 2), pack-reused 1084
Receiving objects: 100% (1105/1105), 216.01 KiB | 2.84 MiB/s, done.
Resolving deltas: 100% (703/703), done.
```
If you prefer [Homebrew][8], you can use:
```
`$ brew install tfenv`
```
Export your path into your Bash profile:
```
`jess@Athena:~$ echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile`
```
If you want to use just the base commands for Ubuntu/Debian-based systems, there is another option that makes things a little easier. After doing the clone in the `.tfenv` directory, set your profile to put the `tfenv` command into your profile in your next session:
```
`jess@Athena:~/.tfenv$ . ~/.profile`
```
Once the profile is set, you can symlink your directory to your `.local/bin` directory to make `tfenv` an executable binary:
```
`jess@Athena:~/.tfenv$ ln -s ~/.tfenv/bin/* ~/.local/bin`
```
Run the `which` command, and you should see `tfenv`'s location:
```
jess@Athena:~/.tfenv$ which tfenv
/home/jess/.local/bin/tfenv
```
### How to use tfenv
Now that everything is installed, check out what commands are available:
```
jess@Athena:~$ tfenv
tfenv 2.0.0-37-g0494129
Usage: tfenv &lt;command&gt; [&lt;options&gt;]
Commands:
   install      Install a specific version of Terraform
   use          Switch a version to use
   uninstall    Uninstall a specific version of Terraform
   list         List all installed versions
   list-remote  List all installable versions
```
As you can see, it's a pretty straightforward tool that enables you to install and uninstall Terraform versions as needed.
Before you decide what to install, check which versions are available. This is a small snippet, as the list is about a mile long:
```
jess@Athena:~$ tfenv list-remote
0.14.0-beta1
0.14.0-alpha20201007
0.14.0-alpha20200923
0.14.0-alpha20200910
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.13.0-rc1
0.13.0-beta3
0.13.0-beta2
0.13.0-beta1
0.12.29
0.12.28
0.12.27
```
#### Install Terraform versions
To install the latest version of Terraform:
```
jess@Athena:~$ tfenv install latest
Installing Terraform v0.13.5
Downloading release tarball from <https://releases.hashicorp.com/terraform/0.13.5/terraform\_0.13.5\_linux\_amd64.zip>
###################################################################################################################################################################################### 100.0%
Downloading SHA hash file from <https://releases.hashicorp.com/terraform/0.13.5/terraform\_0.13.5\_SHA256SUMS>
No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.N3bzZ2/terraform_0.13.5_linux_amd64.zip
  inflating: /home/jess/.tfenv/versions/0.13.5/terraform  
Installation of terraform v0.13.5 successful. To make this your default version, run 'tfenv use 0.13.5'
```
To install a specific Terraform version (in this case, 0.12.29):
```
jess@Athena:~$ tfenv install 0.12.29
Installing Terraform v0.12.29
Downloading release tarball from <https://releases.hashicorp.com/terraform/0.12.29/terraform\_0.12.29\_linux\_amd64.zip>
###################################################################################################################################################################################### 100.0%
Downloading SHA hash file from <https://releases.hashicorp.com/terraform/0.12.29/terraform\_0.12.29\_SHA256SUMS>
No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.1YFOLh/terraform_0.12.29_linux_amd64.zip
  inflating: /home/jess/.tfenv/versions/0.12.29/terraform  
Installation of terraform v0.12.29 successful. To make this your default version, run 'tfenv use 0.12.29'
```
Finally, to install the latest version of Terraform 0.11:
```
jess@Athena:~$ tfenv install latest:^0.11
Installing Terraform v0.11.15-oci
Downloading release tarball from <https://releases.hashicorp.com/terraform/0.11.15-oci/terraform\_0.11.15-oci\_linux\_amd64.zip>
###################################################################################################################################################################################### 100.0%
Downloading SHA hash file from <https://releases.hashicorp.com/terraform/0.11.15-oci/terraform\_0.11.15-oci\_SHA256SUMS>
No keybase install found, skipping OpenPGP signature verification
Archive:  tfenv_download.8OxQ8k/terraform_0.11.15-oci_linux_amd64.zip
  inflating: /home/jess/.tfenv/versions/0.11.15-oci/terraform  
Installation of terraform v0.11.15-oci successful. To make this your default version, run 'tfenv use 0.11.15-oci'
```
That was simple, and now you can put them to use!
#### Change Terraform versions
Once you have installed several versions of Terraform, you can pick one to use. First, find out your options by listing the installed versions:
```
jess@Athena:~$ tfenv list
  0.13.5 (set by /home/jess/.tfenv/version)
  0.12.29
  0.11.15-oci
```
By default, tfenv chooses the most up-to-date version of Terraform you have installed. Find out the default by running the `tfenv use` command:
```
jess@Athena:~$ tfenv use
Switching default version to v0.13.5
Switching completed
jess@Athena:~$ terraform --version
Terraform v0.13.5
```
But what if you need to use an older version? This example switches to the oldest version I have installed:
```
jess@Athena:~$ tfenv use 0.11.15-oci
Switching default version to v0.11.15-oci
Switching completed
jess@Athena:~$ terraform -version
Terraform v0.11.15-oci
Your version of Terraform is out of date! The latest version
is 0.13.5. You can update by downloading from [www.terraform.io/downloads.html][9]
```
It's easy as pie! Just run the `list` command and use the naming convention provided.
#### Uninstall Terraform versions
If you have a version of Terraform you don't want or need any more, you can remove it with the `uninstall` command. For example, I don't need Terraform version 0.13:
```
jess@Athena:~$ tfenv uninstall 0.13.5
Uninstall Terraform v0.13.5
Terraform v0.13.5 is successfully uninstalled
```
To confirm it's no longer installed:
```
jess@Athena:~$ tfenv list
  0.12.29
  0.11.15-oci
```
### Final thoughts
The tfenv tool is great for many reasons. If you need to update from one version of Terraform to another, this is one of the faster ways to upgrade and test the outcome. If your environment has things running on several Terraform versions, it's easy to switch back and forth as needed. If you use Terraform, try tfenv and see how it can transform your environment.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/tfenv
作者:[Jessica Cherry][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/cherrybomb
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
[2]: https://opensource.com/article/20/7/terraform-kubernetes
[3]: https://github.com/tfutils/tfenv
[4]: https://github.com/rbenv/rbenv
[5]: https://www.ruby-lang.org/en/
[6]: https://github.com/tfutils/tfenv#installation
[7]: https://opensource.com/life/16/7/stumbling-git
[8]: https://opensource.com/article/20/6/homebrew-linux
[9]: http://www.terraform.io/downloads.html

View File

@ -0,0 +1,115 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Podman with capabilities on Fedora)
[#]: via: (https://fedoramagazine.org/podman-with-capabilities-on-fedora/)
[#]: author: (shiwanibiradar https://fedoramagazine.org/author/shiwanibiradar/)
Podman with capabilities on Fedora
======
![][1]
Containerization is a booming technology. As many as seventy-five percent of global organizations could be running some type of containerization technology in the near future. Since widely used technologies are more likely to be targeted by hackers, securing containers is especially important. This article will demonstrate how [POSIX capabilities][2] are used to secure Podman containers. Podman is the default container management tool in RHEL8.
### Determine the Podman containers privilege mode
Containers run in either privileged or unprivileged mode. In privileged mode, [the container uid 0 is mapped to the hosts uid 0][3]. For some use cases, unprivileged containers [lack sufficient access][4] to the resources of the host machine. Technologies and techniques including Mandatory Access Control (apparmor, SELinux), seccomp filters, dropping of capabilities, and namespaces help to secure containers regardless of their mode of operation.
**To determine the privilege mode from outside the container:**
```
$ podman inspect --format="{{.HostConfig.Privileged}}" <container id>
```
If the above command returns _true_ then the container is running in privileged mode. If it returns _false_ then the container is running in unprivileged mode.
**To determine the privilege mode from inside the container:**
```
$ ip link add dummy0 type dummy
```
If this command allows you to create an interface then you are running a privileged container. Otherwise you are running an unprivileged container.
### Capabilities
Namespaces isolate a containers processes from arbitrary access to the resources of its host and from access to the resources of other containers running on the same host. Processes within _privileged_ containers, however, might still be able to do things like alter the IP routing table, trace arbitrary processes, and load kernel modules. Capabilities allow one to apply finer-grained restrictions on what resources the processes within a container can access or alter; even when the container is running in privileged mode. Capabilities also allow one to assign privileges to an unprivileged container that it would not otherwise have.
For example, to add the _NET_ADMIN_ capability to an unprivileged container so that a network interface can be created inside of the container, you would run _podman_ with parameters similar to the following:
```
[root@vm1 ~]# podman run -it --cap-add=NET_ADMIN centos
[root@b27fea33ccf1 /]# ip link add dummy0 type dummy
[root@b27fea33ccf1 /]# ip link
```
The above commands demonstrate a _dummy0_ interface being created in an unprivileged container. Without the _NET_ADMIN_ capability, an unprivileged container would not be able to create an interface. The above commands demonstrate how to grant a capability to an unprivileged container.
Currently, there are about [39 capabilities][5] that can be granted or denied. Privileged containers are granted many capabilities by default. It is advisable to drop unneeded capabilities from privileged containers to make them more secure.
**To drop all capabilities from a container:**
```
$ podman run -it -d --name mycontainer --cap-drop=all centos
```
**To list a containers capabilities:**
```
$ podman exec -it 48f11d9fa512 capsh --print
```
The above command should show that no capabilities are granted to the container.
**Refer to the _capabilities_ man page for a complete list of capabilities:**
```
$ man capabilities
```
**Use the _capsh_ command to list the capabilities you currently possess:**
```
$ capsh --print
```
As another example, the below command demonstrates dropping the _NET_RAW_ capability from a container. Without the _NET_RAW_ capability, servers on the internet cannot be pinged from within the container.
```
$ podman run -it --name mycontainer1 --cap-drop=net_raw centos
>>> ping google.com (will output error, operation not permitted)
```
As a final example, if your container were to only need the _SETUID_ and _SETGID_ capabilities, you could achieve such a permission set by dropping all capabilities and then re-adding only those two.
```
$ podman run -d --cap-drop=all --cap-add=setuid --cap-add=setgid fedora sleep 5 > /dev/null; pscap | grep sleep
```
The _pscap_ command shown above should show the capabilities that have been granted to the container.
I hope you enjoyed this brief exploration of how capabilities are used to secure Podman containers.
Thank You!
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/podman-with-capabilities-on-fedora/
作者:[shiwanibiradar][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/shiwanibiradar/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/podman-816x345.jpg
[2]: https://www.linuxjournal.com/magazine/making-root-unprivileged
[3]: https://linuxcontainers.org/lxc/security/#privileged-containers
[4]: https://github.com/containers/podman/blob/master/rootless.md
[5]: https://man7.org/linux/man-pages/man7/capabilities.7.html

View File

@ -0,0 +1,272 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Unlock encrypted disks on Linux automatically)
[#]: via: (https://opensource.com/article/20/11/nbde-linux)
[#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield)
Unlock encrypted disks on Linux automatically
======
Open encrypted disks without having to manually enter a passcode by
using Network-Bound Disk Encryption (NBDE).
![Lock][1]
From a security viewpoint, it's important to encrypt your sensitive data to protect it from prying eyes and hackers. Linux Unified Key Setup ([LUKS][2]) is a great tool and a common standard for Linux disk encryption. Because it stores all pertinent setup information in the partition header, it makes migrating data easy.
To configure encrypted disks or partitions with LUKS, you will need to use the [cryptsetup][3] utility. Unfortunately, one of the downsides of encrypting your disks is that you have to manually provide the password every time the system is rebooted or the disk is remounted.
However, Network-Bound Disk Encryption (NBDE) can automatically and securely unlock encrypted disks without any user intervention. It is available in several Linux distributions, beginning with Red Hat Enterprise Linux 7.4, CentOS 7.4, and Fedora 24, and in later versions of each.
NBDE is implemented with the following technologies:
* **[Clevis framework][4]:** A pluggable framework tool that automatically decrypts and unlocks LUKS volumes
* **[Tang server][5]:** A service for binding cryptographic keys to network presence
Tang provides the encryption keys to the Clevis client. According to Tang's developers, this provides a secure, stateless, anonymous alternative to key escrow services.
Because NBDE uses the client-server architecture, you must configure both the client and the server. You can use a virtual machine on your local network for your Tang server.
### Server installation
Install Tang using sudo:
```
`sudo yum install tang -y`
```
Enable the Tang server:
```
`sudo systemctl enable tangd.socket --now`
```
The Tang server works on port 80 and must be added to firewalld. Add the appropriate firewalld rule:
```
sudo  firewall-cmd --add-port=tcp/80 --perm
sudo firewall-cmd --reload
```
The server should now be installed.
### Client installation
For this example, assume you have added a new 1GB disk named `/dev/vdc` to your system.
Create the primary partition using fdisk or parted:
```
sudo fdisk /dev/vdc
```
Complete the following steps to install the client.
```
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x4a6812d4.
Command (m for help):
```
Enter **n** to create the new partition:
```
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended  
Select (default p):
```
Hit the **Enter** key to select the primary partition:
```
Using default response p
Partition number (1-4, default 1):
```
Hit the **Enter** key to select the default partition number:
```
First sector (2048-2097151, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151):
```
Hit the **Enter** key to select the last sector:
```
Using default value 2097151
Partition 1 of type Linux and of size 1023 MiB is set
Command (m for help): wq
```
Type **wq** to save the changes and exit fdisk:
```
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
```
Run `partprobe` to inform the system of the partition table changes:
```
`sudo partprobe`
```
Install the cryptsetup package using sudo:
```
`sudo yum install cryptsetup -y`
```
Use the `cryptsetup luksFormat` command to encrypt the disk. You will need to type **YES** when prompted and also choose and enter a passphrase to encrypt the disk:
```
sudo cryptsetup luksFormat /dev/vdc1
WARNING!
========
This will overwrite data on /dev/vdc1 irrevocably.
Are you sure? (Type uppercase yes):
Enter passphrase for /dev/vdc1:
Verify passphrase:
```
Use the `cryptsetup luksOpen` command to map the encrypted partition to a logical device. For example, use `encryptedvdc1` as the name. You will also need to enter the passphrase again:
```
sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1
Enter passphrase for /dev/vdc1:
```
The encrypted partition is now available at `/dev/mapper/encryptedvdc1`.
Create an XFS filesystem on the encrypted partition:
```
`sudo mkfs.xfs /dev/mapper/encryptedvdc1`
```
Create a directory for mounting the encrypted partition:
```
`sudo mkdir /encrypted`
```
Use the `cryptsetup luksClose` command to lock the partition:
```
`cryptsetup luksClose encryptedvdc1`
```
Install the Clevis packages using sudo:
```
`sudo yum install clevis clevis-luks clevis-dracut -y`
```
Modify /etc/crypttab to open the encrypted volume at boot time:
```
`sudo vim /etc/crypttab`
```
Add the following line:
```
`encryptedvdc1       /dev/vdc1  none   _netdev`
```
Modify /etc/fstab to automatically mount the encrypted volume during a reboot or at boot time:
```
`sudo vim /etc/fstab`
```
Add the following line:
```
`/dev/mapper/encryptedvdc1   /encrypted       xfs    _netdev        1 2`
```
For this example, assume the Tang server's IP address is `192.168.1.20`. You can also use the hostname or domain if you prefer.
Run the following `clevis` command:
```
sudo clevis bind luks -d /dev/vdc1 tang '{"url":"<http://192.168.1.20"}>'
The advertisement contains the following signing keys:
rwA2BAITfYLuyNiIeYUMBzkhk7M
Do you wish to trust these keys? [ynYN] Y
Enter existing LUKS password:
```
Type **Y** to accept the keys for the Tang server and provide the existing LUKS password for the initial setup.
Enable clevis-luks-askpass.path via systemctl in order to prevent being prompted for the passphrase for non-root partitions.
```
`sudo systemctl enable clevis-luks-askpass.path`
```
The client is installed. Now, whenever you reboot the server, the encrypted disk should automatically be decrypted and mounted by retrieving the keys from the Tang server.
If the Tang server is unavailable for any reason, you'll need to provide the passphrase manually in order to decrypt and mount the partition.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/nbde-linux
作者:[Curt Warfield][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/rcurtiswarfield
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock)
[2]: https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup
[3]: https://gitlab.com/cryptsetup/cryptsetup
[4]: https://github.com/latchset/clevis
[5]: https://github.com/latchset/tang

View File

@ -1,6 +1,6 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: reviewer: (wxy)
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Add sound to your Python game)
@ -9,10 +9,12 @@
添加声音到你的 Python 游戏
======
通过添加声音到你的游戏中,听听当你的英雄战斗,跳跃,收集战利品时会发生什么。学习如何在这一 Pygame 系列的第十三篇文章中,创建一个声音平台类精灵。
> 通过添加声音到你的游戏中,听听当你的英雄战斗、跳跃、收集战利品时会发生什么。学习如何在这个 Pygame 系列的第十三篇文章中,创建一个声音平台类精灵。
![彩色声波图][1]
这是仍在进行中的关于使用 [Pygame][3] 模块来在 [Python 3][2] 中创建电脑游戏的第十三部分。先前的文章是:
在 [Python 3][2] 中使用 [Pygame][3] 模块来创建电脑游戏的系列文章仍在进行中,这是第十三部分。先前的文章是:
1. [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4]
2. [使用 Python 和 Pygame 模块构建一个游戏框架][5]
@ -25,18 +27,15 @@
9. [使你的 Python 游戏玩家能够向前和向后跑][12]
10. [在你的 Python 平台类游戏中放一些奖励][13]
11. [添加计分到你的 Python 游戏][14]
12. [在你的Python游戏中加入投掷技巧][15]
12. [在你的 Python 游戏中加入投掷技巧][15]
Pygame 提供了一种简单的方法来集成声音到你的 Python 电脑游戏中。Pygame 的 [mixer 模块][16] 可以依据命令播放一个或多个声音,并且你也可以将这些声音混合在一起,例如,你能够在听到你的英雄收集奖励或跳过敌人声音的同时播放背景音乐。
集成 mixer 模块到一个已存在的游戏中是很容易的,因此 — 并不是给予你代码示例来向你展示放置它们的准确位置 — 这篇文章分四个所需要的步骤来阐明如何在你应用程序中的获取声音
集成 `mixer` 模块到一个已存在的游戏中是很容易的,因此,与其给你代码示例来向你展示放置它们的位置,不如在这篇文章解释在你的应用程序中获得声音所需的四个步骤
### 启动 mixer
首先,在你代码的 setup 部分,启动 mixer 进程。你的代码已经启动 Pygame 和 Pygame 字体,因此将它们归类到一起是一个很好的主意:
首先,在你代码的设置部分,启动 `mixer` 进程。你的代码已经启动 Pygame 和 Pygame 字体,因此将它们归类到一起是一个很好的主意:
```
pygame.init()
@ -48,16 +47,15 @@ pygame.mixer.init() # add this line
接下来,你必需定义你想要使用的声音。这样就要求你的计算机上有声音文件,就像使用字体就要求你有字体文件,使用图像就要求你有图像文件一样。
你还必需把这些声音与你的游戏捆绑在一起,以便任何玩你游戏的人都有声音文件。
你还必需把这些声音与你的游戏捆绑在一起,以便任何玩你游戏的人都有这些声音文件。
为将一个声音与你的游戏捆绑在一起,首先在你的游戏目录中创建一个新的目录,就像你为你图像和字体创建的目录一样。称它为 `sound`:
```
s = 'sound'
```
尽管在互联网上有很多声音文件,下载这些声音文件并将其与你的游戏一起分发并不一定是合法的。这看起来是很奇怪的,因为这么多来自著名电脑游戏的声音是流行文化的一部分,但法律就是这样运作的。如果你想与你的游戏一起分发一个声音文件,你必需找到一个开放源码或 [Creative Commons][17] 声音文件,它们准许与游戏一起提供声音。
尽管在互联网上有很多声音文件,下载这些声音文件并将其与你的游戏一起分发并不一定是合法的。这看起来是很奇怪的,因为这么多来自著名电脑游戏的声音是流行文化的一部分,但法律就是这样运作的。如果你想与你的游戏一起分发一个声音文件,你必需找到一个开源或[共创许可][17]的声音文件,它们准许与游戏一起提供声音。
这里有一些专门提供自由和合法的声音文件的网站,包括:
@ -65,28 +63,23 @@ s = 'sound'
* [Incompetech][19] 托管存储背景音乐。
* [Open Game Art][20] 托管存储一些音效和音乐。
一些声音文件只要你给予作曲家或声音设计师一个致谢就可以自由使用。在与你的游戏捆绑前,仔细阅读使用条件!音乐家和声音设计师在声音上的工作就像你在代码上的工作一样努力,因此即使他们不要求,给予他们致谢也是极好的。
给予你的声音源文件一些致谢,在一个名为 `CREDIT` 的文本文件中列出你使用的声音,并在你的游戏文件夹中放置该文本文件。
一些声音文件只有当你给予作曲家或声音设计师一下费用时才是可以自由使用的。在与你的游戏捆绑前,仔细阅读使用条件!音乐家和声音设计师在声音上的工作就像你在代码上的工作一样努力,因此当他们不要一些费用时,给予他们一些费用也是极好的。
给予你的声音源文件一些费用,在一个名称为 `CREDIT` 的文本文件中列出你使用的声音,并在你的游戏文件夹中放置该文本文件。
你也可以尝试制作你自己的音乐。极好的 [LMMS][21] 音频工作站易于使用,并携带很多有趣的声音。它在所有主要的平台上都可以使用,也可以导出为 [Ogg Vorbis][22] (OGG) 音频格式。
你也可以尝试制作你自己的音乐。优秀的 [LMMS][21] 音频工作站易于使用,并带有很多有趣的声音。它在所有主要的平台上都可以使用,也可以导出为 [Ogg Vorbis][22]OGG音频格式。
### 添加声音到 Pygame
当你找到你喜欢的一个声音文件时,下载它。如果它来自一个 ZIP 或 TAR 文件中,提取它并将其移动到你游戏目录中的 `sound` 文件夹中。
当你找到你喜欢的一个声音文件时,下载它。如果它是一个 ZIP 或 TAR 文件,提取它并将其移动到你游戏目录中的 `sound` 文件夹中。
如果声音文件有一个带有空格或特殊字符的名字,重新命名它。文件名称是完全随意的,它的名称越简单,你就越容易输入到你的代码中。
如果声音文件的名字带有空格或特殊字符,重新命名它。文件名称是完全随意的,它的名称越简单,你就越容易输入到你的代码中。
大多数的电脑游戏使用 OGG 格式声音文件,因为这种格式在占有较小空间的情况下提供高质量的声音。当你下载一个声音文件时,它可能是一个 MP3, WAVE, FLAC, 或者其它的音频格式。为保持你的文件的较高兼容性和降低下载文件大小,使用一个工具 (像 [fre:ac][23] 或 [Miro][24]) 来转换这些的文件格式为 Ogg 格式。
大多数的电脑游戏使用 OGG 格式声音文件,因为这种格式可以占有较小空间而提供高质量的声音。当你下载一个声音文件时,它可能是一个 MP3、WAVE、FLAC 或者其它的音频格式。为保持你的文件的较高兼容性和降低下载文件大小,使用一个像 [fre:ac][23] 或 [Miro][24] 这样的工具来转换这些的文件格式为 Ogg 格式。
例如,假设你已经下载一个称为 ouch.ogg 的声音文件。
在你代码的 setup 部分中,创建一个代表这你想使用的声音文件的变量:
例如,假设你已经下载一个称为 `ouch.ogg` 的声音文件。
在你代码的设置部分中,创建一个变量,代表你想使用的声音文件:
```
ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg'))
@ -94,8 +87,7 @@ ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg'))
### 触发一个声音
为使用一个声音,你所需要做的全部工作是,当你想触发声音时来调用变量。例如,当你的玩家击中一名敌人时,触发 `OUCH` 声音效果:
为使用一个声音,你所要做的就是在你想触发它的时候调用这个变量。例如,当你的玩家击中一名敌人时,触发 `OUCH` 声音效果:
```
for enemy in enemy_hit_list:
@ -103,12 +95,11 @@ for enemy in enemy_hit_list:
score -= 1
```
你可以为所有的动作类型创建声音,例如,跳跃,收集奖励,投掷,碰撞,和任何你可以想象到的东西
你可以为各种动作创建声音,例如,跳跃、收集奖励、投掷、碰撞,以及其他任何你能想象到的动作
### 添加背景音乐
如果你有你想在你的游戏的背景中播放的音乐或令人激动的音效,你可以使用 Pygame 中的 mixer 模块中的`music` 函数。在你的 setup 部分中,加载音乐文件:
如果你有想在你的游戏的背景中播放的音乐或令人激动的音效,你可以使用 Pygame 中的 `mixer` 模块中的 `music` 函数。在你的设置部分中,加载音乐文件:
```
music = pygame.mixer.music.load(os.path.join(s, 'music.ogg'))
@ -116,14 +107,13 @@ music = pygame.mixer.music.load(os.path.join(s, 'music.ogg'))
然后,开始音乐:
```
pygame.mixer.music.play(-1)
```
`-1`告诉 Pygame 无限循环音乐文件。你可以将其设置为 `0` 或任意更高的数值,以定义音乐在停止前循环多少次。
`-1` 值告诉 Pygame 无限循环音乐文件。你可以将其设置为从 0 到更高的值之间的任意数值,以定义音乐在停止前循环多少次。
### 享受声音时空
### 享受音效
音乐和声音可以为你的游戏添加很多韵味。尝试添加一些声音到你的 Pygame 工程!
@ -134,7 +124,7 @@ via: https://opensource.com/article/20/9/add-sound-python-game
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -143,17 +133,17 @@ via: https://opensource.com/article/20/9/add-sound-python-game
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph)
[2]: https://www.python.org/
[3]: https://www.pygame.org/news
[4]: https://opensource.com/article/17/10/python-101
[5]: https://opensource.com/article/17/12/game-framework-python
[6]: https://opensource.com/article/17/12/game-python-add-a-player
[7]: https://opensource.com/article/17/12/game-python-moving-player
[8]: https://opensource.com/article/18/5/pygame-enemy
[9]: https://opensource.com/article/18/7/put-platforms-python-game
[10]: https://opensource.com/article/19/11/simulate-gravity-python
[11]: https://opensource.com/article/19/12/jumping-python-platformer-game
[12]: https://opensource.com/article/19/12/python-platformer-game-run
[13]: https://opensource.com/article/19/12/loot-python-platformer-game
[14]: https://opensource.com/article/20/1/add-scorekeeping-your-python-game
[4]: https://linux.cn/article-9071-1.html
[5]: https://linux.cn/article-10850-1.html
[6]: https://linux.cn/article-10858-1.html
[7]: https://linux.cn/article-10874-1.html
[8]: https://linux.cn/article-10883-1.html
[9]: https://linux.cn/article-10902-1.html
[10]: https://linux.cn/article-11780-1.html
[11]: https://linux.cn/article-11790-1.html
[12]: https://linux.cn/article-11819-1.html
[13]: https://linux.cn/article-11828-1.html
[14]: https://linux.cn/article-11839-1.html
[15]: https://opensource.com/article/20/9/add-throwing-python-game
[16]: https://www.pygame.org/docs/ref/mixer.html
[17]: https://opensource.com/article/20/1/what-creative-commons

View File

@ -0,0 +1,88 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What I love about the newest GNOME desktop)
[#]: via: (https://opensource.com/article/20/11/new-gnome)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
我对最新的 GNOME 桌面的喜爱之处
======
看看 GNOME 3.38 桌面的最新功能。
![Digital images of a computer desktop][1]
Fedora 33 [刚出来][2],我就马上安装了它。在这个新版 Linux 发行版的众多功能中,其中之一是最新的 GNOME 桌面。GNOME 3.38 于 2020 年 9 月发布,我很喜欢它。
### 我为什么喜欢 GNOME 3.38
GNOME 3.38 [发布说明][3]中列出了这次更新中的一些重大的新功能。其中,如果你是新用户的话,新用户的欢迎页面得到了重大的改版,现在更加容易使用,并且提供了更多有用的信息。
![The new "Welcome GNOME"][4]
([GNOME][5], [CC BY-SA 4.0][6])
我还喜欢在 GNOME 应用概览中拖动来重新排列应用图标的功能。这让我在 GNOME 下组织我一直使用的应用变得轻而易举。你甚至可以将图标拖放在一起,并自动将它们放入文件夹。
![GNOME 3.38 Application Overview][7]
([GNOME][5], [CC BY-SA 4.0][6])
我的家人在不同的时区,更新后的 GNOME 时钟使得添加新的世界时钟变得更加容易,所以当我给家人打电话时,我不必弄清楚现在是什么时间。他们是提前一个小时还是晚了一个小时?我只需查看 GNOME 时钟,就能一目了然地看到每个人的当地时间。另外,虽然我并不经常使用闹钟功能,但我喜欢我可以自己设置铃声持续时间和每个闹钟的默认”打盹“时间。
![Adding a new world clock in GNOME Clocks][8]
([GNOME][5], [CC BY-SA 4.0][6])
除了所有的功能更新之外GNOME 3.38 中最大的改进是性能。正如 GNOME 开发者 Emmanuele Bassi [今年早些时候的解释][9]“GNOME 中的每个人都为使速度更快而做了很多工作,即使是在树莓派等更有限的系统上运行的人。为了让 GNOME 表现得更好大家做了很多工作。因为人们真的很关心它”。而这一点在新版本中体现得淋漓尽致GNOME 桌面感觉反应更灵敏。
![Applications running on GNOME 3.38][10]
([GNOME][5], [CC BY-SA 4.0][6])
作为我的咨询和培训业务的一部分,我经常在几个开放的应用之间切换,包括 LibreOffice、GIMP、Inkscape、一个网络浏览器等。在 GNOME 3.38 中,启动一个新的应用或在开放应用之间切换感觉更快。
### 除了一件事
如果说新版 GNOME 中有什么我不喜欢的地方,那就是重新设计的屏幕截图工具。我一直使用这个工具来抓取屏幕上的一部分内容,并将其插入到我的演示文稿和培训文档中。
![GNOME Screenshot tool][11]
(Jim Hall, [CC BY-SA 4.0][6])
当我浏览用户界面或电脑屏幕时,我自然会像阅读书籍或杂志那样浏览:从左到右,从上到下。当我使用新的屏幕截图工具进行屏幕截图时,我从左上角开始,然后进行选择。大多数时候,我只需要改变选区的捕捉区域,所以我点击那个按钮,然后寻找截图的按钮。但我总是要花点时间才能找到左上角的**截图**按钮。它并不在窗口的底部,也不是我希望找到它的地方。
![GNOME Screenshot tool][12]
(Jim Hall, [CC BY-SA 4.0][6])
到目前为止,这似乎是我在 GNOME 3.38 中唯一的烦恼。总的来说,我对新的 GNOME 感到非常兴奋。我希望你也是!
要了解更多关于 GNOME 3.38 的信息,请访问 [GNOME 网站][13]或阅读 [GNOME 3.38 公告][5]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/11/new-gnome
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop)
[2]: https://fedoramagazine.org/announcing-fedora-33/
[3]: https://help.gnome.org/misc/release-notes/3.38/
[4]: https://opensource.com/sites/default/files/uploads/welcome-tour.png (The new "Welcome GNOME" )
[5]: https://www.gnome.org/news/2020/09/gnome-3-38-released/
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://opensource.com/sites/default/files/uploads/app-overview.png (GNOME 3.38 Application Overview)
[8]: https://opensource.com/sites/default/files/uploads/world-clocks.png (Adding a new world clock in GNOME Clocks)
[9]: https://opensource.com/article/20/7/new-gnome-features
[10]: https://opensource.com/sites/default/files/uploads/desktop-busy.png (Applications running on GNOME 3.38)
[11]: https://opensource.com/sites/default/files/uploads/gnome-screenshot-tool.png (GNOME Screenshot tool)
[12]: https://opensource.com/sites/default/files/uploads/screenshot-tool-path.png (GNOME Screenshot tool)
[13]: https://www.gnome.org/

View File

@ -0,0 +1,127 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Install Google Chrome on Fedora [Beginners Tutorial])
[#]: via: (https://itsfoss.com/install-google-chrome-fedora/)
[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/)
如何在 Fedora 上安装 Google Chrome 浏览器(入门教程)
======
Fedora 的默认网页浏览器是 Firefox。尽管它是一个优秀的网络浏览器你可能更喜欢流行的 Google Chrome 浏览器。
如果你想知道如何在 Fedora 上安装 Google Chrome 浏览器,让我告诉你两种安装 Google Chrome 浏览器的方法:图形化法和命令行法。
* [图形化方法 1通过启用 Fedora 第三方仓库从软件中心安装 Chrom e浏览器][1] 。
* [图形化方法 2从谷歌浏览器网站下载 RPM 文件][2]
* [命令行方法:从 Fedora 第三方仓库安装 Chrome一切使用命令与 GUI 方法 1 相同)][3]。
这全取决于你喜欢哪种方法。你在 [Fedora][4] 上的 Google Chrome 浏览器都将通过这三种方法的系统更新获取定期更新。
### 方法 1在 Fedora 中从软件中心安装 Google Chrome
Fedora 提供了一个第三方仓库其中包含了一些流行的专有软件、图形驱动程序。Google Chrome 就是其中之一。
第一步,确保在 Fedora 中启用第三方仓库。你应该在软件中心中看到这个选项。
![Step1: Fedora Third Party Repositories][5]
启用后,只需在软件中心搜索 Chrome
![Step 2: Search for Chrome In Fedora Software Center][6]
并从那里安装它:
![Step 3: Install Chrome Fedora][7]
Can it be any easier than this? I dont think either :)
还有比这更简单的吗?我不这么认为 :)
### 方法 2在 Fedora 上从 Chrome 网站安装 Google Chrome
如果你不想启用第三方仓库,也没关系。你不必这样做。你可以从 Chrome 的网站上下载 RPM 文件,双击并安装它。
访问 Google Chrome 的网站,点击下载按钮。
[Get Google Chrome][8]
![][9]
然后选择 .rpm 包,点击“接受并安装”。
![][10]
下载结束后,双击文件,在包管理器提示时点击安装。输入密码,等待安装完成。
![][11]
这是超级简单的,对吧?让我们来看看有点复杂的方法(如果你不是一个终端爱好者)。
### 方法 3使用命令行在 Fedora 上安装 Chrome
首先,你需要添加额外的 Fedora 仓库(你在方法 1 中看到的)
```
sudo dnf install fedora-workstation-repositories
```
然后启用 Google Chrome 仓库。
```
sudo dnf config-manager --set-enabled google-chrome
```
![][12]
要安装 Google Chrome 稳定版,请在终端运行以下命令。
```
sudo dnf install google-chrome-stable
```
你会看到一个导入 GPG 密钥的警告,输入 y 继续。
![][13]
你正在添加 Google Chrome 仓库。这个软件包来自这个仓库,它直接来自 Google。
#### 总结
即使你使用命令行,在 Fedora 上安装 Google chrome 也相当简单。除了第三方仓库的部分,这和[在 Ubuntu 上安装 Chrome][14] 差不多。
现在你已经安装好了,你可能会想[查看我们的 Google Chrome 键盘快捷键列表][15]来更快地使用浏览器。
不要忘记订阅,获取关于 Fedora 的最新消息和教程,如果你有任何问题,请在下方留言。
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-google-chrome-fedora/
作者:[Dimitrios Savvopoulos][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/dimitrios/
[b]: https://github.com/lujun9972
[1]: tmp.VFVwBw56ac#gui-method-1
[2]: tmp.VFVwBw56ac#gui-method-2
[3]: tmp.VFVwBw56ac#cli-method
[4]: https://getfedora.org/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repositories.jpg?resize=800%2C400&ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/chrome-in-fedora.png?resize=800%2C400&ssl=1
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/installing-chrome-fedora.png?resize=800%2C400&ssl=1
[8]: https://www.google.com/chrome/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-1.jpeg?resize=800%2C374&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3.-download-rpm-chrome.png?resize=800%2C600&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/4.-install-chrome-fedora.png?resize=800%2C550&ssl=1
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/1.-Fedora-extra-repos.png?resize=800%2C550&ssl=1
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2.-Fedora-GPG-key.png?resize=800%2C550&ssl=1
[14]: https://itsfoss.com/install-chrome-ubuntu/
[15]: https://itsfoss.com/google-chrome-shortcuts/