mirror of
https://github.com/LCTT/TranslateProject.git
synced 2026-09-01 04:27:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (tomjlw)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10939-1.html)
|
||||
[#]: subject: (How to build a mobile particulate matter sensor with a Raspberry Pi)
|
||||
[#]: via: (https://opensource.com/article/19/3/mobile-particulate-matter-sensor)
|
||||
[#]: author: (Stephan Tetzel https://opensource.com/users/stephan)
|
||||
@@ -10,19 +10,19 @@
|
||||
如何用树莓派搭建一个颗粒物传感器
|
||||
======
|
||||
|
||||
用树莓派,一个廉价的传感器和一个便宜的屏幕监测空气质量
|
||||
> 用树莓派、一个廉价的传感器和一个便宜的屏幕监测空气质量。
|
||||
|
||||
![小组交流,讨论][1]
|
||||

|
||||
|
||||
大约一年前,我写了一篇关于如何使用树莓派和廉价传感器测量[空气质量][2]的文章。我们这几年已在学校里和私下使用了这个项目。然而它有一个缺点:由于它基于无线/有线网,因此它不是便携的。如果你的树莓派,你的智能手机和电脑不在同一个网络的话,你甚至都不能访问传感器测量的数据。
|
||||
大约一年前,我写了一篇关于如何使用树莓派和廉价传感器测量[空气质量][2]的文章。我们这几年已在学校里和私下使用了这个项目。然而它有一个缺点:由于它基于无线/有线网,因此它不是便携的。如果你的树莓派、你的智能手机和电脑不在同一个网络的话,你甚至都不能访问传感器测量的数据。
|
||||
|
||||
为了弥补这一缺陷,我们给树莓派添加了一块小屏幕,这样我们就可以直接从该设备上读取数据。以下是我们如何为我们的移动细颗粒物传感器搭建并配置好屏幕。
|
||||
|
||||
### 为树莓派搭建好屏幕
|
||||
|
||||
在[亚马逊][3],阿里巴巴以及其它来源有许多可以获取的树莓派屏幕,从 ePaper 屏幕到可触控 LCD。我们选择了一个便宜的带触控功能且分辨率为320*480像素的[3.5英寸 LCD][3],可以直接插进树莓派的 GPIO 引脚。一个3.5英寸屏幕和树莓派几乎一样大,这一点不错。
|
||||
在[亚马逊][3]、阿里巴巴以及其它来源有许多可以买到的树莓派屏幕,从 ePaper 屏幕到可触控 LCD。我们选择了一个便宜的带触控功能且分辨率为 320*480 像素的[3.5英寸 LCD][3],可以直接插进树莓派的 GPIO 引脚。3.5 英寸屏幕和树莓派几乎一样大,这一点不错。
|
||||
|
||||
当你第一次启动屏幕打开树莓派的时候,因为缺少驱动屏幕会保持白屏。你得首先为屏幕安装[合适的驱动][5]。通过 SSH 登入并执行以下命令:
|
||||
当你第一次启动屏幕打开树莓派的时候,会因为缺少驱动屏幕会保持白屏。你得首先为屏幕安装[合适的驱动][5]。通过 SSH 登入并执行以下命令:
|
||||
|
||||
```
|
||||
$ rm -rf LCD-show
|
||||
@@ -55,22 +55,21 @@ $ sudo apt install raspberrypi-ui-mods
|
||||
$ sudo apt install chromium-browser
|
||||
```
|
||||
|
||||
需要自动登录以使测量数据在启动后直接显示;否则你将只会看到登录界面。然而自动登录并没有为树莓派用户默认设置好。你可以用 **raspi-config** 工具设置自动登录:
|
||||
需要自动登录以使测量数据在启动后直接显示;否则你将只会看到登录界面。然而树莓派用户并没有默认设置好自动登录。你可以用 `raspi-config` 工具设置自动登录:
|
||||
|
||||
```
|
||||
$ sudo raspi-config
|
||||
```
|
||||
|
||||
在菜单中,选择:**3 Boot Options → B1 Desktop / CLI → B4 Desktop Autologin**。
|
||||
在菜单中,选择:“3 Boot Options → B1 Desktop / CLI → B4 Desktop Autologin”。
|
||||
|
||||
在启动后用 Chromium 打开我们的网站这块少了一步。创建文件夹
|
||||
**/home/pi/.config/lxsession/LXDE-pi/**:
|
||||
在启动后用 Chromium 打开我们的网站这块少了一步。创建文件夹 `/home/pi/.config/lxsession/LXDE-pi/`:
|
||||
|
||||
```
|
||||
$ mkdir -p /home/pi/config/lxsession/LXDE-pi/
|
||||
```
|
||||
|
||||
然后在该文件夹里创建 **autostart** 文件:
|
||||
然后在该文件夹里创建 `autostart` 文件:
|
||||
|
||||
```
|
||||
$ nano /home/pi/.config/lxsession/LXDE-pi/autostart
|
||||
@@ -88,7 +87,7 @@ $ nano /home/pi/.config/lxsession/LXDE-pi/autostart
|
||||
@chromium-browser --incognito --kiosk <http://localhost>
|
||||
```
|
||||
|
||||
如果你想要隐藏鼠标指针,你得安装 **unclutter** 包并移除 **autostart** 文件开头的注释。
|
||||
如果你想要隐藏鼠标指针,你得安装 `unclutter` 包并移除 `autostart` 文件开头的注释。
|
||||
|
||||
```
|
||||
$ sudo apt install unclutter
|
||||
@@ -98,11 +97,11 @@ $ sudo apt install unclutter
|
||||
|
||||
我对去年的代码做了些小修改。因此如果你之前搭建过空气质量项目,确保用[原文章][2]中的指导为 AQI 网站重新下载脚本和文件。
|
||||
|
||||
通过添加触摸屏,你现在拥有了一个移动颗粒物传感器!我们在学校用它来检查教室里的空气质量或者进行比较测量。使用这种配置,你无需再依赖网络连接或 WLAN。你可以在任何地方使用小型测量站——你甚至可以使用移动电源以摆脱电网。
|
||||
通过添加触摸屏,你现在拥有了一个便携的颗粒物传感器!我们在学校用它来检查教室里的空气质量或者进行比较测量。使用这种配置,你无需再依赖网络连接或 WLAN。你可以在任何地方使用这个小型测量站——你甚至可以使用移动电源以摆脱电网。
|
||||
|
||||
* * *
|
||||
|
||||
_这篇文章原来在[开源学校解决方案(Open Scool Solutions)][8]上发表,获得许可重新发布。_
|
||||
这篇文章原来在<ruby>[开源学校解决方案][8]<rt>Open Scool Solutions</rt></ruby>上发表,获得许可重新发布。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -111,18 +110,18 @@ via: https://opensource.com/article/19/3/mobile-particulate-matter-sensor
|
||||
作者:[Stephan Tetzel][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[tomjlw](https://github.com/tomjlw)
|
||||
校对:[校对者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/stephan
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat)
|
||||
[2]: https://opensource.com/article/18/3/how-measure-particulate-matter-raspberry-pi
|
||||
[2]: https://linux.cn/article-9620-1.html
|
||||
[3]: https://www.amazon.com/gp/search/ref=as_li_qf_sp_sr_tl?ie=UTF8&tag=openschoolsol-20&keywords=lcd%20raspberry&index=aps&camp=1789&creative=9325&linkCode=ur2&linkId=51d6d7676e10d6c7db203c4a8b3b529a
|
||||
[4]: https://amzn.to/2CcvgpC
|
||||
[5]: https://github.com/goodtft/LCD-show
|
||||
[6]: https://opensource.com/article/17/1/try-raspberry-pis-pixel-os-your-pc
|
||||
[6]: https://linux.cn/article-8459-1.html
|
||||
[7]: https://opensource.com/sites/default/files/uploads/mobile-aqi-sensor.jpg (Mobile particulate matter sensor)
|
||||
[8]: https://openschoolsolutions.org/mobile-particulate-matter-sensor/
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "zhang5788"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "Getting Started With Docker"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-10940-1.html"
|
||||
[#]: subject: "Getting Started With Docker"
|
||||
[#]: via: "https://www.ostechnix.com/getting-started-with-docker/"
|
||||
[#]: author: "sk https://www.ostechnix.com/author/sk/"
|
||||
[#]: author: "sk https://www.ostechnix.com/author/sk/"
|
||||
|
||||
Docker 入门指南
|
||||
======
|
||||
|
||||
![Getting Started With Docker][1]
|
||||
|
||||
在我们的上一个教程中,我们已经了解[**如何在ubuntu上安装Docker**][1],和如何在[**CentOS上安装Docker**][2]。今天,我们将会了解Docker的一些基础用法。该教程包含了如何创建一个新的docker容器,如何运行该容器,如何从现有的docker容器中创建自己的Docker镜像等Docker 的一些基础知识,操作。所有步骤均在Ubuntu 18.04 LTS server 版本下测试通过。
|
||||
在我们的上一个教程中,我们已经了解[如何在 Ubuntu 上安装 Docker][1],和如何在 [CentOS 上安装 Docker][2]。今天,我们将会了解 Docker 的一些基础用法。该教程包含了如何创建一个新的 Docker 容器,如何运行该容器,如何从现有的 Docker 容器中创建自己的 Docker 镜像等 Docker 的一些基础知识、操作。所有步骤均在 Ubuntu 18.04 LTS server 版本下测试通过。
|
||||
|
||||
### 入门指南
|
||||
|
||||
在开始指南之前,不要混淆Docker镜像和Docker容器这两个概念。在之前的教程中,我就解释过,Docker镜像是决定Docker容器行为的一个文件,Docker容器则是Docker镜像的运行态或停止态。(译者注:在`macOS`下使用docker终端时,不需要加`sudo`)
|
||||
在开始指南之前,不要混淆 Docker 镜像和 Docker 容器这两个概念。在之前的教程中,我就解释过,Docker 镜像是决定 Docker 容器行为的一个文件,Docker 容器则是 Docker 镜像的运行态或停止态。(LCTT 译注:在 macOS 下使用 Docker 终端时,不需要加 `sudo`)
|
||||
|
||||
##### 1. 搜索Docker镜像
|
||||
#### 1、搜索 Docker 镜像
|
||||
|
||||
我们可以从Docker的仓库中获取镜像,例如[**Docker hub**][3], 或者自己创建镜像。这里解释一下,`Docker hub`是一个云服务器,用来提供给Docker的用户们,创建,测试,和保存他们的镜像。
|
||||
我们可以从 Docker 仓库中获取镜像,例如 [Docker hub][3],或者自己创建镜像。这里解释一下,Docker hub 是一个云服务器,用来提供给 Docker 的用户们创建、测试,和保存他们的镜像。
|
||||
|
||||
`Docker hub`拥有成千上万个Docker 的镜像文件。你可以在这里搜索任何你想要的镜像,通过`docker search`命令。
|
||||
Docker hub 拥有成千上万个 Docker 镜像文件。你可以通过 `docker search`命令在这里搜索任何你想要的镜像。
|
||||
|
||||
例如,搜索一个基于ubuntu的镜像文件,只需要运行:
|
||||
例如,搜索一个基于 Ubuntu 的镜像文件,只需要运行:
|
||||
|
||||
```shell
|
||||
$ sudo docker search ubuntu
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
示例输出:
|
||||
|
||||
![][5]
|
||||
|
||||
搜索基于CentOS的镜像,运行:
|
||||
搜索基于 CentOS 的镜像,运行:
|
||||
|
||||
```shell
|
||||
$ sudo docker search ubuntu
|
||||
$ sudo docker search centos
|
||||
```
|
||||
|
||||
搜索AWS的镜像,运行:
|
||||
搜索 AWS 的镜像,运行:
|
||||
|
||||
```shell
|
||||
$ sudo docker search aws
|
||||
```
|
||||
|
||||
搜索`wordpress`的镜像:
|
||||
搜索 WordPress 的镜像:
|
||||
|
||||
```shell
|
||||
$ sudo docker search wordpress
|
||||
```
|
||||
|
||||
`Docker hub`拥有几乎所有种类的镜像,包含操作系统,程序和其他任意的类型,这些你都能在`docker hub`上找到已经构建完的镜像。如果你在搜索时,无法找到你想要的镜像文件,你也可以自己构建一个,将其发布出去,或者仅供你自己使用。
|
||||
Docker hub 拥有几乎所有种类的镜像,包含操作系统、程序和其他任意的类型,这些你都能在 Docker hub 上找到已经构建完的镜像。如果你在搜索时,无法找到你想要的镜像文件,你也可以自己构建一个,将其发布出去,或者仅供你自己使用。
|
||||
|
||||
##### 2. 下载Docker 镜像
|
||||
#### 2、下载 Docker 镜像
|
||||
|
||||
下载`ubuntu`的镜像,你需要在终端运行以下命令:
|
||||
下载 Ubuntu 的镜像,你需要在终端运行以下命令:
|
||||
|
||||
```shell
|
||||
$ sudo docker pull ubuntu
|
||||
```
|
||||
|
||||
这条命令将会从**Docker hub**下载最近一个版本的ubuntu镜像文件。
|
||||
这条命令将会从 Docker hub 下载最近一个版本的 Ubuntu 镜像文件。
|
||||
|
||||
**Sample output:**
|
||||
示例输出:
|
||||
|
||||
> ```shell
|
||||
> Using default tag: latest
|
||||
> latest: Pulling from library/ubuntu
|
||||
> 6abc03819f3e: Pull complete
|
||||
> 05731e63f211: Pull complete
|
||||
> 0bd67c50d6be: Pull complete
|
||||
> Digest: sha256:f08638ec7ddc90065187e7eabdfac3c96e5ff0f6b2f1762cf31a4f49b53000a5
|
||||
> Status: Downloaded newer image for ubuntu:latest
|
||||
> ```
|
||||
```
|
||||
Using default tag: latest
|
||||
latest: Pulling from library/ubuntu
|
||||
6abc03819f3e: Pull complete
|
||||
05731e63f211: Pull complete
|
||||
0bd67c50d6be: Pull complete
|
||||
Digest: sha256:f08638ec7ddc90065187e7eabdfac3c96e5ff0f6b2f1762cf31a4f49b53000a5
|
||||
Status: Downloaded newer image for ubuntu:latest
|
||||
```
|
||||
|
||||
![下载docker 镜像][6]
|
||||
![下载 Docker 镜像][6]
|
||||
|
||||
你也可以下载指定版本的ubuntu镜像。运行以下命令:
|
||||
你也可以下载指定版本的 Ubuntu 镜像。运行以下命令:
|
||||
|
||||
```shell
|
||||
$ docker pull ubuntu:18.04
|
||||
```
|
||||
|
||||
Dokcer允许在任意的宿主机操作系统下,下载任意的镜像文件,并运行。
|
||||
Docker 允许在任意的宿主机操作系统下,下载任意的镜像文件,并运行。
|
||||
|
||||
例如,下载CentOS镜像:
|
||||
例如,下载 CentOS 镜像:
|
||||
|
||||
```shell
|
||||
$ sudo docker pull centos
|
||||
```
|
||||
|
||||
所有下载的镜像文件,都被保存在`/var/lib/docker`文件夹下。(译者注:不同操作系统存放的文件夹并不是一致的,具体存放位置请在官方查询)
|
||||
所有下载的镜像文件,都被保存在 `/var/lib/docker` 文件夹下。(LCTT 译注:不同操作系统存放的文件夹并不是一致的,具体存放位置请在官方查询)
|
||||
|
||||
查看已经下载的镜像列表,可以使用以下命令:
|
||||
|
||||
@@ -100,7 +100,7 @@ $ sudo docker pull centos
|
||||
$ sudo docker images
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
@@ -109,17 +109,17 @@ centos latest 9f38484d220f 2 months ago
|
||||
hello-world latest fce289e99eb9 4 months ago 1.84kB
|
||||
```
|
||||
|
||||
正如你看到的那样,我已经下载了三个镜像文件:**ubuntu**, **CentOS**和**Hello-world**.
|
||||
正如你看到的那样,我已经下载了三个镜像文件:`ubuntu`、`centos` 和 `hello-world`。
|
||||
|
||||
现在,让我们继续,来看一下如何运行我们刚刚下载的镜像。
|
||||
|
||||
##### 3. 运行Docker镜像
|
||||
#### 3、运行 Docker 镜像
|
||||
|
||||
运行一个容器有两种方法。我们可以使用`TAG`或者是`镜像ID`。`TAG`指的是特定的镜像快照。`镜像ID`是指镜像的唯一标识。
|
||||
运行一个容器有两种方法。我们可以使用标签或者是镜像 ID。标签指的是特定的镜像快照。镜像 ID 是指镜像的唯一标识。
|
||||
|
||||
正如上面结果中显示,`latest`是所有镜像的一个标签。**7698f282e524**是Ubuntu docker 镜像的`镜像ID`,**9f38484d220f**是CentOS镜像的`镜像ID`,**fce289e99eb9**是hello_world镜像的`镜像ID`。
|
||||
正如上面结果中显示,`latest` 是所有镜像的一个标签。`7698f282e524` 是 Ubuntu Docker 镜像的镜像 ID,`9f38484d220f`是 CentOS 镜像的镜像 ID,`fce289e99eb9` 是 hello_world 镜像的 镜像 ID。
|
||||
|
||||
下载完Docker镜像之后,你可以通过下面的命令来使用`TAG`的方式启动:
|
||||
下载完 Docker 镜像之后,你可以通过下面的命令来使用其标签来启动:
|
||||
|
||||
```shell
|
||||
$ sudo docker run -t -i ubuntu:latest /bin/bash
|
||||
@@ -127,12 +127,12 @@ $ sudo docker run -t -i ubuntu:latest /bin/bash
|
||||
|
||||
在这条语句中:
|
||||
|
||||
* **-t**: 在该容器中启动一个新的终端
|
||||
* **-i**: 通过容器中的标准输入流建立交互式连接
|
||||
* **ubuntu:latest**:带有标签`latest`的ubuntu容器
|
||||
* **/bin/bash** : 在新的容器中启动`BASH Shell`
|
||||
* `-t`:在该容器中启动一个新的终端
|
||||
* `-i`:通过容器中的标准输入流建立交互式连接
|
||||
* `ubuntu:latest`:带有标签 `latest` 的 Ubuntu 容器
|
||||
* `/bin/bash`:在新的容器中启动 BASH Shell
|
||||
|
||||
或者,你可以通过`镜像ID`来启动新的容器:
|
||||
或者,你可以通过镜像 ID 来启动新的容器:
|
||||
|
||||
```shell
|
||||
$ sudo docker run -t -i 7698f282e524 /bin/bash
|
||||
@@ -140,15 +140,15 @@ $ sudo docker run -t -i 7698f282e524 /bin/bash
|
||||
|
||||
在这条语句里:
|
||||
|
||||
* **7698f282e524** —`镜像ID`
|
||||
* `7698f282e524` — 镜像 ID
|
||||
|
||||
在启动容器之后,将会自动进入容器的`shell`中(注意看命令行的提示符)。
|
||||
在启动容器之后,将会自动进入容器的 shell 中(注意看命令行的提示符)。
|
||||
|
||||
![][7]
|
||||
|
||||
Docker 容器的`Shell`
|
||||
*Docker 容器的 Shell*
|
||||
|
||||
如果想要退回到宿主机的终端(在这个例子中,对我来说,就是退回到18.04 LTS),并且不中断该容器的执行,你可以按下`CTRL+P `,再按下`CTRL+Q`。现在,你就安全的返回到了你的宿主机系统中。需要注意的是,docker 容器仍然在后台运行,我们并没有中断它。
|
||||
如果想要退回到宿主机的终端(在这个例子中,对我来说,就是退回到 18.04 LTS),并且不中断该容器的执行,你可以按下 `CTRL+P`,再按下 `CTRL+Q`。现在,你就安全的返回到了你的宿主机系统中。需要注意的是,Docker 容器仍然在后台运行,我们并没有中断它。
|
||||
|
||||
可以通过下面的命令来查看正在运行的容器:
|
||||
|
||||
@@ -156,7 +156,7 @@ Docker 容器的`Shell`
|
||||
$ sudo docker ps
|
||||
```
|
||||
|
||||
**Sample output:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
@@ -165,14 +165,14 @@ CONTAINER ID IMAGE COMMAND CREATED
|
||||
|
||||
![][8]
|
||||
|
||||
列出正在运行的容器
|
||||
*列出正在运行的容器*
|
||||
|
||||
可以看到:
|
||||
可以看到:
|
||||
|
||||
* **32fc32ad0d54** – `容器 ID`
|
||||
* **ubuntu:latest** – Docker 镜像
|
||||
* `32fc32ad0d54` – 容器 ID
|
||||
* `ubuntu:latest` – Docker 镜像
|
||||
|
||||
需要注意的是,**`容器ID`和Docker `镜像ID`是不同的**
|
||||
需要注意的是,容器 ID 和 Docker 的镜像 ID是不同的。
|
||||
|
||||
可以通过以下命令查看所有正在运行和停止运行的容器:
|
||||
|
||||
@@ -192,13 +192,13 @@ $ sudo docker stop <container-id>
|
||||
$ sudo docker stop 32fc32ad0d54
|
||||
```
|
||||
|
||||
如果想要进入正在运行的容器中,你只需要运行
|
||||
如果想要进入正在运行的容器中,你只需要运行:
|
||||
|
||||
```shell
|
||||
$ sudo docker attach 32fc32ad0d54
|
||||
```
|
||||
|
||||
正如你看到的,**32fc32ad0d54**是一个容器的ID。当你在容器中想要退出时,只需要在容器内的终端中输入命令:
|
||||
正如你看到的,`32fc32ad0d54` 是一个容器的 ID。当你在容器中想要退出时,只需要在容器内的终端中输入命令:
|
||||
|
||||
```shell
|
||||
# exit
|
||||
@@ -210,46 +210,44 @@ $ sudo docker attach 32fc32ad0d54
|
||||
$ sudo docker ps
|
||||
```
|
||||
|
||||
##### 4. 构建自己的Docker镜像
|
||||
#### 4、构建自己的 Docker 镜像
|
||||
|
||||
Docker不仅仅可以下载运行在线的容器,你也可以创建你的自己的容器。
|
||||
Docker 不仅仅可以下载运行在线的容器,你也可以创建你的自己的容器。
|
||||
|
||||
想要创建自己的Docker镜像,你需要先运行一个你已经下载完的容器:
|
||||
想要创建自己的 Docker 镜像,你需要先运行一个你已经下载完的容器:
|
||||
|
||||
```shell
|
||||
$ sudo docker run -t -i ubuntu:latest /bin/bash
|
||||
```
|
||||
|
||||
现在,你运行了一个容器,并且进入了该容器。
|
||||
现在,你运行了一个容器,并且进入了该容器。然后,在该容器安装任意一个软件或做任何你想做的事情。
|
||||
|
||||
然后,在该容器安装任意一个软件或做任何你想做的事情。
|
||||
例如,我们在容器中安装一个 Apache web 服务器。
|
||||
|
||||
例如,我们在容器中安装一个**Apache web 服务器**。
|
||||
|
||||
当你完成所有的操作,安装完所有的软件之后,你可以执行以下的命令来构建你自己的Docker镜像:
|
||||
当你完成所有的操作,安装完所有的软件之后,你可以执行以下的命令来构建你自己的 Docker 镜像:
|
||||
|
||||
```shell
|
||||
# apt update
|
||||
# apt install apache2
|
||||
```
|
||||
|
||||
同样的,安装和测试所有的你想要安装的软件在容器中。
|
||||
同样的,在容器中安装和测试你想要安装的所有软件。
|
||||
|
||||
当你安装完毕之后,返回的宿主机的终端。记住,不要关闭容器。想要返回到宿主机的host而不中断容器。请按下CTRL+P ,再按下CTRL+Q。
|
||||
当你安装完毕之后,返回的宿主机的终端。记住,不要关闭容器。想要返回到宿主机而不中断容器。请按下`CTRL+P`,再按下 `CTRL+Q`。
|
||||
|
||||
从你的宿主机的终端中,运行以下命令如寻找容器的ID:
|
||||
从你的宿主机的终端中,运行以下命令如寻找容器的 ID:
|
||||
|
||||
```shell
|
||||
$ sudo docker ps
|
||||
```
|
||||
|
||||
最后,从一个正在运行的容器中创建Docker镜像:
|
||||
最后,从一个正在运行的容器中创建 Docker 镜像:
|
||||
|
||||
```shell
|
||||
$ sudo docker commit 3d24b3de0bfc ostechnix/ubuntu_apache
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
sha256:ce5aa74a48f1e01ea312165887d30691a59caa0d99a2a4aa5116ae124f02f962
|
||||
@@ -257,17 +255,17 @@ sha256:ce5aa74a48f1e01ea312165887d30691a59caa0d99a2a4aa5116ae124f02f962
|
||||
|
||||
在这里:
|
||||
|
||||
* **3d24b3de0bfc** — 指ubuntu容器的ID。
|
||||
* **ostechnix** — 我们创建的的名称
|
||||
* **ubuntu_apache** — 我们创建的镜像
|
||||
* `3d24b3de0bfc` — 指 Ubuntu 容器的 ID。
|
||||
* `ostechnix` — 我们创建的容器的用户名称
|
||||
* `ubuntu_apache` — 我们创建的镜像
|
||||
|
||||
让我们检查一下我们新创建的docker镜像
|
||||
让我们检查一下我们新创建的 Docker 镜像:
|
||||
|
||||
```shell
|
||||
$ sudo docker images
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
@@ -279,7 +277,7 @@ hello-world latest fce289e99eb9 4 months ago
|
||||
|
||||
![][9]
|
||||
|
||||
列出所有的docker镜像
|
||||
*列出所有的 Docker 镜像*
|
||||
|
||||
正如你看到的,这个新的镜像就是我们刚刚在本地系统上从运行的容器上创建的。
|
||||
|
||||
@@ -289,9 +287,9 @@ hello-world latest fce289e99eb9 4 months ago
|
||||
$ sudo docker run -t -i ostechnix/ubuntu_apache /bin/bash
|
||||
```
|
||||
|
||||
##### 5. 移除容器
|
||||
#### 5、删除容器
|
||||
|
||||
如果你在docker上的工作已经全部完成,你就可以删除哪些你不需要的容器。
|
||||
如果你在 Docker 上的工作已经全部完成,你就可以删除那些你不需要的容器。
|
||||
|
||||
想要删除一个容器,首先,你需要停止该容器。
|
||||
|
||||
@@ -301,14 +299,14 @@ $ sudo docker run -t -i ostechnix/ubuntu_apache /bin/bash
|
||||
$ sudo docker ps
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
3d24b3de0bfc ubuntu:latest "/bin/bash" 28 minutes ago Up 28 minutes goofy_easley
|
||||
```
|
||||
|
||||
使用`容器ID`来停止该容器:
|
||||
使用容器 ID 来停止该容器:
|
||||
|
||||
```shell
|
||||
$ sudo docker stop 3d24b3de0bfc
|
||||
@@ -328,7 +326,7 @@ $ sudo docker rm 3d24b3de0bfc
|
||||
$ sudo docker container prune
|
||||
```
|
||||
|
||||
按下"**Y**",来确认你的操作
|
||||
按下 `Y`,来确认你的操作:
|
||||
|
||||
```sehll
|
||||
WARNING! This will remove all stopped containers.
|
||||
@@ -340,11 +338,11 @@ Deleted Containers:
|
||||
Total reclaimed space: 5B
|
||||
```
|
||||
|
||||
这个命令仅支持最新的docker。(译者注:仅支持1.25及以上版本的Docker)
|
||||
这个命令仅支持最新的 Docker。(LCTT 译注:仅支持 1.25 及以上版本的 Docker)
|
||||
|
||||
##### 6. 删除Docker镜像
|
||||
#### 6、删除 Docker 镜像
|
||||
|
||||
当你移除完不要的Docker容器后,你也可以删除你不需要的Docker镜像。
|
||||
当你删除了不要的 Docker 容器后,你也可以删除你不需要的 Docker 镜像。
|
||||
|
||||
列出已经下载的镜像:
|
||||
|
||||
@@ -352,7 +350,7 @@ Total reclaimed space: 5B
|
||||
$ sudo docker images
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
@@ -364,13 +362,13 @@ hello-world latest fce289e99eb9 4 months ago
|
||||
|
||||
由上面的命令可以知道,在本地的系统中存在三个镜像。
|
||||
|
||||
使用`镜像ID`来删除镜像。
|
||||
使用镜像 ID 来删除镜像。
|
||||
|
||||
```shell
|
||||
$ sudo docekr rmi ce5aa74a48f1
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
```shell
|
||||
Untagged: ostechnix/ubuntu_apache:latest
|
||||
@@ -378,17 +376,17 @@ Deleted: sha256:ce5aa74a48f1e01ea312165887d30691a59caa0d99a2a4aa5116ae124f02f962
|
||||
Deleted: sha256:d21c926f11a64b811dc75391bbe0191b50b8fe142419f7616b3cee70229f14cd
|
||||
```
|
||||
|
||||
**解决问题**
|
||||
#### 解决问题
|
||||
|
||||
Docker禁止我们删除一个还在被容器使用的镜像。
|
||||
Docker 禁止我们删除一个还在被容器使用的镜像。
|
||||
|
||||
例如,当我试图删除Docker镜像**b72889fa879c**时,我只能获得一个错误提示:
|
||||
例如,当我试图删除 Docker 镜像 `b72889fa879c` 时,我只能获得一个错误提示:
|
||||
|
||||
```shell
|
||||
Error response from daemon: conflict: unable to delete b72889fa879c (must be forced) - image is being used by stopped container dde4dd285377
|
||||
```
|
||||
|
||||
这是因为这个Docker镜像正在被一个容器使用。
|
||||
这是因为这个 Docker 镜像正在被一个容器使用。
|
||||
|
||||
所以,我们来检查一个正在运行的容器:
|
||||
|
||||
@@ -396,19 +394,19 @@ Error response from daemon: conflict: unable to delete b72889fa879c (must be for
|
||||
$ sudo docker ps
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
![][10]
|
||||
|
||||
注意,现在并没有正在运行的容器!!!
|
||||
|
||||
查看一下所有的容器(包含所有的正在运行和已经停止的容器):
|
||||
查看一下所有的容器(包含所有的正在运行和已经停止的容器):
|
||||
|
||||
```shell
|
||||
$ sudo docker pa -a
|
||||
```
|
||||
|
||||
**输出为:**
|
||||
示例输出:
|
||||
|
||||
![][11]
|
||||
|
||||
@@ -420,9 +418,9 @@ $ sudo docker pa -a
|
||||
$ sudo docker rm 12e892156219
|
||||
```
|
||||
|
||||
我们仍然使用容器ID来删除这些容器。
|
||||
我们仍然使用容器 ID 来删除这些容器。
|
||||
|
||||
当我们删除了所有使用该镜像的容器之后,我们就可以删除Docker的镜像了。
|
||||
当我们删除了所有使用该镜像的容器之后,我们就可以删除 Docker 的镜像了。
|
||||
|
||||
例如:
|
||||
|
||||
@@ -438,19 +436,7 @@ $ sudo docker images
|
||||
|
||||
想要知道更多的细节,请参阅本指南末尾给出的官方资源的链接或者在评论区进行留言。
|
||||
|
||||
或者,下载以下的关于Docker的电子书来了解更多。
|
||||
|
||||
* **Download** – [**Free eBook: “Docker Containerization Cookbook”**][12]
|
||||
|
||||
* **Download** – [**Free Guide: “Understanding Docker”**][13]
|
||||
|
||||
* **Download** – [**Free Guide: “What is Docker and Why is it So Popular?”**][14]
|
||||
|
||||
* **Download** – [**Free Guide: “Introduction to Docker”**][15]
|
||||
|
||||
* **Download** – [**Free Guide: “Docker in Production”**][16]
|
||||
|
||||
这就是全部的教程了,希望你可以了解Docker的一些基础用法。
|
||||
这就是全部的教程了,希望你可以了解 Docker 的一些基础用法。
|
||||
|
||||
更多的教程马上就会到来,敬请关注。
|
||||
|
||||
@@ -461,7 +447,7 @@ via: https://www.ostechnix.com/getting-started-with-docker/
|
||||
作者:[sk][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[zhang5788](https://github.com/zhang5788)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@@ -482,4 +468,4 @@ via: https://www.ostechnix.com/getting-started-with-docker/
|
||||
[13]: https://ostechnix.tradepub.com/free/w_pacb32/prgm.cgi?a=1
|
||||
[14]: https://ostechnix.tradepub.com/free/w_pacb31/prgm.cgi?a=1
|
||||
[15]: https://ostechnix.tradepub.com/free/w_pacb29/prgm.cgi?a=1
|
||||
[16]: https://ostechnix.tradepub.com/free/w_pacb28/prgm.cgi?a=1
|
||||
[16]: https://ostechnix.tradepub.com/free/w_pacb28/prgm.cgi?a=1
|
||||
@@ -1,8 +1,8 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( jdh8383 )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: translator: (jdh8383)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10938-1.html)
|
||||
[#]: subject: (How To Check Available Security Updates On Red Hat (RHEL) And CentOS System?)
|
||||
[#]: via: (https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
@@ -10,35 +10,29 @@
|
||||
如何在 CentOS 或 RHEL 系统上检查可用的安全更新?
|
||||
======
|
||||
|
||||
当你更新系统时,根据你所在公司的安全策略,有时候可能只需要打上与安全相关的补丁。
|
||||

|
||||
|
||||
大多数情况下,这应该是出于程序兼容性方面的考量。
|
||||
当你更新系统时,根据你所在公司的安全策略,有时候可能只需要打上与安全相关的补丁。大多数情况下,这应该是出于程序兼容性方面的考量。那该怎样实践呢?有没有办法让 `yum` 只安装安全补丁呢?
|
||||
|
||||
那该怎样实践呢?有没有办法让 yum 只安装安全补丁呢?
|
||||
答案是肯定的,可以用 `yum` 包管理器轻松实现。
|
||||
|
||||
答案是肯定的,可以用 yum 包管理器轻松实现。
|
||||
在这篇文章中,我们不但会提供所需的信息。而且,我们会介绍一些额外的命令,可以帮你获取指定安全更新的详实信息。
|
||||
|
||||
在这篇文章中,我们不但会提供所需的信息。
|
||||
希望这样可以启发你去了解并修复你列表上的那些漏洞。一旦有安全漏洞被公布,就必须更新受影响的软件,这样可以降低系统中的安全风险。
|
||||
|
||||
而且,我们会介绍一些额外的命令,可以帮你获取指定安全更新的详实信息。
|
||||
|
||||
希望这样可以启发你去了解并修复你列表上的那些漏洞。
|
||||
|
||||
一旦有安全漏洞被公布,就必须更新受影响的软件,这样可以降低系统中的安全风险。
|
||||
|
||||
对于 RHEL 或 CentOS 6 系统,运行下面的 **[Yum 命令][1]** 来安装 yum 安全插件。
|
||||
对于 RHEL 或 CentOS 6 系统,运行下面的 [Yum 命令][1] 来安装 yum 安全插件。
|
||||
|
||||
```
|
||||
# yum -y install yum-plugin-security
|
||||
```
|
||||
|
||||
在 RHEL 7&8 或是 CentOS 7&8 上面,这个插件已经是 yum 的一部分了,不用单独安装。
|
||||
在 RHEL 7&8 或是 CentOS 7&8 上面,这个插件已经是 `yum` 的一部分了,不用单独安装。
|
||||
|
||||
只列出全部可用的补丁(包括安全,Bug 修复以及产品改进),但不安装它们。
|
||||
要列出全部可用的补丁(包括安全、Bug 修复以及产品改进),但不安装它们:
|
||||
|
||||
```
|
||||
# yum updateinfo list available
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos,
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos,
|
||||
: subscription-manager, verify, versionlock
|
||||
RHSA-2014:1031 Important/Sec. 389-ds-base-1.3.1.6-26.el7_0.x86_64
|
||||
RHSA-2015:0416 Important/Sec. 389-ds-base-1.3.3.1-13.el7.x86_64
|
||||
@@ -54,20 +48,18 @@ RHBA-2016:1048 bugfix 389-ds-base-1.3.4.0-30.el7_2.x86_64
|
||||
RHBA-2016:1298 bugfix 389-ds-base-1.3.4.0-32.el7_2.x86_64
|
||||
```
|
||||
|
||||
要统计补丁的大约数量,运行下面的命令。
|
||||
要统计补丁的大约数量,运行下面的命令:
|
||||
|
||||
```
|
||||
# yum updateinfo list available | wc -l
|
||||
11269
|
||||
```
|
||||
|
||||
想列出全部可用的安全补丁但不安装。
|
||||
|
||||
以下命令用来展示你系统里已安装和待安装的推荐补丁。
|
||||
想列出全部可用的安全补丁但不安装,以下命令用来展示你系统里已安装和待安装的推荐补丁:
|
||||
|
||||
```
|
||||
# yum updateinfo list security all
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos,
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos,
|
||||
: subscription-manager, verify, versionlock
|
||||
RHSA-2014:1031 Important/Sec. 389-ds-base-1.3.1.6-26.el7_0.x86_64
|
||||
RHSA-2015:0416 Important/Sec. 389-ds-base-1.3.3.1-13.el7.x86_64
|
||||
@@ -81,13 +73,13 @@ RHBA-2016:1298 bugfix 389-ds-base-1.3.4.0-32.el7_2.x86_64
|
||||
RHSA-2018:1380 Important/Sec. 389-ds-base-1.3.7.5-21.el7_5.x86_64
|
||||
RHSA-2018:2757 Moderate/Sec. 389-ds-base-1.3.7.5-28.el7_5.x86_64
|
||||
RHSA-2018:3127 Moderate/Sec. 389-ds-base-1.3.8.4-15.el7.x86_64
|
||||
i RHSA-2014:1031 Important/Sec. 389-ds-base-libs-1.3.1.6-26.el7_0.x86_64
|
||||
RHSA-2014:1031 Important/Sec. 389-ds-base-libs-1.3.1.6-26.el7_0.x86_64
|
||||
```
|
||||
|
||||
要显示所有待安装的安全补丁。
|
||||
要显示所有待安装的安全补丁:
|
||||
|
||||
```
|
||||
# yum updateinfo list security all | egrep -v "^i"
|
||||
# yum updateinfo list security all | grep -v "i"
|
||||
|
||||
RHSA-2014:1031 Important/Sec. 389-ds-base-1.3.1.6-26.el7_0.x86_64
|
||||
RHSA-2015:0416 Important/Sec. 389-ds-base-1.3.3.1-13.el7.x86_64
|
||||
@@ -102,14 +94,14 @@ RHBA-2016:1298 bugfix 389-ds-base-1.3.4.0-32.el7_2.x86_64
|
||||
RHSA-2018:2757 Moderate/Sec. 389-ds-base-1.3.7.5-28.el7_5.x86_64
|
||||
```
|
||||
|
||||
要统计全部安全补丁的大致数量,运行下面的命令。
|
||||
要统计全部安全补丁的大致数量,运行下面的命令:
|
||||
|
||||
```
|
||||
# yum updateinfo list security all | wc -l
|
||||
3522
|
||||
```
|
||||
|
||||
下面根据已装软件列出可更新的安全补丁。这包括 bugzillas(bug修复),CVEs(知名漏洞数据库),安全更新等。
|
||||
下面根据已装软件列出可更新的安全补丁。这包括 bugzilla(bug 修复)、CVE(知名漏洞数据库)、安全更新等:
|
||||
|
||||
```
|
||||
# yum updateinfo list security
|
||||
@@ -118,7 +110,7 @@ RHBA-2016:1298 bugfix 389-ds-base-1.3.4.0-32.el7_2.x86_64
|
||||
|
||||
# yum updateinfo list sec
|
||||
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos,
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos,
|
||||
: subscription-manager, verify, versionlock
|
||||
|
||||
RHSA-2018:3665 Important/Sec. NetworkManager-1:1.12.0-8.el7_6.x86_64
|
||||
@@ -134,11 +126,11 @@ RHSA-2018:3665 Important/Sec. NetworkManager-wifi-1:1.12.0-8.el7_6.x86_64
|
||||
RHSA-2018:3665 Important/Sec. NetworkManager-wwan-1:1.12.0-8.el7_6.x86_64
|
||||
```
|
||||
|
||||
显示所有与安全相关的更新,并且返回一个结果来告诉你是否有可用的补丁。
|
||||
显示所有与安全相关的更新,并且返回一个结果来告诉你是否有可用的补丁:
|
||||
|
||||
```
|
||||
# yum --security check-update
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
rhel-7-server-rpms | 2.0 kB 00:00:00
|
||||
--> policycoreutils-devel-2.2.5-20.el7.x86_64 from rhel-7-server-rpms excluded (updateinfo)
|
||||
--> smc-raghumalayalam-fonts-6.0-7.el7.noarch from rhel-7-server-rpms excluded (updateinfo)
|
||||
@@ -162,7 +154,7 @@ NetworkManager-libnm.x86_64 1:1.12.0-10.el7_6 rhel-7
|
||||
NetworkManager-ppp.x86_64 1:1.12.0-10.el7_6 rhel-7-server-rpms
|
||||
```
|
||||
|
||||
列出所有可用的安全补丁,并且显示其详细信息。
|
||||
列出所有可用的安全补丁,并且显示其详细信息:
|
||||
|
||||
```
|
||||
# yum info-sec
|
||||
@@ -196,12 +188,12 @@ Description : The tzdata packages contain data files with rules for various
|
||||
Severity : None
|
||||
```
|
||||
|
||||
如果你想要知道某个更新的具体内容,可以运行下面这个命令。
|
||||
如果你想要知道某个更新的具体内容,可以运行下面这个命令:
|
||||
|
||||
```
|
||||
# yum updateinfo RHSA-2019:0163
|
||||
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
rhel-7-server-rpms | 2.0 kB 00:00:00
|
||||
===============================================================================
|
||||
Important: kernel security, bug fix, and enhancement update
|
||||
@@ -243,12 +235,12 @@ Description : The kernel packages contain the Linux kernel, the core of any
|
||||
updateinfo info done
|
||||
```
|
||||
|
||||
跟之前类似,你可以只查询那些通过 CVE 释出的系统漏洞。
|
||||
跟之前类似,你可以只查询那些通过 CVE 释出的系统漏洞:
|
||||
|
||||
```
|
||||
# yum updateinfo list cves
|
||||
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos,
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos,
|
||||
: subscription-manager, verify, versionlock
|
||||
CVE-2018-15688 Important/Sec. NetworkManager-1:1.12.0-8.el7_6.x86_64
|
||||
CVE-2018-15688 Important/Sec. NetworkManager-adsl-1:1.12.0-8.el7_6.x86_64
|
||||
@@ -260,12 +252,12 @@ CVE-2018-15688 Important/Sec. NetworkManager-ppp-1:1.12.0-8.el7_6.x86_64
|
||||
CVE-2018-15688 Important/Sec. NetworkManager-team-1:1.12.0-8.el7_6.x86_64
|
||||
```
|
||||
|
||||
你也可以查看那些跟 bug 修复相关的更新,运行下面的命令。
|
||||
你也可以查看那些跟 bug 修复相关的更新,运行下面的命令:
|
||||
|
||||
```
|
||||
# yum updateinfo list bugfix | less
|
||||
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos,
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos,
|
||||
: subscription-manager, verify, versionlock
|
||||
RHBA-2018:3349 bugfix NetworkManager-1:1.12.0-7.el7_6.x86_64
|
||||
RHBA-2019:0519 bugfix NetworkManager-1:1.12.0-10.el7_6.x86_64
|
||||
@@ -277,11 +269,11 @@ RHBA-2018:3349 bugfix NetworkManager-config-server-1:1.12.0-7.el7_6.noarch
|
||||
RHBA-2019:0519 bugfix NetworkManager-config-server-1:1.12.0-10.el7_6.noarch
|
||||
```
|
||||
|
||||
要想得到待安装更新的摘要信息,运行这个。
|
||||
要想得到待安装更新的摘要信息,运行这个:
|
||||
|
||||
```
|
||||
# yum updateinfo summary
|
||||
已加载插件: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
rhel-7-server-rpms | 2.0 kB 00:00:00
|
||||
Updates Information Summary: updates
|
||||
13 Security notice(s)
|
||||
@@ -311,7 +303,7 @@ via: https://www.2daygeek.com/check-list-view-find-available-security-updates-on
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[jdh8383](https://github.com/jdh8383)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Translating by MjSeven
|
||||
|
||||
Manage your workstation with Ansible: Configure desktop settings
|
||||
======
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (zhang5788)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using Testinfra with Ansible to verify server state)
|
||||
[#]: via: (https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state)
|
||||
[#]: author: (Clement Verna https://opensource.com/users/cverna/users/paulbischoff/users/dcritch/users/cobiacomm/users/wgarry155/users/kadinroob/users/koreyhilpert)
|
||||
|
||||
Using Testinfra with Ansible to verify server state
|
||||
======
|
||||
Testinfra is a powerful library for writing tests to verify an
|
||||
infrastructure's state. Coupled with Ansible and Nagios, it offers a
|
||||
simple solution to enforce infrastructure as code.
|
||||
![Terminal command prompt on orange background][1]
|
||||
|
||||
By design, [Ansible][2] expresses the desired state of a machine to ensure that the content of an Ansible playbook or role is deployed to the targeted machines. But what if you need to make sure all the infrastructure changes are in Ansible? Or verify the state of a server at any time?
|
||||
|
||||
[Testinfra][3] is an infrastructure testing framework that makes it easy to write unit tests to verify the state of a server. It is a Python library and uses the powerful [pytest][4] test engine.
|
||||
|
||||
### Getting started with Testinfra
|
||||
|
||||
Testinfra can be easily installed using the Python package manager (pip) and a Python virtual environment.
|
||||
|
||||
|
||||
```
|
||||
$ python3 -m venv venv
|
||||
$ source venv/bin/activate
|
||||
(venv) $ pip install testinfra
|
||||
```
|
||||
|
||||
Testinfra is also available in the package repositories of Fedora and CentOS using the EPEL repository. For example, on CentOS 7 you can install it with the following commands:
|
||||
|
||||
|
||||
```
|
||||
$ yum install -y epel-release
|
||||
$ yum install -y python-testinfra
|
||||
```
|
||||
|
||||
#### A simple test script
|
||||
|
||||
Writing tests in Testinfra is easy. Using the code editor of your choice, add the following to a file named **test_simple.py** :
|
||||
|
||||
|
||||
```
|
||||
import testinfra
|
||||
|
||||
def test_os_release(host):
|
||||
assert host.file("/etc/os-release").contains("Fedora")
|
||||
|
||||
def test_sshd_inactive(host):
|
||||
assert host.service("sshd").is_running is False
|
||||
```
|
||||
|
||||
By default, Testinfra provides a host object to the test case; this object gives access to different helper modules. For example, the first test uses the **file** module to verify the content of the file on the host, and the second test case uses the **service** module to check the state of a systemd service.
|
||||
|
||||
To run these tests on your local machine, execute the following command:
|
||||
|
||||
|
||||
```
|
||||
(venv)$ pytest test_simple.py
|
||||
================================ test session starts ================================
|
||||
platform linux -- Python 3.7.3, pytest-4.4.1, py-1.8.0, pluggy-0.9.0
|
||||
rootdir: /home/cverna/Documents/Python/testinfra
|
||||
plugins: testinfra-3.0.0
|
||||
collected 2 items
|
||||
test_simple.py ..
|
||||
|
||||
================================ 2 passed in 0.05 seconds ================================
|
||||
```
|
||||
|
||||
For a full list of Testinfra's APIs, you can consult the [documentation][5].
|
||||
|
||||
### Testinfra and Ansible
|
||||
|
||||
One of Testinfra's supported backends is Ansible, which means Testinfra can directly use Ansible's inventory file and a group of machines defined in the inventory to run tests against them.
|
||||
|
||||
Let's use the following inventory file as an example:
|
||||
|
||||
|
||||
```
|
||||
[web]
|
||||
app-frontend01
|
||||
app-frontend02
|
||||
|
||||
[database]
|
||||
db-backend01
|
||||
```
|
||||
|
||||
We want to make sure that our Apache web server service is running on **app-frontend01** and **app-frontend02**. Let's write the test in a file called **test_web.py** :
|
||||
|
||||
|
||||
```
|
||||
def check_httpd_service(host):
|
||||
"""Check that the httpd service is running on the host"""
|
||||
assert host.service("httpd").is_running
|
||||
```
|
||||
|
||||
To run this test using Testinfra and Ansible, use the following command:
|
||||
|
||||
|
||||
```
|
||||
(venv) $ pip install ansible
|
||||
(venv) $ py.test --hosts=web --ansible-inventory=inventory --connection=ansible test_web.py
|
||||
```
|
||||
|
||||
When invoking the tests, we use the Ansible inventory **[web]** group as the targeted machines and also specify that we want to use Ansible as the connection backend.
|
||||
|
||||
#### Using the Ansible module
|
||||
|
||||
Testinfra also provides a nice API to Ansible that can be used in the tests. The Ansible module enables access to run Ansible plays inside a test and makes it easy to inspect the result of the play.
|
||||
|
||||
|
||||
```
|
||||
def check_ansible_play(host):
|
||||
"""
|
||||
Verify that a package is installed using Ansible
|
||||
package module
|
||||
"""
|
||||
assert not host.ansible("package", "name=httpd state=present")["changed"]
|
||||
```
|
||||
|
||||
By default, Ansible's [Check Mode][6] is enabled, which means that Ansible will report what would change if the play were executed on the remote host.
|
||||
|
||||
### Testinfra and Nagios
|
||||
|
||||
Now that we can easily run tests to validate the state of a machine, we can use those tests to trigger alerts on a monitoring system. This is a great way to catch unexpected changes.
|
||||
|
||||
Testinfra offers an integration with [Nagios][7], a popular monitoring solution. By default, Nagios uses the [NRPE][8] plugin to execute checks on remote hosts, but using Testinfra allows you to run the tests directly from the Nagios master.
|
||||
|
||||
To get a Testinfra output compatible with Nagios, we have to use the **\--nagios** flag when triggering the test. We also use the **-qq** pytest flag to enable pytest's **quiet** mode so all the test details will not be displayed.
|
||||
|
||||
|
||||
```
|
||||
(venv) $ py.test --hosts=web --ansible-inventory=inventory --connection=ansible --nagios -qq line test.py
|
||||
TESTINFRA OK - 1 passed, 0 failed, 0 skipped in 2.55 seconds
|
||||
```
|
||||
|
||||
Testinfra is a powerful library for writing tests to verify an infrastructure's state. Coupled with Ansible and Nagios, it offers a simple solution to enforce infrastructure as code. It is also a key component of adding testing during the development of your Ansible roles using [Molecule][9].
|
||||
|
||||
* * *
|
||||
|
||||
Sysadmins who think the cloud is a buzzword and a bunch of hype should check out Ansible.
|
||||
|
||||
Can you really do DevOps without sharing scripts or code? DevOps manifesto proponents value cross-...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state
|
||||
|
||||
作者:[Clement Verna][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/cverna/users/paulbischoff/users/dcritch/users/cobiacomm/users/wgarry155/users/kadinroob/users/koreyhilpert
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
||||
[2]: https://www.ansible.com/
|
||||
[3]: https://testinfra.readthedocs.io/en/latest/
|
||||
[4]: https://pytest.org/
|
||||
[5]: https://testinfra.readthedocs.io/en/latest/modules.html#modules
|
||||
[6]: https://docs.ansible.com/ansible/playbooks_checkmode.html
|
||||
[7]: https://www.nagios.org/
|
||||
[8]: https://en.wikipedia.org/wiki/Nagios#NRPE
|
||||
[9]: https://github.com/ansible/molecule
|
||||
106
sources/tech/20190528 A Quick Look at Elvish Shell.md
Normal file
106
sources/tech/20190528 A Quick Look at Elvish Shell.md
Normal file
@@ -0,0 +1,106 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (A Quick Look at Elvish Shell)
|
||||
[#]: via: (https://itsfoss.com/elvish-shell/)
|
||||
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||
|
||||
A Quick Look at Elvish Shell
|
||||
======
|
||||
|
||||
Everyone who comes to this site has some knowledge (no matter how slight) of the Bash shell that comes default of so many systems. There have been several attempts to create shells that solve some of the shortcomings of Bash that have appeared over the years. One such shell is Elvish, which we will look at today.
|
||||
|
||||
### What is Elvish Shell?
|
||||
|
||||
![Pipelines In Elvish][1]
|
||||
|
||||
[Elvish][2] is more than just a shell. It is [also][3] “an expressive programming language”. It has a number of interesting features including:
|
||||
|
||||
* Written in Go
|
||||
* Built-in file manager, inspired by the [Ranger file manager][4] (`Ctrl + N`)
|
||||
* Searchable command history (`Ctrl + R`)
|
||||
* History of directories visited (`Ctrl + L`)
|
||||
* Powerful pipelines that support structured data, such as lists, maps, and functions
|
||||
* Includes a “standard set of control structures: conditional control with `if`, loops with `for` and `while`, and exception handling with `try`“
|
||||
* Support for [third-party modules via a package manager to extend Elvish][5]
|
||||
* Licensed under the BSD 2-Clause license
|
||||
|
||||
|
||||
|
||||
“Why is it named Elvish?” I hear you shout. Well, according to [their website][6], they chose their current name because:
|
||||
|
||||
> In roguelikes, items made by the elves have a reputation of high quality. These are usually called elven items, but “elvish” was chosen because it ends with “sh”, a long tradition of Unix shells. It also rhymes with fish, one of the shells that influenced the philosophy of Elvish.
|
||||
|
||||
### How to Install Elvish Shell
|
||||
|
||||
Elvish is available in several mainstream distributions.
|
||||
|
||||
Note that the software is very young. The most recent version is 0.12. According to the project’s [GitHub page][3]: “Despite its pre-1.0 status, it is already suitable for most daily interactive use.”
|
||||
|
||||
![Elvish Control Structures][7]
|
||||
|
||||
#### Debian and Ubuntu
|
||||
|
||||
Elvish packages were introduced into Debian Buster and Ubuntu 17.10. Unfortunately, those packages are out of date and you will need to use a [PPA][8] to install the latest version. You will need to use the following commands:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:zhsj/elvish
|
||||
sudo apt update
|
||||
sudo apt install elvish
|
||||
```
|
||||
|
||||
#### Fedora
|
||||
|
||||
Elvish is not available in the main Fedora repos. You will need to add the [FZUG Repository][9] to install Evlish. To do so, you will need to use these commands:
|
||||
|
||||
```
|
||||
sudo dnf config-manager --add-repo=http://repo.fdzh.org/FZUG/FZUG.repol
|
||||
sudo dnf install elvish
|
||||
```
|
||||
|
||||
#### Arch
|
||||
|
||||
Elvish is available in the [Arch User Repository][10].
|
||||
|
||||
I believe you know [how to change shell in Linux][11] so after installing you can switch to Elvish to use it.
|
||||
|
||||
### Final Thoughts on Elvish Shell
|
||||
|
||||
Personally, I have no reason to install Elvish on any of my systems. I can get most of its features by installing a couple of small command line programs or using already installed programs.
|
||||
|
||||
For example, the search past commands feature already exists in Bash and it works pretty well. If you want to improve your ability to search past commands, I would recommend installing [fzf][12] instead. Fzf uses fuzzy search, so you don’t need to remember the exact command you are looking for. Fzf also allows you to preview and open files.
|
||||
|
||||
I do think that the fact that Elvish is also a programming language is neat, but I’ll stick with Bash shell scripting until Elvish matures a little more.
|
||||
|
||||
Have you every used Elvish? Do you think it would be worthwhile to install Elvish? What is your favorite Bash replacement? Please let us know in the comments below.
|
||||
|
||||
If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][13].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/elvish-shell/
|
||||
|
||||
作者:[John Paul][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/john/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/pipelines-in-elvish.png?fit=800%2C421&ssl=1
|
||||
[2]: https://elv.sh/
|
||||
[3]: https://github.com/elves/elvish
|
||||
[4]: https://ranger.github.io/
|
||||
[5]: https://github.com/elves/awesome-elvish
|
||||
[6]: https://elv.sh/ref/name.html
|
||||
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/Elvish-control-structures.png?fit=800%2C425&ssl=1
|
||||
[8]: https://launchpad.net/%7Ezhsj/+archive/ubuntu/elvish
|
||||
[9]: https://github.com/FZUG/repo/wiki/Add-FZUG-Repository
|
||||
[10]: https://aur.archlinux.org/packages/elvish/
|
||||
[11]: https://linuxhandbook.com/change-shell-linux/
|
||||
[12]: https://github.com/junegunn/fzf
|
||||
[13]: http://reddit.com/r/linuxusersgroup
|
||||
@@ -1,70 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (NVMe on Linux)
|
||||
[#]: via: (https://www.networkworld.com/article/3397006/nvme-on-linux.html)
|
||||
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
|
||||
|
||||
NVMe on Linux
|
||||
======
|
||||
In case you haven't yet noticed, some incredibly fast solid-state disk technology is as available for Linux as it is for other operating systems.
|
||||
![Sandra Henry-Stocker][1]
|
||||
|
||||
NVMe stands for “non-volatile memory express” and is a host controller interface and storage protocol that was created to accelerate the transfer of data between enterprise and client systems and solid-state drives (SSD). It works over a computer's high-speed Peripheral Component Interconnect Express (PCIe) bus. What I see when I look at this string of letters, however, is “envy me.” And the reason for the envy is significant.
|
||||
|
||||
Using NVMe, data transfer happens _much_ faster than it does with rotating drives. In fact, NVMe drives can move data seven times faster than SATA SSDs. That’s seven times faster than the SSDs that many of us are using today. This means that your systems could boot blindingly fast when an NVMe drive is serving as its boot drive. In fact, these days anyone buying a new system should probably not consider one that doesn’t come with NVMe built-in — whether a server or a PC.
|
||||
|
||||
### Does NVMe work with Linux?
|
||||
|
||||
Yes! NVMe has been supported in the Linux kernel since 3.3. Upgrading a system, however, generally requires that both an NVMe controller and an NVMe disk be available. Some external drives are available but need more than the typical USB port for attaching to the system.
|
||||
|
||||
[MORE ON NETWORK WORLD: Linux: Best desktop distros for newbies][2]
|
||||
|
||||
To check your kernel release, use a command like this:
|
||||
|
||||
```
|
||||
$ uname -r
|
||||
5.0.0-15-generic
|
||||
```
|
||||
|
||||
If your system is NVMe-ready, you should see a device (e.g., /dev/nvme0), but only if you have an NVMe controller installed. If you don’t have an NVMe controller, you can still get some information on your NVMe-readiness using this command:
|
||||
|
||||
```
|
||||
$ modinfo nvme | head -6
|
||||
filename: /lib/modules/5.0.0-15-generic/kernel/drivers/nvme/host/nvme.ko
|
||||
version: 1.0
|
||||
license: GPL
|
||||
author: Matthew Wilcox <willy@linux.intel.com>
|
||||
srcversion: AA383008D5D5895C2E60523
|
||||
alias: pci:v0000106Bd00002003sv*sd*bc*sc*i*
|
||||
```
|
||||
|
||||
### Learn more
|
||||
|
||||
More details on what you need to know about the insanely fast NVMe storage option are available on _[PCWorld][3]._
|
||||
|
||||
Specs, white papers and other resources are available at [NVMexpress.org][4].
|
||||
|
||||
Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3397006/nvme-on-linux.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://images.idgesg.net/images/article/2019/05/nvme-100797708-large.jpg
|
||||
[2]: https://www.networkworld.com/slideshow/153439/linux-best-desktop-distros-for-newbies.html#tk.nww-infsb
|
||||
[3]: https://www.pcworld.com/article/2899351/everything-you-need-to-know-about-nvme.html
|
||||
[4]: https://nvmexpress.org/
|
||||
[5]: https://www.facebook.com/NetworkWorld/
|
||||
[6]: https://www.linkedin.com/company/network-world
|
||||
@@ -0,0 +1,244 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Packit – packaging in Fedora with minimal effort)
|
||||
[#]: via: (https://fedoramagazine.org/packit-packaging-in-fedora-with-minimal-effort/)
|
||||
[#]: author: (Petr Hracek https://fedoramagazine.org/author/phracek/)
|
||||
|
||||
Packit – packaging in Fedora with minimal effort
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
### What is packit
|
||||
|
||||
Packit ([https://packit.dev/)][2] is a CLI tool that helps you auto-maintain your upstream projects into the Fedora operating system. But what does it really mean?
|
||||
|
||||
As a developer, you might want to update your package in Fedora. If you’ve done it in the past, you know it’s no easy task. If you haven’t let me reiterate: it’s no easy task.
|
||||
|
||||
And this is exactly where packit can help: once you have your package in Fedora, you can maintain your SPEC file upstream and, with just one additional configuration file, packit will help you update your package in Fedora when you update your source code upstream.
|
||||
|
||||
Furthermore, packit can synchronize downstream changes to a SPEC file back into the upstream repository. This could be useful if the SPEC file of your package is changed in Fedora repositories and you would like to synchronize it into your upstream project.
|
||||
|
||||
Packit also provides a way to build an SRPM package based on an upstream repository checkout, which can be used for building RPM packages in COPR.
|
||||
|
||||
Last but not least, packit provides a status command. This command provides information about upstream and downstream repositories, like pull requests, release and more others.
|
||||
|
||||
Packit provides also another two commands: _build_ and _create-update_.
|
||||
|
||||
The command _packit build_ performs a production build of your project in Fedora build system – koji. You can Fedora version you want to build against using an option _–dist-git-branch_. The command _packit create-updates_ creates a Bodhi update for the specific branch using the option — _dist-git-branch_.
|
||||
|
||||
### Installation
|
||||
|
||||
You can install packit on Fedora using dnf:
|
||||
|
||||
```
|
||||
sudo dnf install -y packit
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
For demonstration use case, I have selected the upstream repository of **colin** ([https://github.com/user-cont/colin)][3]. Colin is a tool to check generic rules and best-practices for containers, dockerfiles, and container images.
|
||||
|
||||
First of all, clone **colin** git repository:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/user-cont/colin.git
|
||||
$ cd colin
|
||||
```
|
||||
|
||||
Packit expects to run in the root of your git repository.
|
||||
|
||||
Packit ([https://github.com/packit-service/packit/)][4] needs information about your project, which has to be stored in the upstream repository in the _.packit.yaml_ file (<https://github.com/packit-service/packit/blob/master/docs/configuration.md#projects-configuration-file>).
|
||||
|
||||
See colin’s packit configuration file:
|
||||
|
||||
```
|
||||
$ cat .packit.yaml
|
||||
specfile_path: colin.spec
|
||||
synced_files:
|
||||
-.packit.yaml
|
||||
- colin.spec
|
||||
upstream_project_name: colin
|
||||
downstream_package_name: colin
|
||||
```
|
||||
|
||||
What do the values mean?
|
||||
|
||||
* _specfile_path_ – a relative path to a spec file within the upstream repository (mandatory)
|
||||
* _synced_files_ – a list of relative paths to files in the upstream repo which are meant to be copied to dist-git during an update
|
||||
* _upstream_project_name_ – name of the upstream repository (e.g. in PyPI); this is used in %prep section
|
||||
* _downstream_package_name_ – name of the package in Fedora (mandatory)
|
||||
|
||||
|
||||
|
||||
For more information see the packit configuration documentation (<https://github.com/packit-service/packit/blob/master/docs/configuration.md>)
|
||||
|
||||
### What can packit do?
|
||||
|
||||
Prerequisite for using packit is that you are in a working directory of a git checkout of your upstream project.
|
||||
|
||||
Before running any packit command, you need to do several actions. These actions are mandatory for filing a PR into the upstream or downstream repositories and to have access into the Fedora dist-git repositories.
|
||||
|
||||
Export GitHub token taken from <https://github.com/settings/tokens>:
|
||||
|
||||
```
|
||||
$ export GITHUB_TOKEN=<YOUR_TOKEN>
|
||||
```
|
||||
|
||||
Obtain your Kerberos ticket needed for Fedora Account System (FAS) :
|
||||
|
||||
```
|
||||
$ kinit <yourname>@FEDORAPROJECT.ORG
|
||||
```
|
||||
|
||||
Export your Pagure API keys taken from <https://src.fedoraproject.org/settings#nav-api-tab>:
|
||||
|
||||
```
|
||||
$ export PAGURE_USER_TOKEN=<PAGURE_USER_TOKEN>
|
||||
```
|
||||
|
||||
Packit also needs a fork token to create a pull request. The token is taken from <https://src.fedoraproject.org/fork/YOU/rpms/PACKAGE/settings#apikeys-tab>
|
||||
|
||||
Do it by running:
|
||||
|
||||
```
|
||||
$ export PAGURE_FORK_TOKEN=<PAGURE_FORK_TOKEN>
|
||||
```
|
||||
|
||||
Or store these tokens in the **~/.config/packit.yaml** file:
|
||||
|
||||
```
|
||||
$ cat ~/.config/packit.yaml
|
||||
|
||||
github_token: <GITHUB_TOKEN>
|
||||
pagure_user_token: <PAGURE_USER_TOKEN>
|
||||
pagure_fork_token: <PAGURE_FORK_TOKEN>
|
||||
```
|
||||
|
||||
#### Propose a new upstream release in Fedora
|
||||
|
||||
The command for this first use case is called _**propose-update**_ (<https://github.com/jpopelka/packit/blob/master/docs/propose_update.md>). The command creates a new pull request in Fedora dist-git repository using a selected or the latest upstream release.
|
||||
|
||||
```
|
||||
$ packit propose-update
|
||||
|
||||
INFO: Running 'anitya' versioneer
|
||||
Version in upstream registries is '0.3.1'.
|
||||
Version in spec file is '0.3.0'.
|
||||
WARNING Version in spec file is outdated
|
||||
Picking version of the latest release from the upstream registry.
|
||||
Checking out upstream version 0.3.1
|
||||
Using 'master' dist-git branch
|
||||
Copying /home/vagrant/colin/colin.spec to /tmp/tmptfwr123c/colin.spec.
|
||||
Archive colin-0.3.0.tar.gz found in lookaside cache (skipping upload).
|
||||
INFO: Downloading file from URL https://files.pythonhosted.org/packages/source/c/colin/colin-0.3.0.tar.gz
|
||||
100%[=============================>] 3.18M eta 00:00:00
|
||||
Downloaded archive: '/tmp/tmptfwr123c/colin-0.3.0.tar.gz'
|
||||
About to upload to lookaside cache
|
||||
won't be doing kinit, no credentials provided
|
||||
PR created: https://src.fedoraproject.org/rpms/colin/pull-request/14
|
||||
```
|
||||
|
||||
Once the command finishes, you can see a PR in the Fedora Pagure instance which is based on the latest upstream release. Once you review it, it can be merged.
|
||||
|
||||
![][5]
|
||||
|
||||
#### Sync downstream changes back to the upstream repository
|
||||
|
||||
Another use case is to sync downstream changes into the upstream project repository.
|
||||
|
||||
The command for this purpose is called _**sync-from-downstream**_ (<https://github.com/jpopelka/packit/blob/master/docs/sync-from-downstream.md>). Files synced into the upstream repository are mentioned in the _packit.yaml_ configuration file under the _synced_files_ value.
|
||||
|
||||
```
|
||||
$ packit sync-from-downstream
|
||||
|
||||
upstream active branch master
|
||||
using "master" dist-git branch
|
||||
Copying /tmp/tmplvxqtvbb/colin.spec to /home/vagrant/colin/colin.spec.
|
||||
Creating remote fork-ssh with URL git@github.com:phracek/colin.git.
|
||||
Pushing to remote fork-ssh using branch master-downstream-sync.
|
||||
PR created: https://github.com/user-cont/colin/pull/229
|
||||
```
|
||||
|
||||
As soon as packit finishes, you can see the latest changes taken from the Fedora dist-git repository in the upstream repository. This can be useful, e.g. when Release Engineering performs mass-rebuilds and they update your SPEC file in the Fedora dist-git repository.
|
||||
|
||||
![][6]
|
||||
|
||||
#### Get the status of your upstream project
|
||||
|
||||
If you are a developer, you may want to get all the information about the latest releases, tags, pull requests, etc. from the upstream and the downstream repository. Packit provides the _**status**_ command for this purpose.
|
||||
|
||||
```
|
||||
$ packit status
|
||||
Downstream PRs:
|
||||
ID Title URL
|
||||
---- -------------------------------- ---------------------------------------------------------
|
||||
14 Update to upstream release 0.3.1 https://src.fedoraproject.org//rpms/colin/pull-request/14
|
||||
12 Upstream pr: 226 https://src.fedoraproject.org//rpms/colin/pull-request/12
|
||||
11 Upstream pr: 226 https://src.fedoraproject.org//rpms/colin/pull-request/11
|
||||
8 Upstream pr: 226 https://src.fedoraproject.org//rpms/colin/pull-request/8
|
||||
|
||||
Dist-git versions:
|
||||
f27: 0.2.0
|
||||
f28: 0.2.0
|
||||
f29: 0.2.0
|
||||
f30: 0.2.0
|
||||
master: 0.2.0
|
||||
|
||||
GitHub upstream releases:
|
||||
0.3.1
|
||||
0.3.0
|
||||
0.2.1
|
||||
0.2.0
|
||||
0.1.0
|
||||
|
||||
Latest builds:
|
||||
f27: colin-0.2.0-1.fc27
|
||||
f28: colin-0.3.1-1.fc28
|
||||
f29: colin-0.3.1-1.fc29
|
||||
f30: colin-0.3.1-2.fc30
|
||||
|
||||
Latest bodhi updates:
|
||||
Update Karma status
|
||||
------------------ ------- --------
|
||||
colin-0.3.1-1.fc29 1 stable
|
||||
colin-0.3.1-1.fc28 1 stable
|
||||
colin-0.3.0-2.fc28 0 obsolete
|
||||
```
|
||||
|
||||
#### Create an SRPM
|
||||
|
||||
The last packit use case is to generate an SRPM package based on a git checkout of your upstream project. The packit command for SRPM generation is _**srpm**_.
|
||||
|
||||
```
|
||||
$ packit srpm
|
||||
Version in spec file is '0.3.1.37.g00bb80e'.
|
||||
SRPM: /home/phracek/work/colin/colin-0.3.1.37.g00bb80e-1.fc29.src.rpm
|
||||
```
|
||||
|
||||
### Packit as a service
|
||||
|
||||
In the summer, the people behind packit would like to introduce packit as a service (<https://github.com/packit-service/packit-service>). In this case, the packit GitHub application will be installed into the upstream repository and packit will perform all the actions automatically, based on the events it receives from GitHub or fedmsg.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/packit-packaging-in-fedora-with-minimal-effort/
|
||||
|
||||
作者:[Petr Hracek][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/phracek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/05/packit3-816x345.png
|
||||
[2]: https://packit.dev/
|
||||
[3]: https://github.com/user-cont/colin
|
||||
[4]: https://github.com/packit-service/packit/
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2019/05/colin_pr-1024x781.png
|
||||
[6]: https://fedoramagazine.org/wp-content/uploads/2019/05/colin_upstream_pr-1-1024x677.png
|
||||
@@ -0,0 +1,145 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (A short primer on assemblers, compilers, and interpreters)
|
||||
[#]: via: (https://opensource.com/article/19/5/primer-assemblers-compilers-interpreters)
|
||||
[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/shawnhcorey/users/jnyjny/users/jnyjny)
|
||||
|
||||
A short primer on assemblers, compilers, and interpreters
|
||||
======
|
||||
A gentle introduction to the historical evolution of programming
|
||||
practices.
|
||||
![keyboard with connected dots][1]
|
||||
|
||||
In the early days of computing, hardware was expensive and programmers were cheap. In fact, programmers were so cheap they weren't even called "programmers" and were in fact usually mathematicians or electrical engineers. Early computers were used to solve complex mathematical problems quickly, so mathematicians were a natural fit for the job of "programming."
|
||||
|
||||
### What is a program?
|
||||
|
||||
First, a little background. Computers can't do anything by themselves, so they require programs to drive their behavior. Programs can be thought of as very detailed recipes that take an input and produce an output. The steps in the recipe are composed of instructions that operate on data. While that sounds complicated, you probably know how this statement works:
|
||||
|
||||
|
||||
```
|
||||
`1 + 2 = 3`
|
||||
```
|
||||
|
||||
The plus sign is the "instruction" while the numbers 1 and 2 are the data. Mathematically, the equal sign indicates that both sides of an equation are "equivalent," however most computer languages use some variant of equals to mean "assignment." If a computer were executing that statement, it would store the results of the addition (the "3") somewhere in memory.
|
||||
|
||||
Computers know how to do math with numbers and move data around the machine's memory hierarchy. I won't say too much about memory except that it generally comes in two different flavors: fast/small and slow/big. CPU registers are very fast, very small and act as scratch pads. Main memory is typically very big and not nearly as fast as register memory. CPUs shuffle the data they are working with from main memory to registers and back again while a program executes.
|
||||
|
||||
### Assemblers
|
||||
|
||||
Computers were very expensive and people were cheap. Programmers spent endless hours translating hand-written math into computer instructions that the computer could execute. The very first computers had terrible user interfaces, some only consisting of toggle switches on the front panel. The switches represented 1s and 0s in a single "word" of memory. The programmer would configure a word, indicate where to store it, and commit the word to memory. It was time-consuming and error-prone.
|
||||
|
||||
![Programmers operate the ENIAC computer][2]
|
||||
|
||||
_Programmers[Betty Jean Jennings][3] (left) and [Fran Bilas][4] (right) operate [ENIAC's][5] main control panel._
|
||||
|
||||
Eventually, an [electrical engineer][6] decided his time wasn't cheap and wrote a program with input written as a "recipe" expressed in terms people could read that output a computer-readable version. This was the first "assembler" and it was very controversial. The people that owned the expensive machines didn't want to "waste" compute time on a task that people were already doing; albeit slowly and with errors. Over time, people came to appreciate the speed and accuracy of the assembler versus a hand-assembled program, and the amount of "real work" done with the computer increased.
|
||||
|
||||
While assembler programs were a big step up from toggling bit patterns into the front panel of a machine, they were still pretty specialized. The addition example above might have looked something like this:
|
||||
|
||||
|
||||
```
|
||||
01 MOV R0, 1
|
||||
02 MOV R1, 2
|
||||
03 ADD R0, R1, R2
|
||||
04 MOV 64, R0
|
||||
05 STO R2, R0
|
||||
```
|
||||
|
||||
Each line is a computer instruction, beginning with a shorthand name of the instruction followed by the data the instruction works on. This little program will first "move" the value 1 into a register called R0, then 2 into register R1. Line 03 adds the contents of registers R0 and R1 and stores the resulting value into register R2. Finally, lines 04 and 05 identify where the result should be stored in main memory (address 64). Managing where data is stored in memory is one of the most time-consuming and error-prone parts of writing computer programs.
|
||||
|
||||
### Compilers
|
||||
|
||||
Assembly was much better than writing computer instructions by hand; however, early programmers yearned to write programs like they were accustomed to writing mathematical formulae. This drove the development of higher-level compiled languages, some of which are historical footnotes and others are still in use today. [ALGO][7] is one such footnote, while real problems continue to be solved today with languages like [Fortran][8] and [C][9].
|
||||
|
||||
![Genealogy tree of ALGO and Fortran][10]
|
||||
|
||||
Genealogy tree of ALGO and Fortran programming languages
|
||||
|
||||
The introduction of these "high-level" languages allowed programmers to write their programs in simpler terms. In the C language, our addition assembly program would be written:
|
||||
|
||||
|
||||
```
|
||||
int x;
|
||||
x = 1 + 2;
|
||||
```
|
||||
|
||||
The first statement describes a piece of memory the program will use. In this case, the memory should be the size of an integer and its name is **x** The second statement is the addition, although written "backward." A C programmer would read that as "X is assigned the result of one plus two." Notice the programmer doesn't need to say where to put **x** in memory, as the compiler takes care of that.
|
||||
|
||||
A new type of program called a "compiler" would turn the program written in a high-level language into an assembly language version and then run it through the assembler to produce a machine-readable version of the program. This composition of programs is often called a "toolchain," in that one program's output is sent directly to another program's input.
|
||||
|
||||
The huge advantage of compiled languages over assembly language programs was porting from one computer model or brand to another. In the early days of computing, there was an explosion of different types of computing hardware from companies like IBM, Digital Equipment Corporation, Texas Instruments, UNIVAC, Hewlett Packard, and others. None of these computers shared much in common besides needing to be plugged into an electrical power supply. Memory and CPU architectures differed wildly, and it often took man-years to translate programs from one computer to another.
|
||||
|
||||
With high-level languages, the compiler toolchain only had to be ported to the new platform. Once the compiler was available, high-level language programs could be recompiled for a new computer with little or no modification. Compilation of high-level languages was truly revolutionary.
|
||||
|
||||
![IBM PC XT][11]
|
||||
|
||||
IBM PC XT released in 1983, is an early example of the decreasing cost of hardware.
|
||||
|
||||
Life became very good for programmers. It was much easier to express the problems they wanted to solve using high-level languages. The cost of computer hardware was falling dramatically due to advances in semiconductors and the invention of integrated chips. Computers were getting faster and more capable, as well as much less expensive. At some point, possibly in the late '80s, there was an inversion and programmers became more expensive than the hardware they used.
|
||||
|
||||
### Interpreters
|
||||
|
||||
Over time, a new programming model rose where a special program called an "interpreter" would read a program and turn it into computer instructions to be executed immediately. The interpreter takes the program as input and interprets it into an intermediate form, much like a compiler. Unlike a compiler, the interpreter then executes the intermediate form of the program. This happens every time an interpreted program runs, whereas a compiled program is compiled just one time and the computer executes the machine instructions "as written."
|
||||
|
||||
As a side note, when people say "interpreted programs are slow," this is the main source of the perceived lack of performance. Modern computers are so amazingly capable that most people can't tell the difference between compiled and interpreted programs.
|
||||
|
||||
Interpreted programs, sometimes called "scripts," are even easier to port to different hardware platforms. Because the script doesn't contain any machine-specific instructions, a single version of a program can run on many different computers without changes. The catch, of course, is the interpreter must be ported to the new machine to make that possible.
|
||||
|
||||
One example of a very popular interpreted language is [perl][12]. A complete perl expression of our addition problem would be:
|
||||
|
||||
|
||||
```
|
||||
`$x = 1 + 2`
|
||||
```
|
||||
|
||||
While it looks and acts much like the C version, it lacks the variable initialization statement. There are other differences (which are beyond the scope of this article), but you can see that we can write a computer program that is very close to how a mathematician would write it by hand with pencil and paper.
|
||||
|
||||
### Virtual Machines
|
||||
|
||||
The latest craze in programming models is the virtual machine, often abbreviated as VM. There are two flavors of virtual machine; system virtual machines and process virtual machines. Both types of VMs provide a level of abstraction from the "real" computing hardware, though they have different scopes. A system virtual machine is software that offers a substitute for the physical hardware, while a process virtual machine is designed to execute a program in a system-independent manner. So in this case, a process virtual machine (virtual machine from here on) is similar in scope to an interpreter in that a program is first compiled into an intermediated form before the virtual machine executes it.
|
||||
|
||||
The main difference between an interpreter and a virtual machine is the virtual machine implements an idealized CPU accessed through its virtual instruction set. This abstraction makes it possible to write front-end language tools that compile programs written in different languages and target the virtual machine. Probably the most popular and well known virtual machine is the Java Virtual Machine (JVM). The JVM was initially only for the Java programming language back in the 1990s, but it now hosts [many][13] popular computer languages: Scala, Jython, JRuby, Clojure, and Kotlin to list just a few. There are other examples that may not be common knowledge. I only recently learned that my favorite language, [Python][14], is not an interpreted language, but a [language hosted on a virtual machine][15]!
|
||||
|
||||
Virtual machines continue the historical trend of reducing the amount of platform-specific knowledge a programmer needs to express their problem in a language that supports their domain-specific needs.
|
||||
|
||||
### That's a wrap
|
||||
|
||||
I hope you enjoy this primer on some of the less visible parts of software. Are there other topics you want me to dive into next? Let me know in the comments.
|
||||
|
||||
* * *
|
||||
|
||||
_This article was originally published on[PyBites][16] and is reprinted with permission._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/primer-assemblers-compilers-interpreters
|
||||
|
||||
作者:[Erik O'Shaughnessy][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/jnyjny/users/shawnhcorey/users/jnyjny/users/jnyjny
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (keyboard with connected dots)
|
||||
[2]: https://opensource.com/sites/default/files/uploads/two_women_operating_eniac.gif (Programmers operate the ENIAC computer)
|
||||
[3]: https://en.wikipedia.org/wiki/Jean_Bartik (Jean Bartik)
|
||||
[4]: https://en.wikipedia.org/wiki/Frances_Spence (Frances Spence)
|
||||
[5]: https://en.wikipedia.org/wiki/ENIAC
|
||||
[6]: https://en.wikipedia.org/wiki/Nathaniel_Rochester_%28computer_scientist%29
|
||||
[7]: https://en.wikipedia.org/wiki/ALGO
|
||||
[8]: https://en.wikipedia.org/wiki/Fortran
|
||||
[9]: https://en.wikipedia.org/wiki/C_(programming_language)
|
||||
[10]: https://opensource.com/sites/default/files/uploads/algolfortran_family-by-borkowski.png (Genealogy tree of ALGO and Fortran)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/639px-ibm_px_xt_color.jpg (IBM PC XT)
|
||||
[12]: www.perl.org
|
||||
[13]: https://en.wikipedia.org/wiki/List_of_JVM_languages
|
||||
[14]: /resources/python
|
||||
[15]: https://opensource.com/article/18/4/introduction-python-bytecode
|
||||
[16]: https://pybit.es/python-interpreters.html
|
||||
@@ -0,0 +1,484 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Creating a Source-to-Image build pipeline in OKD)
|
||||
[#]: via: (https://opensource.com/article/19/5/creating-source-image-build-pipeline-okd)
|
||||
[#]: author: (Chris Collins https://opensource.com/users/clcollins)
|
||||
|
||||
Creating a Source-to-Image build pipeline in OKD
|
||||
======
|
||||
S2I is an ideal way to build and compile Go applications in a repeatable
|
||||
way, and it just gets better when paired with OKD BuildConfigs.
|
||||
![][1]
|
||||
|
||||
In the first three articles in this series, we explored the general [requirements][2] of a Source-to-Image (S2I) system and [prepared][3] and [tested][4] an environment specifically for a Go (Golang) application. This S2I build is perfect for local development or maintaining a builder image with a code pipeline, but if you have access to an [OKD][5] or OpenShift cluster (or [Minishift][6]), you can set up the entire workflow using OKD BuildConfigs, not only to build and maintain the builder image but also to use the builder image to create the application image and subsequent runtime image automatically. This way, the images can be rebuilt automatically when downstream images change and can trigger OKD deploymentConfigs to redeploy applications running from these images.
|
||||
|
||||
### Step 1: Build the builder image in OKD
|
||||
|
||||
As in local S2I usage, the first step is to create the builder image to build the GoHelloWorld test application that we can reuse to compile other Go-based applications. This first build step will be a Docker build, just like before, that pulls the Dockerfile and S2I scripts from a Git repository to build the image. Therefore, those files must be committed and available in a public Git repo (or you can use the companion [GitHub repo][7] for this article).
|
||||
|
||||
_Note:_ OKD BuildConfigs do not require that source Git repos are public. To use a private repo, you must set up deploy keys and link the keys to a builder service account. This is not difficult, but for simplicity's sake, this exercise will use a public repository.
|
||||
|
||||
#### Create an image stream for the builder image
|
||||
|
||||
The BuildConfig will create a builder image for us to compile the GoHelloWorld app, but first, we need a place to store the image. In OKD, that place is an image stream.
|
||||
|
||||
An [image stream][8] and its tags are like a manifest or list of related images and image tags. It serves as an abstraction layer that allows you to reference an image, even if the image changes. Think of it as a collection of aliases that reference specific images and, as images are updated, automatically points to the new image version. The image stream is nothing except these aliases—just metadata about real images stored in a registry.
|
||||
|
||||
An image stream can be created with the **oc create imagestream <name>** command, or it can be created from a YAML file with **oc create -f <filename>**. Either way, a brand-new image stream is a small placeholder object that is empty until it is populated with image references, either manually (who wants to do things manually?) or with a BuildConfig.
|
||||
|
||||
Our golang-builder image stream looks like this:
|
||||
|
||||
|
||||
```
|
||||
# imageStream-golang-builder.yaml
|
||||
\---
|
||||
apiVersion: image.openshift.io/v1
|
||||
kind: ImageStream
|
||||
metadata:
|
||||
generation: 1
|
||||
name: golang-builder
|
||||
spec:
|
||||
lookupPolicy:
|
||||
local: false
|
||||
```
|
||||
|
||||
Other than a name, and a (mostly) empty spec, there is nothing really there.
|
||||
|
||||
_Note:_ The **lookupPolicy** has to do with allowing Kubernetes-native components to resolve image stream references since image streams are OKD-native and not a part of the Kubernetes core. This topic is out of scope for this article, but you can read more about how it works in OKD's documentation [Using Image Streams with Kubernetes Resources][9].
|
||||
|
||||
Create an image stream for the builder image and its progeny.
|
||||
|
||||
|
||||
```
|
||||
$ oc create -f imageStream-golangBuilder.yaml
|
||||
|
||||
# Check the ImageStream
|
||||
$ oc get imagestream golang-builder
|
||||
NAME DOCKER REPO TAGS UPDATED
|
||||
imagestream.image.openshift.io/golang-builder docker-registry.default.svc:5000/golang-builder/golang-builder
|
||||
```
|
||||
|
||||
Note that the newly created image stream has no tags and has never been updated.
|
||||
|
||||
#### Create a BuildConfig for the builder image
|
||||
|
||||
In OKD, a [BuildConfig][10] describes how to build container images from a specific source and triggers for when they build. Don't be thrown off by the language—just as you might say you build and re-build the same image from a Dockerfile, but in reality, you have built multiple images, a BuildConfig builds and rebuilds the same image, but in reality, it creates multiple images. (And suddenly the reason for image streams becomes much clearer!)
|
||||
|
||||
Our builder image BuildConfig describes how to build and re-build our builder image(s). The BuildConfig's core is made up of four important parts:
|
||||
|
||||
1. Build source
|
||||
2. Build strategy
|
||||
3. Build output
|
||||
4. Build triggers
|
||||
|
||||
|
||||
|
||||
The _build source_ (predictably) describes where the thing that runs the build comes from. The builds described by the golang-builder BuildConfig will use the Dockerfile and S2I scripts we created previously and, using the Git-type build source, clone a Git repository to get the files to do the builds.
|
||||
|
||||
|
||||
```
|
||||
source:
|
||||
type: Git
|
||||
git:
|
||||
ref: master
|
||||
uri: <https://github.com/clcollins/golang-s2i.git>
|
||||
```
|
||||
|
||||
The _build strategy_ describes what the build will do with the source files from the build source. The golang-builder BuildConfig mimics the **docker build** we used previously to build our local builder image by using the Docker-type build strategy.
|
||||
|
||||
|
||||
```
|
||||
strategy:
|
||||
type: Docker
|
||||
dockerStrategy: {}
|
||||
```
|
||||
|
||||
The **dockerStrategy** build type tells OKD to build a Docker image from the Dockerfile contained in the source specified by the build source.
|
||||
|
||||
The _build output_ tells the BuildConfig what to do with the resulting image. In this case, we specify the image stream we created above and a tag to give to the image. As with our local build, we're tagging it with **golang-builder:1.12** as a reference to the Go version inherited from the parent image.
|
||||
|
||||
|
||||
```
|
||||
output:
|
||||
to:
|
||||
kind: ImageStreamTag
|
||||
name: golang-builder:1.12
|
||||
```
|
||||
|
||||
Finally, the BuildConfig defines a set of _build triggers_ —events that will cause the image to be rebuilt automatically. For this BuildConfig, a change to the BuildConfig configuration or an update to the upstream image (golang:1.12) will trigger a new build.
|
||||
|
||||
|
||||
```
|
||||
triggers:
|
||||
\- type: ConfigChange
|
||||
\- imageChange:
|
||||
type: ImageChange
|
||||
```
|
||||
|
||||
Using the [builder image BuildConfig][11] from the GitHub repo as a reference (or just using that file), create a BuildConfig YAML file and use it to create the BuildConfig.
|
||||
|
||||
|
||||
```
|
||||
$ oc create -f buildConfig-golang-builder.yaml
|
||||
|
||||
# Check the BuildConfig
|
||||
$ oc get bc golang-builder
|
||||
NAME TYPE FROM LATEST
|
||||
golang-builder Docker Git@master 1
|
||||
```
|
||||
|
||||
Because the BuildConfig included the "ImageChange" trigger, it immediately kicks off a new build. You can check that the build was created with the **oc get builds** command.
|
||||
|
||||
|
||||
```
|
||||
# Check the Builds
|
||||
$ oc get builds
|
||||
NAME TYPE FROM STATUS STARTED DURATION
|
||||
golang-builder-1 Docker Git@8eff001 Complete About a minute ago 13s
|
||||
```
|
||||
|
||||
While the build is running and after it has completed, you can view its logs with **oc logs -f <build name>** and see the Docker build output as you would locally.
|
||||
|
||||
|
||||
```
|
||||
$ oc logs -f golang-builder-1-build
|
||||
Step 1/11 : FROM docker.io/golang:1.12
|
||||
\---> 7ced090ee82e
|
||||
Step 2/11 : LABEL maintainer "Chris Collins <[collins.christopher@gmail.com][12]>"
|
||||
\---> 7ad989b765e4
|
||||
Step 3/11 : ENV CGO_ENABLED 0 GOOS linux GOCACHE /tmp STI_SCRIPTS_PATH /usr/libexec/s2i SOURCE_DIR /go/src/app
|
||||
\---> 2cee2ce6757d
|
||||
|
||||
<...>
|
||||
```
|
||||
|
||||
If you did not include any build triggers (or did not have them in the right place), your build may not start automatically. You can manually kick off a new build with the **oc start-build** command.
|
||||
|
||||
|
||||
```
|
||||
$ oc start-build golang-builder
|
||||
|
||||
# Or, if you want to automatically tail the build log
|
||||
$ oc start-build golang-builder --follow
|
||||
```
|
||||
|
||||
When the build completes, the resulting image is tagged and pushed to the integrated image registry and the image stream is updated with the new image's information. Check the image stream with the **oc get imagestream** command to see that the new tag exists.
|
||||
|
||||
|
||||
```
|
||||
$ oc get imagestream golang-builder
|
||||
NAME DOCKER REPO TAGS UPDATED
|
||||
golang-builder docker-registry.default.svc:5000/golang-builder/golang-builder 1.12 33 seconds ago
|
||||
```
|
||||
|
||||
### Step 2: Build the application image in OKD
|
||||
|
||||
Now that we have a builder image for our Golang applications created and stored within OKD, we can use this builder image to compile all of our Go apps. First on the block is the example GoHelloWorld app from our [local build example][4]. GoHelloWorld is a simple Go app that just outputs **Hello World!** when it's run.
|
||||
|
||||
Just as we did in the local example with the **s2i build** command, we can tell OKD to use our builder image and S2I to build the application image for GoHelloWorld, compiling the Go binary from the source code in the [GoHelloWorld GitHub repository][13]. This can be done with a BuildConfig with a **sourceStrategy** build.
|
||||
|
||||
#### Create an image stream for the application image
|
||||
|
||||
First things first, we need to create an image stream to manage the image created by the BuildConfig. The image stream is just like the golang-builder image stream, just with a different name. Create it with **oc create is** or using a YAML file from the [GitHub repo][7].
|
||||
|
||||
|
||||
```
|
||||
$ oc create -f imageStream-goHelloWorld-appimage.yaml
|
||||
imagestream.image.openshift.io/go-hello-world-appimage created
|
||||
```
|
||||
|
||||
#### Create a BuildConfig for the application image
|
||||
|
||||
Just as we did with the builder image BuildConfig, this BuildConfig will use the Git source option to clone our source code from the GoHelloWorld repository.
|
||||
|
||||
|
||||
```
|
||||
source:
|
||||
type: Git
|
||||
git:
|
||||
uri: <https://github.com/clcollins/goHelloWorld.git>
|
||||
```
|
||||
|
||||
Instead of using a DockerStrategy build to create an image from a Dockerfile, this BuildConfig will use the sourceStrategy definition to build the image using S2I.
|
||||
|
||||
|
||||
```
|
||||
strategy:
|
||||
type: Source
|
||||
sourceStrategy:
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: golang-builder:1.12
|
||||
```
|
||||
|
||||
Note the **from:** hash in sourceStrategy. This tells OKD to use the **golang-builder:1.12** image we created previously for the S2I build.
|
||||
|
||||
The BuildConfig will output to the new **appimage** image stream we created, and we'll include config- and image-change triggers to kick off new builds automatically if anything updates.
|
||||
|
||||
|
||||
```
|
||||
output:
|
||||
to:
|
||||
kind: ImageStreamTag
|
||||
name: go-hello-world-appimage:1.0
|
||||
triggers:
|
||||
\- type: ConfigChange
|
||||
\- imageChange:
|
||||
type: ImageChange
|
||||
```
|
||||
|
||||
Once again, create a BuildConfig or use the one from the GitHub repo.
|
||||
|
||||
|
||||
```
|
||||
`$ oc create -f buildConfig-goHelloWorld-appimage.yaml`
|
||||
```
|
||||
|
||||
The new build shows up alongside the golang-builder build and, because image-change triggers are specified, the build starts immediately.
|
||||
|
||||
|
||||
```
|
||||
$ oc get builds
|
||||
NAME TYPE FROM STATUS STARTED DURATION
|
||||
golang-builder-1 Docker Git@8eff001 Complete 8 minutes ago 13s
|
||||
go-hello-world-appimage-1 Source Git@99699a6 Running 44 seconds ago
|
||||
```
|
||||
|
||||
If you want to watch the build logs, use the **oc logs -f** command. Once the application image build completes, it is pushed to the image stream we specified, then the new image stream tag is created.
|
||||
|
||||
|
||||
```
|
||||
$ oc get is go-hello-world-appimage
|
||||
NAME DOCKER REPO TAGS UPDATED
|
||||
go-hello-world-appimage docker-registry.default.svc:5000/golang-builder/go-hello-world-appimage 1.0 10 minutes ago
|
||||
```
|
||||
|
||||
Success! The GoHelloWorld app was cloned from source into a new image and compiled and tested using our S2I scripts. We can use the image as-is but, as with our local S2I builds, we can do better and create an image with just the new Go binary in it.
|
||||
|
||||
### Step 3: Build the runtime image in OKD
|
||||
|
||||
Now that the application image has been created with a compiled Go binary for the GoHelloWorld app, we can use something called chain builds to mimic when we extracted the binary from our local application image and created a new runtime image with just the binary in it.
|
||||
|
||||
#### Create an image stream for the runtime image
|
||||
|
||||
Once again, the first step is to create an image stream image for the new runtime image.
|
||||
|
||||
|
||||
```
|
||||
# Create the ImageStream
|
||||
$ oc create -f imageStream-goHelloWorld.yaml
|
||||
imagestream.image.openshift.io/go-hello-world created
|
||||
|
||||
# Get the ImageStream
|
||||
$ oc get imagestream go-hello-world
|
||||
NAME DOCKER REPO TAGS UPDATED
|
||||
go-hello-world docker-registry.default.svc:5000/golang-builder/go-hello-world
|
||||
```
|
||||
|
||||
#### Chain builds
|
||||
|
||||
Chain builds are when one or more BuildConfigs are used to compile software or assemble artifacts for an application, and those artifacts are saved and used by a subsequent BuildConfig to generate a runtime image without re-compiling the code.
|
||||
|
||||
![Chain Build workflow][14]
|
||||
|
||||
Chain build workflow
|
||||
|
||||
#### Create a BuildConfig for the runtime image
|
||||
|
||||
The runtime BuildConfig uses the DockerStrategy build to build the image from a Dockerfile—the same thing we did with the builder image BuildConfig. This time, however, the source is not a Git source, but a Dockerfile source.
|
||||
|
||||
What is the Dockerfile source? It's an inline Dockerfile! Instead of cloning a repo with a Dockerfile in it and building that, we specify the Dockerfile in the BuildConfig. This is especially appropriate with our runtime Dockerfile because it's just three lines long.
|
||||
|
||||
|
||||
```
|
||||
source:
|
||||
type: Dockerfile
|
||||
dockerfile: |-
|
||||
FROM scratch
|
||||
COPY app /app
|
||||
ENTRYPOINT ["/app"]
|
||||
images:
|
||||
\- from:
|
||||
kind: ImageStreamTag
|
||||
name: go-hello-world-appimage:1.0
|
||||
paths:
|
||||
\- sourcePath: /go/src/app/app
|
||||
destinationDir: "."
|
||||
```
|
||||
|
||||
Note that the Dockerfile in the Dockerfile source definition above is the same as the Dockerfile we used in the [third article][4] in this series when we built the slim GoHelloWorld image locally using the binary we extracted with the S2I **save-artifacts** script.
|
||||
|
||||
Something else to note: **scratch** is a reserved word in Dockerfiles. Unlike other **FROM** statements, it does not define an _actual_ image, but rather that the first layer of this image will be nothing. It is defined with **kind: DockerImage** but does not have a registry or group/namespace/project string. Learn more about this behavior in this excellent [container best practices][15] reference.
|
||||
|
||||
The **images** section of the Dockerfile source describes the source of the artifact(s) to be used in the build; in this case, from the appimage generated earlier. The **paths** subsection describes where to get the binary (i.e., in the **/go/src/app** directory of the app image, get the **app** binary) and where to save it (i.e., in the current working directory of the build itself: **"."** ). This allows the **COPY app /app** to grab the binary from the current working directory and add it to **/app** in the runtime image.
|
||||
|
||||
_Note:_ **paths** is an array of source and the destination path _pairs_. Each entry in the list consists of a source and destination. In the example above, there is just one entry because there is just a single binary to copy.
|
||||
|
||||
The Docker strategy is then used to build the inline Dockerfile.
|
||||
|
||||
|
||||
```
|
||||
strategy:
|
||||
type: Docker
|
||||
dockerStrategy: {}
|
||||
```
|
||||
|
||||
Once again, it is output to the image stream created earlier and includes build triggers to automatically kick off new builds.
|
||||
|
||||
|
||||
```
|
||||
output:
|
||||
to:
|
||||
kind: ImageStreamTag
|
||||
name: go-hello-world:1.0
|
||||
triggers:
|
||||
\- type: ConfigChange
|
||||
\- imageChange:
|
||||
type: ImageChange
|
||||
```
|
||||
|
||||
Create a BuildConfig YAML or use the runtime BuildConfig from the GitHub repo.
|
||||
|
||||
|
||||
```
|
||||
$ oc create -f buildConfig-goHelloWorld.yaml
|
||||
buildconfig.build.openshift.io/go-hello-world created
|
||||
```
|
||||
|
||||
If you watch the logs, you'll notice the first step is **FROM scratch** , which confirms we're adding the compiled binary to a blank image.
|
||||
|
||||
|
||||
```
|
||||
$ oc logs -f pod/go-hello-world-1-build
|
||||
Step 1/5 : FROM scratch
|
||||
\--->
|
||||
Step 2/5 : COPY app /app
|
||||
\---> 9e70e6c710f8
|
||||
Removing intermediate container 4d0bd9cef0a7
|
||||
Step 3/5 : ENTRYPOINT /app
|
||||
\---> Running in 7a2dfeba28ca
|
||||
\---> d697577910fc
|
||||
|
||||
<...>
|
||||
```
|
||||
|
||||
Once the build is completed, check the image stream tag to validate that the new image was pushed to the registry and image stream was updated.
|
||||
|
||||
|
||||
```
|
||||
$ oc get imagestream go-hello-world
|
||||
NAME DOCKER REPO TAGS UPDATED
|
||||
go-hello-world docker-registry.default.svc:5000/golang-builder/go-hello-world 1.0 4 minutes ago
|
||||
```
|
||||
|
||||
Make a note of the **DOCKER REPO** string for the image. It will be used in the next section to run the image.
|
||||
|
||||
### Did we create a tiny, binary-only image?
|
||||
|
||||
Finally, let's validate that we did, indeed, build a tiny image with just the binary.
|
||||
|
||||
Check out the image details. First, get the image's name from the image stream.
|
||||
|
||||
|
||||
```
|
||||
$ oc describe imagestream go-hello-world
|
||||
Name: go-hello-world
|
||||
Namespace: golang-builder
|
||||
Created: 42 minutes ago
|
||||
Labels: <none>
|
||||
Annotations: <none>
|
||||
Docker Pull Spec: docker-registry.default.svc:5000/golang-builder/go-hello-world
|
||||
Image Lookup: local=false
|
||||
Unique Images: 1
|
||||
Tags: 1
|
||||
|
||||
1.0
|
||||
no spec tag
|
||||
|
||||
* docker-registry.default.svc:5000/golang-builder/go-hello-world@sha256:eb11e0147a2917312f5e0e9da71109f0cb80760e945fdc1e2db6424b91bc9053
|
||||
13 minutes ago
|
||||
```
|
||||
|
||||
The image is listed at the bottom, described with the SHA hash (e.g., **sha256:eb11e0147a2917312f5e0e9da71109f0cb80760e945fdc1e2db6424b91bc9053** ; yours will be different).
|
||||
|
||||
Get the details of the image using the hash.
|
||||
|
||||
|
||||
```
|
||||
$ oc describe image sha256:eb11e0147a2917312f5e0e9da71109f0cb80760e945fdc1e2db6424b91bc9053
|
||||
Docker Image: docker-registry.default.svc:5000/golang-builder/go-hello-world@sha256:eb11e0147a2917312f5e0e9da71109f0cb80760e945fdc1e2db6424b91bc9053
|
||||
Name: sha256:eb11e0147a2917312f5e0e9da71109f0cb80760e945fdc1e2db6424b91bc9053
|
||||
Created: 15 minutes ago
|
||||
Annotations: image.openshift.io/dockerLayersOrder=ascending
|
||||
image.openshift.io/manifestBlobStored=true
|
||||
openshift.io/image.managed=true
|
||||
Image Size: 1.026MB
|
||||
Image Created: 15 minutes ago
|
||||
Author: <none>
|
||||
Arch: amd64
|
||||
Entrypoint: /app
|
||||
Working Dir: <none>
|
||||
User: <none>
|
||||
Exposes Ports: <none>
|
||||
Docker Labels: io.openshift.build.name=go-hello-world-1
|
||||
io.openshift.build.namespace=golang-builder
|
||||
Environment: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
OPENSHIFT_BUILD_NAME=go-hello-world-1
|
||||
OPENSHIFT_BUILD_NAMESPACE=golang-builder
|
||||
```
|
||||
|
||||
Notice the image size, 1.026MB, is exactly as we want. The image is a scratch image with just the binary inside it!
|
||||
|
||||
### Run a pod with the runtime image
|
||||
|
||||
Using the runtime image we just created, let's create a pod on-demand and run it and validate that it still works.
|
||||
|
||||
This almost never happens in Kubernetes/OKD, but we will run a pod, just a pod, by itself.
|
||||
|
||||
|
||||
```
|
||||
$ oc run -it go-hello-world --image=docker-registry.default.svc:5000/golang-builder/go-hello-world:1.0 --restart=Never
|
||||
Hello World!
|
||||
```
|
||||
|
||||
Everything is working as expected—the image runs and outputs "Hello World!" just as it did in the previous, local S2I builds.
|
||||
|
||||
By creating this workflow in OKD, we can use the golang-builder S2I image for any Go application. This builder image is in place and built for any other applications, and it will auto-update and rebuild itself anytime the upstream golang:1.12 image changes.
|
||||
|
||||
New apps can be built automatically using the S2I build by creating a chain build strategy in OKD with an appimage BuildConfig to compile the source and the runtime BuildConfig to create the final image. Using the build triggers, any change to the source code in the Git repo will trigger a rebuild through the entire pipeline, rebuilding the appimage and the runtime image automatically.
|
||||
|
||||
This is a great way to maintain updated images for any application. Paired with an OKD deploymentConfig with an image build trigger, long-running applications (e.g., webapps) will be automatically redeployed when new code is committed.
|
||||
|
||||
Source-to-Image is an ideal way to develop builder images to build and compile Go applications in a repeatable way, and it just gets better when paired with OKD BuildConfigs.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/creating-source-image-build-pipeline-okd
|
||||
|
||||
作者:[Chris Collins][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/clcollins
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire
|
||||
[2]: https://opensource.com/article/19/5/source-image-golang-part-1
|
||||
[3]: https://opensource.com/article/19/5/source-image-golang-part-2
|
||||
[4]: https://opensource.com/article/19/5/source-image-golang-part-3
|
||||
[5]: https://www.okd.io/
|
||||
[6]: https://github.com/minishift/minishift
|
||||
[7]: https://github.com/clcollins/golang-s2i.git
|
||||
[8]: https://docs.okd.io/latest/architecture/core_concepts/builds_and_image_streams.html#image-streams
|
||||
[9]: https://docs.okd.io/latest/dev_guide/managing_images.html#using-is-with-k8s
|
||||
[10]: https://docs.okd.io/latest/dev_guide/builds/index.html#defining-a-buildconfig
|
||||
[11]: https://github.com/clcollins/golang-s2i/blob/master/okd/buildConfig-golang-builder.yaml
|
||||
[12]: mailto:collins.christopher@gmail.com
|
||||
[13]: https://github.com/clcollins/goHelloWorld.git
|
||||
[14]: https://opensource.com/sites/default/files/uploads/chainingbuilds.png (Chain Build workflow)
|
||||
[15]: http://docs.projectatomic.io/container-best-practices/#_from_scratch
|
||||
@@ -0,0 +1,90 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Learn Python with these awesome resources)
|
||||
[#]: via: (https://opensource.com/article/19/5/resources-learning-python)
|
||||
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
|
||||
|
||||
Learn Python with these awesome resources
|
||||
======
|
||||
Expand your Python knowledge by adding these resources to your personal
|
||||
learning network.
|
||||
![Book list, favorites][1]
|
||||
|
||||
I've been using and teaching Python for a long time now, but I'm always interested in increasing my knowledge about this practical and useful programming language. That's why I've been trying to expand my Python [personal learning network][2] (PLN), a concept that describes informal and mutually beneficial networks for sharing information.
|
||||
|
||||
Educators [Kelly Paredes][3] and [Sean Tibor][4] recently talked about how to build your Python PLN on their podcast, [Teaching Python][5], which I subscribed to after meeting them at [PyCon 2019][6] in Cleveland (and adding them to my Python PLN). This podcast inspired me to think more about the people in my Python PLN, including those I met recently at PyCon.
|
||||
|
||||
I'll share some of the places I've met members of my PLN; maybe they can become part of your Python PLN, too.
|
||||
|
||||
### Young Coders mentors
|
||||
|
||||
[Betsy Waliszewski][7], the event coordinator for the Python Foundation, is a member of my Python PLN. When we ran into each other at PyCon2019, because I'm a teacher, she recommended I check out the [Young Coders][8] workshop for kids ages 12 and up. There, I met [Katie Cunningham][9], who was running the program, which taught participants how to set up and configure a Raspberry Pi and use Python. The young students also received two books: _[Python for Kids][10]_ by Jason Briggs and _[Learn to Program with Minecraft][11]_ by Craig Richardson. I'm always looking for new ways to improve my teaching, so I quickly picked up two copies of the Minecraft book at [NoStarch Press][12]' booth at the conference. Katie is a great teacher and a prolific author with a wonderful [YouTube][13] channel full of Python training videos.
|
||||
|
||||
I added Katie to my PLN, along with two other people I met at the Young Coders workshop: [Nat Dunn][14] and [Sean Valentine][15]. Like Katie, they were volunteering their time to introduce young programmers to Python. Nat is the president of [Webucator][16], an IT training company that has been a sponsor of the Python Software Foundation for several years and sponsored the PyCon 2018 Education Summit. He decided to teach at Young Coders after teaching Python to his 13-year-old son and 14-year-old nephew. Sean is the director of strategic initiatives at the [Hidden Genius Project][17], a technology and leadership mentoring program for black male youth. Sean said many Hidden Genius participants "built projects using Python, so we saw [Young Coders] as a great opportunity to partner." Learning about the Hidden Genius Project has inspired me to think deeper about the implications of coding and its power to change lives.
|
||||
|
||||
### Open Spaces meetups
|
||||
|
||||
I found PyCon's [Open Spaces][18], self-organizing, impromptu hour-long meetups, just as useful as the official programmed events. One of my favorites was about the [Circuit Playground Express][19] device, which was part of our conference swag bags. I am fascinated by this device, and the Open Space provided an avenue to learn more. The organizers offered a worksheet and a [GitHub][20] repo with all the tools we needed to be successful, as well as an opportunity for hands-on learning and direction to explore this unique hardware.
|
||||
|
||||
This meetup whetted my appetite to learn even more about programming the Circuit Playground Express, so after PyCon, I reached out on Twitter to [Nina Zakharenko][21], who [presented a keynote][22] at the conference about programming the device. Nina has been in my Python PLN since last fall when I heard her talk at [All Things Open][23], and I recently signed up for her [Python Fundamentals][24] class to add to my learning. Nina recommended I add [Kattni Rembor][25], whose [code examples][26] are helping me learn to program with CircuitPython, to my Python PLN.
|
||||
|
||||
### Other resources from my PLN
|
||||
|
||||
I also met fellow [Opensource.com][27] Community Moderator [Moshe Zadka][28] at PyCon2019 and talked with him at length. He shared several new Python resources, including _[How to Think Like a Computer Scientist][29]_. Community Moderator [Seth Kenlon][30] is another member of my PLN; he has published many great [Python articles][31], and I recommend you follow him, too.
|
||||
|
||||
My Python personal learning network continues to grow each day. Besides the folks I have already mentioned, I recommend you follow [Al Sweigart][32], [Eric Matthes][33], and [Adafruit][34] because they share great content. I also recommend the book _[Make: Getting Started with Adafruit Circuit Playground Express][35]_ and [Podcast.__init__][36], a podcast all about the Python community, both of which I learned about from my PLN.
|
||||
|
||||
Who is in your Python PLN? Please share your favorites in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/resources-learning-python
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/don-watkins
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/reading_book_stars_list.png?itok=Iwa1oBOl (Book list, favorites)
|
||||
[2]: https://en.wikipedia.org/wiki/Personal_learning_network
|
||||
[3]: https://www.teachingpython.fm/hosts/kellypared
|
||||
[4]: https://twitter.com/smtibor
|
||||
[5]: https://www.teachingpython.fm/20
|
||||
[6]: https://us.pycon.org/2019/
|
||||
[7]: https://www.linkedin.com/in/betsywaliszewski
|
||||
[8]: https://us.pycon.org/2019/events/letslearnpython/
|
||||
[9]: https://www.linkedin.com/in/kcunning/
|
||||
[10]: https://nostarch.com/pythonforkids
|
||||
[11]: https://nostarch.com/programwithminecraft
|
||||
[12]: https://nostarch.com/
|
||||
[13]: https://www.youtube.com/c/KatieCunningham
|
||||
[14]: https://www.linkedin.com/in/natdunn/
|
||||
[15]: https://www.linkedin.com/in/sean-valentine-b370349b/
|
||||
[16]: https://www.webucator.com/
|
||||
[17]: http://www.hiddengeniusproject.org/
|
||||
[18]: https://us.pycon.org/2019/events/open-spaces/
|
||||
[19]: https://www.adafruit.com/product/3333
|
||||
[20]: https://github.com/adafruit/PyCon2019
|
||||
[21]: https://twitter.com/nnja
|
||||
[22]: https://www.youtube.com/watch?v=35mXD40SvXM
|
||||
[23]: https://allthingsopen.org/
|
||||
[24]: https://frontendmasters.com/courses/python/
|
||||
[25]: https://twitter.com/kattni
|
||||
[26]: https://github.com/kattni/ChiPy_2018
|
||||
[27]: http://Opensource.com
|
||||
[28]: https://opensource.com/users/moshez
|
||||
[29]: http://openbookproject.net/thinkcs/python/english3e/
|
||||
[30]: https://opensource.com/users/seth
|
||||
[31]: https://www.google.com/search?source=hp&ei=gVToXPq-FYXGsAW-mZ_YAw&q=site%3Aopensource.com+%22Seth+Kenlon%22+%2B+Python&oq=site%3Aopensource.com+%22Seth+Kenlon%22+%2B+Python&gs_l=psy-ab.12...627.15303..15584...1.0..0.176.2802.4j21......0....1..gws-wiz.....0..35i39j0j0i131j0i67j0i20i263.r2SAW3dxlB4
|
||||
[32]: http://alsweigart.com/
|
||||
[33]: https://twitter.com/ehmatthes?lang=en
|
||||
[34]: https://twitter.com/adafruit
|
||||
[35]: https://www.adafruit.com/product/3944
|
||||
[36]: https://www.pythonpodcast.com/episodes/
|
||||
@@ -0,0 +1,98 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Unity Editor is Now Officially Available for Linux)
|
||||
[#]: via: (https://itsfoss.com/unity-editor-linux/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Unity Editor is Now Officially Available for Linux
|
||||
======
|
||||
|
||||
If you are a designer, developer or an artist, you might have been using the experimental [Unity Editor][1] that was made available for Linux. However, the experimental version wasn’t going to cut it forever – developers need a full stable experience to work.
|
||||
|
||||
So, they recently announced that you can access the full-fledged Unity Editor on Linux.
|
||||
|
||||
While this is an exciting news, what Linux distro does it officially support? Let us talk about a few more details…
|
||||
|
||||
Non-FOSS Alert
|
||||
|
||||
Unity Editor on Linux (or any other platform for that matter) is not an open source software. We have covered it here because
|
||||
|
||||
### Official Support for Ubuntu and CentOS 7
|
||||
|
||||
![][2]
|
||||
|
||||
No matter whether you have a personal or a professional license, you can access the editor if you have Unity 2019.1 installed or later.
|
||||
|
||||
In addition, they are prioritizing the support for Ubuntu 16.04, Ubuntu 18.04, and CentOS 7.
|
||||
|
||||
In their [announcement post][3], they also mentioned the configurations supported:
|
||||
|
||||
* x86-64 architecture
|
||||
* Gnome desktop environment running on top of X11 windowing system
|
||||
* Nvidia official proprietary graphics driver and AMD Mesa graphics driver
|
||||
* Desktop form factors, running on device/hardware without emulation or compatibility layer
|
||||
|
||||
|
||||
|
||||
You can always try on anything else – but it’s better to stick with the official requirements for the best experience.
|
||||
|
||||
A Note on 3rd Party Tools
|
||||
|
||||
If you happen to utilize any 3rd party tool on any of your projects, you will have to separately check whether they support it or not.
|
||||
|
||||
### How to install Unity Editor on Linux
|
||||
|
||||
Now that you know about it – how do you install it?
|
||||
|
||||
To install Unity, you will have to download and install the [Unity Hub][4].
|
||||
|
||||
![Unity Hub][5]
|
||||
|
||||
Let’s walk you through the steps:
|
||||
|
||||
* Download Unity Hub for Linux from the [official forum page][4].
|
||||
* It will download an AppImage file. Simply, make it executable and run it. In case you are not aware of it, you should check out our guide on [how to use AppImage on Linux][6].
|
||||
* Once you launch the Unity Hub, it will ask you to sign in (or sign up) using your Unity ID to activate the licenses. For more info on how the licenses work, do refer to their [FAQ page][7].
|
||||
* After you sign in using your Unity ID, go to the “ **Installs** ” option (as shown in the image above) and add the version/components you want.
|
||||
|
||||
|
||||
|
||||
[][8]
|
||||
|
||||
Suggested read A Modular and Open Source Router is Being Crowdfunded
|
||||
|
||||
That’s it! This is the best way to get all the latest builds and get it installed in a jiffy.
|
||||
|
||||
**Wrapping Up**
|
||||
|
||||
Even though it is an exciting news, the official configuration support does not seem to be an extensive list. If you use it on Linux, do share your feedback and opinion on [their Linux forum thread][9].
|
||||
|
||||
What do you think about that? Also, do you use Unity Hub to install it or did we miss a better method to get it installed?
|
||||
|
||||
Let us know your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/unity-editor-linux/
|
||||
|
||||
作者:[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://unity3d.com/unity/editor
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/Unity-Editor-on-Linux.png?resize=800%2C450&ssl=1
|
||||
[3]: https://blogs.unity3d.com/2019/05/30/announcing-the-unity-editor-for-linux/
|
||||
[4]: https://forum.unity.com/threads/unity-hub-v-1-6-0-is-now-available.640792/
|
||||
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/unity-hub.jpg?fit=800%2C532&ssl=1
|
||||
[6]: https://itsfoss.com/use-appimage-linux/
|
||||
[7]: https://support.unity3d.com/hc/en-us/categories/201268913-Licenses
|
||||
[8]: https://itsfoss.com/turris-mox-router/
|
||||
[9]: https://forum.unity.com/forums/linux-editor.93/
|
||||
126
sources/tech/20190531 Use Firefox Send with ffsend in Fedora.md
Normal file
126
sources/tech/20190531 Use Firefox Send with ffsend in Fedora.md
Normal file
@@ -0,0 +1,126 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Use Firefox Send with ffsend in Fedora)
|
||||
[#]: via: (https://fedoramagazine.org/use-firefox-send-with-ffsend-in-fedora/)
|
||||
[#]: author: (Sylvia Sánchez https://fedoramagazine.org/author/lailah/)
|
||||
|
||||
Use Firefox Send with ffsend in Fedora
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
_ffsend_ is the command line client of Firefox Send. This article will show how Firefox Send and _ffsend_ work. It’ll also detail how it can be installed and used in Fedora.
|
||||
|
||||
### What are Firefox Send and ffsend ?
|
||||
|
||||
Firefox Send is a file sharing tool from Mozilla that allows sending encrypted files to other users. You can install Send on your own server, or use the Mozilla-hosted link [send.firefox.com][2]. The hosted version officially supports files up to 1 GB, and links that expire after a configurable download count (default of 1) or 24 hours, and then all the files on the Send server are deleted. This tool is still _in experimental phase_ , and therefore shouldn’t be used in production or to share important or sensitive data.
|
||||
|
||||
While Firefox Send is the tool itself and can be used with a web interface, _ffsend_ is a command-line utility you can use with scripts and arguments. It has a wide range of configuration options and can be left working in the background without any human intervention.
|
||||
|
||||
### How does it work?
|
||||
|
||||
FFSend can both upload and download files. The remote host can use either the Firefox tool or another web browser to download the file. Neither Firefox Send nor _ffsend_ require the use of Firefox.
|
||||
|
||||
It’s important to highlight that _ffsend_ uses client-side encryption. This means that files are encrypted _before_ they’re uploaded. You share secrets together with the link, so be careful when sharing, because anyone with the link will be able to download the file. As an extra layer of protection, you can protect the file with a password by using the following argument:
|
||||
|
||||
```
|
||||
ffsend password URL -p PASSWORD
|
||||
```
|
||||
|
||||
### Other features
|
||||
|
||||
There are a few other features worth mentioning. Here’s a list:
|
||||
|
||||
* Configurable download limit, between 1 and 20 times, before the link expires
|
||||
* Built-in extract and archiving functions
|
||||
* Track history of shared files
|
||||
* Inspect or delete shared files
|
||||
* Folders can be shared as well, either as they are or as compressed files
|
||||
* Generate a QR code, for easier download on a mobile phone
|
||||
|
||||
|
||||
|
||||
### How to install in Fedora
|
||||
|
||||
While Fedora Send works with Firefox without installing anything extra, you’ll need to install the CLI tool to use _ffsend_. This tool is in the official repositories, so you only need a simple _dnf_ command [with][3] _[sudo][3]_.
|
||||
|
||||
```
|
||||
$ sudo dnf install ffsend
|
||||
```
|
||||
|
||||
After that, you can use _ffsend_ from the terminal .
|
||||
|
||||
### Upload a file
|
||||
|
||||
Uploading a file is a simple as
|
||||
|
||||
```
|
||||
$ ffsend upload /etc/os-release
|
||||
Upload complete
|
||||
Share link: https://send.firefox.com/download/05826227d70b9a4b/#RM_HSBq6kuyeBem8Z013mg
|
||||
```
|
||||
|
||||
The file now can be easily share using the Share link URL.
|
||||
|
||||
## Downloading a file
|
||||
|
||||
Downloading a file is as simple as uploading.
|
||||
|
||||
```
|
||||
$ ffsend download https://send.firefox.com/download/05826227d70b9a4b/#RM_HSBq6kuyeBem8Z013mg
|
||||
Download complete
|
||||
```
|
||||
|
||||
Before downloading a file it might be useful to check if the file exist and get information about it. _ffsend_ provides 2 handy commands for that.
|
||||
|
||||
```
|
||||
$ ffsend exists https://send.firefox.com/download/88a6324e2a99ebb6/#YRJDh8ZDQsnZL2KZIA-PaQ
|
||||
Exists: true
|
||||
Password: false
|
||||
$ ffsend info https://send.firefox.com/download/88a6324e2a99ebb6/#YRJDh8ZDQsnZL2KZIA-PaQ
|
||||
ID: 88a6324e2a99ebb6
|
||||
Downloads: 0 of 1
|
||||
Expiry: 23h59m (86388s
|
||||
```
|
||||
|
||||
## Upload history
|
||||
|
||||
_ffsend_ also provides a way to check the history of the uploads made with the tools. This can be really useful if you upload a lot of files during a scripted tasks for example and you want to keep track of each files download status.
|
||||
|
||||
```
|
||||
$ ffsend history
|
||||
LINK EXPIRY
|
||||
1 https://send.firefox.com/download/#8TJ9QNw 23h59m
|
||||
2 https://send.firefox.com/download/KZIA-PaQ 23h54m
|
||||
```
|
||||
|
||||
## Delete a file
|
||||
|
||||
Another useful feature is the possibility to delete a file.
|
||||
|
||||
```
|
||||
ffsend delete https://send.firefox.com/download/2d9faa7f34bb1478/#phITKvaYBjCGSRI8TJ9QNw
|
||||
```
|
||||
|
||||
Firefox Send is a great service and the _ffsend_ tools makes it really convenient to use from the terminal. More examples and documentation is available on _ffsend_ ‘s [Gitlab repository][4].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/use-firefox-send-with-ffsend-in-fedora/
|
||||
|
||||
作者:[Sylvia Sánchez][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/lailah/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2019/04/firefox-send-816x345.png
|
||||
[2]: http://send.firefox.com/
|
||||
[3]: https://fedoramagazine.org/howto-use-sudo/
|
||||
[4]: https://gitlab.com/timvisee/ffsend
|
||||
96
sources/tech/20190531 Why translation platforms matter.md
Normal file
96
sources/tech/20190531 Why translation platforms matter.md
Normal file
@@ -0,0 +1,96 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why translation platforms matter)
|
||||
[#]: via: (https://opensource.com/article/19/5/translation-platforms)
|
||||
[#]: author: (Jean-Baptiste Holcroft https://opensource.com/users/jibec/users/annegentle/users/bcotton)
|
||||
|
||||
Why translation platforms matter
|
||||
======
|
||||
Technical considerations are not the best way to judge a good
|
||||
translation platform.
|
||||
![][1]
|
||||
|
||||
Language translation enables open source software to be used by people all over the world, and it's a great way for non-developers to get involved in their favorite projects. There are many [translation tools][2] available that you can evaluate according to how well they handle the main functional areas involved in translations: technical interaction capabilities, teamwork support capabilities, and translation support capabilities.
|
||||
|
||||
Technical interaction considerations include:
|
||||
|
||||
* Supported file formats
|
||||
* Synchronization with the source repository
|
||||
* Automation support tools
|
||||
* Interface possibilities
|
||||
|
||||
|
||||
|
||||
Support for teamwork (which could also be called "community animation") includes how a platform:
|
||||
|
||||
* Monitors changes (by a translator, on a project, etc.)
|
||||
* Follows up on updates pushed by projects
|
||||
* Displays the state of the situation
|
||||
* Enables or not review and validation steps
|
||||
* Assists in discussions between translators (from the same team and inter-languages) and with project maintainers
|
||||
* Supports global communication on the platform (news, etc.)
|
||||
|
||||
|
||||
|
||||
Translator assistance includes:
|
||||
|
||||
* A clear and ergonomic interface
|
||||
* A limited number of steps to find a project and start working
|
||||
* A simple way to read the flow between translation and distribution
|
||||
* Access to a translation memory machine
|
||||
* Glossary enrichment
|
||||
|
||||
|
||||
|
||||
There are no major differences, though there are some minor ones, between source code management platforms relating to the first two functional areas. ****I suspect that the last area pertains mainly to source code. However, the data handled is quite different and users are usually much less technically sophisticated than developers, as well as more numerous.
|
||||
|
||||
### My recommendation
|
||||
|
||||
In my opinion, the GNOME platform offers the best translation platform for the following reasons:
|
||||
|
||||
* Its site contains both the team organization and the translation platform. It's easy to see who is responsible and their roles on the team. Everything is concentrated on a few screens.
|
||||
* It's easy to find what to work on, and you quickly realize you'll have to download files to your computer and send them back once you modify them. It's not very sexy, but the logic is easy to understand.
|
||||
* Once you send a file back, the platform can send an alert to the mailing list so the team knows the next steps and the translation can be easily discussed at the global level (rather than commenting on specific sentences).
|
||||
* It has 297 languages.
|
||||
* It shows clear percentages on progress, both on basic sentences and advanced menus and documentation.
|
||||
|
||||
|
||||
|
||||
Coupled with a predictable GNOME release schedule, everything is available for the community to work well because the tool promotes community work.
|
||||
|
||||
If we look at the Debian translation team, which has been doing a good job for years translating an unimaginable amount of content for Fedora (especially news), we see there is a highly codified translation process based exclusively on emails with a manual push in the repositories. This team also puts everything into the process, rather than the tools, and—despite the considerable energy this seems to require—it has worked for many years while being among the leading group of languages.
|
||||
|
||||
My perception is that the primary issue for a successful translation platform is not based on the ability to make the unitary (technical, translation) work, but on how it structures and supports the translation team's processes. This is what gives sustainability.
|
||||
|
||||
The production processes are the most important way to structure a team; by putting them together correctly, it's easy for newcomers to understand how processes work, adopt them, and explain them to the next group of newcomers.
|
||||
|
||||
To build a sustainable community, the first consideration must be on a tool that supports collaborative work, then on its usability.
|
||||
|
||||
This explains my frustration with the [Zanata][3] tool, which is efficient from a technical and interface standpoint, but poor when it comes to helping to structure a community. GIven that translation is a community-driven process (possibly one of the most community-driven processes in open source software development), this is a critical problem for me.
|
||||
|
||||
* * *
|
||||
|
||||
_This article is adapted from "[What's a good translation platform?][4]" originally published on the Jibec Journal and is reused with permission._
|
||||
|
||||
Learn about seven tools and processes, both human and software, which are used to manage patch...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/translation-platforms
|
||||
|
||||
作者:[Jean-Baptiste Holcroft][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/jibec/users/annegentle/users/bcotton
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_remote_teams_world.png?itok=_9DCHEel
|
||||
[2]: https://opensource.com/article/17/6/open-source-localization-tools
|
||||
[3]: http://zanata.org/
|
||||
[4]: https://jibecfed.fedorapeople.org/blog-hugo/en/2016/09/whats-a-good-translation-platform/
|
||||
@@ -0,0 +1,44 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How many browser tabs do you usually have open?)
|
||||
[#]: via: (https://opensource.com/article/19/6/how-many-browser-tabs)
|
||||
[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst)
|
||||
|
||||
How many browser tabs do you usually have open?
|
||||
======
|
||||
Plus, get a few tips for browser productivity.
|
||||
![Browser of things][1]
|
||||
|
||||
Here's a potentially loaded question: How many browser tabs do you usually have open at one time? Do you have multiple windows, each with multiple tabs? Or are you a minimalist, and only have a couple of tabs open at once. Another option is to move a 20-tabbed browser window to a different monitor so that it is out of the way while working on a particular task. Does your approach differ between work, personal, and mobile browsers? Is your browser strategy related to your [productivity habits][2]?
|
||||
|
||||
### 4 tips for browser productivity
|
||||
|
||||
1. Know your browser shortcuts to save clicks. Whether you use Firefox or Chrome, there are plenty of keyboard shortcuts to help make switching between tabs and performing certain functions a breeze. For example, Chrome makes it easy to open up a blank Google document. Use the shortcut **"Ctrl + t"** to open a new tab, then type **"doc.new"**. The same can be done for spreadsheets, slides, and forms.
|
||||
2. Organize your most frequent tasks with bookmark folders. When it's time to start a particular task, simply open all of the bookmarks in the folder **(Ctrl + click)** to check it off your list quickly.
|
||||
3. Get the right browser extensions for you. There are thousands of browser extensions out there all claiming to improve productivity. Before you install, make sure you're not just adding more distractions to your screen.
|
||||
4. Reduce screen time by using a timer. It doesn't matter if you use an old-fashioned egg timer or a fancy browser extension. To prevent eye strain, implement the 20/20/20 rule. Every 20 minutes, take a 20-second break from your screen and look at something 20 feet away.
|
||||
|
||||
|
||||
|
||||
Take our poll to share how many browser tabs you like to have open at once. Be sure to tell us about your favorite browser tricks in the comments.
|
||||
|
||||
There are two components of productivity—doing the right things and doing those things efficiently...
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/6/how-many-browser-tabs
|
||||
|
||||
作者:[Lauren Pritchett][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/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things)
|
||||
[2]: https://enterprisersproject.com/article/2019/1/5-time-wasting-habits-break-new-year
|
||||
@@ -0,0 +1,135 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Aging in the open: How this community changed us)
|
||||
[#]: via: (https://opensource.com/open-organization/19/6/four-year-celebration)
|
||||
[#]: author: (Bryan Behrenshausen https://opensource.com/users/bbehrens)
|
||||
|
||||
Aging in the open: How this community changed us
|
||||
======
|
||||
Our community dedicated to exploring open organizational culture and
|
||||
design turns four years old this week.
|
||||
![Browser window with birthday hats and a cake][1]
|
||||
|
||||
A community will always surprise you.
|
||||
|
||||
That's not an easy statement for someone like me to digest. I'm not one for surprises. I revel in predictability. I thrive on consistency.
|
||||
|
||||
A passionate and dedicated community offers few of these comforts. Participating in something like [the open organization community at Opensource.com][2]—which [turns four years old this week][3]—means acquiescing to dynamism, to constant change. Every day brings novelty. Every correspondence is packed with possibility. Every interaction reveals undisclosed pathways.
|
||||
|
||||
To [a certain type of person][4] (me again), it can be downright terrifying.
|
||||
|
||||
But that unrelenting and genuine surprise is the [very source of a community's richness][5], its sheer abundance. If a community is the nucleus of all those reactions that catalyze innovations and breakthroughs, then unpredictability and serendipity are its fuel. I've learned to appreciate it—more accurately, perhaps, to stand in awe of it. Four years ago, when the Opensource.com team heeded [Jim Whitehurst's call][6] to build a space for others to "share your thoughts and opinions… on how you think we can all lead and work better in the future" (see the final page of _The Open Organization_ ), we had little more than a mandate, a platform, and a vision. We'd be an open organization [committed to studying, learning from, and propagating open organizations][7]. The rest was a surprise—or rather, a series of surprises:
|
||||
|
||||
* [Hundreds of articles, reviews, guides, and tutorials][2] on infusing open principles into organizations of all sizes across industries
|
||||
* [A book series][8] spanning five volumes (with [another currently in production][9])
|
||||
* A detailed, comprehensive, community-maintained [definition of the "open organization" concept][10]
|
||||
* A [robust maturity model][11] for anyone seeking to understand how that definition might (or might not) support their own work
|
||||
|
||||
|
||||
|
||||
All of that—everything you see there, [and more][12]—is the work of a community that never stopped conversing, never ceased creating, never failed to outsmart itself. No one could have predicted it. No one could have [planned for it][13]. We simply do our best to keep up with it.
|
||||
|
||||
And after four years the work continues, more focused and impassioned than ever. Remaining involved with this bunch of writers, educators, consultants, coaches, leaders, and mentors—all united by their belief that openness is the surest source of hope for organizations struggling to address the challenges of our age—has made me appreciate the power of the utterly surprising. I'm even getting a little more comfortable with it.
|
||||
|
||||
That's been its gift to me. But the gifts it has given each of its participants have been equally special.
|
||||
|
||||
As we celebrate four years of challenges, collaboration, and camaraderie this week, let's recount those surprising gifts by hearing from some of the members:
|
||||
|
||||
* * *
|
||||
|
||||
Four years of the open organization community—congratulations to all!
|
||||
|
||||
My first thought was to look at the five most-read articles over the past four years. Here they are:
|
||||
|
||||
* [5 laws every aspiring DevOps engineer should know][14]
|
||||
* [What value do you bring to your company?][15]
|
||||
* [8 answers to management questions from an open point of view][16]
|
||||
* [What to do when you're feeling underutilized][17]
|
||||
* [What's the point of DevOps?][18]
|
||||
|
||||
|
||||
|
||||
All great articles. And then I started to think: Of all the great content over the past four years, which articles have impacted me the most?
|
||||
|
||||
I remembered reading several great articles about meetings and how to make them more effective. So I typed "opensource.com meetings" into my search engine, and these two wonderful articles were at the top of the results list:
|
||||
|
||||
* [The secret to better one-on-one meetings][19]
|
||||
* [Time to rethink your team's approach to meetings][20]
|
||||
|
||||
|
||||
|
||||
Articles like that have inspired my favorite open organization management principle, which I've tried to apply and has made a huge difference: All meetings are optional.
|
||||
|
||||
**—Jeff Mackanic, senior director, Marketing, Red Hat**
|
||||
|
||||
* * *
|
||||
|
||||
Being a member of the "open community" has reminded me of the power of getting things done via values and shared purpose without command and control—something that seems more important than ever in today's fragmented and often abusive management world, and at a time when truth and transparency themselves are under attack.
|
||||
|
||||
Four years is a long journey for this kind of initiative—but there's still so much to learn and understand about what makes "open" work and what it will take to accelerate the embrace of its principles more widely through different domains of work and society. Congratulations on all you, your colleagues, partners, and other members of the community have done thus far!
|
||||
|
||||
**—Brook Manville, Principal, Brook Manville LLC, author of _A Company of Citizens_ and co-author of _The Harvard Business Review Leader's Handbook_**
|
||||
|
||||
* * *
|
||||
|
||||
The Open Organization Ambassador program has, in the last four years, become an inspired community of experts. We have defined what it means to be a truly open organization. We've written books, guides, articles, and other resources for learning about, understanding, and implementing open principles. We've done this while bringing open principles to other communities, and we've done this together.
|
||||
|
||||
For me, personally and professionally, the togetherness is the best part of this endeavor. I have learned so much from my colleagues. I'm absolutely ecstatic to be one of the idealists and activists in this community—committed to making our workplaces more equitable and open.
|
||||
|
||||
**—Laura Hilliger, co-founder, We Are Open Co-Op, and[Open Organization Ambassador][21]**
|
||||
|
||||
* * *
|
||||
|
||||
Finding the open organization community opened me up to knowing that there are others out there who thought as I did. I wasn't alone. My ideas on leadership and the workplace were not crazy. This sense of belonging increased once I joined the Ambassador team. Our monthly meetings are never long enough. I don't like when we have to hang up because each session is full of laughter, sharpening each other, idea exchange, and joy. Humans seek community. We search for people who share values and ideals as we do but who also push back and help us expand. This is the gift of the open organization community—expansion, growth, and lifelong friendships. Thank you to all of those who contribute their time, intellect, content, and whole self to this awesome think tank that is changing the shape of how we organize to solve problems!
|
||||
|
||||
**—Jen Kelchner, founder and Chief Change Architect, LDR21, and[Open Organization Ambassador][21]**
|
||||
|
||||
* * *
|
||||
|
||||
Happy fourth birthday, open organization community! Thank you for being an ever-present reminder in my life that being open is better than being closed, that listening is more fruitful than telling, and that together we can achieve more.
|
||||
|
||||
**—Michael Doyle, professional coach and[Open Organization Ambassador][21]**
|
||||
|
||||
* * *
|
||||
|
||||
Wow, what a journey it's been exploring the world of open organizations. We're seeing more interest now than ever before. It's amazing to see what this community has done and I'm excited to see what the future holds for open organizations and open leadership.
|
||||
|
||||
**—Jason Hibbets, senior community architect, Red Hat**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/open-organization/19/6/four-year-celebration
|
||||
|
||||
作者:[Bryan Behrenshausen][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/bbehrens
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/happy_birthday_anniversary_celebrate_hats_cake.jpg?itok=Zfsv6DE_ (Browser window with birthday hats and a cake)
|
||||
[2]: https://opensource.com/open-organization
|
||||
[3]: https://opensource.com/open-organization/15/5/introducing-open-organization
|
||||
[4]: https://opensource.com/open-organization/18/11/design-communities-personality-types
|
||||
[5]: https://opensource.com/open-organization/18/1/why-build-community-1
|
||||
[6]: https://www.redhat.com/en/explore/the-open-organization-book
|
||||
[7]: https://opensource.com/open-organization/resources/ambassadors-program
|
||||
[8]: https://opensource.com/open-organization/resources/book-series
|
||||
[9]: https://opensource.com/open-organization/19/5/educators-guide-project
|
||||
[10]: https://opensource.com/open-organization/resources/open-org-definition
|
||||
[11]: https://opensource.com/open-organization/resources/open-org-maturity-model
|
||||
[12]: https://opensource.com/open-organization/resources
|
||||
[13]: https://opensource.com/open-organization/19/2/3-misconceptions-agile
|
||||
[14]: https://opensource.com/open-organization/17/5/5-devops-laws
|
||||
[15]: https://opensource.com/open-organization/15/7/what-value-do-you-bring-your-company
|
||||
[16]: https://opensource.com/open-organization/16/5/open-questions-and-answers-about-open-management
|
||||
[17]: https://opensource.com/open-organization/17/4/feeling-underutilized
|
||||
[18]: https://opensource.com/open-organization/17/5/what-is-the-point-of-DevOps
|
||||
[19]: https://opensource.com/open-organization/18/5/open-one-on-one-meetings-guide
|
||||
[20]: https://opensource.com/open-organization/18/3/open-approaches-meetings
|
||||
[21]: https://opensource.com/open-organization/resources/meet-ambassadors
|
||||
224
sources/tech/20190604 Create a CentOS homelab in an hour.md
Normal file
224
sources/tech/20190604 Create a CentOS homelab in an hour.md
Normal file
@@ -0,0 +1,224 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Create a CentOS homelab in an hour)
|
||||
[#]: via: (https://opensource.com/article/19/6/create-centos-homelab-hour)
|
||||
[#]: author: (Bob Murphy https://opensource.com/users/murph)
|
||||
|
||||
Create a CentOS homelab in an hour
|
||||
======
|
||||
Set up a self-sustained set of basic Linux servers with nothing more
|
||||
than a system with virtualization software, a CentOS ISO, and about an
|
||||
hour of your time.
|
||||
![metrics and data shown on a computer screen][1]
|
||||
|
||||
When working on new Linux skills (or, as I was, studying for a Linux certification), it is helpful to have a few virtual machines (VMs) available on your laptop so you can do some learning on the go.
|
||||
|
||||
But what happens if you are working somewhere without a good internet connection and you want to work on a web server? What about using other software that you don't already have installed? If you were depending on downloading it from the distribution's repositories, you may be out of luck. With a bit of preparation, you can set up a [homelab][2] that will allow you to install anything you need wherever you are, with or without a network connection.
|
||||
|
||||
The requirements are:
|
||||
|
||||
* A downloaded ISO file of the Linux distribution you intend to use (for example, CentOS, Red Hat, etc.)
|
||||
* A host computer with virtualization. I use [Fedora][3] with [KVM][4] and [virt-manager][5], but any Linux will work similarly. You could even use Windows or Mac with virtualization, with some difference in implementation
|
||||
* About an hour of time
|
||||
|
||||
|
||||
|
||||
### 1\. Create a VM for your repo host
|
||||
|
||||
Use virt-manager to create a VM with modest specs; 1GB RAM, one CPU, and 16GB of disk space are plenty.
|
||||
|
||||
Install [CentOS 7][6] on the VM.
|
||||
|
||||
![Installing a CentOS homelab][7]
|
||||
|
||||
Select your language and continue.
|
||||
|
||||
Click _Installation Destination_ , select your local disk, mark the _Automatically Configure Partitioning_ checkbox, and click *Done *in the upper-left corner.
|
||||
|
||||
Under _Software Selection_ , select _Infrastructure Server_ , mark the _FTP Server_ checkbox, and click _Done_.
|
||||
|
||||
![Installing a CentOS homelab][8]
|
||||
|
||||
Select _Network and Host Name_ , enable Ethernet in the upper-right, then click _Done_ in the upper-left corner.
|
||||
|
||||
Click _Begin Installation_ to start installing the OS.
|
||||
|
||||
You must create a root password, then you can create a user with a password as it installs.
|
||||
|
||||
### 2\. Start the FTP service
|
||||
|
||||
The next step is to start and set the FTP service to run and allow it through the firewall.
|
||||
|
||||
Log in with your root password, then start the FTP server:
|
||||
|
||||
|
||||
```
|
||||
`systemctl start vsftpd`
|
||||
```
|
||||
|
||||
Enable it to work on every start:
|
||||
|
||||
|
||||
```
|
||||
`systemctl enable vsftpd`
|
||||
```
|
||||
|
||||
Set the port as allowed through the firewall:
|
||||
|
||||
|
||||
```
|
||||
`firewall-cmd --add-service=ftp --perm`
|
||||
```
|
||||
|
||||
Enable this change immediately:
|
||||
|
||||
|
||||
```
|
||||
`firewall-cmd --reload`
|
||||
```
|
||||
|
||||
Get your IP address:
|
||||
|
||||
|
||||
```
|
||||
`ip a`
|
||||
```
|
||||
|
||||
(it's probably **eth0** ). You'll need it in a minute.
|
||||
|
||||
### 3\. Copy the files for your local repository
|
||||
|
||||
Mount the CD you installed from to your VM through your virtualization software.
|
||||
|
||||
Create a directory for the CD to be mounted to temporarily:
|
||||
|
||||
|
||||
```
|
||||
`mkdir /root/temp`
|
||||
```
|
||||
|
||||
Mount the install CD:
|
||||
|
||||
|
||||
```
|
||||
`mount /dev/cdrom /root/temp`
|
||||
```
|
||||
|
||||
Copy all the files to the FTP server directory:
|
||||
|
||||
|
||||
```
|
||||
`rsync -avhP /root/temp/ /var/ftp/pub/`
|
||||
```
|
||||
|
||||
### 4\. Point the server to the local repository
|
||||
|
||||
Red Hat-based systems use files that end in **.repo** to identify where to get updates and new software. Those files can be found at
|
||||
|
||||
|
||||
```
|
||||
`cd /etc/yum.repos.d`
|
||||
```
|
||||
|
||||
You need to get rid of the repo files that point your server to look to the CentOS repositories on the internet. I prefer to copy them to root's home directory to get them out of the way:
|
||||
|
||||
|
||||
```
|
||||
`mv * ~`
|
||||
```
|
||||
|
||||
Then create a new repo file to point to your server. Use your favorite text editor to create a file named **network.repo** with the following lines (substituting the IP address you got in step 2 for _< your IP>_), then save it:
|
||||
|
||||
|
||||
```
|
||||
[network]
|
||||
name=network
|
||||
baseurl=<ftp://192.168.122.\><your ip>/pub
|
||||
gpgcheck=0
|
||||
```
|
||||
|
||||
When that's done, we can test it out with the following:
|
||||
|
||||
|
||||
```
|
||||
`yum clean all; yum install ftp`
|
||||
```
|
||||
|
||||
If your FTP client installs as expected from the "network" repository, your local repo is set up!
|
||||
|
||||
![Installing a CentOS homelab][9]
|
||||
|
||||
### 5\. Install a new VM with the repository you set up
|
||||
|
||||
Go back to the virtual machine manager, and create another VM—but this time, select _Network Install_ with a URL of:
|
||||
|
||||
|
||||
```
|
||||
`ftp://192.168.122.<your IP>/pub`
|
||||
```
|
||||
|
||||
If you're using a different host OS or virtualization manager, install your VM similarly as before, and skip to the next section.
|
||||
|
||||
### 6\. Set the new VM to use your existing network repository
|
||||
|
||||
You can copy the repo file from your existing server to use here.
|
||||
|
||||
As in the first server example, enter:
|
||||
|
||||
|
||||
```
|
||||
cd /etc/yum.repos.d
|
||||
mv * ~
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
|
||||
```
|
||||
`scp root@192.168.122.<your IP>:/etc/yum.repos.d/network.repo /etc/yum.repos.d`
|
||||
```
|
||||
|
||||
Now you should be ready to work with your new VM and get all your software from your local repository.
|
||||
|
||||
Test this again:
|
||||
|
||||
|
||||
```
|
||||
`yum clean all; yum install screen`
|
||||
```
|
||||
|
||||
This will install your software from your local repo server.
|
||||
|
||||
This setup, which gives you independence from the network with the ability to install software, can create a much more dependable environment for expanding your skills on the road.
|
||||
|
||||
* * *
|
||||
|
||||
_Bob Murphy will present this topic as well as an introduction to[GNU Screen][10] at [Southeast Linux Fest][11], June 15-16 in Charlotte, N.C._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/6/create-centos-homelab-hour
|
||||
|
||||
作者:[Bob Murphy][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/murph
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen)
|
||||
[2]: https://opensource.com/article/19/3/home-lab
|
||||
[3]: https://getfedora.org/
|
||||
[4]: https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine
|
||||
[5]: https://virt-manager.org/
|
||||
[6]: https://www.centos.org/download/
|
||||
[7]: https://opensource.com/sites/default/files/uploads/homelab-3b_0.png (Installing a CentOS homelab)
|
||||
[8]: https://opensource.com/sites/default/files/uploads/homelab-5b.png (Installing a CentOS homelab)
|
||||
[9]: https://opensource.com/sites/default/files/uploads/homelab-14b.png (Installing a CentOS homelab)
|
||||
[10]: https://opensource.com/article/17/3/introduction-gnu-screen
|
||||
[11]: https://southeastlinuxfest.org/
|
||||
@@ -0,0 +1,103 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (ExamSnap Guide: 6 Excellent Resources for Microsoft 98-366: Networking Fundamentals Exam)
|
||||
[#]: via: (https://www.2daygeek.com/examsnap-guide-6-excellent-resources-for-microsoft-98-366-networking-fundamentals-exam/)
|
||||
[#]: author: (2daygeek http://www.2daygeek.com/author/2daygeek/)
|
||||
|
||||
ExamSnap Guide: 6 Excellent Resources for Microsoft 98-366: Networking Fundamentals Exam
|
||||
======
|
||||
|
||||
The Microsoft 98-366 exam is almost similar to the CompTIA Network+ certification test when it comes to its content.
|
||||
|
||||
It is also known as Networking Fundamentals, and its purpose is to assess your knowledge of switches, routers, OSI models, wide area and local area networks, wireless networking, and IP addressing.
|
||||
|
||||
Those who pass the exam earn the MTA (Microsoft Technology Associate) certificate. This certifications an ideal entry-level credential to help you begin your IT career.
|
||||
|
||||
### 6 Resources for Microsoft MTA 98-366 Exam
|
||||
|
||||
Using approved training materials is the best method to prepare for your certification exam. Most candidates are fond of shortcuts and often use PDFs and brain dumps to prepare for the test.
|
||||
|
||||
It is important to note that these materials need additional study methods. They will not help you gain better knowledge that is meant to make you perform better at work.
|
||||
|
||||
When you take your time to master the course contents of a certification exam, you are not only getting ready for the test but also developing your skills, expertise, and knowledge in the topics covered there.
|
||||
|
||||
* **[ExamSnap][1]**
|
||||
|
||||
|
||||
|
||||
Another important point to note is that you shouldn’t rely only on brain dumps. Microsoft can withhold or withdraw your certification if it is discovered that you have cheated.
|
||||
|
||||
This may also result in the situation when a person is not allowed to earn the credentials any more. Thus, use only verified platforms such as Examsnap.
|
||||
|
||||
Most people tend to believe that there is no way they can get discovered. However, you need to know that Microsoft has been offering professional certification exams for years and they know what they are doing.
|
||||
|
||||
Now when we have established the importance of using legal materials to prepare for your certification exam, we need to highlight the top resources you can use to prepare for the Microsoft 98-366 test.
|
||||
|
||||
### 1\. Microsoft Video Academy
|
||||
|
||||
The MVA (Microsoft Video Academy) provides you with introductory lessons on the 98-366 certification exam.This is not sufficient for your study although it is a great way to begin your preparation for the test. The materials in the video do not cover everything you need to know before taking the exam.
|
||||
|
||||
In fact, it is introductory series that is meant to lay down the foundation for your study. You will have to explore other materials for you to get an in-depth knowledge of the topics.
|
||||
|
||||
These videos are available without payment, so you can easily access them and use whenever you want.
|
||||
|
||||
* [Microsoft Certification Overview][2]
|
||||
|
||||
|
||||
|
||||
### 2\. Examsnap
|
||||
|
||||
If you have been looking for material that can help you prepare for the Microsoft Networking Fundamentals exam, look no further because you will know about Examsnap now.
|
||||
|
||||
It is an online platform that provides you with exam dumps and video series of various certification courses. All you need to do is to register on the website and pay a fee for you to be able to access various tools that will help you prepare for the test.
|
||||
|
||||
Examsnap will enable you to pass your exams with confidence by providing you with the most accurate and comprehensive preparation materials on the Internet. The platform also has training courses to help you improve your study.
|
||||
|
||||
Before making any payment on the site, you can complete the trial course to establish whether the site is suitable for your exam preparation needs.
|
||||
|
||||
### 3\. Exam 98-366: MTA Networking Fundamentals
|
||||
|
||||
This is a study resource that is a book. It provides you with a comprehensive approach to the various topics. It is important for you to note that this study guide is critical to your success.
|
||||
|
||||
It offers you more detailed material than the introductory lectures by the MVA. It is advisable that you do not focus on the sample questions in each part when using this book.
|
||||
|
||||
You should not concentrate on the sample questions because they are not so informative. You can make up for this shortcoming by checking out other practice test options. Overall, this book is a top resource that will contribute greatly to your certification exam success.
|
||||
|
||||
### 4\. Measure-Up
|
||||
|
||||
Measure-Up is the official Microsoft practice test provider whereby you can access different materials. You can get a lab and hands-on practice with networking software tools, which are very beneficial for your preparation. The site also has study questions that you can purchase.
|
||||
|
||||
### 5\. U-Certify
|
||||
|
||||
The U-Certify platform is a reputable organization that offers video courses that are considered to be more understandable than those offered by the MVA. In addition to video courses, the site presents flashcards at the end of the videos.
|
||||
|
||||
You can also access a series of practice tests, which contain several hundreds of study questions on the platform. There are more contents in videos and tests that you can access the moment you subscribe. Depending on what you are looking for, you can choose to buy the tests or the videos.
|
||||
|
||||
### 6\. Networking Essentials – Wiki
|
||||
|
||||
There are several posts that are linked to the Networking Essentials page on Wiki, and you can be sure that these articles are greatly detailed with information that will be helpful for your exam preparation.
|
||||
|
||||
It is important to note that they are not meant to be studied as the only resource materials. You should only use them as additional means for the purpose of getting more information on specific topics but not as an individual study tool.
|
||||
|
||||
### Conclusion
|
||||
|
||||
You may not be able to access all the top resources available. However, you can access some of them. In addition to the resources mentioned, there are also some others that are very good. Visit the Microsoft official website to get the list of reliable resource platforms you can use. Study and be well-prepared for the 98-366 certification exam!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/examsnap-guide-6-excellent-resources-for-microsoft-98-366-networking-fundamentals-exam/
|
||||
|
||||
作者:[2daygeek][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: http://www.2daygeek.com/author/2daygeek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.examsnap.com/
|
||||
[2]: https://www.microsoft.com/en-us/learning/certification-overview.aspx
|
||||
@@ -0,0 +1,174 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Four Ways To Install Security Updates On Red Hat (RHEL) And CentOS Systems?)
|
||||
[#]: via: (https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Four Ways To Install Security Updates On Red Hat (RHEL) And CentOS Systems?
|
||||
======
|
||||
|
||||
Patching of the Linux server is one of important and routine task of Linux admin.
|
||||
|
||||
Keeping the system with latest patch level is must. It protects your system against unnecessary attack.
|
||||
|
||||
There are three kind of erratas available in the RHEL/CentOS repository, these are Security, Bug Fix and Product Enhancement.
|
||||
|
||||
Now, you have two options to handle this.
|
||||
|
||||
Either install only security updates or all the errata packages.
|
||||
|
||||
We have already written an article in the past **[to check available security updates?][1]**.
|
||||
|
||||
Also, **[check the installed security updates on your system][2]** using this link.
|
||||
|
||||
You can navigate to the above link, if you would like to verify available security updates before installing them.
|
||||
|
||||
In this article, we will show your, how to install security updates in multiple ways on RHEL and CentOS system.
|
||||
|
||||
### 1) How To Install Entire Errata Updates In Red Hat And CentOS System?
|
||||
|
||||
Run the following command to download and apply all available security updates on your system.
|
||||
|
||||
Make a note, this command will install the last available version of any package with at least one security errata.
|
||||
|
||||
Also, install non-security erratas if they provide a more updated version of the package.
|
||||
|
||||
```
|
||||
# yum update --security
|
||||
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
RHEL7-Server-DVD | 4.3 kB 00:00:00
|
||||
rhel-7-server-rpms | 2.0 kB 00:00:00
|
||||
--> 1:grub2-tools-extra-2.02-0.76.el7.1.x86_64 from rhel-7-server-rpms removed (updateinfo)
|
||||
--> nss-pem-1.0.3-5.el7_6.1.x86_64 from rhel-7-server-rpms removed (updateinfo)
|
||||
.
|
||||
35 package(s) needed (+0 related) for security, out of 115 available
|
||||
Resolving Dependencies
|
||||
--> Running transaction check
|
||||
---> Package NetworkManager.x86_64 1:1.12.0-6.el7 will be updated
|
||||
---> Package NetworkManager.x86_64 1:1.12.0-10.el7_6 will be an update
|
||||
```
|
||||
|
||||
Once you ran the above command, it will check all the available updates and its dependency satisfaction.
|
||||
|
||||
```
|
||||
--> Finished Dependency Resolution
|
||||
--> Running transaction check
|
||||
---> Package kernel.x86_64 0:3.10.0-514.26.1.el7 will be erased
|
||||
---> Package kernel-devel.x86_64 0:3.10.0-514.26.1.el7 will be erased
|
||||
--> Finished Dependency Resolution
|
||||
|
||||
Dependencies Resolved
|
||||
=====================================================================================================================================================================
|
||||
Package Arch Version Repository Size
|
||||
=====================================================================================================================================================================
|
||||
Installing:
|
||||
kernel x86_64 3.10.0-957.10.1.el7 rhel-7-server-rpms 48 M
|
||||
kernel-devel x86_64 3.10.0-957.10.1.el7 rhel-7-server-rpms 17 M
|
||||
Updating:
|
||||
NetworkManager x86_64 1:1.12.0-10.el7_6 rhel-7-server-rpms 1.7 M
|
||||
NetworkManager-adsl x86_64 1:1.12.0-10.el7_6 rhel-7-server-rpms 157 k
|
||||
.
|
||||
Removing:
|
||||
kernel x86_64 3.10.0-514.26.1.el7 @rhel-7-server-rpms 148 M
|
||||
kernel-devel x86_64 3.10.0-514.26.1.el7 @rhel-7-server-rpms 34 M
|
||||
```
|
||||
|
||||
If these dependencies were satisfied, which finally gives you a total summary about it.
|
||||
|
||||
The transaction summary shows, how many packages will be getting Installed, upgraded and removed from the system.
|
||||
|
||||
```
|
||||
Transaction Summary
|
||||
=====================================================================================================================================================================
|
||||
Install 2 Packages
|
||||
Upgrade 33 Packages
|
||||
Remove 2 Packages
|
||||
|
||||
Total download size: 124 M
|
||||
Is this ok [y/d/N]:
|
||||
```
|
||||
|
||||
### How To Install Only Security Updates In Red Hat And CentOS System?
|
||||
|
||||
Run the following command to install only the packages that have a security errata.
|
||||
|
||||
```
|
||||
# yum update-minimal --security
|
||||
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock
|
||||
rhel-7-server-rpms | 2.0 kB 00:00:00
|
||||
Resolving Dependencies
|
||||
--> Running transaction check
|
||||
---> Package NetworkManager.x86_64 1:1.12.0-6.el7 will be updated
|
||||
---> Package NetworkManager.x86_64 1:1.12.0-8.el7_6 will be an update
|
||||
.
|
||||
--> Finished Dependency Resolution
|
||||
--> Running transaction check
|
||||
---> Package kernel.x86_64 0:3.10.0-514.26.1.el7 will be erased
|
||||
---> Package kernel-devel.x86_64 0:3.10.0-514.26.1.el7 will be erased
|
||||
--> Finished Dependency Resolution
|
||||
|
||||
Dependencies Resolved
|
||||
=====================================================================================================================================================================
|
||||
Package Arch Version Repository Size
|
||||
=====================================================================================================================================================================
|
||||
Installing:
|
||||
kernel x86_64 3.10.0-957.10.1.el7 rhel-7-server-rpms 48 M
|
||||
kernel-devel x86_64 3.10.0-957.10.1.el7 rhel-7-server-rpms 17 M
|
||||
Updating:
|
||||
NetworkManager x86_64 1:1.12.0-8.el7_6 rhel-7-server-rpms 1.7 M
|
||||
NetworkManager-adsl x86_64 1:1.12.0-8.el7_6 rhel-7-server-rpms 157 k
|
||||
.
|
||||
Removing:
|
||||
kernel x86_64 3.10.0-514.26.1.el7 @rhel-7-server-rpms 148 M
|
||||
kernel-devel x86_64 3.10.0-514.26.1.el7 @rhel-7-server-rpms 34 M
|
||||
|
||||
Transaction Summary
|
||||
=====================================================================================================================================================================
|
||||
Install 2 Packages
|
||||
Upgrade 33 Packages
|
||||
Remove 2 Packages
|
||||
|
||||
Total download size: 124 M
|
||||
Is this ok [y/d/N]:
|
||||
```
|
||||
|
||||
### How To Install Security Update Using CVE reference In Red Hat And CentOS System?
|
||||
|
||||
If you would like to install a security update using a CVE reference, run the following command.
|
||||
|
||||
```
|
||||
# yum update --cve
|
||||
|
||||
# yum update --cve CVE-2008-0947
|
||||
```
|
||||
|
||||
### How To Install Security Update Using Specific Advisory In Red Hat And CentOS System?
|
||||
|
||||
Run the following command, if you want to apply only a specific advisory.
|
||||
|
||||
```
|
||||
# yum update --advisory=
|
||||
|
||||
# yum update --advisory=RHSA-2014:0159
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/
|
||||
[2]: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/
|
||||
@@ -0,0 +1,169 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How To Verify NTP Setup (Sync) is Working or Not In Linux?)
|
||||
[#]: via: (https://www.2daygeek.com/check-verify-ntp-sync-is-working-or-not-in-linux-using-ntpq-ntpstat-timedatectl/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
How To Verify NTP Setup (Sync) is Working or Not In Linux?
|
||||
======
|
||||
|
||||
NTP stand for Network Time Protocol, which synchronize the clock between computer systems over the network.
|
||||
|
||||
NTP server keep all the servers in your organization in-sync with an accurate time to perform time based jobs.
|
||||
|
||||
NTP client will synchronize its clock to the network time server.
|
||||
|
||||
We had already wrote an article about NTP Server and Client installation and configuration.
|
||||
|
||||
If you would like to check these article, navigate to the following links.
|
||||
|
||||
* **[How To Install And Configure NTP Server And NTP Client In Linux?][1]**
|
||||
* **[How To Install And Configure Chrony As NTP Client?][2]**
|
||||
|
||||
|
||||
|
||||
I assume that we have already setup NTP server and NTP client using the above links.
|
||||
|
||||
Now, how to verify whether the NTP setup is working correctly or not?
|
||||
|
||||
There are three commands available in Linux to validate the NTP sync. The details are below. In this article, we will tell you, how to verify NTP sync using all these commands.
|
||||
|
||||
* **`ntpq:`** ntpq is standard NTP query program.
|
||||
* **`ntpstat:`** It shows network time synchronization status.
|
||||
* **`timedatectl:`** It controls the system time and date in systemd system.
|
||||
|
||||
|
||||
|
||||
### Method-1: How To Check NTP Status Using ntpq Command?
|
||||
|
||||
The ntpq utility program is used to monitor NTP daemon ntpd operations and determine performance.
|
||||
|
||||
The program can be run either in interactive mode or controlled using command line arguments.
|
||||
|
||||
It prints a list of peers that connected by sending multiple queries to the server.
|
||||
|
||||
If NTP is working properly, you will be getting the output similar to below.
|
||||
|
||||
```
|
||||
# ntpq -p
|
||||
|
||||
remote refid st t when poll reach delay offset jitter
|
||||
==============================================================================
|
||||
*CentOS7.2daygee 133.243.238.163 2 u 14 64 37 0.686 0.151 16.432
|
||||
```
|
||||
|
||||
**Details:**
|
||||
|
||||
* **-p:** Print a list of the peers known to the server as well as a summary of their state.
|
||||
|
||||
|
||||
|
||||
### Method-2: How To Check NTP Status Using ntpstat Command?
|
||||
|
||||
ntpstat will report the synchronisation state of the NTP daemon (ntpd) running on the local machine.
|
||||
|
||||
If the local system is found to be synchronised to a reference time source, ntpstat will report the approximate time accuracy.
|
||||
|
||||
The ntpstat command returns three kind of status code based on the NTP sync. The details are below.
|
||||
|
||||
* **`0:`**` ` It returns 0 if clock is synchronised.
|
||||
* **`1:`**` ` It returns 1 if clock is not synchronised.
|
||||
* **`2:`**` ` It returns 2 if clock state is indeterminant, for example if ntpd is not contactable.
|
||||
|
||||
|
||||
|
||||
```
|
||||
# ntpstat
|
||||
|
||||
synchronised to NTP server (192.168.1.8) at stratum 3
|
||||
time correct to within 508 ms
|
||||
polling server every 64 s
|
||||
```
|
||||
|
||||
### Method-3: How To Check NTP Status Using timedatectl Command?
|
||||
|
||||
**[timedatectl Command][3]** is used to query and change the system clock and its settings in systmed system.
|
||||
|
||||
```
|
||||
# timedatectl
|
||||
or
|
||||
# timedatectl status
|
||||
|
||||
Local time: Thu 2019-05-30 05:01:05 CDT
|
||||
Universal time: Thu 2019-05-30 10:01:05 UTC
|
||||
RTC time: Thu 2019-05-30 10:01:05
|
||||
Time zone: America/Chicago (CDT, -0500)
|
||||
NTP enabled: yes
|
||||
NTP synchronized: yes
|
||||
RTC in local TZ: no
|
||||
DST active: yes
|
||||
Last DST change: DST began at
|
||||
Sun 2019-03-10 01:59:59 CST
|
||||
Sun 2019-03-10 03:00:00 CDT
|
||||
Next DST change: DST ends (the clock jumps one hour backwards) at
|
||||
Sun 2019-11-03 01:59:59 CDT
|
||||
Sun 2019-11-03 01:00:00 CST
|
||||
```
|
||||
|
||||
### Bonus Tips:
|
||||
|
||||
Chrony is replacement of NTP client.
|
||||
|
||||
It can synchronize the system clock faster with better time accuracy and it can be particularly useful for the systems which are not online all the time.
|
||||
|
||||
chronyd is smaller, it uses less memory and it wakes up the CPU only when necessary, which is better for power saving.
|
||||
|
||||
It can perform well even when the network is congested for longer periods of time.
|
||||
|
||||
You can use any of the below commands to check Chrony status.
|
||||
|
||||
To check chrony tracking status.
|
||||
|
||||
```
|
||||
# chronyc tracking
|
||||
|
||||
Reference ID : C0A80105 (CentOS7.2daygeek.com)
|
||||
Stratum : 3
|
||||
Ref time (UTC) : Thu Mar 28 05:57:27 2019
|
||||
System time : 0.000002545 seconds slow of NTP time
|
||||
Last offset : +0.001194361 seconds
|
||||
RMS offset : 0.001194361 seconds
|
||||
Frequency : 1.650 ppm fast
|
||||
Residual freq : +184.101 ppm
|
||||
Skew : 2.962 ppm
|
||||
Root delay : 0.107966967 seconds
|
||||
Root dispersion : 1.060455322 seconds
|
||||
Update interval : 2.0 seconds
|
||||
Leap status : Normal
|
||||
```
|
||||
|
||||
Run the sources command to displays information about the current time sources.
|
||||
|
||||
```
|
||||
# chronyc sources
|
||||
|
||||
210 Number of sources = 1
|
||||
MS Name/IP address Stratum Poll Reach LastRx Last sample
|
||||
===============================================================================
|
||||
^* CentOS7.2daygeek.com 2 6 17 62 +36us[+1230us] +/- 1111ms
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/check-verify-ntp-sync-is-working-or-not-in-linux-using-ntpq-ntpstat-timedatectl/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/install-configure-ntp-server-ntp-client-in-linux/
|
||||
[2]: https://www.2daygeek.com/configure-ntp-client-using-chrony-in-linux/
|
||||
[3]: https://www.2daygeek.com/change-set-time-date-and-timezone-on-linux/
|
||||
@@ -0,0 +1,178 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Linux Shell Script To Monitor CPU Utilization And Send Email)
|
||||
[#]: via: (https://www.2daygeek.com/linux-shell-script-to-monitor-cpu-utilization-usage-and-send-email/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Linux Shell Script To Monitor CPU Utilization And Send Email
|
||||
======
|
||||
|
||||
There are many opensource monitoring tools are available to monitor Linux systems performance.
|
||||
|
||||
It will send an email alert when the system reaches the given threshold limit.
|
||||
|
||||
It monitors everything such as CPU utilization, Memory utilization, swap utilization, disk space utilization and much more.
|
||||
|
||||
If you only have few systems and want to monitor them then writing a small shell script can achieve this.
|
||||
|
||||
In this tutorial we have added two shell script to monitor CPU utilization on Linux system.
|
||||
|
||||
When the system reaches the given threshold then it will trigger a mail to corresponding email id.
|
||||
|
||||
### Method-1 : Linux Shell Script To Monitor CPU Utilization And Send an Email
|
||||
|
||||
If you want to only get CPU utilization percentage through mail when the system reaches the given threshold, use the following script.
|
||||
|
||||
This is very simple and straightforward and one line script.
|
||||
|
||||
It will trigger an email when your system reaches `80%` CPU utilization.
|
||||
|
||||
```
|
||||
*/5 * * * * /usr/bin/cat /proc/loadavg | awk '{print $1}' | awk '{ if($1 > 80) printf("Current CPU Utilization is: %.2f%\n"), $0;}' | mail -s "High CPU Alert" [email protected]
|
||||
```
|
||||
|
||||
**Note:** You need to change the email id instead of ours. Also, you can change the CPU utilization threshold value as per your requirement.
|
||||
|
||||
**Output:** You will be getting an email alert similar to below.
|
||||
|
||||
```
|
||||
Current CPU Utilization is: 80.40%
|
||||
```
|
||||
|
||||
We had added many useful shell scripts in the past. If you want to check those, navigate to the below link.
|
||||
|
||||
* **[How to automate day to day activities using shell scripts?][1]**
|
||||
|
||||
|
||||
|
||||
### Method-2 : Linux Shell Script To Monitor CPU Utilization And Send an Email
|
||||
|
||||
If you want to get more information about the CPU utilization in the mail alert.
|
||||
|
||||
Then use the following script, which includes top CPU utilization process details based on the top Command and ps Command.
|
||||
|
||||
This will inconstantly gives you an idea what is going on your system.
|
||||
|
||||
It will trigger an email when your system reaches `80%` CPU utilization.
|
||||
|
||||
**Note:** You need to change the email id instead of ours. Also, you can change the CPU utilization threshold value as per your requirement.
|
||||
|
||||
```
|
||||
# vi /opt/scripts/cpu-alert.sh
|
||||
|
||||
#!/bin/bash
|
||||
cpuuse=$(cat /proc/loadavg | awk '{print $1}')
|
||||
|
||||
if [ "$cpuuse" > 80 ]; then
|
||||
|
||||
SUBJECT="ATTENTION: CPU Load Is High on $(hostname) at $(date)"
|
||||
|
||||
MESSAGE="/tmp/Mail.out"
|
||||
|
||||
TO="[email protected]"
|
||||
|
||||
echo "CPU Current Usage is: $cpuuse%" >> $MESSAGE
|
||||
|
||||
echo "" >> $MESSAGE
|
||||
|
||||
echo "+------------------------------------------------------------------+" >> $MESSAGE
|
||||
|
||||
echo "Top CPU Process Using top command" >> $MESSAGE
|
||||
|
||||
echo "+------------------------------------------------------------------+" >> $MESSAGE
|
||||
|
||||
echo "$(top -bn1 | head -20)" >> $MESSAGE
|
||||
|
||||
echo "" >> $MESSAGE
|
||||
|
||||
echo "+------------------------------------------------------------------+" >> $MESSAGE
|
||||
|
||||
echo "Top CPU Process Using ps command" >> $MESSAGE
|
||||
|
||||
echo "+------------------------------------------------------------------+" >> $MESSAGE
|
||||
|
||||
echo "$(ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10)" >> $MESSAGE
|
||||
|
||||
mail -s "$SUBJECT" "$TO" < $MESSAGE
|
||||
|
||||
rm /tmp/Mail.out
|
||||
|
||||
fi
|
||||
```
|
||||
|
||||
Finally add a **[cronjob][2]** to automate this. It will run every 5 minutes.
|
||||
|
||||
```
|
||||
# crontab -e
|
||||
*/10 * * * * /bin/bash /opt/scripts/cpu-alert.sh
|
||||
```
|
||||
|
||||
**Note:** You will be getting an email alert 5 mins later since the script has scheduled to run every 5 minutes (But it's not exactly 5 mins and it depends the timing).
|
||||
|
||||
Say for example. If your system reaches the limit at 8.25 then you will get an email alert in another 5 mins. Hope it's clear now.
|
||||
|
||||
**Output:** You will be getting an email alert similar to below.
|
||||
|
||||
```
|
||||
CPU Current Usage is: 80.51%
|
||||
|
||||
+------------------------------------------------------------------+
|
||||
Top CPU Process Using top command
|
||||
+------------------------------------------------------------------+
|
||||
top - 13:23:01 up 1:43, 1 user, load average: 2.58, 2.58, 1.51
|
||||
Tasks: 306 total, 3 running, 303 sleeping, 0 stopped, 0 zombie
|
||||
%Cpu0 : 6.2 us, 6.2 sy, 0.0 ni, 87.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu1 : 18.8 us, 0.0 sy, 0.0 ni, 81.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu2 : 50.0 us, 37.5 sy, 0.0 ni, 12.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu3 : 5.9 us, 5.9 sy, 0.0 ni, 88.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu4 : 0.0 us, 5.9 sy, 0.0 ni, 94.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu5 : 29.4 us, 23.5 sy, 0.0 ni, 47.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu6 : 0.0 us, 5.9 sy, 0.0 ni, 94.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
%Cpu7 : 5.9 us, 0.0 sy, 0.0 ni, 94.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
|
||||
KiB Mem : 16248588 total, 223436 free, 5816924 used, 10208228 buff/cache
|
||||
KiB Swap: 17873388 total, 17871340 free, 2048 used. 7440884 avail Mem
|
||||
|
||||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
||||
8867 daygeek 20 2743884 440420 360952 R 100.0 2.7 1:07.25 /usr/lib/virtualbox/VirtualBoxVM --comment CentOS7 --startvm 002f47b8-2af2-48f5-be1d-67b67e03514c --no-startvm-errormsgbox
|
||||
9119 daygeek 20 36136 784 R 46.7 0.0 0:00.07 /usr/bin/CROND -n
|
||||
1057 daygeek 20 889808 487692 461692 S 13.3 3.0 4:21.12 /usr/lib/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3
|
||||
3098 daygeek 20 1929012 351412 120532 S 13.3 2.2 16:42.51 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -prefsLen 9236 -prefMapSize 184485 -parentBuildID 20190521202118 -greomni /us+
|
||||
1 root 20 188820 10144 7708 S 6.7 0.1 0:06.92 /sbin/init
|
||||
818 gdm 20 199836 25120 15876 S 6.7 0.2 0:01.85 /usr/lib/Xorg vt1 -displayfd 3 -auth /run/user/120/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -verbose 3
|
||||
1170 daygeek 9 -11 2676516 16516 12520 S 6.7 0.1 1:28.30 /usr/bin/pulseaudio --daemonize=no
|
||||
8271 root 20 I 6.7 0:00.21 [kworker/u16:4-i915]
|
||||
9117 daygeek 20 13528 4036 3144 R 6.7 0.0 0:00.01 top -bn1
|
||||
|
||||
+------------------------------------------------------------------+
|
||||
Top CPU Process Using ps command
|
||||
+------------------------------------------------------------------+
|
||||
%CPU PID USER COMMAND
|
||||
8.8 8522 daygeek /usr/lib/virtualbox/VirtualBox
|
||||
86.2 8867 daygeek /usr/lib/virtualbox/VirtualBoxVM --comment CentOS7 --startvm 002f47b8-2af2-48f5-be1d-67b67e03514c --no-startvm-errormsgbox
|
||||
76.1 8921 daygeek /usr/lib/virtualbox/VirtualBoxVM --comment Ubuntu-18.04 --startvm e8c32dbb-8b01-41b0-977a-bf28b9db1117 --no-startvm-errormsgbox
|
||||
5.5 8080 daygeek /usr/bin/nautilus --gapplication-service
|
||||
4.7 4575 daygeek /usr/lib/firefox/firefox -contentproc -childID 12 -isForBrowser -prefsLen 9375 -prefMapSize 184485 -parentBuildID 20190521202118 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1525 true tab
|
||||
4.4 3511 daygeek /usr/lib/firefox/firefox -contentproc -childID 8 -isForBrowser -prefsLen 9308 -prefMapSize 184485 -parentBuildID 20190521202118 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1525 true tab
|
||||
4.4 3190 daygeek /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 9237 -prefMapSize 184485 -parentBuildID 20190521202118 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1525 true tab
|
||||
4.4 1612 daygeek /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 184485 -parentBuildID 20190521202118 -greomni /usr/lib/firefox/omni.ja -appomni /usr/lib/firefox/browser/omni.ja -appdir /usr/lib/firefox/browser 1525 true tab
|
||||
4.2 3565 daygeek /usr/bin/../lib/notepadqq/notepadqq-bin
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/linux-shell-script-to-monitor-cpu-utilization-usage-and-send-email/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/category/shell-script/
|
||||
[2]: https://www.2daygeek.com/crontab-cronjob-to-schedule-jobs-in-linux/
|
||||
@@ -0,0 +1,170 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Two Methods To Check Or List Installed Security Updates on Redhat (RHEL) And CentOS System)
|
||||
[#]: via: (https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Two Methods To Check Or List Installed Security Updates on Redhat (RHEL) And CentOS System
|
||||
======
|
||||
|
||||
We had wrote two articles in the past about this topic and each articles were published for different requirements.
|
||||
|
||||
If you would like to check those articles before getting into this topic.
|
||||
|
||||
Navigate to the following links.
|
||||
|
||||
* **[How To Check Available Security Updates On Red Hat (RHEL) And CentOS System?][1]**
|
||||
* **[Four Ways To Install Security Updates On Red Hat (RHEL) And CentOS Systems?][2]**
|
||||
|
||||
|
||||
|
||||
These articles are interlinked one with others so, better to read them before digging into this.
|
||||
|
||||
In this article, we will show you, how to check installed security updates.
|
||||
|
||||
I have add two methods to achieve this and you can choose which one is best and suitable for you.
|
||||
|
||||
Also, i added a small shell script, that gives you a summary about installed security packages count.
|
||||
|
||||
Run the following command to get a list of the installed security updates on your system.
|
||||
|
||||
```
|
||||
# yum updateinfo list security installed
|
||||
|
||||
Loaded plugins: changelog, package_upload, product-id, search-disabled-repos,
|
||||
: subscription-manager, verify, versionlock
|
||||
RHSA-2015:2315 Moderate/Sec. ModemManager-glib-1.1.0-8.git20130913.el7.x86_64
|
||||
RHSA-2015:2315 Moderate/Sec. NetworkManager-1:1.0.6-27.el7.x86_64
|
||||
RHSA-2016:2581 Low/Sec. NetworkManager-1:1.4.0-12.el7.x86_64
|
||||
RHSA-2017:2299 Moderate/Sec. NetworkManager-1:1.8.0-9.el7.x86_64
|
||||
RHSA-2015:2315 Moderate/Sec. NetworkManager-adsl-1:1.0.6-27.el7.x86_64
|
||||
RHSA-2016:2581 Low/Sec. NetworkManager-adsl-1:1.4.0-12.el7.x86_64
|
||||
RHSA-2017:2299 Moderate/Sec. NetworkManager-adsl-1:1.8.0-9.el7.x86_64
|
||||
RHSA-2015:2315 Moderate/Sec. NetworkManager-bluetooth-1:1.0.6-27.el7.x86_64
|
||||
```
|
||||
|
||||
To count the number of installed security packages, run the following command.
|
||||
|
||||
```
|
||||
# yum updateinfo list security installed | wc -l
|
||||
1046
|
||||
```
|
||||
|
||||
To print only install packages list.
|
||||
|
||||
```
|
||||
# yum updateinfo list security all | grep -w "i"
|
||||
|
||||
i RHSA-2015:2315 Moderate/Sec. ModemManager-glib-1.1.0-8.git20130913.el7.x86_64
|
||||
i RHSA-2015:2315 Moderate/Sec. NetworkManager-1:1.0.6-27.el7.x86_64
|
||||
i RHSA-2016:2581 Low/Sec. NetworkManager-1:1.4.0-12.el7.x86_64
|
||||
i RHSA-2017:2299 Moderate/Sec. NetworkManager-1:1.8.0-9.el7.x86_64
|
||||
i RHSA-2015:2315 Moderate/Sec. NetworkManager-adsl-1:1.0.6-27.el7.x86_64
|
||||
i RHSA-2016:2581 Low/Sec. NetworkManager-adsl-1:1.4.0-12.el7.x86_64
|
||||
i RHSA-2017:2299 Moderate/Sec. NetworkManager-adsl-1:1.8.0-9.el7.x86_64
|
||||
i RHSA-2015:2315 Moderate/Sec. NetworkManager-bluetooth-1:1.0.6-27.el7.x86_64
|
||||
i RHSA-2016:2581 Low/Sec. NetworkManager-bluetooth-1:1.4.0-12.el7.x86_64
|
||||
i RHSA-2017:2299 Moderate/Sec. NetworkManager-bluetooth-1:1.8.0-9.el7.x86_64
|
||||
i RHSA-2015:2315 Moderate/Sec. NetworkManager-config-server-1:1.0.6-27.el7.x86_64
|
||||
i RHSA-2016:2581 Low/Sec. NetworkManager-config-server-1:1.4.0-12.el7.x86_64
|
||||
i RHSA-2017:2299 Moderate/Sec. NetworkManager-config-server-1:1.8.0-9.el7.noarch
|
||||
```
|
||||
|
||||
To count the number of installed security packages, run the following command.
|
||||
|
||||
```
|
||||
# yum updateinfo list security all | grep -w "i" | wc -l
|
||||
1043
|
||||
```
|
||||
|
||||
Alternatively, you can check the list of vulnerabilities had fixed against the given package.
|
||||
|
||||
In this example, we are going to check the list of vulnerabilities had fixed in the “openssh” package.
|
||||
|
||||
```
|
||||
# rpm -q --changelog openssh | grep -i CVE
|
||||
|
||||
- Fix for CVE-2017-15906 (#1517226)
|
||||
- CVE-2015-8325: privilege escalation via user's PAM environment and UseLogin=yes (#1329191)
|
||||
- CVE-2016-1908: possible fallback from untrusted to trusted X11 forwarding (#1298741)
|
||||
- CVE-2016-3115: missing sanitisation of input for X11 forwarding (#1317819)
|
||||
- prevents CVE-2016-0777 and CVE-2016-0778
|
||||
- Security fixes released with openssh-6.9 (CVE-2015-5352) (#1247864)
|
||||
- only query each keyboard-interactive device once (CVE-2015-5600) (#1245971)
|
||||
- add new option GSSAPIEnablek5users and disable using ~/.k5users by default CVE-2014-9278
|
||||
- prevent a server from skipping SSHFP lookup - CVE-2014-2653 (#1081338)
|
||||
- change default value of MaxStartups - CVE-2010-5107 (#908707)
|
||||
- CVE-2010-4755
|
||||
- merged cve-2007_3102 to audit patch
|
||||
- fixed audit log injection problem (CVE-2007-3102)
|
||||
- CVE-2006-5794 - properly detect failed key verify in monitor (#214641)
|
||||
- CVE-2006-4924 - prevent DoS on deattack detector (#207957)
|
||||
- CVE-2006-5051 - don't call cleanups from signal handler (#208459)
|
||||
- use fork+exec instead of system in scp - CVE-2006-0225 (#168167)
|
||||
```
|
||||
|
||||
Similarly, you can check whether the given vulnerability is fixed or not in the corresponding package by running the following command.
|
||||
|
||||
```
|
||||
# rpm -q --changelog openssh | grep -i CVE-2016-3115
|
||||
|
||||
- CVE-2016-3115: missing sanitisation of input for X11 forwarding (#1317819)
|
||||
```
|
||||
|
||||
### How To Count Installed Security Packages Using Shell Script?
|
||||
|
||||
I have added a small shell script, which helps you to count the list of installed security packages.
|
||||
|
||||
```
|
||||
# vi /opt/scripts/security-check.sh
|
||||
|
||||
#!/bin/bash
|
||||
echo "+-------------------------+"
|
||||
echo "|Security Advisories Count|"
|
||||
echo "+-------------------------+"
|
||||
for i in Important Moderate Low
|
||||
do
|
||||
sec=$(yum updateinfo list security installed | grep $i | wc -l)
|
||||
echo "$i: $sec"
|
||||
done | column -t
|
||||
echo "+-------------------------+"
|
||||
```
|
||||
|
||||
Set an executable permission to `security-check.sh` file.
|
||||
|
||||
```
|
||||
$ chmod +x security-check.sh
|
||||
```
|
||||
|
||||
Finally run the script to achieve this.
|
||||
|
||||
```
|
||||
# sh /opt/scripts/security-check.sh
|
||||
|
||||
+-------------------------+
|
||||
|Security Advisories Count|
|
||||
+-------------------------+
|
||||
Important: 480
|
||||
Moderate: 410
|
||||
Low: 111
|
||||
+-------------------------+
|
||||
```
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/
|
||||
[2]: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/
|
||||
@@ -0,0 +1,158 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Using Testinfra with Ansible to verify server state)
|
||||
[#]: via: (https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state)
|
||||
[#]: author: (Clement Verna https://opensource.com/users/cverna/users/paulbischoff/users/dcritch/users/cobiacomm/users/wgarry155/users/kadinroob/users/koreyhilpert)
|
||||
|
||||
使用 Testinfra 和 Ansible 验证服务器状态
|
||||
======
|
||||
Testinfra 是一个功能强大的库,可用于编写测试来验证基础设施的状态。另外与 Ansible 和 Nagios 相结合,提供了一个用于架构即代码 (IaC) 的简单解决方案。
|
||||
![Terminal command prompt on orange background][1]
|
||||
|
||||
根据设计,[Ansible][2] 传递机器的期望状态,以确保 Ansible playbook 或角色的内容部署到目标机器上。但是,如果你需要确保所有基础架构更改都在 Ansible 中,该怎么办?或者随时验证服务器的状态?
|
||||
|
||||
[Testinfra][3] 是一个基础架构测试框架,它可以轻松编写单元测试来验证服务器的状态。它是一个 Python 库,使用强大的 [pytest][4] 测试引擎。
|
||||
|
||||
### 开始使用 Testinfra
|
||||
|
||||
可以使用 Python 包管理器 (pip) 和 Python 虚拟环境轻松安装 Testinfra。
|
||||
|
||||
|
||||
```
|
||||
$ python3 -m venv venv
|
||||
$ source venv/bin/activate
|
||||
(venv) $ pip install testinfra
|
||||
```
|
||||
|
||||
Testinfra 也可以使用 EPEL 仓库的 Fedora 和 CentOS 中使用。例如,在 CentOS 7 上,你可以使用以下命令安装它:
|
||||
|
||||
|
||||
```
|
||||
$ yum install -y epel-release
|
||||
$ yum install -y python-testinfra
|
||||
```
|
||||
|
||||
#### 一个简单的测试脚本
|
||||
|
||||
在 Testinfra 中编写测试很容易。使用你选择的代码编辑器,将以下内容添加到名为 **test_simple.py** 的文件中:
|
||||
|
||||
|
||||
```
|
||||
import testinfra
|
||||
|
||||
def test_os_release(host):
|
||||
assert host.file("/etc/os-release").contains("Fedora")
|
||||
|
||||
def test_sshd_inactive(host):
|
||||
assert host.service("sshd").is_running is False
|
||||
```
|
||||
|
||||
默认情况下,Testinfra 为测试用例提供了一个主机对象,该对象能访问不同的辅助模块。例如,第一个测试使用 **file** 模块来验证主机上文件的内容,第二个测试用例使用 **service** 模块来检查 systemd 服务的状态。
|
||||
|
||||
要在本机运行这些测试,请执行以下命令:
|
||||
|
||||
|
||||
```
|
||||
(venv)$ pytest test_simple.py
|
||||
================================ test session starts ================================
|
||||
platform linux -- Python 3.7.3, pytest-4.4.1, py-1.8.0, pluggy-0.9.0
|
||||
rootdir: /home/cverna/Documents/Python/testinfra
|
||||
plugins: testinfra-3.0.0
|
||||
collected 2 items
|
||||
test_simple.py ..
|
||||
|
||||
================================ 2 passed in 0.05 seconds ================================
|
||||
```
|
||||
|
||||
有关 Testinfra API 的完整列表,你可以参考[文档][5]。
|
||||
|
||||
### Testinfra 和 Ansible
|
||||
|
||||
Testinfra 支持的后端之一是 Ansible,这意味着 Testinfra 可以直接使用 Ansible 的 inventory 文件和 inventory 中定义的一组机器来对它们进行测试。
|
||||
|
||||
我们使用以下 inventory 文件作为示例:
|
||||
|
||||
|
||||
```
|
||||
[web]
|
||||
app-frontend01
|
||||
app-frontend02
|
||||
|
||||
[database]
|
||||
db-backend01
|
||||
```
|
||||
|
||||
我们希望确保我们的 Apache Web 服务器在 **app-frontend01** 和 **app-frontend02** 上运行。让我们在名为 **test_web.py** 的文件中编写测试:
|
||||
|
||||
|
||||
```
|
||||
def check_httpd_service(host):
|
||||
"""Check that the httpd service is running on the host"""
|
||||
assert host.service("httpd").is_running
|
||||
```
|
||||
|
||||
要使用 Testinfra 和 Ansible 运行此测试,请使用以下命令:
|
||||
|
||||
|
||||
```
|
||||
(venv) $ pip install ansible
|
||||
(venv) $ py.test --hosts=web --ansible-inventory=inventory --connection=ansible test_web.py
|
||||
```
|
||||
|
||||
在调用测试时,我们使用 Ansible inventory 的 **[web]** 组作为目标计算机,并指定我们要使用 Ansible 作为连接后端。
|
||||
|
||||
#### 使用 Ansible 模块
|
||||
|
||||
Testinfra 还为 Ansible 提供了一个很好的可用于测试的 API。该 Ansible 模块能够在 测试中运行 Ansible play,并且能够轻松检查 play 的状态。
|
||||
|
||||
```
|
||||
def check_ansible_play(host):
|
||||
"""
|
||||
Verify that a package is installed using Ansible
|
||||
package module
|
||||
"""
|
||||
assert not host.ansible("package", "name=httpd state=present")["changed"]
|
||||
```
|
||||
|
||||
B默认情况下,Ansible 的[检查模式][6]已启用,这意味着 Ansible 将报告在远程主机上执行 play 时会发生的变化。
|
||||
|
||||
### Testinfra 和 Nagios
|
||||
|
||||
现在我们可以轻松地运行测试来验证机器的状态,我们可以使用这些测试来触发监控系统上的警报。这是捕获意外更改的好方法。
|
||||
|
||||
Testinfra 提供了与 [Nagios][7] 的集成,它是一种流行的监控解决方案。默认情况下,Nagios 使用 [NRPE][8] 插件对远程主机进行检查,但使用 Testinfra 可以直接从 Nagios master 上运行测试。
|
||||
|
||||
要使 Testinfra 输出与 Nagios 兼容,我们必须在触发测试时使用 **\--nagios** 标志。我们还使用 **-qq** 这个 pytest 标志来启用 pytest 的**静默**模式,这样就不会显示所有测试细节。
|
||||
|
||||
```
|
||||
(venv) $ py.test --hosts=web --ansible-inventory=inventory --connection=ansible --nagios -qq line test.py
|
||||
TESTINFRA OK - 1 passed, 0 failed, 0 skipped in 2.55 seconds
|
||||
```
|
||||
|
||||
Testinfra 是一个功能强大的库,可用于编写测试以验证基础架构的状态。 另外与 Ansible 和 Nagios 相结合,提供了一个用于架构即代码 (IaC) 的简单解决方案。 它也是使用 [Molecule][9] 开发 Ansible 角色过程中添加测试的关键组件。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state
|
||||
|
||||
作者:[Clement Verna][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/cverna/users/paulbischoff/users/dcritch/users/cobiacomm/users/wgarry155/users/kadinroob/users/koreyhilpert
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
||||
[2]: https://www.ansible.com/
|
||||
[3]: https://testinfra.readthedocs.io/en/latest/
|
||||
[4]: https://pytest.org/
|
||||
[5]: https://testinfra.readthedocs.io/en/latest/modules.html#modules
|
||||
[6]: https://docs.ansible.com/ansible/playbooks_checkmode.html
|
||||
[7]: https://www.nagios.org/
|
||||
[8]: https://en.wikipedia.org/wiki/Nagios#NRPE
|
||||
[9]: https://github.com/ansible/molecule
|
||||
69
translated/tech/20190529 NVMe on Linux.md
Normal file
69
translated/tech/20190529 NVMe on Linux.md
Normal file
@@ -0,0 +1,69 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (warmfrog)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (NVMe on Linux)
|
||||
[#]: via: (https://www.networkworld.com/article/3397006/nvme-on-linux.html)
|
||||
[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
|
||||
|
||||
Linux 上的 NVMe
|
||||
===============
|
||||
|
||||
如果你还没注意到,一些极速的固态磁盘技术对于Linux和其他操作系统都是可用的。
|
||||
![Sandra Henry-Stocker][1]
|
||||
|
||||
NVMe 代表“非易失性内存快车”,它是一个主机控制器接口和存储协议,用于加速企业和客户端系统以及固态驱动器(SSD)之间的数据传输。它通过电脑的高速外围组件互联快车总线(PCIe)工作。当我看到这些名词时,我感到“羡慕”。羡慕的原因很重要。
|
||||
|
||||
使用 NVMe,数据传输的速度比旋转磁盘快很多。事实上,NVMe 驱动能够比 SATA SSD 快 7 倍。这比我们今天很多人用的固态硬盘快了 7 倍多。这意味着,如果你用一个 NVMe 驱动盘作为启动盘,你的系统能够启动的非常快。事实上,如今任何人买一个新的系统可能都不会考虑那些没有自带 NVMe 的,不管是服务器或者个人电脑。
|
||||
|
||||
### NVMe 在 Linux 下能工作吗?
|
||||
|
||||
是的!NVMe 自 Linux 内核 3.3 版本就支持了。更新一个系统,然而,通常同时需要一个 NVMe 控制器和一个 NVMe 磁盘。一些外置磁盘也行,但是为了添加到系统中,需要的不仅仅是通用的 USB 接口。
|
||||
|
||||
[MORE ON NETWORK WORLD: Linux: Best desktop distros for newbies][2]
|
||||
|
||||
为了检查内核版本,使用下列命令:
|
||||
|
||||
```
|
||||
$ uname -r
|
||||
5.0.0-15-generic
|
||||
```
|
||||
|
||||
如果你的系统已经用了 NVMe,你将看到一个设备(例如, /dev/nvme0),但是仅在你安装了 NVMe 控制器的情况下。如果你没有,你可以用下列命令获取使用 NVMe 的相关信息。
|
||||
|
||||
```
|
||||
$ modinfo nvme | head -6
|
||||
filename: /lib/modules/5.0.0-15-generic/kernel/drivers/nvme/host/nvme.ko
|
||||
version: 1.0
|
||||
license: GPL
|
||||
author: Matthew Wilcox <willy@linux.intel.com>
|
||||
srcversion: AA383008D5D5895C2E60523
|
||||
alias: pci:v0000106Bd00002003sv*sd*bc*sc*i*
|
||||
```
|
||||
|
||||
### 了解更多
|
||||
|
||||
如果你想了解极速的 NVMe 存储的更多细节,可在 _[PCWorld][3]_ 获取。
|
||||
|
||||
规格,白皮书和其他资源可在 [NVMexpress.org][4] 获取。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3397006/nvme-on-linux.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[warmfrog](https://github.com/warmfrog)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://images.idgesg.net/images/article/2019/05/nvme-100797708-large.jpg
|
||||
[2]: https://www.networkworld.com/slideshow/153439/linux-best-desktop-distros-for-newbies.html#tk.nww-infsb
|
||||
[3]: https://www.pcworld.com/article/2899351/everything-you-need-to-know-about-nvme.html
|
||||
[4]: https://nvmexpress.org/
|
||||
[5]: https://www.facebook.com/NetworkWorld/
|
||||
[6]: https://www.linkedin.com/company/network-world
|
||||
Reference in New Issue
Block a user