Merge pull request #24 from LCTT/master

Update from LCTT
This commit is contained in:
chen ni 2019-12-29 16:34:24 +08:00 committed by GitHub
commit c7887fbae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 3045 additions and 1697 deletions

View File

@ -1,19 +1,20 @@
[#]: collector: (lujun9972)
[#]: translator: (XLCYun)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11725-1.html)
[#]: subject: (DevOps for introverted people)
[#]: via: (https://opensource.com/article/19/7/devops-introverted-people)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo)
[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg)
内向者的 DevOps
======
我们邀请 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。
![问答][1]
> 我们邀请 Opensource.com 的 DevOps 团队,希望他们能够谈一谈作为 DevOps 内向者的休验,同时给 DevOps 外向者一些建议。下面是他们的回答。
我们请求我们的 [DevOps 团队][2] 谈一谈他们作为一个内向者的体验,并给外向者们一些建议。但是在我们开始了解他们的回答之前,让我们先来定义一下这些词汇。
![](https://img.linux.net.cn/data/attachment/album/201912/29/103642jmzt6t6mggjjx5yt.jpg)
我们邀请我们的 [DevOps 团队][2] 谈一谈他们作为一个内向者的体验,并给外向者们一些建议。但是在我们开始了解他们的回答之前,让我们先来定义一下这些词汇。
### “内向者”是什么意思?
@ -25,27 +26,27 @@
### DevOps 技术主管可以通过哪些方式来让内向者感觉他们是团队的一部分并且愿意分享他们的想法?
“每个人都会不大一样,所以观察敏锐就很重要了。从 GitLab 过来的一个人告诉我,他们的哲学就是如果他们没有提供任何意见,那么他们就是被排除在外的。如果有人在一个会议上没有提供任何的意见,那就想办法让他们加入进来。**当我知道一个内向者对我们将要讨论的会议论题感兴趣的时候,我会提前请他写一些书面文本。有非常多的会议其实是可以避免的,只要通过把讨论放到 Slack 或者 GitLab 上就行了,内向者会更愿意参与进来**。在站立会议中,每个人都会交代最新的进展,在这个环境下,内向者表现得很好。有时候我们在其实会议上会重复做一些事情,仅仅是为了保证每个人都有时间发言。我同时也会鼓励内向者在工作小组或者社区小组面前发言,以此来锻炼他们的这些技能。—— 丹·巴克
“每个人都会不大一样,所以观察敏锐就很重要了。从 GitLab 过来的一个人告诉我,他们的哲学就是如果他们没有提供任何意见,那么他们就是被排除在外的。如果有人在一个会议上没有提供任何的意见,那就想办法让他们加入进来。**当我知道一个内向者对我们将要讨论的会议论题感兴趣的时候,我会提前请他写一些书面文本。有非常多的会议其实是可以避免的,只要通过把讨论放到 Slack 或者 GitLab 上就行了,内向者会更愿意参与进来**。在站立会议中,每个人都会交代最新的进展,在这个环境下,内向者表现得很好。有时候我们在其实会议上会重复做一些事情,仅仅是为了保证每个人都有时间发言。我同时也会鼓励内向者在工作小组或者社区小组面前发言,以此来锻炼他们的这些技能。—— 丹·巴克
“**我觉得别人对我做的最好的事情,就是他们保证了当重大问题来临的时候,我拥有必要的技能去回答它**。彼时,我作为一名非常年轻的入伍空军的一员,我需要给我们部队的高级领导做状态简报的汇报。我必须在任何时候都有一些可用的数据点,以及在实现我们确立的目标的过程中,产生延误以及偏差的背后的原因。那样的经历推动着我从一个“幕后人员”逐渐变得更加愿意和别人分享自己的观点和想法。
“**我觉得别人对我做的最好的事情,就是他们保证了当重大问题来临的时候,我拥有必要的技能去回答它**。彼时,我作为一名非常年轻的入伍空军的一员,我需要给我们部队的高级领导做状态简报的汇报。我必须在任何时候都有一些可用的数据点,以及在实现我们确立的目标的过程中,产生延误以及偏差的背后的原因。那样的经历推动着我从一个‘幕后人员’逐渐变得更加愿意和别人分享自己的观点和想法。”—— 克里斯·肖特
“**通过文化去领导。为你的同僚一起设计和尝试仪式。**你可以为给你的小组或团队设计一个小的每周仪式,甚至给你的部门或组织设计一个年度的大仪式。它的意义在于去尝试一些事物,并观察你在其中的领导角色。去找到你们文化当中的代沟以及对立。回顾团队的信仰和行为。你能从哪里观察到对立?你们的文化中缺失了什么?从一个小陈述开始‘我从 X 和 Y 之间看到了对立’,或者‘我的团队缺少了 Z。接着将代沟与对立转换为问题写下三个我们如何能……(How might we's, HMWs)’。”——凯瑟琳·路易斯
“**通过文化去领导。为你的同僚一起设计和尝试仪式。**你可以为给你的小组或团队设计一个小的每周仪式,甚至给你的部门或组织设计一个年度的大仪式。它的意义在于去尝试一些事物,并观察你在其中的领导角色。去找到你们文化当中的代沟以及对立。回顾团队的信仰和行为。你能从哪里观察到对立?你们的文化中缺失了什么?从一个小陈述开始‘我从 X 和 Y 之间看到了对立’,或者‘我的团队缺少了 Z。接着将代沟与对立转换为问题写下三个我们如何能……(How might we's, HMWs)’。”—— 凯瑟琳·路易斯
“内向者不是一个不同的群体,他们要么是在分享他们的想法之前想得太多或等得太久的一些人,要么就是一些根本不知道发生了什么的人。我就是第一种,我想太多了,有时候还担心我的意见会被其他人嘲笑,或者没有什么意思,或者想偏了。形成那样的思维方式很难,但它同时也在吞噬着我学习更好事物的机会。有一次,我们团队在讨论一个实现问题。我当时的老大一次又一次地问我,为什么我没有作为团队中更具经验的人参与进来,然后我就(集齐了全宇宙的力量之后)开口说我想说的大家都已经说过了。他说,有时候我可以重复说一次,事情纷繁,如果你能够重复一遍你的想法,即使它已经被讨论过了,也会大有裨益。好吧,虽然它不是一种特别信服的方式,但是我知道了至少有人想听听我怎么说,它给了我一点信心。
“现在,我所使用的让团队中的人发言的方法是**我经常向内向的人求助,即使我知道解决方法,并且在团队会议和讨论中感谢他们来建立他们的自信心,通过给他们时间让他们一点一点的从他们寡言的本性中走出来,从而跟团队分享很多的知识**。他们在外面的世界中可能仍然会有一点点孤立,但是在团队里面,有些会成为我们可以信赖的人。——阿布希什克·塔姆拉卡尔
“现在,我所使用的让团队中的人发言的方法是**我经常向内向的人求助,即使我知道解决方法,并且在团队会议和讨论中感谢他们来建立他们的自信心,通过给他们时间让他们一点一点的从他们寡言的本性中走出来,从而跟团队分享很多的知识**。他们在外面的世界中可能仍然会有一点点孤立,但是在团队里面,有些会成为我们可以信赖的人。—— 阿布希什克·塔姆拉卡尔
“我给参加会议的内向者的建议是,找一个同样要参加会议的朋友或者同事,这样到时你就会有人可以跟你一起舒服地交谈,在会议开始之前,提前跟其他的与会者(朋友,行业联系人,前同事等等)约着见个面或者吃顿饭,**要注意你的疲劳程度,并且照顾好自己**:如果你需要重新恢复能量,就跳过那些社交或者夜晚的活动,在事后回顾中记录一下自己的感受。”——伊丽莎白·约瑟夫
“我给参加会议的内向者的建议是,找一个同样要参加会议的朋友或者同事,这样到时你就会有人可以跟你一起舒服地交谈,在会议开始之前,提前跟其他的与会者(朋友、行业联系人、前同事等等)约着见个面或者吃顿饭,**要注意你的疲劳程度,并且照顾好自己**:如果你需要重新恢复能量,就跳过那些社交或者夜晚的活动,在事后回顾中记录一下自己的感受。”—— 伊丽莎白·约瑟夫
### 和一个内向者倾向的同事一起工作时,有什么提高生产效率的小建议?
“在保证质量时,生产效率会越来越具备挑战性。在大多数时候,工作中的一个小憩或者轻松随意的交谈,可能正是我们的创造性活动中需要的一个火花。再说一次,我发现当你的团队中有内向者时, Slack 和 Github 会是一个非常有用的用于交换想法以及和其他人互动的媒介。**我同时也发现,结对编程对于大部分的内向者也非常有用,虽然一对一的交流对于他们来说,并不像交税那么频繁,但是生产质量和效率的提升却是重大的**。但是,当一个内向者在独自工作的时间,团队中的所有人都不应该去打断他们。最好是发个邮件,或者使用没有那么强的侵入性的媒介。——丹·巴克
“在保证质量时,生产效率会越来越具备挑战性。在大多数时候,工作中的一个小憩或者轻松随意的交谈,可能正是我们的创造性活动中需要的一个火花。再说一次,我发现当你的团队中有内向者时, Slack 和 Github 会是一个非常有用的用于交换想法以及和其他人互动的媒介。**我同时也发现,结对编程对于大部分的内向者也非常有用,虽然一对一的交流对于他们来说,并不像交税那么频繁,但是生产质量和效率的提升却是重大的**。但是,当一个内向者在独自工作的时间,团队中的所有人都不应该去打断他们。最好是发个邮件,或者使用没有那么强的侵入性的媒介。—— 丹·巴克
“给他们趁手的工具,让他们工作并归档他们的工作。**让他们能够在他们的工作上做到最好**。要足够经常地去检查一下,保证他们没有走偏路,但是要记住,相比外向者而言,这样做是更大的一种让人分心的困扰。
“给他们趁手的工具,让他们工作并归档他们的工作。**让他们能够在他们的工作上做到最好**。要足够经常地去检查一下,保证他们没有走偏路,但是要记住,相比外向者而言,这样做是更大的一种让人分心的困扰。”—— 克里斯·肖特
“**当我低着头的时候,不要打断我。真的,别打断我**当我沉浸在某件事物中时,这样做会造成我至少需要花费两个小时,才能让我的大脑重新回到之前的状态。感觉很痛苦。真的。你可以发个邮件让我去有白板的地方。然后从客户的角度而不是你的角度——通过画图的方式——分享下有什么问题。要知道,可能同时会有十几个客户问题缠绕在我的脑海中,如果你的问题听起来就是“这样子做会让我在我的领导面前显得很好”的那一类问题,那么相比我脑袋中已经有的真正的客户问题而言,它不会得到更多的关注的。画个图,给我点时间思考。当我准备分享我的看法的时候,保证有多支马克笔可以使用。准备好接受你对问题的假设有可能完全是错误的。”——凯瑟琳·路易斯
“**当我低着头的时候,不要打断我。真的,别打断我**当我沉浸在某件事物中时,这样做会造成我至少需要花费两个小时,才能让我的大脑重新回到之前的状态。感觉很痛苦。真的。你可以发个邮件让我去有白板的地方。然后从客户的角度而不是你的角度——通过画图的方式——分享下有什么问题。要知道,可能同时会有十几个客户问题缠绕在我的脑海中,如果你的问题听起来就是‘这样子做会让我在我的领导面前显得很好’的那一类问题,那么相比我脑袋中已经有的真正的客户问题而言,它不会得到更多的关注的。画个图,给我点时间思考。当我准备分享我的看法的时候,保证有多支马克笔可以使用。准备好接受你对问题的假设有可能完全是错误的。”—— 凯瑟琳·路易斯
“感谢和鼓励就是解决的方法,感谢可能不是一份工作评估,但是感谢能让人舒服地感受到自己并不仅仅是一个活着的独立实体,**因而每个人都能够感觉到自己是被倾听的,而不是被嘲笑或者低估的**。”——阿布希什克·塔姆拉卡尔
“感谢和鼓励就是解决的方法,感谢可能不是一份工作评估,但是感谢能让人舒服地感受到自己并不仅仅是一个活着的独立实体,**因而每个人都能够感觉到自己是被倾听的,而不是被嘲笑或者低估的**。”—— 阿布希什克·塔姆拉卡尔
### 结语
@ -53,16 +54,16 @@
--------------------------------------------------------------------------------
转载自: https://opensource.com/article/19/7/devops-introverted-people
via: https://opensource.com/article/19/7/devops-introverted-people
作者:[Matthew Broberg][a]
选题:[lujun9972][b]
译者:[XLCYun](https://github.com/XLCYun)
校对:[校对者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/mbbroberg/users/don-watkins/users/shawnhcorey/users/mbbroberg/users/marcobravo
[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/osdc_QandAorange_520x292_0311LL.png?itok=qa3hHSou (Q and A letters)
[2]: https://opensource.com/devops-team

View File

@ -0,0 +1,265 @@
[#]: collector: (lujun9972)
[#]: translator: (runningwater)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11717-1.html)
[#]: subject: (Using the Java Persistence API)
[#]: via: (https://opensource.com/article/19/10/using-java-persistence-api)
[#]: author: (Stephon Brown https://opensource.com/users/stephb)
使用 Java 持久化 API
======
> 我们通过为自行车商店构建示例应用程序来学习如何使用 JPA。
![](https://img.linux.net.cn/data/attachment/album/201912/27/000705dymv92hnba2a2322.jpg)
对应用开发者来说,<ruby>Java 持久化 API<rt>Java Persistence API</rt></ruby>JPA是一项重要的 java 功能,需要透彻理解。它为 Java 开发人员定义了如何将对象的方法调用转换为访问、持久化及管理存储在 NoSQL 和关系型数据库中的数据的方案。
本文通过构建自行车借贷服务的教程示例来详细研究 JPA。此示例会使用 Spring Boot 框架、MongoDB 数据库([已经不开源][2])和 Maven 包管理来构建一个大型应用程序并且构建一个创建、读取、更新和删除CRUD层。这儿我选择 NetBeans 11 作为我的 IDE。
此教程仅从开源的角度来介绍 Java 持久化 API 的工作原理,不涉及其作为工具的使用说明。这全是关于编写应用程序模式的学习,但对于理解具体的软件实现也很益处。可以从我的 [GitHub 仓库][3]来获取相关代码。
### Java: 不仅仅是“豆子”
Java 是一门面向对象的编程语言,自 1996 年发布第一版 Java 开发工具JDK已经变化了很多很多。要了解其各种发展及其虚拟机本身就是一堂历史课。简而言之和 Linux 内核很相似,自发布以来,该语言已经向多个方向分支发展。有对社区免费的标准版本、有针对企业的企业版本及由多家供应商提供的开源替代品。主要版本每六个月发布一次,其功能往往差异很大,所以确认选用版本前得先做些研究。
总而言之Java 的历史很悠久。本教程重点介绍 Java 11 的开源实现 [JDK 11][4]。因其是仍然有效的长期支持版本之一。
* **Spring Boot** 是由 Pivotal 公司开发的大型 Spring 框架的一个模块。Spring 是 Java 开发中一个非常流行的框架。它支持各种框架和配置,也为 WEB 应用程序及安全提供了保障。Spring Boot 为快速构建各种类型的 Java 项目提供了基本的配置。本教程使用 Spring Boot 来快速编写控制台应用程序并针对数据库编写测试用例。
* **Maven** 是由 Apache 开发的项目/包管理工具。Maven 通过 `POM.xml` 文件来管理包及其依赖项。如果你使用过 NPM 的话,可能会非常熟悉包管理器的功能。此外 Maven 也用来进行项目构建及生成功能报告。
* **Lombok** 是一个库,它通过在对象文件里面添加注解来自动创建 getters/setters 方法。像 C# 这些语言已经实现了此功能Lombok 只是把此功能引入 Java 语言而已。
* **NetBeans** 是一款很流行的开源 IDE专门用于 Java 开发。它的许多工具都随着 Java SE 和 EE 的版本更新而更新。
我们会用这组工具为一个虚构自行车商店创建一个简单的应用程序。会实现对 `Customer``Bike` 对象集合的的插入操作。
### 酿造完美
导航到 [Spring Initializr][5] 页面。该网站可以生成基于 Spring Boot 和其依赖项的基本项目。选择以下选项:
1. **项目:** Maven 工程
2. **语言:** Java
3. **Spring Boot** 2.1.8(或最稳定版本)
4. **项目元数据:** 无论你使用什么名字,其命名约定都是像 `com.stephb` 这样的。
* 你可以保留 Artifact 名字为 “Demo”。
5. **依赖项:** 添加:
* Spring Data MongoDB
* Lombok
点击 **下载**,然后用你的 IDE例如 NetBeans 打开此新项目。
#### 模型层概要
在项目里面,<ruby>模型<rt>model</rt></ruby>代表从数据库里取出的信息的具体对象。我们关注两个对象:`Customer` 和 `Bike`。首先,在 `src` 目录创建 `dto` 目录;然后,创建两个名为 `Customer.java``Bike.java` 的 Java 类对象文件。其结构如下示:
```Java
package com.stephb.JavaMongo.dto;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
/**
*
* @author stephon
*/
@Getter @Setter
public class Customer {
private @Id String id;
private String emailAddress;
private String firstName;
private String lastName;
private String address;
}
```
*Customer.Java*
```Java
package com.stephb.JavaMongo.dto;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Id;
/**
*
* @author stephon
*/
@Getter @Setter
public class Bike {
private @Id String id;
private String modelNumber;
private String color;
private String description;
@Override
public String toString() {
return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description;
}
}
```
*Bike.java*
如你所见,对象中使用 Lombok 注解来为定义的<ruby>属性<rt>properties</rt></ruby>/<ruby>特性<rt>attributes</rt></ruby>生成 getters/setters 方法。如果你不想对该类的所有特性都生成 getters/setters 方法,可以在属性上专门定义这些注解。这两个类会变成容器,里面携带有数据,无论在何处想显示信息都可以使用。
#### 配置数据库
我使用 [Mongo Docker][7] 容器来进行此次测试。如果你的系统上已经安装了 MongoDB则不必运行 Docker 实例。你也可以登录其官网,选择系统信息,然后按照安装说明来安装 MongoDB。
安装后就可以使用命令行、GUI例如 MongoDB Compass或用于连接数据源的 IDE 驱动程序来与新的 MongoDB 服务器进行交互。到目前为止,可以开始定义数据层了,用来拉取、转换和持久化数据。需要设置数据库访问属性,请导航到程序中的 `applications.properties` 文件,然后添加如下内容:
```
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=BikeStore
```
#### 定义数据访问对象/数据访问层
<ruby>数据访问层<rt>data access layer</rt></ruby>DAL中的<ruby>数据访问对象<rt>data access objects</rt></ruby>DAO定义了与数据库中的数据的交互过程。令人惊叹的就是在使用 `spring-boot-starter` 后,查询数据库的大部分工作已经完成。
让我们从 `Customer` DAO 开始。在 `src` 下的新目录 `dao` 中创建一个接口文件,然后再创建一个名为 `CustomerRepository.java` 的 Java 类文件,其内容如下示:
```
package com.stephb.JavaMongo.dao;
import com.stephb.JavaMongo.dto.Customer;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
*
* @author stephon
*/
public interface CustomerRepository extends MongoRepository<Customer, String>{
@Override
public List<Customer> findAll();
public List<Customer> findByFirstName(String firstName);
public List<Customer> findByLastName(String lastName);
}
```
这个类是一个接口,扩展或继承于 `MongoRepository` 类,而 `MongoRepository` 类依赖于 DTO `Customer.java`)和一个字符串,它们用来实现自定义函数查询功能。因为你已继承自此类,所以你可以访问许多方法函数,这些函数允许持久化和查询对象,而无需实现或引用自己定义的方法函数。例如,在实例化 `CustomerRepository` 对象后,你就可以直接使用 `Save` 函数。如果你需要扩展更多的功能,也可以重写这些函数。我创建了一些自定义查询来搜索我的集合,这些集合对象是我自定义的元素。
`Bike` 对象也有一个存储源负责与数据库交互。与 `CustomerRepository` 的实现非常类似。其实现如下所示:
```
package com.stephb.JavaMongo.dao;
import com.stephb.JavaMongo.dto.Bike;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
*
* @author stephon
*/
public interface BikeRepository extends MongoRepository<Bike,String>{
public Bike findByModelNumber(String modelNumber);
@Override
public List<Bike> findAll();
public List<Bike> findByColor(String color);
}
```
#### 运行程序
现在,你已经有了一种结构化数据的方式,可以对数据进行提取、转换和持久化,然后运行这个程序。
找到 `Application.java` 文件(有可能不是此名称,具体取决于你的应用程序名称,但都会包含有 “application” )。在定义此类的地方,在后面加上 `implements CommandLineRunner`。这将允许你实现 `run` 方法来创建命令行应用程序。重写 `CommandLineRunner` 接口提供的 `run` 方法,并包含如下内容用来测试 `BikeRepository`
```
package com.stephb.JavaMongo;
import com.stephb.JavaMongo.dao.BikeRepository;
import com.stephb.JavaMongo.dao.CustomerRepository;
import com.stephb.JavaMongo.dto.Bike;
import java.util.Scanner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class JavaMongoApplication implements CommandLineRunner {
@Autowired
private BikeRepository bikeRepo;
private CustomerRepository custRepo;
public static void main(String[] args) {
SpringApplication.run(JavaMongoApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
Scanner scan = new Scanner(System.in);
String response = "";
boolean running = true;
while(running){
System.out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close");
response = scan.nextLine();
if ("B".equals(response.toUpperCase())) {
String[] bikeInformation = new String[3];
System.out.println("Enter the information for the Bike");
System.out.println("Model Number");
bikeInformation[0] = scan.nextLine();
System.out.println("Color");
bikeInformation[1] = scan.nextLine();
System.out.println("Description");
bikeInformation[2] = scan.nextLine();
Bike bike = new Bike();
bike.setModelNumber(bikeInformation[0]);
bike.setColor(bikeInformation[1]);
bike.setDescription(bikeInformation[2]);
bike = bikeRepo.save(bike);
System.out.println(bike.toString());
} else if ("X".equals(response.toUpperCase())) {
System.out.println("Bye");
running = false;
} else {
System.out.println("Sorry nothing else works right now!");
}
}
}
}
```
其中的 `@Autowired` 注解会自动依赖注入 `BikeRepository``CustomerRepository` Bean。我们将使用这些类来从数据库持久化和采集数据。
已经好了。你已经创建了一个命令行应用程序。该应用程序连接到数据库,并且能够以最少的代码执行 CRUD 操作
### 结论
从诸如对象和类之类的编程语言概念转换为用于在数据库中存储、检索或更改数据的调用对于构建应用程序至关重要。Java 持久化 APIJPA正是为 Java 开发人员解决这一难题的重要工具。你正在使用 Java 操纵哪些数据库呢?请在评论中分享。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/10/using-java-persistence-api
作者:[Stephon Brown][a]
选题:[lujun9972][b]
译者:[runningwater](https://github.com/runningwater)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/stephb
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans)
[2]: https://www.techrepublic.com/article/mongodb-ceo-tells-hard-truths-about-commercial-open-source/
[3]: https://github.com/StephonBrown/SpringMongoJava
[4]: https://openjdk.java.net/projects/jdk/11/
[5]: https://start.spring.io/
[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
[7]: https://hub.docker.com/_/mongo
[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system

View File

@ -0,0 +1,336 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11714-1.html)
[#]: subject: (How to program with Bash: Loops)
[#]: via: (https://opensource.com/article/19/10/programming-bash-loops)
[#]: author: (David Both https://opensource.com/users/dboth)
怎样用 Bash 编程:循环
======
> 本文是 Bash 编程系列三篇中的最后一篇,来学习使用循环执行迭代的操作。
![](https://img.linux.net.cn/data/attachment/album/201912/26/111437f9pa3zqqwcc9wwg1.jpg)
Bash 是一种强大的用于命令行和 shell 脚本的编程语言。本系列的三部分都是基于我的三集 [Linux 自学课程][2] 写的,探索怎么用 CLI 进行 bash 编程。
本系列的 [第一篇文章][3] 讨论了 bash 编程的一些简单命令行操作,如使用变量和控制操作符。[第二篇文章][4] 探讨了文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 bash 中不同种类的扩展。本文是第三篇(也是最后一篇),意在考察在各种迭代的操作中使用循环以及怎么合理控制循环。
### 循环
我使用过的所有编程语言都至少有两种循环结构来用来执行重复的操作。我经常使用 `for` 循环,然而我发现 `while``until` 循环也很有用处。
#### for 循环
我的理解是,在 bash 中实现的 `for` 命令比大部分语言灵活,因为它可以处理非数字的值;与之形成对比的是,诸如标准 C 语言的 `for` 循环只能处理数字类型的值。
Bash 版的 `for` 命令基本的结构很简单:
```
for Var in list1 ; do list2 ; done
```
解释一下:“对于 `list1` 中的每一个值,把 `$Var` 设置为那个值,使用该值执行 `list2` 中的程序语句;`list1` 中的值都执行完后,整个循环结束,退出循环。” `list1` 中的值可以是一个简单的显式字符串值,也可以是一个命令执行后的结果(`` 包含其内的命令执行的结果,本系列第二篇文章中有描述)。我经常使用这种结构。
要测试它,确认 `~/testdir` 仍然是当前的工作目录PWD。删除目录下所有东西来看下这个显式写出值列表的 `for` 循环的简单的示例。这个列表混合了字母和数字 — 但是不要忘了,在 bash 中所有的变量都是字符串或者可以被当成字符串来处理。
```
[student@studentvm1 testdir]$ rm *
[student@studentvm1 testdir]$ for I in a b c d 1 2 3 4 ; do echo $I ; done
a
b
c
d
1
2
3
4
```
给变量赋予更有意义的名字,变成前面版本的进阶版:
```
[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Department $Dept" ; done
Department Human Resources
Department Sales
Department Finance
Department Information Technology
Department Engineering
Department Administration
Department Research
```
创建几个目录(创建时显示一些处理信息):
```
[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done
Working on Department Human Resources
Working on Department Sales
Working on Department Finance
Working on Department Information Technology
Working on Department Engineering
Working on Department Administration
Working on Department Research
[student@studentvm1 testdir]$ ll
total 28
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Administration
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Engineering
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Finance
drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Human Resources'
drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Information Technology'
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Research
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Sales
```
`mkdir` 语句中 `$Dept` 变量必须用引号包裹起来;否则名字中间有空格(如 `Information Technology`)会被当做两个独立的目录处理。我一直信奉的一条实践规则:所有的文件和目录都应该为一个单词(中间没有空格)。虽然大部分现代的操作系统可以处理名字中间有空格的情况,但是系统管理员需要花费额外的精力去确保脚本和 CLI 程序能正确处理这些特例。(即使它们很烦人,也务必考虑它们,因为你永远不知道将拥有哪些文件。)
再次删除 `~/testdir` 下的所有东西 — 再运行一次下面的命令:
```
[student@studentvm1 testdir]$ rm -rf * ; ll
total 0
[student@studentvm1 testdir]$ for Dept in Human-Resources Sales Finance Information-Technology Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done
Working on Department Human-Resources
Working on Department Sales
Working on Department Finance
Working on Department Information-Technology
Working on Department Engineering
Working on Department Administration
Working on Department Research
[student@studentvm1 testdir]$ ll
total 28
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Administration
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Engineering
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Finance
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Human-Resources
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Information-Technology
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Research
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Sales
```
假设现在有个需求,需要列出一台 Linux 机器上所有的 RPM 包并对每个包附上简短的描述。我为北卡罗来纳州工作的时候,曾经遇到过这种需求。由于当时开源尚未得到州政府的“批准”,而且我只在台式机上使用 Linux对技术一窍不通的老板PHB需要我列出我计算机上安装的所有软件以便他们可以“批准”一个特例。
你怎么实现它?有一种方法是,已知 `rpm qa` 命令提供了 RPM 包的完整描述,包括了白痴老板想要的东西:软件名称和概要描述。
让我们一步步执行出最后的结果。首先,列出所有的 RPM 包:
```
[student@studentvm1 testdir]$ rpm -qa
perl-HTTP-Message-6.18-3.fc29.noarch
perl-IO-1.39-427.fc29.x86_64
perl-Math-Complex-1.59-429.fc29.noarch
lua-5.3.5-2.fc29.x86_64
java-11-openjdk-headless-11.0.ea.28-2.fc29.x86_64
util-linux-2.32.1-1.fc29.x86_64
libreport-fedora-2.9.7-1.fc29.x86_64
rpcbind-1.2.5-0.fc29.x86_64
libsss_sudo-2.0.0-5.fc29.x86_64
libfontenc-1.1.3-9.fc29.x86_64
&lt;snip&gt;
```
`sort``uniq` 命令对列表进行排序和打印去重后的结果(有些已安装的 RPM 包具有相同的名字):
```
[student@studentvm1 testdir]$ rpm -qa | sort | uniq
a2ps-4.14-39.fc29.x86_64
aajohan-comfortaa-fonts-3.001-3.fc29.noarch
abattis-cantarell-fonts-0.111-1.fc29.noarch
abiword-3.0.2-13.fc29.x86_64
abrt-2.11.0-1.fc29.x86_64
abrt-addon-ccpp-2.11.0-1.fc29.x86_64
abrt-addon-coredump-helper-2.11.0-1.fc29.x86_64
abrt-addon-kerneloops-2.11.0-1.fc29.x86_64
abrt-addon-pstoreoops-2.11.0-1.fc29.x86_64
abrt-addon-vmcore-2.11.0-1.fc29.x86_64
&lt;snip&gt;
```
以上命令得到了想要的 RPM 列表,因此你可以把这个列表作为一个循环的输入信息,循环最终会打印每个 RPM 包的详细信息:
```
[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done
```
这段代码产出了多余的信息。当循环结束后,下一步就是提取出白痴老板需要的信息。因此,添加一个 `egrep` 命令用来搜索匹配 `^Name``^Summary` 的行。脱字符(`^`)表示行首,整个命令表示显示所有以 Name 或 Summary 开头的行。
```
[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary"
Name        : a2ps
Summary     : Converts text and other types of files to PostScript
Name        : aajohan-comfortaa-fonts
Summary     : Modern style true type font
Name        : abattis-cantarell-fonts
Summary     : Humanist sans serif font
Name        : abiword
Summary     : Word processing program
Name        : abrt
Summary     : Automatic bug detection and reporting tool
&lt;snip&gt;
```
在上面的命令中你可以试试用 `grep` 代替 `egrep` ,你会发现用 `grep` 不能得到正确的结果。你也可以通过管道把命令结果用 `less` 过滤器来查看。最终命令像这样:
```
[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" > RPM-summary.txt
```
这个命令行程序用到了管道、重定向和 `for` 循环,这些全都在一行中。它把你的 CLI 程序的结果重定向到了一个文件,这个文件可以在邮件中使用或在其他地方作为输入使用。
这个一次一步构建程序的过程让你能看到每步的结果,以此来确保整个程序以你期望的流程进行且输出你想要的结果。
白痴老板最终收到了超过 1900 个不同的 RPM 包的清单,我严重怀疑根本就没人读过这个列表。我给了他们想要的东西,没有从他们嘴里听到过任何关于 RPM 包的信息。
### 其他循环
Bash 中还有两种其他类型的循环结构:`while` 和 `until` 结构,两者在语法和功能上都类似。这些循环结构的基础语法很简单:
```
while [ expression ] ; do list ; done
```
逻辑解释:表达式(`expression`)结果为 true 时,执行程序语句 `list`。表达式结果为 false 时,退出循环。
```
until [ expression ] ; do list ; done
```
逻辑解释:执行程序语句 `list`,直到表达式的结果为 true。当表达式结果为 true 时,退出循环。
#### While 循环
`while` 循环用于当逻辑表达式结果为 true 时执行一系列程序语句。假设你的 PWD 仍是 `~/testdir`
最简单的 `while` 循环形式是这个会一直运行下去的循环。下面格式的条件语句永远以 `true` 作为返回。你也可以用简单的 `1` 代替 `true`,结果一样,但是这解释了 true 表达式的用法。
```
[student@studentvm1 testdir]$ X=0 ; while [ true ] ; do echo $X ; X=$((X+1)) ; done | head
0
1
2
3
4
5
6
7
8
9
[student@studentvm1 testdir]$
```
既然你已经学了 CLI 的各部分知识,那就让它变得更有用处。首先,为了防止变量 `$X` 在前面的程序或 CLI 命令执行后有遗留的值,设置 `$X` 的值为 0。然后因为逻辑表达式 `[ true ]` 的结果永远是 1即 true`do``done` 中间的程序指令列表会一直执行 — 或者直到你按下 `Ctrl+C` 抑或发送一个 2 号信号给程序。那些程序指令是算数扩展,用来打印变量 `$X` 当前的值并加 1.
《[系统管理员的 Linux 哲学][5]》的信条之一是追求优雅,实现优雅的一种方式就是简化。你可以用操作符 `++` 来简化这个程序。在第一个例子中,变量当前的值被打印出来,然后变量的值增加了。可以在变量后加一个 `++` 来表示这个逻辑:
```
[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((X++)) ; done | head
0
1
2
3
4
5
6
7
8
9
```
现在删掉程序最后的 `| head` 再运行一次。
在下面这个版本中,变量在值被打印之前就自增了。这是通过在变量之前添加 `++` 操作符实现的。你能看出区别吗?
```
[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((++X)) ; done | head
1
2
3
4
5
6
7
8
9
```
你已经把打印变量的值和自增简化到了一条语句。类似 `++` 操作符,也有 `--` 操作符。
你需要一个在循环到某个特定数字时终止循环的方法。把 true 表达式换成一个数字比较表达式来实现它。这里有一个循环到 5 终止的程序。在下面的示例代码中,你可以看到 `-le` 是 “小于或等于” 的数字逻辑操作符。整个语句的意思:只要 `$X` 的值小于或等于 5循环就一直运行。当 `$X` 增加到 6 时,循环终止。
```
[student@studentvm1 ~]$ X=0 ; while [ $X -le 5 ] ; do echo $((X++)) ; done
0
1
2
3
4
5
[student@studentvm1 ~]$
```
#### Until 循环
`until` 命令非常像 `while` 命令。不同之处是,它直到逻辑表达式的值是 `true` 之前,会一直循环。看一下这种结构最简单的格式:
```
[student@studentvm1 ~]$ X=0 ; until false  ; do echo $((X++)) ; done | head
0
1
2
3
4
5
6
7
8
9
[student@studentvm1 ~]$
```
它用一个逻辑比较表达式来计数到一个特定的值:
```
[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((X++)) ; done
0
1
2
3
4
[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((++X)) ; done
1
2
3
4
5
[student@studentvm1 ~]$
```
### 总结
本系列探讨了构建 Bash 命令行程序和 shell 脚本的很多强大的工具。但是这仅仅是你能用 Bash 做的很多有意思的事中的冰山一角,接下来就看你的了。
我发现学习 Bash 编程最好的方法就是实践。找一个需要多个 Bash 命令的简单项目然后写一个 CLI 程序。系统管理员们要做很多适合 CLI 编程的工作,因此我确信你很容易能找到自动化的任务。
很多年前,尽管我对其他的 Shell 语言和 Perl 很熟悉,但还是决定用 Bash 做所有系统管理员的自动化任务。我发现,有时稍微搜索一下,我可以用 Bash 实现我需要的所有事情。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/10/programming-bash-loops
作者:[David Both][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster)
[2]: http://www.both.org/?page_id=1183
[3]: https://linux.cn/article-11552-1.html
[4]: https://linux.cn/article-11687-1.html
[5]: https://www.apress.com/us/book/9781484237298

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11716-1.html)
[#]: subject: (Create virtual machines with Cockpit in Fedora)
[#]: via: (https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/)
[#]: author: (Karlis KavacisPaul W. Frields https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/)
@ -12,19 +12,19 @@
![][1]
本文向你展示如何在 Fedora 31 上使用安装 Cockpit 所需软件来创建和管理虚拟机。Cockpit 是一个[交互式管理界面][2],可让你在任何受支持的 Web 浏览器上访问和管理系统。随着 [virt-manager 逐渐废弃][3],用户被鼓励使用 Cockpit 来替换它。
本文向你展示如何在 Fedora 31 上使用安装 Cockpit 所需软件来创建和管理虚拟机。Cockpit 是一个[交互式管理界面][2],可让你在任何受支持的 Web 浏览器上访问和管理系统。随着 [virt-manager 逐渐废弃][3]鼓励用户使用 Cockpit 来替换它。
Cockpit 是一个积极开发的项目,它有许多扩展其工作的插件。例如,其中一个是 “Machines”它与 libvirtd 交互并允许用户创建和管理虚拟机。
Cockpit 是一个正在活跃开发的项目,它有许多扩展其工作的插件。例如,其中一个是 “Machines”它与 libvirtd 交互并允许用户创建和管理虚拟机。
### 安装软件
先决所需软件是 _libvirt _、_ cockpit_ 和 _cockpit-machines_。要将它们安装在 Fedora 31 上,请在终端[使用 sudo][4] 运行以下命令:
先决所需软件是 `libvirt`、`cockpit` 和 `cockpit-machines`。要将它们安装在 Fedora 31 上,请在终端[使用 sudo][4] 运行以下命令:
```
$ sudo dnf install libvirt cockpit cockpit-machines
```
Cockpit 也在 “Headless Management” 软件包组中。该组对于仅通过网络访问的基于 Fedora 的服务器很有用。在这里,请使用以下命令进行安装:
Cockpit 也在 “Headless Management” 软件包组中。该软件组对于仅通过网络访问的基于 Fedora 的服务器很有用。在这里,请使用以下命令进行安装:
```
$ sudo dnf groupinstall "Headless Management"
@ -32,7 +32,7 @@ $ sudo dnf groupinstall "Headless Management"
### 设置 Cockpit 服务
安装了必要的软件包后,就该启用服务了。 _libvirtd_ 服务运行虚拟机,而 Cockpit 有一个激活的套接字服务,可让你访问 Web GUI
安装了必要的软件包后,就该启用服务了。`libvirtd` 服务运行虚拟机,而 Cockpit 有一个激活的套接字服务,可让你访问 Web GUI
```
$ sudo systemctl enable libvirtd --now
@ -59,35 +59,31 @@ $ sudo systemctl status cockpit.socket
使用系统的用户名和密码登录界面。你还可以选择是否允许在此会话中将密码用于管理任务。
选择 _Virtual Machines_然后选择_ Create VM_ 来创建一台新的虚拟机。控制台为你提供几个选项:
选择 “Virtual Machines”然后选择 “Create VM” 来创建一台新的虚拟机。控制台为你提供几个选项:
* 使用 Cockpit 的内置库下载操作系统
* 使用系统上已下载的安装媒体
* 指向系统安装树的 URL
* 通过 [PXE][5] 协议通过网络引导媒体
输入所有必要的参数。然后选择 _Create_ 启动新虚拟机。
输入所有必要的参数。然后选择 “Create” 启动新虚拟机。
此时,将出现一个图形控制台。大多数现代 Web 浏览器都允许你使用键盘和鼠标与 VM 控制台进行交互。现在,你可以完成安装并使用新的 VM就像[过去通过 virt-manager][6] 一样。
* * *
_照片由 [Miguel Teixeira][7] 发布于 [Flickr][8]CC BY-SA 2.0_
*照片由 [Miguel Teixeira][7] 发布于 [Flickr][8]CC BY-SA 2.0*
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/
作者:[Karlis KavacisPaul W. Frields][a]
作者:[Karlis Kavacis][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/) 荣誉推出
[a]: https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/
[a]: https://fedoramagazine.org/author/karlisk/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/create-vm-cockpit-816x345.jpg
[2]: https://cockpit-project.org/

View File

@ -0,0 +1,207 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11720-1.html)
[#]: subject: (Build a retro Apple desktop with the Linux MLVWM)
[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 Linux MLVWM 打造复古苹果桌面
======
> 本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑是用开源 POSIX 构建的呢?你可以通过构建 Macintosh 式的虚拟窗口管理器来实现。
![Person typing on a 1980's computer][1]
想象一下穿越到另一段平行历史Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有惯例,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用 [Macintosh 式的虚拟窗口管理器MLVWM][3]来回答这些问题(甚至更多!)。
![MLVWM running on Slackware 14.2][4]
### 安装 MLVWM
MLVWM 安装并不容易,并且可能不在你的发行版软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 .xpm 图片,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。不管怎么说这是一个新奇的窗口管理器其最新版本可以追溯到 2000 年。
要编译 MLVWM你必须安装 imake它提供了 `xmkmf` 命令。你可以从发行版的软件仓库中安装 imake也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 `xmkmf` 命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建:
```
$ xmkmf -a
$ make
```
构建后,编译后的 `mlvwm` 二进制文件位于 `mlvwm` 目录中。将其移动到[你的 PATH][6] 的任何位置:
```
$ mv mlvwm/mlvwm /usr/local/bin/
```
#### 编辑配置文件
现在已经安装好 MLVWM但是如果不调整几个配置文件并仔细放好所需的图像文件它将无法正确启动。示例配置文件位于你下载的源代码的 `sample_rc` 目录中。将文件 `Mlvwm-Netscape``Mlvwm-Xterm` 复制到你的主目录:
```
$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME
```
`Mlvwmrc` 改名为 `$HOME/.mlvwmrc`(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”
```
$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc
```
打开 `.mlwmrc` 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径(`IconPath`
```
# Set icon search path. It needs before "Style".
IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap
```
调整路径以匹配你填充图像的路径(我建议使用 `$HOME/.local/share/pixmaps`。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。
即使你有位于系统其他位置的像素图(例如 `/usr/share/pixmaps`),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。
```
# Set icon search path. It needs before "Style".
IconPath /home/seth/.local/share/pixmaps
```
#### 选择像素图
你已将 `.local/share/pixmaps` 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录:
```
$ mkdir -p $HOME/.local/share/pixmaps
```
现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 .xpm 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。
`.mlvwmrc` 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。
这有些例子。
此代码块设置屏幕左上角的图标:
```
# Register the menu
Menu Apple, Icon label1.xpm, Stick
```
`label1.xpm` 图像实际上在源代码的 `pixmap` 目录中,但我更喜欢使用来自 `/usr/share/pixmaps``Penguin.xpm`(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 `~/.local/share/pixmaps` 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。
此代码块定义了左侧菜单中列出的应用:
```
"About this Workstation..." NonSelect, Gray, Action About
"" NonSelect
"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls
"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm
"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm
END
```
通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 `mule` 更改为 `emacs`)。这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 `/usr/share/applications` 文件夹的快捷方式。
```
"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications
```
完成编辑配置文件并将自己的图像添加到 IconPath 目录后,必须将所有像素图的大小都调整为大约 16x16 像素。MLVWM 的默认设置不一致,因此存在变化空间。)你可以使用 ImageMagick 进行批量操作:
```
$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done
```
### 启动 MLVWM
最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 `$HOME/.xinitrc` 文件。我从 Slackware 复制了这个,它也是从 Xorg 拿来的:
```
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
exec ck-launch-session /usr/local/bin/mlvwm
else
exec /usr/local/bin/mlvwm
fi
```
根据此文件,`startx` 命令的默认操作是启动 MLVWM。但是你的发行版可能对于图形服务器启动或被终止以重新启动时会发生的情况有其他做法因此此文件可能对你没有什么帮助。在许多发行版上你可以添加 .desktop 文件到 `/usr/share/xsessions` 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 `mlvwm.desktop` 的文件并输入:
```
[Desktop Entry]
Name=Mlvwm
Comment=Macintosh-like virtual window manager
Exec=/usr/local/bin/mlvwm
TryExec=ck-launch-session /usr/local/bin/mlvwm
Type=Application
```
从桌面会话注销并重新登录到 MLVWM。默认情况下会话管理器KDM、GDM 或 LightDM具体取决于你的设置将继续登录到以前的桌面因此在登录之前必须覆盖它。
对于 GDM
![][7]
对于 SDDM
![][8]
#### 强制启动
如果 MLVWM 无法启动,请尝试安装 XDM这是一个轻量级会话管理器它不会查询 `/usr/share/xsessions` 的内容,而是执行经过身份验证用户的所有 `.xinitrc` 操作。
![MLVWM][9]
### 打造自己的复古苹果
MLVWM 桌面未经打磨、不完美、模仿到位且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。
这是一次让你时光倒流、改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-mlvwm-desktop
作者:[Seth Kenlon][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://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2)
[5]: http://cgit.freedesktop.org/xorg/util/imake
[6]: https://opensource.com/article/17/6/set-path-linux
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM)

View File

@ -1,22 +1,24 @@
[#]: collector: (lujun9972)
[#]: translator: (chen-ni)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11721-1.html)
[#]: subject: (How tracking pixels work)
[#]: via: (https://jvns.ca/blog/how-tracking-pixels-work/)
[#]: author: (Julia Evans https://jvns.ca/)
追踪像素是如何工作的?
网络广告商的像素追踪是如何工作的?
======
昨天,我和一名记者谈到了一个问题:广告商是如何在互联网上对人们进行追踪的?我们津津有味地查看了 Firefox 的开发者工具虽然我不是一个互联网隐私专家但至少还会使用开发者工具中的“network”标签页从中我终于弄明白追踪像素在实际中是如何工作的了。
![](https://img.linux.net.cn/data/attachment/album/201912/27/214125hvpv4e5ijepa0aqj.jpg)
昨天,我和一名记者谈到了一个问题:广告商是如何在互联网上对人们进行追踪的?我们津津有味地查看了 Firefox 的开发者工具虽然我不是一个互联网隐私专家但至少还会使用开发者工具中的“network”标签页从中我终于弄明白<ruby>像素追踪<rt>tracking pixels</rt></ruby>在实际中是如何工作的了。
### 问题Facebook 怎么知道你逛了 Old Navy
我时常听人们说起这种有些诡异的上网经历:你在线上浏览了一个商品,一天之后,竟然看到了同一款靴子(或者是别的什么你当时浏览的商品)的广告。这就是所谓的“再营销”,但它到底是如何实现的呢?
在本文中,我们来进行一个小实验,看看 Facebook 究竟是怎么知道你在线上浏览了什么商品的。这里使用 Facebook 作为示例,只是因为很容易找到投放了 Facebook 追踪像素的网站;其实,几乎所有互联网广告公司都会使用类似的追踪技术。
在本文中,我们来进行一个小实验,看看 Facebook 究竟是怎么知道你在线上浏览了什么商品的。这里使用 Facebook 作为示例,只是因为很容易找到使用了 Facebook 像素追踪技术的网站;其实,几乎所有互联网广告公司都会使用类似的追踪技术。
### 准备:允许第三方追踪器,同时关闭广告拦截器
@ -24,16 +26,20 @@
首先,我将隐私设置从默认设置([截图][1])修改为允许第三方追踪器的个性化设置([截图][2]),然后禁用了一些平时运行的隐私保护扩展。
### 追踪像素:关键不在于 gif而在于请求参数
![截图][1]
追踪像素是网站用来追踪你的一个 1x1 大小的 gif。就其本身而言一个小小的 1x1 gif 显然起不到什么作用。那么,追踪像素到底是如何进行追踪的?其中涉及两个方面:
![截图][2]
1. 通过使用追踪像素上的**请求参数**,网站可以添加额外的信息,比如你正在访问的页面。这样一来,请求的就不是 `https://www.facebook.com/tr/`(这个链接是一个 44 字节大小的 1x1 gif而是 `https://www.facebook.com/tr/?the_website_you're_on`。(邮件营销人员会使用类似的技巧,通过为追踪像素指定一个独特的 URL弄清楚你是否打开了某一封邮件。
2. 在发送该请求的同时,还发送了相应的 cookie。这样一来广告商就可以知道访问 oldnavy.com 的这个人和在同一台电脑上使用 Facebook 的是同一个人。
### 像素追踪:关键不在于 gif而在于请求参数
### Old Navy 网站上的 Facebook 追踪像素
像素追踪是网站用来追踪你的一个 1x1 大小的 gif。就其本身而言一个小小的 1x1 gif 显然起不到什么作用。那么,像素追踪到底是如何进行追踪的?其中涉及两个方面:
为了对此进行验证,我在 Old NavyGAP 旗下的一个服装品牌网站上浏览了一个商品相应的URL是 [https://oldnavy.gap.com/browse/product.do?pid=504753002&amp;cid=1125694&amp;pcid=1135640&amp;vid=1&amp;grid=pds_0_109_1][3](这是一件“男款短绒格子花呢大衣”)。
1. 通过使用像素追踪上的**请求参数**,网站可以添加额外的信息,比如你正在访问的页面。这样一来,请求的就不是 `https://www.facebook.com/tr/`(这个链接是一个 44 字节大小的 1x1 gif而是 `https://www.facebook.com/tr/?the_website_you're_on`。(邮件营销人员会使用类似的技巧,通过为像素追踪指定一个独特的 URL弄清楚你是否打开了某一封邮件。
2. 在发送该请求的同时,还发送了相应的 cookie。这样一来广告商就可以知道访问 oldnavy.com 的这个人和在同一台电脑上使用 Facebook 的是同一个人。
### Old Navy 网站上的 Facebook 像素追踪
为了对此进行验证,我在 Old NavyGAP 旗下的一个服装品牌)网站上浏览了一个商品,相应的 URL 是 `https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1`(这是一件“男款短绒格子花呢大衣”)。
在我浏览这个商品的同时,页面上运行的 Javascript用的应该是[这段代码][4])向 facebook.com 发送了一个请求。在开发者工具中,该请求看上去是这样的:(我屏蔽了大部分 cookie 值,因为其中有一些是我的登录 cookie
@ -41,14 +47,23 @@
下面对其进行拆解分析:
1. 我的浏览器向 ` https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET` 发送了一个请求;
2. 与该请求同时发送的,还有一个名为 `fr` 的 cookie取值为 `10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`(估计是我的 Facebook 广告追踪 ID
1. 我的浏览器向如下 URL 发送了一个请求;
在所发送的追踪像素查询字符串里,有三个值得注意的地方:
```
https://www.facebook.com/tr/?id=937725046402747&ev=PageView&dl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fproduct.do%3Fpid%3D504753002%26cid%3D1125694%26pcid%3Dxxxxxx0%26vid%3D1%26grid%3Dpds_0_109_1%23pdp-page-content&rl=https%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D1135640%26mlink%3D5155%2Cm_mts_a&if=false&ts=1576684838096&sw=1920&sh=1080&v=2.9.15&r=stable&a=tmtealium&ec=0&o=30&fbp=fb.1.1576684798512.1946041422&it=15xxxxxxxxxx4&coo=false&rqm=GET
```
2. 与该请求同时发送的,还有一个名为 `fr` 的 cookie取值为
* 我当前访问的页面:[https://oldnavy.gap.com/browse/product.do?pid=504753002&amp;cid=1125694&amp;pcid=1135640&amp;vid=1&amp;grid=pds_0_109_1#pdp-page-content][6]
* 引导我来到当前页面的上一级页面:[https://oldnavy.gap.com/browse/category.do?cid=1135640&amp;mlink=5155,m_mts_a][7]
* 作为我的身份标识的 cookie`10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`
```
10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.
```
(估计是我的 Facebook 广告追踪 ID
在所发送的像素追踪查询字符串里,有三个值得注意的地方:
* 我当前访问的页面:`https://oldnavy.gap.com/browse/product.do?pid=504753002&cid=1125694&pcid=1135640&vid=1&grid=pds_0_109_1#pdp-page-content`
* 引导我来到当前页面的上一级页面:`https://oldnavy.gap.com/browse/category.do?cid=1135640&mlink=5155,m_mts_a`
* 作为我的身份标识的 cookie`10oGXEcKfGekg67iy.AWVdJq5MG3VLYaNjz4MTNRaU1zg.Bd-kxt.KU.F36.0.0.Bd-kx6.`
### 下面来逛逛 Facebook
@ -60,11 +75,11 @@
Facebook 用来追踪我访问了哪些网站的 cookie属于所谓的“第三方 cookie”因为 Old Navy 的网站使用它为一个第三方(即 facebook.com确认我的身份。这和用来维持登录状态的“第一方 cookie”有所不同。
Safari 和 Firefox 默认都会拦截许多第三方 cookie所以需要更改 Firefox 的隐私设置,才能够进行这个实验),而 Chrome 目前并不进行拦截(很可能是因为 Chrome 的所有者正是一个广告公司)。
Safari 和 Firefox 默认都会拦截许多第三方 cookie所以需要更改 Firefox 的隐私设置,才能够进行这个实验),而 Chrome 目前并不进行拦截(很可能是因为 Chrome 的所有者正是一个广告公司)。LCTT 译注Chrome 可以设置阻拦)
### 网站上的追踪像素有很多
### 网站上的像素追踪有很多
如我所料,网站上的追踪像素**很多**。比如wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的追踪像素。wrangler.com 上的追踪像素分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及`adservice.google.com`。
如我所料,网站上的像素追踪有 **很多**。比如wrangler.com 在我的浏览器里加载了来自不同域的 19 个不同的像素追踪。wrangler.com 上的像素追踪分别来自:`ct.pinterest.com`、`af.monetate.net`、`csm.va.us.criteo.net`、`google-analytics.com`、`dpm.demdex.net`、`google.ca`、`a.tribalfusion.com`、`data.photorank.me`、`stats.g.doubleclick.net`、`vfcorp.dl.sc.omtrdc.net`、`ib.adnxs.com`、`idsync.rlcdn.com`、`p.brsrvr.com`,以及 `adservice.google.com`
Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的大部分追踪器都会被拦截:
@ -72,13 +87,13 @@ Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的
### 浏览器的重要性
浏览器之所以如此重要是因为你的浏览器最终决定了发送你的什么信息、发送到哪些网站。Old Navy 网站上的 Javascript 可以请求你的浏览器向 Facebook 发送关于你的追踪信息,但浏览器可以拒绝执行。浏览器的决定可以是:“哈,我知道 facebook.com/tr/ 是一个追踪像素,我不想让我的用户被追踪,所以我不会发送这个请求”。
浏览器之所以如此重要是因为你的浏览器最终决定了发送你的什么信息、发送到哪些网站。Old Navy 网站上的 Javascript 可以请求你的浏览器向 Facebook 发送关于你的追踪信息,但浏览器可以拒绝执行。浏览器的决定可以是:“哈,我知道 facebook.com/tr/ 是一个像素追踪,我不想让我的用户被追踪,所以我不会发送这个请求”。
浏览器还可以允许用户对上述行为进行配置,方法包括更改浏览器设置,以及安装浏览器扩展(所以才会有如此多的隐私保护扩展)。
### 摸清其中原理,实为一件趣事
在我看来,弄清楚 cookie / 追踪像素是怎么用于对你进行追踪的,实在是一件趣事(尽管显得有点阴险)。我之前大概明白其中的道理,但是并没有亲自查看过追踪像素上的 cookie也没有看过发送的查询参数上究竟包含什么样的信息。
在我看来,弄清楚 cookie/像素追踪是怎么用于对你进行追踪的,实在是一件趣事(尽管有点吓人)。我之前大概明白其中的道理,但是并没有亲自查看过像素追踪上的 cookie也没有看过发送的查询参数上究竟包含什么样的信息。
当然,明白了其中的原理,也就更容易降低被追踪的概率了。
@ -86,9 +101,9 @@ Firefox 贴心地指出,如果使用 Firefox 的标准隐私设置,其中的
为了尽量避免在互联网上被追踪,我采取了几种简单的措施:
* 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以针对许多追踪器的域进行拦截。
* 使用目前默认隐私保护强度更高的 Firefox/Safari而不是 Chrome。
* 使用 [Facebook Container][9] 这个 Firefox 扩展。该扩展针对 Facebook 进一步采取了防止追踪的措施。
* 安装一个广告拦截器(比如 ublock origin 之类)。广告拦截器可以针对许多追踪器的域进行拦截。
* 使用目前默认隐私保护强度更高的 Firefox/Safari而不是 Chrome。
* 使用 [Facebook Container][9] 这个 Firefox 扩展。该扩展针对 Facebook 进一步采取了防止追踪的措施。
虽然在互联网上被追踪的方式还有很多(尤其是在使用手机应用的时候,因为在这种情况下,你没有和像对浏览器一样的控制程度),但是能够理解这种追踪方法的工作原理,稍微减少一些被追踪的可能性,也总归是一件好事。
@ -98,8 +113,8 @@ via: https://jvns.ca/blog/how-tracking-pixels-work/
作者:[Julia Evans][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/chen-ni)
校对:[校对者ID](https://github.com/校对者ID)
译者:[chen-ni](https://github.com/chen-ni)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11722-1.html)
[#]: subject: (How to Start, Stop & Restart Services in Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/start-stop-restart-services-linux/)
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
@ -10,37 +10,33 @@
如何在 Ubuntu 和其他 Linux 发行版中启动、停止和重启服务
======
服务是必不可少的后台进程,它通常随系统启动,并在关机时关闭。
![](https://img.linux.net.cn/data/attachment/album/201912/28/081645vee5lkult55kituu.jpg)
如果你是系统管理员,那么你会定期处理服务。
如果你是普通桌面用户,你可能会遇到需要重启服务的情况,例如[安装 Barrier 来用于在计算机之间共享鼠标和键盘][1]。或[在使用 ufw 设置防火墙][2]时。
服务是必不可少的后台进程,它通常随系统启动,并在关机时关闭。如果你是系统管理员,那么你会定期处理服务。如果你是普通桌面用户,你可能会遇到需要重启服务的情况,例如[安装 Barrier 来用于在计算机之间共享鼠标和键盘][1]。或[在使用 ufw 设置防火墙][2]时。
今天,我将向你展示两种管理服务的方式。你将学习在 Ubuntu 或任何其他 Linux 发行版中启动、停止和重启服务。
systemd 与 init
> systemd 与 init
>
> 如今Ubuntu 和许多其他发行版都使用 systemd 而不是旧的 init。
>
> 在 systemd 中,可以使用 `systemctl` 命令管理服务。
>
> 在 init 中,你可以使用 `service` 命令管理服务。
>
> 你会注意到,即使你的 Linux 系统使用 systemd它仍然可以使用 `service` 命令(与 init 系统一起使用的)。这是因为 `service` 命令实际上已重定向到 `systemctl`。systemd 引入了向后兼容性,因为系统管理员们习惯使用 `service` 命令。
>
> 在本教程中,我将同时展示 `systemctl``service` 命令。
如今Ubuntu 和许多其他发行版都使用 systemd 而不是旧的 init。
在 systemd 中,可以使用 systemctl 命令管理服务。
在 init 中,你可以使用 service 命令管理服务。
你会注意到,即使你的 Linux 系统使用 systemd它仍然可以使用 service 命令(为了与 init 系统一起使用)。这是因为 service 命令实际上已重定向到 systemctl。systemd 引入了向后兼容性,因为系统管理员们习惯使用 service 命令。
在本教程中,我将同时展示 systemctl 和 service 命令。
_我的是 Ubuntu 18.04但其他版本的过程也一样_。
我用的是 Ubuntu 18.04,但其他版本的过程也一样。
### 方法 1使用 systemd 在 Linux 中管理服务
我从 systemd 开始,因为它被广泛接受。
#### 1\. 列出所有服务
#### 1、列出所有服务
为了管理服务,你首先需要知道系统上有哪些服务可用。
你可以使用 systemd 命令列出 Linux 系统上的所有服务:
为了管理服务,你首先需要知道系统上有哪些服务可用。你可以使用 systemd 的命令列出 Linux 系统上的所有服务:
```
systemctl list-unit-files --type service -all
@ -48,9 +44,9 @@ systemctl list-unit-files --type service -all
![systemctl list-unit-files][3]
此命令将输出所有服务的状态。服务状态有启用、禁用、屏蔽(在取消掩码之前处于非活动状态)、静态和已生成
此命令将输出所有服务的状态。服务状态有<ruby>启用<rt>enabled</rt></ruby><ruby>禁用<rt>disabled</rt></ruby><ruby>屏蔽<rt>masked</rt></ruby>(在取消屏蔽之前处于非活动状态)、<ruby>静态<rt>static</rt></ruby><ruby>已生成<rt>generated</rt></ruby>
与 [grep 命令][4] 结合,你可以**仅显示正在运行的服务**
与 [grep 命令][4] 结合,你可以仅显示正在运行的服务:
```
sudo systemctl | grep running
@ -60,9 +56,9 @@ sudo systemctl | grep running
现在,你知道了如何引用所有不同的服务,你可以开始主动管理它们。
**注意:** 命令中的 **&lt;service-name&gt;** 应该用你想管理的服务名代替。比如network-manager、ufw 等)
**注意:** 下列命令中的 `<service-name>` 应该用你想管理的服务名代替。比如network-manager、ufw 等)
#### 2\. 启动服务
#### 2启动服务
要在 Linux 中启动服务,你只需使用它的名字:
@ -70,15 +66,15 @@ sudo systemctl | grep running
systemctl start <service-name>
```
#### 3\. 停止服务
#### 3停止服务
要停止 systemd 服务,可以使用 systemctl 命令的 stop 选项:
要停止 systemd 服务,可以使用 `systemctl` 命令的 `stop` 选项:
```
systemctl stop <service-name>
```
#### 4\. 重启服务
#### 4重启服务
要重启 systemd 服务,可以使用:
@ -86,7 +82,7 @@ systemctl stop <service-name>
systemctl restart <service-name>
```
#### 5\. 检查服务状态
#### 5检查服务状态
你可以通过打印服务状态来确认你已经成功执行特定操作:
@ -104,7 +100,7 @@ systemctl status <service-name>
init 的命令和 systemd 的一样简单。
#### 1\. 列出所有服务
#### 1列出所有服务
要列出所有 Linux 服务,使用:
@ -114,9 +110,9 @@ service --status-all
![service status-all][7]
前面的 **[ ]** 代表**禁用****[ + ]** 代表**启用**。
前面的 `[ ]` 代表**禁用**`[ + ]` 代表**启用**。
#### 2\. 启动服务
#### 2启动服务
要在 Ubuntu 和其他发行版中启动服务,使用命令:
@ -124,7 +120,7 @@ service --status-all
service <service-name> start
```
#### 3\. 停止服务
#### 3停止服务
停止服务同样简单。
@ -132,7 +128,7 @@ service <service-name> start
service <service-name> stop
```
#### 4\. 重启服务
#### 4重启服务
如果你想重启服务,命令是:
@ -140,9 +136,9 @@ service <service-name> stop
service <service-name> restart
```
#### 5\. 检查服务状态
#### 5检查服务状态
此外,要检查是否达到了预期的结果,你可以输出服务**状态**
此外,要检查是否达到了预期的结果,你可以输出服务状态:
```
service <service-name> status
@ -152,9 +148,9 @@ service <service-name> status
![service status][8]
最重要的是,这将告诉你某项服务是否处于活跃状态(**正在运行**)。
最重要的是,这将告诉你某项服务是否处于活跃状态(正在运行)。
**总结**
### 总结
今天,我详细介绍了两种在 Ubuntu 或任何其他 Linux 系统上管理服务的非常简单的方法。 希望本文对你有所帮助。
@ -167,7 +163,7 @@ via: https://itsfoss.com/start-stop-restart-services-linux/
作者:[Sergiu][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,129 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11726-1.html)
[#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/update-grub/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何在 Ubuntu 和其它 Linux 发行版上更新 grub
======
![](https://img.linux.net.cn/data/attachment/album/201912/29/110155d51bhogs5ezp5p71.png)
在这篇文章中,你将学习在 Ubuntu 或任何其它 Linux 发行版上更新 grub 。你也将学习一个或两个关于更新这个 grub 过程如何工作的事情。
### 如何更新 grub
Ubuntu 和很多其它的 Linux 发行版提供一个易使用的称为 `update-grub` 命令行实用程序。
为更新 grub ,你所要的全部工作就是使用 `sudo` 在终端中运行这个命令。
```
sudo update-grub
```
你应该看到一个像这样的输出:
```
[email protected]:~$ sudo update-grub
[sudo] password for abhishek:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found initrd image: /boot/initrd.img-5.0.0-36-generic
Found linux image: /boot/vmlinuz-5.0.0-31-generic
Found initrd image: /boot/initrd.img-5.0.0-31-generic
Found Ubuntu 19.10 (19.10) on /dev/sda4
Found MX 19 patito feo (19) on /dev/sdb1
Adding boot menu entry for EFI firmware configuration
done
```
你可能看到一个类似的称为 `update-grub2` 的命令。不需要在 `update-grub``update-grub2` 之间感到害怕或不知所措。这两个命令执行相同的动作。
大约在 10 年前,当 grub2 刚刚被引进时,`update-grub2` 命令也被引进。现在,`update-grub2` 只是一个链接到 `update-grub` 的符号,它们都更新 grub2 配置(因为 grub2 是默认的)。
#### 不能找到 update-grub 命令?这里是在这种情况下该做什么
它可能是,你的 Linux 发行版可能没有可用的 `update-grub` 命令。
在这种情况下你该做什么?你如何在这样一个 Linux 发行版上更新 grub
在这里不需要惊慌。`update-grub` 命令只是一个入口,用于运行 `grub-mkconfig -o /boot/grub/grub.cfg` 来生成 grub2 配置文件。
这意味着你可以在任意 Linux 发行版上使用下面的命令更新 grub
```
sudo grub-mkconfig -o /boot/grub/grub.cfg
```
当然,记住 `update-grub` 命令比上面的命令容易很多,这是为什么它在一开始被创建的原因。
### update-grub 是如何工作的?
当你安装一个 Linux 发行版时,它(通常)要求你安装 [grub 启动引导程序][1]。
grub 的一部分安装在 MBR/ESP 分区上。grub 的剩余部分保留在 Linux 发行版的 `/boot/grub` 目录中。
依据它的 [man 页面][2]`update-grub` 通过查找 `/boot` 目录来工作。所有以 [vmlinuz-][3] 开头的文件将被作为内核来对待,并且它们将得到一个 grub 菜单项。它也将为与所找到内核版本相同的 [ramdisk][4] 镜像添加 initrd 行。
它也使用 [os-prober][5] 为其它操作系统查找所有磁盘分区。如果找到其它操作系统,它添加它们到 grub 菜单。
![Representational image of Grub Menu][6]
### 为什么你需要更新 grub
在有很多场景下你需要更新 grub。
假设你修改 grub 配置文件(`/etc/default/grub`)以 [更改默认启动顺序][7] 或减少默认启动时间。除非你更新 grub ,否则你的修改将不会生效。
另一种情况是,你在同一个电脑系统上安装多个 Linux 发行版。
例如,在我的 Intel NUC 上,我有两个磁盘。第一个磁盘有 Ubuntu 19.10 ,并且我在其上面安装了 Ubuntu 18.04 。第二个操作系统Ubuntu 18.04)安装了其自己的 grub ,现在 grub 启动屏幕由 Ubuntu 18.04 grub 控制。
在第二个磁盘上,我安装了 MX Linux ,但是这次我没有安装 grub。我希望现有的 grub由 Ubuntu 18.04 控制)来处理所有的操作系统项目。
现在,在这种情况中,在 Ubuntu 18.04 上的 grub 需要更新,以便它能够看到 [MX Linux][8] 。
![][9]
如上图所示,当我更新 grub 时,它在 18.04 上找到很多安装的 Linux 内核, 以及在不同的分区上 Ubntu 19.10 和 MX Linux 。
如果你想让 MX Linux 控制 grub ,我可以使用 [grub-install][10] 命令来在 MX Linux 上安装 grub然后在 MX Linux 上的 grub 将开始控制 grub 启动屏幕。你已经明白这点,对吧?
使用一个像 [Grub Customizer][11] 的 GUI 工具是在 grub 中进行更改的一种简单的方法。
### 最后…
最初,我打算保持它为一篇短文作为一种快速提示。但是后来我想解释一些与之相关的东西,以便(相对)新的 Linux 用户能够学到更多,而不仅仅是一个简单命令。
你喜欢它吗?你有一些问题或建议吗?请随意发表评论。
--------------------------------------------------------------------------------
via: https://itsfoss.com/update-grub/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/GNU_GRUB
[2]: https://manpages.debian.org/testing/grub-legacy/update-grub.8.en.html
[3]: https://www.ibm.com/developerworks/community/blogs/mhhaque/entry/anatomy_of_the_initrd_and_vmlinuz?lang=en
[4]: https://en.wikipedia.org/wiki/Initial_ramdisk
[5]: https://packages.debian.org/sid/utils/os-prober
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/grub_screen.png?ssl=1
[7]: https://itsfoss.com/grub-customizer-ubuntu/
[8]: https://mxlinux.org/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/update_grub.png?ssl=1
[10]: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html
[11]: https://itsfoss.com/customize-grub-linux/

View File

@ -1,26 +1,30 @@
[#]: collector: (lujun9972)
[#]: translator: (HankChow)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11718-1.html)
[#]: subject: (Why your Python code needs to be beautiful and explicit)
[#]: via: (https://opensource.com/article/19/12/zen-python-beauty-clarity)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
为什么 Python 代码要写得美观而明确
======
欢迎阅读“Python 光明节Pythonukkah”系列文章这个系列文章将会讨论《Python 之禅》。我们首先来看《Python 之禅》里的前两个原则:美观与明确。
![Searching for code][1]
早在 1999 年Python 的贡献者之一Tim Peters 就提出了《[Python 之禅][2]》直到二十年后的今天《Python 之禅》中的 19 条原则仍然对整个社区都产生着深远的影响。为此我们举行了这一次的“Python 光明节”。首先我们会讨论《Python 之禅》中的前两个原则:美观和明确。
> 欢迎阅读“Python 光明节Pythonukkah”系列文章这个系列文章将会讨论《Python 之禅》。我们首先来看《Python 之禅》里的前两个原则:美观与明确。
> "Hanukkah is the Festival of Lights,
> Instead of one day of presents, we get eight crazy nights."
> —亚当·桑德勒, [光明节之歌][3]
![](https://img.linux.net.cn/data/attachment/album/201912/27/091634drq96c2fojzp6okr.png)
早在 1999 年Python 的贡献者之一Tim Peters 就提出了《[Python 之禅][2]》直到二十年后的今天《Python 之禅》中的 19 条原则仍然对整个社区都产生着深远的影响。为此,就像庆典光明的<ruby>光明节<rt>Hanukkah</rt></ruby>一样,我们举行了这一次的“<ruby>Python 光明节<rt>Pythonukkah</rt></ruby>”。首先我们会讨论《Python 之禅》中的前两个原则:美观和明确。
> “Hanukkah is the Festival of Lights,
>
> Instead of one day of presents, we get eight crazy nights.”
>
> —亚当·桑德勒,[光明节之歌][3]
### 美观胜于丑陋
著名的《[<ruby>计算机程序的构造和解释<rt>Structure and Interpretation of Computer Programs</rt></ruby>][4]》中有这么一句话代码是写给人看的只是恰好能让机器运行Programs must be written for people to read and only incidentally for machines to execute.)。毕竟机器并不在乎代码的美观性,但人类在乎。
著名的《[<ruby>计算机程序的构造和解释<rt>Structure and Interpretation of Computer Programs</rt></ruby>][4]》中有这么一句话:<ruby>代码是写给人看的,只是恰好能让机器运行<rt>Programs must be written for people to read and only incidentally for machines to execute.</rt></ruby>机器并不在乎代码的美观性,但人类在乎。
阅读美观的代码对人们来说是一种享受,这就要求在整套代码中保持一致的风格。使用诸如 [Black][5]、[flake8][6]、[Pylint][7] 这一类工具能够有效地接近这一个目标。
@ -28,7 +32,7 @@
最后,个人的主观能动性也很重要,否则一切工具和流程都会变得毫无意义。只有意识到美观的重要性,才能主动编写出美观的代码。
这就是为什么美观在众多原则当中排到了首位,它让“美”成为了 Python 社区的一种价值。如果有人要问,”我们真的在乎美吗?“社区会以代码给出肯定的答案。
这就是为什么美观在众多原则当中排到了首位,它让“美”成为了 Python 社区的一种价值。如果有人要问,”我们*真的*在乎美吗?“社区会以代码给出肯定的答案。
### 明确胜于隐晦
@ -38,7 +42,7 @@
这个问题已经是老生常谈了,但网络上很多流传已久的回答都是不准确的。在编写<ruby>元类<rt>metaclass</rt></ruby>时,显式指定 `self` 参数就显得毫无意义。如果你没有编写过元类,希望你可以尝试一下,这是很多 Python 程序员的必经之路。
显式指定 `self` 参数的原因并不是 Python 的设计者不想将这样的元类视为“默认”元类,而是因为第一个参数必须是显式的。
显式指定 `self` 参数的原因并不是 Python 的设计者不想将这样的元类视为“默认”元类,而是因为第一个参数必须是*显式*的。
即使 Python 中确实允许非显式的情况存在(例如上下文变量),但我们还是应该提出疑问:某个东西是不是有存在的必要呢?如果非显式地传递参数会不会出现问题呢?有些时候,由于种种原因,这是会有问题的。总之,在写代码时一旦能够优先考虑到明确性,至少意味着能对不明确的地方提出疑问并对结果作出有效的估计。
@ -49,7 +53,7 @@ via: https://opensource.com/article/19/12/zen-python-beauty-clarity
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[HankChow](https://github.com/HankChow)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11724-1.html)
[#]: subject: (Unix is turning 50. What does that mean?)
[#]: via: (https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html)
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
@ -12,17 +12,17 @@ Unix 即将迎来 50 岁
Unix 时间(又称为“<ruby>纪元时间<rt>epoch time</rt></ruby>”)是自 1970 年 1 月 1 日以来经过的秒数。当 Unix 即将 50 岁时,让我们看一下让内核开发人员担心的地方。
[cbaquiran][1]
![](https://img.linux.net.cn/data/attachment/album/201912/28/120311hzghpxux1hp5t4xo.jpg)
对于 Unix 而言2020 年是重要的一年。在这一年年初Unix 进入 50 岁。
尽管 Unix 的某些早期开发早于其“纪元”的正式开始,但 1970 年 1 月 1 日仍然是 POSIX 时间的零点,也是公认的 Unix 的万物之始。自那一刻算起2020 年 1 月 1 日将是其 50 周年。
尽管 Unix 的某些早期开发早于其“纪元”的正式开始,但 1970 年 1 月 1 日仍然是 POSIX 时间的零点,也是公认的 Unix 的万物之始。自那一刻算起2020 年 1 月 1 日将是其 50 周年。LCTT 译注:实际上,在 1971/11/3 出版的第一版《Unix 程序员手册》中,将 1971/1/1 作为 Unix 纪元的开始,并且一秒钟记录 60 个数,但是后来发现这样 32 位整型数字只能记录两年多,后来这个纪元被一再重新定义,改为从 1970/1/1 开始,每秒 1 个数。)
### Unix 时间与人类时间
就人类时间而言50 年是很重要的。就 Unix 时间而言50 年没有什么特别的。48.7 年同样重要。
Unix包括 Linux系统将日期/时间值存储为自 1970-01-01 00:00:00 UTC 以来经过的秒数32 位二进制)。要确定自该时间以来经过了几秒钟,看看 Unix 时间值是什么样子,你可以发出如下命令:
Unix包括 Linux系统将日期/时间值存储为自 1970-01-01 00:00:00 UTC 以来经过的秒数32 位整型)。要确定自该时间以来经过了多少秒钟,看看 Unix 时间值是什么样子,你可以发出如下命令:
```
$ date +%s
@ -47,7 +47,7 @@ $ echo '2^31' | bc
2147483648
```
并且,由于 Unix 计数以 0 开头,这意味着我们有 2,147,483,648 个值,但最大的可能值为 2,147,483,647 个。Unix 日期/时间值不能超过该数字——就像汽车上的里程表可能不能超过 999,999 英里一样。加 1 该值就变为了 -2147483648。LCTT 译注:此处原文描述有误,已修改。在达到最大值之后,即 2018/1/19 03:14:07下 1 秒导致符号位变为 1其余 31 位为 0即 -2147483648时间变为 1901/12/13 20:45:52这就是 Y2K38 问题。)
并且,由于 Unix 计数以 0 开头,这意味着我们有 2,147,483,648 个值,但最大的可能值为 2,147,483,647 个。Unix 日期/时间值不能超过该数字——就像汽车上的里程表可能不能超过 999,999 英里一样。加 1 该值就变为了 -2147483648。LCTT 译注:此处原文描述有误,已修改。在达到最大值之后,即 2038/1/19 03:14:07下 1 秒导致符号位变为 1其余 31 位为 0即 -2147483648时间变为 1901/12/13 20:45:52这就是 Y2K38 问题。)
### 一年有多少秒?
@ -65,6 +65,8 @@ $ expr 24 \* 60 \* 60 \* 366
31622400
```
LCTT 译注Unix 时间将一天精确定义为 24 * 60 * 60 = 86400 秒,忽略闰秒。)
### Unix 将如何庆祝其 50 岁生日?
2020 年 1 月 1 日中午 12:00 是纪元时间的 1577836800。这个计算有些棘手但主要是因为我们必须适应闰年。自该纪元开始以来我们经历了 12 个闰年,从 1972 年开始,到上一个闰年是 2016 年。而且,当我们达到 2020 年时,我们将有 38 个常规年份。
@ -83,7 +85,7 @@ $ expr 31536000 \* 38 + 31622400 \* 12
1577836800
```
这种跟踪日期和时间的方式使 Unix 系统完全不受 Y2K 恐慌的影响1999 年末人们开始担心进入 2000 年会对计算机系统造成严重破坏但是实际遇到的问题比人们担心的少得多。实际上,只有以两位数格式存储年份的应用程序才会将年份变为 00以表示时间倒退。尽管如此许多应用程序开发人员还是做了很多额外的繁琐工作以确保 2000 年到来时,他们的系统不会出现严重问题。
这种跟踪日期和时间的方式使 Unix 系统完全不受 Y2K 恐慌的影响1999 年末人们开始担心进入 2000 年会对计算机系统造成严重破坏但是实际遇到的问题比人们担心的少得多。实际上,只有以两位数格式存储年份的应用程序才会将年份变为 00以表示时间倒退。尽管如此许多应用程序开发人员还是做了很多额外的繁琐工作以确保 2000 年到来时,他们的系统不会出现严重问题。
### Unix 时间何时会遇到问题?
@ -91,6 +93,8 @@ $ expr 31536000 \* 38 + 31622400 \* 12
2038 年的问题有时称为 Y2K38 问题。我们必须在 2038 年 1 月 19 日星期二之前解决这个问题。如果问题到时候仍未解决,则该日期之后的系统可能会认为是 1901 年。解决该问题的一种方法是切换为日期/时间信息的 64 位表示形式。有些人认为即使那样也会有比听起来更复杂的问题。无论如何恐慌还为时过早。并且与此同时也许在新年前夜演唱了《Auld Lang Syne》之后你可以向 Unix 唱《生日快乐》歌了。Unix 50 岁了,这仍然是大事。
LCTT 译注:建议阅读一下 Unix 时间的[维基百科][6]页面,有更多有趣和不为人知的信息。)
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-that-mean.html
@ -98,7 +102,7 @@ via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-t
作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
@ -109,3 +113,4 @@ via: https://www.networkworld.com/article/3511428/unix-is-turning-50-what-does-t
[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage)
[4]: https://www.facebook.com/NetworkWorld/
[5]: https://www.linkedin.com/company/network-world
[6]: https://en.wikipedia.org/wiki/Unix_time

View File

@ -0,0 +1,112 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Darktable 3 Released With GUI Rework and New Features)
[#]: via: (https://itsfoss.com/darktable-3-release/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Darktable 3 Released With GUI Rework and New Features
======
Heres the Christmas gift for the photography enthusiasts. Darktable 3.0 has just released.
[Darktable][1] is one of the [best applications for editing RAW images on Linux][2]. You can consider it as a [free and open source alternative to Adobe Lightroom][3].
Darktable 3 is a major new release with tons of feature improvements and a complete rework of the user interface. The GUI is now completely controlled by GTK+ CSS rules, which makes the whole GUI themable. There are eight themes available by default.
With the help of over 3000 commits and 553 pull requests, the new release has fixed 66 bugs and added many new features.
Lets see what features this new release brings.
### New features in Darktable 3.0
![Darktable 3.0 Screenshot][4]
Here are the highlighted new features:
* Reworked UI
* A new module for handling 3D RGB Lut transformations
* Many improvements to the denoise (profiled) module
* A new culling mode and timeline view added
* Many improvements to the denoise (profiled) module
* New tone equalizer basic and filmic RGB modules
* Better 4K/5K display support
* Undo/redo support for more operations
* Many code optimizations for CPU and SSE paths
* Support for exporting to Google Photos
* More camera support, white balance presets, and noise profiles
* Plenty of bug fixes and feature improvements
You can read about all the changes in the [release notes on GitHub][5].
### Installing Darktable 3.0 on Linux
Lets see how to get the latest Darktable release.
#### Installing Darktable 3.0 on Ubuntu-based distributions
Darktable is available in Ubuntu but you wont get the latest release immediately. For the LTS version, it may take months before you have this version update.
Worry not! Darktable provides its [own PPA][6] to install the latest release on Ubuntu-based distributions.
Unfortuntaley, That Darktable PPA has not been updated with the new release.
Worry not (again)! Thanks to our friend [Ji M of Ubuntu Handbook][7], we have an unofficial PPA for easily installing Darktable 3.0 on Ubuntu and other Ubuntu based distributions.
Open a terminal and use these commands one by one:
```
sudo add-apt-repository ppa:ubuntuhandbook1/darktable
sudo apt update
sudo apt install darktable
```
#### Uninstall Darktable 3
To remove Darktable installed via this PPA, you can first uninstall the application:
```
sudo apt remove darktable
```
And then [remove the PPA][8] as well:
```
sudo add-apt-repository -r ppa:ubuntuhandbook1/darktable
```
#### Installing Darktable on other Linux distributions
You may wait for your distribution to provide this new release through the software manager.
You may also download the tarball or the entire source code from the GitHub release page (its at the bottom of the page).
[Download Darktable 3.0][5]
With Darktable 3, you can edit your holiday pictures better :)
--------------------------------------------------------------------------------
via: https://itsfoss.com/darktable-3-release/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.darktable.org/
[2]: https://itsfoss.com/raw-image-tools-linux/
[3]: https://itsfoss.com/open-source-photoshop-alternatives/
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/darktable_3_screenshot.jpg?ssl=1
[5]: https://github.com/darktable-org/darktable/releases/tag/release-3.0.0
[6]: https://launchpad.net/~pmjdebruijn/+archive/ubuntu/darktable-release
[7]: http://ubuntuhandbook.org/index.php/2019/12/install-darktable-3-0-0-ubuntu-18-04-19-10/
[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/

View File

@ -0,0 +1,63 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to run a business with open source: Top reads)
[#]: via: (https://opensource.com/article/19/12/business-open-source)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
How to run a business with open source: Top reads
======
Open source software is open for business, as evidenced in the these top
5 articles from 2019.
![Open for business][1]
Open source is ready to get to work, and in 2019, Opensource.com had many great articles about how organizations have adopted open source software or open methods to drive their business. As open source matures, we've seen open source not just replace proprietary software, but create entirely new business models.
Check out this list of five outstanding articles from Opensource.com in 2019 about running a business with open source.
### Get your business up and running with these open source tools
In [_Get your business up and running with these open source tools_][2], I explain: "Yes, you really can operate a business using open source software." In this article, I review the key open source software tools that I use to run my company, including Inkscape, GIMP, LibreOffice, and Scribus.
### What's your favorite open source BI software?
As Lauren Maffeo explains in _[What's your favorite open source BI software?][3]_ "Open source business intelligence (BI) software helps users upload, visualize, and make decisions based on data that is pulled from several sources... BI involves turning data into insights that help your business make better decisions... Before choosing which open source BI tool to adopt, it's worth weighing the pros and cons of each tool against your business needs." The article's accompanying poll asks readers whether they prefer Pentaho, Logz.io, Cluvio, Qlikview, Sisense, or another BI application. Answer the poll to let us know which is your favorite and to see what other readers say.
### Scrum vs. kanban: Which agile framework is better?
Because scrum and kanban both fall under the agile framework umbrella, many people confuse them or think they're the same thing. There are differences, however. In [_Scrum vs. kanban: Which agile framework is better?_][4] Taz Brown explains the differences between scrum and kanban and helps you decide which one may be best for your team.
### What is Small Scale Scrum?
"Agile is fast becoming a mainstream way industries act, behave, and work as they look to improve efficiency, minimize costs, and empower staff. Most software developers naturally think, act, and work this way, and alignment towards agile software methodologies has gathered pace in recent years," write Agnieszka Gancarczyk and Leigh Griffin in [_What is Small Scale Scrum?_][5] In this article, they explain how the scrum agile methodology can help small teams work more efficiently.
### What does DevOps mean to you?
In *[What does DevOps mean to you?][6] *Girish Managoli offers one answer to this article's headline: "DevOps is a process of software development focusing on communication and collaboration to facilitate rapid application and product deployment." But there are a range of opinions and expectations around DevOps. To help explain DevOps and how to leverage it in organizations, Girish interviewed six experts to break down DevOps and the key practices and philosophies in making DevOps work for you.
### Open source is open for business
As open source plays an increasingly important role in business, there's more to learn about the topic. What do you want to know about it in 2020? Please share your ideas for articles in the comments—or even share your own experiences with running a business on open source software by [writing an article for Opensource.com][7].
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/business-open-source
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_openseries.png?itok=rCtTDz5G (Open for business)
[2]: https://opensource.com/article/19/9/business-creators-open-source-tools
[3]: https://opensource.com/article/19/8/favorite-open-source-bi-software
[4]: https://opensource.com/article/19/8/scrum-vs-kanban
[5]: https://opensource.com/article/19/1/what-small-scale-scrum
[6]: https://opensource.com/article/19/1/what-does-devops-mean-you
[7]: https://opensource.com/how-submit-article

View File

@ -1,3 +1,4 @@
chenmu-kk is translating.
How the four components of a distributed tracing system work together
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/touch-tracing.jpg?itok=rOmsY-nU)

View File

@ -1,91 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (Morisun029)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 interview questions every Kubernetes job candidate should know)
[#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions)
[#]: author: (Jessica Repka https://opensource.com/users/jrepka)
5 interview questions every Kubernetes job candidate should know
======
If you're interviewing people for Kubernetes-related roles, here's what
to ask and why it matters.
![Pair programming][1]
Job interviews are hard for people on both sides of the table, but I've discovered that interviewing candidates for Kubernetes-related jobs has seemed especially hard lately. Why, you ask? For one thing, it's hard to find someone who can answer some of my questions. Also, it has been hard to confirm whether they have the right experience, regardless of their answers to my questions.
I'll skip over my musings on that topic and get to some questions that you should ask of any job candidate who would be working with [Kubernetes][2].
### What is Kubernetes?
I've always found this question to be one of the best ones to ask in interviews. I always hear, "I work with Kubernetes," but when I ask, "what is it?" I never get a confident answer.
My favorite answer is from [Chris Short][3]: "Just an API with some YAML files."
While he is not wrong, I'll give you a more detailed version. Kubernetes is a portable container orchestration tool that is used to automate the tasks of managing, monitoring, scaling, and deploying containerized applications.
I've found that "an orchestration tool for deploying containerized applications" is probably as good as you're going to get as an answer, which in my opinion is good enough. While many believe Kubernetes adds a great deal more, overall, it offers many APIs to add to this core feature: container orchestration.
In my opinion, this is one of the best questions you can ask in an interview, as it at least proves whether the candidate knows what Kubernetes is.
### What is the difference between a Kubernetes node and a pod?
This question reveals a great first look at the complexity of Kubernetes. It shifts the conversation to an architectural overview and can lead to many interesting follow-up details. It has also been explained incorrectly to me an innumerable amount of times.
A [node][4] is the worker machine. This machine can be a virtual machine (VM) or a physical machine, depending on whether you are running on a hypervisor or on bare metal. The node contains services to run containers, including the kubelet, kube-proxy, and container runtime.
A [pod][5] includes (1) one or more containers (2) with shared network (3) and storage (4) and the specification on how to run the containers deployed together. All four of these details are important. For bonus points, an applicant could mention that, technically, a pod is the smallest deployable unit Kubernetes can create and manage—not a container.
The best short answer I've received for this question is: "The node is the worker, and the pod is the thing the containers are in." The distinction matters. Most of a Kubernetes administrator's job depends on knowing when to deploy what, and nodes can be very, very expensive, depending on where they are run. I wouldn't want someone deploying nodes over and over when what they needed to do was deploy a bunch of pods.
### What is kubectl? (And how do you pronounce it?)
This question is one of my higher priority questions, but it may not be relevant for you and your team. In my organization, we don't use a graphical interface to manage our Kubernetes environments, which means command-line actions are all we do.
So what is [kubectl][6]? It is the command-line interface to Kubernetes. You can get and set anything from there, from gathering logs and events to editing deployments and secrets. It's always helpful to pop in a random question about how to use this tool to test the interviewee's familiarity with kubectl.
How do you pronounce it? Well, that's up to you (there's a big disagreement on the matter), but I will gladly point you to this great video presentation by my friend [Waldo][7].
### What is a namespace?
I haven't received an answer to this question on multiple interviews. I am not sure that namespaces are used as often in other environments as they are in the organization I work in. I'll give a short answer here: a namespace is a virtual cluster in a pod. This abstraction is what enables you to keep several virtual clusters in various environments for isolation purposes.
### What is a container?
It always helps to know what is being deployed in your pod, because what's a deployment without knowing what you're deploying in it? A container is a standard unit of software that packages up code and all its dependencies. Two optional secondary answers I have received and am OK with include: a) a slimmed-down image of an OS and b) an application running in a limited OS environment. Bonus points if you can name orchestration software that uses containers other than [Docker][8], like your favorite public cloud's container service.
### Other questions
If you're wondering why I didn't add more to this list of questions, I have an easy answer for you: these are the minimum set of things _you_ should know when you are asking candidates interview questions. The next set of questions should come from a large list of questions based on your specific team, environment, and organization. As you think through these, try to find interesting questions about how technology interacts with each other to see how people think through infrastructure challenges. Think about recent challenges your team had (outages), ask to walk through deployments step-by-step, or about strategies to improve something your team actively wants to improve (like a reduction to deployment time). The less abstract the questions, the more your asking about skills that will actually matter after the interview.
**[Read more: [How to prepare for a Kubernetes job interview]][9]**
No two environments will be the same, and this also applies when you are interviewing people. I mix up questions in every interview. I also have a small environment I can use to test interviewees. I always find that answering the questions is the easiest part, and doing the work is the real test you need to give.
My last bit of advice for anyone giving interviews: If you meet someone who has potential but none of the experience, give them a chance to prove themselves. I wouldn't have the knowledge and experience I have today if someone hadn't seen the potential of what I could do and given me an opportunity.
What are other important questions to ask interviewees about Kubernetes? Please add your list in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/kubernetes-interview-questions
作者:[Jessica Repka][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/jrepka
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1 (Pair programming)
[2]: https://kubernetes.io/
[3]: https://twitter.com/ChrisShort
[4]: https://kubernetes.io/docs/concepts/architecture/nodes/
[5]: https://kubernetes.io/docs/concepts/workloads/pods/pod/
[6]: https://kubernetes.io/docs/reference/kubectl/kubectl/
[7]: https://opensource.com/article/18/12/kubectl-definitive-pronunciation-guide
[8]: https://opensource.com/resources/what-docker
[9]: https://enterprisersproject.com/article/2019/2/kubernetes-job-interview-questions-how-prepare

View File

@ -1,192 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Kubernetes namespaces for beginners)
[#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces)
[#]: author: (Jessica Cherry https://opensource.com/users/jrepka)
Kubernetes namespaces for beginners
======
What is a namespace and why do you need it?
![Ship captain sailing the Kubernetes seas][1]
What is in a Kubernetes namespace? As Shakespeare once wrote, which we call a namespace, by any other name, would still be a virtual cluster. By virtual cluster, I mean Kubernetes can offer multiple Kubernetes clusters on a single cluster, much like a virtual machine is an abstraction of its host. According to the [Kubernetes docs][2]:
> Kubernetes supports multiple virtual clusters backed by the same physical cluster. These virtual clusters are called namespaces.
Why do you need to use namespaces? In one word: isolation.
Isolation has many advantages, including that it supports secure and clean environments. If you are the owner of the infrastructure and are supporting developers, isolation is fairly important. The last thing you need is someone who is unfamiliar with how your cluster is built going and changing the system configuration—and possibly disabling everyone's ability to log in.
### The namespaces that start it all
The first three namespaces created in a cluster are always **default**, **kube-system**, and **kube-public**. While you can technically deploy within these namespaces, I recommend leaving these for system configuration and not for your projects. 
* **Default** is for deployments that are not given a namespace, which is a quick way to create a mess that will be hard to clean up if you do too many deployments without the proper information. I leave this alone because it serves that one purpose and has confused me on more than one occasion.
* **Kube-system** is for all things relating to, you guessed it, the Kubernetes system. Any deployments to this namespace are playing a dangerous game and can accidentally cause irreparable damage to the system itself. Yes, I have done it; I do not recommend it.
* **Kube-public** is readable by everyone, but the namespace is reserved for system usage.
### Using namespaces for isolation
I have used namespaces for isolation in a couple of ways. I use them most often to split many users' projects into separate environments. This is useful in preventing cross-project contamination since namespaces provide independent environments. Users can install multiple versions of Jenkins, for example, and their environmental variables won't collide if they are in different namespaces.
This separation also helps with cleanup. If development groups are working on various projects that suddenly become obsolete, you can delete the namespace and remove everything in one swift movement with **kubectl delete ns &lt;$NAMESPACENAME&gt;**. (Please make sure it's the right namespace. I deleted the wrong one in production once, and it's not pretty.)
Be aware that this can cause damage across teams and problems for you if you are the infrastructure owner. For example, if you create a namespace with some special, extra-secure DNS functions and the wrong person deletes it, all of your pods and their running applications will be removed with the namespace. Any use of **delete** should be reviewed by a peer (through [GitOps][3]) before hitting the cluster.
While the official documentation suggests not using multiple namespaces [with 10 or fewer users][2], I still use them in my own cluster for architectural purposes. The cleaner the cluster, the better.
### What admins need to know about namespaces
For starters, namespaces cannot be nested in other namespaces. There can be only one namespace with deployments in it. You don't have to use namespaces for versioned projects, but you can always use the labels to separate versioned apps with the same name. Namespaces divide resources between users using resource quotas; for example, _this namespace can only have x_ _number_ _of nodes_. Finally, all namespaces scope down to a unique name for the resource type.
### Namespace commands in action
To try out the following namespace commands, you need to have [Minikube][4], [Helm][5], and the [kubectl][6] command line installed. For information about installing them, see my article [_Security scanning your DevOps pipeline_][7] or each project's homepage. I am using the most recent release of Minikube. The manual installation is fast and has consistently worked correctly the first time.
To get your first set of namespaces:
```
jess@Athena:~$ kubectl get namespace
NAME            STATUS   AGE
default         Active   5m23s
kube-public     Active   5m24s
kube-system     Active   5m24s
```
To create a namespace:
```
jess@Athena:~$ kubectl create namespace athena
namespace/athena created
```
Now developers can deploy to the namespace you created; for example, here's a small and easy Helm chart:
```
jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena
NAME: teset-deploy
LAST DEPLOYED: Sat Nov 23 13:47:43 2019
NAMESPACE: athena
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
Redis can be accessed via port 6379 on the following DNS names from within your cluster:
teset-deploy-redis-master.athena.svc.cluster.local for read/write operations
teset-deploy-redis-slave.athena.svc.cluster.local for read-only operations
```
To get your password:
```
`export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis -o jsonpath="{.data.redis-password}" | base64 --decode)`
```
To connect to your Redis server:
1. Run a Redis pod that you can use as a client: [code] kubectl run --namespace athena teset-deploy-redis-client --rm --tty -i --restart='Never' \
        --env REDIS_PASSWORD=$REDIS_PASSWORD \
\--image docker.io/bitnami/redis:5.0.7-debian-9-r0 -- bash
```
2. Connect using the Redis CLI: [code] redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD
redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD
```
To connect to your database from outside the cluster:
```
kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 &amp;
redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD
```
Now that this deployment is out, you have a chart deployed in your namespace named **test-deploy**.
To look at what pods are in your namespace:
```
jess@Athena:~$ kubectl get pods --namespace athena
NAME                            READY   STATUS  RESTARTS   AGE
teset-deploy-redis-master-0   1/1       Running   0             2m38s
teset-deploy-redis-slave-0      1/1     Running   0             2m38s
teset-deploy-redis-slave-1      1/1     Running   0             90s
```
At this point, you have officially isolated your application to a single namespace and created one virtual cluster that talks internally only to itself.
Delete everything with a single command:
```
jess@Athena:~$ kubectl delete namespace athena
namespace "athena" deleted
```
Because this deletes the application's entire internal configuration, the delete may take some time, depending on how large your deployment is.
Double-check that everything has been removed:
```
jess@Athena:~$ kubectl get pods --all-namespaces
NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE
kube-system   coredns-5644d7b6d9-4vxv6          1/1     Running   0             32m
kube-system   coredns-5644d7b6d9-t5wn7          1/1     Running   0             32m
kube-system   etcd-minikube                     1/1     Running   0             31m
kube-system   kube-addon-manager-minikube       1/1     Running   0             32m
kube-system   kube-apiserver-minikube           1/1     Running   0             31m
kube-system   kube-controller-manager-minikube  1/1     Running   0             31m
kube-system   kube-proxy-5tdmh                  1/1     Running   0             32m
kube-system   kube-scheduler-minikube           1/1     Running   0             31m
kube-system   storage-provisioner               1/1     Running   0             27m
```
This is a list of all the pods and all the known namespaces where they live. As you can see, the application and namespace you previously made are now gone.
### Namespaces in practice
I currently use namespaces for security purposes, including reducing the privileges of users with limitations. You can limit everything—from which roles can access a namespace to their quota levels for cluster resources, like CPUs. For example, I use resource quotas and role-based access control (RBAC) configurations to confirm that a namespace is accessible only by the appropriate service accounts.
On the isolation side of security, I don't want my home Jenkins application to be accessible over a trusted local network as secure images that have public IP addresses (and thus, I have to assume, could be compromised).
Namespaces can also be helpful for budgeting purposes if you have a hard budget on how much you can use in your cloud platform for nodes (or, in my case, how much I can deploy before [segfaulting][8] my home server). Although this is out of scope for this article, and it's complicated, it is worth researching and taking advantage of to prevent overextending your cluster.
### Conclusion
Namespaces are a great way to isolate projects and applications. This is just a quick introduction to the topic, so I encourage you to do more advanced research on namespaces and use them more in your work.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/kubernetes-namespaces
作者:[Jessica Cherry][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jrepka
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas)
[2]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
[3]: https://www.weave.works/blog/gitops-operations-by-pull-request
[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/
[5]: https://helm.sh/
[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[7]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline
[8]: https://en.wikipedia.org/wiki/Segmentation_fault

View File

@ -1,105 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager)
[#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Why Vim fans love the Herbstluftwm Linux window manager
======
This article is part of a special series of 24 days of Linux desktops.
If you're a Vim fan, check out herbstluftwm, a tile-based Linux window
manager that takes the "Vim way" as inspiration.
![OpenStack source code \(Python\) in VIM][1]
Everybody loves Vim (aside from Dvorak and Emacs users). Vim is so popular that there are entire web browsers dedicated to navigating the web with Vim keybindings, a Vim mode in the wildly popular [Zsh][2] terminal emulator, and even a text editor. There's also a window manager called [herbstluftwm][3] that models itself partly after the "Vim way." Herbstluftwm does away with windows, as such, and replaces them with tiles, or quadrants, into which applications are loaded and used. You use the keyboard (**Alt+h**, **Alt+j**, **Alt+k**, and **Alt+l**) to navigate from one tile to another.
![Herbstluftwm][4]
Install herbstluftwm from your distribution's software repository. After installing it, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in.
With GDM:
![][5]
With SDDM:
![][6]
### Herbstluftwm desktop tour
The first time you log into herbstluftwm, you are greeted with nothing but a green screen with a darker green border around the edges. What you're seeing is the initial tile with no application loaded into it. To start the default application, xterm, press **Alt+Return**.
The documentation emphasizes the **$HOME/.config/herbstluftwm/autostart** configuration file as a way to start important applications when you log in. For applications you don't necessarily want to start every time you log in, you can use xterm as your launch daemon. As usual, placing an ampersand (**&amp;**) symbol after the command returns control of the shell to you. To start Emacs, for instance:
```
`% emacs &`
```
This launches an Emacs window in a new tile and returns you to a prompt.
![Emacs running in Herbstluftwm][7]
#### Switching tiles
To move from one tile to another, use the classic Vim navigation combination of **h**, **j**, **k**, or **l**, along with the **Alt** key. For example, to switch from the terminal to an application in a tile below it (i.e., at the bottom of the screen), press **Alt+j**. To navigate back up, **Alt+k**. Left and right navigations are **Alt+h** and **Alt+l**, respectively.
#### Split screen
You can manually split a screen vertically with **Alt+o** and horizontally with **Alt+u**.
To remove an empty tile, navigate into it and press **Alt+r**.
### Configuring herbstluftwm
Aside from the **Alt** keybindings, you communicate with herbstluftwm through the **herbstclient** command. This command can be used interactively from a shell, or you can preserve your preferences in a configuration file.
You can view all attributes available in Herbstluftwm with:
```
`$ herbstclient attr`
```
Herbstluftwm's default behavior is defined in the default config file, which you can copy to your home directory and modify. Upon launch, herbstluftwm executes the commands contained in the config file. For instance, if you find it awkward to use keybindings centered around the **Alt** key, which is traditionally a key reserved for in-application shortcuts, you can change the key used to trigger herbstluftwm actions in the config file:
```
% mkdir ~/.config/herbstluftwm
% cp /usr/xdg/herbstluftwm/autostart \
~/.config/herbstluftwm
% sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm
% herbstclient reload
```
This changes the herbstluftwm modifier to the Super key (the "Windows" or "Tux" key, depending on your keyboard).
Using the autostart file, you can set custom keybindings, create tags for applications of a specific type so you can tile applications in a consistent way, and do much more.
### Why you need to try herbstluftwm
Herbstluftwm is a fine example of a tiling window manager. It tiles windows by default and lets the user define exceptions to global rules. It uses Vim-like navigation but allows for quick and easy overrides. It's very likely the tiling manager you've been looking for, so try it soon.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop
作者:[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/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM)
[2]: https://opensource.com/article/19/9/getting-started-zsh
[3]: https://herbstluftwm.org
[4]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm.png (Herbstluftwm)
[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg
[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg
[7]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm-emacs.jpg (Emacs running in Herbstluftwm)

View File

@ -1,72 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Customize your Linux desktop with KDE Plasma)
[#]: via: (https://opensource.com/article/19/12/linux-kde-plasma)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
Customize your Linux desktop with KDE Plasma
======
This article is part of a special series of 24 days of Linux desktops.
If you think there's no such thing as too much opportunity to customize
your desktop, KDE Plasma may be for you.
![5 pengiuns floating on iceburg][1]
The Plasma desktop by the KDE community is a pinnacle among open source desktops. KDE got into the Linux desktop market early, but since its foundational Qt toolkit did not have a fully open license at the time, the [GNOME][2] desktop was created. Since then, Qt has become open source, and KDE (and its derivatives, like the [Trinity desktop][3]) has thrived.
You may find the KDE desktop in your distribution's software repository, or you can download and install a distribution that ships KDE as its default. Before you install, be aware that KDE provides a full, integrated, and robust desktop experience, so several KDE applications are installed along with it. If you're already running a different desktop, you will find yourself with redundant applications (two PDF readers, several media players, two or more file managers, and so on). If you just want to try the KDE desktop without committing to it, you can install a KDE-based distribution in a virtual machine, such as [GNOME Boxes][4], or you can try a bootable OS like [Porteus][5].
### KDE desktop tour
The [KDE Plasma][6] desktop is relatively boring at first glance—but in a comforting way. It's got the industry-standard layout: pop-up application menu in the bottom-left corner, taskbar in the middle, system tray on the right. It's exactly what you'd expect from a standard household or business computer.
![KDE Plasma desktop][7]
What sets KDE apart, though, is that you can change nearly anything you want. The Qt toolkit can be taken apart and rearranged in some surprising ways, meaning you can essentially design your own desktop using KDE's parts as your foundation. The settings available for how your desktop behaves are vast, too. KDE can act as a standard desktop, a tiling window manager, and anything in between. You can create your own window rules by window class, role, type, title, or any combination thereof, so if you want specific applications to behave differently than everything else, you can create an exception to global settings.
Furthermore, there's a rich collection of widgets to enable you to customize the way you interface with your desktop. There's a GNOME-like full-screen application launcher, a Unity-like dock launcher and icons-only taskbar, and a traditional taskbar. You can create and place panels on any edge of the screen you want.
![A slightly customized KDE desktop][8]
There's so much customization, in fact, that one of the most common critiques of KDE is that it's _too customizable_, so keep in mind that customization is optional. You can use the Plasma desktop in its default configuration, and change things gradually and only as you feel necessary. What matters most about Plasma desktop configuration options isn't their number, but that they're discoverable and intuitive, either in the System Settings application or with a right-click.
The fact is, on KDE, there's almost never just one way to accomplish any given task, and its users see that as its greatest strength. There's no implied workflow in KDE, only a default. And all defaults can be changed, until everything you need to do with your desktop is second-nature.
### Consistency and integration
The KDE community prides itself on consistency and integration, made possible through great developer and community management and the KDE libraries. The developers of KDE aren't just developers of a desktop. They provide a [stunning collection of applications][9], each of them created with KDE libs that extend and standardize common Qt widgets. It's no accident that after using KDE for a few months, whether you open [DigiKam][10] for photo management or Kmail to check email or KTorrent to grab the latest ISO or Dolphin to manage files, your muscle memory takes you where you need to go in the UI before you consciously think about it.
![KDE on Porteus][11]
### Try KDE
KDE has something for everyone. Use its default settings for a smooth, plain-vanilla desktop experience, or customize it to make it your own. It's a stable, attractive, and robust desktop environment that probably has everything you need for whatever you want to do on Linux.
KDE originally stood for Kool Desktop Environment, but is now known by many as the K Desktop...
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-kde-plasma
作者:[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/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg)
[2]: https://opensource.com/article/19/12/gnome-linux-desktop
[3]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde
[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization
[5]: https://opensource.com/article/19/6/linux-distros-to-try
[6]: https://kde.org/plasma-desktop
[7]: https://opensource.com/sites/default/files/uploads/advent-kde-presskit.jpg (KDE Plasma desktop)
[8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop)
[9]: https://kde.org/applications/
[10]: https://opensource.com/life/16/5/how-use-digikam-photo-management
[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus)

View File

@ -1,154 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?)
[#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Pop!_OS vs Ubuntu: Which One is Better?
======
Well, you might find it easy to pick one from the list of [best Linux distributions][1]. However, it is often confusing to compare two similar Linux distros, just like Pop!_OS vs Ubuntu.
Interestingly, Pop!_OS is based on [Ubuntu][2]. So, what is the difference between Pop!_OS and Ubuntu? Why should you choose one over other?
In this article, Im going to compare Pop!_OS and Ubuntu (both of which happen to be my favorites).
**Note:** _You might find some of the points opinionated, this article is just a reference for the comparison. With constant developments and updates to Linux distros, a lot can change over time._
### Comparing Ubuntu and Pop!_OS
![Pop!_OS Vs Ubuntu][3]
Spotting the similarity helps you distinguish other differences. So, let me start noting down some of the obvious similarities.
Like I mentioned, Pop!_OS is a Linux distribution on top of Ubuntu. So, you get all the benefits of using Ubuntu (technically the same thing at its core) when you use Pop!_OS.
They both ship with the [GNOME desktop environment][4] by default and hence they feature a similar user interface (UI).
Without going into all the under-the-hood differences, I will be highlighting some important ones here.
#### User Experience &amp; Theming
![Pop!_OS][5]
A lot of users think that Pop!_OS is just Ubuntu with a different skin.
From my experience, Ill mention that it is not entirely true.
Yes, they both rock [GNOME desktop environment][4] however, Pop!_OS just feels more polished.
In addition to the look and feel, [Ubuntu customizes the GNOME experience][6] by adding a dock and a few more tricks. You might find it better if you like a customized GNOME experience.
But, if you prefer a pure GNOME experience, Pop!_OS gives you that by default.
I cannot convince you enough until you try it out for yourself. But, the overall color scheme, icons, and the theme that goes on in Pop!_OS is arguably more pleasing as a superior user experience.
It can be a subjective thing but it is what I observed. You can also check out the video tour for Ubuntu 19.10 to check it out for yourself:
#### Ease of Installing Third-Party Apps
![Pop Os PPA][7]
Ubuntu puts a lot of emphasis on Snap packages. This increases the number of application it offers.
But there are some major issues with Snap packages. They take too much of disk space and they take a lot of time to start.
This is why I prefer using the APT version of any application.
Why am I telling you this?
Because Pop!_OS has its [own official PPA][8] which is enabled by default. Youll find some useful applications like Android Studio, TensorFlow in here. No need to download a 1 GB snap package for the Android Studio. Just use [apt-get install][9] and get done with it.
#### Pre-installed Applications
![Ubuntu installation slideshow][10]
It may not be the biggest deal-breaker for some but having a lot of pre-installed apps could affect the experience and performance. Even if it does not affect the performance some users just prefer fewer pre-installed apps.
Pop!_OS comes bundled with fewer default apps (potentially less bloatware, if I may call it that) when compared to Ubuntu.
Yet again, this is something subjective. If you want to have more apps pre-installed, you may consider Ubuntu over Pop!_OS.
#### Snap Package Support
![][11]
For users comfortable with the snap packages, Ubuntus software center is a slightly better solution to Pop!_OS shop because you can have snap packages listed right in your software center.
You cannot filter the snap packages in the software center but it will be easier to install a snap package when you notice one (look at the details for the source of the app as _Snap store_ / _Snapcraft_) in the Software Center.
Pop!_OS does support snap packages as well if youre confused. But, you wont find them through the Pop!_OS shop, thats the only difference here.
If you are not sure what a snap package is and what it does, you can check out our article on [installing snap apps on Linux][12].
#### Separate NVIDIA/AMD ISO File
![ISOs][13]
Technically, it isnt a part of the comparison internally but it is a factor that some users care for.
So, it is worth highlighting that Pop!_OS provides separate ISOs. One for the systems with NVIDIA graphics card and another for systems with/without AMD graphics.
With Ubuntu 19.10, you get NVIDIA drivers on the Ubuntu ISO but there is no such thing for AMD graphics.
#### Reliability &amp; Issues
Unquestionably, both the [distributions are beginner-friendly][14] and quite reliable. You might want to hold on to a Long Term Support (LTS) release if you want better reliability and fewer issues.
When a new version of Ubuntu comes up, Pop!_OS works on it and potentially fixes the issues that users encounter on Ubuntus original release before making the new upgrade available. This gives them a slight edge but thats nothing substantial because those fixes eventually reach Ubuntu.
#### Performance
The performance will highly depend on what you have installed and the hardware configuration you install it on.
Unless you have a super old system, both distributions seem to perform very well.
Im rocking an i5-7400 processor coupled with 16 Gigs of RAM (with a GTX 1050ti Graphics Card) and I find the experience good enough on both the distros.
Of course, you could manually do a few optimization tweaks to fit your requirements if either of them does not work out for your hardware configuration.
But, if you want to get your hands on a System76 laptop, Pop!_OS will prove to be [the Apple of Linux space][15] because Pop!_OS has been tailored for their hardware, unlike Ubuntu.
#### Hardware Compatibility
This is definitely something to consider when comparing other Linux distributions. However, in this case, theres really no significant difference.
You might consider Pop!_OS to constantly work with newer hardware configurations because they primarily tailor the OS for their laptops with a variety of configurations. And, its just an observation not a fact.
**Wrapping Up**
I know its not easy to choose one among the two popular Linux distro without trying them out. If its a possibility, Ill recommend you to give them both a try while keeping this comparison for reference.
Whats your choice between these two? Did I miss something in the comparison? Let me know in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/pop-os-vs-ubuntu/
作者:[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://itsfoss.com/best-linux-distributions/
[2]: https://ubuntu.com/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/pop_os_vs_ubuntu.png?ssl=1
[4]: https://www.gnome.org/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-UI.jpg?ssl=1
[6]: https://itsfoss.com/gnome-tricks-ubuntu/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-ppa.jpg?ssl=1
[8]: https://launchpad.net/~system76/+archive/ubuntu/pop/
[9]: https://itsfoss.com/apt-get-linux-guide/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?resize=800%2C516&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/snapcraft.jpg?ssl=1
[12]: https://itsfoss.com/install-snap-linux/
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/iso-amd-nvidia-pop-os.jpg?ssl=1
[14]: https://itsfoss.com/best-linux-beginners/
[15]: https://www.phoronix.com/scan.php?page=news_item&px=System76-Integrated-Vision

View File

@ -1,127 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Update Grub on Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/update-grub/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Update Grub on Ubuntu and Other Linux Distributions
======
In this tutorial, youll learn to update grub on Ubuntu or any other Linux distribution. Youll also learn a thing or two about how this grub update process works.
### How to update grub
Ubuntu and many other Linux distributions provide a handy command line utility called update-grub.
To update grub, all you have to do is to run this command in the terminal with sudo.
```
sudo update-grub
```
You should see an output like this:
```
[email protected]:~$ sudo update-grub
[sudo] password for abhishek:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.0.0-37-generic
Found initrd image: /boot/initrd.img-5.0.0-37-generic
Found linux image: /boot/vmlinuz-5.0.0-36-generic
Found initrd image: /boot/initrd.img-5.0.0-36-generic
Found linux image: /boot/vmlinuz-5.0.0-31-generic
Found initrd image: /boot/initrd.img-5.0.0-31-generic
Found Ubuntu 19.10 (19.10) on /dev/sda4
Found MX 19 patito feo (19) on /dev/sdb1
Adding boot menu entry for EFI firmware configuration
done
```
You may see a similar command called update-grub2. No need to be alarmed or confused between update-grub and update-grub2. Both of these commands do the same action.
Around ten years ago, when grub2 was just introduced, update-grub2 command was also introduced. Today, update-grub2 is just a symbolic link to update-grub and both update grub2 configuration (because grub2 is the default).
#### Cant find update-grub command? Heres what to do in that case
Its possible that your Linux distribution might not have update-grub command available.
What do you do in that case? How do you update grub on such a Linux distribution?
There is no need to panic. The update-grub command is simply a stub for running grub-mkconfig -o /boot/grub/grub.cfg to generate grub2 config file.
Which means that you can update grub with the following command on any Linux distribution:
```
sudo grub-mkconfig -o /boot/grub/grub.cfg
```
Of course, remembering update-grub command is a lot easier than the above command and this is the reason why it was created in the first place.
### How does update-grub work?
When you install a Linux distribution, it (usually) asks you to install the [grub boot loader][1].
Part of grub is installed on the MBR/ESP partition. Rest of the grub lies in /boo/grub directory of the Linux distributions.
As per its [man page][2], update-grub works by looking into the /boot directory. All the files starting with [vmlinuz-][3] will be treated as kernels and they will get a grub menu entry. It will also add initrd lines for [ramdisk][4] images found with the same version as kernels found.
It also looks into all disk partitions for other operating systems with [os-prober][5]. If it finds other operating systems, it adds them to the grub menu.
![Representational image of Grub Menu][6]
### Why would you need to update grub?
There could be a number of scenarios when you need to update grub.
Suppose you changed the grub config file (/etc/default/grub) to [change the default boot order][7] or reduce the default boot time. Your changes wont take into effect unless you update the grub.
Another scenario is when you have multiple Linux distributions installed on the same system.
For example, on my Intel NUC, I have two disks. The first disk had Ubuntu 19.10 and then I installed Ubuntu 18.04 on it. The second OS (Ubuntu 18.04) also installed its own grub and now the grub screen is controlled by Ubuntu 18.04 grub.
On the second disk, I installed MX Linux but I didnt install grub this time. I want the existing grub (controlled by Ubuntu 18.04) to handle all the OS entries.
Now, in this scenario, the grub on Ubuntu 18.04 needs to be updated so that it can see [MX Linux][8].
![][9]
As you can see in the image above, when I update the grub, it finds various Linux kernels installed on 18.04 along with Ubuntu 19.10 and MX Linux on different partition.
If I want MX Linux to control the grub, I can install grub on MX Linux with [grub-install][10] command and then the grub on MX Linux will start controlling the grub screen. You get the gist, right?
Using a GUI tool like [Grub Customizer][11] is a simpler way to make changes in grub.
**In the end…**
Initially, I had intended to keep it a short article as a quick tip. But then I thought of explaining a few things associated with it so that (relatively) new Linux users could learn more than just a simple command.
Did you like it? Do you have some questions or suggestions? Please feel free to leave a comment.
--------------------------------------------------------------------------------
via: https://itsfoss.com/update-grub/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://en.wikipedia.org/wiki/GNU_GRUB
[2]: https://manpages.debian.org/testing/grub-legacy/update-grub.8.en.html
[3]: https://www.ibm.com/developerworks/community/blogs/mhhaque/entry/anatomy_of_the_initrd_and_vmlinuz?lang=en
[4]: https://en.wikipedia.org/wiki/Initial_ramdisk
[5]: https://packages.debian.org/sid/utils/os-prober
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/grub_screen.png?ssl=1
[7]: https://itsfoss.com/grub-customizer-ubuntu/
[8]: https://mxlinux.org/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/update_grub.png?ssl=1
[10]: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html
[11]: https://itsfoss.com/customize-grub-linux/

View File

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

View File

@ -0,0 +1,97 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (12 open source resources for kids and young adults)
[#]: via: (https://opensource.com/article/19/12/kids-students-education)
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
12 open source resources for kids and young adults
======
Explore new technologies with Opensource.com's top 12 articles from 2019
about learning an open source technology.
![Person reading a book and digital copy][1]
Are you looking to challenge your children (or even yourself) to learn new things about open source technologies? Whether you're in elementary school, high school, or college, or even a parent or teacher, Opensource.com has some great reading about open source technologies suitable for the younger generation. Here are our top 12 articles from 2019 on open source for students (and those who love them).
### Hacking math education with Python
As a student, I had difficulty with the abstraction of mathematics. Traditional classroom instruction didn't work for me. Peter Farrell has another approach for learners who are challenged by conventional mathematics instruction. His unique approach, which teaches math using Python, resonated with me when I interviewed him about how he is [_Hacking math education with Python_][2].
### 5 open source tools for teaching young children to read
No doubt, you have seen how easy it is for children to master today's electronic devices—but what about traditional literacy? Are today's children getting the foundation in reading, writing, and arithmetic that they need to be successful? Laura Janusek's [_5 open source tools for teaching young children to read_][3] may help. She says, "Access to literary environments has been shown to impact literacy and attitudes towards reading. Why not strive to create a digital literacy environment for our kids by filling our devices with educational technologies, just like our shelves are filled with books?"
### What programming language would you teach a kid first?
Coding has become a hot area for schools and parents. Opinions abound on the best computer language to teach and when to begin teaching it. Lauren Pritchett celebrated Ada Lovelace Day 2019 by exploring [_What programming language would you teach kids first?_][4] Be sure to take the accompanying poll, too.
### Getting started with the BBC Microbit
Learning to code should be fun, and one of the ways to ensure a great early experience is by using an inexpensive open hardware board. In [_Getting started with the BBC Microbit_][5], I provide step-by-step directions and some code examples so your child can learn to program with MicroPython.
### Introducing kids to computational thinking with Python
Coding can be the key that lifts children out of poverty and empowers them to gain new skills, confidence, and the knowledge necessary to break free from socioeconomic disadvantages. In [_Introducing kids to computational thinking with Python_][6], I interviewed librarian Qumisha Goss, who is leveraging the power of Python to transform children's lives in Detroit.
### A dozen ways to learn Python
Do you know someone who really wants to learn to Python but is looking for the right hook to get started? Removing abstraction has been key to my best learning experiences, and I share some of the resources I've found in [_A dozen ways to learn Python_][7]. They will start you on your journey to Python proficiency and sustain your learning over the long haul.
### 100 ways to learn Python and R for data science
Many people want to learn data science but are drowning in the deluge of information available online, leaving them confused about where to find the best book, tutorial, or other learning resources. Where would you turn to learn the skills necessary to play a role in this rapidly growing field? Chris Englehardt, Dorris Scott, and Annu Singh share their suggestions in [_100 ways to learn Python and_ _R for data science_][8].
### How a trip to China inspired Endless OS and teaching kids to hack
I've long been interested in inexpensive, Linux-based computers that help children around the world learn how to code. One of these is Endless' Hack, a low-cost laptop, and an accompanying series of video games designed to get kids coding and become creative problem solvers while they're having fun. In 2019, I got to interview Endless' founder Matt Dalio, where he shares [_How a trip to China inspired Endless OS and teaching kids to hack_][9].
### How to use the internet to learn IT skills
Looking to do something meaningful in the new year? How about helping a few young people take their first steps in an IT career? You can follow the lead of David Clinton, a systems administrator, teacher, and writer, who shares [_How to use the internet to learn IT skills_][10]. Giving students access to open source tools and letting them explore and iterate creates a rich learning experience, he explains.
### Digital divide? How the Asian Penguins share Linux at Minnesota charter school
Stu Keroff is an educator who has turned his passion for Linux and open source into a schoolcommunity outreach program that serves a large number of immigrant families in Minnesota. He is a husband, father, teacher, speaker, and advocate for Linux in K-12 education and a winner of the [2016 Opensource.com Readers Choice Award][11]. In [_Digital divide? How the Asian Penguins share Linux at Minnesota charter school_][12], Stu shares his Linux-powered solution to expand digital literacy in his community.
### 13 books for picking up new tech in 2019
If you (or someone you know) learn best by reading, my [_13 books for picking up new tech in 2019_][13] may help you discover a new skill that piques your curiosity. The list includes books on everything from Python to Linux to developing games on a Raspberry Pi.
### 11 surprising ways you use Linux every day
If you, like me, wonder what powers all the electronic gadgets that power our day-to-day lives today, read my article on [_11 surprising ways you use Linux every day_][14]. You might be amazed at how much we depend on open source to get us through our days.
### A lifetime of learning
What would you like to know to help the children in your life expand their tech knowledge and skills? Please share your ideas in the comments, or even consider sharing your own experiences with Opensource.com readers by [submitting an article][15] about your favorite open source education topic.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/kids-students-education
作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy)
[2]: https://opensource.com/article/19/1/hacking-math
[3]: https://opensource.com/article/19/4/early-literacy-tools
[4]: https://opensource.com/article/19/10/first-programming-language-kids
[5]: https://opensource.com/article/19/8/getting-started-bbc-microbit
[6]: https://opensource.com/article/19/2/break-down-stereotypes-python
[7]: https://opensource.com/article/19/8/dozen-ways-learn-python
[8]: https://opensource.com/article/19/5/learn-python-r-data-science
[9]: https://opensource.com/article/19/6/endless-digital-literacy
[10]: https://opensource.com/article/19/5/it-skills-internet
[11]: https://opensource.com/community/16/2/winners-2016-community-awards
[12]: https://opensource.com/article/19/2/asian-penguins-close-digital-divide
[13]: https://opensource.com/article/19/1/tech-books-new-skils
[14]: https://opensource.com/article/19/8/everyday-tech-runs-linux
[15]: https://opensource.com/how-submit-article

View File

@ -0,0 +1,84 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 security tips from Santa)
[#]: via: (https://opensource.com/article/19/12/security-tips)
[#]: author: (Mike Bursell https://opensource.com/users/mikecamel)
5 security tips from Santa
======
Stay off Santa's (and your employer's) naughty list by following this
list of useful security tips and practices.
![Security monster][1]
If you're reading this in 2019, it's almost Christmas (as celebrated according to the Western Christian calendar), and, like all children and IT professionals, it's time to write your letter to Santa/St. Nick/Father Christmas. Don't forget: those who have been good get nice presents and those who haven't get coal. Coal is _not_ a clean-burning fuel, and with climate change well and truly upon us,[1][2] you don't want to be going for the latter option.
Think back to all of the good security practices you've adopted over the past 11 or so months. And then think back to all of the bad security practices you've adopted when you should have been doing the _right_ thing. Oh, dear. It's not looking good for you, is it?
Here's the good news, though: because Santa is a benevolent soul, there's time to make amends (unless you're reading this after Christmas[2][3]). Here's a list of useful security tips and practices that Santa follows and therefore are bound to put you on his "good" side.
### 1\. Use a password manager
Santa is very careful with his passwords. Here's a little secret: from time to time, rather than have his elves handcraft every little present, he sources his gifts from other parties. I'm not suggesting that he pays market rates (he's ordering in bulk, and he has a very, very good credit rating), but he uses lots of different suppliers, and he's aware that not all of them take security as seriously as he does. He doesn't want all his account logins to be leaked if one of his suppliers is hacked, so he uses separate passwords for each account. Now, Santa, being Santa, could remember all of these details if he wanted to—and even generate unique passwords that meet all the relevant complexity requirements for each site—but he uses an open source [password manager][4] for safety and for succession planning.[3][5]
### 2\. Manage personal information properly
You may work for a large company, organisation, or government, and you may think you have lots of customers and associated data, but consider Santa. He manages (or has managed) names, birth dates, addresses, hobbies, shoe sizes, colour preferences, and other personal data for literally every person on Earth. That's an awful lot of sensitive data, and it needs to be protected. When people grow too old for presents from Santa,[4][6] he needs to delete their data securely. In fact, Santa may well be the archetypal [GDPR][7] data controller, and he needs to be very careful who and what can access the data that he holds. Of course, he encrypts all the data and is very careful about key management. He's also very aware of the dangers associated with cold boot attacks (given the average temperature around his residence), so he ensures data is properly wiped before shutdown.
### 3\. Measure and mitigate risk
Santa knows all about [risk][8]. He has complex systems for ordering, fulfillment, travel planning, logistics, and delivery that are the envy of most of the world. He understands what impact failure in any part of the supply chain can have on his customers: mainly children and IT professionals. He quantifies risk, recalculating it on a regular basis to ensure that he is up to date with possible vulnerabilities and ready with mitigations.
### 4\. Patch frequently but carefully
Santa absolutely cannot afford for his systems to go down, particularly around his most busy period. He has established processes to ensure that the [concerns of security are balanced with the needs of the business][9].[5][10] He knows that sometimes business continuity must take priority, and on other occasions, the impact of a security breach would be so major that patches just _have_ to be applied. He tells people what he wants and listens to their views, taking them into account where he can. In other words, he embraces open management, delegating decisions where possible to the people who are best positioned to make the call, and only intervenes when asked for an executive decision or when exceptions arise. Santa is a _very_ enlightened manager.
### 5\. Embrace diversity
One of the useful consequences of running a global operation is that Santa values diversity. Old or young (at heart); male, female, or gender-neutral; neurotypical or neurodiverse; of any culture, sexuality, race, ability, creed, or nose colour, Santa takes into account his stakeholders and their views on what might go wrong. What a fantastic set of viewpoints Santa has available to him! And he's surprisingly hip to the opportunities for security practices that a wide and [diverse set of opinions and experiences][11] can bring[6][12] not to mention the multiple [positive impacts][13] on his organisation.
### Summary
Here's my advice: Be like Santa, and adopt at least some of his security practices. You'll have a much better opportunity of getting onto his good side, and that's going to go down well—not just with him, but also with your employer, who is just certain to give you a nice bonus, right? And if not, well, it's not too late to write that letter directly to Santa himself.
* * *
1. If you have a problem with this statement, then either you need to find another article, or you're reading this in the far future where all our climate problems have been solved. I hope.
2. Or you dwell in one of those cultures where Santa visits quite early in December.
3. A high-flying goose in the face can do terrible damage to a fast-moving reindeer, and if the sleigh were to crash, what then...?
4. Not me!
5. Santa doesn't refer to it as a "business," but he's happy for us to call it that, so we can model our own experience on his. He's nice like that.
6. Though Santa would never use the phrase "hip to the opportunities." He's way too cool for that.
Download the free All Things Open interview series eBook Jessica McKellar is an entrepreneur,...
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/security-tips
作者:[Mike Bursell][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/mikecamel
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu (Security monster)
[2]: tmp.PgLkHLx1Uz#1
[3]: tmp.PgLkHLx1Uz#2
[4]: https://opensource.com/article/18/4/3-password-managers-linux-command-line
[5]: tmp.PgLkHLx1Uz#3
[6]: tmp.PgLkHLx1Uz#4
[7]: https://opensource.com/article/18/1/being-open-about-data-privacy
[8]: http://aliceevebob.com/2019/03/12/dont-talk-security-talk-risk/
[9]: http://aliceevebob.com/2017/10/17/stop-reading-start-patching/
[10]: tmp.PgLkHLx1Uz#5
[11]: http://aliceevebob.com/2017/08/08/diversity-in-it-security-not-just-a-canine-issue/
[12]: tmp.PgLkHLx1Uz#6
[13]: https://opensource.com/article/19/11/diversity-and-inclusion-strategies

View File

@ -0,0 +1,61 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Making trade-offs when writing Python code)
[#]: via: (https://opensource.com/article/19/12/zen-python-trade-offs)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
Making trade-offs when writing Python code
======
This is part of a special series about the Zen of Python focusing on the
seventh, eighth, and ninth principles: readability, special cases, and
practicality.
![Brick wall between two people, a developer and an operations manager][1]
Software development is a discipline rife with trade-offs. For every choice, there is an equally defensible but opposite choice. Make a method private? You're encouraging copy-paste. Make a method public? You're committing prematurely to an interface.
Software developers make hard choices every minute. While all the principles in the [Zen of Python][2] cover trade-offs to some extent, the following principles take the hardest, coldest look at some trade-offs.
### Readability counts.
In some sense, this middle principle is indeed the center of the entire Zen of Python. The Zen is not about writing efficient programs. It is not even about writing robust programs, for the most part. It is about writing programs that _other people can read_.
Reading code, by its nature, happens after the code has been added to the system. Often, it happens long after. Neglecting readability is the easiest choice since it does not hurt right now. Whatever the reason for adding new code—a painful bug or a highly requested feature—it does hurt. Right now.
In the face of immense pressure to throw readability to the side and just "solve the problem," the Zen of Python reminds us: readability counts. Writing the code so it can be read is a form of compassion for yourself and others.
### Special cases aren't special enough to break the rules.
There is always an excuse. This bug is particularly painful; let's not worry about simplicity. This feature is particularly urgent; let's not worry about beauty. The domain rules covering this case are particularly hairy; let's not worry about nesting levels.
Once we allow special pleading, the dam wall breaks, and there are no more principles; things devolve into a Mad Max dystopia with every programmer for themselves, trying to find the best excuses.
Discipline requires commitment. It is only when things are hard, when there is a strong temptation, that a software developer is tested. There is always a valid excuse to break the rules, and that's why the rules must be kept the rules. Discipline is the art of saying no to exceptions. No amount of explanation can change that.
### Although, practicality beats purity.
> "If you think only of hitting, springing, striking, or touching the enemy, you will not be able actually to cut him."
> — Miyamoto Musashi, _[The Book of Water][3]_
Ultimately, software development is a practical discipline. Its goal is to solve real problems, faced by real people. Practicality beats purity: above all else, we must _solve the problem_. If we think only about readability, simplicity, or beauty, we will not be able to actually _solve the problem_.
As Musashi suggested, the primary goal of every code change should be to _solve a problem_. The problem must be foremost in our minds. If we waver from it and think only of the Zen of Python, we have failed the Zen of Python. This is another one of those contradictions inherent in the Zen of Python.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-trade-offs
作者:[Moshe Zadka][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/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager)
[2]: https://www.python.org/dev/peps/pep-0020/
[3]: https://en.wikipedia.org/wiki/The_Book_of_Five_Rings#The_Book_of_Water

View File

@ -0,0 +1,196 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: ("server" is hard to define)
[#]: via: (https://jvns.ca/blog/2019/12/26/whats-a-server/)
[#]: author: (Julia Evans https://jvns.ca/)
"server" is hard to define
======
Somebody asked me recently what a server was, and I had a harder time explaining it than I expected! I thought I was going to be able to give some kind of simple pithy answer but it kind of got away from me. So heres an short exploration of what the word “server” can mean:
### a server responds to requests
A server definitely responds to requests. A few examples:
webserver:
```
Me: "please give me google.com"
Server: "here is the HTML for that webpage"
```
bittorrent server:
```
Me: "I would like this chunk of the good wife season 2"
Server: "here are some of the bytes from that .avi file!"
```
mail server:
```
Me: "can you send this email to [email protected]"
Server: "I sent it!"
```
But what is a server actually specifically exactly?
### a server is a program
My first instinct is to say “a server is a program” because for example a “the wordpress server” is a PHP program, so lets start with that.
A server is usually a program that listens on a **port** (like 80). For example, if were talking about a Rails webserver, then the program is a Ruby program thats listening on a port for HTTP requests.
For example, we can start a Python server to serve files out of the current directory.
```
$ python3 -m http.server &
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ..
```
and send requests to it with `curl`:
```
$ curl localhost:8000/config.yaml
baseurl: https://jvns.ca
disablePathToLower: true
languageCode: en-us
title: Julia Evans
author: Julia Evans
...
```
### a server might be a virtual machine
But often when I talk about “a server” at work, Ill use it in a sentence like “Im going to SSH to that server to see whats going on with it”, or “wow, that server is swapping a lot, thats bad!“.
So in those cases clearly I dont mean a program when I say “that server” (you cant ssh to a program, though the ssh server that runs on the VM is itself a program!), I mean the AWS instance that the server program is running on. That AWS instance is a virtual machine, which looks like a computer in a lot of ways (its running an operating system!) but it isnt a physical computer.
### a server might be a container
Similarly to how your server might be a virtual machine, it could also be a container running in a virtual machine. So “the server is running out of memory” could mean “the container is running out of memory and crashing” which really means “we set a cgroup memory limit on this container and the programs in the container with that cgroup exceeded the limit so the Linux kernel OOM killed them”.
But containers make everything a lot more complicated so I think we should stop there for now.
### a server is a computer
But also when you **buy** a server from Dell or some other computer company, youre not buying a virtual machine, youre buying an actual physical machine.
Usually these computers are in building datacenters. For example in this video you can see thousands of servers in a Google datacenter.
The computers in this datacenter dont look like the computers in my house! Theyre short and wide because theyre designed to fit into these giant racks of servers. For example if you search Newegg for [1U server][1] youll find servers that are 1 “[rack unit][2]” high, and a rack unit is 1.75 inches. There are also 2U servers which are twice as high.
Heres a picture of a 1U server I found on Newegg:
![][3]
Ive only seen a server rack once at the [Internet Archive][4] which is in what used to be a church in San Francisco, and it was really cool to realize wow, when I use the Wayback Machine its using the actual computers in this room!
### “the server” might be 1000 computers
Next, lets say were talking about how Gmail works. You might ask “hey, when I search my email to find my boarding pass, does that happen in the frontend or on the server?”.
The answer is “it happens on the server”, but whats “the server” here? Theres not just one computer or program or virtual machine that searches your Gmail, there are probably lots of computers and programs at Google that are reponsible for that and theyre probably distributed across many datacenters all over the world.
And even if were just talking about doing 1 search, there could easily be 20 different computers in 3 different countries involved in just running that 1 search.
So the words “the server” in “oh yeah, that happens on the server” mean something kind of complicated here what youre actually saying is something “well the browser makes a request, and that request does _something_, but Im not really going to worry about what because the important thing is just that the browser made a request and got some kind of response back.”
### what happens when I search my email for a boarding pass?
When I search for “boarding” in my email, the Javascript running on the frontend puts together this request. Its mostly indecipherable but it definitely contains the word “boarding”:
```
{
"1": {
"1": 79,
"2": 101,
"4": "boarding",
"5": {
"5": 0,
"12": "1577376926313",
"13": -18000000
},
"6": "itemlist-ViewType(79)-5",
"7": 1,
"8": 2000,
"10": 0,
"14": 1,
"16": {
"1": 1,
"2": 0,
"3": 0,
"7": 1
},
"19": 1
},
"3": {
"1": "0",
"2": 5,
"5": 1,
"6": 1,
"7": 1
}
}
```
We get a response back which is large and complicated and definitely contains search results from my email about boarding passes. Heres an excerpt:
```
"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable",
"the attached boarding pass to present at the airport. Manage your booking \nBooking Details Passenger: JULIA EVANS Booking",
"Electronic boarding pass is not offered for your flight. Click the link \nbelow to access the PRINTABLE VERSION of your boarding",
"Save time at the airport Save time at the airport Web version",
"GET YOUR BOARDING PASS IN ADVANCE > You can now check in for your flight \nand you will receive a boarding pass > allowing",
"Save time at the airport Save time at the airport Web version",
"Booking Confirmation Booking Reference: xxxxxx Date of issue: xxxxxxxxxxxx \nSelect Seats eUpgrade",
"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable",
"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable",
"Save time at the airport Save time at the airport Web version",
"house was boarded up during the last round of bombings. I have no spatial \nimagination and cannot picture the house in three",
"Booking Confirmation Booking Reference: xxxxxx Date of issue: xxxxxxxxxxxx \nSelect Seats eUpgrade"
"required when boarding a flight to Canada. For more details, please visit \nCanada.ca/eTA . - Terms and Conditions of Sale",
"Your KLM boarding pass(s) on XXXXXX To: [image: KLM SkyTeam] Boarding \ninformation Thank you for checking in! Attached you",
"Boarding information Thank you for checking in! Attached you will find your \nboarding pass and/or other documents. Below",
"jetBlue® Your upcoming trip to SEATTLE, WA on xxxxxxxxxxx Flight status \nBaggage info Airport info TAG",
"your electronic boarding pass. You could also be asked to display this \nmessage to airport security. * PLEASE NOTE: A printable"
```
That request got sent to 172.217.13.197:443, which corresponds to some edge server near me. There were probably many other computers involved in searching my email than just the first one who got my request, but the nice thing about this is that we dont need to care exactly what happened behind the scenes! The browser sent a request, and it got search results back, and it doesnt need to know what servers.
We can just say “it happens on the server” and not worry too much about the ambiguity of what exactly that means (until something weird goes wrong :)).
### the meaning of “server” depends on the context
So weve arrived somewhere a little bit interesting at first when I thought about the question “whats a server?” I really thought there was going to be a single simple answer! But it turns out that if you look at sentences where we use the word “server” it can actually refer to a lot of different things in a way that can be confusing:
* “Let me just ssh into the server and see whats going on” =&gt; a virtual machine (or possibly a computer)
* “I sent a SIGTERM to the server and that fixed the problem” =&gt; a program
* “Lets look at the server code” =&gt; a program
* “Lets buy 20 of those 2U servers” =&gt; a computer
* “We need to add more server capacity” =&gt; a program and a virtual machine probably
* “That happens on the server” =&gt; possibly some complex distributed system
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2019/12/26/whats-a-server/
作者:[Julia Evans][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://jvns.ca/
[b]: https://github.com/lujun9972
[1]: https://www.newegg.com/p/pl?d=1u+server
[2]: https://en.wikipedia.org/wiki/Rack_unit
[3]: https://c1.neweggimages.com/NeweggImage/ProductImage/11-152-136-02.jpg
[4]: https://archive.org/

View File

@ -0,0 +1,86 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 Linux command tutorials for beginners and experts)
[#]: via: (https://opensource.com/article/19/12/linux-commands)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
10 Linux command tutorials for beginners and experts
======
Learn how to make Linux do what you need it to do in Opensource.com's
top 10 articles about Linux commands from 2019.
![Penguin driving a car with a yellow background][1]
Using Linux _well_ means understanding what commands are available and what they're capable of doing for you. We have covered a lot of them on Opensource.com during 2019, and here are 10 favorites from the bunch.
### Using the force at the Linux command line
The Force has a light side and a dark side. Properly understanding that is crucial to true mastery. In his article [_Using the force at the Linux command line_][2], Alan Formy-Duval explains the **-f** option (also known as **\--force**) for several popular and sometimes dangerous commands.
### Intro to the Linux useradd command
Sharing accounts is a bad idea. Instead, give separate accounts to different people (and even different roles) with the quintessential **useradd** command. Part of his venerable series on basic Linux administration, Alan Formy-Duval provides an [_Intro to the Linux useradd command_][3], and, as usual, he explains it in _plain English_ so that both new and experienced admins can understand it.
### Linux commands to display your hardware information
What's _inside_ the box? Sometimes it's useful to inspect your hardware without using a screwdriver. In [_Linux commands to display your hardware information_][4], Howard Fosdick provides both popular and obscure commands to help you dig deep into the computer you're using, the computer you're testing at the store before buying, or the computer you're trying to repair.
### How to encrypt files with gocryptfs on Linux
Our files hold lots of private data, from social security numbers to personal letters to loved ones. In [_How to encrypt files with gocryptfs on Linux_][5], Brian "Bex" Exelbierd explains how to keep *private *what's meant to be private. As a bonus, he demonstrates encrypting files in a way that has little to no impact on your existing workflow. This isn't a complex PGP-style puzzle of key management and background key agents; this is quick, seamless, and secure file encryption.
### How to use advanced rsync for large Linux backups
In the New Year, many people will resolve to be more diligent about making backups. Alan Formy-Duval must have made that resolution years ago, because in [_How to use advanced rsync for large Linux backups_][6], he displays remarkable familiarity with the file synchronization command. You might not remember all the syntax right away, but the idea is to read and process the options, construct your backup command, and then automate it. That's the smart way to use **rsync**, and it's the _only_ way to do backups reliably.
### Using more to view text files at the Linux command line
In Scott Nesbitt's article [_Using more to view text files at the Linux command line_][7], the good old default pager **more** finally gets the spotlight. Many people install and use **less**, because it's more flexible than **more**. However, with more and more systems being implemented in the sparsest of containers, the luxury of fancy new tools like **less** or **most** sometimes just doesn't exist. Knowing and using **more** is simple, it's a common default, and it's the production system's debugging tool of last resort.
### What you probably didn't know about sudo
The **sudo** command is famous to a fault. People know the **sudo** term, and most of us believe we know what it does. And we're a little bit correct, but as Peter Czanik reveals in his article [_What you probably didn't know about sudo_][8], there's a lot more to the command than just "Simon says." Like that classic childhood game, the **sudo** command is powerful and also prone to silly mistakes—only with greater potential for horrible consequences. This is one game you do not want to lose!
### How to program with Bash: Syntax and tools
If you're a Linux, BSD, or Mac (and lately, Windows) user, you may have used the Bash shell interactively. It's a great shell for quick, one-off commands, which is why so many Linux users love to use it as their primary user interface. However, Bash is much more than just a command prompt. It's also a programming language, and if you're already using Bash commands, then the path to automation has never been more straightforward. Learn all about it in David Both's excellent [_How to program with Bash: Syntax and tools_][9].
### Master the Linux ls command
The **ls** command is one of those commands that merits a two-letter name; one-letter commands are an optimization for slow terminals where each letter causes a significant delay and also a nice bonus for lazy typists. Seth Kenlon explains how you can [_Master the Linux ls command_][10] and he does so with his usual clarity and pragmatism. Most significantly, in a system where "everything is a file," being able to list the files is crucial.
### Getting started with the Linux cat command
The **cat** command (short for con_cat_enate) is deceptively simple. Whether you use it to quickly see the contents of a file or to pipe the contents to another command, you may not be using **cat** to its full potential. Alan Formy-Duval's elucidating [_Getting started with the Linux cat command_][11] offers new ideas to take advantage of a command that lets you open a file without feeling like you've opened it. As a bonus, learn all about **zcat** so you can decompress files without all the trouble of decompression! It's a small and simple thing, but _this_ is what makes Linux great.
### Continue the journey
Don't let Opensource.com's 10 best articles about Linux commands of 2019 be the end of your journey. There's much more to discover about Linux and its versatile prompt, so stay tuned in 2020 for more insights. And, if there's a Linux command you want us to know about, please tell us about it in the comments, or share your knowledge with Opensource.com readers by [submitting an article][12] about your favorite Linux command.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-commands
作者:[Moshe Zadka][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/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background)
[2]: https://opensource.com/article/19/5/may-the-force-linux
[3]: https://opensource.com/article/19/10/linux-useradd-command
[4]: https://opensource.com/article/19/9/linux-commands-hardware-information
[5]: https://opensource.com/article/19/8/how-encrypt-files-gocryptfs
[6]: https://opensource.com/article/19/5/advanced-rsync
[7]: https://opensource.com/article/19/1/more-text-files-linux
[8]: https://opensource.com/article/19/10/know-about-sudo
[9]: https://opensource.com/article/19/10/programming-bash-syntax-tools
[10]: https://opensource.com/article/19/7/master-ls-command
[11]: https://opensource.com/article/19/2/getting-started-cat-command
[12]: https://opensource.com/how-submit-article

View File

@ -0,0 +1,123 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 articles to become more data science savvy)
[#]: via: (https://opensource.com/article/19/12/data-science-resources)
[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo)
10 articles to become more data science savvy
======
Boost your data science game in 2020 with Opensource.com's top 10
most-read articles on the topic from 2019.
![Open data brain][1]
When LinkedIn released its third annual [Emerging Jobs report][2], engineers everywhere said, "Amen." More than half the list consists of engineering roles, with new fields like robotics appearing for the first time.
But data science had a strong showing as well. The role shows 37% annual growth, topping that aspect of the Emerging Jobs list for the third year in a row.
Looking at the core skills a data scientist needs—including R, Python, and Apache Spark—it's easy to find overlaps with open source. So, we're not surprised that data science was one of the most popular topics at Opensource.com in 2019.
We saw a need for knowledge about diverse data science topics. And our community of authors delivered answers.
For your reading pleasure, we've listed the top 10 data science articles of 2019. We define "top" as the data science articles that were published in 2019 and earned the most page views, starting with the most popular.
Whether you want to use Kubernetes for batch jobs or query 10 years' worth of GitHub data, these articles will boost your data science game in 2020.
### Why data scientists love Kubernetes
Kubernetes is having more than a moment. That's due in no small part to its versatility. You might already know that Kubernetes helps software developers and system operators deploy applications in Linux containers. But did you know how helpful it can be for data science as well?
In [_Why data scientists love Kubernetes_][3], our most popular data science article in 2019, William Benton and Sophie Watson share how Kubernetes supports the data science workflow. From repeatable batch jobs to debugging ML models, this article shares several ways for data scientists to leverage Kubernetes.
### How to use Spark SQL: A hands-on tutorial
Wondering how to use a cloud service for big data analytics? [_How to use Spark SQL: A hands-on tutorial_][4] uses Spark DataFrames to show how to use relational databases at scale. DJ Sarkar uses a real-world dataset to walk readers through the process of using Spark SQL.
Rich with screenshots and code, Sarkar's tutorial is the ideal sequel to [his first piece][5] on this subject. He shares several ways that you can use Spark to manage structured data obtained from flat files or databases.
### 9 resources for data science projects
The growth of data science in open source—from machine learning to neural networks—has left many engineers wanting to learn more. In [_9 resources for data science projects_][6], Dan Barker shares the books, tools, and online courses he thinks are a must for any engineer who wants to get started.
Barker is especially keen on Cathy O'Neil's book [_Weapons of Math Destruction_][7], which shares how bias creeps into data and how you can stop it. He also shares a range of websites for newbies to explore.
### Getting started with data science using Python
Alongside the rise of data science techniques, Python has seen a meteoric rise. It's now one of the most popular programming languages. When used with libraries like pandas and Seaborn, Python is an ideal entry to data science.
In [_Getting started with data science using Python_][8], a follow-up to his [intro to Python][9] article, Seth Kenlon shares how to create a Python virtual environment; install pandas and NumPy; create a sample dataset; and much more. This article is an especially good read if you want to learn more about data visualization.
### How to analyze log data with Python and Apache Spark
Like many articles in our top 10 list, [_How to analyze log data with Python and Apache Spark_][10] is a sequel to [an earlier article][11] on using Python and Apache Spark to wrangle data. Once you've learned how to put your data into a clean, structured format, DJ Sarkar offers this piece to help you analyze that data.
Whether you want to see the top 10 error endpoints or content size statistics, Sarkar shows you how to analyze several types of log data in your [DataFrame][12]. The data that he uses isn't "big data" from a size or volume standpoint. But these techniques can scale for use with larger datasets.
### How to wrangle log data with Python and Apache Spark
[_How to wrangle log data with Python and Apache Spark_][11], DJ Sarkar's prequel to his piece on analyzing log data, also made our top 10 list. It's no surprise since most organizations use a range of systems and infrastructure that run constantly. Data logs are an ideal way to make sure that everything keeps working effectively.
In this tutorial, Sarkar shows how to use Apache Spark on real-world production logs from NASA. He walks through the process of using Spark to do log analytics at scale on semi-structured log data. This ranges from setting up dependencies to data wrangling.
### Querying 10 years of GitHub data with GHTorrent and Libraries.io
Did you know that you can use Kibana or the Elasticsearch API to turn Amazon S3 object-storage data into a searchable Elasticsearch-type cluster? Likewise, did you know about the project that aims to build an offline version of all data available through GitHub APIs?
In [_Querying 10 years of GitHub data with GHTorrent and Libraries.io_][13], Pete Cheslock explores how to access and query GHTorrent data. You can do it using several formats, including CSV and Google Big Query. Cheslock uses the latter to search indexed GHTorrent data to learn which software languages, licenses, and rates of growth are most popular for GitHub projects.
### Predicting NFL play outcomes with Python and data science
Want to increase your machine learning skills in Python? With the NFL playoff season upon us, it's a great time to read [_Predicting NFL play outcomes with Python and data science_][14], which shares some data science tips to predict plays.
Christa Hayes shows how to spot weird values, predict downs and play types, make regression plots, and train models. Once you've read her article on [how to format data for training][15], this one is the ideal next step.
### Analyzing the Stack Overflow Survey with Python and Pandas
Stack Overflow's annual developer survey is a tech behemoth. Nearly 90,000 developers took this year's 20-minute survey and left a lot of data in their wake.
To find certain results, Moshe Zadka used the pandas library to search the survey's [anonymized results][16]. If you want to filter Stack Overflow's dataset for certain details (like seeing how many developers use certain languages or contribute to open source projects), Moshe's [_Analyzing the Stack Overflow Survey with Python and Pandas_][17] tutorial shows you how.
### 4 Python tools for getting started with astronomy
For readers with their heads in the clouds, NumFOCUS republished some of its blog posts on Opensource.com this year. In [_4 Python tools for getting started with astronomy_][18], Dr. Gina Helfrich shares how you can get involved in astronomy.
Intimidated? Don't be: Dr. Helfrich says Python packages are so advanced that building data-reduction scripts is much easier than ever before. If you want to play with astronomy imaging datasets, this piece will steer you in the right direction.
### What do you want to know about data science?
Data science is an exciting field with countless things to explore. If there's something you want to know about data science, please tell us about it in the comments so we can try to cover it in 2020. Or, if you are so inclined, please share your knowledge with Opensource.com readers by [submitting an article][19] about your favorite data science topic.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/data-science-resources
作者:[Lauren Maffeo][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/lmaffeo
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opendata_0613mm.png?itok=UIjD_jhK (Open data brain)
[2]: https://business.linkedin.com/content/dam/me/business/en-us/talent-solutions/emerging-jobs-report/Emerging_Jobs_Report_U.S._FINAL.pdf
[3]: https://opensource.com/article/19/1/why-data-scientists-love-kubernetes
[4]: https://opensource.com/article/19/3/apache-spark-and-dataframes-tutorial
[5]: https://opensource.com/article/19/3/sql-scale-apache-spark-sql-and-dataframes
[6]: https://opensource.com/article/19/2/learn-data-science-ai
[7]: https://www.amazon.com/Weapons-Math-Destruction-Increases-Inequality/dp/0553418815
[8]: https://opensource.com/article/19/9/get-started-data-science-python
[9]: https://opensource.com/article/17/10/python-101
[10]: https://opensource.com/article/19/5/visualize-log-data-apache-spark
[11]: https://opensource.com/article/19/5/log-data-apache-spark
[12]: https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#dataframe
[13]: https://opensource.com/article/19/5/chaossearch-github-ghtorrent
[14]: https://opensource.com/article/19/10/predicting-nfl-plays-python
[15]: https://opensource.com/article/19/10/formatting-nfl-data-python
[16]: https://insights.stackoverflow.com/survey
[17]: https://opensource.com/article/19/9/stack-overflow-survey-python-pandas
[18]: https://opensource.com/article/19/10/python-astronomy-open-data
[19]: https://opensource.com/how-submit-article

View File

@ -0,0 +1,56 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How the Zen of Python handles errors)
[#]: via: (https://opensource.com/article/19/12/zen-python-errors)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
How the Zen of Python handles errors
======
This is part of a special series about the Zen of Python focusing on the
10th and 11th principles: on the silence (or not) of errors.
![a checklist for a team][1]
Handling "exceptional conditions" is one of the most debated issues in programming. That could be because the stakes are high: mishandled error values can bring down even the largest systems. Since "exception conditions," by nature, are the least tested but occur with unpleasant frequency, correctly handling them can often distinguish a system that horror stories are told about to a system that "just works."
From Java's **checked** exceptions through Erlang's fault isolation to Haskell's **Maybe**, different languages have remarkably different attitudes to error handling.
The [Zen][2] offers Python's meditation on the topic.
### Errors should never pass silently…
Before the Zen of Python was a twinkle in Tim Peters' eye, before Wikipedia became informally known as "wiki," the first WikiWiki site, [C2][3], existed as a trove of programming guidelines. These are principles that mostly came out of a [Smalltalk][4] programming community. Smalltalk's ideas influenced many object-oriented languages, Python included.
The C2 wiki defines the Samurai Principle: "return victorious, or not at all." In Pythonic terms, it encourages eschewing sentinel values, such as returning **None** or **-1** to indicate an inability to complete the task, in favor of raising exceptions. A **None** is silent: it looks like a value and can be put in a variable and passed around. Sometimes, it is even a _valid_ return value.
The principle here is that if a function cannot accomplish its contract, it should "fail loudly": raise an exception. The raised exception will never look like a possible value. It will skip past the **returned_value = call_to_function(parameter)** line and go up the stack, potentially crashing the program.
A crash is straightforward to debug: there is a stack trace indicating the problem as well as the call stack. The failure might mean that a necessary condition for the program was not met, and human intervention is needed. It might mean that the program's logic is faulty. In either case, the loud failure is better than a hidden, "missing" value, infecting the program's valid data with **None**, until it is used somewhere and an error message says "**None does not have method split**," which you probably already knew.
### Unless explicitly silenced.
Exceptions sometimes need to be explicitly caught. We might anticipate some of the lines in a file are misformatted and want to handle those in a special way, maybe by putting them in a "lines to be looked at by a human" file, instead of crashing the entire program.
Python allows us to catch exceptions with **except**. This means errors can be _explicitly_ silenced. This explicitness means that the **except** line is visible in code reviews. It makes sense to question why this is the right place to silence, and potentially recover from, the exception. It makes sense to ask if we are catching too many exceptions or too few.
Because this is all explicit, it is possible for someone to read the code and understand which exceptional conditions are recoverable.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-errors
作者:[Moshe Zadka][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/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team)
[2]: https://www.python.org/dev/peps/pep-0020/
[3]: https://wiki.c2.com/
[4]: https://en.wikipedia.org/wiki/Smalltalk

View File

@ -0,0 +1,72 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top 10 Raspberry Pi articles of 2019)
[#]: via: (https://opensource.com/article/19/12/raspberry-pi-2019)
[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja)
Top 10 Raspberry Pi articles of 2019
======
Take a look back at the year in Raspberry Pi and get excited for what's
to come in 2020.
![Raspberries with pi symbol overlay][1]
Since its introduction, the Raspberry Pi has been one of the hottest topics on Opensource.com. This trend continued in 2019 with an impressive list of over 30 articles about various Raspberry Pi projects. The top 10 articles are covered below, but if you are a true Raspberry Pi aficionado, I encourage you to check out out our entire selection of [Raspberry Pi articles][2].
1. _[Turn a Raspberry Pi 3B+ into a PriTunl VPN][3]_ by Stephen Bancroft demonstrates how to set up a PriTunl virtual private networking (VPN) on a Raspberry Pi 3B+. There are several sticky points about the process that Bancroft helpfully and clearly explains. Following his instructions, you can easily turn a Raspberry Pi into a VPN server.
2. In _[Lets get physical: How to use GPIO pins on the Raspberry Pi][4]_, Anderson Silva provides a brief introduction to using the GPIO pins on a Raspberry Pi. The article is full of links to other resources, including some of Silvas other pieces, for those who want to dig deeper into the topic.
3. Sam Bocettas article _[How to use your Raspberry Pi as a VPN server][5]_, demonstrates how to install and configure PiVPN on a Raspberry Pi to create a VPN server. The article covers every aspect of the installation and configuration process, so if the reader has followed all the instructions provided, they will end up with their own Raspberry Pi-powered VPN.
4. _[Program the real world using Rust on Raspberry Pi][6]_ by Rahul Thakoor explores how to use the Rust programming language on the Raspberry Pi. By adding **rust_gpiozero** to a Rust project, it is possible to write code in Rust that can interact with buttons, servos, and other hardware connected to a Raspberry Pi. This article shows you how to get started.
5. Ben Nuttall, Raspberry Pi community manager, proclaims _[Raspberry Pi 4 is here!][7]_ in this article covering the release of the Raspberry Pi 4. The Raspberry Pi 4 features many improvements over previous Raspberry Pi models, and Nuttall walks through them in detail. From the new hardware features to the software updates in the updated release of Raspbian, this article brings you up to speed on what the Raspberry Pi 4 brings to the Raspberry Pi ecosystem.
6. _[How to build a WiFi picture frame with a Raspberry Pi][8]_ by Manuel Dewald shows you how to create a WiFi-connected digital picture frame using a Raspberry Pi 3. This step-by-step tutorial provides all the instructions needed to configure the software, but if you want to make a fancy case for your digital picture frame, that part is up to you.
7. Anderson Silvas _[How to boot up a new Raspberry Pi][9]_ explains what you need to do to boot an operating system on a Raspberry Pi. This article primarily provides an overview of NOOBS (New Out Of Box Software) and contains links to the official Raspberry Pi website for the most up-to-date installation instructions.
8. _[How to build a mobile particulate matter sensor with a Raspberry Pi][10]_ by Stephan Tetzel illustrates how to build a sensor that can monitor your air quality using a Raspberry Pi, a small LCD display, and an inexpensive sensor. The particulate matter sensor you create can be used anywhere when paired with a power bank.
9. _[3 popular programming languages you can learn with Raspberry Pi][11]_ by Anderson Silva looks at programming Python, Java, and JavaScript on the Raspberry Pi. The Thonny IDE for Python and the BlueJ IDE for Java are briefly covered. The article also encourages users who are interested in other programming languages with the assurance that "theres a high likelihood that you can use your Raspberry Pi to compile or interpret any language of choice, including C, C++, PHP, and Ruby."
10. Take a trip down memory lane by _[Resurrecting the Amiga on the Raspberry Pi][12]_ with this guide by Sarah Thornton. Using the instructions provided, you can experience the Amiga again on a Raspberry Pi or several other devices. Thornton even provides a helpful set of links for those interested in learning more about the history of the Amiga.
I hope these articles encourage you to explore the possibilities of the Raspberry Pi. Maybe they have even inspired you to [share your own Raspberry Pi story][13] with us? Your story could end up on this list next year!
In this month's Raspberry Pi column, Ben Nuttall introduces readers to five projects that you might...
Owning a little cloud has a lot of benefits and can save you over $100 per month. In this step-by-...
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/raspberry-pi-2019
作者:[Joshua Allen Holm][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/holmja
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay)
[2]: https://opensource.com/tags/raspberry-pi
[3]: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi
[4]: https://opensource.com/article/19/3/gpio-pins-raspberry-pi
[5]: https://opensource.com/article/19/6/raspberry-pi-vpn-server
[6]: https://opensource.com/article/19/3/physical-computing-rust-raspberry-pi
[7]: https://opensource.com/article/19/6/raspberry-pi-4
[8]: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi
[9]: https://opensource.com/article/19/3/how-boot-new-raspberry-pi
[10]: https://opensource.com/article/19/3/mobile-particulate-matter-sensor
[11]: https://opensource.com/article/19/3/programming-languages-raspberry-pi
[12]: https://opensource.com/article/19/3/amiga-raspberry-pi
[13]: https://opensource.com/how-submit-article

View File

@ -0,0 +1,68 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 resources to boost your Git skills)
[#]: via: (https://opensource.com/article/19/12/git-resources)
[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja)
10 resources to boost your Git skills
======
Wrap up the year with a review of the best in Git. Here are the top 10
articles about surprising ways you can use Git in the new year.
![open source button on keyboard][1]
As we near the end of 2019, it is time to look back at the top 10 articles we published about Git this year.
These articles range from use cases and tutorials to some very interesting, if somewhat unconventional, ways to use Git. All of these articles can help you improve your Git skills, but if you really need a Git 101 introduction, be sure to check out our _[Getting started with Git: Terminology 101][2]_ article and download our [Git cheat sheet][3].
1. _[How GNOME uses Git][4]_ by Molly de Blanc looks at the GNOME projects adoption of a self-hosted GitLab instance as the GNOME projects centralized location for contributing to GNOME. De Blanc works in a non-coding position, so her article also explores how the switch to GitLab benefits contributors whose primary role is not writing code.
2. Ahmad Awais _[Emoji-Log: A new way to write Git commit messages][5]_ explains how to use Emoji-Log, "a straightforward, open source Git commit log standard," to write better, more user-friendly, Git commit messages. The article contains an overview of the theory behind Emoji-Log and configuration examples that can be added to **.bashrc, .zshrc, or .gitconfig** to quickly start using Emoji-Log.
3. In _[Manage your daily schedule with Git][6]_, Seth Kenlon explains how to use Git to manage your calendar. By combining Org mode, Git, and a few other tools, Kenlon describes how to create a Git-based calendar workflow that can be synced across devices.
4. [_Use Git as the backend for chat_][7] by Seth Kenlon explores another unconventional way to use Git. In this article, he explores GIC, which is a chat client written in Node.js with Git functioning as the backend database. GIC is proof of concept, not something intended for production use, but it provides an interesting example of a really unique way to use Git.
5. Alan Formy-Duvals _[A practical learning exercise for Git][8]_ is a chronicle of his effort to improve his Git skills. He shares his experience for others to benefit from what he learned, and Git novices will gain a lot from this excellent overview of Gits core functionality.
6. _[How writers can get work done better with Git][9]_ by Seth Kenlon looks at how writers can benefit from a Git-based workflow. The article explains how to use Git and Atom to write using Markdown. By following the examples in this article, writers can easily add a complex revision control system to their writing workflow.
7. In _[How to use Magit to manage Git projects][10]_, Sachin Patil explains how to use Emacs Magit extension to manage Git repositories. The article provides clear examples of how to perform a selection of key Git tasks inside Emacs. The examples are supported by screenshots illustrating the various tasks.
8. _[Move your dotfiles to version control][11]_ by Matthew Broberg shows how to use Git to store the dotfiles in your home directory. Storing your dotfiles in a Git repository makes it easier to share your system configuration between computers and, if you so choose, share your configurations with others. The article does come with a warning about what not to share because sharing the wrong dotfiles can expose others.
9. Austin Deweys _[4 secrets management tools for Git encryption][12]_ compares Git-crypt, BlackBox, SOPS, and Transcrypt in this article examining tools for storing secrets in Git. The article covers four major areas: encryption types supported, the goals of each project, the projects workflows and differences, and other features.
10. _[Run a server with Git][13]_ by Seth Kenlon explains how Gitolite can be used to manage a Git server. Gitolite is "a backend application managing the fiddly bits" involved in using Git to manage a Git server. The article demonstrates how to install, configure, and use Gitolite, with clear examples detailing each step the process.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/git-resources
作者:[Joshua Allen Holm][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/holmja
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard)
[2]: https://opensource.com/article/19/2/git-terminology
[3]: https://opensource.com/downloads/cheat-sheet-git
[4]: https://opensource.com/article/19/10/how-gnome-uses-git
[5]: https://opensource.com/article/19/2/emoji-log-git-commit-messages
[6]: https://opensource.com/article/19/4/calendar-git
[7]: https://opensource.com/article/19/4/git-based-chat
[8]: https://opensource.com/article/19/5/practical-learning-exercise-git
[9]: https://opensource.com/article/19/4/write-git
[10]: https://opensource.com/article/19/1/how-use-magit
[11]: https://opensource.com/article/19/3/move-your-dotfiles-version-control
[12]: https://opensource.com/article/19/2/secrets-management-tools-git
[13]: https://opensource.com/article/19/4/server-administration-git

View File

@ -0,0 +1,120 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Explained! Why Your Distribution Still Using an Outdated Linux Kernel?)
[#]: via: (https://itsfoss.com/why-distros-use-old-kernel/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
Explained! Why Your Distribution Still Using an Outdated Linux Kernel?
======
[Check your Linux kernel version][1]. Chances are that youll find that the kernel version your system is using has already reached end of life (EOL) as listed on Linux Kernel website.
End of life means a software wont get bug fixes and support anymore.
That poses some valid questions. Why is my Linux distribution using a kernel that has reached end of life? Is this not a security risk? Is my system safe?
Let me explain all these questions in this article.
Summary
The upstream kernel support and the your distributions kernel support are two different things.
For example, Linux kernel 4.15 might have reached end of life (as per the official Linux kernel website) but Ubuntu 18.04 LTS release will use it and maintain it till April 2023 by backporting security patches and bug fixes.
### Checking Linux kernel version and finding its end of life status
Lets first check the Linux kernel version on your system:
```
uname -r
```
I am using Ubuntu 18.04 here and it shows the Linux kernel version like this:
```
[email protected]:~$ uname -r
5.0.0-37-generic
```
Now, you may go to the official Linux kernel website and see what Linux kernels are still being supported. Its displayed on the homepage itself.
[Linux Kernel Official Website][2]
You should see a status like this:
![Linux Kernel Status][3]
If you dont see a kernel version listed on the homepage of kernel website, it means that specific version has reached end of life.
As you can see, kernel 5.0 is not listed here. It indicates that this kernel version is not being supported anymore. Actually, it [reached end of life in June 2019][4].
The life cycle of a Linux kernel doesnt follow a set pattern, unfortunately. Its NOT like a regular kernel stable release will be supported for X months and a long term support(LTS) kernel will be supported for Y years.
Based on the demand and requirements, there could be several LTS kernel versions with different EOL. You can find them along with their projected EOL on [this page][5].
Now comes the big question. Why is Ubuntu providing kernel 5.0 if the Linux kernel website shows that it has reached its end of life?
### Your distribution uses an EOL Linux kernel but thats Okay!
![][6]
Have you ever wondered why Ubuntu/Debian/Fedora etc are called Linux distributions? Its because they distribute the Linux kernel.
They have their own modification of the Linux kernel, they add the GUI elements (desktop environment, display server etc) and software and they make it available to their users.
In the typical workflow, a Linux distribution will choose a kernel to provide to its users. And then it will hold on to this kernel for months or years even after the kernel has reached end of life.
How is it safe then? Its because the _**distribution maintains the kernel by backporting all the important fixes to its kernel**_.
In other words, your Linux distribution makes sure that your Linux kernel is patched well and has all the bug fixes and important new features backported to it. There will be thousands of changes on top of the old outdated Linux kernel.
When the Linux kernel website says that a certain kernel version has reached EOL, it means that the core Linux kernel maintainers are not going to update/patch that kernel version anymore.
But at the same time, the developers at Debian/Ubuntu or other distributions work to keep the same old version alive by bringing the relevant changes from the newer kernel versions (being maintained by the core kernel team) to your distributions old kernel.
Bottom line is that even if it seems like your distribution is using an outdated Linux kernel, it is actually being well maintained and not really outdated.
### Should you use the latest stable kernel version?
![][7]
A new stable Linux kernel version is released every 2-3 months. And this makes many users wonder who they can get their hands on that new shiny thing.
To be frank, you should not do that unless you have a pretty good reason for it. Your distribution doesnt provide it to you. You cannot just use _sudo apt give-me-the-latest-stable-kernel_.
Now, manually [installing the mainline Linux kernel version][8] could be a challenge in itself. Even if you manage to install it, it is now up to you to make sure that this kernel is updated every time there is a bug fix. And when this new kernel reaches end of life, it becomes your responsibility to upgrade to the newer kernel version. It wont be handled with apt upgrade like regular [Ubuntu updates][9].
You should also keep in mind that your distribution also has drivers and patches which you may not be able to use if you switch to the mainline kernel.
As [Greg Kroah-Hartman][10] puts it, “_**the best kernel you can use is one that someone else supports**_“. And who can be better at this job then your Linux distribution!
I hope you have a better understanding on this topic and you wont panic the next time you find out that the kernel version your system is using has reached end of life.
I welcome your questions and suggestions. Please feel free to use the comment section.
--------------------------------------------------------------------------------
via: https://itsfoss.com/why-distros-use-old-kernel/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/
[2]: https://www.kernel.org/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/linux-kernel-status.jpg?ssl=1
[4]: http://lkml.iu.edu/hypermail/linux/kernel/1906.0/02354.html
[5]: https://www.kernel.org/category/releases.html
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/Keep_Calm_and_Trust_Your_Distribution.png?ssl=1
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/using_latest_kernel.png?ssl=1
[8]: https://wiki.ubuntu.com/Kernel/MainlineBuilds
[9]: https://itsfoss.com/update-ubuntu/
[10]: https://en.wikipedia.org/wiki/Greg_Kroah-Hartman

View File

@ -0,0 +1,71 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (The importance of consistency in your Python code)
[#]: via: (https://opensource.com/article/19/12/zen-python-consistency)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
The importance of consistency in your Python code
======
This is part of a special series about the Zen of Python focusing on the
12th, 13th, and 14th principles: the roles of ambiguity and obviousness.
![Two animated computers waving one missing an arm][1]
The principle of least surprise is [a guideline][2] when designing user interfaces. It says that when the user performs an action, the program should do whatever would surprise the user the least. This is for the same reason kids love reading the same book over and over again: there is nothing more comforting to people than the ability to predict and have those predictions come true.
A critical insight in the development of the [ABC language][3], Python's inspiration, was that programming languages are user interfaces and need to be designed with the same tools that UI designers use. Thankfully, since then, more languages have adopted the concepts of affordance and ergonomics from UI design, even if they apply them less strictly.
This brings us to the next three principles in the [Zen of Python][4].
### In the face of ambiguity, refuse the temptation to guess.
What should the result of **1 + "1"** be? Both **"11"** and **2** would be valid guesses. This expression is _ambiguous_: there is no single thing it can do that would not be a surprise to at least some people.
Some languages choose to guess. In JavaScript, the result is **"11"**. In Perl, the result is **2**. In C, naturally, the result is the empty string. In the face of ambiguity, JavaScript, Perl, and C all guess.
In Python, this raises a **TypeError**: an error that is not silent. It is atypical to catch **TypeError**: it will usually terminate the program or at least the current task (for example, in most web frameworks, it will terminate the handling of the current request).
Python refuses to guess what **1 + "1"** means. The programmer is forced to write code with clear intention: either **1 + int("1")**, which would be **2**; or **str(1) + "1"**, which would be **"11"**; or **"1"[1:]**, which would be an empty string. By refusing to guess, Python makes programs more predictable.
### There should be one—and preferably only one—obvious way to do it.
Prediction also goes the other way. Given a task, can you predict the code that will be written to achieve it? It is impossible, of course, to predict perfectly. Programming, after all, is a creative task.
However, there is no reason to intentionally provide multiple, redundant ways to achieve the same thing. There is a sense in which some solutions are "better" or "more Pythonic."
Part of the appreciation for the Pythonic aesthetic is that it is OK to have healthy debates about which solution is better. It is even OK to disagree and keep programming. It is even OK to agree to disagree for the sake of harmony. But beneath it all, there has to be a feeling that, eventually, the right solution will come to light. There must be the hope that eventually we can live in true harmony by agreeing on the best way to achieve a goal.
### Although that way may not be obvious at first (unless you're Dutch).
This is an important caveat: It is often _not_ obvious, at first, what is the best way to achieve a task. Ideas are evolving. _Python_ is evolving. The best way to read a file block-by-block is, probably, to wait until Python 3.8 and use the [walrus operator][5].
This common task, reading a file block-by-block, did not have a "single best way to do it" for almost _30 years_ of Python's existence.
When I started using Python in 1998 with Python 1.5.2, there was no single best way to read a file line-by-line. For many years, the best way to know if a dictionary had a key was to use **.haskey**, until the **in** operator became the best way.
It is only by appreciating that sometimes, finding the one (and only one) way of achieving a goal can take 30 years of trying out alternatives that Python can keep aiming to find those ways. This view of history, where 30 years is an acceptable time for something to take, often feels foreign to people in the United States, when the country has existed for just over 200 years.
The Dutch, whether it's Python creator [Guido van Rossum][6] or famous computer scientist [Edsger W. Dijkstra][7], have a different worldview according to this part of the Zen of Python. A certain European appreciation for time is essential to appreciate it.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/zen-python-consistency
作者:[Moshe Zadka][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/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0 (Two animated computers waving one missing an arm)
[2]: https://www.uxpassion.com/blog/the-principle-of-least-surprise/
[3]: https://en.wikipedia.org/wiki/ABC_(programming_language)
[4]: https://www.python.org/dev/peps/pep-0020/
[5]: https://www.python.org/dev/peps/pep-0572/#abstract
[6]: https://en.wikipedia.org/wiki/Guido_van_Rossum
[7]: http://en.wikipedia.org/wiki/Edsger_W._Dijkstra

View File

@ -0,0 +1,57 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Top CI/CD resources to set you up for success)
[#]: via: (https://opensource.com/article/19/12/cicd-resources)
[#]: author: (Jessica Cherry https://opensource.com/users/jrepka)
Top CI/CD resources to set you up for success
======
Continuous integration and continuous deployment were key topics in 2019
as organizations look to achieve seamless, flexible, and scalable
deployments.
![Plumbing tubes in many directions][1]
This has been a fantastic year for continuous integration/continuous deployment (CI/CD) and the world of DevOps. Opensource.com authors shared how they're moving toward agile and scrum as they focus on seamless, flexible, and scalable deployments. Here are some of the big themes in the CI/CD articles we published this year.
### Learning and improving your CI/CD skills
Some of our favorite articles focus on hands-on CI/CD experience and cover a lot of ground as they do. The place to start is always with [Jenkins][2] pipelines, and Bryant Son's [_Building CI/CD pipelines with Jenkins_][3] will give you enough experience to get started building your first pipelines. Daniel Oh's [_Automate user acceptance testing with your DevOps pipeline_][4] provides great information on acceptance testing, including various CI/CD applications you can use for testing in its own right. And my article on [_Security scanning your DevOps pipeline_][5] is a very short, to the point tutorial on how to set up security in a pipeline using the Jenkins platform.
### Delivery workflow
While learning how to use and improve your skills with CI/CD, the workflow matters, especially when it comes to pipelines, as Jithin Emmanuel shares in [_Screwdriver: A scalable build platform for continuous delivery_][6]. Emily Burns explains having the flexibility to build exactly what you need with your CI/CD workflow in [_Why Spinnaker matters to CI/CD_][7]. And Willy-Peter Schaub extols the idea of creating a unified pipeline for everything to build consistently in [_One CI/CD pipeline per product to rule them all_][8]. These articles will give you a good sense of what happens after you onboard team members to the workflow process.
### How CI/CD affects organizations
2019 was also the year of recognizing CI/CD's business impact and how it affects day-to-day operations. Agnieszka Gancarczyk shares the results of Red Hat's [_Small Scale Scrum vs. Large Scale Scrum_][9] survey, including respondents' differing opinions on scrums, the agile movement, and the impact on teams. Will Kelly covers [_How continuous deployment impacts the entire organization_][10], including the importance of open communication, and Daniel Oh emphasizes the importance of metrics and observability in [_3 types of metric dashboards for DevOps teams_][11]. Last, but far from least, Ann Marie Fred's great article [_Don't test in production? Test in production!_][12] details why it's important for you to test in production—before your customers do.
We are thankful to the many contributing authors who shared their insights with Opensource.com readers in 2019, and I look forward to learning more from them about the evolution of CI/CD in 2020.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/cicd-resources
作者:[Jessica Cherry][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jrepka
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plumbing_pipes_tutorial_how_behind_scenes.png?itok=F2Z8OJV1 (Plumbing tubes in many directions)
[2]: https://jenkins.io/
[3]: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins
[4]: https://opensource.com/article/19/4/devops-pipeline-acceptance-testing
[5]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline
[6]: https://opensource.com/article/19/3/screwdriver-cicd
[7]: https://opensource.com/article/19/8/why-spinnaker-matters-cicd
[8]: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all
[9]: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum
[10]: https://opensource.com/article/19/7/organizational-impact-continuous-deployment
[11]: https://opensource.com/article/19/7/dashboards-devops-teams
[12]: https://opensource.com/article/19/5/dont-test-production

View File

@ -0,0 +1,90 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Most-read open source news stories of 2019)
[#]: via: (https://opensource.com/article/19/12/open-source-news)
[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt)
Most-read open source news stories of 2019
======
Here are some of the big news items from the year and a look at the
future of open source.
![Radio wave.][1]
A great deal happened in the world of open source in 2019. Once upon a time, you would have been hard-pressed to find news about Linux, free software, and open source software outside of a small handful of specialist publications. Today, though, news about open source is everywhere; the online edition of Forbes even has its own [Linux columnist][2].
We regularly round up many of the most interesting and topical news articles in [fortnightly articles][3]. Of those, weve compiled the top 10 most read (by you, our readers) stories we curated during 2019.
### Google's trusted hardware project
Many of us take the security of our software seriously but, at the same time, take the security of our hardware for granted. How do we know if the hardware were using is secure and trusted? To help ensure that it is, Google [announced OpenTitan][4], a secure, open source chip design project. The project builds upon a chip that Google developed called Titan, and the search giant has recruited several hardware manufacturers to join this initiative.
### Database makers embrace open source licenses
Over the last 18 months or so, several open source database firms moved to less open licenses for the software they develop in an attempt to stay competitive in a tough market. Cloudera and YugaByte, however, went in the opposite direction in 2019. Cloudera put the proprietary portions of its products under the umbrella of the [AGPL and Apache 2.0 licenses][5], while YugaByte [announced it was adopting][6] the Apache 2.0 license for its wares.
### GNOME and KDE agree to work together
Its always great when two rivals put aside their differences to work for a greater good; especially when that greater good is the further advancement of the Linux desktop. Thats what happened when the GNOME Foundation and KDE [announced they were going to work together][7]. The goal is to bring the GNOME and KDE communities together "to build an application ecosystem that transcends individual distros and broadens the market for everyone."
### System76 announces Linux laptops with Coreboot firmware
While there are several small companies selling Linux-powered computers, not all components of those computers are open source. Thats especially true for their firmware. Computer maker System76 is trying to change that. The company announced that it will [ship two of its most popular laptops][8] with the lightweight Coreboot open source firmware. According to Forbes Online, by adopting Coreboot (which helps computers start faster) System76 is taking another step in "the companys steady march toward offering open source software and hardware."
### Open source platform spans the globe to help local communities
Open source knows no borders. Proof of that is at the St. Francis Neighborhood Center in West Baltimore, which [adopted the Lutèce platform][9] to help deliver its programs and services. While Lutèce was developed in France and runs services in French cities like Paris, Lyon, and Marseille, the implementation in West Baltimore is the first time the platform has been used outside of its country of origin.
### Australian government uses open source to build notification platform
When Australias Digital Transformation Agency (DTA) need to quickly deploy an email and text message notification system, it turned to software developed by the Government Digital Service in the UK. The result was a platform called Notify. Using existing software enabled the DTA to [get the platform up and running][10] in eight weeks. Notify is now being used by over 100 government departments across the country.
### Dutch city to further embrace open source
Like many cities in Europe, Nijmegen in the eastern part of the Netherlands has long been an advocate of using open source in government. Unfortunately, the citys procurement processes still favored proprietary solutions. Thats starting to change, thanks to a [resolution passed in 2019][11] which requires the city to "deploy both the mandatory and the recommended open standards listed by the Dutch Standardisation Forum." The municipal government hopes that the resolution will spur wider use of open source software to avoid vendor lock-in.
### Acquia buys Mautic
Acquia, the company behind the popular open source content management system Drupal, took a big step in its ambition to create the first "open digital experience platform" by acquiring open source marketing automation firm Mautic. The idea behind the acquisition is to give companies that use Acquias offerings "the freedom they need to own their digital destiny without the constraint of vendor lock-in."
### Mozilla Labs makes a return
A few years ago, Mozilla had seemed to abandoned Mozilla Labs. Labs, you might remember, was the home of various beta features for Firefox that users could test drive. In early 2019, Mozilla [brought Labs back][12] with more experimental goodness. The new edition of Mozilla Labs is aimed at sharing ways to expand the capabilities of Firefox. It also showcases technologies that make it easier for anyone interact with virtual reality and the Internet of Things.
### Making it easier to announce software's end of life
Like many things, older versions of software have a use-by date - a date after which it wont be supported or be compatible with its supporting software or operating systems. That information often gets buried on a projects website. Thats where [endoflife.date][13] comes in. Its a repository of information that "aims to overcome the complexity of end of life (EOL) announcements for software."
### Predictions for 2020
What Linux and open source projects and news do you predict being big stories in 2020? Let us know about them in the comments, or send a story proposal to [open@opensource.com][14].
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/open-source-news
作者:[Scott Nesbitt][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/scottnesbitt
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/news-radio-wave-lead_520.png?itok=J86HG1Vg (Radio wave.)
[2]: https://opensource.com/article/19/9/found-linux-video-gaming
[3]: https://opensource.com/tags/news
[4]: https://techcrunch.com/2019/11/05/google-opentitan-secure-chip/
[5]: https://www.cbronline.com/news/cloudera-open-source
[6]: http://www.dbta.com/Editorial/News-Flashes/YugaByte-Becomes-100-percent-Open-Source-Under-Apache-20-License-133083.aspx
[7]: https://www.zdnet.com/article/gnome-and-kde-work-together-on-the-linux-desktop/
[8]: https://www.forbes.com/sites/jasonevangelho/2019/10/10/system76-will-begin-shipping-2-linux-laptops-with-coreboot-based-open-source-firmware/#3c5fb7294e64
[9]: https://technical.ly/baltimore/2019/04/19/paris-lutece-open-source-platform-city-services-west-baltimore-community-center-st-francis/
[10]: https://www.zdnet.com/article/open-source-notify-gov-au-delivered-in-eight-weeks-for-a-cost-of-au150k/
[11]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/not-having-choose
[12]: https://betanews.com/2018/12/28/mozilla-labs-is-back/
[13]: https://endoflife.date/
[14]: mailto:open@opensource.com

View File

@ -1,272 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (runningwater)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Using the Java Persistence API)
[#]: via: (https://opensource.com/article/19/10/using-java-persistence-api)
[#]: author: (Stephon Brown https://opensource.com/users/stephb)
使用 Java 持久化 API
======
我们通过为自行车商店构建示例应用程序来学习如何使用 JPA。
![Coffee beans][1]
对应用开发者来说Java 持久化 API JPA是一项重要的技能需要透彻理解。它为 Java 开发人员定义了如何将对象的方法调用转换为访问、持久化及管理 NoSQL 和关系型数据库数据存储的问题的方案。
本文通过构建自行车借贷服务的教程示例来详细研究 JPA。此示例会使用 Spring Boot 框架、MongoDB 数据库([已经不开源][2])和 Maven 包管理来构建一个大型应用程序,并且创建一个创建、读取、更新和删除(CRUD) 层。这儿我选择 NetBeans 11 作为我的 IDE。
此教程仅从开源的角度来介绍 Java 持久化的工作原理,不涉及其作为工具的使用说明。这全是关于编写应用程序模式的学习,但对于理解具体的软件实现也很益处。可以从我的[ GitHub 源仓库][3] 来获取相关代码。
### Java: 不仅仅是 'beans'
Java 是一门面向对象的编程语言,自 1996 年发布第一版 Java 开发工具JDK已经变化了很多很多。要了解其特性和其虚拟机本身就是个很长的历史。简而言之和 Linux 内核很相似,自发布以来,该语言已经向多个方向分支发展。有对社区免费的标准版本、有针对企业的企业版本及由多家供应商提供的开源替代品。主要版本每六个月发布一次,其功能往往差异很大,所以确认选用版本前得先做些研究。
总而言之Java 的历史很悠久。本教程重点介绍 Java 11 的开源实现 [JDK 11][4]。因其是扔然有效的长期支持版本之一。
* **Spring Boot: ** Spring Boot 是由 Pivotal 公司开发大型 Spring 框架的一个模块。Spring 是 Java 开发中一个非常流行的框架。它支持各种框架和配置,也支持 WEB 应用程序及提供了应用安全保障功能。Spring Boot 为快速启动项目集成了基本的配置。本教程使用 Spring Boot 来快速编写控制台应用程序并针对数据库编写测试用例。
* **Maven:** Maven 是由 Apache 开发的项目/包管理工具。Maven 通过 `POM.xml` 文件来管理包及其依赖项。如果你们使用过 NPM 的话,可能会非常熟悉包管理器的功能。此外 Maven 也用来进行项目构建及生成功能报告。
* **Lombok:** Lombok 是一个库,它通过在对象文件里面添加注解来自动创建 getters/setters 方法。像 C# 这些语言已经实现了此功能Lombok 只是把此功能引入 Java 语言而已。
* **NetBeans: ** NetBeans 是一款很流行的开源 IDE专门用于 Java 开发。它的许多工具都随着 Java SE 和 EE 的版本更新而更新。
我们会这组工具来创建一个简单的虚构自行车商店应用程序。会实现对 "Customer" 和 "Bike" 对象集合的的插入操作。
### 酿造完美
导航到 [Spring Initializr][5] 页面。该网站可以生成基于 Spring Boot 和其依赖项的基本项目。选择以下选项:
1. **项目:** Maven 工程
2. **语言:** Java
3. **Spring Boot:** 2.1.8 (或最稳定版本)
4. **项目元数据:** 无论你使用什么名字,其命名约定都是像 **com.stephb** 这样的。
* 你可以保留 Artifact 名字为 “Demo”。
5. **依赖项:** 添加:
* Spring Data MongoDB
* Lombok
点击 **下载**,然后用你的 IDE例如 NetBeans 打开此新项目。
#### 模型层(Model)概要
项目里面,模型代表从数据库里取出的信息的具体对象。我们关注两个对象:**Customer** 和 **Bike**。首先,在 **src** 目录创建 **dto** 目录;然后,创建两个名为 **Customer.java****Bike.java** 的 Java 类对象文件。其结构如下示:
**Customer.Java**
```
 1 package com.stephb.JavaMongo.dto;
 2 
 3 import lombok.Getter;
 4 import lombok.Setter;
 5 import org.springframework.data.annotation.Id;
 6 
 7 /**
 8  *
 9  * @author stephon
10  */
11 @Getter @Setter
12 public class Customer {
13 
14         private @Id String id;
15         private String emailAddress;
16         private String firstName;
17         private String lastName;
18         private String address;
19         
20 }
```
**Bike.java**
```Java
 1 package com.stephb.JavaMongo.dto;
 2 
 3 import lombok.Getter;
 4 import lombok.Setter;
 5 import org.springframework.data.annotation.Id;
 6 
 7 /**
 8  *
 9  * @author stephon
10  */
11 @Getter @Setter
12 public class Bike {
13         private @Id String id;
14         private String modelNumber;
15         private String color;
16         private String description;
17 
18         @Override
19         public String toString() {
20                 return "This bike model is " + this.modelNumber + " is the color " + this.color + " and is " + description;
21         }
22 }
```
如你所见,对象中使用 Lombok 注解来为定义的属性(特性)生成 getters/setters 方法。如果你不想对所有属于都生成 getters/setters 方法,可以在属性上定义这些注解。这两个类会变成容器,里面携带有数据,无论在何处想显示信息都可以使用。
#### 配置数据库
我使用 [Mongo Docker][7] 容器来进行此次测试。如果你的系统上已经安装了 MongoDB则不必运行 Docker 实例。你也可以登陆其官网,然后按照安装说明,选择系统信息来安装 MongoDB。
安装后就可以使用命令行、GUI例如 MongoDB Compass或用于连接数据源的 IDE 驱动程序来与新的 MongoDB 服务进行交互。到目前为止,可以开始定义数据层了,用来拉取、转换和持久化数据。需要设置数据库访问属性,请导航到程序中的 **applications.properties** 文件,然后添加如下内容:
```
 1 spring.data.mongodb.host=localhost
 2 spring.data.mongodb.port=27017
 3 spring.data.mongodb.database=BikeStore
```
#### 定义数据访问对象(数据)层
数据访问层DAL中的数据访问对象DAO定义了与数据库中的数据的交互过程。令人惊叹的就是在使用 **spring-boot-starter** 后,查询数据库的大部分工作已经完成。
让我们从 **Customer** DAO 开始。在 **src** 下的新目录 **dao** 中创建一个接口文件,然后再创建一个名为 **CustomerRepository.java** 的 Java 类文件,其内容如下示:
```
 1 package com.stephb.JavaMongo.dao;
 2 
 3 import com.stephb.JavaMongo.dto.Customer;
 4 import java.util.List;
 5 import org.springframework.data.mongodb.repository.MongoRepository;
 6 
 7 /**
 8  *
 9  * @author stephon
10  */
11 public interface CustomerRepository extends MongoRepository<Customer, String>{
12         @Override
13         public ListStringCustomer> findAll();
14         public List<Customer> findByFirstName(String firstName);
15         public List<Customer> findByLastName(String lastName);
16 }
```
这个类是一个接口,扩展或继承于 **MongoRepository** 类,而 MongoRepository 类依赖于 DTO **Customer.java**)和一个字符串,它们用来实现自定义函数查询功能。因为您已继承自此类,所以您可以访问许多方法函数,这些函数允许持久化和查询对象,而无需实现或引用自己定义的方法函数。例如,在实例化 **CustomerRepository** 对象后,你就可以直接使用 **Save** 功能。如果你需要扩展更多的功能,也可以重写这些方法。我创建了一些自定义查询来搜索我的集合,这些集合对象是我自定义的元素。
**Bike** 对象也有一个存储源负责与数据库交互。与 **CustomerRepository** 的实现非常类似。其实现如下所示:
```
 1 package com.stephb.JavaMongo.dao;
 2 
 3 import com.stephb.JavaMongo.dto.Bike;
 4 import java.util.List;
 5 import org.springframework.data.mongodb.repository.MongoRepository;
 6 
 7 /**
 8  *
 9  * @author stephon
10  */
11 public interface BikeRepository extends MongoRepository<Bike,String>{
12         public Bike findByModelNumber(String modelNumber);
13         @Override
14         public List<Bike> findAll();
15         public List<Bike> findByColor(String color);
16 }
```
#### 运行程序
现在,你已经有了一种结构化数据的方式,可以对数据进行提取、转换和持久化,然后运行这个程序。
找到 **Application.java** 文件(有可能不是此名称,具体取决于你的应用程序名称,但都会包含有 “application” )。在定义此类的地方,在后面加上 **CommandLineRunner 的实现**。这将允许你实现 **run** 方法来创建命令行应用程序。重写 **CommandLineRunner** 接口提供的 **run** 方法,并包含如下内容用来测试 **BikeRepository**
```
 1 package com.stephb.JavaMongo;
 2 
 3 import com.stephb.JavaMongo.dao.BikeRepository;
 4 import com.stephb.JavaMongo.dao.CustomerRepository;
 5 import com.stephb.JavaMongo.dto.Bike;
 6 import java.util.Scanner;
 7 import org.springframework.beans.factory.annotation.Autowired;
 8 import org.springframework.boot.CommandLineRunner;
 9 import org.springframework.boot.SpringApplication;
10 import org.springframework.boot.autoconfigure.SpringBootApplication;
11 
12 
13 @SpringBootApplication
14 public class JavaMongoApplication implements CommandLineRunner {
15                 @Autowired
16                 private BikeRepository bikeRepo;
17                 private CustomerRepository custRepo;
18                 
19     public static void main(String[] args) {
20                         SpringApplication.run(JavaMongoApplication.class, args);
21     }
22         @Override
23         public void run(String... args) throws [Exception] {
24                 Scanner scan = new Scanner(System.in);
25                 String response = "";
26                 boolean running = true;
27                 while(running){
28                         System.out.println("What would you like to create? \n C: The Customer \n B: Bike? \n X:Close");
29                         response = scan.nextLine();
30                         if ("B".equals(response.toUpperCase())) {
31                                 String[] bikeInformation = new String;
32                                 System.out.println("Enter the information for the Bike");
33                                 System.out.println("Model Number");
34                                 bikeInformation[0] = scan.nextLine();
35                                 System.out.println("Color");
36                                 bikeInformation[1] = scan.nextLine();
37                                 System.out.println("Description");
38                                 bikeInformation[2] = scan.nextLine();
39 
40                                 Bike bike = new Bike();
41                                 bike.setModelNumber(bikeInformation[0]);
42                                 bike.setColor(bikeInformation[1]);
43                                 bike.setDescription(bikeInformation[2]);
44 
45                                 bike = bikeRepo.save(bike);
46                                 System.out.println(bike.toString());
47 
48 
49                         } else if ("X".equals(response.toUpperCase())) {
50                                 System.out.println("Bye");
51                                 running = false;
52                         } else {
53                                 System.out.println("Sorry nothing else works right now!");
54                         }
55                 }
56                 
57         }
58 }
```
其中的 **@Autowired** 注解会自动依赖注入 **BikeRepository****CustomerRepository** Bean。我们将使用这些类来从数据库持久化和采集数据。
已经好了。你已经创建了一个命令行应用程序。该应用程序连接到数据库,并且能够以最少的代码执行 CRUD 操作
### 结论
从诸如对象和类之类的编程语言概念转换为用于在数据库中存储、检索或更改数据的调用对于构建应用程序至关重要。Java 持久化 API JPA正是为 Java 开发人员解决这一难题的重要工具。 你正在使用 Java 操纵哪些数据库呢? 请在评论中分享。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/10/using-java-persistence-api
作者:[Stephon Brown][a]
选题:[lujun9972][b]
译者:[runningwater](https://github.com/runningwater)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/stephb
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans)
[2]: https://www.techrepublic.com/article/mongodb-ceo-tells-hard-truths-about-commercial-open-source/
[3]: https://github.com/StephonBrown/SpringMongoJava
[4]: https://openjdk.java.net/projects/jdk/11/
[5]: https://start.spring.io/
[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
[7]: https://hub.docker.com/_/mongo
[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception
[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system

View File

@ -1,337 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: (wxy)
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to program with Bash: Loops)
[#]: via: (https://opensource.com/article/19/10/programming-bash-loops)
[#]: author: (David Both https://opensource.com/users/dboth)
Bash 编程教程之循环
======
本文是 bash 编程系列3 部分)的最后一篇,来学习使用循环执行迭代的操作。
![arrows cycle symbol for failing faster][1]
Bash 是一种强大的用于命令行和 shell 脚本里的编程语言。本系列的三部分都是基于我的 [Linux 自学课程三卷][2] 写的,探索怎么用 CLIcommand-line interface进行 bash 编程。本系列的 [第一篇文章][3] 讨论了 bash 编程的一些简单命令行操作,如使用变量和控制操作符。[第二篇文章][4] 探讨了文件、字符串、数字等类型和各种各样在执行流中提供控制逻辑的的逻辑运算符,还有 bash 中不同种类的扩展。本文是第三篇(也是最后一篇),意在考察在各种迭代的操作中使用循环以及怎么合理控制循环。
### 循环
我使用过的所有编程语言都有很多种循环结构来用来执行重复的操作。我经常使用 for 循环,然而我发现 while 和 until 循环也很有用处。
#### for 循环
我的理解是,**for** 命令在 bash 中的实现比大部分语言灵活,因为它可以处理非数字的值;与之形成对比的是,诸如标准 C 语言的 **for** 循环只能处理数字类型的值。
Bash 版的 **for** 命令基本的结构很简单:
```
`for Var in list1 ; do list2 ; done`
```
解释一下:“对于 list1 中的每一个值,把 **$Var** 设置为那个值,使用该值执行 list2 中的程序语句list1 中的值都执行完后,整个循环结束,退出循环。” list1 中的值可以是一个简单的显式字符串值,也可以是一个命令执行后的结果(译注:**\` \`** 包含的命令执行的结果,本系列第二篇文章中有描述)。我经常使用这种结构。
确认 **~/testdir** 仍然是当前的工作目录PWD。删除目录下所有东西来看下这个显式写出值列表的 **for** 循环的简单的示例。这个列表中的值是字母值 — 但是不要忘了,在 bash 中所有的变量都是 string 或者可以被当成 string 来处理。
```
[student@studentvm1 testdir]$ rm *
[student@studentvm1 testdir]$ for I in a b c d 1 2 3 4 ; do echo $I ; done
a
b
c
d
1
2
3
4
```
给变量赋予更有意义的名字,变成前面版本的进阶版:
```
[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Department $Dept" ; done
Department Human Resources
Department Sales
Department Finance
Department Information Technology
Department Engineering
Department Administration
Department Research
```
创建几个目录(创建时显示一些处理信息):
```
[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done
Working on Department Human Resources
Working on Department Sales
Working on Department Finance
Working on Department Information Technology
Working on Department Engineering
Working on Department Administration
Working on Department Research
[student@studentvm1 testdir]$ ll
total 28
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Administration
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Engineering
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Finance
drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Human Resources'
drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Information Technology'
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Research
drwxrwxr-x 2 student student 4096 Apr  8 15:45  Sales
```
**mkdir** 语句中 **$Dept** 变量必须用引号包裹起来;否则名字中间有空格(如 `Information Technology`)会被当做两个独立的目录处理。我一直信奉的一条实践规则:所有的文件和目录都应该为一个单词(中间没有空格)。虽然大部分现代的操作系统可以处理名字中间有空格的情况,但是系统管理员需要花费额外的精力去确保脚本和 CLI 程序能正确处理这些特例。(尽管你因为不知道将要处理什么样的文件而烦恼,但是脚本和 CLI 应该已经把这些特例考虑在内了。)
再次删除 **~/testdir** 下的所有东西 — 再运行一次下面的命令:
```
[student@studentvm1 testdir]$ rm -rf * ; ll
total 0
[student@studentvm1 testdir]$ for Dept in Human-Resources Sales Finance Information-Technology Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done
Working on Department Human-Resources
Working on Department Sales
Working on Department Finance
Working on Department Information-Technology
Working on Department Engineering
Working on Department Administration
Working on Department Research
[student@studentvm1 testdir]$ ll
total 28
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Administration
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Engineering
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Finance
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Human-Resources
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Information-Technology
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Research
drwxrwxr-x 2 student student 4096 Apr  8 15:52 Sales
```
假设现在有个需求,需要列出一台 Linux 机器上所有的 RPM 包并对每个包附上简短的描述。我为North Carolina 州工作的时候,曾经遇到过这种需求。由于当时州代理处不允许使用开源的工具,而且我对 Linux 不够熟悉对技术一窍不通的老板PHB需要我列出我计算机上安装的所有软件这样他们就可以“查看“计算机上有没有安装异常的软件了。
你怎么实现它?有一种方法是,已知 **rpm qa** 命令提供了 RPM 包的完整描述,包括 PHB 想要的东西:软件名称和概要描述。一步步执行出最后的结果。首先,列出所有的 RPM 包:
```
[student@studentvm1 testdir]$ rpm -qa
perl-HTTP-Message-6.18-3.fc29.noarch
perl-IO-1.39-427.fc29.x86_64
perl-Math-Complex-1.59-429.fc29.noarch
lua-5.3.5-2.fc29.x86_64
java-11-openjdk-headless-11.0.ea.28-2.fc29.x86_64
util-linux-2.32.1-1.fc29.x86_64
libreport-fedora-2.9.7-1.fc29.x86_64
rpcbind-1.2.5-0.fc29.x86_64
libsss_sudo-2.0.0-5.fc29.x86_64
libfontenc-1.1.3-9.fc29.x86_64
&lt;snip&gt;
```
**sort****uniq** 命令对列表进行排序和打印去重后的结果(有些已安装的 RPM 包具有相同的名字:)
```
[student@studentvm1 testdir]$ rpm -qa | sort | uniq
a2ps-4.14-39.fc29.x86_64
aajohan-comfortaa-fonts-3.001-3.fc29.noarch
abattis-cantarell-fonts-0.111-1.fc29.noarch
abiword-3.0.2-13.fc29.x86_64
abrt-2.11.0-1.fc29.x86_64
abrt-addon-ccpp-2.11.0-1.fc29.x86_64
abrt-addon-coredump-helper-2.11.0-1.fc29.x86_64
abrt-addon-kerneloops-2.11.0-1.fc29.x86_64
abrt-addon-pstoreoops-2.11.0-1.fc29.x86_64
abrt-addon-vmcore-2.11.0-1.fc29.x86_64
&lt;snip&gt;
```
以上命令得到了想要的 RPM 列表,因此你可以把这个列表作为一个循环的输入信息,循环最终会打印每个 RPM 包的详细信息:
```
[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done
```
这段代码产出了多余的信息。当循环结束后, 下一步就是提取出 PHB 需要的信息。因此,添加一个 **egrep** 命令用来搜索匹配 **^Name** 或 **^Summary** 的行。脱字符(^)表示行首,整个命令表示显示所有以 Name 或 Summary 开头的行。
```
[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary"
Name        : a2ps
Summary     : Converts text and other types of files to PostScript
Name        : aajohan-comfortaa-fonts
Summary     : Modern style true type font
Name        : abattis-cantarell-fonts
Summary     : Humanist sans serif font
Name        : abiword
Summary     : Word processing program
Name        : abrt
Summary     : Automatic bug detection and reporting tool
&lt;snip&gt;
```
在上面的命令中你可以试试用 **grep** 代替 **egrep** ,你会发现用 **grep** 不能得到正确的结果。你可以通过管道把命令结果用 **less** 过滤下。最终命令像这样:
```
[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" > RPM-summary.txt
```
这个命令行程序在同一行中用到了管道、重定向和 **for** 循环。它把你 CLI 程序的结果重定向到了一个文件,这个文件可以在邮件中使用或在其他地方作为输入使用。这个一次一步构建程序的过程让你能看到每步的结果,以此来确保整个程序以你期望的流程进行且输出你想要的结果。
PHB 最终收到了超过 1900 个独立 RPM 包的清单,我严重怀疑根本就没人去读它。我给了他们想要的东西,没有从他们嘴里听到过任何关于 RPM 包的信息。
### 其他循环
Bash 中还有两种其他类型的循环结构:**while** 和 **until** 结构,两者在语法和功能上都类似。这些循环结构的基础语法很简单:
```
while [ expression ] ; do list ; done
```
逻辑解释表达式expression结果为 true 时,执行程序语句 `list`。表达式结果为 false 时,退出循环。
```
until [ expression ] ; do list ; done
```
逻辑解释:直到表达式的结果为 true执行程序语句 `list`。当表达式结果为 true 时,退出循环。
#### While 循环
**while** 循环用于当逻辑表达式结果为 true 时执行一系列程序语句。假设你的 PWD 仍是 **~/testdir** 。最简单的 **while** 循环会一直运行下去。下面格式的条件语句永远以 `true` 作为返回。你也可以用简单的 `1` 代替 `true` — 结果一样 — 但是这解释了 true 表达式的用法。
```
[student@studentvm1 testdir]$ X=0 ; while [ true ] ; do echo $X ; X=$((X+1)) ; done | head
0
1
2
3
4
5
6
7
8
9
[student@studentvm1 testdir]$
```
既然你已经学了 CLI 的各部分知识,那就让它变得更有用处。首先,为了防止变量 **$X** 在前面的程序或 CLI 命令执行后有遗留的值,设置 **$X** 的值为 0。然后因为逻辑表达式 **[ true ]** 的结果永远是 1即 true**do****done** 中间的程序指令列表会一直执行 — 或者直到你按下 **Ctrl+C** 抑或发送一个 `signal 2` 给程序。那些程序指令是算法扩展,用来打印变量 **$X** 当前的值并加 1.
[系统管理员的 Linux 哲学][5] 的信条之一是追求优雅,实现优雅的一种方式就是简化。你可以用操作符 **++** 来简化这个程序。在第一个例子中,变量当前的值被打印出来,然后变量的值增加了。可以在变量后加一个 **++** 来表示这个逻辑:
```
[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((X++)) ; done | head
0
1
2
3
4
5
6
7
8
9
```
现在删掉程序最后的 **| head** 再运行一次。在这个版本中,变量在值被打印之前就自增了。这是通过在变量之前添加 **++** 操作符实现的。你能看出区别吗?
```
[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((++X)) ; done | head
1
2
3
4
5
6
7
8
9
```
你已经把打印变量的值和自增简化到了一条语句。类似 **++** 操作符, 也有 **--** 操作符。你需要一个在循环到某个特定数字时终止循环的方法。把 true 表达式换成一个数字比较表达式来实现它。写一个循环到 5 终止的程序。在下面的示例代码中,你可以看到 **-le** 是 ”小于或等于“ 的数字逻辑操作符。整个语句的意思:只要 **$X** 的值小于或等于 5循环就一直运行。当 **$X** 增加到 6时循环终止。
```
[student@studentvm1 ~]$ X=0 ; while [ $X -le 5 ] ; do echo $((X++)) ; done
0
1
2
3
4
5
[student@studentvm1 ~]$
```
#### Until 循环
*until** 命令非常像 **while** 命令。不同之处是,它直到逻辑表达式的值是 `true` 之前,会一直循环。看一下这种结构最简单的格式:
```
[student@studentvm1 ~]$ X=0 ; until false  ; do echo $((X++)) ; done | head
0
1
2
3
4
5
6
7
8
9
[student@studentvm1 ~]$
```
它用一个逻辑比较表达式来数到一个特定的值:
```
[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((X++)) ; done
0
1
2
3
4
[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((++X)) ; done
1
2
3
4
5
[student@studentvm1 ~]$
```
### 总结:
本系列探讨了构建 bash 命令行程序和 shell 脚本的很多强大的工具。但是这仅仅是你能用 Bash 做的很多有意思的事中的冰山一角,接下来就看你的了。我发现学习 Bash 编程最好的方法就是实践。找一个需要多个 Bash 命令的简单项目然后写一个 CLI 程序。系统管理员们做了很多工作让任务变成 CLI 编程,因此我确信你很容易能找到自动化的任务。很多年前,尽管我对其他的 Shell 语言和 Perl 很熟悉,但还是决定用 Bash 做所有系统管理员的自动化任务。我发现 — 有时稍微搜索一下 — 我可以用 Bash 实现我需要的所有事情。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/10/programming-bash-loops
作者:[David Both][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster)
[2]: http://www.both.org/?page_id=1183
[3]: https://opensource.com/article/19/10/programming-bash-part-1
[4]: https://opensource.com/article/19/10/programming-bash-part-2
[5]: https://www.apress.com/us/book/9781484237298

View File

@ -0,0 +1,88 @@
[#]: collector: (lujun9972)
[#]: translator: (Morisun029)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 interview questions every Kubernetes job candidate should know)
[#]: via: (https://opensource.com/article/19/12/kubernetes-interview-questions)
[#]: author: (Jessica Repka https://opensource.com/users/jrepka)
每个 Kubernetes 应聘者应该知道的5个面试题
======
如果你要面试Kubernetes相关的应聘者这里给出了要提问的问题以及这些问题的重要性。
![Pair programming][1]
面试对面试官及候选人来说都很不容易。最近,我发现面试 Kubernetes 相关工作的候选人似乎尤其困难。为什么呢?一方面,很难找到可以回答他们问题的人。而且,不管回答者回答的怎样,都很难确定他们是否有正确的经验。
跳过这个问题,让我们来看看面试[Kubernetes][2]求职者时应该提问的一些问题。
### Kubernetes 是什么?
我发现这个问题是面试中最好的问题之一。我经常听到有人说“我用Kubernetes工作”但是当我问道“Kubernetes 是什么时,从来都没有得到过一个满意答案。
我最喜欢克里斯•肖特[Chris Short][3]给出的答案“Kubernetes 就是带有一些 YAML 文件的 API 。”
虽然他的回答没有错,但我会给你更详细的解释。 Kubernetes 是一个便携式容器编排工具,用于自动执行管理,监控,扩展和部署容器化应用程序。
我认为“用于部署容器化应用程序的编排工具”这个回答可能与你期望的答案差不多了。能回答出这个,我觉得已经很不错了。尽管许多人相信 Kubernetes 可以增加很多但总的来说它提供了许多API来增加其核心功能容器编排。
我认为,这是你在面试中可以提问的最好的问题之一,因为它至少证明了候选人是否知道 Kubernetes 是什么。
### Kubernetes 的 node(节点)和 Pod 有什么区别?
该问题揭示了候选人对 Kubernetes 复杂性的初步了解。它将对话转换为体系结构概述,并可能导向许多有趣的后续细节问题。我已经听到了无数次关于该问题的错误解释了。
[node][4] 是工作计算机。该计算机可以是虚拟机VM或物理计算机具体取决于你是在虚拟机监控程序上运行还是在裸机上运行。该节点包含用于运行容器的服务包括 kubeletkube-proxy 和容器运行时。
[pod][5] pod 包括1一个或多个具有共享网络3和存储4的容器2以及有关如何运行一起部署的容器的规范。这四个细节都很重要。更进一步申请人应从技术层面解释pod 是Kubernetes 可以创建和管理的最小可部署单元,而不是容器。
对于这个问题我听到的最好的简答是“node 是计算机,而 pod 是容器中的东西。” 区别很重要。 Kubernetes 管理员的大部分工作是知道什么时间要部署什么而节点可能非常非常昂贵具体取决于它们的运行位置。我不希望有人一遍又一遍地部署节点他们需要做的就是部署一堆Pod。
### kubectl 是什么? (你怎么发音?)
这个问题是我的优先级中较高的问题之一但可能与你和你的团队无关。在我的团队中我们不会使用图形化界面来管理Kubernetes环境我们使用命令行操作。
那么什么是[kubectl][6]?它是 Kubernetes 的命令行界面。你可以从该界面获取并设置任何内容,从收集日志和事件到编辑部署环境和机密文件。随机提问候选人关于如何使用此工具对测试候选人对 kubectl 的熟悉度是很有帮助的。
你是怎么读的?好吧,你随便吧(对此有很大的分歧),但是我很高兴向你介绍我朋友[Waldo][7]的精彩视频演示。
### 名称空间是什么?
在多次面试中我都没有得到关于这个问题的答案。我不确定在其他环境中使用的名称空间是否会在我所在的团队经常使用。我在这里给出一个简短的答案名称空间是Pod中的虚拟集群。这种抽象可以使你将多个虚拟群集保留在各种环境中以此来进行隔离。
### 容器是什么?
了解 Pod 中正在部署的内容总是有帮助的因为如果都不知道其中部署的是什么何谈部署容器是打包代码及其所有依赖项的软件的标准单元。我收到了两个可以接收的答案其中包括a精简的操作系统映像以及b在受限的 OS 环境中运行的应用程序。如果你可以命名使用[Docker][8]以外的其他容器的编排软件(例如你最喜欢的公共云的容器服务),则可以得到加分。
### 其他问题
如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。如果你想知道为什么我没有在此问题列表中添加更多问题,那么我可以给出一个简单的答案:我所列出的这些问题是在面试候选人时应了解的最基本的问题。接下来的问题应该是基于具体的团队、环境及组织。
**[阅读更多:如何准备 Kubernetes 相关的面试?]][9]**
没有两个环境是完全相同的。这也适用于面试中。我在每次面试中都会混合提问。 我也有一个测试面试者的小环境。我经常发现回答问题是最容易的部分,而你所做的工作才是对你的真正的考验。
我给面试官的最后一点建议是:如果你遇到一个很有潜力但没有经验的候选人时,请给他们一个证明自己的机会。如果当初没有人看到我的潜力,没有给我机会的话,我不会拥有今天的知识和经验。
还有哪些重要的问题?请留言告诉我们。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/kubernetes-interview-questions
作者:[Jessica Repka][a]
选题:[lujun9972][b]
译者:[Morisun029](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jrepka
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1 (Pair programming)
[2]: https://kubernetes.io/
[3]: https://twitter.com/ChrisShort
[4]: https://kubernetes.io/docs/concepts/architecture/nodes/
[5]: https://kubernetes.io/docs/concepts/workloads/pods/pod/
[6]: https://kubernetes.io/docs/reference/kubectl/kubectl/
[7]: https://opensource.com/article/18/12/kubectl-definitive-pronunciation-guide
[8]: https://opensource.com/resources/what-docker
[9]: https://enterprisersproject.com/article/2019/2/kubernetes-job-interview-questions-how-prepare

View File

@ -1,218 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Build a retro Apple desktop with the Linux MLVWM)
[#]: via: (https://opensource.com/article/19/12/linux-mlvwm-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 Linux MLVWM 打造复古苹果桌面
======
本文是 24 天 Linux 桌面特别系列的一部分。如果老式的苹果电脑用开源 POSIX 构建如何?你可以通过构建类 Macintosh 虚拟窗口管理器来实现。
![Person typing on a 1980's computer][1]
想象一下进入另外一个历史Apple II GS 和 MacOS 7 是基于开源 [POSIX][2] 构建的,它使用了与现代 Linux 相同的所有约定,例如纯文本配置文件和模块化系统设计。这样的操作系统将为其用户带来什么?你可以使用[类 Macintosh 虚拟窗口管理器MLVWM][3]来回答这些问题(甚至更多!)。
![MLVWM running on Slackware 14.2][4]
### 安装 MLVWM
MLVWM 安装并不容易,并且可能不在发行版的软件仓库中。如果你有时间理解翻译不佳的 README 文件,编辑一些配置文件,收集并调整一些旧的 **.xpm**图像,编辑一两个 Xorg 选项,那么你就可以体验 MLVWM。否则这是一个新奇的窗口管理器其最新版本可以追溯到 2000 年。
要编译 MLVWM你必须安装 **imake**,它提供 **xmkmf** 命令。你可以从发行版的软件仓库中安装 imake也可以直接从 [Freedesktop.org][5] 获得。假设你已经有 **xmkmf**命令,请进入包含 MLVWM 源码的目录,然后运行以下命令进行构建:
```
$ xmkmf -a
$ make
```
构建后,编译后的 **mlvwm** 二进制文件位于 **mlvwm** 目录中。将其移动到[你的 PATH ][6]的任何位置:
```
`$ mv mlvwm/mlvwm /usr/local/bin/`
```
#### 编辑配置文件
现在已经安装 MLVWM但是如果不调整几个配置文件并仔细排列所需的图像文件它将无法正确启动。示例配置文件位于你下载的源代码的 **sample_rc** 目录中。将文件 **Mlvwm-Netscape****Mlvwm-Xterm** 复制到你的主目录:
```
`$ cp sample_rc/Mlvwm-{Netscape,Xterm} $HOME`
```
**Mlvwmrc** 移动到 **$HOME/.mlvwmrc**(是的,即使示例文件的名称看似是大写字母,但你也必须使用小写的 “m”
```
`$ cp sample_rc/Mlvwmrc $HOME/.mlvwmrc`
```
打开 **.mlwmrc** 并找到第 54-55 行,它们定义了 MLVWM 在菜单和 UI 中使用的像素图的路径“IconPath”
```
# Set icon search path. It needs before "Style".
IconPath /usr/local/include/X11/pixmaps:/home2/tak/bin/pixmap
```
调整路径以匹配你填充图像的路径(我建议使用 **$HOME/.local/share/pixmaps**。MLVWM 不提供像素图,因此需要你提供构建桌面所需图标。
即使你有位于系统其他位置的像素图(例如 **/usr/share/pixmaps**)),也要这样做,因为你需要调整像素图的大小,你可能也不想在系统范围内执行此操作。
```
# Set icon search path. It needs before "Style".
IconPath /home/seth/.local/share/pixmaps
```
#### 选择像素图
你已将 **.local/share/pixmaps** 目录定义为像素图源路径,但是该目录和图像均不存在。创建目录:
```
`$ mkdir -p $HOME/.local/share/pixmaps`
```
现在,配置文件将图像分配给菜单项和 UI 元素,但是系统中不存在这些图像。要解决此问题,请通读配置文件并找到每个 **.xpm** 图像。对于配置中列出的每个图像,将具有相同文件名的图像(或更改配置文件中的文件名)添加到你的 IconPath 目录。
**.mlvwmrc** 文件的注释很好,因此你可以大致了解要编辑的内容。无论如何,这只是第一步。你可以随时回来更改桌面外观。
这有些例子
此代码块设置屏幕左上角的图标:
```
# Register the menu
Menu Apple, Icon label1.xpm, Stick
```
**label1.xpm** 图像实际上在源代码的 **pixmap**目录中,但我更喜欢使用来自 **/usr/share/pixmaps** 的 **Penguin.xpm**(在 Slackware 上)。无论使用什么,都必须将自定义像素图放在 **~/.local/share/pixmaps** 中,并在配置中更改像素图的名称,或者重命名像素图以匹配配置文件中当前的名称。
此代码块定义了左侧菜单中列出的应用:
```
"About this Workstation..." NonSelect, Gray, Action About
"" NonSelect
"Terminal"      Icon mini-display.xpm, Action Exec "kterm" exec kterm -ls
"Editor"  Action Exec "mule" exec mule, Icon mini-edit.xpm
"calculator" Action Exec "xcal" exec xcalc, Icon mini-calc.xpm
END
```
通过遵循与配置文件中相同的语法,你可以自定义像素图并将自己的应用添加到菜单中(例如,我将 **mule** 更改为 **emacs**)。 这是你在 MLVWM GUI 中打开应用的入口,因此请列出你要快速访问的所有内容。你可能还希望包括指向 **/usr/share/applications** 文件夹的快捷方式。
```
`"Applications" Icon Penguin.xpm, Action Exec "thunar /usr/share/applications" exec thunar /usr/share/applications`
```
完成编辑配置文件并将自己的图像添加到 IconPath 目录后,必须将所有像素图的大小都调整为大约 16x16 像素。MLVWM 的默认设置不一致,因此存在变化空间。)你可以使用 ImageMagick 进行批量操作:
```
`$ for i in ~/.local/share/mlvwm-pixmaps/*xpm ; do convert -resize '16x16^' $i; done`
```
### 启动 MLVWM
最简单的运行 MLVWM 的方式是让 Xorg 完成大部分工作。首先,你必须创建一个 **$HOME/.xinitrc** 文件。我从 Slackware 复制了这个,它也是从 Xorg 来的:
```
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
    xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
    xmodmap $usermodmap
fi
# Start the window manager:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
  exec ck-launch-session /usr/local/bin/mlvwm
else
  exec /usr/local/bin/mlvwm
fi
```
根据此文件,**startx** 命令的默认操作是启动 MLVWM。但是你的发行版可能对于图形服务器启动或被终止重新启动时会发生的情况有其他做法因此此文件可能对你没有什么帮助。在许多发行版上你可以添加 **.desktop** 文件到 **/usr/share/xsessions** 中,以将其列在 GDM 或 KDM 菜单中,因此创建名为 **mlvwm.desktop** 的文件并输入:
```
[Desktop Entry]
Name=Mlvwm
Comment=Macintosh-like virtual window manager
Exec=/usr/local/bin/mlvwm
TryExec=ck-launch-session /usr/local/bin/mlvwm
Type=Application
```
从桌面会话注销并重新登录到 MLVWM。默认情况下会话管理器KDM、GDM 或 LightDM具体取决于你的设置将继续登录到以前的桌面因此在登录之前必须覆盖它。
对于 GDM
![][7]
对于 SDDM
![][8]
#### 强制启动
如果 MLVWM 无法启动,请尝试安装 XDM这是一个轻量级会话管理器它不会查询 **/usr/share/xsessions** 的内容,而是执行经过身份验证用户的所有 **.xinitrc** 操作。
![MLVWM][9]
### 打造自己的复古苹果
MLVWM 桌面未经打磨、不完美、准确且充满乐趣。你看到的许多菜单项都是未实现的,但你可以使它们变得活跃且有意义。
这是一次让你时光倒流,改变历史,让老式苹果系列电脑成为开源堡垒的机会。成为一名修正主义者,设计你自己的复古苹果桌面,最重要的是,它有乐趣。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-mlvwm-desktop
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer)
[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[3]: http://www2u.biglobe.ne.jp/~y-miyata/mlvwm.html
[4]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-file.jpg (MLVWM running on Slackware 14.2)
[5]: http://cgit.freedesktop.org/xorg/util/imake
[6]: https://opensource.com/article/17/6/set-path-linux
[7]: https://opensource.com/sites/default/files/advent-gdm_2.jpg
[8]: https://opensource.com/sites/default/files/advent-kdm_1.jpg
[9]: https://opensource.com/sites/default/files/uploads/advent-mlvwm-chess.jpg (MLVWM)

View File

@ -0,0 +1,189 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Kubernetes namespaces for beginners)
[#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces)
[#]: author: (Jessica Cherry https://opensource.com/users/jrepka)
Kubernetes 命名空间入门
======
命名空间是什么?你为什么需要它?
![Ship captain sailing the Kubernetes seas][1]
kubernetes 命名空间是什么Shakespeare 以前写过,我们声称的命名空间,或者任何其他名字,仍是一个虚拟集群。命名空间,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个对其主机进行抽象的虚拟机。[kubernetes 文档][2] 中的解释:
> kubernetes 在一个物理集群上提供了多个虚拟集群。这些虚拟集群被称为命名空间。
你为什么需要命名空间?一句话概括:隔离。
隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 — 这可能导致所有人都无法登录。
### 初始命名空间
 一个集群的三个初始命名空间:**default**、**kube-system** 和 **kube-public**。虽然你可以用这三个命名空间作技术部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。
* **Default** 某些部署没有指明命名空间,这样部署可以快速创建一个网格,但如果做了很多错误信息的部署,就很能去清理。我不去修改它,因为它在为某一个目的服务时,会在不止一种情况下误导我。
* **Kube-system** 系统相关的所有对象组成的命名空间。任何此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。
* **Kube-public** 所有人可读,但是这个命名空间是为系统保留的。
### 用命名空间来实现隔离
我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,使用者可以安装不同版本的 Jenkins如果它们的环境变量是在不同的命名空间就不会冲突。
这种隔离对于清理也很有帮助。如果部署组的多个项目被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。)
如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有 DNS 函数,其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。
虽然官方文档不建议 [10 人以下团队][2] 使用多个命名空间,但出于架构需要,在我自己的集群上还是用了多个命名空间。集群越干净越好。
### 关于命名空间管理员应该知道的
首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个 node*。最后,所有的命名空间对于资源类型只能使用一个独一无二的名字。
### 命名空间命令操作
你需要安装 [Minikube][4]、 [Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章 [_安全浏览你的 DevOps 流水线_][7] 中有它们的安装教程,你也可以去每个工程的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快第一次就能成功运行。
获取你的第一组命名空间:
```
jess@Athena:~$ kubectl get namespace
NAME            STATUS   AGE
default         Active   5m23s
kube-public     Active   5m24s
kube-system     Active   5m24s
```
创建一个命名空间:
```
jess@Athena:~$ kubectl create namespace athena
namespace/athena created
```
现在开发者可以部署到你创建的命名空间;例如,这里是一个简短的 Helm 结构信息:
```
jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena
NAME: teset-deploy
LAST DEPLOYED: Sat Nov 23 13:47:43 2019
NAMESPACE: athena
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
Redis can be accessed via port 6379 on the following DNS names from within your cluster:
teset-deploy-redis-master.athena.svc.cluster.local for read/write operations
teset-deploy-redis-slave.athena.svc.cluster.local for read-only operations
```
获取你的密码:
```
export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis -o jsonpath="{.data.redis-password}" | base64 --decode)
```
连接你的 redis 服务:
1. 运行一个你可以作为客户端用的 Redis pod
```bash
kubectl run --namespace athena teset-deploy-redis-client --rm --tty -i --restart='Never' \
  --env REDIS_PASSWORD=$REDIS_PASSWORD \
--image docker.io/bitnami/redis:5.0.7-debian-9-r0 -- bash
```
2. 使用 Redis CLI 连接:
```bash
redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD
redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD
```
从集群外连接你的数据库:
```bash
kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379 &
redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD
```
现在这一套部署已经完成了,你有一个在命名空间 **test-deploy** 中部署的图表。
查看你的命名空间中有哪些 pod
```
jess@Athena:~$ kubectl get pods --namespace athena
NAME                            READY   STATUS  RESTARTS   AGE
teset-deploy-redis-master-0   1/1       Running   0             2m38s
teset-deploy-redis-slave-0      1/1     Running   0             2m38s
teset-deploy-redis-slave-1      1/1     Running   0             90s
```
现在,你已经正式把你的应用隔离到了一个命名空间,创建了一个只在内部通信的虚拟集群。
一键删除所有东西:
```bash
jess@Athena:~$ kubectl delete namespace athena
namespace "athena" deleted
```
因为这会删除应用的所有内部配置,所以这个删除操作可能会持续一段时间,持续时间取决于你的部署到底有多大。
再次检查一下所有东西是否被删除了:
```bash
jess@Athena:~$ kubectl get pods --all-namespaces
NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE
kube-system   coredns-5644d7b6d9-4vxv6          1/1     Running   0             32m
kube-system   coredns-5644d7b6d9-t5wn7          1/1     Running   0             32m
kube-system   etcd-minikube                     1/1     Running   0             31m
kube-system   kube-addon-manager-minikube       1/1     Running   0             32m
kube-system   kube-apiserver-minikube           1/1     Running   0             31m
kube-system   kube-controller-manager-minikube  1/1     Running   0             31m
kube-system   kube-proxy-5tdmh                  1/1     Running   0             32m
kube-system   kube-scheduler-minikube           1/1     Running   0             31m
kube-system   storage-provisioner               1/1     Running   0             27m
```
这是一个所有 pod 及它们存在于的已知命名空间的列表。你可以看到,之前创建的应用和命名空间现在已经不在了。
### 命名空间实践
现在我是为了安全使用命名空间,如限制用户的权限。你可以限制所有的东西 — 从哪些角色可以访问命名空间到命名空间可使用的集群资源CPU 等的配额等级。例如我通过资源配额和基于角色的访问控制role-based access controlRBAC配置来确保只有允许的服务账号可以访问命名空间。
对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做有公共 IP 地址的安全镜像来访问(我不得不假定,可能会做出妥协)。
如果你很难提前计算出到底要在你的云平台上部署多少 node就我而言在把我的私人服务器放到 [segfaulting][8] 之前可以部署多少个 node那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围而且很复杂但值得你去调研和使用来防止你的集群过分扩展。
### 总结
命名空间是一个很好的隔离项目和应用的方法。本文仅是一个关于命名空间的简短介绍,所以我建议你更深入地研究下命名空间,在你的实践中更多地去使用它们。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/kubernetes-namespaces
作者:[Jessica Cherry][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jrepka
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas)
[2]: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
[3]: https://www.weave.works/blog/gitops-operations-by-pull-request
[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/
[5]: https://helm.sh/
[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/
[7]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline
[8]: https://en.wikipedia.org/wiki/Segmentation_fault

View File

@ -0,0 +1,104 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Why Vim fans love the Herbstluftwm Linux window manager)
[#]: via: (https://opensource.com/article/19/12/herbstluftwm-linux-desktop)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
为什么 Vim 爱好者喜欢 Herbstluftwm Linux 窗口管理器
======
本文是 24 天 Linux 桌面特别系列的一部分。如果你是Vim爱好者请试试 Herbstluftwm这是一个受到 ”Vim 方式“启发的基于平铺的 Linux 窗口管理器。
![OpenStack source code \(Python\) in VIM][1]
每个人都喜欢 Vim除了 Dvorak 和 Emacs 用户。Vim 非常流行,以至于有整个 Web 浏览器都使用 Vim 键绑定来浏览网页,非常流行的 [Zsh][2] 终端仿真器中的 Vim 模式,甚至是文本编辑器。 还有一个名为 [herbstluftwm][3] 的窗口管理器,它部分模仿了 “Vim 方式”。Herbstluftwm 取消了窗口,在程序载入和使用时使用平铺或者象限代替。 你可以使用键盘(**Alt+h**、**Alt+j**、**Alt+k** 和 **Alt+l**)从一个平铺块移动到另一个平铺块。
![Herbstluftwm][4]
从发行版软件仓库安装 Herbstluftwm。安装后请退出当前桌面会话以便可以登录到新会话。默认情况下会话管理器KDM、GDM、LightDM 或 XDM具体取决于你的设置将继续登录到以前的桌面因此在登录之前必须覆盖它。
在 GDM 中:
![][5]
在 SDDM 中:
![][6]
### Herbstluftwm 桌面之旅
第一次登录 Herbstluftwm 时,你只会看到绿屏,边缘有深绿色边框。你所看到的是初始平铺,其中没有加载任何应用程序。要启动默认应用,请按 **Alt+回车**
文档中强调使用 **$HOME/.config/herbstluftwm/autostart** 作为登录时启动应用的配置文件。对于不必在每次登录时启动的应用,可以使用 xterm 作为启动守护进程。与往常一样,在命令将 shell 的控制权返回给你后加一个 **amp;** 符号。例如,要启动 Emacs
```
`% emacs &`
```
这将在新平铺中启动 Emacs 窗口,然后返回命令行。
![Emacs running in Herbstluftwm][7]
#### 切换平铺
要从一个平铺块移动到另一个平铺块,请使用经典的 **h**、**j**、**k** 或 **l****Alt** 的 Vim 导航组合键。例如,要从终端切换到其下方平铺中的应用(即屏幕底部),请按 **Alt+j**。要返回,请按 **Alt+k**。左移和右移分别为 **Alt+h****Alt+l**
#### 分割屏幕
你可以使用 **Alt+o** 垂直分割屏幕,使用 **Alt+u** 水平分割屏幕。
要删除空白平铺块,请移动到该平铺块,然后按 **Alt+r**
### 配置 herbstluftwm
除了 **Alt** 键绑定外,你还可通过 **herbstclient** 命令与 Herbstluftwm 进行通信。此命令可以在 shell 中交互,或者你可在配置文件中保留你的首选项。
你可以查看 Herbstluftwm 中的所有可用属性:
```
`$ herbstclient attr`
```
Herbstluftwm 的默认行为在默认配置文件中定义你可以将其复制到家目录并进行修改。启动后Herbstluftwm 执行配置文件中包含的命令。例如,你觉得使用以 **Alt** 为中心的键绑定很笨拙(它传统上是应用内保留快捷键),那你可以在配置文件中更改触发 Herbstluftwm 操作的键:
```
% mkdir ~/.config/herbstluftwm
% cp /usr/xdg/herbstluftwm/autostart \
~/.config/herbstluftwm
% sed -i 's/Mod=Mod1/Mod=Mod4/' ~/.config/herbstluftwm
% herbstclient reload
```
这将使 Herbstluftwm 的修饰键更改为 Super 键”Windows“或 ”Tux“ 键,具体取决于你的键盘)。
使用自动启动文件,你可以设置自定义键绑定,为特定类型的应用创建标签,以便以一致的方式平铺应用,并执行更多操作。
### 为何你要尝试 herbstluftwm
Herbstluftwm 是一个平铺窗口管理器的很好例子。它默认平铺窗口,并允许用户定义全局规则例外。它使用类似 Vim 的导航,但可以快速简单地覆盖它。你可能是你一直在寻找的平铺管理器,所以请尽快尝试一下。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/herbstluftwm-linux-desktop
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM)
[2]: https://opensource.com/article/19/9/getting-started-zsh
[3]: https://herbstluftwm.org
[4]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm.png (Herbstluftwm)
[5]: https://opensource.com/sites/default/files/advent-gdm_1.jpg
[6]: https://opensource.com/sites/default/files/advent-kdm_0.jpg
[7]: https://opensource.com/sites/default/files/uploads/advent-herbsluftwm-emacs.jpg (Emacs running in Herbstluftwm)

View File

@ -0,0 +1,70 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Customize your Linux desktop with KDE Plasma)
[#]: via: (https://opensource.com/article/19/12/linux-kde-plasma)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
使用 KDE Plasma 定制 Linux 桌面
======
本文是 24 天 Linux 桌面特别系列的一部分。如果你认为没有太多机会进行自定义桌面KDE Plasma 可能适合你。
![5 pengiuns floating on iceburg][1]
KDE 社区的 Plasma 桌面是开源桌面中的巅峰之作。KDE 很早就进入了 Linux 桌面市场,但是由于它的 基础 Qt 工具包当时没有完全开放的许可证,因此才有 [GNOME][2] 桌面。在此之后Qt 开源了,并且 KDE及其衍生产品例如 [Trinity桌面][3])开始蓬勃发展。
你可能会在发行版的软件仓库中找到 KDE 桌面,或者可以下载并安装将 KDE 作为默认桌面的发行版。在安装之前请注意KDE 提供了完整、集成且强大的桌面体验,因此会同时安装几个 KDE 应用。如果你已经在运行其他桌面,那么将发现有几个冗余的应用(两个 PDF 阅读器、多个媒体播放器、两个或多个文件管理器,等等)。如果你只想尝试而不是一直使用 KDE 桌面,那么可以在虚拟机,如[GNOME Boxes][4]中安装基于 KDE 的发行版,也可以尝试使用可引导的操作系统,例如 [Porteus][5]。
### KDE 桌面之旅
乍一看,[KDE Plasma][6] 桌面相对无聊,但让人感到舒适。它有行业标准的布局:左下角弹出应用菜单,中间是任务栏,右边是系统托盘。这正是你对标准家用或商用计算机的期望。
![KDE Plasma desktop][7]
但是,使 KDE 与众不同的是你几乎可以更改任何想要的东西。Qt 工具包可以以令人惊讶的方式分割和重新排列,这意味着你实质上可以使用 KDE 的部件作为基础来设计自己的桌面。桌面行为的可用设置也很多。KDE 可以充当标准桌面,平铺窗口管理器以及两者之间的任意形式。你可以通过窗口类、角色、类型、标题或它们的任意组合来创建自己的窗口规则,因此,如果希望特定应用的行为不同于其他行为,那么可以创建全局设置的例外。
此外,它还有丰富的小部件集合,使你可以自定义与桌面交互的方式。它有一个类似 GNOME 的全屏应用启动器,一个类似 Unity 的 dock 启动器和仅有图标的任务栏,一个传统的任务栏。你可以在屏幕的任何边缘上创建和放置面板。
![A slightly customized KDE desktop][8]
实际上,它有太多的自定义项了,因此 KDE 最常见的批评之一是它的_太过可定制化_所以请记住自定义项是可选的。你可以在默认配置下使用 Plasma 桌面并仅在你认为必要时逐步进行更改。Plasma 桌面配置选项最重要的不是它们的数目,而是它们容易发现和直观,它们都在系统设置应用或者右键单击中。
事实是,在 KDE 上几乎绝不会只有一种方法可以完成任何给定的任务并且它的用户将其视为其最大的优势。KDE 中没有隐含的工作流,只有默认的。并且可以更改所有默认设置,直到你需要桌面做的成为你的习惯。
### 一致性和集成
KDE 社区以一致性和集成为荣,出色的开发人员、社区管理以及 KDE 库使其成为可能。KDE 的开发人员不只是桌面开发人员。它们提供了[惊人的应用集合][9],每个应用都使用 KDE 库创建,这些库扩展并标准化了常见的 Qt 小部件。使用 KDE 几个月后,无论是打开 [DigiKam][10] 进行照片管理,还是打开 Kmail 来检查电子邮件,还是打开 KTorrent 来获取最新的 ISO 或者使用 Dolphin 管理文件,你的肌肉记忆会在你思考之前直接带你进入对应 UI。
![KDE on Porteus][11]
### 尝试 KDE
KDE 适合所有人。使用其默认设置可获得流畅、原始的桌面体验,或对其进行自定义以使其成为自己专属。它是一个稳定、有吸引力且强大的桌面环境,可能有你想要在 Linux 完成要做的事的一切。
KDE 最初代表 Kool Desktop Environment但现在被许多人称为 K Desktop。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/linux-kde-plasma
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg)
[2]: https://opensource.com/article/19/12/gnome-linux-desktop
[3]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde
[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization
[5]: https://opensource.com/article/19/6/linux-distros-to-try
[6]: https://kde.org/plasma-desktop
[7]: https://opensource.com/sites/default/files/uploads/advent-kde-presskit.jpg (KDE Plasma desktop)
[8]: https://opensource.com/sites/default/files/uploads/advent-kde-dock.jpg (A slightly customized KDE desktop)
[9]: https://kde.org/applications/
[10]: https://opensource.com/life/16/5/how-use-digikam-photo-management
[11]: https://opensource.com/sites/default/files/uploads/advent-kde.jpg (KDE on Porteus)

View File

@ -0,0 +1,154 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Pop!_OS vs Ubuntu: Which One is Better?)
[#]: via: (https://itsfoss.com/pop-os-vs-ubuntu/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Pop!_OS 与 Ubuntu哪个更棒
======
好吧,你可能会发现从[最佳 Linux 发行版][1]列表中选择一个发行版很容易,但是,将两个类似的 Linux 发行版进行比较通常会令人困惑,就像 Pop!_OS 与 Ubuntu 一样。
有趣的是Pop!\_OS 基于 [Ubuntu][2]。那么Pop!\_OS 和 Ubuntu 之间有什么区别呢?为什么要从中选择一个呢?
在本文中,我将比较 Pop!_OS 和 Ubuntu两者都是我的最爱
**注意:**你可能会发现一些武断的观点,而本文只是一份比较的参考。随着 Linux 发行版的不断开发和更新,随着时间的流逝,很多事情都会改变。
### 比较 Ubuntu 和 Pop!_OS
![Pop!_OS Vs Ubuntu][3]
发现相似之处可帮助你区分其他差异之处。因此,让我们从一些明显的相似之处开始。
就像我提到的Pop!\_OS 是基于 Ubuntu 之上的 Linux 发行版。因此,当你使用 Pop!_OS 时,你将获得使用 Ubuntu 的所有好处(从技术上说,其核心是一样的)。
它们都默认带有 [GNOME 桌面环境][4]因此它们具有相似的用户界面UI
在不讨论所有底层差异的情况下,我将在这里重点介绍一些重要的差异。
#### 用户体验及主题
![Pop!_OS][5]
许多用户认为 Pop!_OS 只是具有不同外观的 Ubuntu。
根据我的经验,我觉得这并非完全正确。
是的,它们俩都很喜欢 [GNOME 桌面环境][4] —— 但是Pop!_OS 让人感觉更加优美。
除了外观之外,[Ubuntu 还通过添加程序坞和其他一些小花巧来定制了 GNOME 的体验][6]。如果你喜欢定制的 GNOME 体验,可能会发现它更好。
但是,如果你更喜欢纯粹的 GNOME 体验,默认情况下 Pop!_OS 会为你提供。
在你亲自尝试之前我无法说服你。但是Pop!_OS 中的总体配色方案、图标和主题可以说是令人愉悦的高级用户体验。
这可能是一个主观的事情,但这是我所观察到的。你还可以查看 Ubuntu 19.10 的视频教程,亲自感受一下。
#### 易于安装第三方应用
![Pop Os PPA][7]
Ubuntu 非常重视 Snap 软件包。这增加了它提供的应用程序的数量。
但是 Snap 软件包存在一些重要的问题。它们占用了过多的磁盘空间,并且启动要花费大量的时间。
这就是为什么我更喜欢使用应用程序的 APT 版本的原因。
我为什么要说这个呢?
因为 Pop!_OS 具有其[自己的官方 PPA][8],并在默认情况下已启用。你会在此处找到一些有用的应用程序,例如 Android Studio、TensorFlow。无需下载 Android Studio 的 1GB 大的 Snap 程序包。只需使用 [apt-get install][9]就可以了。
#### 预装应用
![Ubuntu installation slideshow][10]
对于某些人来说,它可能不是最大的问题,但是拥有大量预安装的应用程序可能会影响体验和性能。即使不影响性能,某些用户也只喜欢较少的预装应用程序。
与 Ubuntu 相比Pop!_OS 捆绑了更少的默认应用程序(潜在地减少了胖软件)。
再一次提醒,这是主观的看法。如果你希望预安装更多应用程序,则可以考虑使用 Ubuntu 而不是 Pop!_OS。
#### Snap 软件包支持
![][11]
对于熟悉 Snap 程序包的用户来说Ubuntu 的软件中心是比 Pop!_OS 商店更好的解决方案,因为你可以在软件中心中列出快照程序包。
你无法在软件中心中过滤快照包,但是当你在软件中心中发现一个 Snap 包(查看应用程序来源的详细信息为“ Snap store ”/“Snapcraft”时安装它就更容易了。
如果你感到困惑Pop!\_OS 也确实支持快照包。但是,你不会在 Pop!_OS 商店中找到它们,这是唯一的区别。
如果不确定什么是 Snap 软件包及其功能,可以查看我们的文章[在 Linux 上安装 Snap 应用][12]。
#### 单独的 NVIDIA/AMD ISO 文件
![ISOs][13]
从技术上讲,它不是内部比较的一部分,而是某些用户关心的一个因素。
因此,值得强调的是 Pop!_OS 提供了单独的 ISO。一个用于带 NVIDIA 显卡的系统,另一个用于带/不带 AMD 显卡的系统。
使用 Ubuntu 19.10,你可以在 Ubuntu ISO 上获得 NVIDIA 驱动程序,但 AMD 显卡没有这个。
#### 可靠性与问题
毫无疑问,这两个[发行版都适合初学者][14]并且相当可靠。如果你想要更好的可靠性和更少的问题则可能希望一直用长期支持LTS版本。
当出现新版本的 Ubuntu 时Pop!_OS 将在其上开发,并有可能解决用户在 Ubuntu 原始发行版上遇到的问题,然后再进行新的升级。这给他们带来了一点优势,但这没什么实质性的不同,因为这些修复最终都可以运用于 Ubuntu。
#### 性能
性能将高度取决于你所安装的内容以及所安装的硬件配置。
除非你有一个超级旧的系统,否则这两个发行版似乎都表现良好。
我的机器是 i5-7400 处理器和 16GB 的 RAM带有 GTX 1050ti 显卡),我发现两种发行版上的体验都足够好。
当然,你可以手动进行一些优化调整以满足要求——无论它们中的哪个不满足你的硬件配置。
但是,如果你想使用 System76 笔记本电脑,那么 Pop!\_OS 将可以证明自己是 [Linux 领域的苹果][15],因为 Pop!_OS 是针对其硬件量身定制的,与 Ubuntu 有所不同。
#### 硬件兼容性
在比较其他 Linux 发行版时,这绝对是要考虑的事情。但是,在这种情况下,实际上并没有太大的区别。
你可能会考虑 Pop!_OS 一直在使用较新的硬件配置,因为他们主要是为他们的笔记本电脑量身定制具有各种配置的 OS。而且这只是一个观察而不是事实。
### 结语
我知道在不亲自尝试的情况下从两个流行的 Linux 发行版中选择一个并不容易。如果可能的话,我建议你在进行比较的同时尝试两者,以供参考。
你在这两者之间有何选择?我在比较中错过了什么吗?在下面的评论中让我知道。
--------------------------------------------------------------------------------
via: https://itsfoss.com/pop-os-vs-ubuntu/
作者:[Ankush Das][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://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/best-linux-distributions/
[2]: https://ubuntu.com/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/pop_os_vs_ubuntu.png?ssl=1
[4]: https://www.gnome.org/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-UI.jpg?ssl=1
[6]: https://itsfoss.com/gnome-tricks-ubuntu/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/pop-os-ppa.jpg?ssl=1
[8]: https://launchpad.net/~system76/+archive/ubuntu/pop/
[9]: https://itsfoss.com/apt-get-linux-guide/
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?resize=800%2C516&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/snapcraft.jpg?ssl=1
[12]: https://itsfoss.com/install-snap-linux/
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/iso-amd-nvidia-pop-os.jpg?ssl=1
[14]: https://itsfoss.com/best-linux-beginners/
[15]: https://www.phoronix.com/scan.php?page=news_item&px=System76-Integrated-Vision