Merge pull request #1 from LCTT/master

refresh #1
This commit is contained in:
0x996 2019-07-17 02:01:17 +10:00 committed by GitHub
commit f69323ad98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 2566 additions and 1253 deletions

View File

@ -1,73 +1,56 @@
使用 Ansible 管理工作站:配置桌面设置
使用 Ansible 管理你的工作站:配置桌面设置
======
> 在本系列第三篇(也是最后一篇)文章中,我们将使用 Ansible 自动化配置 GNOME 桌面设置。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ)
在本系列关于使用 Ansible 配置工作站的[第一篇文章][1]中,我们设置了一个仓库并配置了一些基本的东西。在[第二篇文章][2]中,我们配置了 Ansible 以使其在对仓库进行更改时自动应用设置。在第三篇(也是最后一篇)文章中,我们将使用 Ansible 配置 GNOME 桌面设置。
此配置只适用于较新的发行版(例如我将在示例中使用的 Ubuntu 18.04)。较旧版本的 Ubuntu 将无法运行,因为它们附带了一个老版本的 `python-psutils`,对于 Ansible 的 `dconf` 模块无法正常工作。如果你使用的是较新版本的 Linux 发行版,则应该没有问题。
在开始之前,确保你已经完成了本系列的第一部分和第二部分,因为第三部分建立在此基础之上的。如果还没有,下载前两篇文章中一直使用的 GitHub 仓库,我们将为其添加更多功能。
在开始之前,确保你已经完成了本系列的第一部分和第二部分,因为第三部分建立在此基础之上的。如果还没有,下载前两篇文章中一直使用的 GitHub [仓库][3],我们将为其添加更多功能。
### 设置壁纸和锁屏
首先,我们将创建一个任务手册来保存我们的 GNOME 设置。在仓库的根目录中,应该有一个名为 `local.yml` 的文件,添加以下行:
```
- include: tasks/gnome.yml
```
整个文件应如下所示:
```
- hosts: localhost
become: true
pre_tasks:
- name: update repositories
apt: update_cache=yes
changed_when: False
  become: true
  pre_tasks:
    - name: update repositories
      apt: update_cache=yes
      changed_when: False
  tasks:
    - include: tasks/users.yml
    - include: tasks/cron.yml
    - include: tasks/packages.yml
    - include: tasks/gnome.yml
tasks:
- include: tasks/users.yml
- include: tasks/cron.yml
- include: tasks/packages.yml
- include: tasks/gnome.yml
```
基本上,这添加了对名为 `gnome.yml` 文件的引用,它将存储在仓库内的 `tasks` 目录中。我们还没有创建这个文件,现在就来创建它。在 `tasks` 目录中创建 `gnome.yml` 文件,并将以下内容放入:
```
- name: Install python-psutil package
  apt: name=python-psutil
apt: name=python-psutil
- name: Copy wallpaper file
  copy: src=files/wallpaper.jpg dest=/home/jay/.wallpaper.jpg owner=jay group=jay mode=600
copy: src=files/wallpaper.jpg dest=/home/jay/.wallpaper.jpg owner=jay group=jay mode=600
- name: Set GNOME Wallpaper
  become_user: jay
  dconf: key="/org/gnome/desktop/background/picture-uri" value="'file:///home/jay/.wallpaper.jpg'"
become_user: jay
dconf: key="/org/gnome/desktop/background/picture-uri" value="'file:///home/jay/.wallpaper.jpg'"
```
注意,此代码多次引用我的用户名(`jay`),因此确保使用你机器上的用户名替换每次出现的 `jay`。另外,如果你没有像我一样使用 Ubuntu 18.04,你将不得不更改 `apt` 一行来匹配你所选择的发行版的包管理器,并确认 `python-psutil` 包的名称,因为它可能有所不同。
注意,此代码多次引用我的用户名(`jay`),因此确保使用你机器上的用户名替换每次出现的 `jay`。另外,如果你没有像我一样使用 Ubuntu 18.04,你将必须更改 `apt` 一行来匹配你所选择的发行版的包管理器,并确认 `python-psutil` 包的名称,因为它可能有所不同。
在示例任务中,我引用了 `file` 目录下的 `wallpaper.jpg` 文件,此文件必须存在,否则 Ansible 配置将失败。在 `tasks` 目录中,创建一个名为 `files` 的子目录。找到你喜欢的壁纸图片,将其命名为 `wallpaper.jpg`,然后把它放在 `files` 目录中。如果文件是 PNG 图像而不是 JPG在代码和仓库中更改文件扩展名。如果你觉得没有创意我在 [GitHub 仓库][3] 中有一个示例壁纸文件,你可以使用它。
@ -77,49 +60,34 @@
* 使用上面提到的内容创建 `tasks/gnome.yml`
* 在 `tasks` 目录中创建一个 `files` 目录,其中有一个名为 `wallpaper.jpg` 的图像文件(或者你选择的任何名称)。
完成这些步骤并将更改推送到仓库后,配置应该在下次计划运行期间自动应用。(你可能还记得我们在上一篇文章中对此进行了自动化。)如果你想节省时间,可以使用以下命令立即应用配置:
完成这些步骤并将更改推送到仓库后,配置应该在下次计划运行期间自动应用。(你可能还记得我们在上一篇文章中对此进行了自动化。)如果你赶时间,可以使用以下命令立即应用配置:
```
sudo ansible-pull -U https://github.com/<github_user>/ansible.git
```
如果一切正常,你应该可以看到你的新壁纸。
让我们花一点时间来了解新 GNOME 任务手册的功能。首先,我们添加了一个计划来安装 `python-psutil` 包。如果不添加它,我们就不能使用 `dconf` 模块,因为它需要在修改 GNOME 设置之前安装这个包。接下来,我们使用 `copy` 模块将壁纸文件复制到我们的 `home` 目录,并将生成的文件命名为以点开头的隐藏文件。如果你不希望此文件放在 `home` 目录的根目录中,你可以随时指示此部分将其复制到其它位置 - 只要你在正确的位置引用它,它仍然可以工作。在下一个计划中,我们使用 `dconf` 模块来更改 GNOME 设置。在这种情况下,我们调整了 `/org/gnome/desktop/background/picture-uri` 键并将其设置为 `file:///home/jay/.wallpaper.jpg`。注意本节中的引号 - 你必须在 `dconf` 值中使用两个单引号,如果值是一个字符串,还必须包含双引号。
让我们花一点时间来了解新的 GNOME 任务手册的功能。首先,我们添加了一个计划来安装 `python-psutil` 包。如果不添加它,我们就不能使用 `dconf` 模块,因为它需要在修改 GNOME 设置之前安装这个包。接下来,我们使用 `copy` 模块将壁纸文件复制到我们的 `home` 目录,并将生成的文件命名为以点开头的隐藏文件。如果你不希望此文件放在 `home` 目录的根目录中,你可以随时指示此部分将其复制到其它位置 —— 只要你在正确的位置引用它,它仍然可以工作。在下一个计划中,我们使用 `dconf` 模块来更改 GNOME 设置。在这种情况下,我们调整了 `/org/gnome/desktop/background/picture-uri` 键并将其设置为 `file:///home/jay/.wallpaper.jpg`。注意本节中的引号 —— 你必须在 `dconf` 值中使用两个单引号,如果值是一个字符串,还必须包含在双引号内。
现在,让我们进一步进行配置,并将背景应用于锁屏。这是现在的 GNOME 任务手册,但增加了两个额外的计划:
现在,让我们进一步进行配置,并将背景应用于锁屏。这是 GNOME 任务手册,但增加了两个额外的计划:
```
- name: Install python-psutil package
  apt: name=python-psutil
apt: name=python-psutil
- name: Copy wallpaper file
  copy: src=files/wallpaper.jpg dest=/home/jay/.wallpaper.jpg owner=jay group=jay mode=600
copy: src=files/wallpaper.jpg dest=/home/jay/.wallpaper.jpg owner=jay group=jay mode=600
- name: Set GNOME wallpaper
  dconf: key="/org/gnome/desktop/background/picture-uri" value="'file:///home/jay/.wallpaper.jpg'"
dconf: key="/org/gnome/desktop/background/picture-uri" value="'file:///home/jay/.wallpaper.jpg'"
- name: Copy lockscreenfile
  copy: src=files/lockscreen.jpg dest=/home/jay/.lockscreen.jpg owner=jay group=jay mode=600
copy: src=files/lockscreen.jpg dest=/home/jay/.lockscreen.jpg owner=jay group=jay mode=600
- name: Set lock screen background
  become_user: jay
  dconf: key="/org/gnome/desktop/screensaver/picture-uri" value="'file:///home/jay/.lockscreen.jpg'"
become_user: jay
dconf: key="/org/gnome/desktop/screensaver/picture-uri" value="'file:///home/jay/.lockscreen.jpg'"
```
正如你所看到的,我们做的事情和设置壁纸时差不多。我们添加了两个额外的任务,一个是复制锁屏图像并将其放在我们的 `home` 目录中,另一个是将设置应用于 GNOME 以便使用它。同样,确保将 `jay` 更改为你的用户名,并命名你想要的锁屏图片 `lockscreen.jpg`,并将其复制到 `files` 目录。将这些更改提交到仓库后,在下一次计划的 Ansible 运行期间就会应用新的锁屏。
@ -127,52 +95,49 @@ sudo ansible-pull -U https://github.com/<github_user>/ansible.git
### 应用新的桌面主题
设置壁纸和锁屏背景很酷,但是让我们更进一步来应用桌面主题。首先,让我们在我们的任务手册中添加一条指令来安装 `arc` 主题的包。将以下代码添加到 GNOME 任务手册的开头:
```
- name: Install arc theme
  apt: name=arc-theme
```
然后,在底部,添加以下任务:
然后,在底部,添加以下动作:
```
- name: Set GTK theme
  become_user: jay
  dconf: key="/org/gnome/desktop/interface/gtk-theme" value="'Arc'"
```
你看到 GNOME 的 GTK 主题在你眼前变化了吗?我们添加了一个任务来通过 `apt` 模块安装 `arc-theme` 包,另一个任务将这个主题应用到 GNOME。
你看到 GNOME 的 GTK 主题在你眼前变化了吗?我们添加了一个动作来通过 `apt` 模块安装 `arc-theme` 包,另一个动作将这个主题应用到 GNOME。
### 进行其它定制
既然你已经更改了一些 GNOME 设置,你可以随意添加其它定制。你在 GNOME 中调整的任何设置都可以通过这种方式自动完成,设置壁纸和主题只是几个例子。你可能想知道如何找到要更改的设置,以下一个适合我的技巧。
既然你已经更改了一些 GNOME 设置,你可以随意添加其它定制。你在 GNOME 中调整的任何设置都可以通过这种方式自动完成,设置壁纸和主题只是几个例子。你可能想知道如何找到要更改的设置,以下一个我的技巧。
首先,通过在你管理的计算机上运行以下命令,获取所有当前 `dconf` 设置的快照:
```
dconf dump / > before.txt
```
此命令将所有当前更改导出到名为 `before.txt` 的文件中。接下来,手动更改要自动化的设置,并再次获取 `dconf` 设置:
```
dconf dump / > after.txt
```
现在,你可以使用 `diff` 命令查看两个文件之间的不同之处:
```
diff before.txt after.txt
```
这应该会给你一个已更改键的列表。虽然手动更改设置确实违背了自动化的目的,但你实际上正在做的是获取更新首选设置时更改的键,这允许你创建 Ansible 任务以修改这些设置这样你就再也不需要碰这些设置了。如果你需要还原机器Ansible 仓库将负责你的每个定制。如果你有多台计算机,甚至是一组工作站,则只需手动进行一次更改,所有其他工作站都将应用新设置并完全同步。
这应该会给你一个已更改键的列表。虽然手动更改设置确实违背了自动化的目的,但你实际上正在做的是获取更新首选设置时更改的键,这允许你创建 Ansible 任务以修改这些设置这样你就再也不需要碰这些设置了。如果你需要还原机器Ansible 仓库会处理好你的每个定制。如果你有多台计算机,甚至是一组工作站,则只需手动进行一次更改,所有其他工作站都将应用新设置并完全同步。
### 最后
如果你已经阅读完本系列文章,你应该知道如何设置 Ansible 来自动化工作站。这些示例提供了一个有用的基线,你可以使用语法和示例进行其他定制。随着你的前进,你可以继续添加新的修改,这将使你的 Ansible 配置一直增长。
如果你已经阅读完本系列文章,你应该知道如何设置 Ansible 来自动化工作站。这些示例提供了一个有用的基础,你可以使用这些语法和示例进行其他定制。随着你的进展,你可以继续添加新的修改,这将使你的 Ansible 配置一直增长。
我已经用 Ansible 以这种方式自动化了一切包括我的用户帐户和密码、Vim、tmux 等配置文件、桌面包、SSH 设置、SSH 密钥,基本上我想要自定义的一切都使用了。以本系列文章作为起点,将为你实现工作站的完全自动化铺平道路。
@ -183,11 +148,11 @@ via: https://opensource.com/article/18/5/manage-your-workstation-ansible-part-3
作者:[Jay LaCroix][a]
选题:[lujun9972](https://github.com/lujun9972 )
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/jlacroix
[1]:https://opensource.com/article/18/3/manage-workstation-ansible
[2]:https://opensource.com/article/18/3/manage-your-workstation-configuration-ansible-part-2
[1]:https://linux.cn/article-10434-1.html
[2]:https://linux.cn/article-10449-1.html
[3]:https://github.com/jlacroix82/ansible_article.git

View File

@ -0,0 +1,97 @@
[#]: collector: (lujun9972)
[#]: translator: (GraveAccent)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11098-1.html)
[#]: subject: (5G will augment Wi-Fi, not replace it)
[#]: via: (https://www.networkworld.com/article/3399978/5g-will-augment-wi-fi-not-replace-it.html)
[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/)
5G 会增强 Wi-Fi而不是取代它
======
> Aruba 战略和企业发展副总裁 Jeff Lipton 为 5G 炒作增添了一些干货,讨论了它和 Wi-Fi 如何协同工作以及如何最大化两者的价值。
![Thinkstock][1]
如今可以说没有技术主题比 [5G][2] 更热。这是最近 [移动世界大会][3] 节目的一个主题,并且已经在其他活动中占据了主导地位,例如 Enterprise Connect 和我参加的几乎所有供应商活动。
一些供应商将 5G 定位为解决所有网络问题的灵丹妙药,并预测它将消除所有其他形式的网络。像这样的观点显然是极端的,但我相信 5G 会对网络行业产生影响,网络工程师应该意识到这一点。
为了帮助为 5G 炒作带来一些现实感,我最近采访了一家惠普公司旗下的 Aruba 公司的战略和企业发展副总裁 Jeff Lipton因为我知道惠普已经深入参与了 5G 和 Wi-Fi 的发展。
![Jeff Lipton, VP of strategy and corporate development, Aruba][4]
### Zeus Kerravala: 5G 被吹捧为“明日之星”。你是这样看的吗?
**Jeff Lipton** 接下来的重点是连接“事物”并从这些事物中产生可操作的见解和背景。5G 是服务于这一趋势的技术之一。Wi-Fi 6 是另一个还有边缘计算、蓝牙低功耗BLE、人工智能AI和机器学习ML。这一切都很重要全都有自己的用武之地。
### 你是否在企业中看到 5G 的风头盖过 Wi-Fi
**Lipton** 与所有蜂窝接入一样,如果你需要<ruby>宏观区域覆盖<rt>macro area coverage</rt></ruby>和高速切换,使用 5G 是合适的。但对于大多数企业级应用程序而言,它通常不需要这些功能。从性能角度来看,[Wi-Fi 6][5] 和 5G 在大多数指标上大致相等包括吞吐量、延迟、可靠性和连接密度。它们并不相似的地方在经济方面Wi-Fi 要好得多。我不认为很多客户愿意用 Wi-Fi 交换 5G除非他们需要宏观覆盖或高速切换。
### Wi-Fi 和 5G 可以共存吗? 企业如何一起使用 5G 和 Wi-Fi
**Lipton** Wi-Fi 和 5G 可以共存并且应该是互补的。5G 架构将蜂窝核心和无线接入网络RAN分离。因此Wi-Fi 可以是企业无线电前端,并与 5G 核心紧密连接。由于 Wi-Fi特别是 Wi-Fi 6的经济有利并且性能非常好我们设想许多服务提供商会使用 Wi-Fi 作为其 5G 系统的无线电前端充当其分布式天线DAS和小型蜂窝系统的替代方案。
> “Wi-Fi 和 5G 可以并且应该是互补的。” — Jeff Lipton
### 如果一个企业打算完全转向 5G那将如何实现以及它的实用性如何
**Lipton** 为了将 5G 用于主要的室内访问方式客户需要升级其网络和几乎所有设备。5G 在室外提供良好的覆盖但蜂窝信号不能可靠地穿透建筑物5G 会使这个问题变得更糟,因为它部分依赖于更高频率的无线电。因此,服务提供商需要一种提供室内覆盖的方法。为了提供这种覆盖,他们会部署 DAS 或小型蜂窝系统 —— 由终端客户支付费用。然后,客户将他们的设备直连到这些蜂窝系统,并为每个设备支付服务合同。
这种方法存在一些问题。首先DAS 和小型蜂窝系统比 Wi-Fi 网络贵得多。并且成本不会仅限于网络。每台设备都需要一台 5G 蜂窝调制解调器,批量价格高达数十美元,而终端用户通常需要花费一百多美元。由于目前很少或者没有 MacBook、PC、打印机、AppleTV 有 5G 调制解调器,因此需要对这些设备进行升级。我不相信很多企业会愿意支付这笔额外费用并升级他们的大部分设备以获得尚不明确的好处。
### 经济性是 5G 与 Wi-Fi 之争的一个要素吗?
**Lipton** 经济性始终是一个要素。让我们将对话集中在室内企业级应用程序上,因为这是一些运营商打算用 5G 定位的用例。我们已经提到升级到 5G 将要求企业部署昂贵的 DAS 或小型蜂窝系统用于室内覆盖,几乎将所有设备升级到包含 5G 调制解调器,并为每个设备支付服务合同。理解 5G 蜂窝网络和 DAS 系统在许可频谱上运行也很重要这类似于一条私人高速公路。服务提供商为此频谱支付了数十亿美元这笔费用需要货币化并嵌入服务成本中。因此从部署和生命周期的角度来看Wi-Fi 在经济上比 5G 有利。
### 5G 与 Wi-Fi 相比有任何安全隐患吗?
**Lipton** 一些人认为蜂窝技术比 Wi-Fi 更安全但事实并非如此。LTE 相对安全但也有弱点。例如普渡大学和爱荷华大学的研究人员表示LTE 容易受到一系列攻击包括数据拦截和设备跟踪。5G 通过多种认证方法和更好的密钥管理改进了 LTE 安全性。
Wi-Fi 的安全性也没有停滞不前而是在继续发展。当然,不遵循最佳实践的 Wi-Fi 实现,例如那些甚至没有基本密码保护的实现,并不是最佳的。但那些配置了适当的访问控制和密码的则是非常安全的。随着新标准 —— 特别是 WPA3 和<ruby>增强开放<rt>Enhanced Open</rt></ruby> —— Wi-Fi 网络安全性进一步提高。
同样重要的是要记住,企业已根据其特定需求对安全性和合规性解决方案进行了大量投资。对于包括 5G 在内的蜂窝网络,企业将失去部署所选安全性和合规性解决方案的能力,以及对流量流的大多数可见性。虽然 5G 的未来版本将通过称为网络切片的功能提供高级别的自定义,但企业仍将失去他们目前需要的和拥有的安全性和合规性定制级别。
### 关于 5G 与 Wi-Fi 之间的讨论的补充想法
**Lipton** 围绕 Wi-Fi 与 5G 的争论忽略了这一点。它们都有自己的用武之地而且它们在很多方面都是互补的。由于需要连接和分析越来越多的东西Wi-Fi 和 5G 市场都将增长。如果客户需要宏观覆盖或高速切换,并且可以为这些功能支付额外成本,那么 5G 是可行的。
5G 也适用于客户需要物理网络分段的某些工业用例。但对于绝大多数企业客户而言Wi-Fi 将继续像现在一样证明自己作为可靠、安全且经济高效的无线接入技术的价值。
**更多关于 802.11ax (Wi-Fi 6):**
* [为什么 802.11ax 是无线网络的下一件大事][7]
* [FAQ802.11ax Wi-Fi][8]
* [Wi-Fi 6 (802.11ax) 正在来到你附近的路由器][9]
* [带有 OFDMA 的 Wi-Fi 6 打开了一个全新的无线可能性世界][10]
* [802.11ax 预览:支持 Wi-Fi 6 的接入点和路由器随时可用][11]
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3399978/5g-will-augment-wi-fi-not-replace-it.html
作者:[Zeus Kerravala][a]
选题:[lujun9972][b]
译者:[GraveAccent](https://github.com/graveaccent)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Zeus-Kerravala/
[b]: https://github.com/lujun9972
[1]: https://images.idgesg.net/images/article/2019/05/wireless_connection_speed_connectivity_bars_cell_tower_5g_by_thinkstock-100796921-large.jpg
[2]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html
[3]: https://www.networkworld.com/article/3354477/mobile-world-congress-the-time-of-5g-is-almost-here.html
[4]: https://images.idgesg.net/images/article/2019/06/headshot_jlipton_aruba-100798360-small.jpg
[5]: https://www.networkworld.com/article/3215907/why-80211ax-is-the-next-big-thing-in-wi-fi.html
[6]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture
[7]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html
[8]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html
[9]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html
[10]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html
[11]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html
[12]: https://www.facebook.com/NetworkWorld/
[13]: https://www.linkedin.com/company/network-world

View File

@ -0,0 +1,214 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11101-1.html)
[#]: subject: (4 tools to help you drive Kubernetes)
[#]: via: (https://opensource.com/article/19/6/tools-drive-kubernetes)
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux/users/fatherlinux/users/fatherlinux/users/fatherlinux)
帮助你驾驭 Kubernetes 的 4 个工具
======
> 学习如何驾驭 Kubernetes 比如何建造它更重要,这些工具可以帮助你更快上路。
![Tools in a workshop][1]
在本系列的第三篇文章中,[Kubernetes 基础:首先学习如何使用][2],我强调你应该学会使用 Kubernetes而不是建造它。我还解释说在 Kubernetes 中,你必须学习最小的一组原语来建模应用程序。我想强调这一点:你需要学习的这组原语是最简单的原语集,你可以通过它们学习如何实现生产级的应用程序部署(即高可用性 [HA]、多容器、多应用程序)。换句话说,学习 Kubernetes 内置的原语集比学习集群软件、集群文件系统、负载平衡器、让人发疯的 Apache 和 Nginx 的配置、路由器、交换机、防火墙和存储后端更容易 —— 这些是你在传统的 IT 环境(虚拟机或裸机)中建模简单的 HA 应用程序所需要的东西。
在这第四篇文章中,我将分享一些有助于你学习快速驾驭 Kubernetes 的工具。
### 1、Katacoda
无疑,[Katacoda][3] 是试驾 Kubernetes 集群的最简单方法。只需单击一下,五秒钟后就可以将基于 Web 的终端直接连接到正在运行的 Kubernetes 集群中。这对于使用和学习来说非常棒。我甚至将它用于演示和测试新想法。Katacoda 提供了一个完整的临时环境,在你使用完毕后可以回收利用。
![OpenShift Playground][4]
*[OpenShift Playground][5]*
![Kubernetes Playground][6]
*[Kubernetes Playground][7]*
Katacoda 提供了一个临时的环境和更深入的实验室环境。例如,我最近三四年主讲的 [Linux Container Internals Lab][3] 是在 Katacoda 中构建的。
Katacoda 在其主站点上维护了若干 [Kubernetes 和云教程][8]并与 Red Hat 合作以支持了一个 [OpenShift 的专用学习门户][9]。了解一下,它们是极好的学习资源。
当你第一次学习驾驶翻斗车时,最好先观察一下其他人的驾驶方式。
### 2、Podman generate kube
`podman generate kube` 命令是一个很棒的子命令,可以帮助用户自然地从运行简单容器的简单容器引擎转换到运行许多容器的集群用例(正如我在[上篇文章][2]中所描述的那样)。[Podman][10] 通过让你启动一个新的容器,然后导出这个可工作的 Kube YAML并在 Kubernetes 中启动它来实现这一点。看看这个(你可以在 [Katacoda lab][3] 中运行它,它已经有了 Podman 和 OpenShift
首先,请注意运行容器的语法与 Docker 非常相似:
```
podman run -dtn two-pizza quay.io/fatherlinux/two-pizza
```
不过这个是其它容器引擎所没有的:
```
podman generate kube two-pizza
```
输出:
```
# Generation of Kubernetes YAML is still under development!
#
# Save the output of this file and use kubectl create -f to import
# it into Kubernetes.
#
# Created with podman-1.3.1
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2019-06-07T08:08:12Z"
labels:
app: two-pizza
name: two-pizza
spec:
containers:
- command:
- /bin/sh
- -c
- bash -c 'while true; do /usr/bin/nc -l -p 3306 < /srv/hello.txt; done'
env:
- name: PATH
value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: TERM
value: xterm
- name: HOSTNAME
- name: container
value: oci
image: quay.io/fatherlinux/two-pizza:latest
name: two-pizza
resources: {}
securityContext:
allowPrivilegeEscalation: true
capabilities: {}
privileged: false
readOnlyRootFilesystem: false
tty: true
workingDir: /
status: {}
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-06-07T08:08:12Z"
labels:
app: two-pizza
name: two-pizza
spec:
selector:
app: two-pizza
type: NodePort
status:
loadBalancer: {}
```
你现在有了一些可以的工作 Kubernetes YAML你可以用它作为练习的起点来学习、调整等等。`-s` 标志可以为你创造一项服务。[Brent Baude][11] 甚至致力于[添加卷/持久卷断言][12]等新功能。如果想进一步深入,请在 Brent 的博客文章《[Podman 现在可以轻松过渡到 Kubernetes 和 CRI-O][13]》中了解他的工作。
### 3、oc new-app
`oc new-app` 命令非常强大。它是特定于 OpenShift 的,所以它在默认的 Kubernetes 中不可用,但是当你开始学习 Kubernetes 时它非常有用。让我们从快速命令开始创建一个相当复杂的应用程序:
```
oc new-project -n example
oc new-app -f https://raw.githubusercontent.com/openshift/origin/master/examples/quickstarts/cakephp-mysql.json
```
使用 `oc new-app`,你可以从 OpenShift 开发人员那里偷取模板,并在开发原语来描述你自己的应用程序时拥有一个已知良好的起点。运行上述命令后,你的 Kubernetes 命名空间(在 OpenShift 中)将由若干新的已定义资源填充。
```
oc get all
```
输出:
```
NAME READY STATUS RESTARTS AGE
pod/cakephp-mysql-example-1-build 0/1 Completed 0 4m
pod/cakephp-mysql-example-1-gz65l 1/1 Running 0 1m
pod/mysql-1-nkhqn 1/1 Running 0 4m
NAME DESIRED CURRENT READY AGE
replicationcontroller/cakephp-mysql-example-1 1 1 1 1m
replicationcontroller/mysql-1 1 1 1 4m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/cakephp-mysql-example ClusterIP 172.30.234.135 <none> 8080/TCP 4m
service/mysql ClusterIP 172.30.13.195 <none> 3306/TCP 4m
NAME REVISION DESIRED CURRENT TRIGGERED BY
deploymentconfig.apps.openshift.io/cakephp-mysql-example 1 1 1 config,image(cakephp-mysql-example:latest)
deploymentconfig.apps.openshift.io/mysql 1 1 1 config,image(mysql:5.7)
NAME TYPE FROM LATEST
buildconfig.build.openshift.io/cakephp-mysql-example Source Git 1
NAME TYPE FROM STATUS STARTED DURATION
build.build.openshift.io/cakephp-mysql-example-1 Source Git@47a951e Complete 4 minutes ago 2m27s
NAME DOCKER REPO TAGS UPDATED
imagestream.image.openshift.io/cakephp-mysql-example docker-registry.default.svc:5000/example/cakephp-mysql-example latest About aminute ago
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
route.route.openshift.io/cakephp-mysql-example cakephp-mysql-example-example.2886795271-80-rhsummit1.environments.katacoda.com cakephp-mysql-example <all> None
```
这样做的好处是你可以删除 Pod观察复制控制器如何重新创建它们缩放 Pod 等等。你可以使用模板并将其更改为其他应用程序(这是我第一次启动时所做的)。
### 4、Visual Studio Code
我把我最喜欢的放在最后。我的大部分工作都使用 [vi][14],但我从来没有为 Kubernetes 找到一个好的语法高亮器和代码补完插件(如果有的话,请告诉我)。相反,我发现微软的 [VS Code][15] 有一套杀手级的插件,可以完成 Kubernetes 资源的创建并提供样板。
![VS Code plugins UI][16]
首先,安装上图中显示的 Kubernetes 和 YAML 插件。
![Autocomplete in VS Code][17]
然后,你可以从头开始创建新的 YAML 文件,并自动补完 Kubernetes 资源。上面的示例显示了一个服务。
![VS Code autocomplete filling in boilerplate for an object][18]
当你使用自动补完并选择服务资源时,它会填充该对象的一些模板。当你第一次学习使用 Kubernetes 时,这非常棒。你可以构建 Pod、服务、复制控制器、部署等。当你从头开始构建这些文件甚至修改你使用 `podman generate kube` 创建的文件时,这是一个非常好的功能。
### 总结
这四个工具(如果算上两个插件,则为六个)将帮助你学习驾驭 Kubernetes而不是构造或装备它。在本系列的最后一篇文章中我将讨论为什么 Kubernetes 如此适合运行这么多不同的工作负载。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/6/tools-drive-kubernetes
作者:[Scott McCarty][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/fatherlinux/users/fatherlinux/users/fatherlinux/users/fatherlinux
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_workshop_blue_mechanic.jpg?itok=4YXkCU-J (Tools in a workshop)
[2]: https://linux.cn/article-11036-1.html
[3]: https://learn.openshift.com/subsystems/container-internals-lab-2-0-part-1
[4]: https://opensource.com/sites/default/files/uploads/openshift-playground.png (OpenShift Playground)
[5]: https://learn.openshift.com/playgrounds/openshift311/
[6]: https://opensource.com/sites/default/files/uploads/kubernetes-playground.png (Kubernetes Playground)
[7]: https://katacoda.com/courses/kubernetes/playground
[8]: https://katacoda.com/learn
[9]: http://learn.openshift.com/
[10]: https://podman.io/
[11]: https://developers.redhat.com/blog/author/bbaude/
[12]: https://github.com/containers/libpod/issues/2303
[13]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/
[14]: https://en.wikipedia.org/wiki/Vi
[15]: https://code.visualstudio.com/
[16]: https://opensource.com/sites/default/files/uploads/vscode_-_kubernetes_red_hat_-_plugins.png (VS Code plugins UI)
[17]: https://opensource.com/sites/default/files/uploads/vscode_-_kubernetes_service_-_autocomplete.png (Autocomplete in VS Code)
[18]: https://opensource.com/sites/default/files/uploads/vscode_-_kubernetes_service_-_boiler_plate.png (VS Code autocomplete filling in boilerplate for an object)

View File

@ -1,16 +1,18 @@
[#]: collector: (lujun9972)
[#]: translator: (chen-ni)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11106-1.html)
[#]: subject: (The innovation delusion)
[#]: via: (https://opensource.com/open-organization/19/6/innovation-delusion)
[#]: author: (Jim Whitehurst https://opensource.com/users/jwhitehurst/users/jwhitehurst/users/n8chz/users/dhdeans)
创新的幻觉
======
创新是一种混乱的过程,但是关于创新的故事却很有条理。我们不应该把两者搞混了。
![gears and lightbulb to represent innovation][1]
> 创新是一种混乱的过程,但是关于创新的故事却很有条理。我们不应该把两者搞混了。
![](https://img.linux.net.cn/data/attachment/album/201907/16/120302zlyzlzl2d2vh1eyd.jpg)
如果说 [传统的规划方法已经消亡了][2],为什么这么多机构还在孜孜不倦地运用那些针对工业革命所设计的规划方法呢?
@ -44,11 +46,11 @@
### 开放(并且混乱的)创新
机构(特别是领导们)喜欢把成功说成是一件计划之内的事情 - 好像成功人士可以驾驭混乱,并且几乎可以预测未来。但是这些言论都是事后诸葛亮罢了,他们在讲述自己充满偶然性的经历的时候会刻意将无序的事情整理一番,对于毫无确定性的事情也会说“我们就是想要那么做的”。
机构(特别是领导们)喜欢把成功说成是一件计划之内的事情 —— 好像成功人士可以驾驭混乱,并且几乎可以预测未来。但是这些言论都是事后诸葛亮罢了,他们在讲述自己充满偶然性的经历的时候会刻意将无序的事情整理一番,对于毫无确定性的事情也会说“我们就是想要那么做的”。
但是正如我前面说的,我们不应该相信这些故事是创新过程的真实还原,也不应该在这种错误的假设的基础之上去构建未来的方案或者实验。
试想有另一家摩托车制造商想要复制本田公司在超级幼兽上的成功,就逐字逐句地照搬波士顿咨询总结的故事。由于本田公司成功的 **故事** 听上去是如此有逻辑,并且是线性的,这家新公司也许会假定他们可以通过类似的程序得到同样的结果:制定目标、谋划行动,然后针对可预期的结果进行执行。但是我们知道本田公司并不是真的靠这种“制定、谋划、执行”的方式赢得他们的市场份额的。他们是通过灵活性和一点运气获得成功的 - 更像是“尝试、学习、修改”。
试想有另一家摩托车制造商想要复制本田公司在超级幼兽上的成功,就逐字逐句地照搬波士顿咨询总结的故事。由于本田公司成功的 **故事** 听上去是如此有逻辑,并且是线性的,这家新公司也许会假定他们可以通过类似的程序得到同样的结果:制定目标、谋划行动,然后针对可预期的结果进行执行。但是我们知道本田公司并不是真的靠这种“制定、谋划、执行”的方式赢得他们的市场份额的。他们是通过灵活性和一点运气获得成功的 —— 更像是“尝试、学习、修改”。
当我们可以真正理解并且接受“创新过程是混乱的”这个事实的时候,我们就可以换种方式思考如何让我们的机构实现创新了。与其将资源浪费在预先制定的计划上,**强迫** 创新以一种线性时间线的方式发生,我们不如去构建一些开放并且敏捷的机构,可以 **在创新发生的时候做出及时的响应**
@ -69,7 +71,7 @@ via: https://opensource.com/open-organization/19/6/innovation-delusion
作者:[Jim Whitehurst][a]
选题:[lujun9972][b]
译者:[chen-ni](https://github.com/chen-ni)
校对:[校对者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,57 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11097-1.html)
[#]: subject: (From BASIC to Ruby: Life lessons from first programming languages on Command Line Heroes)
[#]: via: (https://opensource.com/19/7/command-line-heroes-ruby-basic)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
从 BASIC 到 Ruby入门编程语言的体悟
======
> 为什么 BASIC 是一种备受喜爱的入门语言?下一代该如何学习编程?
![Listen to the Command Line Heroes Podcast][1]
《[Command Line Heroes][2]》 第三季的第二集今天抵达了,它对我的入门编程的怀旧让我回到了过去。
LCTT 译注《Command Line Heroes》 是红帽公司制作的播客,讲述了开发人员、程序员、黑客、极客和开源反叛者如何彻底改变技术前景的真实史诗。其第一季制作于 2017 年邀请到了谷歌、NASA 等重量级企业的技术专家担当嘉宾讲述操作系统战争风云、美国航天局如何开源等等涉及开源、操作系统、容器、DevOps、云计算等话题。
### 语言会影响可访问性
这一集告诉我BASIC 是计算机的理解力民主化的一次巨大飞跃。我很难想象,在一个不太遥远的、计算机尚且是稀罕之物的时代,是 BASIC 改变了世界。正如 [Saron Yitbarek][3] 提到的那样“在早些年编程你几乎得有个博士学位才行。”BASIC 是一个巨大的飞跃,它专注于可用性(适合初学者的命令)和资源共享(单个计算机的分时操作)。它使得编程不在局限于当时的“计算机玩家”(我喜欢这集中的这句话),并帮助了新一代人参与了进来。进入编程领域的壁垒得以下降。
### 入门编程语言
这一集的核心话题是围绕学习入门语言展开的。关于学习什么编程语言以及如何学习,有很多建议。关于这个问题[在这里][4]已经写了很多。我喜欢听到 Saron 以 Ruby 作为她的介绍的故事,以及它以一种几乎意想不到的方式变得有趣。我有一些类似的经历,因为我在一些项目中用到了 Ruby。它的灵活性让我感到开心。当我对编程感到紧张时正是这种快乐让我重新回到它的身边并且它有一些能够使语言如此充满情感的强大功能。
我第一次体验编程是用 HTML 和 CSS但我第一个重型编程语言是 Java。我永远不会忘记在课堂的第一天被告知要记住 `public static void main`,但没有告知我关于它意味着什么的任何信息。我们花了很多时间在面向对象编程的上下文环境中探讨它是什么,但它从未像我在 Ruby 中使用 `.each` 迭代列表,或者像在 Python 中用 `import numpy` 做一些数学魔术那样感到兴奋。然后我听说孩子们正在学习如何使用 Python 编写 [Minecraft][5] 或使用像 [Scratch][6] 这样的可视化编程语言我因此而悟BASIC 的遗产正在以新的方式存在。
我从这一集中获取到的内容:
* 请记住,没有人出生就是程序员。每个人都没有这样的背景。你并不孤单。
* 学习一门语言。任何一种都行。如果你有选择的可能,那么请选择能带给你最大乐趣的那个。
* 不要忘记所有语言都可以构建一些东西。请为人类创造有意义的事物。
《Command Line Heroes》整个第三季将涉及编程语言。[请在此处订阅来学习你想要了解的有关编程语言的起源][2],我很乐意在下面的评论中听到你的想法。
--------------------------------------------------------------------------------
via: https://opensource.com/19/7/command-line-heroes-ruby-basic
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ep1_blog-header-520x292_lgr.png?itok=I8IS1hkt (Listen to the Command Line Heroes Podcast)
[2]: https://www.redhat.com/en/command-line-heroes
[3]: https://twitter.com/saronyitbarek
[4]: https://linux.cn/article-8379-1.html
[5]: https://opensource.com/life/15/5/getting-started-minecraft-pi
[6]: https://opensource.com/education/11/6/how-teach-next-generation-open-source-scratch

View File

@ -0,0 +1,180 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11104-1.html)
[#]: subject: (Pipx Install And Run Python Applications In Isolated Environments)
[#]: via: (https://www.ostechnix.com/pipx-install-and-run-python-applications-in-isolated-environments/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Pipx在隔离环境中安装和运行 Python 应用
======
![][1]
我们始终建议在虚拟环境中安装 Python 应用以避免彼此冲突。Pip 包管理器可以帮助我们在隔离的环境中安装 Python 应用,我们使用两个工具,即 `venv``virtualenv`。还有一个 Python.org 推荐的名为 [Pipenv][2] 的 Python 包管理器也可以用来安装 Python 应用。与 Pip 不同Pipenv 默认会自动创建虚拟环境。这意味着你不再需要为项目手动创建虚拟环境。今天,我偶然发现了一个名为 “Pipx” 的类似工具,它是一个自由开源程序,允许你在隔离的虚拟环境中安装和运行 Python 应用。
使用 Pipx我们可以轻松安装 PyPI 中托管的数千个 Python 应用,而不会有太多麻烦。好的是,你可以使用常规用户权限执行所有操作。你不需要成为 “root” 用户或不需要具有 “sudo” 权限。值得一提的是Pipx 可以从临时环境运行程序,而无需安装它。当你经常测试同一程序的多个版本时,这将非常方便。随 Pipx 一起安装的软件包可以随时列出、升级或卸载。Pipx 是一个跨平台的程序,因此它可以在 Linux、Mac OS 和 Windows 上运行。
### 安装 Pipx
Python 3.6+ 、Pip 和 `venv` 模块是安装 `pipx` 所必需的。确保按照以下指南中的说明安装它们。
* [如何使用 Pip 管理 Python 包][3]
此处,需要 `venv` 来创建虚拟环境。
接下来,运行以下命令安装 Pipx。
```
$ python3 -m pip install --user pipx
$ python3 -m userpath append ~/.local/bin
```
`pipx` 二进制文件的默认位置是 `~/.local/bin`。你可以使用 `PIPX_BIN_DIR` 环境变量覆盖它。如果要覆盖 `PIPX_BIN_DIR`,只需运行 `userpath append $PIPX_BIN_DIR`,确保它在你的路径中。
Pipx 的默认虚拟环境位置是 `~/.local/pipx`。这可以用环境变量 `PIPX_HOME` 覆盖。
让我们继续看看如何使用 Pipx 安装 Python 应用。
### 使用 Pipx 在隔离环境中安装和运行 Python 应用
以下是 Pipx 入门的几个例子
#### 安装 Python 包
要全局安装 Python 应用,例如 cowsay请运行
```
$ pipx install cowsay
```
此命令将自动创建虚拟环境,在其中安装包并包的可执行文件放在 `$PATH` 中。
示例输出:
```
installed package cowsay 2.0.3, Python 3.6.8
These binaries are now globally available
- cowsay
done! ✨ 🌟 ✨
```
![1][4]
*使用 Pipx 安装 Python 应用*
让我们测试新安装的 cowsay 程序:
![1][5]
在这里,我从官方网站上摘取了这些例子。你可以安装/测试任何其他的 Python 包。
#### 列出 Python 包
要使用 Pipx 列出所有已安装的应用,请运行:
```
$ pipx list
```
示例输出:
```
venvs are in /home/sk/.local/pipx/venvs
binaries are exposed on your $PATH at /home/sk/.local/bin
package cowsay 2.0.3, Python 3.6.8
- cowsay
```
如果你尚未安装任何软件包,你将看到以下输出:
```
nothing has been installed with pipx 😴
```
#### 升级包
要升级包,只需执行以下操作:
```
$ pipx upgrade cowsay
```
要一次性升级所有已安装的软件包,请使用:
```
$ pipx upgrade-all
```
#### 从临时虚拟环境运行应用
有时,你可能希望运行特定的 Python 程序,但并不实际安装它。
```
$ pipx run pycowsay moooo
```
![1][6]
*在临时隔离虚拟环境中运行 Python 应用*
此命令实际上并不安装指定程序,而是从临时虚拟环境运行它。你可以使用此命令快速测试 Python 应用。
你甚至可以直接运行 .py 文件。
```
$ pipx run https://gist.githubusercontent.com/cs01/fa721a17a326e551ede048c5088f9e0f/raw/6bdfbb6e9c1132b1c38fdd2f195d4a24c540c324/pipx-demo.py
pipx is working!
```
#### 卸载软件包
可以使用以下命令卸载软件包:
```
$ pipx uninstall cowsay
```
要删除所有已安装的包:
```
$ pipx uninstall-all
```
#### 获得帮助
要查看帮助部分,请运行:
```
$ pipx --help
```
就是这些了。如果你一直在寻找安全,方便和可靠的程序来安装和运行 Python 应用Pipx 可能是一个不错的选择。
资源:
* [Pipx 的 GitHub 仓库][7]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/pipx-install-and-run-python-applications-in-isolated-environments/
作者:[sk][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/pipx-720x340.png
[2]: https://www.ostechnix.com/pipenv-officially-recommended-python-packaging-tool/
[3]: https://www.ostechnix.com/manage-python-packages-using-pip/
[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/Install-Python-Applications-Using-Pipx.png
[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/Test-Python-application.png
[6]: https://www.ostechnix.com/wp-content/uploads/2019/07/Run-Python-Applications-In-Isolated-Environments.png
[7]: https://github.com/pipxproject/pipx

View File

@ -1,23 +1,23 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11099-1.html)
[#]: subject: (How To Find Virtualbox Version From Commandline In Linux)
[#]: via: (https://www.ostechnix.com/how-to-find-virtualbox-version-from-commandline-in-linux/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
在 Linux 中如何从命令行查找 Virtualbox 版本
在 Linux 中如何从命令行查找 VirtualBox 版本
======
![FInd Virtualbox version from commandline In Linux][1]
我使用 **Oracle VirtualBox** 和 [**KVM**][2] 虚拟化程序[**测试不同的 Linux 操作系统**][3]。虽然我偶尔使用 KVM但 Virtualbox 始终是我的首选。不是因为我不喜欢 KVM而是因为我只是习惯了 Virtualbox。当在我的 Ubuntu 无头服务器上使用 [**Virtualbox**][4] 时,我需要知道 Virtualbox 的版本。如果它有 GUI我可以进入**Virtualbox - > About -> Help** 轻松找到它。但我的是没有 GUI 的 Ubuntu 服务器。如果你想知道如何在 Linux 中从命令行查找 Virtualbox 版本,可以采用以下几种方法。
我使用 Oracle VirtualBox 和 [KVM][2] 虚拟化程序[测试不同的 Linux 操作系统][3]。虽然我偶尔使用 KVM但 Virtualbox 始终是我的首选。不是因为我不喜欢 KVM而是因为我只是习惯了 VirtualBox。当在我的 Ubuntu 无头服务器上使用 [Virtualbox][4] 时,我需要知道 VirtualBox 的版本。如果它有 GUI我可以进入 Virtualbox -> About -> Help 轻松找到它。但我的是没有 GUI 的 Ubuntu 服务器。如果你想知道如何在 Linux 中从命令行查找 VirtualBox 版本,可以采用以下几种方法。
### 在 Linux 中从命令行查找 Virtualbox 版本
### 在 Linux 中从命令行查找 VirtualBox 版本
要查找已安装的 Virtualbox 的版本,请打开终端并运行以下命令:
要查找已安装的 VirtualBox 的版本,请打开终端并运行以下命令:
```
$ vboxmanage --version
@ -31,11 +31,11 @@ $ vboxmanage --version
![][5]
在 Linux 中从命令行查找 Virtualbox 版本
*在 Linux 中从命令行查找 Virtualbox 版本*
正如你在上面的输出中看到的,安装的 Virtualbox 的版本是 **5.2**
正如你在上面的输出中看到的,安装的 VirtualBox 的版本是 5.2
查找 virtualbox 版本的另一种方法是:
查找 VirtualBox 版本的另一种方法是:
```
$ vbox-img --version
@ -47,7 +47,7 @@ $ vbox-img --version
5.2.18_Ubuntur123745
```
或者,你可以使用 **“head”** 和 **“awk”** 命令来查找 Virtualbox 版本。
或者,你可以使用 `head``awk` 命令来查找 VirtualBox 版本。
```
$ virtualbox --help | head -n 1 | awk '{print $NF}'
@ -59,7 +59,7 @@ $ virtualbox --help | head -n 1 | awk '{print $NF}'
5.2.18_Ubuntu
```
或者,使用 **“echo”** 命令结合 “head” 和 “awk” 命令:
或者,使用 `echo` 命令结合 `head``awk` 命令:
```
$ echo $(virtualbox --help | head -n 1 | awk '{print $NF}')
@ -71,7 +71,7 @@ $ echo $(virtualbox --help | head -n 1 | awk '{print $NF}')
5.2.18_Ubuntu
```
以上命令适用于任何 Linux 发行版。如果你使用的是 Ubuntu你可以使用 **“dpkg”** 命令查看 Virtualbox 版本。
以上命令适用于任何 Linux 发行版。如果你使用的是 Ubuntu你可以使用 `dpkg` 命令查看 VirtualBox 版本。
```
$ dpkg -l | grep virtualbox | awk '{print $3}'
@ -86,11 +86,9 @@ $ dpkg -l | grep virtualbox | awk '{print $3}'
就是这些了。这些是从 Linux 中的终端查找 Oracle Virtualbox 版本的几种方法。希望这篇文章很有用。
**参考来自:**
* [**AskUbuntu**][6]
参考来自:
* [AskUbuntu][6]
--------------------------------------------------------------------------------
@ -99,7 +97,7 @@ via: https://www.ostechnix.com/how-to-find-virtualbox-version-from-commandline-i
作者:[sk][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,251 @@
[#]: collector: "lujun9972"
[#]: translator: "zianglei"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-11108-1.html"
[#]: subject: "Make an RGB cube with Python and Scribus"
[#]: via: "https://opensource.com/article/19/7/rgb-cube-python-scribus"
[#]: author: "Greg Pittman https://opensource.com/users/greg-p/users/greg-p"
使用 Python 和 Scribus 创建一个 RGB 立方体
======
> 使用 Scribus 的 Python 脚本编写器功能,开发一个显示 RGB 色谱的 3D 立方体。
![cubes coming together to create a larger cube][1]
当我决定这个夏天要玩色彩游戏时,我想到通常色彩都是在色轮上描绘的。这些色彩通常都是使用色素而不是光,并且你失去了任何对颜色亮度或光度变化的感觉。
作为色轮的替代,我想在立方体表面使用一系列图形来显示 RGB 频谱。色彩的 RGB 值将在具有 X、Y、Z 轴的三维图形上展示。例如,一个平面将会保持 B蓝色为 0其余的坐标轴将显示当我将 R红色和 G (绿色)的值从 0 绘制到 255 时发生的情况。
事实证明,使用 [Scribus][2] 及其 [Python 脚本编写器][3] 功能实现这一点并不困难。我可以创建 RGB 颜色,使矩形显示颜色,并以 2D 格式排列它们。我决定设置颜色值的间隔为 5并让矩形按 5 个点pt进行绘图。因此对于每个 2D 图形,我将使用大约 250 种颜色,立方体的一个边有 250 个点pt也就是 3.5 英寸。
我使用下面这段 Python 代码完成了绿 - 红图的任务:
```python
x = 300
y = 300
r = 0
g = 0
b = 0
if scribus.newDoc(scribus.PAPER_LETTER, (0,0,0,0),scribus.PORTRAIT, 1,                  scribus.UNIT_POINTS, scribus.NOFACINGPAGES, scribus.FIRSTPAGERIGHT):
    while r < 256:
        while g < 256:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '0_0_0':
                newcolor = 'Black'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x + g, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            g = g + 5
        g = 0
        r = r + 5
        y = y 5
```
这个脚本在 `300,300` 位置开始绘制图形,这个位置大约是一个美国信件大小的纸张的水平中心,大概是垂直方向从顶部到底的三分之一位置;这是图像的原点,然后它沿着 X 轴(绿色值)水平构建图形,然后返回到 Y 轴,向上移动 5 个点,然后绘制下一条矩形线。
![Red-Green graph][4]
这看起来很简单;我只需要调整一下数字就可以把立方体的另一面画出来。但这不仅仅是再画两个图,一个是蓝 - 绿色,另一个是红 - 蓝色的问题。我想创建一个展开的立方体,这样我就可以打印、剪开然后折叠它,创建一个 RGB 的 3D 视图。因此,下一部分(向下的页面)的原点(黑色的角落)需要在左上角,其水平方向是绿色,垂直方向是蓝色。
“调整数字”最终或多或少变成了试错,从而得到我想要的东西。在创建了第二个图之后,我需要第三个图,它是红 - 蓝色的,原点位于左上角,红色向左递增,蓝色向下递增。
下面是最终效果图:
![First half of RGB cube][5]
当然,这只是这个立方体的前半部分。我需要做一个类似的形状,除了原点应该是白色(而不是黑色)来表示高值。这是我希望自己更聪明的时候之一,因为我不仅需要做出一个类似的整体形状,还需要以镜像的方式与第一个形状交互(我认为)。有时候,尝试和错误是你唯一的朋友。
结果是这样的;我使用了一个单独的脚本,因为在一个美国信件大小的页面上没有足够的空间同时容纳这两个图案。
![Second half of RGB cube][6]
现在,是时候轮到打印机了!在这里,你可以直观了解彩色打印机如何处理 RGB 颜色到 CMYK 颜色的转换以及打印颜色密集空间。
接下来,朋友们,是剪切粘贴时间!我可以用胶带,但我不想改变表面的外观,所以我在切割的时候在两边留下了一些空间,这样我就可以把它们粘在里面了。根据我的经验,在复印纸上打印会产生一些不需要的皱纹,所以在我的复印纸原型完成后,我把立方体打印在了更厚的纸上,表面是哑光的。
![RGB cubes][7]
请记住,这只是 RGB 空间边界的一个视图;更准确地说,你必须做出一个可以在中间切片的实心立方体。例如,这是一个实心 RGB 立方体在蓝色 = 120 的切片。
![RGB cube slice][8]
最后,我做这个项目很开心。如果您也想参与其中,这里有两个脚本。
这是前半部分:
```python
#!/usr/bin/env python
# black2rgb.py
"""
Creates one-half of RGB cube with Black at origin
"""
import scribus
x = 300
y = 300
r = 0
g = 0
b = 0
if scribus.newDoc(scribus.PAPER_LETTER, (0,0,0,0),scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.NOFACINGPAGES, scribus.FIRSTPAGERIGHT):
    while r < 256:
        while g < 256:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '0_0_0':
                newcolor = 'Black'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x + g, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            g = g + 5
        g = 0
        r = r + 5
        y = y - 5
       
    r = 0
    g = 0
    y = 305
    while b < 256:
        while g < 256:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '0_0_0':
                newcolor = 'Black'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x + g, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            g = g + 5
        g = 0
        b = b + 5
        y = y + 5
       
    r = 255
    g = 0
    y = 305
    x = 39
    b = 0
    while b < 256:
        while r >= 0:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '0_0_0':
                newcolor = 'Black'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            r = r - 5
            x = x+5
        b = b + 5
        x = 39.5
        r = 255
        y = y + 5
       
scribus.setRedraw(True)
scribus.redrawAll()
```
后半部分:
```python
#!/usr/bin/env python
# white2rgb.py
"""
Creates one-half of RGB cube with White at origin
"""
import scribus
x = 300
y = 300
r = 255
g = 255
b = 255
if scribus.newDoc(scribus.PAPER_LETTER, (0,0,0,0),scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.NOFACINGPAGES, scribus.FIRSTPAGERIGHT):
    while g >= 0:
        while r >= 0:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '255_255_255':
                newcolor = 'White'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x + 255 - r, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            r = r - 5
        r = 255
        g = g - 5
        y = y - 5
       
    r = 255
    g = 255
    y = 305
    while b >= 0:
        while r >= 0:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '255_255_255':
                newcolor = 'White'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x + 255 - r, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            r = r - 5
        r = 255
        b = b - 5
        y = y + 5
       
    r = 255
    g = 0
    y = 305
    x = 39
    b = 255
    while b >= 0:
        while g < 256:
            newcolor = str(r) + '_' + str(g) + '_' + str(b)
            if newcolor == '255_255_255':
                newcolor = 'White'
            scribus.defineColorRGB(newcolor,r, g, b)
            rect = scribus.createRect(x + g, y, 5, 5)
            scribus.setFillColor(newcolor, rect)
            scribus.setLineColor(newcolor, rect)
            g = g + 5
        g = 0
        b = b - 5
        y = y + 5
       
scribus.setRedraw(True)
scribus.redrawAll()
```
由于我创建了大量的颜色,所以当看到 Scribus 文件比我用它创建的 PDF 文件大得多的时候,我并不感到惊讶。例如,我的 Scribus SLA 文件是 3.0MB,而从中生成的 PDF 只有 70KB。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/rgb-cube-python-scribus
作者:[Greg Pittman][a]
选题:[lujun9972][b]
译者:[zianglei](https://github.com/zianglei)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/greg-p/users/greg-p
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ "cubes coming together to create a larger cube"
[2]: https://www.scribus.net/
[3]: https://opensource.com/sites/default/files/ebooks/pythonscriptingwithscribus.pdf
[4]: https://opensource.com/sites/default/files/uploads/redgreengraph.png "Red-Green graph"
[5]: https://opensource.com/sites/default/files/uploads/rgbcubefirsthalf.png "First half of RGB cube"
[6]: https://opensource.com/sites/default/files/uploads/rgbcubesecondhalf.png "Second half of RGB cube"
[7]: https://opensource.com/sites/default/files/uploads/rgbcubecompositephoto.png "RGB cubes"
[8]: https://opensource.com/sites/default/files/uploads/rgbcubeslice.png "RGB cube slice"

View File

@ -0,0 +1,82 @@
[#]: collector: (lujun9972)
[#]: translator: (PandaWizard)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11102-1.html)
[#]: subject: (What is DevSecOps?)
[#]: via: (https://opensource.com/article/19/1/what-devsecops)
[#]: author: (Brett Hunoldt https://opensource.com/users/bretthunoldtcom)
什么是 DevSecOps
======
> DevSecOps 的实践之旅开始于 DevSecOps 增权、赋能和培养。下面就介绍如何开始学习使用 DevSecOps。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devop.png?itok=Yicb2nnZ)
> Stephen Streichsbier 说过: DevSecOps 使得组织可以用 DevOps 的速度发布内在安全的软件。
DevSecOps 是一场关于 DevOps 概念实践或艺术形式的变革。为了更好理解 DevSecOps你应该首先理解 DevOps 的含义。
DevOps 起源于通过合并开发和运维实践,消除隔离,统一关注点,提升团队和产品的效率和性能。它是一种注重于构建容易维护和易于平常自动运营的产品和服务的新型协作方式。
安全在很多团队中都是常见的隔离点。安全的核心关注点是保护团队,而有时这也意味着创建延缓新服务或是新产品发布的障碍或策略,用于保障任何事都能被很好的理解和安全的执行,并且没有给团队带来不必要的风险。
因为安全隔离点方面的明显特征和它可能带来的摩擦,开发和运维有时会避开安全要求以满足客观情况。在一些公司,这种隔离形成了一种产品安全完全是安全团队责任的期望,并取决于安全团队去寻找产品的安全缺陷或是可能带来的问题。
DevSecOps 看起来是通过给开发或是运维角色加强或是建立安全意识,或是在产品团队中引入一个安全工程师角色,在产品设计中找到安全问题,从而把安全要求汇聚在 Devops 中。
这样使得公司能更快发布和更新产品,并且充分相信安全已经嵌入产品中。
### 坚固的软件哪里适用 DevSecOps
建造坚固的软件是 DevOps 文化的一个层面而不是一个特别的实践,它完善和增强了 DevSecOps 实践。想想一款坚固的软件就像是某些经历过残酷战斗过程的事物。
有必要指出坚固的软件并不是 100% 安全可靠的(虽然它可能最终是在某些方面)。然而,它被设计成可以处理大部分被抛过来的问题。
践行坚固软件最重要的原则是促进竞争、实践、可控的失败与合作。
### 你该如何开始学习 DevSecOps
开始实践 DevSecOps 涉及提升安全需求和在开发过程中尽可能早的阶段进行实践。它最终在公司文化上提升了安全的重要性,使得安全成为所有人的责任,而并不只是安全团队的责任。
你可能在团队中听说过“<ruby>左上升<rt>shift left</rt></ruby>”这个词,如果你把开发周期线扁平化到一条横线上,以包括产品变革的的关键时期:从初始化到设计、建造、测试以及最终的运行,安全的目的就是尽早的参与进来。这使得风险可以在设计中能更好的评估、交流和减轻。“左提升”的含义是指促使安全能在开发周期线上更往左走。
这个过程始于三个关键要素:
* <ruby>增权<rt>empowerment</rt></ruby>
* <ruby>赋能<rt>enablement</rt></ruby>
* <ruby>培养<rt>education</rt></ruby>
增权,在我看来,是关于释放控制权以及使得团队(在理性分析下)做出独立决定而不用害怕失败或影响。这个过程的唯一告诫信息就是要严格的做出明智的决定(不要比这更低要求)。
为了实现增权,商务和行政支持(通过内部销售、展示来建立,通过建立矩阵来展示这项投资的回报)是打破历史障碍和割裂的团队的关键。合并安全人员到开发和运维团队中,提升交流和透明度有助于开始 DevSecOps 之旅。
这个整合和移动使得团队只关注单一的结果:打造一个他们共同负责的产品,让开发和安全人员相互依赖合作。这将引领你们共同走向增权。这是产品研发团队的共同责任,并保证每个可分割的产品都保持其安全性。
赋能涉及正确的使用掌握在团队手中的工具和资源。这是建立一种通过论坛、维基、信息聚合的知识分享文化。
打造一种注重自动化、重复任务应该编码来尽可能减少以后的操作并增强安全性的理念。这种场景不仅仅是提供知识,而是让这种知识能够通过多种渠道和媒介(通过某些工具)可获取,以便它可以被团队或是个人以他喜欢的方式去消化和分享。当团队成员正在编码时一种媒介可能工作的很好,而当他们在进行中时另一种可能更好。让工具简单可用,让团队用上它们。
不同的 DevSecOps 团队有不同的喜好,因此允许他们尽可能的保持独立。这是一个微妙的平衡工作,因为你确实希望实现规模经济和产品间共享的能力。在选择中协作和参与,并更新工具方法有助于减少使用中的障碍。
最后也可能是最重要的DevSecOps 是有关训练和兴趣打造。聚会、社交或是组织中通常的报告会都是让同事们教学和分享他们的知识的很棒的方式。有时,这些会突出其他人可能没有考虑过的共同挑战、顾虑或风险。分享和教学也是一种高效的学习和指导团队的方法。
在我个人经验中,每个团队的文化都是独一无二的,因此你不能用一种“普适”的方法。走进你的团队并找到他们想要使用的工具方法。尝试不同的论坛和聚会并找出最适用于你们文化的方式。寻找反馈并询问团队如何工作,他们喜欢什么以及对应的原因。适应和学习,保持乐观,不要停止尝试,你们将会有所收获。
- [下载 DevSecOps 的入门手册][1]
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/what-devsecops
作者:[Brett Hunoldt][a]
选题:[lujun9972][b]
译者:[PandaWizard](https://github.com/PandaWizard)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/bretthunoldtcom
[b]: https://github.com/lujun9972
[1]: https://opensource.com/downloads/devsecops

View File

@ -0,0 +1,81 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Excellent! Ubuntu LTS Users Will Now Get the Latest Nvidia Driver Updates [No PPA Needed Anymore])
[#]: via: (https://itsfoss.com/ubuntu-lts-latest-nvidia-drivers/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Excellent! Ubuntu LTS Users Will Now Get the Latest Nvidia Driver Updates [No PPA Needed Anymore]
======
_**Brief: To get the latest Nvidia drivers in Ubuntu LTS versions, you dont have to use PPA anymore. The latest drivers will now be available in the repositories of the Ubuntu LTS versions.**_
![][1]
You might be aware of the troubles to install the latest and greatest Nvidia binary driver updates on Ubuntu.
By default, Ubuntu provides the open source [Nvidia Nouveau drivers][2] that some time result in Ubuntu being stuck at boot screen.
You can also [install the proprietary Nvidia driver in Ubuntu][3] easily. The problem is that the Nvidia drivers in the default [Ubuntu repositories][4] are not the latest one. To solve this problem, [Ubuntu introduced a dedicated PPA][5] a few years back.
[Using the official PPA][6] is still a decent workaround for installing the closed source graphics driver. However, it is definitely not the most convenient option.
But, now, Ubuntu agreed to include the latest Nvidia driver update as part of the SRU ([StableReleaseUpdates][7]). So, you will have Nvidia drivers baked in with Ubuntu LTS versions.
Well, this means that you no longer have to separately download/install the Nvidia graphics drivers on Ubuntu LTS versions.
Just like you get an update for your browser or the core OS updates (or the security updates), similarly, you will get the required Nvidia binary driver update packages.
### Can We Rely on the Latest Nvidia Graphics Driver?
SRU literally refers to stable updates for Ubuntu (or Ubuntu-based distros). So, instead of opting for the pre-released updates in order to get the latest graphics driver, you should wait for it to drop as a stable update.
Of course, no one can guarantee that it will work 100% of the time but it will be way more safe to install than the pre-released ones.
### How Can I Get the latest Nvidia drivers?
![Software Updates Nvidia][8]
You just have to enable “Using NVIDIA driver meta package….” from the additional drivers section in the software update option.
[][9]
Suggested read  Ubuntu 17.04 Release Date, Features And Upgrade Procedure
Originally, [The Linux Experiment][10] shared this news through a video which then Ubuntus official Twitter handle re-tweeted as an announcement. You can watch the video below to get more details on it:
### Which Ubuntu LTS Versions are Supported?
For now, Ubuntu 18.04 LTS supports this out of the box. It will soon be available for Ubuntu 16.04 LTS (and later LTS versions will follow).
**Wrapping Up**
Now that you can install the latest Nvidia binary driver updates, how do you think will it help you?
If you have tested a pre-released package, let us know your thoughts on that in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/ubuntu-lts-latest-nvidia-drivers/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/nvidia-ubuntu-logo.png?resize=800%2C450&ssl=1
[2]: https://nouveau.freedesktop.org/wiki/
[3]: https://itsfoss.com/install-additional-drivers-ubuntu/
[4]: https://itsfoss.com/ubuntu-repositories/
[5]: https://itsfoss.com/ubuntu-official-ppa-graphics/
[6]: https://itsfoss.com/ppa-guide/
[7]: https://wiki.ubuntu.com/StableReleaseUpdates
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/software-updates-nvidia.jpg?fit=800%2C542&ssl=1
[9]: https://itsfoss.com/ubuntu-17-04-release-features/
[10]: https://twitter.com/thelinuxEXP

View File

@ -1,69 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (WangYueScream )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Introducing kids to computational thinking with Python)
[#]: via: (https://opensource.com/article/19/2/break-down-stereotypes-python)
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
Introducing kids to computational thinking with Python
======
Coding program gives low-income students the skills, confidence, and knowledge to break free from economic and societal disadvantages.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa)
When the [Parkman Branch][1] of the Detroit Public Library was flooded with bored children taking up all the computers during summer break, the library saw it not as a problem, rather an opportunity. They started a coding club, the [Parkman Coders][2], led by [Qumisha Goss][3], a librarian who is leveraging the power of Python to introduce disadvantaged children to computational thinking.
When she started the Parkman Coders program about four years ago, "Q" (as she is known) didn't know much about coding. Since then, she's become a specialist in library instruction and technology and a certified Raspberry Pi instructor.
The program began by using [Scratch][4], but the students got bored with the block coding interface, which they regarded as "baby stuff." She says, "I knew we need to make a change to something that was still beginner friendly, but that would be more challenging for them to continue to hold their attention." At this point, she started teaching them Python.
Q first saw Python while playing a game with dungeons and skeleton monsters on [Code.org][5]. She began to learn Python by reading books like [Python Programming: An Introduction to Computer Science][6] and [Python for Kids][7]. She also recommends [Automate the Boring Stuff with Python][8] and [Lauren Ipsum: A Story about Computer Science and Other Improbable Things][9].
### Setting up a Raspberry Pi makerspace
Q decided to use [Raspberry Pi][10] computers to avoid the possibility that the students might be able to hack into the library system's computers, which weren't arranged in a way conducive to a makerspace anyway. The Pi's affordability, plus its flexibility and the included free software, lent more credibility to her decision.
While the coder program was the library's effort keep the peace and create a learning space that would engage the children, it quickly grew so popular that it ran out of space, computers, and adequate electrical outlets in a building built in 1921. They started with 10 Raspberry Pi computers shared among 20 children, but the library obtained funding from individuals, companies including Microsoft, the 4H, and the Detroit Public Library Foundation to get more equipment and expand the program.
Currently, about 40 children participate in each session and they have enough Raspberry Pi's for one device per child and some to give away. Many of the Parkman Coders come from low socio-economic backgrounds and don't have a computer at home, so the library provides them with donated Chromebooks.
Q says, "when kids demonstrate that they have a good understanding of how to use a Raspberry Pi or a [Microbit][11] and have been coming to programs regularly, we give them equipment to take home with them. This process is very challenging, however, because [they may not] have internet access at home [or] all the peripheral things they need like monitors, keyboards, and mice."
### Learning life skills and breaking stereotypes with Python
Q says, "I believe that the mainstays of learning computer science are learning critical thinking and problem-solving skills. My hope is that these lessons will stay with the kids as they grow and pursue futures in whatever field they choose. In addition, I'm hoping to inspire some pride in creatorship. It's a very powerful feeling to know 'I made this thing,' and once they've had these successes early, I hope they will approach new challenges with zeal."
She also says, "in learning to program, you have to learn to be hyper-vigilant about spelling and capitalization, and for some of our kids, reading is an issue. To make sure that the program is inclusive, we spell aloud during our lessons, and we encourage kids to speak up if they don't know a word or can't spell it correctly."
Q also tries to give extra attention to children who need it. She says, "if I recognize that someone has a more severe problem, we try to get them paired with a tutor at our library outside of program time, but still allow them to come to the program. We want to help them without discouraging them from participating."
Most importantly, the Parkman Coders program seeks to help every child realize that each has a unique skill set and abilities. Most of the children are African-American and half are girls. Q says, "we live in a world where we grow up with societal stigmas that frequently limit our own belief of what we can accomplish." She believes that children need a nonjudgmental space where "they can try new things, mess up, and discover."
The environment Q and the Parkman Coders program creates helps the participants break away from economic and societal disadvantages. She says that the secret sauce is to "make sure you have a welcoming space so anyone can come and that your space is forgiving and understanding. Let people come as they are, and be prepared to teach and to learn; when people feel comfortable and engaged, they want to stay."
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/break-down-stereotypes-python
作者:[Don Watkins][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/don-watkins
[b]: https://github.com/lujun9972
[1]: https://detroitpubliclibrary.org/locations/parkman
[2]: https://www.dplfound.org/single-post/2016/05/15/Parkman-Branch-Coders
[3]: https://www.linkedin.com/in/qumisha-goss-b3bb5470
[4]: https://scratch.mit.edu/
[5]: http://Code.org
[6]: https://www.amazon.com/Python-Programming-Introduction-Computer-Science/dp/1887902996
[7]: https://nostarch.com/pythonforkids
[8]: https://automatetheboringstuff.com/
[9]: https://nostarch.com/laurenipsum
[10]: https://www.raspberrypi.org/
[11]: https://microbit.org/guide/

View File

@ -1,3 +1,5 @@
bestony is translating.
Create a Clean-Code App with Kotlin Coroutines and Android Architecture Components
============================================================

View File

@ -1,3 +1,4 @@
ZhiW5217 is translating
Top 10 Microsoft Visio Alternatives for Linux
======
**Brief: If you are looking for a good Visio viewer in Linux, here are some alternatives to Microsoft Visio that you can use in Linux.**

View File

@ -1,3 +1,5 @@
translating by zyk2290
Two great uses for the cp command: Bash shortcuts
============================================================

View File

@ -1,149 +0,0 @@
translating by qfzy1233
MX Linux: A Mid-Weight Distro Focused on Simplicity
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux.png?itok=OLjmCxT9)
There are so many distributions of Linux. Some of those distributions go a very long way to differentiate themselves. In other cases, the differences are so minimal, you wonder why anyone would have bothered reinventing that particular wheel. Its that latter concern that had me wondering why [antiX][1] and [MEPIS][2] communities would come together to create yet another distribution—especially given that the results would be an Xfce edition of antiX, built by the MEPIS community.
Does building antiX with an Xfce desktop warrant its own distribution? After all, antiX claims to be a “fast, lightweight and easy to install systemd-free linux live CD distribution based on Debian Stable.” The antiX desktop of choice is [LXDE][3], which does certainly fit the bill for a lightweight desktop. So why retool antiX into another lightweight distribution, only this time with Xfce? Well, as anyone within the Linux community knows, variance adds flavor and a good lightweight distribution is a worthwhile endeavor (especially in preventing old hardware from making its way to the landfill). Of course, LXDE and Xfce arent quite in the same category. LXDE should be considered a true lightweight desktop, whereas Xfce should be considered more a mid-weight desktop. And that, my friends, is key to why MX Linux is an important iteration of antiX. A mid-weight distribution, built on Debian, that includes all the tools you need to get your work done.
But theres something really keen within MX Linux—something directly borrowed from antiX—and that is the installation tool. When I first set up a VirtualBox VM to install MX Linux, I assumed the installation would be the typical, incredibly easy Linux installation Id grown accustomed to. Much to my surprise, that antiX installer MX Linux uses could be a real game changer, especially for those on the fence about giving Linux a try.
So even before I began kicking the tires of MX Linux, I was impressed. Lets take a look at what makes the installation of this distribution so special, and then finally have a go with the desktop.
You can download MX Linux 17.1 from [here][4]. The minimum system requirements are:
* A CD/DVD drive (and BIOS capable of booting from that drive), or a live USB (and BIOS capable of booting from USB)
* A modern i486 Intel or AMD processor
* 512 MB of RAM memory
* 5 GB free hard drive space
* A SoundBlaster, AC97 or HDA-compatible sound card
* For use as a LiveUSB, 4 GB free
### Installation
Out of the gate, the MX Linux installer makes installing Linux a breeze. Although it may not be the most modern-looking installation tool, theres little to second-guess. The heart of the installation begins with choosing the disks and selecting the installation type (Figure 1).
![install][6]
Figure 1: One of the first installer screens for MX Linux.
[Used with permission][7]
The next important screen (Figure 2) requires you to set a computer name, domain, and (if necessary) a workgroup for MS Networking.
That ability to configure a workgroup is the first bit to really stand out. This is the first distribution I can remember that offers this option during installation. It also should clue you in that MX Linux offers the ability to share directories out of the box. It does, and it does so with aplomb. Its not perfect, but it works without having to install any extra package (more on this in a bit).
The last important installation screen (that requires user-interaction) is the creation of the user account and root password (Figure 3).
![user][9]
Figure 3: Setting up your user account details and the root user password.
[Used with permission][7]
Once youve taken care of this final screen, the installation will complete and ask you to reboot. Upon rebooting, youll be greeted with the login screen. Login and enjoy the MX Linux experience.
### Usage
The Xfce desktop is quite an easy interface to get up to speed with. The default places the panel on the left edge of the screen (Figure 4).
![desktop ][11]
Figure 4: The default MX Linux desktop.
[Used with permission][7]
If you want to move the panel to a more traditional location, right click a blank spot on the panel and click Panel > Panel Preferences. In the resulting window (Figure 5), click the Mode drop-down to select from between Deskbar, Vertical, or Horizontal.
![panel][13]
Figure 5: Configuring the MX Linux Panel.
[Used with permission][7]
The difference between the Deskbar and Vertical options is that, in the Deskbar mode, the panel is aligned vertically, just like in the vertical mode, but the plugins are laid out horizontally. This means you can create much wider panels (for widescreen layouts). If you opt for a horizontal layout, it will default to the top—you will have to then uncheck the Lock panel check box, click Close, and then (using the drag handle on the left edge of the panel) drag it to the bottom. You can then go back into the Panel Settings window and re-lock the panel.
Beyond that, using the Xfce desktop should be a no-brainer for nearly any experience level … its that easy. Youll find software to cover productivity (LibreOffice, Orage Calendar, PDF-Shuffler), graphics (GIMP), communication (Firefox, Thunderbird, HexChat), multimedia (Clementine, guvcview, SMTube, VLC media player), and a number of tools specific to MX Linux (called MX Tools, that range from a live-USB drive creator, a network assistant, package installer, repo manager, live ISO snapshot creator, and more).
![sharing][15]
Figure 6: Sharing out a directory to your network.
[Used with permission][7]
### Samba
Lets talk about sharing folders to your network. As I mentioned, you wont have to install any extra packages to get this to function. You simply open up the file manager, right-click anywhere, and select Share a folder on your network. You will be prompted for the administrative password (set during installation). Upon successful authentication, the Samba Server Configuration Tool will open (Figure 6).
![sharing][17]
Figure 7: Configuring the share on MX Linux.
[Used with permission][7]
Click the + button and configure your share. You will be asked to locate the directory, give the share a name/description, and then decide if the share is writeable and visible (Figure 7).
When you click the Access tab, you have the choice between giving everyone access to the share or just specific users. Heres where the problem arises. At this point, no users will be available for sharing. Why? They havent been added. In order to add them, there are two possibilities: From the command line or using the tool we already have open. Lets take the obvious route. From the main window of the Samba Server Configuration Tool, click Preferences > Samba Users. In the resulting window, click Add user.
A new window will appear (Figure 8), where you need to select the user from the drop-down, enter a Windows username, and type/retype a password for the user.
![Samba][19]
Figure 8: Adding a user to Samba.
[Used with permission][7]
Once youve clicked OK, the user will be added and the share will be accessible, to that user, across your network. Creating Samba shares really can be that easy.
### The conclusion
MX Linux makes transitioning from just about any desktop operating system simple. Although some might find the desktop interface to be a bit less-than-modern, the distributions primary focus isnt on beauty, but simplicity. To that end, MX Linux succeeds in stellar fashion. This flavor of Linux can make anyone feel right at home on Linux. Spin up this mid-weight distribution and see if it cant serve as your daily driver.
Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/learn/intro-to-linux/2018/4/mx-linux-mid-weight-distro-focused-simplicity
作者:[JACK WALLEN][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/jlwallen
[1]:https://antixlinux.com/
[2]:https://en.wikipedia.org/wiki/MEPIS
[3]:https://lxde.org/
[4]:https://mxlinux.org/download-links
[5]:/files/images/mxlinux1jpg
[6]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux_1.jpg?itok=i9bNScjH (install)
[7]:/licenses/category/used-permission
[8]:/files/images/mxlinux3jpg
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux_3.jpg?itok=ppf2l_bm (user)
[10]:/files/images/mxlinux4jpg
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux_4.jpg?itok=mS1eBy9m (desktop)
[12]:/files/images/mxlinux5jpg
[13]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_5.jpg?itok=wsN1hviN (panel)
[14]:/files/images/mxlinux6jpg
[15]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_6.jpg?itok=vw8mIp9T (sharing)
[16]:/files/images/mxlinux7jpg
[17]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_7.jpg?itok=tRIWdcEk (sharing)
[18]:/files/images/mxlinux8jpg
[19]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_8.jpg?itok=ZS6lhZN2 (Samba)
[20]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

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

View File

@ -1,219 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (4 tools to help you drive Kubernetes)
[#]: via: (https://opensource.com/article/19/6/tools-drive-kubernetes)
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux/users/fatherlinux/users/fatherlinux/users/fatherlinux)
4 tools to help you drive Kubernetes
======
Learning to drive Kubernetes is more important that knowing how to build
it, and these tools will get you on the road fast.
![Tools in a workshop][1]
In the third article in this series, _[Kubernetes basics: Learn how to drive first][2]_ , I emphasized that you should learn to drive Kubernetes, not build it. I also explained that there is a minimum set of primitives that you have to learn to model an application in Kubernetes. I want to emphasize this point: the set of primitives that you _need_ to learn are the easiest set of primitives that you _can_ learn to achieve production-quality application deployments (i.e., high-availability [HA], multiple containers, multiple applications). Stated another way, learning the set of primitives built into Kubernetes is easier than learning clustering software, clustered file systems, load balancers, crazy Apache configs, crazy Nginx configs, routers, switches, firewalls, and storage backends—all the things you would need to model a simple HA application in a traditional IT environment (for virtual machines or bare metal).
In this fourth article, I'll share some tools that will help you learn to drive Kubernetes quickly.
### 1\. Katacoda
[Katacoda][3] is the easiest way to test-drive a Kubernetes cluster, hands-down. With one click and five seconds of time, you have a web-based terminal plumbed straight into a running Kubernetes cluster. It's magnificent for playing and learning. I even use it for demos and testing out new ideas. Katacoda provides a completely ephemeral environment that is recycled when you finish using it.
![OpenShift Playground][4]
[OpenShift playground][5]
![Kubernetes Playground][6]
[Kubernetes playground][7]
Katacoda provides ephemeral playgrounds and deeper lab environments. For example, the [Linux Container Internals Lab][3], which I have run for the last three or four years, is built in Katacoda.
Katacoda maintains a bunch of [Kubernetes and cloud tutorials][8] on its main site and collaborates with Red Hat to support a [dedicated learning portal for OpenShift][9]. Explore them both—they are excellent learning resources.
When you first learn to drive a dump truck, it's always best to watch how other people drive first.
### 2\. Podman generate kube
The **podman generate kube** command is a brilliant little subcommand that helps users naturally transition from a simple container engine running simple containers to a cluster use case running many containers (as I described in the [last article][2]). [Podman][10] does this by letting you start a few containers, then exporting the working Kube YAML, and firing them up in Kubernetes. Check this out (pssst, you can run it in this [Katacoda lab][3], which already has Podman and OpenShift).
First, notice the syntax to run a container is strikingly similar to Docker:
```
`podman run -dtn two-pizza quay.io/fatherlinux/two-pizza`
```
But this is something other container engines don't do:
```
`podman generate kube two-pizza`
```
The output:
```
# Generation of Kubernetes YAML is still under development!
#
# Save the output of this file and use kubectl create -f to import
# it into Kubernetes.
#
# Created with podman-1.3.1
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2019-06-07T08:08:12Z"
labels:
app: two-pizza
name: two-pizza
spec:
containers:
\- command:
\- /bin/sh
\- -c
\- bash -c 'while true; do /usr/bin/nc -l -p 3306 < /srv/hello.txt; done'
env:
\- name: PATH
value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
\- name: TERM
value: xterm
\- name: HOSTNAME
\- name: container
value: oci
image: quay.io/fatherlinux/two-pizza:latest
name: two-pizza
resources: {}
securityContext:
allowPrivilegeEscalation: true
capabilities: {}
privileged: false
readOnlyRootFilesystem: false
tty: true
workingDir: /
status: {}
\---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2019-06-07T08:08:12Z"
labels:
app: two-pizza
name: two-pizza
spec:
selector:
app: two-pizza
type: NodePort
status:
loadBalancer: {}
```
You now have some working Kubernetes YAML, which you can use as a starting point for mucking around and learning, tweaking, etc. The **-s** flag created a service for you. [Brent Baude][11] is even working on new features like [adding Volumes/Persistent Volume Claims][12]. For a deeper dive, check out Brent's amazing work in his blog post "[Podman can now ease the transition to Kubernetes and CRI-O][13]."
### 3\. oc new-app
The **oc new-app** command is extremely powerful. It's OpenShift-specific, so it's not available in default Kubernetes, but it's really useful when you're starting to learn Kubernetes. Let's start with a quick command to create a fairly sophisticated application:
```
oc new-project -n example
oc new-app -f <https://raw.githubusercontent.com/openshift/origin/master/examples/quickstarts/cakephp-mysql.json>
```
With **oc new-app** , you can literally steal templates from the OpenShift developers and have a known, good starting point when developing primitives to describe your own applications. After you run the above command, your Kubernetes namespace (in OpenShift) will be populated by a bunch of new, defined resources.
```
`oc get all`
```
The output:
```
NAME READY STATUS RESTARTS AGE
pod/cakephp-mysql-example-1-build 0/1 Completed 0 4m
pod/cakephp-mysql-example-1-gz65l 1/1 Running 0 1m
pod/mysql-1-nkhqn 1/1 Running 0 4m
NAME DESIRED CURRENT READY AGE
replicationcontroller/cakephp-mysql-example-1 1 1 1 1m
replicationcontroller/mysql-1 1 1 1 4m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/cakephp-mysql-example ClusterIP 172.30.234.135 <none> 8080/TCP 4m
service/mysql ClusterIP 172.30.13.195 <none> 3306/TCP 4m
NAME REVISION DESIRED CURRENT TRIGGERED BY
deploymentconfig.apps.openshift.io/cakephp-mysql-example 1 1 1 config,image(cakephp-mysql-example:latest)
deploymentconfig.apps.openshift.io/mysql 1 1 1 config,image(mysql:5.7)
NAME TYPE FROM LATEST
buildconfig.build.openshift.io/cakephp-mysql-example Source Git 1
NAME TYPE FROM STATUS STARTED DURATION
build.build.openshift.io/cakephp-mysql-example-1 Source Git@47a951e Complete 4 minutes ago 2m27s
NAME DOCKER REPO TAGS UPDATED
imagestream.image.openshift.io/cakephp-mysql-example docker-registry.default.svc:5000/example/cakephp-mysql-example latest About aminute ago
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
route.route.openshift.io/cakephp-mysql-example cakephp-mysql-example-example.2886795271-80-rhsummit1.environments.katacoda.com cakephp-mysql-example <all> None
```
The beauty of this is that you can delete Pods, watch the replication controllers recreate them, scale Pods up, and scale them down. You can play with the template and change it for other applications (which is what I did when I first started).
### 4\. Visual Studio Code
I saved one of my favorites for last. I use [vi][14] for most of my work, but I have never found a good syntax highlighter and code completion plugin for Kubernetes (if you have one, let me know). Instead, I have found that Microsoft's [VS Code][15] has a killer set of plugins that complete the creation of Kubernetes resources and provide boilerplate.
![VS Code plugins UI][16]
First, install Kubernetes and YAML plugins shown in the image above.
![Autocomplete in VS Code][17]
Then, you can create a new YAML file from scratch and get auto-completion of Kubernetes resources. The example above shows a Service.
![VS Code autocomplete filling in boilerplate for an object][18]
When you use autocomplete and select the Service resource, it fills in some boilerplate for the object. This is magnificent when you are first learning to drive Kubernetes. You can build Pods, Services, Replication Controllers, Deployments, etc. This is a really nice feature when you are building these files from scratch or even modifying the files you create with **Podman generate kube**.
### Conclusion
These four tools (six if you count the two plugins) will help you learn to drive Kubernetes, instead of building or equipping it. In my final article in the series, I will talk about why Kubernetes is so exciting for running so many different workloads.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/6/tools-drive-kubernetes
作者:[Scott McCarty][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/fatherlinux/users/fatherlinux/users/fatherlinux/users/fatherlinux
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_workshop_blue_mechanic.jpg?itok=4YXkCU-J (Tools in a workshop)
[2]: https://opensource.com/article/19/6/kubernetes-basics
[3]: https://learn.openshift.com/subsystems/container-internals-lab-2-0-part-1
[4]: https://opensource.com/sites/default/files/uploads/openshift-playground.png (OpenShift Playground)
[5]: https://learn.openshift.com/playgrounds/openshift311/
[6]: https://opensource.com/sites/default/files/uploads/kubernetes-playground.png (Kubernetes Playground)
[7]: https://katacoda.com/courses/kubernetes/playground
[8]: https://katacoda.com/learn
[9]: http://learn.openshift.com/
[10]: https://podman.io/
[11]: https://developers.redhat.com/blog/author/bbaude/
[12]: https://github.com/containers/libpod/issues/2303
[13]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/
[14]: https://en.wikipedia.org/wiki/Vi
[15]: https://code.visualstudio.com/
[16]: https://opensource.com/sites/default/files/uploads/vscode_-_kubernetes_red_hat_-_plugins.png (VS Code plugins UI)
[17]: https://opensource.com/sites/default/files/uploads/vscode_-_kubernetes_service_-_autocomplete.png (Autocomplete in VS Code)
[18]: https://opensource.com/sites/default/files/uploads/vscode_-_kubernetes_service_-_boiler_plate.png (VS Code autocomplete filling in boilerplate for an object)

View File

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

View File

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

View File

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

View File

@ -1,184 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 ways to get started with Linux)
[#]: via: (https://opensource.com/article/19/7/ways-get-started-linux)
[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/don-watkins)
10 ways to get started with Linux
======
Ready to dive in and learn Linux? Try these 10 ways to get started.
![Penguins gathered together in the Artic][1]
The article _[What is a Linux user?][2]_ by Anderson Silva made it clear that these days people are as likely to use Linux (in some way) as they are to use Windows, as long as your definition of "using Linux" is sufficiently broad. Still, if you don't have enough Linux in your life, now is a great time to try Linux in a way you've never tried before.
Here are 10 ways to get started with Linux. Try one or try them all.
### 1\. Join a free shell
![Free shell screenshot][3]
There are a lot of people running Linux with more Linux servers than they know what to do with (keep in mind that a "Linux server" can be anything from the latest supercomputer to a discarded 12-year-old laptop). To put excess computers to good use, many administrators open their spare boxes up for free shell accounts.
If you want to log time in a Linux terminal to learn commands, shell scripting, Python, and the basics of web development, a free shell account is an easy, no-cost way to get started. Here's a short list to try:
* [Freeshell.de][4] is a public access Linux system that's been online since 2002. You get SSH access (to experiment in a Linux shell), IPv6, and OpenSSL, and you can request a MySQL database.
* [Blinkenshell][5] provides a Linux shell to learn Unix, use IRC, host simple websites, and share files. It's been online since 2006.
* [SDF Public Access Unix System][6] was established in 1987 to offer free NetBSD accounts. NetBSD isn't Linux, of course, but it's open source Unix, so it offers a similar experience. It also has several homebrewed applications, so it straddles the line between old-school BBS and plain-old free shell.
Free shell accounts are subject to a lot of abuse, so the more you demonstrate trustworthiness and willingness to participate in the goings-on of the collective, the better your experience. You can often gain access (through a special request or a small donation to demonstrate goodwill) to database engines, compilers, and advanced programming languages. You can also ask for additional software or libraries to be installed, subject to administrator approval.
#### How to use it
Public access shell accounts are a great way to try out a real Linux system. The fact that you don't get root access means you get to learn local software management without having to mow your own lawn or fix leaky faucets. You can do just enough real-life activities to make them viable for getting real work done, although they're not reliable enough to be mission critical.
### 2\. Try Linux on Windows with WSL 2
Believe it or not, Microsoft started shipping Linux with Windows as of June 2019, meaning you can run Linux applications from Windows as the second iteration of the [Windows Subsystem for Linux][7] (WSL 2). While it's primarily aimed at developers, Windows users will find WSL 2 to be a Linux environment from the comfort of a familiar desktop without any virtualization taking up extra resources. This is Linux running as a process on your Windows machine. At this time, it's still a new initiative and a work in progress, so it's subject to change. If you try to push it too far too soon, you're likely to encounter a bug or two, but if you're just looking to get started with Linux, learn some commands, and get a feel for getting serious work done in a text-based environment, WSL 2 may be exactly what you need.
#### How to use it
WSL doesn't yet have a clear pathway or purpose, but it provides a Linux environment on your Windows machine. You get root access and can run Linux distributions and applications, so it's an easy and seamless way to learn. However, even though WSL _is Linux_, it's not exactly a typical Linux experience. It's Linux provided by Windows, and that's not what you're likely to encounter in the real world. WSL is a development and educational tool, but if it's available to you, then you should use it.
### 3\. Carry Linux on a bootable thumb drive
![Porteus Linux][8]
Carry Linux, installed to a USB thumb drive, everywhere you go, and boot any computer you encounter from that thumb drive. You get a personalized Linux desktop, and you don't have to worry about the data on the host computer you've booted from. The computer doesn't touch your Linux OS, and your Linux OS doesn't affect the computer. It's ideal for public computers at hotel business centers, libraries, schools, or just to give yourself an excuse to boot into Linux from time to time.
Unlike many other quick hacks to get to a Linux shell, this method offers you a full and robust Linux system, complete with a desktop, access to whatever software you need, and persistent data storage.
The system never changes. Any data you want to save is written into a compressed filesystem, which is then applied as an overlay to the system when you boot. This flexibility allows you to choose whether to boot in persistent mode, saving all data back to the thumb drive, or in an ephemeral mode, so everything you do disappears once you power down. In other words, you can use this as a secure kiosk on an untrusted computer or as your portable OS on computers you trust.
There are many [thumb drive distributions][9] you can try, some with minimal desktop environments for low-powered computers and others with a full desktop. I'm partial to [Porteus][10] Linux. I've carried it on my keychain every day for the past eight years, using it as my primary computing platform during business travel as well as a utility disk if computer problems strike at work or home. It's a reliable and stable operating system that's fun and easy to use.
On Mac or Windows, download the [Fedora Media Writer][11] to create a bootable thumb drive of whatever portable distribution you download.
#### How to use it
Booting a "live Linux" from a USB thumb drive provides a complete Linux distribution. While data storage is done a little differently from a system you install to a hard drive, everything else is as you'd expect from a Linux desktop. There's little you can't do on a portable Linux OS, so install one on your keychain to unlock the full potential of every computer you encounter.
### 4\. Take an online tour
![Linux tour screenshot][12]
Somebody over at Ubuntu thought up the brilliant idea of hosting an Ubuntu GNOME desktop in the browser. To try it out for yourself, open a web browser and navigate to [tour.ubuntu.com][13]. You can select which activity you want demonstrated, or you can skip individual lessons and click the Show Yourself Around button.
Even if you're new to the Linux desktop, you might find showing yourself around is more familiar than you might expect. From the online tour, you can look around, see what applications are available, and view what a typical default Linux desktop is like. You can't adjust settings or launch another tour in Firefox (it was the first thing I tried, naturally), and while you can go through the motions of installing applications, you can't launch them. But if you've never used a Linux desktop before and you want to see what all the fuss is about, this is the whirlwind tour.
#### How to use it
An online tour is truly just a tour. If you've never seen a Linux desktop in action, this is an opportunity to get a glimpse of what it's like. Not intended for serious work, this is an attractive display to entice passers-by.
### 5\. Run Linux in the browser with JavaScript
![JSLinux][14]
Not so long ago, virtualization used to be computationally expensive, limited to users with premium hardware. Now virtualization has been optimized to the point that it can be performed by a JavaScript engine, thanks to Fabrice Bellard, the creator of the excellent and open source [QEMU][15] machine emulator and virtualizer.
Bellard also started the JSLinux project, which allows you to run Linux and other operating systems in a browser, in his spare time for fun. It's still an experimental project, but it's a technical marvel. Open a web browser to the [JSLinux][16] page, and you can boot a text-based Linux shell or a minimal graphical Linux environment. You can upload and download files to your JSLinux host or (theoretically) send your files to a network backup location, because JSLinux has access to the internet through a VPN socket (although at capped speeds, dependent upon the VPN service).
#### How to use it
You won't be doing serious work on JSLinux anytime soon, and the environment is arguably too unusual to learn broad lessons about how Linux normally works. If, however, you're bored of running Linux on a plain old PC and would like to try Linux on a truly distinctive platform, JSLinux is in a class all its own.
### 6\. Read about it
Not every Linux experience happens on the computer. Maybe you're the sort of person who likes to keep your distance, observe, and do your research before jumping into something new, or maybe you're just not clear yet on what "Linux" encompasses, or maybe you love full immersion. There's a wealth of information to read about how Linux works, what it's like to run Linux, and what's happening in the Linux world.
The more you get familiar with the world of open source, the easier it is to understand the common lingo and to separate urban myth from actual experience. We publish [book lists][17] from time to time, but one of my favorites is [_The Charm of Linux_][18] by Hazel Russman. It's a tour through Linux from many different angles, written by an independent author out of excitement over discovering Linux.
#### How to use it
Nothing beats kicking back with a good book. This is the least traditional method of experiencing Linux, but for people who love the printed word, it's both comforting and effective.
### 7\. Get a Raspberry Pi
![Raspberry Pi 4][19]
If you're using a [Raspberry Pi][20], you're running Linux. It's that easy to get started with Linux and low-powered computing. The great thing about the Pi, aside from it costing well under $100, is that its [website][21] is designed for education. You can learn all about what the Pi does, and while you're at it, all about what Linux can do for you.
#### How to use it
The Pi is, by design, a low-powered computer. That means you can't do as much multitasking as you might be used to, but that's a convenient way to keep yourself from getting overwhelmed. The Raspberry Pi is a great way to learn Linux and all of the possibilities that come with it, and it's a fun way to discover the power of eco-friendly, small-form-factor, simplified computing. And be sure to stay tuned to Opensource.com—especially during Pi Week every March—for [tips][22] and [tricks][23] and [fun][24] [activities][25].
### 8\. Climb aboard the container craze
If you work near the back end of the mythical [cloud][26], then you've heard about the container craze. While you can run Docker and Kubernetes on Windows, Azure, Mac, and Linux, you may not know that the containers themselves are Linux. Cloud computing apps and infrastructure are literally minimal Linux systems that run partly virtualized and partly on bare metal. If you launch a container, you are launching a miniature, hyper-specific Linux distribution.
Containers are [different][27] than virtual machines or physical servers. They're not intended to be used as a general-purpose operating system. However, if you are developing in a container, you might want to pause and have a look around. You'll get a glimpse of how a Linux system is structured, where important files are kept, and which commands are the most common. You can even [try a container online][28], and you can read all about how they work in my article about going [behind the scenes with Linux containers][29].
#### How to use it
Containers are, by design, specific to a single task, but they're Linux, so they're extremely flexible. You can use them as they're intended, or you can build a container out into a mostly complete system for your Linux experiments. It's not a desktop Linux experience, but it's a full Linux experience.
### 9\. Install Linux as a VM
Virtualization is the easy way to try an operating system, and [VirtualBox][30] is a great open source way to virtualize. VirtualBox runs on Windows and Mac, so you can install Linux as a virtual machine (VM) and use it almost as if it were just another application. If you're not accustomed to installing an operating system, VirtualBox is also a very safe way to try Linux without accidentally installing it over your usual OS.
#### How to use it
Running Linux as a VM is convenient and easy, either as a trial run or an alternative to dual-booting or rebooting when you need a Linux environment. It's full-featured and, because it uses virtual hardware, the host operating system drives your peripherals. The only disadvantage to running Linux as a virtual machine is primarily psychological. If you intend to use Linux as your main OS, but end up defaulting to the host OS for all but the most Linux-specific tasks, then the VM has failed you. Otherwise, a VM is a triumph of modern technology, and using Linux in VirtualBox provides you with all the best features Linux has to offer.
### 10\. Install it
![Fedora Silverblue][31]
When in doubt, there's always the traditional route. If you want to give Linux the attention it deserves, you can download Linux, burn the installer to a thumb drive (or a DVD, if you prefer optical media), and install it on your computer. Linux is open source, so it can be distributed by anyone who wants to take the time to bundle Linux—and all the bits and pieces that make it usable—into what is commonly called a _distribution_ (or "distro") for short. Ask any Linux user, and you're bound to get a different answer for which distribution is "best" (mostly because the term "best" is often left undefined). Most people admit that you should use the Linux distribution that works for you, meaning that you should test a few popular distros and settle on the one that makes your computer behave as you expect it to behave. This is a pragmatic and functional approach. For example, should a distribution fail to recognize your webcam and you want your webcam to work, then use a distribution that recognizes your webcam.
If you've never installed an operating system before, you'll find most Linux distributions include a friendly and easy installer. Just download a distribution (they are delivered as ISO files), and download the [Fedora Media Writer][11] to create a bootable installation thumb drive.
#### How to use it
Installing Linux and using it as an operating system is a step toward becoming familiar and familial with it. There's no wrong way to use it. You might discover must-have features you never knew you needed, you might learn more about computers than you ever imagined you could, and you may shift in your worldview. Or you might use a Linux desktop because it was easy to download and install, or because you want to cut out the middleman of some corporate overlord, or because it helps you get your work done.
Whatever your reason, just give Linux a try with any (or all) of these options.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/ways-get-started-linux
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 (Penguins gathered together in the Artic)
[2]: https://opensource.com/article/19/6/what-linux-user
[3]: https://opensource.com/sites/default/files/uploads/freeshell.png (Free shell screenshot)
[4]: https://freeshell.de
[5]: https://blinkenshell.org/wiki/Start
[6]: https://sdf.org/
[7]: https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-in-windows-insiders/
[8]: https://opensource.com/sites/default/files/uploads/porteus.jpg (Porteus Linux)
[9]: https://opensource.com/article/19/6/tiny-linux-distros-you-have-try
[10]: http://porteus.org
[11]: https://getfedora.org/en/workstation/download/
[12]: https://opensource.com/sites/default/files/uploads/linux_tour.jpg (Linux tour screenshot)
[13]: http://tour.ubuntu.com/en/#
[14]: https://opensource.com/sites/default/files/uploads/jslinux.jpg (JSLinux)
[15]: https://www.qemu.org
[16]: https://bellard.org/jslinux/
[17]: https://opensource.com/article/19/1/tech-books-new-skils
[18]: http://www.lulu.com/shop/hazel-russman/the-charm-of-linux/paperback/product-21229401.html
[19]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4-case.jpg (Raspberry Pi 4)
[20]: https://opensource.com/resources/raspberry-pi
[21]: https://www.raspberrypi.org/
[22]: https://opensource.com/article/19/3/raspberry-pi-projects
[23]: https://opensource.com/article/19/3/piflash
[24]: https://opensource.com/article/19/3/gamepad-raspberry-pi
[25]: https://opensource.com/life/16/3/make-music-raspberry-pi-milkytracker
[26]: https://opensource.com/resources/cloud
[27]: https://opensource.com/article/19/6/how-ssh-running-container
[28]: https://linuxcontainers.org/lxd/try-it/
[29]: https://opensource.com/article/18/11/behind-scenes-linux-containers
[30]: https://virtualbox.org
[31]: https://opensource.com/sites/default/files/uploads/fedora-silverblue.png (Fedora Silverblue)

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
@ -122,7 +122,7 @@ via: https://fedoramagazine.org/command-line-quick-tips-permissions/
作者:[Paul W. Frields][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,56 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (From BASIC to Ruby: Life lessons from first programming languages on Command Line Heroes)
[#]: via: (https://opensource.com/19/7/command-line-heroes-ruby-basic)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
From BASIC to Ruby: Life lessons from first programming languages on Command Line Heroes
======
Find out more about why BASIC is a beloved first language and how the
next generation will learn to code.
![Listen to the Command Line Heroes Podcast][1]
The second episode of this [Command Line Heroes][2] season 3 drops today and it sent me back through a nostalgic look at the idea of first programming languages.
### Languages affect accessibility
This episode taught me that BASIC was a huge leap in the democratization of computer comprehension. It's hard for me to imagine a time when computers were scarce, but that not-so-distant past was when BASIC changed the world. As [Saron Yitbarek][3] mentions, "In the early days of programming, you pretty much needed a Ph.D. to do anything." BASIC was such a monumental leap with its focus on usability (beginner-friendly commands) and resource sharing (timesharing of a single computer). It helped programming get beyond the "computer jocks" of the time (I love that phrase from the episode) and helped a new generation of people participate. The barrier of entry dropped.
### First programming languages
The heart of this episode rests on the topic of learning the first language. There is so much advice out there about what to learn and how to learn it. Quite a lot has been written on the subject [on here][4]. I love hearing Saron's story of Ruby being her introduction, and how it was fun in an almost unexpected way. I had a similar experience as I dug into Ruby for a few projects. It's wildly flexible in a way that makes me happy. It's that happiness that keeps me coming back to it when I'm in a pinch, and there's something powerful about how languages can be so emotionally charged.
I first experienced programming with HTML and CSS, but the first heavy-duty language was Java. I will never forget being told on day one of class to memorize **public static void main** without any context on what it meant. We took a good bit of that semester to explore what it in the context of object-oriented programming, but it never made me feel as excited as when I iterate over a list using **.each** in Ruby or **import numpy** and do some mathematical magic in Python. Then I hear about how kids are learning to program with Python for [Minecraft][5] or visual programming languages like [Scratch][6] and I am inspired. The legacy of BASIC lives on in new ways. 
Which leads to my takeaways from this episode: 
* Remember that no one is born a programmer. Everyone starts with no background. You're not alone there.
* Learn a language. Any of them. Choose the one that brings you the most joy if you have the luxury of choosing.
* Don't forget that all languages are there to build something. Create meaningful things for humans.
Command Line Heroes will cover programming languages for all of season 3. [Subscribe here to learn everything you want to know about the origin of programming languages][2], and I would love to hear your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://opensource.com/19/7/command-line-heroes-ruby-basic
作者:[Matthew Broberg][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/mbbroberg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ep1_blog-header-520x292_lgr.png?itok=I8IS1hkt (Listen to the Command Line Heroes Podcast)
[2]: https://www.redhat.com/en/command-line-heroes
[3]: https://twitter.com/saronyitbarek
[4]: /article/17/1/choosing-your-first-programming-language
[5]: /life/15/5/getting-started-minecraft-pi
[6]: /education/11/6/how-teach-next-generation-open-source-scratch

View File

@ -1,183 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Pipx Install And Run Python Applications In Isolated Environments)
[#]: via: (https://www.ostechnix.com/pipx-install-and-run-python-applications-in-isolated-environments/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Pipx Install And Run Python Applications In Isolated Environments
======
![][1]
It is always recommended to install Python applications in Virtual Environments to avoid conflicts with one another. **Pip package manager** helps us to install Python applications in an isolated environments, using two tools namely **venv** and **virtualenv**. There is also another Python package manager named [**“Pipenv”**][2], which is recommended by Python.org, to install Python applications. Unlike Pip, Pipenv automatically creates virtual environments by default. Meaning you dont need to manually create virtual environments for your projects anymore. Today, I stumbled upon a similar tool named **“Pipx”** , a free and open source utility that allows you to install and run Python applications in an isolated virtual environments.
Using Pipx, we can easily install thousands of Python applications hosted in **PyPI** without much hassle. Good thing is you can do everything with regular user permissions. You need not to be “root” user or need not to have “sudo” permissions. It is worth mentioning that **Pipx can run a program from temporary environment** , without having to install it. This will be handy when you test multiple versions of same program often. The packages installed with Pipx can be listed, upgrade or uninstalled at any time. Pipx is a cross-platform application, so it can run on Linux, Mac OS and Windows.
### Install Pipx
**Python 3.6+** , **Pip** and **venv** module are required to install pipx. Make sure you have installed them as described in the following guide.
* [**How To Manage Python Packages Using Pip**][3]
Here, venv is needed to create virtual environments.
Next, run the following commands to install Pipx.
```
$ python3 -m pip install --user pipx
$ python3 -m userpath append ~/.local/bin
```
The default location of pipxs binary is **~/.local/bin**. You can override this with the **PIPX_BIN_DIR** environment variable. If you override **PIPX_BIN_DIR** , just make sure it is on your path by running **userpath append $PIPX_BIN_DIR**.
And the default virtual environment location of Pipx is **~/.local/pipx**. This can be overridden with the environment variable **PIPX_HOME**.
Let us go ahead and see how to install Python applications using Pipx.
### Install And Run Python Applications In Isolated Environments Using Pipx
Here are few examples to getting started with Pipx.
##### Install Python packages
To install a Python application, for example **cowsay** , globally, run:
```
$ pipx install cowsay
```
This command will automatically create virtual environments, install the package in it and put the package executable file on your **$PATH**.
**Sample output:**
```
installed package cowsay 2.0.3, Python 3.6.8
These binaries are now globally available
- cowsay
done! ✨ 🌟 ✨
```
![1][4]
Install Python Applications Using Pipx
Let us test newly installed cowsay program:
![1][5]
Here, I have taken the examples from official site. You can install/test any other Python package of your choice.
##### List Python packages
To list all installed applications using Pipx, run:
```
$ pipx list
```
Sample output:
```
venvs are in /home/sk/.local/pipx/venvs
binaries are exposed on your $PATH at /home/sk/.local/bin
package cowsay 2.0.3, Python 3.6.8
- cowsay
```
If you have not installed any packages, you will see the following output:
```
nothing has been installed with pipx 😴
```
##### Upgrade Packages
To upgrade a package, simply do:
```
$ pipx upgrade cowsay
```
To upgrade all installed packages in one go, use:
```
$ pipx upgrade-all
```
##### Run a application from temporary virtual environments
At times, you might want to run a specific python program, but not actually install it.
```
$ pipx run pycowsay moooo
```
![1][6]
Run Python Applications In Temporary Isolated Virtual Environments
This command doesnt actually install the given program, but run it from the temporary virtual environment. You can use this command for quickly testing a python application.
You can even run .py files directly as well.
```
$ pipx run https://gist.githubusercontent.com/cs01/fa721a17a326e551ede048c5088f9e0f/raw/6bdfbb6e9c1132b1c38fdd2f195d4a24c540c324/pipx-demo.py
pipx is working!
```
##### Uninstall packages
A package can be uninstalled with command:
```
$ pipx uninstall cowsay
```
To remove all installed packages:
```
$ pipx uninstall-all
```
##### Getting help
To view help section, run:
```
$ pipx --help
```
And, thats all. If youre ever looking for a safe, convenient and reliable application to install and run Python applications, Pipx might be a good choice.
**Resource:**
* [**Pipx GitHub Repository**][7]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/pipx-install-and-run-python-applications-in-isolated-environments/
作者:[sk][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.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/pipx-720x340.png
[2]: https://www.ostechnix.com/pipenv-officially-recommended-python-packaging-tool/
[3]: https://www.ostechnix.com/manage-python-packages-using-pip/
[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/Install-Python-Applications-Using-Pipx.png
[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/Test-Python-application.png
[6]: https://www.ostechnix.com/wp-content/uploads/2019/07/Run-Python-Applications-In-Isolated-Environments.png
[7]: https://github.com/pipxproject/pipx

View File

@ -1,61 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Sysadmin vs SRE: What's the difference?)
[#]: via: (https://opensource.com/article/19/7/sysadmins-vs-sres)
[#]: author: (Vince Power https://opensource.com/users/vincepower/users/craig5/users/dawnparzych/users/penglish)
Sysadmin vs SRE: What's the difference?
======
Both sysadmins and site reliability engineers are valuable parts of any
organization. Here's a look at each role differs.
![People work on a computer server with devices][1]
In the IT world, there has always been a pull between generalist and specialist. The stereotypical sysadmin falls in the generalist category 99 times out of 100. The [site reliability engineer (SRE)][2] role is specialized, however, and grew out of the needs of one of the first companies to know real scale: Google. Ultimately, these two roles have the same goal for the applications whose infrastructure they operate: providing a good experience for the applications consumers. Yet, these roles have drastically different starting points.
### Sysadmins: Neutral good incarnate
Sysadmins typically grow into their position by starting as entry-level desktop and network support, and then over time acquiring the broad set of skills most sysadmins have in common. By that point, these sysadmins know all of the systems and applications they are responsible for. They know the app on server one needs to be restarted every other Tuesday, or the service on server nine will crash on Wednesday with no errors. They have fine-tuned their monitoring so it ignores what doesnt matter, even that error that happens on the third Sunday of the month, despite the fact that its marked as fatal.
In short, sysadmins know how to feed and care for the servers that run the core of your business. These sysadmins have grown to use automation to handle routine tasks across all the servers they manage. They love templates, golden images, and standards, but are flexible enough to make a parameter change on just the one server that has an error, and then make a note regarding why that server is now uniquely configured.
Sysadmins are great, but they have a couple of quirks. The first being that you just do not get root access without divine intervention, and that any changes they make which were not their idea have to be documented as required by the application they are working withs vendor, and then will still be double-checked.
The servers are their domain, and no one messes with their stuff.
### SREs: Thanos would be proud
As opposed to the path to becoming a sysadmin, SREs are as likely to come from a development background as a sysadmin background. The SRE position is closer to the lifecycle you find in an application development environment.
As an organization grows and introduces [DevOps][3] concepts like [continuous integration][4] and [continuous delivery][5] (CI/CD), there will often be a skills gap on how to run those immutable applications across multiple environments while having them scale to meet the businesss needs. This is the world of an SRE. Yes, a sysadmin can learn the additional tools, but at scale, this easily becomes a full-time position to keep up. A specialist makes sense.
SREs use concepts like [infrastructure-as-code][6] to produce templates, which are called to deploy the environment an application will run in, with the goal of every application and its environment being completely reproducible with the push of a button. So, app one on server one in system testing will have the exact same binaries that will be used on server fifteen in production, with the exception of environment-specific variables like passwords and database connection strings.
An SRE will also completely destroy an environment and rebuild it based on a configuration change. There is no emotional attachment to any system. Each system is just a number and is tagged and lifecycled accordingly, even to the point that routine server patching is done by redeploying the entire application stack.
### Conclusion
In certain situations, especially when operating in large DevOps-based environments, the specialized skills an SRE provides regarding how to handle any level of scale definitely offer an advantage. And every time they get stuck, they will seek out the help of their friendly neighborhood sysadmin—or [(BOFH)][7] on a bad day—for those well-honed troubleshooting skills, and the breadth of experiences which sysadmins rely on to provide value to any organization they are a part of.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/sysadmins-vs-sres
作者:[Vince Power][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/vincepower/users/craig5/users/dawnparzych/users/penglish
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices)
[2]: https://en.wikipedia.org/wiki/Site_Reliability_Engineering
[3]: https://opensource.com/resources/devops
[4]: https://en.wikipedia.org/wiki/Continuous_integration
[5]: https://en.wikipedia.org/wiki/Continuous_delivery
[6]: https://en.wikipedia.org/wiki/Infrastructure_as_code
[7]: http://www.bofharchive.com/BOFH.html

View File

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

View File

@ -0,0 +1,162 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Type Linux Commands In Capital Letters To Run Them As Sudo User)
[#]: via: (https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/)
[#]: author: (sk https://www.ostechnix.com/author/sk/)
Type Linux Commands In Capital Letters To Run Them As Sudo User
======
![Type Linux Commands In Capital Letters To Run Them As Sudo User][1]
The reason I love Linux community a lot is they create so many FUN projects which you rarely find in any other propriety operating systems. A while ago, we looked at a fun project named [**“Hollywood”**][2] which turns the Terminal into a Hollywood technical melodrama hacker interface in Ubuntu-like systems. There are few other utilities available, for example **cowsay** , **fortune** , **sl** and **toilet** (!) etc., to kill your free time and keep you entertained! They may not be useful, but these utilities are really entertaining and fun to use. Today, I stumbled upon yet another similar utility named **“SUDO”**. As the name implies, whenever you type Linux commands in capital letters, the SUDO utility will run them as sudo user! Meaning, you need not to type “sudo” in-front of the Linux commands you about to run. Cool, yeah?
### Install SUDO
* * *
**A word of caution:**
Before installing this (or any utility), take a look at the source code (Link given at the end) and see if there are suspicious/malicious code included to harm your system. Test it in a VM. If you like or found it useful, you can use it in your personal/production systems.
* * *
Git clone the SUDO repository:
```
$ git clone https://github.com/jthistle/SUDO.git
```
This command will clone the contents of SUDO GIT repository and saves them in a directory named “SUDO” in your current working directory.
```
Cloning into 'SUDO'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 42 (delta 17), reused 30 (delta 12), pack-reused 0
Unpacking objects: 100% (42/42), done.
```
Switch to SUDO directory:
```
$ cd SUDO/
```
And, install it using command:
```
$ ./install.sh
```
The command will add the following entries in your **~/.bashrc** file:
```
[...]
# SUDO - shout at bash to su commands
# Distributed under GNU GPLv2, @jthistle on github
shopt -s expand_aliases
IFS_=${IFS}
IFS=":" read -ra PATHS <<< "$PATH"
for i in "${PATHS[@]}"; do
for j in $( ls "$i" ); do
if [ ${j^^} != $j ] && [ $j != "sudo" ]; then
alias ${j^^}="sudo $j"
fi
done
done
alias SUDO='sudo $(history -p !!)'
IFS=${IFS_}
# end SUDO
```
It will also take a backup of your **~/.bashrc** and save it as **~/.bashrc.old**. You can restore it if anything goes catastrophically wrong.
Finally, update the changes using command:
```
$ source ~/.bashrc
```
### Now, type Linux Commands in Capital letters to run them as Sudo user
Usually, we execute Linux commands that requires sudo/root privileges like below.
```
$ sudo mkdir /ostechnix
```
Right? Yes! The above command will create directory named “ostechnix” in root (/). Let us cancel this command using **Ctrl+c**.
Once SUDO is installed, you can **type any Linux command in capital without sudo** and run them. So, you can run the above command like below:
```
$ MKDIR /ostechnix
$ TOUCH /ostechnix/test.txt
$ LS /ostechnix
```
![][3]
Type Linux Commands In Capital Letters To Run Them As Sudo User
Please note that **it will not bypass the sudo password**. You still need to type sudo password to execute the given command. It will only help to avoid typing “sudo” in-front of each command.
* * *
**Related read:**
* [**How To Run Particular Commands Without Sudo Password In Linux**][4]
* [**How To Restore Sudo Privileges To A User**][5]
* [**How To Grant And Remove Sudo Privileges To Users On Ubuntu**][6]
* [**How To Find All Sudo Users In Your Linux System**][7]
* [**How To Display Asterisks When You Type Password In Terminal**][8]
* [**How To Change The Sudo Prompt In Linux**][9]
* * *
Of course, typing “sudo” will take only a few seconds, so it is not a big deal. I must tell this is just fun and USELESS project to pass time. If you dont like it, go away and learn something useful. If you like it, give it a go and have fun!
**Resource:**
* [**SUDO GitHub Repository**][10]
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/
作者:[sk][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.ostechnix.com/author/sk/
[b]: https://github.com/lujun9972
[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/sudo-720x340.png
[2]: https://www.ostechnix.com/turn-ubuntu-terminal-hollywood-technical-melodrama-hacker-interface/
[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/SUDO-in-action.gif
[4]: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/
[5]: https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/
[6]: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/
[7]: https://www.ostechnix.com/find-sudo-users-linux-system/
[8]: https://www.ostechnix.com/display-asterisks-type-password-terminal/
[9]: https://www.ostechnix.com/change-sudo-prompt-linux-unix/
[10]: https://github.com/jthistle/SUDO

View File

@ -0,0 +1,64 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Certifications for DevOps engineers)
[#]: via: (https://opensource.com/article/19/7/devops-certifications)
[#]: author: (Daniel OhDominika Bula https://opensource.com/users/daniel-oh/users/vincepower/users/ftrivino/users/dominika/users/heronthecli)
Certifications for DevOps engineers
======
Establish your DevOps expertise and become more valuable in the job
marketplace with these certifications.
![Open books][1]
DevOps teams [appreciate using DevOps processes][2], especially in [multi][3]\- and [hybrid cloud][4] infrastructures, for many reasons. For one thing, [DevOps][5] breaks down barriers and enables [agile][6] software development and continuous delivery of IT operations. It is also popular in enterprises because it helps accelerate business outcomes through digital transformation.
DevOps engineers and site reliability engineers (SREs) help organizations achieve their performance objectives because they have the high-level skillsets required to use the tools that orchestrate the DevOps pipeline—from automated app builds to continuous integration, multi-stage testing, and continuous deployment on the hybrid cloud.
As agile practices and processes move deeper into enterprises, experts with the knowledge to scale the framework can become more valuable in DevOps teams and across their organizations.
### DevOps certifications to consider
A successful career in DevOps engineering requires knowledge of agile practices, excellent collaboration skills, and the ability to thrive on rapid response times. DevOps-related certifications, including the ones listed below, will strengthen your capabilities to align with market demands and demonstrate your expertise.
* [ICAgile][7] certifications demonstrate expertise in agile methodologies and practices for DevOps initiatives. Training is offered by more than 150 member organizations; the costs vary depending upon courses selected and coursework providers.
* [PMI Agile Certified Practitioner (PMI-ACP][8]) certification recognizes knowledge of agile tools and principles. Certification requires passing the PMI-ACP exam, which costs US$ 435.00 (for Project Management Institute members) or US$ 495.00 (for non-members).
* Many organizations are using the Scaled Agile Framework (SAFe) as the foundation to deliver lean software development. The [Scaled Agile Academy][9] offers multiple SAFe certifications for various professions and roles. Certification is earned based on taking specific classes and passing exams; the cost depends on which class you choose.
* Open source tools and platforms enable DevOps teams to build, deploy, and manage [Linux container][10] apps with minimal efforts. [Kubernetes][11] is a popular (and growing) platform to manage clusters of containers, and [Kubernetes certification][12] is an excellent option for sysadmins who aspire to become DevOps professionals. This expertise will also help you reduce human errors, minimize manual tasks, and eventually improve [team collaboration][13] across multiple [open organizations][14].
### Summary
These certifications will establish your DevOps credentials and help you encourage your team to embrace DevOps practices. Certification is not the end of your DevOps learning journey; rather it's the first step in becoming a DevOps professional. To keep up with the latest tools and technologies, continue to practice your skills and stay in touch with news about [DevOps trends and insights][15].
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/devops-certifications
作者:[Daniel OhDominika Bula][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/daniel-oh/users/vincepower/users/ftrivino/users/dominika/users/heronthecli
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open%20courseware.png?itok=WT_B93r5 (Open books)
[2]: https://opensource.com/article/19/5/values-devops-mindset
[3]: https://opensource.com/article/18/1/future-devops
[4]: https://opensource.com/article/17/7/hybrid-cloud
[5]: https://opensource.com/resources/devops
[6]: https://opensource.com/article/18/10/what-agile
[7]: https://www.icagile.com/
[8]: https://www.pmi.org/certifications/types/agile-acp
[9]: https://www.scaledagileacademy.com/
[10]: https://opensource.com/resources/what-are-linux-containers
[11]: https://opensource.com/resources/what-is-kubernetes
[12]: https://www.cncf.io/certification/ckad/
[13]: https://opensource.com/business/13/9/openproject-interview
[14]: https://opensource.com/open-organization/resources/open-org-definition
[15]: https://opensource.com/tags/devops

View File

@ -0,0 +1,79 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (MTTR is dead, long live CIRT)
[#]: via: (https://opensource.com/article/19/7/measure-operational-performance)
[#]: author: (Julie Gunderson https://opensource.com/users/juliegund/users/kearnsjd/users/ophir)
MTTR is dead, long live CIRT
======
By focusing on business-impacting incidents, CIRT is a more accurate way
to gauge ops performance.
![Green graph of measurements][1]
The game is changing for the IT ops community, which means the rules of the past make less and less sense. Organizations need accurate, understandable, and actionable metrics in the right context to measure operations performance and drive critical business transformation.
The more customers use modern tools and the more variation in the types of incidents they manage, the less sense it makes to smash all those different incidents into one bucket to compute an average resolution time that will represent ops performance, which is what IT has been doing for a long time.
### History and metrics
History shows that context is key when analyzing signals to prevent errors and misunderstandings. For example, during the 1980s, Sweden set up a system to analyze hydrophone signals to alert them to Russian submarines in local Sweden waters. The Swedes used an acoustic signature they thought represented a class of Russian submarines—but was actually [gas bubbles][2] released by herring when confronted by a potential predator. This misinterpretation of a metric increased tensions between the countries and almost resulted in a war.
![Funny fish cartoon][3]
Mean time to resolve (MTTR) is the main ops performance metric operations managers use to gain insight towards achieving their goals. It is an age-old measure based on systems reliability engineering. MTTR has been adopted across many industries, including manufacturing, facility maintenance, and, more recently, IT ops, where it represents the average time it takes to resolve incidents from the time they were created across a given period of time.
MTTR is calculated by dividing the time it takes to resolve all incidents (from the time of incident creation to time of resolution) by the total number of incidents.
![MTTR formula][4]
MTTR is exactly what it says: It's the average across _**all**_ incidents. MTTR smears together both high- and low-urgency incidents. It also repetitively counts each separate, ungrouped incident and results in a biased resolve time. It includes manually resolved and auto-resolved incidents in the same context. It mashes together incidents that are tabled for days (or months) after creation or are even completely ignored. Finally, MTTR includes every little transient burst (incidents that are auto-closed in under 120 seconds), which are either noisy non-issues or quickly resolved by a machine.
![Variability in incident types][5]
MTTR takes all incidents, regardless of type, throws them into a single bucket, mashes them all together, and calculates an "average" resolution time across the entire set. This overly simplistic method results in a noisy, erroneous, and misleading indication of how operations is performing.
### A new way of measuring performance
Critical incident response time (CIRT) is a new, significantly more accurate method to evaluate operations performance. PagerDuty developed the concept of CIRT, but the methodology is freely available for anyone to use.
CIRT focuses on the incidents that are most likely to impact business by culling noise from incoming signals using the following techniques:
1. Real business-impacting (or potentially impacting) incidents are very rarely low urgency, so rule out all low-urgency incidents.
2. Real business-impacting incidents are very rarely (if ever) auto-resolved by monitoring tools without the need for human intervention, so rule out incidents that were not resolved by a human.
3. Short, bursting, and transient incidents that are resolved within 120 seconds are highly unlikely to be real business-impacting incidents, so rule them out.
4. Incidents that go unnoticed, tabled, or ignored (not acknowledged, not resolved) for a very long time are rarely business-impacting; rule them out. Note: This threshold can be a statistically derived number that is customer-specific (e.g., two standard deviations above the mean) to avoid using an arbitrary number.
5. Individual, ungrouped incidents generated by separate alerts are not representative of the larger business-impacting incident. Therefore, simulate incident groupings with a very conservative threshold, e.g., two minutes, to calculate response time.
What effect does applying these assumptions have on response times? In a nutshell, a very, very large effect!
By focusing on ops performance during critical, business-impacting incidents, the resolve-time distribution narrows and shifts greatly to the left, because now it is dealing with similar types of incidents rather than all events.
Because MTTR calculates a much longer, artificially skewed response time, it is a poor indicator of operations performance. CIRT, on the other hand, is an intentional measure focused on the incidents that matter most to business.
An additional critical measure that is wise to use alongside CIRT is the percentage of responders who are acknowledging and resolving incidents. This is important, as it validates whether the CIRT (or MTTA/MTTR for that matter) is worth utilizing. For example, if an MTTR result is low, say 10 minutes, it sounds great, but if only 42% of your responders are resolving their incidents, then that number is suspect.
In summary, CIRT and the percentage of responders who are acknowledging and resolving incidents form a valuable set of metrics that give you a much better idea of how operations is performing. Gauging performance is the first step to improving performance, so these new measures are key to achieving continuous cycles of measurable improvement for your organization.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/measure-operational-performance
作者:[Julie Gunderson][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/juliegund/users/kearnsjd/users/ophir
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements)
[2]: http://blogfishx.blogspot.com/2014/05/herring-fart-to-communicate.html
[3]: https://opensource.com/sites/default/files/uploads/fish.png (Funny fish cartoon)
[4]: https://opensource.com/sites/default/files/uploads/mttr.png (MTTR formula)
[5]: https://opensource.com/sites/default/files/uploads/incidents.png (Variability in incident types)

View File

@ -0,0 +1,364 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Understanding software design patterns)
[#]: via: (https://opensource.com/article/19/7/understanding-software-design-patterns)
[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/erezhttps://opensource.com/users/brson)
Understanding software design patterns
======
Design patterns help eliminate redundant coding. Learn how to use the
singleton pattern, factory pattern, and observer pattern using Java.
![clouds in the sky with blue pattern][1]
If you are a programmer or a student pursuing computer science or a similar discipline, sooner or later, you will encounter the term "software design pattern." According to Wikipedia, _"a [software design pattern][2] is a general, reusable solution to a commonly occurring problem within a given context in software design."_ Here is my take on the definition: When you have been working on a coding project for a while, you often begin to think, "Huh, this seems redundant. I wonder if I can change the code to be more flexible and accepting of changes?" So, you begin to think about how to separate what stays the same from what needs to change often.
> A **design pattern** is a way to make your code easier to change by separating the part that stays the same and the part that needs constant changes.
Not surprisingly, everyone who has worked on a programming project has probably had the same thought. Especially for any industry-level project, where it's common to work with dozens or even hundreds of developers; the collaboration process suggests that there have to be some standards and rules to make the code more elegant and adaptable to changes. That is why we have [object-oriented programming][3] (OOP) and [software framework tools][4]. A design pattern is somewhat similar to OOP, but it goes further by considering changes as part of the natural development process. Basically, the design pattern leverages some ideas from OOP, like abstractions and interfaces, but focuses on the process of changes.
When you start to work on a project, you often hear the term _refactoring_, which means _to change the code to be more elegant and reusable;_ this is where the design pattern shines. Whenever you're working on existing code (whether built by someone else or your past self), knowing the design patterns helps you begin to see things differently—you will discover problems and ways to improve the code.
There are numerous design patterns, but three popular ones, which I'll present in this introductory article, are singleton pattern, factory pattern, and observer pattern.
### How to follow this guide
I want this tutorial to be as easy as possible for anyone to understand, whether you are an experienced programmer or a beginner to coding. The design pattern concept is not exactly easy to understand, and reducing the learning curve when you start a journey is always a top priority. Therefore, in addition to this article with diagrams and code pieces, I've also created a [GitHub repository][5] you can clone and run the code to implement the three design patterns on your own. You can also follow along with the following [YouTube video][6] I created.
#### Prerequisites
If you just want to get the idea of design patterns in general, you do not need to clone the sample project or install any of the tools. However, to run the sample code, you need to have the following installed:
* **Java Development Kit (JDK):** I highly recommend [OpenJDK][7].
* **Apache Maven:** The sample project is built using [Apache Maven][8]; fortunately, many IDEs come with Maven installed.
* **Interactive development editor (IDE):** I use [IntelliJ Community Edition][9], but you can use [Eclipse IDE][10] or any other Java IDE of your choice
* **Git:** If you want to clone the project, you need a [Git][11] client.
To clone the project and follow along, run the following command after you install Git:
```
`git clone https://github.com/bryantson/OpensourceDotComDemos.git`
```
Then, in your favorite IDE, you can import the code in the TopDesignPatterns repo as an Apache Maven project.
I am using Java, but you can implement the design pattern using any programming language that supports the [abstraction principle][12].
### Singleton pattern: Avoid creating an object every single time
The [singleton pattern][13] is a very popular design pattern that is also relatively simple to implement because you need just one class. However, many developers debate whether the singleton design pattern's benefits outpace its problems because it lacks clear benefits and is easy to abuse. Few developers implement singleton directly; instead, programming frameworks like Spring Framework and Google Guice have built-in singleton design pattern features.
But knowing about singleton is still tremendously useful. The singleton pattern makes sure that a class is created only once and provides a global point of access to it.
> **Singleton pattern:** Ensures that only one instantation is created and avoids creating multiple instances of the same object.
The diagram below shows the typical process for creating a class object. When the client asks to create an object, the constructor creates, or instantiates, an object and returns to the class with the caller method. However, this happens every single time an object is requested—the constructor is called, a new object is created, and it returns with a unique object. I guess the creators of the OOP language had a reason behind creating a new object every single time, but the proponents of the singleton process say this is redundant and a waste of resources.
![Normal class instantiation][14]
The following diagram creates the object using the singleton pattern. Here, the constructor is called only when the object is requested the first time through a designated getInstance() method. This is usually done by checking the null value, and the object is saved inside the singleton class as a private field value. The next time the getInstance() is called, the class returns the object that was created the first time. No new object is created; it just returns the old one.
![Singleton pattern instantiation][15]
The following script shows the simplest possible way to create the singleton pattern:
```
package org.opensource.demo.singleton;
public class OpensourceSingleton {
    private static OpensourceSingleton uniqueInstance;
    private OpensourceSingleton() {
    }
    public static OpensourceSingleton getInstance() {
        if (uniqueInstance == null) {
            uniqueInstance = new OpensourceSingleton();
        }
        return uniqueInstance;
    }
}
```
On the caller side, here is how the singleton class will be called to get an object:
```
Opensource newObject = Opensource.getInstance();
```
This code demonstrates the idea of a singleton well:
1. When getInstance() is called, it checks whether the object was already created by checking the null value.
2. If the value is null, it creates a new object, saves it into the private field, and returns the object to the caller. Otherwise, it returns the object that was created previously.
The main problem with this singleton implementation is its disregard for parallel processes. When multiple processes using threads access the resource simultaneously, a problem occurs. There is one solution to this, and it is called _double-checked locking_ for multithread safety, which is shown here:
```
package org.opensource.demo.singleton;
public class ImprovedOpensourceSingleton {
    private volatile static ImprovedOpensourceSingleton uniqueInstance;
    private ImprovedOpensourceSingleton() {}
    public static ImprovedOpensourceSingleton getInstance() {
        if (uniqueInstance == null) {
            synchronized (ImprovedOpensourceSingleton.class) {
                if (uniqueInstance == null) {
                    uniqueInstance = new ImprovedOpensourceSingleton();
                }
            }
        }
        return uniqueInstance;
    }
}
```
Just to emphasize the previous point, make sure to implement your singleton directly only when you believe is a safe option to do so. The best way is to leverage the singleton feature is by using a well-made programming framework.
### Factory pattern: Delegate object creation to the factory class to hide creation logic
The [factory pattern][16] is another well-known design pattern, but it is a little more complex. There are several ways to implement the factory pattern, but the following sample code demonstrates the simplest possible way. The factory pattern defines an interface for creating an object but lets the subclasses decide which class to instantiate.
> **Factory pattern:** Delegates object creation to the factory class so it hides the creation logic.
The diagram below shows how the simplest factory pattern is implemented.
![Factory pattern][17]
Instead of the client directly calling the object creation, the client asks the factory class for a certain object, type x. Based on the type, the factory pattern decides which object to create and to return.
In this code sample, OpensourceFactory is the factory class implementation that takes the _type_ from the caller and decides which object to create based on that input value:
```
package org.opensource.demo.factory;
public class OpensourceFactory {
    public OpensourceJVMServers getServerByVendor([String][18] name) {
        if(name.equals("Apache")) {
            return new Tomcat();
        }
        else if(name.equals("Eclipse")) {
            return new Jetty();
        }
        else if (name.equals("RedHat")) {
            return new WildFly();
        }
        else {
            return null;
        }
    }
}
```
And OpenSourceJVMServer is a 100% abstraction class (or an interface class) that indicates what to implement, not how:
```
package org.opensource.demo.factory;
public interface OpensourceJVMServers {
    public void startServer();
    public void stopServer();
    public [String][18] getName();
}
```
Here is a sample implementation class for OpensourceJVMServers. When "RedHat" is passed as the type to the factory class, the WildFly server is created:
```
package org.opensource.demo.factory;
public class WildFly implements OpensourceJVMServers {
    public void startServer() {
        [System][19].out.println("Starting WildFly Server...");
    }
    public void stopServer() {
        [System][19].out.println("Shutting Down WildFly Server...");
    }
    public [String][18] getName() {
        return "WildFly";
    }
}
```
### Observer pattern: Subscribe to topics and get notified about updates
Finally, there is the [observer pattern][20]_._ Like the singleton pattern, few professional programmers implement the observer pattern directly. However, many messaging queue and data service implementations borrow the observer pattern concept. The observer pattern defines one-to-many dependencies between objects so that when one object changes state, all of its dependents are notified and updated automatically.
> **Observer pattern:** Subscribe to the topics/subjects where the client can be notified if there is an update.
The easiest way to think about the observer pattern is to imagine a mailing list where you can subscribe to any topic, whether it is open source, technologies, celebrities, cooking, or anything else that interests you. Each topic maintains a list of its subscribers, which is equivalent to an "observer" in the observer pattern. When a topic is updated, all of its subscribers (observers) are notified of the changes. And a subscriber can always unsubscribe from a topic.
As the following diagram shows, the client can be subscribed to different topics and add the observer to be notified about new information. Because the observer listens continuously to the subject, the observer notifies the client about any change that occurs.
![Observer pattern][21]
Let's look at the sample code for the observer pattern, starting with the subject/topic class:
```
package org.opensource.demo.observer;
public interface Topic {
    public void addObserver([Observer][22] observer);
    public void deleteObserver([Observer][22] observer);
    public void notifyObservers();
}
```
This code describes an interface for different topics to implement the defined methods. Notice how an observer can be added, removed, or notified.
Here is an example implementation of the topic:
```
package org.opensource.demo.observer;
import java.util.List;
import java.util.ArrayList;
public class Conference implements Topic {
    private List&lt;Observer&gt; listObservers;
    private int totalAttendees;
    private int totalSpeakers;
    private [String][18] nameEvent;
    public Conference() {
        listObservers = new ArrayList&lt;Observer&gt;();
    }
    public void addObserver([Observer][22] observer) {
        listObservers.add(observer);
    }
    public void deleteObserver([Observer][22] observer) {
        int i = listObservers.indexOf(observer);
        if (i &gt;= 0) {
            listObservers.remove(i);
        }
    }
    public void notifyObservers() {
        for (int i=0, nObservers = listObservers.size(); i &lt; nObservers; ++ i) {
            [Observer][22] observer = listObservers.get(i);
            observer.update(totalAttendees,totalSpeakers,nameEvent);
        }
    }
    public void setConferenceDetails(int totalAttendees, int totalSpeakers, [String][18] nameEvent) {
        this.totalAttendees = totalAttendees;
        this.totalSpeakers = totalSpeakers;
        this.nameEvent = nameEvent;
        notifyObservers();
    }
}
```
This class defines the implementation of a particular topic. When a change happens, this implementation is where it is invoked. Notice that this takes the number of observers, which is stored as the list, and can both notify and maintain the observers.
Here is an observer class:
```
package org.opensource.demo.observer;
public interface [Observer][22] {
    public void update(int totalAttendees, int totalSpeakers, [String][18] nameEvent);
}
```
This class defines an interface that different observers can implement to take certain actions.
For example, the observer implementation can print out the number of attendees and speakers at a conference:
```
package org.opensource.demo.observer;
public class MonitorConferenceAttendees implements [Observer][22] {
    private int totalAttendees;
    private int totalSpeakers;
    private [String][18] nameEvent;
    private Topic topic;
    public MonitorConferenceAttendees(Topic topic) {
        this.topic = topic;
        topic.addObserver(this);
    }
    public void update(int totalAttendees, int totalSpeakers, [String][18] nameEvent) {
        this.totalAttendees = totalAttendees;
        this.totalSpeakers = totalSpeakers;
        this.nameEvent = nameEvent;
        printConferenceInfo();
    }
    public void printConferenceInfo() {
        [System][19].out.println(this.nameEvent + " has " + totalSpeakers + " speakers and " + totalAttendees + " attendees");
    }
}
```
### Where to go from here?
Now that you've read this introductory guide to design patterns, you should be in a good place to pursue other design patterns, such as facade, template, and decorator. There are also concurrent and distributed system design patterns like the circuit breaker pattern and the actor pattern.
However, I believe it's best to hone your skills first by implementing these design patterns in your side projects or just as practice. You can even begin to contemplate how you can apply these design patterns in your real projects. Next, I highly recommend checking out the [SOLID principles][23] of OOP. After that, you will be ready to look into the other design patterns.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/understanding-software-design-patterns
作者:[Bryant Son][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/brsonhttps://opensource.com/users/erezhttps://opensource.com/users/brson
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern)
[2]: https://en.wikipedia.org/wiki/Software_design_pattern
[3]: https://en.wikipedia.org/wiki/Object-oriented_programming
[4]: https://en.wikipedia.org/wiki/Software_framework
[5]: https://github.com/bryantson/OpensourceDotComDemos/tree/master/TopDesignPatterns
[6]: https://www.youtube.com/watch?v=VlBXYtLI7kE&feature=youtu.be
[7]: https://openjdk.java.net/
[8]: https://maven.apache.org/
[9]: https://www.jetbrains.com/idea/download/#section=mac
[10]: https://www.eclipse.org/ide/
[11]: https://git-scm.com/
[12]: https://en.wikipedia.org/wiki/Abstraction_principle_(computer_programming)
[13]: https://en.wikipedia.org/wiki/Singleton_pattern
[14]: https://opensource.com/sites/default/files/uploads/designpatterns1_normalclassinstantiation.jpg (Normal class instantiation)
[15]: https://opensource.com/sites/default/files/uploads/designpatterns2_singletonpattern.jpg (Singleton pattern instantiation)
[16]: https://en.wikipedia.org/wiki/Factory_method_pattern
[17]: https://opensource.com/sites/default/files/uploads/designpatterns3_factorypattern.jpg (Factory pattern)
[18]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
[19]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system
[20]: https://en.wikipedia.org/wiki/Observer_pattern
[21]: https://opensource.com/sites/default/files/uploads/designpatterns4_observerpattern.jpg (Observer pattern)
[22]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+observer
[23]: https://en.wikipedia.org/wiki/SOLID

View File

@ -0,0 +1,193 @@
[#]: collector: (lujun9972)
[#]: translator: (martin2011qi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What is POSIX? Richard Stallman explains)
[#]: via: (https://opensource.com/article/19/7/what-posix-richard-stallman-explains)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
What is POSIX? Richard Stallman explains
======
Discover what's behind the standards for operating system compatibility
from a pioneer of computer freedom.
![Scissors cutting open access to files][1]
What is [POSIX][2], and why does it matter? It's a term you've likely seen in technical writing, but it often gets lost in a sea of techno-initialisms and jargon-that-ends-in-X. I emailed Dr. [Richard Stallman][3] (better known in hacker circles as RMS) to find out more about the term's origin and the concept behind it.
Richard Stallman says "open" and "closed" are the wrong way to classify software. Stallman classifies programs as _freedom-respecting_ ("free" or "libre") and _freedom-trampling_ ("non-free" or "proprietary"). Open source discourse typically encourages certain practices for the sake of practical advantages, not as a moral imperative.
The free software movement, which Stallman launched in 1984, says more than _advantages_ are at stake. Users of computers _deserve_ control of their computing, so programs denying users control are an injustice to be rejected and eliminated. For users to have control, the program must give them the [four essential freedoms][4]:
* The freedom to run the program as you wish, for any purpose (freedom 0).
* The freedom to study how the program works and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
* The freedom to redistribute copies so you can help others (freedom 2).
* The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.
### About POSIX
**Seth:** The POSIX standard is a document released by the [IEEE][5] that describes a "portable operating system." As long as developers write programs to match this description, they have produced a POSIX-compliant program. In the tech industry, we call this a "specification" or "spec" for short. That's mostly understandable, as far as tech jargon goes, but what makes an operating system "portable"?
**RMS:** I think it was the _interface_ that was supposed to be portable (among systems), rather than any one _system_. Indeed, various systems that are different inside do support parts of the POSIX interface spec.
**Seth:** So if two systems feature POSIX-compliant programs, then they can make assumptions about one another, enabling them to know how to "talk" to one another. I read that it was you who came up with the name "POSIX." How did you come up with the term, and how was it adopted by the IEEE?
**RMS:** The IEEE had finished developing the spec but had no concise name for it. The title said something like "portable operating system interface," though I don't remember the exact words. The committee put on "IEEEIX" as the concise name. I did not think that was a good choice. It is ugly to pronounce—it would sound like a scream of terror, "Ayeee!"—so I expected people would instead call the spec "Unix."
Since [GNU's Not Unix][6], and it was intended to replace Unix, I did not want people to call GNU a "Unix system." I, therefore, proposed a concise name that people might actually use. Having no particular inspiration, I generated a name the unclever way: I took the initials of "portable operating system" and added "ix." The IEEE adopted this eagerly.
**Seth:** Does "operating system" in the POSIX acronym refer only to Unix and Unix-like systems such as GNU, or is the intent to encompass all operating systems?
**RMS:** The term "operating system," in the abstract, covers systems that are not at all like Unix, not at all close to the POSIX spec. However, the spec is meant for systems that are a lot like Unix; only such systems will fit the POSIX spec.
**Seth:** Are you involved in reviewing or updating the current POSIX standards?
**RMS:** Not now.
**Seth:** The GNU Autotools toolchain does a lot to make applications easier to port, at least in terms of when it comes time to build and install. Is Autotools an important part of building a portable infrastructure?
**RMS:** Yes, because even among systems that follow POSIX, there are lots of little differences. The Autotools make it easier for a program to adapt to those differences. By the way, if anyone wants to help in the development of the Autotools, please email me.
**Seth:** I imagine, way back when GNU was just starting to make people realize that a (not)Unix liberated from proprietary technology was possible, there must have been a void of clarity about how free software could possibly work together.
**RMS:** I don't think there was any void or any uncertainty. I was simply going to follow the interfaces of BSD.
**Seth:** Some GNU applications are POSIX-compliant, while others have GNU-specific features either not in the POSIX spec or lack features required by the spec. How important is POSIX compliance to GNU applications?
**RMS:** Following a standard is important to the extent it serves users. We do not treat a standard as an authority, but rather as a guide that may be useful to follow. Thus, we talk about following standards rather than "complying" with them. See the section [Non-GNU Standards][7] in the GNU Coding Standards.
We strive to be compatible with standards on most issues because, on most issues, that serves users best. But there are occasional exceptions.
For instance, POSIX specifies that some utilities measure disk space in units of 512 bytes. I asked the committee to change this to 1K, but it refused, saying that a bureaucratic rule compelled the choice of 512. I don't recall much attempt to argue that users would be pleased with that decision.
Since GNU's second priority, after users' freedom, is users' convenience, we made GNU programs measure disk space in blocks of 1K by default.
However, to defend against potential attacks by competitors who might claim that this deviation made GNU "noncompliant," we implemented optional modes that follow POSIX and ISO C to ridiculous extremes. For POSIX, setting the environment variable POSIXLY_CORRECT makes programs specified by POSIX list disk space in terms of 512 bytes. If anyone knows of a case of an actual use of POSIXLY_CORRECT or its GCC counterpart **\--pedantic** that provides an actual benefit to some user, please tell me about it.
**Seth:** Are POSIX-compliant free software projects easier to port to other Unix-like systems?
**RMS:** I suppose so, but I decided in the 1980s not to spend my time on porting software to systems other than GNU. I focused on advancing the GNU system towards making it unnecessary to use any non-free software and left the porting of GNU programs to non-GNU-like systems to whoever wanted to run them on those systems.
**Seth:** Is POSIX important to software freedom?
**RMS:** At the fundamental level, it makes no difference. However, standardization by POSIX and ISO C surely made the GNU system easier to migrate to, and that helped us advance more quickly towards the goal of liberating users from non-free software. That was achieved in the early 1990s, when Linux was made free software and then filled the kernel-shaped gap in GNU.
### GNU innovations adopted by POSIX
I also asked Dr. Stallman whether any GNU-specific innovations or conventions had later become adopted as a POSIX standard. He couldn't recall specific examples, but kindly emailed several developers on my behalf.
Developers Giacomo Catenazzi, James Youngman, Eric Blake, Arnold Robbins, and Joshua Judson Rosen all responded with memories of previous POSIX iterations as well as ones still in progress. POSIX is a "living" standard, so it's being updated and reviewed by industry professionals continuously, and many developers who work on GNU projects propose the inclusion of GNU features.
For the sake of historical interest, here' are some popular GNU features that have made their way into POSIX.
#### Make
Some GNU **Make** features have been adopted into POSIX's definition of **make**. The relevant [specification][8] provides detailed attribution for features borrowed from existing implementations.
#### Diff and patch
Both the **[diff][9]** and **[patch][10]** commands have gotten **-u** and **-U** options added directly from GNU versions of those tools.
#### C library
Many features of the GNU C library, **glibc**, have been adopted in POSIX. Lineage is sometimes difficult to trace, but James Youngman wrote:
> "I'm pretty sure there are a number of features of ISO C which were pioneered by GCC. For example, **_Noreturn** is new in C11, but GCC-1.35 had this feature (one used the **volatile** modifier on a function declaration). Also—though I'm not certain about this—GCC-1.35 supported Arrays of Variable Length which seem to be very similar to modern C's conformant arrays."
Giacomo Catenazzi cites the Open Group's [**strftime** article][11], pointing to this attribution: "This is based on a feature in some versions of GNU libc's **strftime()**."
Eric Blake notes that the **getline()** and various ***_l()** locale-based functions were definitely pioneered by GNU.
Joshua Judson Rosen adds to this, saying he clearly remembers being impressed by the adoption of **getline** functions after witnessing strangely familiar GNU-like behavior from code meant for a different OS entirely.
"Wait…that's GNU-specific… isn't it? Oh—not anymore, apparently."
Rosen pointed me to the [**getline** man page][12], which says:
> Both **getline()** and **getdelim()** were originally GNU extensions. They were standardized in POSIX.1-2008.
Eric Blake sent me a list of other extensions that may be added in the next POSIX revision (codenamed Issue 8, currently due around 2021):
* [ppoll][13]
* [pthread_cond_clockwait et al.][14]
* [posix_spawn_file_actions_addchdir][15]
* [getlocalename_1][16]
* [reallocarray][17]
### Userspace extensions
POSIX doesn't just define functions and features for developers. It defines standard behavior for userspace as well.
#### ls
The **-A** option is used to exclude the **.** (representing the current location) and **..** (representing the opportunity to go back one directory) notation from the results of an **ls** command. This was adopted for POSIX 2008.
#### find
The **find** command is a useful tool for ad hoc [**for** loops][18] and as a gateway into [parallel][19] processing.
A few conveniences made their way from GNU to POSIX, including the **-path** and **-perm** options.
The **-path** option lets you filter search results matching a filesystem path pattern and was available in GNU's version of **find** since before 1996 (the earliest record in **findutil**'s Git repository). James Youngman notes that [HP-UX][20] also had this option very early on, so whether it's a GNU or an HP-UX innovation (or both) is uncertain.
The **-perm** option lets you filter search results by file permission. This was in GNU's version of **find** by 1996 and arrived later in the POSIX standard "IEEE Std 1003.1, 2004 Edition."
The **xargs** command, part of the **findutils** package, had a **-p** option to put **xargs** into an interactive mode (the user is prompted whether to continue or not) by 1996, and it arrived in POSIX in "IEEE Std 1003.1, 2004 Edition."
#### Awk
Arnold Robbins, the maintainer of GNU **awk** (the **gawk** command in your **/usr/bin** directory, probably the destination of the symlink **awk**), says that **gawk** and **mawk** (another GPL **awk** implementation) allow **RS** to be a regular expression, which is the case when **RS** has a length greater than 1. This isn't a feature in POSIX yet, but there's an [indication that it will be][21]:
> _The undefined behavior resulting from NULs in extended regular expressions allows future extensions for the GNU gawk program to process binary data._
>
> _The unspecified behavior from using multi-character RS values is to allow possible future extensions based on extended regular expressions used for record separators. Historical implementations take the first character of the string and ignore the others._
This is a significant enhancement because the **RS** notation defines a separator between records. It might be a comma or a semicolon or a dash or any such character, but if it's a _sequence_ of characters, then only the first character is used unless you're working in **gawk** or **mawk**. Imagine parsing a document of IP addresses with records separated by an ellipsis (three dots in a row), only to get back results parsed at every dot in every IP address.
**[Mawk][22]** supported the feature first, but it was without a maintainer for several years, leaving **gawk** to carry the torch. (**Mawk** has since gained a new maintainer, so arguably credit can be shared for pushing this feature into the collective expectation.)
### The POSIX spec
In general, Giacomo Catenzzi points out, "…because GNU utilities were used so much, a lot of other options and behaviors were aligned. At every change in shell, Bash is used as comparison (as a first-class citizen)." There's no requirement to cite GNU or any other influence when something is rolled into the POSIX spec, and it can safely be assumed that influences to POSIX come from many sources, with GNU being only one of many.
The significance of POSIX is consensus. A group of technologists working together toward common specifications to be shared by hundreds of uncommon developers lends strength to the greater movement toward software independence and developer and user freedom.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2 (Scissors cutting open access to files)
[2]: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/
[3]: https://stallman.org/
[4]: https://www.gnu.org/philosophy/free-sw.en.html
[5]: https://www.ieee.org/
[6]: http://gnu.org
[7]: https://www.gnu.org/prep/standards/html_node/Non_002dGNU-Standards.html
[8]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
[9]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html
[10]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/patch.html
[11]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
[12]: http://man7.org/linux/man-pages/man3/getline.3.html
[13]: http://austingroupbugs.net/view.php?id=1263
[14]: http://austingroupbugs.net/view.php?id=1216
[15]: http://austingroupbugs.net/view.php?id=1208
[16]: http://austingroupbugs.net/view.php?id=1220
[17]: http://austingroupbugs.net/view.php?id=1218
[18]: https://opensource.com/article/19/6/how-write-loop-bash
[19]: https://opensource.com/article/18/5/gnu-parallel
[20]: https://www.hpe.com/us/en/servers/hp-ux.html
[21]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
[22]: https://invisible-island.net/mawk/

View File

@ -0,0 +1,170 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Use BleachBit to Optimize Ubuntu Linux)
[#]: via: (https://itsfoss.com/use-bleachbit-ubuntu/)
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
How to Use BleachBit to Optimize Ubuntu Linux
======
[BleachBit][1] is a cross-platform, free and [open source tool for helping you get rid of junk files][2] on your machine. It is powerful and easy to use, allowing you to not only delete junk files, but also to shred and wipe files. This is useful for keeping your keeping system clean and organized, as well as offering you well-deserved privacy.
In this article, Im going to guide you through the installation process and show you how to make basic usage of BleachBit, while also including screenshots where needed.
![][3]
**Note:** _Ill be using_ _**Ubuntu**_*, but the steps are similar for most Linux distributions.*
### Installing BleachBit on Ubuntu
The simplest way to install BleachBit is using the package manager or the software. Here you can search for **BleachBit** and when you find it, click on it and then press **Install**. Removing it is as simple as searching for it again and pressing **Remove**.
![BleachBit in Ubuntu Software Center][4]
If you are terminal lover, you can [use apt command][5] to install BleachBit:
```
sudo apt install bleachbit -y
```
However, this wont install the latest version of BleachBit. At the time of writing this article, the [Ubuntu repositories][6] contain version 2.0, while the latest version is 2.2.
To get the latest version, you first of all have to go to the [official download page][7]:
![BleachBit Download Page][8]
Here, download the right package for your system (in my case its **Ubuntu 18.04 LTS**) by clicking on the corresponding link. It will download a .deb file. [Installing packages from deb files][9] is simple. Simply double click on it and it will run in the software center. Just click on install here.
### Using BleachBit to clean your system
Search for BleachBit and clcik on the **bleachbit** icon in the **Applications Menu**:
![Bleachbit In Applications Menu][10]
**Note:** _To run **BleachBit** with administrator privileges, click on the second icon (**BleachBit as Administrator/root)**._
Either of this methods should open up the **start screen**:
![BleachBit Start Screen][11]
This is the **Preferences** menu and you can open it up at any time by clicking **Edit &gt; Prefrences**.
[][12]
Suggested read  Top 5 CAD Software Available for Linux
Some **important options** include:
* **Overwrite contents of files to prevent recovery**: although slower, this will actually **shred** your files. Files are normally marked as deleted and allowed to be overwritten if there isnt any space left. However, selecting this options will fill the space with junk (that will still act as a deleted file), making the shredded file irrecoverable. Keep in mind that this process is slower.
* **Languages**: here you can choose which languages to keep (although they dont really take up that much space).
* **Drives:** in this sub-menu you can add directories where all free space should be replaced with junk (as when shredding files), making sure no file can be recovered from those locations.
Closing the **Preferences** menu will leave you in the **Main Menu**:
![BleachBit Menu][13]
On the **left side**, you can select what type of files you want to delete (this includes system-wide files and application-specific files). Some of them require **administrator privileges** (such as APT cache and System-related options), and some of them will prompt warnings (such as Firefox warning you that your saved passwords will be deleted).
After making your selection, I suggest clicking on the **Preview** (the magnifying glass icon). This will show you exactly what is going to be deleted:
![BleachBit Preview][14]
By pressing **Clean** (the red circle), you are going to start the deleting process. Youll get a message when **BleachBit** finishes:
![BleachBit Clean][15]
Another thing you can do is **quickly shred** or **wipe** a specific directory or file:
![BleachBit Quick Shred][16]
### Using BleachBit in command line
You can also use BleachBit in the terminal. To **list cleaners** run:
```
bleachbit -l
```
This will produce output in the vein of:
```
...
thunderbird.index
thunderbird.passwords
thunderbird.vacuum
transmission.blocklists
transmission.history
transmission.torrents
tremulous.cache
vim.history
vlc.mru
vuze.backup_files
vuze.cache
vuze.logs
vuze.tmp
warzone2100.logs
wine.tmp
winetricks.temporary_files
x11.debug_logs
xine.cache
yum.clean_all
yum.vacuum
...
```
Now you can run any cleaner or group of cleaners. For example:
```
bleachbit -c google_chrome* thunderbird.passwords
```
This command will delete all Google Chrome saved data and all saved Thunderbird passwords.
The CLI is useful because you can write bash scripts that execute BleachBit commands and you can even schedule cleaning actions using tools such as CRON.
[][17]
Suggested read  Use Evernote on Linux with These Tools
**Wrapping Up**
There are [ways to clean up Ubuntu][18] but having a dedicated GUI tool is always handy. Whether you are simply looking for a neat way to keep your system clean of any unnecessary data, optimizing your machine, or trying to keep your personal details safe, **BleachBit** is a tool that will surely come in handy, being so easy to get the hang of (while still being powerful).
Do you use any system cleaner? If so, which one and how? Let us know in the comments!
--------------------------------------------------------------------------------
via: https://itsfoss.com/use-bleachbit-ubuntu/
作者:[Sergiu][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/sergiu/
[b]: https://github.com/lujun9972
[1]: https://www.bleachbit.org/
[2]: https://itsfoss.com/ccleaner-alternatives-ubuntu-linux/
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/how_to_use_bleachbit_to_optimize_ubuntu-e1563200895890-800x450.png?resize=800%2C450&ssl=1
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_ubuntu_software_center.png?fit=800%2C369&ssl=1
[5]: https://itsfoss.com/apt-command-guide/
[6]: https://itsfoss.com/ubuntu-repositories/
[7]: https://www.bleachbit.org/download/linux
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_download_page.png?fit=800%2C455&ssl=1
[9]: https://itsfoss.com/install-deb-files-ubuntu/
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_in_applications_menu.jpg?fit=800%2C276&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_start_screen.png?fit=800%2C656&ssl=1
[12]: https://itsfoss.com/cad-software-linux/
[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_menu.png?fit=800%2C659&ssl=1
[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_preview.png?fit=800%2C650&ssl=1
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_clean.png?fit=800%2C653&ssl=1
[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/bleachbit_shred.png?fit=800%2C435&ssl=1
[17]: https://itsfoss.com/evernote-on-linux/
[18]: https://itsfoss.com/free-up-space-ubuntu-linux/

View File

@ -0,0 +1,75 @@
[#]: collector: (lujun9972)
[#]: translator: (WangYueScream)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Introducing kids to computational thinking with Python)
[#]: via: (https://opensource.com/article/19/2/break-down-stereotypes-python)
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
利用 Python 引导孩子的计算机思维
========================
编程可以给低收入家庭的学生提供足够的技能,信心和知识,进而让他们摆脱因为家庭收入低带来的经济和社会地位上的劣势。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_kid_education.png?itok=3lRp6gFa)
尽管暑假期间底特律公共图书馆的[帕克曼分部][1]挤满了无聊的孩子并且占用了所有的电脑,图书馆工作人员并不觉得这会是个问题,反而更多是一个机会。他们成立一个名为 [Parkman Coders][2] 的编程社团,社团以 [Qumisha Goss][3] 为首,她是图书管理员,也负责利用 Python 的魔力引导弱势儿童的计算机思维。
四年前 [Qumisha Goss][3] 刚发起 Parkman Coders 计划的时候, “Q” 并不是太懂编程。之后她通过努力成为图书馆里教学和技术方面的专家和 Raspberry Pi 认证讲师。
社团最开始采用 [Scratch][4] 教学但很快学生就对这种图形化的块编程感到乏味他们觉得这就是个“婴儿玩具”。Q 坦言,“我们意识到是时候需要在课程内容这方面做些改变了,如果是为了维持课程内容对初学者的友好性继续选择 Scratch 教学,这无疑会影响孩子们后期继续保持对编程的关注。”因此,她开始教授孩子们 Python。
Q 是在 [Code.org][5] 平台玩地牢骷髅怪物这个关卡的时候第一次接触到 Python。她最开始是通过 [Python Programming: An Introduction to Computer Science][6] 和 [Python for Kids][7] 这两本书学习 Python。她也推荐 [Automate the Boring Stuff with Python][8] 和 [Lauren Ipsum: A Story about Computer Science and Other Improbable Things][9] 这两本书。
### 建立一个基于 Raspberry Pi 的创客空间
Q 决定使用 [Raspberry Pi][10] 电脑来避免学生可能会因为自己的不当操作对图书馆的电脑造成损害,而且这些电脑因为便携性等问题也不方便用来构建组成一个创客空间。[Raspberry Pi][10] 的购买价格加上它的灵活性和便携性包括生态圈里面的一些适合教学的自由免费软件,让大家更能感受到她的决策的可行性和可靠性。
虽然图书馆发起 [Parkman Coders][2] 社区计划的本意是通过努力创造一个吸引孩子们的学习空间进而维持图书馆的平和,但社区发展的很快,很受大家欢迎以至于这座建立于 1921 的大楼的空间,电脑和插座都不够用了。他们最开始是 20 个孩子共享 10 台 [Raspberry Pi][10] 来进行授课,但后来图书馆陆续收到了来自个人和公司比如 Microsoft4H和 Detroit Public Library Foundation 的资金援助从而能够购买更多设备以支撑社区的进一步壮大发展。
目前,大概有 40 个孩子参加了每节课程而且图书馆也有了足够的 [Raspberry Pi][10] 让参与者人手一台设备甚至还可以分发出去。鉴于不少 [Parkman Coders][2] 的参与者来自于低收入家庭,图书馆也能提供别人捐赠的 Chromebooks 给他们使用。
Q 说,“当孩子们的表现可以证明他们能够很好的使用 [Raspberry Pi][10] 或者 [Microbit][11] 而且定期来参加课程,我们也会提供设备允许他们可以带回家练习。但即便这样也还是会遇到很多问题,比如他们在家无法访问网络或者没有显示器,键盘,鼠标等外设。”
### 利用 Python 学习生存技能,打破束缚
Q 说,“我认为教授孩子们计算机科学的主要目的是让他们学会批判性思考和解决问题的能力。我希望随着孩子们长大成人,不管他们选择在哪个领域继续发展他们的未来,这些经验教训都会一直伴随他们成长。此外,我也希望这个课程能够激发孩子们对创造的自豪感。能够清楚的意识到‘这是我做的’是一种很强烈很有用的感受。而且一旦孩子们越早能够有这种成功的体验,我相信未来的路上他们都会满怀热情迎接新的挑战而不是逃避。”
她继续分享道,“在学习编程的过程中,你不得不对单词的拼写和大小写高度警惕。受限于孩子年龄,有时候阅读认知会是个大问题。为了确保课程受众的包容性,我们会在授课过程中大声拼读,同样我们也会极力鼓励孩子们大声说出他们不知道的或者不能正确拼写的单词,以便我们纠正。”
Q 也会尝试尽力去给需要帮助的孩子们更多的关注。她解释道,“如果我确认有孩子遇到困难不能跟上我们的授课进度,我们会尝试在课下时间安排老师辅导帮助他,但还是会允许他们继续参加编程。我们想到帮助到他们而不是让他们因为挫败而沮丧的不在参与进来。”
最重要的是, [Parkman Coders][2] 计划所追求的是能够帮助每个孩子认识到每个人都会有独特的技能和能力。参与进来的大部分孩子都是非裔美国人一半是女孩。Q 直言,“我们所生活在的这个世界,我们成长的过程中,伴随着各种各种的社会偏见,这些都常常会限制我们对自己所能达到的成就的准确认知。”她坚信孩子们需要一个没有偏见的空间,“他们可以尝试很多新事物,不会因为担心犯错责骂而束手束脚,可以放心大胆的去求知探索。”
Q 和 [Parkman Coders][2] 计划所营造的环境氛围能够帮助到参与者摆脱低家庭收入带来的劣势。如果说社区能够发展壮大到今天的规模真有什么独特秘诀的话那大概就是Q 解释道,“确保你有一个令人舒适的空间,充满了理解与宽容,这样大家才会被吸引过来。让来的人不忘初心,做好传道受业解惑的准备;当大家参与进来并感觉到充实愉悦,自然而然会想要留下来。”
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/2/break-down-stereotypes-python
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[WangYueScream](https://github.com/WangYueScream)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://detroitpubliclibrary.org/locations/parkman
[2]: https://www.dplfound.org/single-post/2016/05/15/Parkman-Branch-Coders
[3]: https://www.linkedin.com/in/qumisha-goss-b3bb5470
[4]: https://scratch.mit.edu/
[5]: http://Code.org
[6]: https://www.amazon.com/Python-Programming-Introduction-Computer-Science/dp/1887902996
[7]: https://nostarch.com/pythonforkids
[8]: https://automatetheboringstuff.com/
[9]: https://nostarch.com/laurenipsum
[10]: https://www.raspberrypi.org/
[11]: https://microbit.org/guide/

View File

@ -1,103 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (GraveAccent)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5G will augment Wi-Fi, not replace it)
[#]: via: (https://www.networkworld.com/article/3399978/5g-will-augment-wi-fi-not-replace-it.html)
[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/)
5G 会增强 Wi-Fi而不是取代它
======
Aruba 战略和企业发展副总裁 Jeff Lipton 为 5G 炒作增添了一些干货,讨论了它和 Wi-Fi 如何协同工作以及如何最大化两者的价值。
![Thinkstock][1]
可以说没有技术主题比 [5G][2] 更热。 这是最近 [移动世界大会][3] 节目的一个主题,并且已经在其他活动中占据了主导地位,例如 Enterprise Connect 和我参加的几乎所有供应商活动。
一些供应商将 5G 定位为解决所有网络问题的灵丹妙药,并预测它将消除所有其他形式的网络。 像这样的观点显然是极端的,但我相信 5G 会对网络行业产生影响,网络工程师应该意识到这一点。
为了帮助为5G炒作带来一些现实感我最近采访了一家惠普公司 Aruba 的战略和企业发展副总裁 Jeff Lipton因为我知道惠普已经深入参与了 5G 和 Wi-Fi 的发展。
**[ 另见:[5G 时代几乎已经来了][3] ]**
### Zeus Kerravala: 5G 被吹捧为“下一件大事”。你是这样看的吗?
**Jeff Lipton:** 接下来的重点是连接“事物”并从这些事物中产生可操作的见解和背景。5G 是服务于这一趋势的技术之一。Wi-Fi 6 是另一个还有边缘计算蓝牙低功耗BLE人工智能AI和机器学习ML。这一切都很重要全都有自己的用武之地。
### 你是否在企业中看到 5G 的风头盖过 Wi-Fi
![Jeff Lipton, VP of strategy and corporate development, Aruba][4]
**Lipton:** 与所有蜂窝接入一样,如果你需要宏观区域覆盖和高速切换,使用 5G 是合适的。但对于大多数企业级应用程序而言,它通常不需要这些功能。从性能角度来看,[Wi-Fi 6][5] 和 5G 在大多数指标上大致相等包括吞吐量延迟可靠性和连接密度。它们并不相似的地方在经济方面Wi-Fi要好得多。我不认为很多客户愿意用 Wi-Fi 交换 5G除非他们需要宏观覆盖或高速切换。
### Wi-Fi 和 5G 可以共存吗? 企业如何一起使用 5G 和 Wi-Fi
**Lipton:** Wi-Fi 和 5G 可以并且应该是互补的。 5G 架构将蜂窝核心和无线接入网络RAN分离。 因此Wi-Fi 可以是企业无线电前端,并与 5G 核心紧密连接。 由于 Wi-Fi 的经济性 - 特别是 Wi-Fi 6 - 是有利的并且性能非常好,我们设想许多服务提供商在有可行的地方使用 Wi-Fi 作为其 5G 系统的无线电前端充当分布式天线DAS和小型蜂窝系统的替代。
“Wi-Fi 和 5G 可以并且应该是互补的。” — Jeff Lipton
### 如果一个企业打算完全转向 5G那将如何实现以及它的实用性如何
**Lipton:** 为了将 5G 用于主要的室内访问,客户需要升级其网络和几乎所有设备。 5G 在室外提供良好的覆盖,但蜂窝信号不能可靠地穿透建筑物。 5G 会使这个问题变得更糟,因为它部分依赖于更高频率的无线电。因此,服务提供商需要一种提供室内覆盖的方法。为了提供这种覆盖,他们会部署 DAS 或小型蜂窝系统 - 由终端客户支付。然后,客户将他们的设备直连到这些蜂窝系统,并为每个设备支付服务合同。
**[[上 PluralSight 学习移动设备管理课程,了解如何在不降低用户体验的情况下保护公司中的设备。][6]]**
这种方法存在一些问题。首先DAS 和小型蜂窝系统比 Wi-Fi 网络贵得多。 并且成本不会因网络而停止。 每台设备都需要一台 5G 蜂窝调制解调器,批发价格高达数十美元,而终端用户通常需要花费一百多美元。 由于目前很少或者没有 MacBook、PC、打印机、AppleTV 有 5G 调制解调器,因此需要对这些设备进行升级。我不相信很多企业会愿意支付这笔额外费用并升级他们的大部分设备以获得不明确的好处。
### 经济是 5G 与 Wi-Fi 之争的一个要素吗?
**Lipton:** 经济始终是一个要素。让我们将对话集中在室内企业级应用程序上,因为这是一些运营商打算用 5G 定位的用例。 我们已经提到升级到 5G 将要求企业部署昂贵的 DAS 或小型蜂窝系统用于室内覆盖,几乎将所有设备升级到包含 5G 调制解调器,并为每个设备支付服务合同。理解 5G 蜂窝网络和 DAS 系统在许可频谱上运行也很重要,这类似于私人高速公路。 服务提供商为此频谱支付了数十亿美元,这笔费用需要货币化并嵌入服务成本中。 因此从部署和生命周期的角度来看Wi-Fi 在经济上比 5G 有利。
### 5G 与 Wi-Fi 有任何安全隐患吗?
**Lipton:** 一些人认为蜂窝技术比Wi-Fi更安全但事实并非如此。LTE 相对安全但也有弱点。例如普渡大学和爱荷华大学的研究人员表示LTE 容易受到一系列攻击包括数据拦截和设备跟踪。5G 通过多种认证方法和更好的密钥管理改进了 LTE 安全性。
Wi-Fi 的安全性也没有停滞不前而是继续发展。当然,不遵循最佳实践的 Wi-Fi 实现,例如那些甚至没有基本密码保护的实现,并不是最佳的。但那些配置了适当的访问控制和密码的人是非常安全的。 随着新标准 - 特别是 WPA3 和增强开放Enhanced Open - Wi-Fi网络安全性进一步提高。
同样重要的是要记住,企业已根据其特定需求对安全性和合规性解决方案进行了大量投资。对于包括 5G 在内的蜂窝网络,企业将失去部署所选安全性和合规性解决方案的能力,以及对流量流的大多数可见性。 虽然 5G 的未来版本将通过称为网络切片的功能提供高级别的自定义,但企业仍将失去他们目前需要和拥有的安全性和合规性定制级别。
### 关于 5G 与 Wi-Fi 之间的讨论有什么最后的想法?
**Lipton:** 围绕 Wi-Fi 与 5G 的争论忽略了这一点。它们都有自己的用武之地而且它们在很多方面都是互补的。由于需要连接和分析越来越多的东西Wi-Fi 和 5G 市场都将增长。如果客户需要宏覆盖或高速切换,并且可以为这些功能支付额外成本,那么 5G 是可行的。
5G 也适用于客户需要物理网络分段的某些工业用例。但对于绝大多数企业客户而言Wi-Fi 将继续像现在一样证明自己作为可靠,安全且经济高效的无线接入技术的价值。
**更多关于 802.11ax (Wi-Fi 6):**
* [为什么 802.11ax 是无线网络的下一件大事][7]
* [FAQ: 802.11ax Wi-Fi][8]
* [Wi-Fi 6 (802.11ax) 正在来到你附件的路由器][9]
* [带有 OFDMA 的 Wi-Fi 6 打开了一个全新的无线可能性世界][10]
* [802.11ax 预览:支持 Wi-Fi 6 的接入点和路由器随时可用][11]
加入 [Facebook][12] 和 [LinkedIn][13] 上的 network world 社区,评论你认为最重要的话题。
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3399978/5g-will-augment-wi-fi-not-replace-it.html
作者:[Zeus Kerravala][a]
选题:[lujun9972][b]
译者:[GraveAccent](https://github.com/graveaccent)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Zeus-Kerravala/
[b]: https://github.com/lujun9972
[1]: https://images.idgesg.net/images/article/2019/05/wireless_connection_speed_connectivity_bars_cell_tower_5g_by_thinkstock-100796921-large.jpg
[2]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html
[3]: https://www.networkworld.com/article/3354477/mobile-world-congress-the-time-of-5g-is-almost-here.html
[4]: https://images.idgesg.net/images/article/2019/06/headshot_jlipton_aruba-100798360-small.jpg
[5]: https://www.networkworld.com/article/3215907/why-80211ax-is-the-next-big-thing-in-wi-fi.html
[6]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture
[7]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html
[8]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html
[9]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html
[10]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html
[11]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html
[12]: https://www.facebook.com/NetworkWorld/
[13]: https://www.linkedin.com/company/network-world

View File

@ -1,85 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (PandaWizard)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (What is DevSecOps?)
[#]: via: (https://opensource.com/article/19/1/what-devsecops)
[#]: author: (Brett Hunoldt https://opensource.com/users/bretthunoldtcom)
什么是 DevSecOps
======
DevSecOps 的实践之旅开始于 DevSecOps 授权,启用和培养。下面就介绍如何开始学习使用 DevSecOps。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devop.png?itok=Yicb2nnZ)
> Stephen Streichsbier 说过: DevSecOps 使得组织可以用 DevOps 的速度发布内在安全的软件。
DevSecOps 是一场关于 DevOps 概念实践或艺术形式的变革。为了更好理解 DevSecOps你应该首先理解 DevOps 的含义。
DevOps 起源于通过合并开发和运维实践,消除隔离,统一关注点,提升团队和产品的效率和性能。它是一种注重构建容易维持和易于平常自动运营维护产品和服务的新型协作方式。
安全在很多团队中都是常见的隔离点。安全的核心关注点是保护团队,而有时这也意味着生成延缓新服务或是新产品发布的障碍或是策略,用于保障任何事都能被很好的理解和安全的执行,并且没有给团队带来不必要的风险。
**[[点击下载 DevSecOps 的引导手册]][1]**
因为安全方面的明显特征和它可能带来的摩擦,开发和运维有时会避开或是满足客观的安全要求。在一些公司,这种隔离形成了一种产品安全完全是安全团队责任的期望,并取决于安全团队去寻找产品的安全缺陷或是可能带来的问题。
DevSecOps 看起来是通过给开发或是运维角色加强或是建立安全意识,或是在产品团队中引入一个安全工程师角色,在产品设计中找到安全问题,从而把安全要求汇聚在 Devops 中。
这样使得公司能更快发布和更新产品,并且充分相信安全已经嵌入产品中。
### 坚固的软件哪里适用 DevSecOps
建造坚固的软件是 DevOps 文化的一个层面而不是一个特别的实践,它完善和增强了 DevSecops 的实践。想想一款坚固的软件就像是某些经历过残酷战斗过程的事物。
有必要指出坚固的软件并不是 100% 安全可靠的(虽然它可能最终是在某些方面)。然而,它被设计成可以处理大部分被抛过来的问题。
践行坚固软件最重要的原则是促进竞争,实践,可控的失败与合作。
### 你如何开始学习 DevSecOps
开始实践 DevSecOps 涉及提升安全需求和在开发过程中最早期可能的阶段实践。它最终在公司文化上提升了安全的重要性,使得安全成为所有人的责任,而并不只是安全团队的责任。
你可能在团队中听说过“左上升”这个词,如果你把开发周期包括产品变革的的关键时期线放平在一条横线上,从初始化到设计,建造,测试以及最终的运行。安全的目的就是今早的参与进来。这使得风险可以在设计中能更好的评估、交流和减轻。“左提升”的含义是指促使安全能在开发周期线上更往左走。
这篇入门文章有三个关键要素:
* 授权
* 启用
* 培养
授权,在我看来,是关于释放控制权以及使得团队做出独立决定而不用害怕失败或影响(理性分析)。这个过程的唯一告诫信息就是要严格的做出明智的决定(不要比这更低要求)。
为了实现授权,商务和行政支持(通过内部销售,展示来建立,通过建立矩阵来 展示这项投资的回报)是打破历史障碍和分割的团队的关键。合并安全人员到开发和运维团队中,提升交流和透明度透明度有助于 DevSecOps 的开始之旅。
这次整合和移动使得团队只关注单一的结果:打造一个他们共同负责的产品,让开发和安全人员相互依赖合作。这将引领你们共同走向授权。这是产品研发团队的共同责任,并保证每个可分割的产品都保持其安全性。
启用涉及正确的使用掌握在团队手中的工具和资源。这是准备建立一种通过论坛、维基、信息聚合的知识分享文化。
打造一种注重自动化、重复任务应该编码来尽可能减少以后的操作并增强安全性。这种场景不仅仅是提供知识,而是让这种知识能够通过多种渠道和媒介(通过某些工具)可获取,以便它可以被团队或是个人以他喜欢的方式去消化和分享。一种工具可以更好的实现当团队成员正在编码而另一组成员正在来的路上。让工具简单可用和让团队可以使用它们。
不同的 DevSecOps 团队有不同的喜好,因此允许它们尽可能的保持独立。这是一种微笑平衡的练习,因为你真的很想在经济规模和能力中分享产品。在选择中协作参与并更新工具方法有助于减少使用中的障碍。
最后,也可能是最重要的, DevSecOps 是有关训练和兴趣打造。聚会、社交或是组织中通常的报告会都是很棒的方式让同事们教学和分享他们的知识。有时,这些高光的被分享的挑战、关注点或是一些其他人没有关注到的风险。分享和教学也是一种高效的学习和指导团队的方法。
在我个人经验中,每个团队的文化都是独一无二的,因此你不能用“一种尺寸适合所有”的方法。走进你的团队并找到他们想要使用的工具方法。尝试不同的论坛和聚会并找出最适用于你们文化的方式。寻找反馈并询问团队如何工作,他们喜欢什么以及对应的原因。适应和学习,保持乐观,不要停止尝试,你们将会有所收获。
[下载 DevSecOps 的入门手册][1]
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/1/what-devsecops
作者:[Brett Hunoldt][a]
选题:[lujun9972][b]
译者:[PandaWizard](https://github.com/PandaWizard)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/bretthunoldtcom
[b]: https://github.com/lujun9972
[1]: https://opensource.com/downloads/devsecops

View File

@ -0,0 +1,139 @@
MX Linux: 一款专注于简洁性的发行版
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux.png?itok=OLjmCxT9)
Linux 有着如此多种的发型版。许多发行版为了使自己与众不同而做出了很多改变。另一方面,许多发行版之间的区别又是如此之小,你可能会问为什么有人还愿意不厌其烦的重复别人已经做过的工作呢?也正是基于这一疑惑,让我好奇为什么 [antiX][1] 和 [MEPIS][2]这两个社区要联合推出一个特殊的发行版,考虑到具体情况应该会是一个搭载 Xfce 桌面并基于 antiX 的版本,由 MEPIS 社区承担开发。
这一开发中的使用 Xfce 桌面的 antiX 系统是否会基于他之前的发行版呢毕竟antiX 旨在提供一个“快速、轻量级、易于安装的、支持linux live CD 且基于Debian Stable的发行版”。antiX 所搭载的桌面是 [LXDE][3],能够极好的满足关于轻量化系统的相关要求和特性。那究竟是什么原因使得 antiX 决定构建另一个轻量化发行版呢,仅仅是因为这次换成了 Xfce 吗好吧Linux 社区中的任何人都知道,差异之处体现了不同版本的特性,一个好的轻量级发行版是值得一试的(特别是可以使得我们的旧硬件摆脱进入垃圾填埋场的宿命)。当然LXDE 和 Xfce 并不完全属于同一类别。LXDE应该被认为是一个真正的轻量级桌面而 Xfce 应该被认为是一个中等重量的桌面。朋友们,这就是为什么 MX Linux 是 antiX 的一个重要迭代的关键。一个基于Debian的中等体量的发行版它包含你完成工作所需的所有工具。
但是在 MX linux 中有一些直接从 antiX 借用来的非常有用的东西—那就是安装工具。当我第一次设置VirtualBox 的虚拟机来安装 MX Linux 时我认为安装将是我已经习惯的典型的、非常简单的Linux安装。令我非常惊讶的是MX Linux 使用的 antiX 安装程序打破了以往的痛点,特别是对于那些对尝试 Linux 持观望态度的人来说。
因此,甚至在我开始尝试 MX Linux 之前,我就对它有了深刻的印象。让我们来看看是什么让这个发行版的安装如此特别,最后再来看看桌面。
你可以从[这里][4]下载 MX Linux 17.1。系统的最低要求是:
* CD/DVD驱动器(以及能够从该驱动器引导的BIOS)或活动USB(以及能够从USB引导的BIOS)
* 英特尔 i486 或 AMD 处理器
* 512 MB 内存
* 5 GB 硬盘空间
* 扬声器AC97 或 HDA-compatible 声卡
* 作为一个 LiveUSB 使用,需要 4 GB 空间
### 安装
MX Linux安装程序使安装 Linux 变得轻而易举。虽然它可能不是外观最现代化的安装工具,但也已经差不多了。安装的要点是从选择磁盘和选择安装类型开始的(图1)。
![install][6]
图1:MX Linux 的安装程序截图之一。
[Used with permission][7]
下一个重要的界面(图2)要求你为MS网络设置一个计算机名称、域名和(如果需要的话)工作组。
配置工作组的能力是真正值得称赞的第一项。这是我记忆中第一款在安装期间提供此选项的发行版。它还应该提示你MX Linux 提供了开箱即用共享目录的功能。它做到了,而且深藏功与名。它并不完美,但它可以在不需要安装任何额外包的情况下工作(稍后将详细介绍)。
最后一个重要的安装界面(需要用户交互)是创建用户帐户和 root 权限的密码(图3)。
![user][9]
图3:设置用户帐户详细信息和 root 用户密码。
[Used with permission][7]
最后一个界面设置完成后安装将完成并要求重新启动。重启后你将看到登录屏幕。登录并享受MX Linux 带来的体验。
### 使用
Xfce桌面是一个非常容易上手的界面。默认设置将面板位于屏幕的左边缘(图4)。
![desktop ][11]
图4: MX Linux 的默认桌面。
[Used with permission][7]
如果你想将面板移动到更传统的位置,右键单击面板上的空白点,然后单击面板>面板首选项。在生成的窗口中(图5),单击样式下拉菜单,在桌面栏、垂直栏或水平栏之间进行选择你想要的模式。
![panel][13]
图5:配置 MX Linux 面板。
[Used with permission][7]
桌面栏和垂直选项的区别在于,在桌面栏模式下,面板垂直对齐,就像在垂直模式下一样,但是插件是水平放置的。这意味着你可以创建更宽的面板(用于宽屏布局)。如果选择水平布局,它将默在顶部,然后你必须取消锁定面板,单击关闭,然后(使用面板左侧边缘的拖动手柄)将其拖动到底部。你可以回到面板设置窗口并重新锁定面板。
除此之外,使用 Xfce 桌面对于任何级别的用户来说都是无需动脑筋的事情……就是这么简单。你会发现很多生产力代表的软件(LibreOffice, Orage日历,PDF-Shuffler)、图像软件(GIMP)、通信(Firefox,Thunderbird,HexChat),多媒体(Clementine、guvcview SMTube, VLC媒体播放器),和一些 MX Linux 专属的工具(称为MX工具,涵盖了 live-USB 驱动器制作工具,包管理工具,repo 管理工具,回购经理,live ISO 快照工具,等等)。
![sharing][15]
图6:向网络共享一个目录。
[Used with permission][7]
### Samba
让我们讨论一下如何将文件夹共享到你的网络。正如我所提到的,你不需要安装任何额外的包就可以使其正常工作。只需打开文件管理器,右键单击任何位置,并选择网络上的共享文件夹。系统将提示你输入管理密码(已在安装期间设置)。验证成功之后Samba服务器配置工具将打开(图6)。
![sharing][17]
图7在MX Linux上配置共享。
[Used with permission][7]
单击+按钮并配置你的共享。你将被要求指定一个目录,为共享提供一个名称/描述,然后决定该共享是否可写且可见(图7)。
当你单击 Access 选项时,你可以选择是让每个人都访问共享,还是限于特定的用户。问题就出在这里。此时,没有用户可以共享。为什么?因为它们还没有被添加。,有两种方法可以把它们添加到共享:从命令行或使用我们已经打开的工具。让我们用一种更为简单的方法。在Samba服务器配置工具的主窗口中单击Preferences > Samba Users。在弹出的窗口中单击 Add user。
将出现一个新窗口(图8)你需要从下拉框中选择用户输入Windows用户名并为用户键入/重新键入密码。
![Samba][19]
图8:向 Samba 添加用户。
[Used with permission][7]
一旦你单击确定,用户将被添加,并且基于你的网络的对用户的共享功能也随之启用。创建 Samba 共享从未变得如此容易。
### 结论
MX Linux 使任何从桌面操作系统转到 Linux 都变得非常简单。尽管有些人可能会觉得桌面界面不太现代但发行版的主要关注点不是美观而是简洁。为此MX Linux 以出色的方式取得了成功。Linux 的这种特性可以让任何人在使用 Linux 的过程中感到宾至如归。尝试这一中等体量的发行版,看看它能否作为你的日常系统。
从Linux 基金会和 edX 的[“Linux入门”][20]课程了解更多关于Linux的知识。
--------------------------------------------------------------------------------
via: https://www.linux.com/learn/intro-to-linux/2018/4/mx-linux-mid-weight-distro-focused-simplicity
作者:[JACK WALLEN][a]
译者:[qfzy1233](https://github.com/qfzy1233)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/jlwallen
[1]:https://antixlinux.com/
[2]:https://en.wikipedia.org/wiki/MEPIS
[3]:https://lxde.org/
[4]:https://mxlinux.org/download-links
[5]:/files/images/mxlinux1jpg
[6]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux_1.jpg?itok=i9bNScjH (install)
[7]:/licenses/category/used-permission
[8]:/files/images/mxlinux3jpg
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux_3.jpg?itok=ppf2l_bm (user)
[10]:/files/images/mxlinux4jpg
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/mxlinux_4.jpg?itok=mS1eBy9m (desktop)
[12]:/files/images/mxlinux5jpg
[13]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_5.jpg?itok=wsN1hviN (panel)
[14]:/files/images/mxlinux6jpg
[15]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_6.jpg?itok=vw8mIp9T (sharing)
[16]:/files/images/mxlinux7jpg
[17]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_7.jpg?itok=tRIWdcEk (sharing)
[18]:/files/images/mxlinux8jpg
[19]:https://www.linux.com/sites/lcom/files/styles/floated_images/public/mxlinux_8.jpg?itok=ZS6lhZN2 (Samba)
[20]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (hopefully2333)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
@ -7,28 +7,28 @@
[#]: via: (https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
How to Manually Install Security Updates on Debian/Ubuntu?
如何在 Debian/Ubuntu 上手动安装安全更新?
======
Installing a package in Linux from command line is a simple task.
在 Linux 上通过命令行安装一个包程序是一件简单的事。
In a single command or combining of multiple commands could make you to complete your task easily.
在一行命令中组合使用多个命令能让你更加简单地完成任务。
The same can be done for security updates as well.
安全更新也同样如此。
In this tutorial, we will show you how to check available security update and install them on Debian based systems such as Ubuntu, LinuxMint, etc,.
在这个教程里面,我们会向你展示如何查看可用的安全更新,以及如何在 UbuntuLinuxMint 等等这些基于 Debian 的系统中安装它们。
It can be done using three methods. All these methods are described in this article in details.
有三种方法可以完成这件事,下面会详细地描述这三种方法。
As a Linux administrator, you should keep your system up-to-date, that makes your system more secure. It protects your system against unwanted attack.
作为一个 Linux 管理员,你应该让你的系统保持为最新,这会让你的系统更安全,保护你的系统抵抗意想不到的攻击。
If you are not able to patch entire system with all updates due to some application dependency. At-least, you should install only security patches to make your system 100% compliance.
如果你因为一些应用的依赖问题不能解决,导致不能给所有的系统进行全部更新。那至少,你应该打上安全补丁来让你的系统 100% 符合要求。
### How to Install unattended-upgrades package in Debian/Ubuntu?
### 如何在 Debian/Ubuntu 上安装 unattended-upgrades
By default `unattended-upgrades` package should be installed on your system. But in case if its not installed use the following command to install it.
默认情况下,你的系统上应该是已经安装了 unattended-upgrades 包的。但是如果你的系统没有装这个包,那么请使用下面的命令来安装它。
Use **[APT-GET Command][1]** or **[APT Command][2]** to install unattended-upgrades package.
使用 **[APT-GET 命令][1]** 或者 **[APT 命令][2]** 来安装 unattended-upgrades 包.
```
$ sudo apt-get install unattended-upgrades
@ -36,13 +36,13 @@ or
$ sudo apt install unattended-upgrades
```
### Method-1: How to Check if any Security Updates are available in Debian/Ubuntu?
### 方法一:如何检查 Debian/Ubuntu 中是否有任何可用的安全更新?
Its always a good practice to check list of available security updates before performing the patch installation. It will give you the list of packages that are going to be updated in your system.
在进行补丁安装之前,检查可用安全更新列表始终是一个好习惯。它会为你提供将在你的系统中进行更新的软件包的列表。
**Whats dry run?** Most of the Linux commands have a dry run option, which stimulate the actual output but nothing will be downloaded or installed.
**什么是试运行?** 大多数的 Linux 命令都有一个试运行选项,它会给出实际的输出但不会下载或安装任何东西。
To do so, you need to add `--dry-run` option with unattended-upgrades command.
为此,你需要在 unattended-upgrades 命令中添加 --dry-run 选项。
```
$ sudo unattended-upgrade --dry-run -d
@ -101,21 +101,21 @@ vim-tiny
xxd
```
If the above command output says **“No packages found that can be upgraded unattended and no pending auto-removals”** in the Terminal, this implies your System is up-to-date.
如果在终端里,上面的命令输出说 **“No packages found that can be upgraded unattended and no pending auto-removals”** , 这意味着你的系统已经是最新的了。
### How to Install available Security Updates in Debian/Ubuntu?
### 如何在 Debian/Ubuntu 中安装可用的安全更新?
If your got any package updates in the above command output. Then run the following command to install them.
如果你在上面的命令输出中获得了任意的软件包更新,就运行下面的命令来安装它们。
```
$ sudo unattended-upgrade -d
```
Alternatively this can be done from apt-get command. Its bit tricky. However, i would suggest users to go with first option.
除此之外,你也可以使用 apt-get 命令来进行安装。但是这个方法有点棘手,我会建议用户用第一个选项。
### Method-2: How to Check if any Security Updates are available in Debian/Ubuntu Using apt-get Command?
### 方法二:如何使用 apt-get 命令在 Debian/Ubuntu 中检查是否有可用的安全更新?
Run the following command to check list of available security updates in your Debian/Ubuntu system
在你的 Debian/Ubuntu 系统中运行下面的命令来查看可用安全更新的列表。
```
$ sudo apt-get -s dist-upgrade | grep "^Inst" | grep -i securi
@ -160,19 +160,19 @@ Inst gcc [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, U
Inst g++ [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64])
```
### How to Install available Security Updates in Debian/Ubuntu Using apt-get Command?
### 如何使用 apt-get 命令在 Debian/Ubuntu 系统中安装可用的安全更新?
If you found any package updates in the above output. Finally run the following command to install them.
如果你在上面命令的输出中发现任何的软件包更新。就运行下面的命令来安装它们。
```
$ sudo apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs apt-get install
```
Alternatively this can be done from apt command. Its bit tricky. However, i would suggest users to go with first option.
除此之外,也可以使用 apt 命令来完成。但是这个方法有点棘手,我会建议用户用第一个选项。
### Method-3: How to Check if any Security Updates are available in Debian/Ubuntu Using apt Command?
### 方法三:如何使用 apt 命令在 Debian/Ubuntu 系统中检查是否有可用的安全更新?
Run the following command to check list of available security updates in your Debian/Ubuntu system
在 Debian/Ubuntu 系统中运行下面的命令来查看可用安全更新的列表。
```
$ sudo apt list --upgradable | grep -e "-security"
@ -217,15 +217,15 @@ vim-tiny/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 [upgradable
xxd/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 [upgradable from: 2:8.0.1453-1ubuntu1]
```
### How to Install available Security Updates in Debian/Ubuntu Using apt Command?
### 如何在 Debian/Ubuntu 系统中使用 apt 命令来安装可用的安全更新?
If you found any package updates in the above output. Finally run the following command to install them.
如果你在上面命令的输出中发现任何的软件包更新。就运行下面的命令来安装它们。
```
$ sudo apt list --upgradable | grep -e "-security" | awk -F "/" '{print $1}' | xargs apt install
```
Also, the following file will give you the packages update count.
同样,下面的文件也会告诉你更新包的总数。
```
$ sudo cat /var/lib/update-notifier/updates-available
@ -240,7 +240,7 @@ via: https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[hopefully2333](https://github.com/hopefully2333)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,184 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 ways to get started with Linux)
[#]: via: (https://opensource.com/article/19/7/ways-get-started-linux)
[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/don-watkins)
Linux 入门十法
======
> 想要进入 Linux 之门,试试这十个方法。
![Penguins gathered together in the Artic][1]
文章《[什么是 Linux 用户?][2]》的作者 Anderson Silva 明确表示,现今人们使用 Linux在某种程度上就像使用 Windows 一样,只要你对“使用 Linux”这个事情定义得足够广泛。尽管如此如果你的生活中没有足够的使用 Linux 的机会,现在正是以前所未有的方式尝试 Linux 的好时机。
以下是 Linux 入门的十种方法。你可以试试其中一个或者全部试试。
### 1、加入免费 shell 计划
![Free shell screenshot][3]
有很多人在用不上的服务器上运行 Linux 请记住“Linux 服务器”可以是从最新的超级计算机到丢弃的已经用了 12 年的笔记本电脑中的任何一个)。为了充分利用多余的计算机,许多管理员用这些备用的机器提供了免费的 shell 帐户。
如果你想要登录到 Linux 终端中学习命令、shell 脚本、Python 以及 Web 开发的基础知识,那么免费的 shell 帐户是一种简单、免费的入门方式。这是一个简短的列表:
* [Freeshell.de][4] 是一个自 2002 年以来一直在线的公用 Linux 系统。你可以通过 SSH、IPv6 和 OpenSSL 进行访问,以获得 Linux shell 体验,并且可以使用 MySQL 数据库。
* [Blinkenshell][5] 提供了一个学习 Unix、使用 IRC、托管简单网站和共享文件的 Linux shell。它自 2006 年以来一直在线。
* [SDF 公用 Unix 系统][6]成立于 1987 年,提供了免费的 NetBSD 账户。当然NetBSD 不是 Linux但它是开源的 Unix因此它提供了类似的体验。它也有几个自制应用程序因此它跨越了老派 BBS 和普通的免费 shell 之间的界限。
免费 shell 帐户受到很多滥用,因此你表现出的信任度和参与集体活动的意愿越多,你的体验就越好。你通常可以访问数据库引擎、编译器和高级编程语言(通过特殊请求或小额捐赠来证明声誉)。你还可以要求安装其他软件或库,但需经管理员批准。
#### 如何使用
公用 shell 帐户是尝试真正的 Linux 系统的好方法。你无法获得 root 权限这一事实意味着你可学习本地软件管理,而无需做更多的维护工作。你可以做很多实际操作,以完成真正的工作,尽管它们对于学习关键任务还不够。
### 2、试试 Windows WSL 2 里面的 Linux
不管你信不信,微软从 2019 年 6 月开始在 Windows 里面带上了 Linux这意味着你可以从 Windows 运行 Linux 应用程序,这是第二代的 [Windows 里的 Linux 子系统][7]WSL 2。虽然它主要针对开发人员但 Windows 用户会发现 WSL 2 是一个熟悉的桌面上的 Linux 环境,而没有被任何虚拟化占用额外资源。这是一个以进程方式运行在 Windows 机器上的 Linux。在这个时候它仍然是一个新的动向和正在进行中的工作因此它可能会发生变化。如果你试图用它承担重任你可能会遇到一两个错误但是如果你只是想入门 Linux、学习一些命令并感受在基于文本的环境如何完成工作那么 WSL 2 可能正是你所需要的。
#### 如何使用
WSL 还没有明确的方向或目的,但它在 Windows 机器上提供了 Linux 环境。你可以获得 root 访问权限,并可以运行 Linux 发行版和应用程序,因此这是一种简单而无缝的学习方式。但是,即使 WSL *是Linux*,它也不能给你典型的 Linux 体验。它是由 Windows 提供的 Linux而这不太会是你在现实世界中遇到的。WSL 是一个开发和教育工具,但如果你可以使用它,那么你应该试试它。
### 3、把 Linux 放到可启动的 U 盘上
![Porteus Linux][8]
便携 Linux 可以安装到 U 盘上随身携带,并用该 U 盘启动你遇到的任何计算机。你可以获得个性化的 Linux 桌面,而无需担心所启动的主机上的数据。计算机不会接触你的 Linux 操作系统,并且你的 Linux 操作系统也不会影响计算机。它非常适合酒店商务中心、图书馆、学校的公共计算机,或者只是给自己一个不时启动 Linux 的借口。
与许多其他快速取得的 Linux shell 不同,此方法为你提供了一个完整而强大的 Linux 系统,包括桌面环境,可访问你需要的任何软件以及持久的数据存储。
这个系统永远不会改变。你要保存的任何数据都将写入压缩的文件系统中,然后在引导时将其作为覆盖层应用于该系统。这种灵活性允许你选择是以持久模式启动,将所有数据保存回 U 盘;还是以临时模式启动,以便一旦关闭电源,你所做的一切都会消失。换句话说,你可以将其用作不受信任的计算机上的安全信息亭或你信任的计算机上的便携式操作系统。
你可以尝试很多 [U 盘发行版][9],有些桌面环境很少,适用于低功耗计算机,有些适用于完整桌面环境。我偏爱 [Porteus][10] Linux。在过去的八年里我每天都把它放在我的钥匙链上在商务旅行中使用它作为我的主要计算平台如果在工作或家中计算机发生问题它也会用作工具盘。它是一个可靠而稳定的操作系统有趣且易于使用。
在 Mac 或 Windows 上,下载 [Fedora Media Writer][11] 以创建你下载的任何便携式发行版的可启动 U 盘。
#### 如何使用
从 U 盘启动一个“实时 Linux”可提供完整的 Linux 发行版。虽然数据存储与你安装到硬盘驱动器的系统略有不同,但其他所有内容都与你在 Linux 桌面上所期望的一样。在便携式 Linux 操作系统上你几乎没有什么不能做的,所以在你的钥匙串上安装一个以解锁你遇到的每台计算机的全部潜力吧。
### 4、在线导览
![Linux tour screenshot][12]
Ubuntu 的某个人想到了在浏览器中托管 Ubuntu GNOME 桌面的好主意。想要自己尝试一下,可以打开 Web 浏览器并导航到 [tour.ubuntu.com][13]。你可以选择要演示的活动,也可以跳过单个课程并单击 “四处看看” 按钮。
即使你是 Linux 桌面的新用户,你也可能会发现“四处看看”功能比你想象的更还简单。在线游览中,您可以四处看看,查看可用的应用程序,以及查看典型的默认 Linux 桌面。你不能在 Firefox 中调整设置或启动另一个在线导览(这是我尝试的第一件事),虽然你可以完成安装应用程序的动作,但你无法启动它们。 但是,如果你之前从未使用过 Linux 桌面,并且想要看到各种新奇的东西,那这就是一场旋风之旅。
#### 如何使用
在线导览真的只是一次旅行。如果你从未见过 Linux 桌面,那么这是一个了解它的情况的机会。不是为了正式的使用,而是一个吸引过客的展示。
### 5、在浏览器中用 JavaScript 运行 Linux
![JSLinux][14]
就在不久之前,虚拟化的计算成本还很高,这仅限于使用高级硬件的用户。而现在虚拟化已被优化到可以由 JavaScript 引擎执行的程度,这要归功于 Fabrice Bellard它是优秀的开源 [QEMU][15] 机器仿真器和虚拟器的创建者。
Bellard 还启动了 JSLinux 项目,该项目允许你在浏览器中运行 Linux 和其他操作系统,算是闲暇时间的一个乐趣。它仍然是一个实验项目,但它是一个技术奇迹。打开 Web 浏览器导航到 [JSLinux][16] 页面,你可以启动基于文本的 Linux shell 或极简的图形 Linux 环境。你可以上传和下载文件到 JSLinux 主机上或(在理论上)将文件发送到一个网络备份位置,因为 JSLinux 可以通过 VPN 套接字访问互联网(尽管上限速度取决于 VPN 服务)。
#### 如何使用
你不会在 JSLinux 上正经使用多少时间,这个环境可能太不寻常了,无法学习 Linux 正常工作的广泛课程。但是,如果你厌倦了在一台普通的 PC 上运行 Linux 并想在一个真正独特的平台上试用 Linux那么 JSLinux 就属于这种。
### 6、阅读关于它的书
并非每种 Linux 体验都要用计算机。也许你是那种喜欢在开始新事物之前保持距离,先观察和研究的人,或者你可能还不清楚 “Linux” 所包含的内容,或者你喜欢全情投入其中。关于 Linux 如何工作、运行 Linux 的方式以及 Linux 世界中有什么,有很多书可以读。
你越熟悉开源世界,就越容易理解常用术语,将城市神话与实际经验区分开来。我们不时会发布[图书清单] [17],但我的最爱之一是 Hazel Russman 的《[The Charm of Linux][18]》。这是一个从不同角度巡览 Linux 的过程,是由一位独立作者在发现 Linux 时兴奋之余写作的。
#### 如何使用
没有什么能比一本好书更好。这是体验 Linux 的最不传统的方法,但对于喜欢印刷文字的人来说,它既舒适又有效。
### 7、弄块树莓派
![Raspberry Pi 4][19]
如果你正在使用[树莓派][20],那么你就正在运行 Linux。Linux 和低功耗计算很容易上手。关于树莓派的好处,除了价格低于 100 美元之外,它的[网站][21]是专为教育而设计的。你可以了解树莓派所做的一切,当你了解之后,就知道了 Linux 可以为你做些什么。
#### 如何使用
树莓派被设计为低功耗计算机。这意味着你不能像过去那样做那么多的多任务处理,但这是一种避免不堪重负的方便方法。树莓派是学习 Linux 及其附带的所有可能性的好方法,它是发现环保、小型、简化计算能力的有趣方式。并且一定要关注 Opensource.com 上的[提示][22]和[技巧][23]和[有趣的][24][活动] [25],特别是在每年三月份的树莓派之周期间。
### 8、赶上容器热潮
如果你在神话般的[云][26]的后端附近工作,那么你已经听说过容器热潮。虽然你可以在 Windows、Azure、Mac 和 Linux 上运行 Docker 和 Kubernetes但你可能不知道容器本身就是 Linux。云计算应用和基础设施实际上是精简的 Linux 系统,部分虚拟化,部分基于裸机。如果启动容器,则会启动微型的超特定的 Linux 发行版。
容器与虚拟机或物理服务器[不同][27]。它们不打算用作通用操作系统。但是,如果你在容器中进行开发,你可以停下来四处打量一下,你将了解到 Linux 系统的结构、保存重要文件的位置以及最常见的命令。你甚至可以[在线尝试容器][28],你可以在我的文章中[深入到 Linux 容器的背后][29]了解它们如何工作的。
#### 如何使用
根据设计,容器特定于单个任务,但它们是 Linux因此它们非常灵活。你可以如你预期的使用它们也可以在你的 Linux 实验当中将容器构建到大部分完整系统中。它虽然不是桌面 Linux 体验,但它是完整的 Linux 体验。
### 9、以虚拟机方式安装 Linux
虚拟化是尝试操作系统的简便方法,[VirtualBox][30]是一种很好的开源虚拟化方法。VirtualBox 可以在 Windows 和 Mac 上运行,因此你可以将 Linux 安装为虚拟机VM并使用它就好像它只是一个应用程序一样。如果你不习惯安装操作系统VirtualBox 也是一种尝试 Linux 的非常安全的方式,而不会意外地将其安装在你通常的操作系统上。
#### 如何使用
将 Linux 作为虚拟机运行既方便又简单,既可以作为试运行使用,也可以在需要 Linux 环境时进行双启动或重启。它功能齐全,因为它使用虚拟硬件,主机操作系统负责驱动你的外围设备。将 Linux 作为虚拟机运行的唯一缺点主要是心理上的。如果你打算使用 Linux 作为主操作系统,但最终默认在宿主操作系统做除了特定于 Linux 的大多数任务,那么虚拟机就会让你失望。否则,虚拟机是现代技术的胜利,在 VirtualBox 中使用 Linux 可以为你提供 Linux 所提供的所有最佳功能。
### 10、安装一个 Linux
![Fedora Silverblue][31]
如果对上述方式有疑问,那么总会有传统的方式。如果你想给予 Linux 应有的关注,你可以下载 Linux将安装程序刻录到 U 盘(或 DVD如果你更喜欢光学介质的话并将其安装在你的计算机上。Linux 是开源的,所以任何想要花时间打包 Linux 的人都可以分发 Linux并且可以将所有可用的部分分配到通常称为发行版的内容中。询问任何 Linux 用户哪个发行版是“最好的”,你必然会得到一个不同的答案(主要是因为术语“最佳”通常是未定义的)。大多数人都认可你应该使用适合你的 Linux 发行版,这意味着你应该测试一些流行的发行版,并坚持使你的计算机按照你期望的行为行事。这是一种务实和功能性的方法。例如,如果发行版无法识别你的网络摄像头而你希望它可以正常工作,则可以使用一个可识别该网络摄像头的发行版。
如果你之前从未安装过操作系统,你会发现大多数 Linux 发行版都包含友好且简单的安装程序。只需下载一个发行版(它们作为 ISO 文件提供),然后下载 [Fedora Media Writer][11] 来创建一个可启动的安装 U 盘。
#### 如何使用
安装 Linux 并将其用作操作系统是迈向熟悉和熟悉它的一步。怎么使用它都可以。你可能会发现你从未了解过所需的必备功能,你可能会比你想象的更多地了解计算机,并且可能会改变你的世界观。或者你可以使用 Linux 桌面,因为它易于下载和安装,或者因为你想要削减某些公司霸主的中间人,或者因为它可以帮助你完成工作。
无论你的原因是什么,只需尝试使用上面这些任何(或所有)这些方式。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/ways-get-started-linux
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 (Penguins gathered together in the Artic)
[2]: https://opensource.com/article/19/6/what-linux-user
[3]: https://opensource.com/sites/default/files/uploads/freeshell.png (Free shell screenshot)
[4]: https://freeshell.de
[5]: https://blinkenshell.org/wiki/Start
[6]: https://sdf.org/
[7]: https://devblogs.microsoft.com/commandline/wsl-2-is-now-available-in-windows-insiders/
[8]: https://opensource.com/sites/default/files/uploads/porteus.jpg (Porteus Linux)
[9]: https://linux.cn/article-11040-1.html
[10]: http://porteus.org
[11]: https://getfedora.org/en/workstation/download/
[12]: https://opensource.com/sites/default/files/uploads/linux_tour.jpg (Linux tour screenshot)
[13]: http://tour.ubuntu.com/en/#
[14]: https://opensource.com/sites/default/files/uploads/jslinux.jpg (JSLinux)
[15]: https://www.qemu.org
[16]: https://bellard.org/jslinux/
[17]: https://opensource.com/article/19/1/tech-books-new-skils
[18]: http://www.lulu.com/shop/hazel-russman/the-charm-of-linux/paperback/product-21229401.html
[19]: https://opensource.com/sites/default/files/uploads/raspberry-pi-4-case.jpg (Raspberry Pi 4)
[20]: https://opensource.com/resources/raspberry-pi
[21]: https://www.raspberrypi.org/
[22]: https://opensource.com/article/19/3/raspberry-pi-projects
[23]: https://opensource.com/article/19/3/piflash
[24]: https://opensource.com/article/19/3/gamepad-raspberry-pi
[25]: https://opensource.com/life/16/3/make-music-raspberry-pi-milkytracker
[26]: https://opensource.com/resources/cloud
[27]: https://opensource.com/article/19/6/how-ssh-running-container
[28]: https://linuxcontainers.org/lxd/try-it/
[29]: https://opensource.com/article/18/11/behind-scenes-linux-containers
[30]: https://virtualbox.org
[31]: https://opensource.com/sites/default/files/uploads/fedora-silverblue.png (Fedora Silverblue)

View File

@ -0,0 +1,60 @@
[#]: collector: (lujun9972)
[#]: translator: (vizv)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Sysadmin vs SRE: What's the difference?)
[#]: via: (https://opensource.com/article/19/7/sysadmins-vs-sres)
[#]: author: (Vince Power https://opensource.com/users/vincepower/users/craig5/users/dawnparzych/users/penglish)
系统管理员与网站可靠性工程师对比:区别在那儿?
======
系统管理员和网站可靠性工程师SRE下同对于任何组织来讲都很重要。本篇将介绍下两者的不同之处。
![People work on a computer server with devices][1]
在 IT 行业成为多面手或是专家的争议一直存在。99% 的传统系统管理员都被归到了多面手这类。[网站可靠性工程师][2]的角色则更加专精,并且其需求在如 Google 般有着一定规模的公司中不断增加。但总的来说这两者对于跑着应用的基础设施有着同样的目标:为应用的消费者提供良好的体验。然而两者的出发点却截然不同。
### 系统管理员:中立善良的化身
系统管理员一般都是从基础的桌面或网络支持成长过来的,并一路习得大多数系统管理员都会掌握的广泛的技能。此时这些系统管理员会对他们所负责的系统和应用了如指掌。他们会知道一号服务器上的应用每隔一个星期二就需要重启一次,或是九号服务器周三会静默的崩溃。他们会对服务器的监视作出微调以忽略无关紧要的信息,尽管那是个每月第三个周日都会显示的被标记为<ruby>致命<rt>fatal<rt></ruby>的错误信息。
总的来讲,系统管理员了解如何照料那些跑着你核心业务的服务器。这些系统管理员已经成长到开始使用自动化工具去处理所有归他们管的服务器上的例行任务。他们虽然喜欢使用模板、<ruby>黄金镜像<rt>golden images</rt></ruby>、以及标准,但同时也有着足够的灵活度去修改一个服务器上的参数以解决错误,并注释为什么那个服务器的配置与众不同。
尽管系统管理员很伟大,但他们也有着一些怪癖。其中一项就是没有他们神圣的授权你永远也获取不了系统的 root 访问权限,另一项则是任何不是他们的主意都在文档被记录为应用的提供者的要求,并仍然需要再次核对。
他们所管理的服务器是他们的地盘,没有人可以随意干涉。
### SRE灭霸将为之自豪
与成为系统管理员的道路相反,从开发背景和从系统管理员背景成长为 SRE 的可能性相近。SRE 的职位出现的时长与应用开发环境的生命周期相近。
随着一个组织的发展而引入的类似于[持续集成][4]和[持续发布][5] (CI/CD) 的 [DevOps][3] 概念,通常会带来如何让这些<ruby>不可变<rt>immutable</rt></ruby>的应用部署到多个环境并随着业务需求进行扩展的技能空缺。着将是 SRE 的舞台。的确,一个系统管理员可以学习额外的工具,但大体上成为一个全职的职位更容易跟的上进度。在这里成为一个专家更说的通。
SRE 使用如<ruby>[代码即基础设施][6]<rt>infrastructure-as-code</rt></ruby>的概念去制作模板,然后调用它们来部署用以运行应用的环境,并以使用一键将每个应用和它们的环境完整重现作为目标。因此测试环境中一号服务器里的一号应用的二进制文件与生产环境中十五号服务器的完全一致,仅环境相关的变量如密码和数据库链接字串有所不同。
SRE 同时也在配置发生改变时完全摧毁一个环境并重新构建它。对于任何系统他们不带一点感情。每个系统只是个被打了标记和安排了生命周期的数字,甚至例行的服务器补丁也要重新部署整个<ruby>应用栈<rt>application stack</rt></ruby>
### 总结
对于一些情况,尤其是运维一些大型的基于 DevOps 的环境时,一个 SRE 所能提供的用于处理各种规模业务的专业技能当然更具优势。但每次他们在运气不好走入死胡同时都会去寻求友人系统管理员,或是 [(BOFH)][7] 那身经百战的故障排除技能和那些系统管理员用于给组织提供价值的丰富经验的帮助。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/7/sysadmins-vs-sres
作者:[Vince Power][a]
选题:[lujun9972][b]
译者:[vizv](https://github.com/vizv)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/vincepower/users/craig5/users/dawnparzych/users/penglish
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices)
[2]: https://en.wikipedia.org/wiki/Site_Reliability_Engineering
[3]: https://opensource.com/resources/devops
[4]: https://en.wikipedia.org/wiki/Continuous_integration
[5]: https://en.wikipedia.org/wiki/Continuous_delivery
[6]: https://en.wikipedia.org/wiki/Infrastructure_as_code
[7]: http://www.bofharchive.com/BOFH.html