mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-21 02:10:11 +08:00
commit
f430d27e3b
202
published/20210412 Scheduling tasks with cron.md
Normal file
202
published/20210412 Scheduling tasks with cron.md
Normal file
@ -0,0 +1,202 @@
|
||||
[#]: subject: "Scheduling tasks with cron"
|
||||
[#]: via: "https://fedoramagazine.org/scheduling-tasks-with-cron/"
|
||||
[#]: author: "Darshna Das https://fedoramagazine.org/author/climoiselle/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-13383-1.html"
|
||||
|
||||
使用 cron 调度任务
|
||||
======
|
||||
|
||||

|
||||
|
||||
cron 是一个调度守护进程,它以指定的时间间隔执行任务,这些任务称为 corn 作业,主要用于自动执行系统维护或管理任务。例如,你可以设置一个 cron 作业来自动执行重复的任务,比如备份数据库或数据,使用最新的安全补丁更新系统,检查磁盘空间使用情况,发送电子邮件等等。 cron 作业可以按分钟、小时、日、月、星期或它们的任意组合运行。
|
||||
|
||||
### cron 的一些优点
|
||||
|
||||
以下是使用 cron 作业的一些优点:
|
||||
|
||||
* 你可以更好地控制作业的运行时间。例如,你可以精确到分钟、小时、天等。
|
||||
* 它消除了为循环任务逻辑而去写代码的需要,当你不再需要执行任务时,可以直接关闭它。
|
||||
* 作业在不执行时不会占用内存,因此你可以节省内存分配。
|
||||
* 如果一个作业执行失败并由于某种原因退出,它将在适当的时间再次运行。
|
||||
|
||||
### 安装 cron 守护进程
|
||||
|
||||
幸运的是,Fedora Linux 预先配置了运行重要的系统任务来保持系统更新,有几个实用程序可以运行任务例如 cron、`anacron`、`at` 和 `batch` 。本文只关注 cron 实用程序的安装。cron 和 cronie 包一起安装,cronie 包也提供 `cron` 服务。
|
||||
|
||||
要确定软件包是否已经存在,使用 `rpm` 命令:
|
||||
|
||||
```
|
||||
$ rpm -q cronie
|
||||
Cronie-1.5.2-4.el8.x86_64
|
||||
```
|
||||
|
||||
如果安装了 cronie ,它将返回 cronie 包的全名。如果你的系统中没有安装,则会显示未安装。
|
||||
|
||||
使用以下命令安装:
|
||||
|
||||
```
|
||||
$ dnf install cronie
|
||||
```
|
||||
|
||||
### 运行 cron 守护进程
|
||||
|
||||
cron 作业由 crond 服务来执行,它会读取配置文件中的信息。在将作业添加到配置文件之前,必须启动 crond 服务,或者安装它。什么是 crond 呢?crond 是 cron 守护程序的简称。要确定 crond 服务是否正在运行,输入以下命令:
|
||||
|
||||
```
|
||||
$ systemctl status crond.service
|
||||
● crond.service - Command Scheduler
|
||||
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor pre>
|
||||
Active: active (running) since Sat 2021-03-20 14:12:35 PDT; 1 day 21h ago
|
||||
Main PID: 1110 (crond)
|
||||
```
|
||||
|
||||
如果你没有看到类似的内容 `Active: active (running) since…`,你需要启动 crond 守护进程。要在当前会话中运行 crond 服务,输入以下命令:
|
||||
|
||||
```
|
||||
$ systemctl run crond.service
|
||||
```
|
||||
|
||||
将其配置为开机自启动,输入以下命令:
|
||||
|
||||
```
|
||||
$ systemctl enable crond.service
|
||||
```
|
||||
|
||||
如果出于某种原因,你希望停止 crond 服务,按以下方式使用 `stop` 命令:
|
||||
|
||||
```
|
||||
$ systemctl stop crond.service
|
||||
```
|
||||
|
||||
要重新启动它,只需使用 `restart` 命令:
|
||||
|
||||
```
|
||||
$ systemctl restart crond.service
|
||||
```
|
||||
|
||||
### 定义一个 cron 作业
|
||||
|
||||
#### cron 配置
|
||||
|
||||
以下是一个 cron 作业的配置细节示例。它定义了一个简单的 cron 作业,将 `git` master 分支的最新更改拉取到克隆的仓库中:
|
||||
|
||||
```
|
||||
*/59 * * * * username cd /home/username/project/design && git pull origin master
|
||||
```
|
||||
|
||||
主要有两部分:
|
||||
|
||||
* 第一部分是 `*/59 * * * *`。这表明计时器设置为第 59 分钟执行一次。(LCTT 译注:原文此处有误。)
|
||||
* 该行的其余部分是命令,因为它将从命令行运行。
|
||||
在此示例中,命令本身包含三个部分:
|
||||
* 作业将以用户 `username` 的身份运行
|
||||
* 它将切换到目录 `/home/username/project/design`
|
||||
* 运行 `git` 命令拉取 master 分支中的最新更改
|
||||
|
||||
#### 时间语法
|
||||
|
||||
如上所述,时间信息是 cron 作业字符串的第一部分,如上所属。它决定了 cron 作业运行的频率和时间。它按以下顺序包括 5 个部分:
|
||||
|
||||
* 分钟
|
||||
* 小时
|
||||
* 一个月中的某天
|
||||
* 月份
|
||||
* 一周中的某天
|
||||
|
||||
下面是一种更图形化的方式来解释语法:
|
||||
|
||||
```
|
||||
.--------------- 分钟 (0 - 59)
|
||||
| .------------- 小时 (0 - 23)
|
||||
| | .---------- 一月中的某天 (1 - 31)
|
||||
| | | .------- 月份 (1 - 12) 或 jan、feb、mar、apr …
|
||||
| | | | .---- 一周中的某天 (0-6) (周日=0 或 7)
|
||||
| | | | | 或 sun、mon、tue、wed、thr、fri、sat
|
||||
| | | | |
|
||||
* * * * * user-name command-to-be-executed
|
||||
```
|
||||
|
||||
#### 星号的使用
|
||||
|
||||
星号(`*`)可以用来替代数字,表示该位置的所有可能值。例如,分钟位置上的星号会使它每分钟运行一次。以下示例可能有助于更好地理解语法。
|
||||
|
||||
这个 cron 作业将每分钟运行一次:
|
||||
|
||||
```
|
||||
* * * * [command]
|
||||
```
|
||||
|
||||
斜杠表示分钟的间隔数。下面的示例将每小时运行 12 次,即每 5 分钟运行一次:
|
||||
|
||||
```
|
||||
*/5 * * * * [command]
|
||||
```
|
||||
|
||||
下一个示例将每月的第二天午夜(例如 1 月 2 日凌晨 12:00,2 月 2 日凌晨 12:00 等等):
|
||||
|
||||
```
|
||||
0 0 2 * * [command]
|
||||
```
|
||||
|
||||
(LCTT 译注:关于 cron 时间格式,还有更多格式符号,此处没有展开)
|
||||
|
||||
#### 使用 crontab 创建一个 cron 作业
|
||||
|
||||
cron 作业会在后台运行,它会不断检查 `/etc/crontab` 文件和 `/etc/cron.*/` 以及 `/var/spool/cron/` 目录。每个用户在 `/var/spool/cron/` 中都有一个唯一的 crontab 文件。
|
||||
|
||||
不应该直接编辑这些 cron 文件。`crontab` 命令是用于创建、编辑、安装、卸载和列出 cron 作业的方法。
|
||||
|
||||
更酷的是,在创建新文件或编辑现有文件后,你无需重新启动 cron。
|
||||
|
||||
```
|
||||
$ crontab -e
|
||||
```
|
||||
|
||||
这将打开你现有的 crontab 文件,或者创建一个。调用 `crontab -e` 时,默认情况下会使用 `vi` 编辑器。注意:要使用 Nano 编辑 crontab 文件,可以设置 `EDITOR=nano` 环境变量。
|
||||
|
||||
使用 `-l` 选项列出所有 cron 作业。如果需要,使用 `-u` 选项指定一个用户。
|
||||
|
||||
```
|
||||
$ crontab -l
|
||||
$ crontab -u username -l
|
||||
```
|
||||
|
||||
使用以下命令删除所有 cron 作业:
|
||||
|
||||
```
|
||||
$ crontab -r
|
||||
```
|
||||
|
||||
要删除特定用户的作业,你必须以 root 用户身份运行以下命令:
|
||||
|
||||
```
|
||||
$ crontab -r -u username
|
||||
```
|
||||
|
||||
感谢你的阅读。cron 作业看起来可能只是系统管理员的工具,但它实际上与许多 Web 应用程序和用户任务有关。
|
||||
|
||||
### 参考
|
||||
|
||||
Fedora Linux 文档的 [自动化任务][4]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/scheduling-tasks-with-cron/
|
||||
|
||||
作者:[Darshna Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/climoiselle/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/03/schedule_with_cron-816x345.jpg
|
||||
[2]: https://unsplash.com/@yomex4life?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/clock?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://docs.fedoraproject.org/en-US/Fedora/12/html/Deployment_Guide/ch-autotasks.html
|
@ -3,23 +3,20 @@
|
||||
[#]: author: (Daniel Schier https://fedoramagazine.org/author/danielwtd/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (ShuyRoy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13382-1.html)
|
||||
|
||||
构建更小的容器
|
||||
如何构建更小的容器
|
||||
======
|
||||
|
||||
![build smaller containers][1]
|
||||

|
||||
|
||||
水獭图片节选自[Dele Oluwayomi][2] 发表在 [Unsplash][3]上的照片
|
||||
|
||||
使用容器工作是很多用户和开发者的日常任务。容器开发者经常需要频繁地(重)构建容器镜像。如果你开发容器,你有想过减小镜像的大小吗?比较小的镜像有一些好处。在下载的时候所需要的带宽更少,而且在云环境中运行的时候也可以节省开销。而且在Fedora [CoreOS][4]、[IoT][5]以及[Silverblue][6]上使用较小的容器镜像提升了整体系统性能,因为这些操作系统严重依赖于容器工作流。这篇文章将会提供一些减小容器镜像大小的技巧。
|
||||
使用容器工作是很多用户和开发者的日常任务。容器开发者经常需要频繁地(重新)构建容器镜像。如果你开发容器,你有想过减小镜像的大小吗?较小的镜像有一些好处。在下载的时候所需要的带宽更少,而且在云环境中运行的时候也可以节省开销。而且在 Fedora [CoreOS][4]、[IoT][5] 以及[Silverblue][6] 上使用较小的容器镜像可以提升整体系统性能,因为这些操作系统严重依赖于容器工作流。这篇文章将会提供一些减小容器镜像大小的技巧。
|
||||
|
||||
### 工具
|
||||
|
||||
以下例子所用到的主机操作系统是Fedora Linux33。例子使用 [Podman][7] 3.1.0 和[Buildah][8] 1.2.0。在大多数Fedora Linux变体中,Podman和Buildah都被预装好了。如果你没有安装Podman和Buildah,可以用下边的命令安装:
|
||||
|
||||
以下例子所用到的主机操作系统是 Fedora Linux 33。例子使用 [Podman][7] 3.1.0 和[Buildah][8] 1.2.0。Podman 和 Buildah 已经预装在大多数 Fedora Linux 变种中。如果你没有安装 Podman 和 Buildah,可以用下边的命令安装:
|
||||
|
||||
```
|
||||
$ sudo dnf install -y podman buildah
|
||||
@ -27,20 +24,18 @@ $ sudo dnf install -y podman buildah
|
||||
|
||||
### 任务
|
||||
|
||||
从一个基础的例子开始。构建一个满足以下需求的web容器。
|
||||
从一个基础的例子开始。构建一个满足以下需求的 web 容器:
|
||||
|
||||
* 容器必须基于Fedora Linux
|
||||
* 使用Apache httpd web 服务器
|
||||
* 容器必须基于 Fedora Linux
|
||||
* 使用 Apache httpd web 服务器
|
||||
* 包含一个定制的网站
|
||||
* 容器应该比较小
|
||||
|
||||
|
||||
|
||||
下边的步骤都是在比较复杂的镜像上进行的。
|
||||
下边的步骤也适用于比较复杂的镜像。
|
||||
|
||||
### 设置
|
||||
|
||||
首先,创建一个工程目录。这个目录将会包含你的网站和容器文件。
|
||||
首先,创建一个工程目录。这个目录将会包含你的网站和容器文件:
|
||||
|
||||
```
|
||||
$ mkdir smallerContainer
|
||||
@ -49,7 +44,7 @@ $ mkdir files
|
||||
$ touch files/index.html
|
||||
```
|
||||
|
||||
制作一个简单的登录页面。对于这个演示,你可以将下面的HTML复制到 _index.html_ 文件中。
|
||||
制作一个简单的登录页面。对于这个演示,你可以将下面的 HTML 复制到 `index.html` 文件中。
|
||||
|
||||
```
|
||||
<!doctype html>
|
||||
@ -100,20 +95,20 @@ $ touch files/index.html
|
||||
</html>
|
||||
```
|
||||
|
||||
此时你可以选择在浏览器中测试上面的 _index.html_ 文件。
|
||||
此时你可以选择在浏览器中测试上面的 `index.html` 文件:
|
||||
|
||||
```
|
||||
$ firefox files/index.html
|
||||
```
|
||||
|
||||
最后,创建一个容器文件。这个文件可以命名为 _Dockerfile_ 或者 _Containerfile_。
|
||||
|
||||
最后,创建一个容器文件。这个文件可以命名为 `Dockerfile` 或者 `Containerfile`:
|
||||
|
||||
```
|
||||
$ touch Containerfile
|
||||
```
|
||||
|
||||
现在你应该有了一个工程目录,并且该目录中的文件系统布局如下。
|
||||
现在你应该有了一个工程目录,并且该目录中的文件系统布局如下:
|
||||
|
||||
```
|
||||
smallerContainer/
|
||||
|- files/
|
||||
@ -124,14 +119,14 @@ smallerContainer/
|
||||
|
||||
### 构建
|
||||
|
||||
现在构建镜像。下边的每个阶段都会添加一层改进来帮助减小镜像的大小。你最终会得到一系列镜像,但只有一个 _Containerfile_ 。
|
||||
现在构建镜像。下边的每个阶段都会添加一层改进来帮助减小镜像的大小。你最终会得到一系列镜像,但只有一个 `Containerfile`。
|
||||
|
||||
#### 阶段0:一个基本的容器镜像
|
||||
#### 阶段 0:一个基本的容器镜像
|
||||
|
||||
你的新镜像将会非常简单,它只包含强制性步骤。在 _Containerfile_ 中添加以下内容。
|
||||
你的新镜像将会非常简单,它只包含强制性步骤。在 `Containerfile` 中添加以下内容:
|
||||
|
||||
```
|
||||
# 使用 Fedora 33作为基镜像
|
||||
# 使用 Fedora 33 作为基镜像
|
||||
FROM registry.fedoraproject.org/fedora:33
|
||||
|
||||
# 安装 httpd
|
||||
@ -140,7 +135,7 @@ RUN dnf install -y httpd
|
||||
# 复制这个网站
|
||||
COPY files/* /var/www/html/
|
||||
|
||||
# 设置端口为80/tcp
|
||||
# 设置端口为 80/tcp
|
||||
EXPOSE 80
|
||||
|
||||
# 启动 httpd
|
||||
@ -149,15 +144,13 @@ CMD ["httpd", "-DFOREGROUND"]
|
||||
|
||||
在上边的文件中有一些注释来解释每一行内容都是在做什么。更详细的步骤:
|
||||
|
||||
1. 在FROM registry.fedoraproject.org/fedora:33 的基础上创建一个构建容器
|
||||
2. 运行命令: _dnf install -y httpd_
|
||||
3. 将与 _Containerfile_ 有关的文件拷贝到容器中
|
||||
4. 设置EXPOSE 80来说明哪个端口是可以自动设置的
|
||||
5. 设置一个CMD指令来说明如果从这个镜像创建一个容器应该运行什么
|
||||
1. 在 `FROM registry.fedoraproject.org/fedora:33` 的基础上创建一个构建容器
|
||||
2. 运行命令: `dnf install -y httpd`
|
||||
3. 将与 `Containerfile` 有关的文件拷贝到容器中
|
||||
4. 设置 `EXPOSE 80` 来说明哪个端口是可以自动设置的
|
||||
5. 设置一个 `CMD` 指令来说明如果从这个镜像创建一个容器应该运行什么
|
||||
|
||||
|
||||
|
||||
运行下边的命令从工程目录创建一个新的镜像。
|
||||
运行下边的命令从工程目录创建一个新的镜像:
|
||||
|
||||
```
|
||||
$ podman image build -f Containerfile -t localhost/web-base
|
||||
@ -174,13 +167,13 @@ registry.fedoraproject.org/fedora 33 9f2a56037643 3 months ago 182 MB
|
||||
|
||||
以上这个例子中展示的镜像在现在占用了467 MB的空间。剩下的阶段将会显著地减小镜像的大小。但是首先要验证镜像是否能够按照预期工作。
|
||||
|
||||
输入以下命令来启动容器。
|
||||
输入以下命令来启动容器:
|
||||
|
||||
```
|
||||
$ podman container run -d --name web-base -P localhost/web-base
|
||||
```
|
||||
|
||||
输入以下命令可以列出你的容器。
|
||||
输入以下命令可以列出你的容器:
|
||||
|
||||
```
|
||||
$ podman container ls
|
||||
@ -188,16 +181,15 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
|
||||
d24063487f9f localhost/web-base httpd -DFOREGROUN... 2 seconds ago Up 3 seconds ago 0.0.0.0:46191->80/tcp web-base
|
||||
```
|
||||
|
||||
以上展示的容器正在运行,它正在监听的端口是 _46191_ 。从运行在主机操作系统上的web浏览器转到 _localhost:46191_ 应该呈现你的web页面。
|
||||
|
||||
以上展示的容器正在运行,它正在监听的端口是 `46191` 。从运行在主机操作系统上的 web 浏览器转到 `localhost:46191` 应该呈现你的 web 页面:
|
||||
|
||||
```
|
||||
$ firefox localhost:46191
|
||||
```
|
||||
|
||||
#### 阶段1:清除缓存并将残余的内容从容器中删除
|
||||
#### 阶段 1:清除缓存并将残余的内容从容器中删除
|
||||
|
||||
为了优化容器镜像的大小,第一步应该总是执行”清理“。这将保证安装和打包所残余的内容都被删掉。这个过程到底需要什么取决于你的容器。对于以上的例子,只需要编辑 _Containerfile_ 让它包含以下几行。
|
||||
为了优化容器镜像的大小,第一步应该总是执行“清理”。这将保证安装和打包所残余的内容都被删掉。这个过程到底需要什么取决于你的容器。对于以上的例子,只需要编辑 `Containerfile` 让它包含以下几行。
|
||||
|
||||
```
|
||||
[...]
|
||||
@ -207,7 +199,7 @@ RUN dnf install -y httpd && \
|
||||
[...]
|
||||
```
|
||||
|
||||
构建修改后的 _Containerfile_ 来显著地减小镜像(这个例子中是237 MB)。
|
||||
构建修改后的 `Containerfile` 来显著地减小镜像(这个例子中是 237 MB)。
|
||||
|
||||
```
|
||||
$ podman image build -f Containerfile -t localhost/web-clean
|
||||
@ -216,11 +208,11 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
localhost/web-clean latest f0f62aece028 6 seconds ago 237 MB
|
||||
```
|
||||
|
||||
#### 阶段2:删除文档和不需要的依赖包
|
||||
#### 阶段 2:删除文档和不需要的依赖包
|
||||
|
||||
许多包在安装时会被建议拉下来,包含一些弱依赖和文档。这些在容器中通常是不需要的,可以删除。 _dnf_ 命令的选项表明了他不需要包含弱依赖或文档。
|
||||
许多包在安装时会被建议拉下来,包含一些弱依赖和文档。这些在容器中通常是不需要的,可以删除。 `dnf` 命令有选项可以表明它不需要包含弱依赖或文档。
|
||||
|
||||
再次编辑 _Containerfile_ ,并在 _dnf install_ 行中添加删除文档和弱依赖的选项:
|
||||
再次编辑 `Containerfile` ,并在 `dnf install` 行中添加删除文档和弱依赖的选项:
|
||||
|
||||
```
|
||||
[...]
|
||||
@ -230,7 +222,7 @@ RUN dnf install -y httpd --nodocs --setopt install_weak_deps=False && \
|
||||
[...]
|
||||
```
|
||||
|
||||
构建经过以上修改后的 _Containerfile_ 可以得到一个更小的镜像(231 MB)。
|
||||
构建经过以上修改后的 `Containerfile` 可以得到一个更小的镜像(231 MB)。
|
||||
|
||||
```
|
||||
$ podman image build -f Containerfile -t localhost/web-docs
|
||||
@ -239,11 +231,11 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
localhost/web-docs latest 8a76820cec2f 8 seconds ago 231 MB
|
||||
```
|
||||
|
||||
#### 阶段3:使用更小的容器基镜像
|
||||
#### 阶段 3:使用更小的容器基镜像
|
||||
|
||||
前面的阶段结合起来,使得示例镜像的大小减少了一半。但是仍然还有一些途径来进一步减小镜像的大小。这个基镜像 _registry.fedoraproject.org/fedora:33_ 是通用的。它提供了一组软件包,许多人希望这些软件包预先安装在他们的Fedora Linux容器中。但是,通用Fedora Linux基镜像中提供的包通常必须要的更多。Fedora工程也为那些希望只从基本包开始,然后只添加所需内容来实现较小总镜像大小的用户提供了一个 _fedora-minimal_ 镜像。
|
||||
前面的阶段结合起来,使得示例镜像的大小减少了一半。但是仍然还有一些途径来进一步减小镜像的大小。这个基镜像 `registry.fedoraproject.org/fedora:33` 是通用的。它提供了一组软件包,许多人希望这些软件包预先安装在他们的 Fedora Linux 容器中。但是,通用的 Fedora Linux 基镜像中提供的包通常必须要的更多。Fedora 项目也为那些希望只从基本包开始,然后只添加所需内容来实现较小总镜像大小的用户提供了一个 `fedora-minimal` 镜像。
|
||||
|
||||
使用 _podman image search_ 来查找 _fedora-minimal_ 镜像如下所示。
|
||||
使用 `podman image search` 来查找 `fedora-minimal` 镜像,如下所示:
|
||||
|
||||
```
|
||||
$ podman image search fedora-minimal
|
||||
@ -251,11 +243,10 @@ INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||
fedoraproject.org registry.fedoraproject.org/fedora-minimal 0
|
||||
```
|
||||
|
||||
_fedora-minimal_ 基镜像不包含[DNF][9],而是倾向于不需要Python的较小的[microDNF][10]。当 _registry.fedoraproject.org/fedora:33_ 被 _registry.fedoraproject.org/fedora-minimal:33_ 替换后,需要用 _microdnf_ 来替换 _dnf_。
|
||||
|
||||
`fedora-minimal` 基镜像不包含 [DNF][9],而是倾向于使用不需要 Python 的较小的 [microDNF][10]。当 `registry.fedoraproject.org/fedora:33` 被 `registry.fedoraproject.org/fedora-minimal:33` 替换后,需要用 `microdnf` 命令来替换 `dnf`。
|
||||
|
||||
```
|
||||
# 使用Fedora minimal 33作为基镜像
|
||||
# 使用 Fedora minimal 33 作为基镜像
|
||||
FROM registry.fedoraproject.org/fedora-minimal:33
|
||||
|
||||
# 安装 httpd
|
||||
@ -263,7 +254,7 @@ RUN microdnf install -y httpd --nodocs --setopt install_weak_deps=0 && \
|
||||
microdnf clean all -y
|
||||
[...]
|
||||
```
|
||||
使用 _fedora-minimal_ 重新构建后的镜像大小如下所示 (169 MB)。
|
||||
使用 `fedora-minimal` 重新构建后的镜像大小如下所示 (169 MB):
|
||||
|
||||
```
|
||||
$ podman image build -f Containerfile -t localhost/web-docs
|
||||
@ -272,14 +263,13 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
localhost/web-minimal latest e1603bbb1097 7 minutes ago 169 MB
|
||||
```
|
||||
|
||||
最开始的镜像大小是**467 MB**。结合以上每个阶段所提到的方法,进行重新构建之后可以得到最终大小为**169 MB**的镜像。最终的 _总_ 镜像大小比最开始的 _基_ 镜像大小小了182 MB!
|
||||
最开始的镜像大小是 **467 MB**。结合以上每个阶段所提到的方法,进行重新构建之后可以得到最终大小为 **169 MB** 的镜像。最终的 _总_ 镜像大小比最开始的 _基_ 镜像小了 182 MB!
|
||||
|
||||
### 从零开始构建容器
|
||||
|
||||
前边的内容使用一个容器文件和Podman来构建一个新的镜像。还有最后一个方法要展示——使用Buildah来从头构建一个容器。Podman使用与Buildah相同的库来构建容器。但是Buildah被认为是一个纯构建工具。Podman被设计来是为了代替Docker的。
|
||||
|
||||
使用Buildah从头构建的容器是空的——它里边什么都 _没有_ 。所有的东西都需要安装或者从容器外拷贝。幸运地是,使用Buildah可以相当简单。下边是一个从头开始构建镜像的小的Bash脚本。除了运行这个脚本,你也可以在终端逐条地运行脚本中的命令,来更好的理解每一步都是做什么的。
|
||||
前边的内容使用一个容器文件和 Podman 来构建一个新的镜像。还有最后一个方法要展示——使用 Buildah 来从头构建一个容器。Podman 使用与 Buildah 相同的库来构建容器。但是 Buildah 被认为是一个纯构建工具。Podman 被设计来是为了代替 Docker 的。
|
||||
|
||||
使用 Buildah 从头构建的容器是空的——它里边什么都 _没有_ 。所有的东西都需要安装或者从容器外复制。幸运地是,使用 Buildah 相当简单。下边是一个从头开始构建镜像的小的 Bash 脚本。除了运行这个脚本,你也可以在终端逐条地运行脚本中的命令,来更好的理解每一步都是做什么的。
|
||||
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
@ -291,7 +281,7 @@ CONTAINER=$(buildah from scratch)
|
||||
# 挂载容器文件系统
|
||||
MOUNTPOINT=$(buildah mount $CONTAINER)
|
||||
|
||||
# 安装一个基本的文件系统和最小的包以及nginx
|
||||
# 安装一个基本的文件系统和最小的包以及 nginx
|
||||
dnf install -y --installroot $MOUNTPOINT --releasever 33 glibc-minimal-langpack httpd --nodocs --setopt install_weak_deps=False
|
||||
|
||||
dnf clean all -y --installroot $MOUNTPOINT --releasever 33
|
||||
@ -305,14 +295,14 @@ buildah copy $CONTAINER 'files/*' '/var/www/html/'
|
||||
# 设置端口为 80/tcp
|
||||
buildah config --port 80 $CONTAINER
|
||||
|
||||
# 启动httpd
|
||||
# 启动 httpd
|
||||
buildah config --cmd "httpd -DFOREGROUND" $CONTAINER
|
||||
|
||||
# 将容器保存为一个镜像
|
||||
buildah commit --squash $CONTAINER web-scratch
|
||||
```
|
||||
|
||||
或者,可以通过将上面的脚本传递给Buildah来构建镜像。注意不需要root权限。
|
||||
或者,可以通过将上面的脚本传递给 Buildah 来构建镜像。注意不需要 root 权限。
|
||||
|
||||
```
|
||||
$ buildah unshare bash web-scratch.sh
|
||||
@ -321,13 +311,12 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
localhost/web-scratch latest acca45fc9118 9 seconds ago 155 MB
|
||||
```
|
||||
|
||||
最后的镜像只有**155 MB**!而且[攻击面][11]也减少了。甚至在最后的镜像中都没有安装DNF(或者microDNF)。
|
||||
最后的镜像只有 **155 MB**!而且 [攻击面][11] 也减少了。甚至在最后的镜像中都没有安装 DNF(或者 microDNF)。
|
||||
|
||||
### 结论
|
||||
|
||||
构建一个比较小的容器镜像有许多优点。减少所需要的带宽、磁盘占用以及攻击面,都会得到更好的镜像。只用很少的更改来减小镜像的大小很简单。许多更改都可以在不改变结果镜像的功能下完成。
|
||||
|
||||
|
||||
只保存所需的二进制文件和配置文件来构建非常小的镜像也是可能的。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -337,7 +326,7 @@ via: https://fedoramagazine.org/build-smaller-containers/
|
||||
作者:[Daniel Schier][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[ShuyRoy](https://github.com/Shuyroy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,26 +3,24 @@
|
||||
[#]: author: (Maurizio Garcia https://fedoramagazine.org/author/malgnuz/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (DCOLIVERSUN)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13379-1.html)
|
||||
|
||||
用 NetworkManager 配置 WireGuard 虚拟私有网络
|
||||
======
|
||||
|
||||
![wireguard][1]
|
||||
|
||||
照片由[High Treason][3]节选自[Thin Ethernet Ramble (TS 10:38)][2]
|
||||

|
||||
|
||||
<ruby>虚拟私有网络<rt>Virtual Private Networks</rt></ruby>应用广泛。如今有各种方案可供使用,用户可通过这些方案访问任意类型的资源,同时保持其机密性与隐私性。
|
||||
|
||||
最近,WireGuard 因为其简单性、速度与安全性成为最广泛使用的虚拟私有网络协议之一。WireGuard 最早应用于 Linux 内核,但目前可以用在其他平台,例如 iOS、Android 等。
|
||||
|
||||
WireGuard 使用 UDP 作为其传输协议,基于 Critokey Routing (CKR) 建立对等节点之间的通信。服务器或客户端的每一个对等节点都有一对<ruby>密钥<rt>key</rt></ruby>(公钥与私钥),公钥与许可 IP 间建立通信连接。有关 WireGuard 更多信息请访问[主页][4]。
|
||||
WireGuard 使用 UDP 作为其传输协议,并在 Critokey Routing(CKR)的基础上建立对等节点之间的通信。每个对等节点(无论是服务器或客户端)都有一对<ruby>密钥<rt>key</rt></ruby>(公钥与私钥),公钥与许可 IP 间建立通信连接。有关 WireGuard 更多信息请访问其 [主页][4]。
|
||||
|
||||
本文描述了如何在两个对等方——PeerA 与 PeerB——间设置 WireGuard。两个节点均运行 Fedora Linux 系统,使用 NetworkManager 为持久性配置。
|
||||
本文描述了如何在两个对等节点(PeerA 与 PeerB)间设置 WireGuard。两个节点均运行 Fedora Linux 系统,使用 NetworkManager 进行持久性配置。
|
||||
|
||||
## **WireGuard 设置与网络配置**
|
||||
### WireGuard 设置与网络配置
|
||||
|
||||
在 PeerA 与 PeerB 之间建立持久性虚拟私有网络连接只需三步:
|
||||
|
||||
@ -30,36 +28,34 @@ WireGuard 使用 UDP 作为其传输协议,基于 Critokey Routing (CKR) 建
|
||||
2. 生成<ruby>密钥对<rt>key pair</rt></ruby>。
|
||||
3. 配置 WireGuard 接口。
|
||||
|
||||
### **安装**
|
||||
### 安装
|
||||
|
||||
在两个对等节点(PeerA 与 PeerB)上安装 _wireguard-tools_ 软件包:
|
||||
在两个对等节点(PeerA 与 PeerB)上安装 `wireguard-tools` 软件包:
|
||||
|
||||
```
|
||||
$ sudo -i
|
||||
# dnf -y install wireguard-tools
|
||||
```
|
||||
|
||||
这个包可以从 Fedora Linux 更新库中找到。它在 _/etc/wireguard/_ 中创建一个配置目录。在这里你将创建密钥和接口配置文件。
|
||||
这个包可以从 Fedora Linux 更新库中找到。它在 `/etc/wireguard/` 中创建一个配置目录。在这里你将创建密钥和接口配置文件。
|
||||
|
||||
### **生成密钥对**
|
||||
### 生成密钥对
|
||||
|
||||
现在,使用 _wg_ 工具在每个节点上生成公钥与私钥:
|
||||
现在,使用 `wg` 工具在每个节点上生成公钥与私钥:
|
||||
|
||||
```
|
||||
# cd /etc/wireguard
|
||||
# wg genkey | tee privatekey | wg pubkey > publickey
|
||||
```
|
||||
|
||||
### **在 PeerA 上配置 WireGuard 接口**
|
||||
### 在 PeerA 上配置 WireGuard 接口
|
||||
|
||||
WireGuard 接口命名规则为 _wg0_、_wg1_等等。完成下述步骤为 WireGuard 接口创建配置:
|
||||
WireGuard 接口命名规则为 `wg0`、`wg1` 等等。完成下述步骤为 WireGuard 接口创建配置:
|
||||
|
||||
* PeerA 节点上配置想要的 IP 地址与 MASK。
|
||||
* PeerA 节点上配置想要的 IP 地址与掩码。
|
||||
* 该节点监听的 UDP 端口。
|
||||
* PeerA 的私钥。
|
||||
|
||||
|
||||
|
||||
```
|
||||
# cat << EOF > /etc/wireguard/wg0.conf
|
||||
[Interface]
|
||||
@ -74,7 +70,7 @@ AllowedIPs = 172.16.1.2/32
|
||||
EOF
|
||||
```
|
||||
|
||||
节点监听端口的许可 UDP 流量:
|
||||
允许 UDP 流量通过节点监听的端口:
|
||||
|
||||
```
|
||||
# firewall-cmd --add-port=60001/udp --permanent --zone=public
|
||||
@ -82,14 +78,14 @@ EOF
|
||||
success
|
||||
```
|
||||
|
||||
最后,将接口配置文件导入 NetworkManager。因此,WireGuard 接口在重启后将持续存在。
|
||||
最后,将接口配置文件导入 NetworkManager。这样,WireGuard 接口在重启后将持续存在。
|
||||
|
||||
```
|
||||
# nmcli con import type wireguard file /etc/wireguard/wg0.conf
|
||||
Connection 'wg0' (21d939af-9e55-4df2-bacf-a13a4a488377) successfully added.
|
||||
```
|
||||
|
||||
验证 _wg0_ 的状态:
|
||||
验证 `wg0`的状态:
|
||||
|
||||
```
|
||||
# wg
|
||||
@ -128,19 +124,17 @@ IP6.GATEWAY: --
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
上述输出显示接口 _wg0_ 已连接。现在,它可以和虚拟私有网络 IP 地址为 172.16.1.2 的对等节点通信。
|
||||
上述输出显示接口 `wg0` 已连接。现在,它可以和虚拟私有网络 IP 地址为 172.16.1.2 的对等节点通信。
|
||||
|
||||
### 在 PeerB 上配置 WireGuard 接口
|
||||
|
||||
现在可以在第二个对等节点上创建 _wg0_ 接口的配置文件了。确保你已经完成以下步骤:
|
||||
现在可以在第二个对等节点上创建 `wg0` 接口的配置文件了。确保你已经完成以下步骤:
|
||||
|
||||
* PeerB 节点上设置 IP 地址与 MASK。
|
||||
* PeerB 节点上设置 IP 地址与掩码。
|
||||
* PeerB 的私钥。
|
||||
* PeerA 的公钥
|
||||
* PeerA 的公钥。
|
||||
* PeerA 的 IP 地址或主机名、监听 WireGuard 流量的 UDP 端口。
|
||||
|
||||
|
||||
|
||||
```
|
||||
# cat << EOF > /etc/wireguard/wg0.conf
|
||||
[Interface]
|
||||
@ -162,7 +156,7 @@ EOF
|
||||
Connection 'wg0' (39bdaba7-8d91-4334-bc8f-85fa978777d8) successfully added.
|
||||
```
|
||||
|
||||
验证 _wg0_ 的状态:
|
||||
验证 `wg0` 的状态:
|
||||
|
||||
```
|
||||
# wg
|
||||
@ -201,9 +195,9 @@ IP6.GATEWAY: --
|
||||
-------------------------------------------------------------------------------
|
||||
```
|
||||
|
||||
上述输出显示接口 _wg0_ 已连接。现在,它可以和虚拟私有网络 IP 地址为 172.16.1.254 的对等节点通信。
|
||||
上述输出显示接口 `wg0` 已连接。现在,它可以和虚拟私有网络 IP 地址为 172.16.1.254 的对等节点通信。
|
||||
|
||||
### **验证节点间通信**
|
||||
### 验证节点间通信
|
||||
|
||||
完成上述步骤后,两个对等节点可以通过虚拟私有网络连接相互通信,以下是 ICMP 测试结果:
|
||||
|
||||
@ -222,7 +216,7 @@ PING 172.16.1.254 (172.16.1.254) 56(84) bytes of data.
|
||||
|
||||
## 总结
|
||||
|
||||
虚拟私有网络很常见。在用于部署虚拟私有网络的各种协议和工具中,WireGuard 是一种简单、轻巧和安全的选择。它可以基于 CryptoKey Routing 的对等节点间建立安全的<ruby>点对点通信<rt>point-to-point connection</rt></ruby>>,过程非常简单。此外,NetworkManager 支持 WireGuard 接口,允许重启后进行持久配置。
|
||||
虚拟私有网络很常见。在用于部署虚拟私有网络的各种协议和工具中,WireGuard 是一种简单、轻巧和安全的选择。它可以在对等节点之间基于 CryptoKey 路由建立安全的点对点连接,过程非常简单。此外,NetworkManager 支持 WireGuard 接口,允许重启后进行持久配置。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -231,7 +225,7 @@ via: https://fedoramagazine.org/configure-wireguard-vpns-with-networkmanager/
|
||||
作者:[Maurizio Garcia][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[DCOLIVERSUN](https://github.com/DCOLIVERSUN)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,42 +3,41 @@
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-13381-1.html)
|
||||
|
||||
为 OpenSSL 放弃 telnet
|
||||
用 OpenSSL 替代 telnet
|
||||
======
|
||||
Telnet 缺乏加密,这使得 OpenSSL 成为连接远程系统的更安全的选择。
|
||||
![Lock][1]
|
||||
|
||||
[telnet][2] 命令是最受欢迎的网络故障排除工具之一,从系统管理员到网络爱好者都可以使用。在网络计算的早期,telnet 被用来连接到一个远程系统。你可以用 telnet 访问一个远程系统的端口,登录并在该主机上运行命令。
|
||||
> Telnet 缺乏加密,这使得 OpenSSL 成为连接远程系统的更安全的选择。
|
||||
|
||||
由于 telnet 缺乏加密功能,它在很大程度上已经被 OpenSSL 取代了这项工作。然而,作为一种智能的 `ping`,telnet 的相关仍然存在(甚至在某些情况下至今仍然存在)。虽然 `ping` 命令是一个探测主机响应的好方法,但这是它能做的_全部_。另一方面,telnet 不仅可以确认一个活动端口,而且还可以与该端口的服务进行交互。即便如此,由于大多数现代网络服务都是加密的,telnet 的作用可能要小得多,这取决于你想实现什么。
|
||||

|
||||
|
||||
[telnet][2] 命令是最受欢迎的网络故障排除工具之一,从系统管理员到网络爱好者都可以使用。在网络计算的早期,`telnet` 被用来连接到一个远程系统。你可以用 `telnet` 访问一个远程系统的端口,登录并在该主机上运行命令。
|
||||
|
||||
由于 `telnet` 缺乏加密功能,它在很大程度上已经被 OpenSSL 取代了这项工作。然而,作为一种智能的 `ping`,`telnet` 的作用仍然存在(甚至在某些情况下至今仍然存在)。虽然 `ping` 命令是一个探测主机响应的好方法,但这是它能做的 _全部_。另一方面,`telnet` 不仅可以确认一个活动端口,而且还可以与该端口的服务进行交互。即便如此,由于大多数现代网络服务都是加密的,`telnet` 的作用可能要小得多,这取决于你想实现什么。
|
||||
|
||||
### OpenSSL s_client
|
||||
|
||||
对于大多数曾经需要 telnet 的任务,我现在使用 OpenSSL 的 `s_client` 命令。(我在一些任务中使用 [curl][3],但那些情况下我可能无论如何也不会使用 telnet)。大多数人都知道 [OpenSSL][4] 是一个加密的库和框架,但不是所有人都意识到它也是一个命令。`openssl` 命令的 `s_client`组件实现了一个通用的 SSL 或 TLS 客户端,帮助你使用 SSL 或 TLS 连接到远程主机。它是用来测试的,至少在内部使用与库相同的功能。
|
||||
对于大多数曾经需要 `telnet` 的任务,我现在使用 OpenSSL 的 `s_client` 命令。(我在一些任务中使用 [curl][3],但那些情况下我可能无论如何也不会使用 `telnet`)。大多数人都知道 [OpenSSL][4] 是一个加密的库和框架,但不是所有人都意识到它也是一个命令。`openssl` 命令的 `s_client` 组件实现了一个通用的 SSL 或 TLS 客户端,帮助你使用 SSL 或 TLS 连接到远程主机。它是用来测试的,至少在内部使用与该库相同的功能。
|
||||
|
||||
### 安装 OpenSSL
|
||||
|
||||
OpenSSL 可能已经安装在你的 Linux 系统上了。如果没有,你可以用你的发行版的软件包管理器安装它:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install openssl`
|
||||
$ sudo dnf install openssl
|
||||
```
|
||||
|
||||
在 Debian 或类似的系统上:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo apt install openssl`
|
||||
$ sudo apt install openssl
|
||||
```
|
||||
|
||||
安装后,验证它的响应是否符合预期:
|
||||
|
||||
|
||||
```
|
||||
$ openssl version
|
||||
OpenSSL x.y.z FIPS
|
||||
@ -46,8 +45,7 @@ OpenSSL x.y.z FIPS
|
||||
|
||||
### 验证端口访问
|
||||
|
||||
最基本的 telnet 用法是一个看起来像这样的任务:
|
||||
|
||||
最基本的 `telnet` 用法是一个看起来像这样的任务:
|
||||
|
||||
```
|
||||
$ telnet mail.example.com 25
|
||||
@ -56,7 +54,7 @@ Connected to example.com.
|
||||
Escape character is '^]'.
|
||||
```
|
||||
|
||||
这将与正在端口 25(可能是邮件服务器)监听的任意服务开一个交互式会话(在此示例中)。 只要你获得访问权限,就可以与该服务进行通信。
|
||||
在此示例中,这将与正在端口 25(可能是邮件服务器)监听的任意服务打开一个交互式会话。只要你获得访问权限,就可以与该服务进行通信。
|
||||
|
||||
如果端口 25 无法访问,连接就会被拒绝。
|
||||
|
||||
@ -83,14 +81,13 @@ Early data was not sent
|
||||
Verify return code: 0 (ok)
|
||||
```
|
||||
|
||||
但是,这仅是目标性 ping。从输出中可以看出,没有交换 SSL 证书,所以连接立即终止。为了充分利用 `openssl s_client`,你必须针对加密的端口。
|
||||
但是,这仅是目标性 `ping`。从输出中可以看出,没有交换 SSL 证书,所以连接立即终止。为了充分利用 `openssl s_client`,你必须连接加密的端口。
|
||||
|
||||
### 交互式 OpenSSL
|
||||
|
||||
Web 浏览器和 Web 服务器进行交互,使指向 80 端口的流量实际上被转发到 443,这是保留给加密 HTTP 流量的端口。知道了这一点,你就可以用 `openssl` 命令连接到加密的端口,并与在其上运行的任何网络服务进行交互。
|
||||
|
||||
首先,使用 SSL 连接到一个端口。使用 `-showcerts` 选项会使 SSL 证书打印到你的终端上,使最初的输出比 telnet 要冗长得多:
|
||||
Web 浏览器和 Web 服务器进行交互,可以使指向 80 端口的流量实际上被转发到 443,这是保留给加密 HTTP 流量的端口。知道了这一点,你就可以用 `openssl` 命令连接到加密的端口,并与在其上运行的任何网络服务进行交互。
|
||||
|
||||
首先,使用 SSL 连接到一个端口。使用 `-showcerts` 选项会使 SSL 证书打印到你的终端上,一开始的输出要比 telnet 要冗长得多:
|
||||
|
||||
```
|
||||
$ openssl s_client -connect example.com:443 -showcerts
|
||||
@ -111,7 +108,6 @@ read R BLOCK
|
||||
|
||||
你被留在一个交互式会话中。最终,这个会话将关闭,但如果你及时行动,你可以向服务器发送 HTTP 信号:
|
||||
|
||||
|
||||
```
|
||||
[...]
|
||||
GET / HTTP/1.1
|
||||
@ -120,27 +116,25 @@ HOST: example.com
|
||||
|
||||
按**回车键**两次,你会收到 `example.com/index.html` 的数据:
|
||||
|
||||
|
||||
```
|
||||
[...]
|
||||
<body>
|
||||
<div>
|
||||
<h1>Example Domain</h1>
|
||||
<p>This domain is for use in illustrative examples in documents. You may use this
|
||||
domain in literature without prior coordination or asking for permission.</p>
|
||||
<p><a href="[https://www.iana.org/domains/example"\>More][5] information...</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<body>
|
||||
<div>
|
||||
<h1>Example Domain</h1>
|
||||
<p>This domain is for use in illustrative examples in documents. You may use this
|
||||
domain in literature without prior coordination or asking for permission.</p>
|
||||
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### Email 服务器
|
||||
|
||||
你也可以使用 OpenSSL 的 `s_client` 来测试一个加密的 email 服务器。要做到这点,你必须把你的测试用户的用户名和密码用 Base64 编码。
|
||||
你也可以使用 OpenSSL 的 `s_client` 来测试一个加密的 Email 服务器。要做到这点,你必须把你的测试用户的用户名和密码用 Base64 编码。
|
||||
|
||||
这里有一个简单的方法来做到:
|
||||
|
||||
|
||||
```
|
||||
$ perl -MMIME::Base64 -e 'print encode_base64("username");'
|
||||
$ perl -MMIME::Base64 -e 'print encode_base64("password");'
|
||||
@ -148,29 +142,28 @@ $ perl -MMIME::Base64 -e 'print encode_base64("password");'
|
||||
|
||||
当你记录了这些值,你就可以通过 SSL 连接到邮件服务器,它通常在 587 端口:
|
||||
|
||||
|
||||
```
|
||||
$ openssl s_client -starttls smtp \
|
||||
-connect email.example.com:587
|
||||
> ehlo example.com
|
||||
> auth login
|
||||
> ehlo example.com
|
||||
> auth login
|
||||
##paste your user base64 string here##
|
||||
##paste your password base64 string here##
|
||||
|
||||
> mail from: [noreply@example.com][6]
|
||||
> rcpt to: [admin@example.com][7]
|
||||
> data
|
||||
> Subject: Test 001
|
||||
> mail from: noreply@example.com
|
||||
> rcpt to: admin@example.com
|
||||
> data
|
||||
> Subject: Test 001
|
||||
This is a test email.
|
||||
.
|
||||
> quit
|
||||
> quit
|
||||
```
|
||||
|
||||
检查你的邮件(在这个示例代码中,是 `admin@example.com`),查看来自 `noreply@example.com` 的测试邮件。
|
||||
|
||||
### OpenSSL 还是 telnet?
|
||||
### OpenSSL 还是 Telnet?
|
||||
|
||||
telnet 仍然有用途,但它已经不是以前那种不可缺少的工具了。该命令在许多发行版上被归入 ”legacy“ 网络包,但还没有 `telnet-ng`或一些明显的继任者,管理员有时会对它被排除在默认安装之外感到疑惑。答案是,它不再是必不可少的,它的作用越来越小,这是_很好_的。网络安全很重要,所以要适应与加密接口互动的工具,这样你就不必在排除故障时禁用你的保护措施。
|
||||
`telnet` 仍然有用途,但它已经不是以前那种不可缺少的工具了。该命令在许多发行版上被归入 “遗留” 网络软件包,而且还没有 `telnet-ng` 之类的明显的继任者,管理员有时会对它被排除在默认安装之外感到疑惑。答案是,它不再是必不可少的,它的作用越来越小,这 _很好_。网络安全很重要,所以要适应与加密接口互动的工具,这样你就不必在排除故障时禁用你的保护措施。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -179,7 +172,7 @@ via: https://opensource.com/article/21/5/drop-telnet-openssl
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,96 +0,0 @@
|
||||
[#]: subject: (ProtonMail Users can Now Access Proton Calendar (beta) for Free)
|
||||
[#]: via: (https://news.itsfoss.com/protoncalendar-beta-free/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
ProtonMail Users can Now Access Proton Calendar (beta) for Free
|
||||
======
|
||||
|
||||
[ProtonMail][1] is one of the [best secure email services][2] out there. While alternatives like [Tutanota][3] already offer a calendar feature, ProtonMail did not offer it for all the users.
|
||||
|
||||
The calendar feature (in beta) was limited to paid users. Recently, in an [announcement][4], ProtonMail has made it accessible for all users for free.
|
||||
|
||||
It is worth noting that it is still in beta but accessible to more users.
|
||||
|
||||
### Try Proton Calendar beta
|
||||
|
||||
Proton Calendar is a feature integrated with ProtonMail itself. However, you get a separate mobile app if you want to use it on Android. No signs of an iOS app yet.
|
||||
|
||||
If you are already using the **[beta.protonmail.com][5]** portal when accessing through your web browser, you can navigate your way to Proton Calendar as shown below:
|
||||
|
||||
![][6]
|
||||
|
||||
In either case, you can simply head to [Proton Calendar page][7] (calendar.protonmail.com) and log in to access it.
|
||||
|
||||
They should also add the selector menu to the main ProtonMail version, but unfortunately, it is only available on the beta portal for now.
|
||||
|
||||
As per the announcement, the features available with Proton Calendar right now are:
|
||||
|
||||
* Create, edit, and delete events across devices
|
||||
* Set reminders
|
||||
* Send and respond to event invitations (web only for now)
|
||||
* Set up recurring events annually, monthly, weekly, daily, or on an interval of your choice
|
||||
* Also available in dark mode
|
||||
|
||||
|
||||
|
||||
You can also import events from your existing calendar if you are thinking to make a switch. Event invitations should work from both Google and Microsoft Calendars.
|
||||
|
||||
Unlike other calendars, Proton Calendar utilizes end-to-end encryption to protect your events. So, only you know what events you have and the information regarding it.
|
||||
|
||||
If you are curious to know the details behind how they protect your calendar data, you can refer to their [official blog post][8] about it.
|
||||
|
||||
_Have you tried Proton Calendar yet? Is it as useful as Tutanota’s already existing calendar if you’ve tried it?_
|
||||
|
||||
![][9]
|
||||
|
||||
I'm not interested
|
||||
|
||||
#### _Related_
|
||||
|
||||
* [Gmail's Privacy Alternative ProtonMail Makes 'Undo Send' Feature Available for All Users][10]
|
||||
* ![][11] ![ProtonMail undo send option][12]
|
||||
|
||||
|
||||
* [Firefox Proton With Major Redesign Change is Coming Soon. Take a Look Before the Final Release][13]
|
||||
* ![][11] ![][14]
|
||||
|
||||
|
||||
* [ProtonVPN Adds 'NetShield' Feature to Block Malware, Scripts & Ads Online][15]
|
||||
* ![][11] ![NetShield by ProtonVPN][16]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/protoncalendar-beta-free/
|
||||
|
||||
作者:[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://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/recommends/protonmail/
|
||||
[2]: https://itsfoss.com/secure-private-email-services/
|
||||
[3]: https://tutanota.com/
|
||||
[4]: https://protonmail.com/blog/calendar-free-web-android/
|
||||
[5]: https://beta.protonmail.co
|
||||
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1OScgd2lkdGg9JzI4NycgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[7]: https://calendar.protonmail.com
|
||||
[8]: https://protonmail.com/blog/protoncalendar-security-model/
|
||||
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[10]: https://news.itsfoss.com/protonmail-undo-send/
|
||||
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/protonmail-undo-send.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[13]: https://news.itsfoss.com/firefox-proton-redesign/
|
||||
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/firefox-proton-look-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[15]: https://news.itsfoss.com/protonvpn-netshield/
|
||||
[16]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Netshield-by-ProtonVPN.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
@ -1,128 +0,0 @@
|
||||
[#]: subject: (Kate Editor Set to Become KDE’s Answer to Microsoft’s Visual Studio Code)
|
||||
[#]: via: (https://news.itsfoss.com/kate/)
|
||||
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Kate Editor Set to Become KDE’s Answer to Microsoft’s Visual Studio Code
|
||||
======
|
||||
|
||||
KDE has revealed some details on the upcoming 21.04 release of their Kate text editor, or KDE Advanced Text Editor. With this release comes a huge range of new features, such as a new HUD style command palette and improved search in files.
|
||||
|
||||
To the Visual Studio Code users out there, this may seem familiar. Microsoft VS Code has had a similar style command palette for a long time, which Kate users (until now) had to leave out of their workflow.
|
||||
|
||||
Some of the features I will be looking at in this article include:
|
||||
|
||||
* **Integrated Git support**
|
||||
* HUD style command palette
|
||||
* Quick open with fuzzy matching
|
||||
* Improved Search In Files
|
||||
* Improved Language Server Protocol (LSP) support
|
||||
|
||||
|
||||
|
||||
### Integrated Git Support – Finally!
|
||||
|
||||
![][1]
|
||||
|
||||
One of the biggest features of this update is the integrated git support. Although it has been possible to load git repositories in Kate for a while now, the new integrated git support allows you to checkout and create branches, stash stuff, stage your files for commit or diff, and do the commit and push afterward, **all without touching the terminal!**
|
||||
|
||||
This is a huge improvement over the old way of using Kate’s built-in terminal to manage your repositories.
|
||||
|
||||
Additionally, it opens up the ability to use git on the Windows version of Kate, which still doesn’t have the ability to access a command line (most likely due to the locked-down nature of it).
|
||||
|
||||
This is a a huge feature, and I suspect that it will be welcomed by developers everywhere.
|
||||
|
||||
### HUD Style Command Palette
|
||||
|
||||
![][2]
|
||||
|
||||
One of the key components of the VS Code workflow is the Command Palette. After waiting for years, this huge feature has finally been added to Kate.
|
||||
|
||||
The Command Palette is possibly one of the most commonly used features in VS Code, and it has been one of the few things that have kept me using the aforementioned text editor. Now with the integration into Kate, I can happily switch, without worrying about a huge disruption to my workflow.
|
||||
|
||||
### Quick Open (With Fuzzy Matching)
|
||||
|
||||
![][3]
|
||||
|
||||
A longtime feature of Kate, Quick Open hasn’t been improved all that much over the past few years. Now with the new 21.04 release, it is receiving a major overhaul, with things such as Fuzzy Matching and a new UI that aims to be more consistent with the Command Palette.
|
||||
|
||||
The new UI is the result of a move to a more consistent design throughout Kate. Although minor, this change definitely is more eye-pleasing and helps improve the layout for those with larger screens.
|
||||
|
||||
The fuzzy matching is also a welcome improvement. The Quick Open dialog used to use a wildcard filter for its top result, with direct matches to the search term being listed beneath it. The 21.04 release uses a new fuzzy matching algorithm, providing the best results at the top, with less likely results located at the bottom.
|
||||
|
||||
The result of this is far more reliable results, which when combined with the new UI, provides a huge improvement to the user experience.
|
||||
|
||||
### Improved Search in Files
|
||||
|
||||
![][3]
|
||||
|
||||
With the new release comes yet another welcome improvement: Better search in files.
|
||||
|
||||
The search plugin got a major overhaul with much better result representation in the proper editor font and colors. It has also been improved in terms of speed, with a very noticeable performance jump.
|
||||
|
||||
One way they achieved this is through parallelizing the search engine, allowing it to attempt to utilize all the available cores on the CPU. No longer does Kate need to hide behind Atom/VS Code!
|
||||
|
||||
### Improved LSP Support
|
||||
|
||||
![][4]
|
||||
|
||||
For those unfamiliar with the term, LSP stands for Language Server Protocol. This is what’s responsible for the detection of code errors and warnings, go to definition/declaration capabilities, and symbol outlines.
|
||||
|
||||
If you happen to be coding in one of the supported languages, it should be enabled out of the box, enabling Kate to be used similarly to a lightweight IDE.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
With this [upcoming new release][5], you can expect heaps of cool new features, each providing a better experience to the end-user. After a long wait, it seems that Kate is finally catching up with other [modern code editors like VS Code][6] in terms of features, with the added benefit of better integration into KDE Plasma desktop.
|
||||
|
||||
The new release should arrive in within the next two weeks. Keep an eye out for it.
|
||||
|
||||
![][7]
|
||||
|
||||
I'm not interested
|
||||
|
||||
#### _Related_
|
||||
|
||||
* [KDE Plasma 5.22 To Include New Adaptive Panel Opacity and Other Exciting Improvements][8]
|
||||
* ![][9] ![][10]
|
||||
|
||||
|
||||
* [KDE Plasma 5.21 Brings in a New Application Launcher, Wayland Support, and Other Exciting Additions][11]
|
||||
* ![][9] ![][12]
|
||||
|
||||
|
||||
* [Linux Release Roundup #21.12: 7-Zip, Vivaldi Browser 3.7, Audacity 3.0 and More New Releases][13]
|
||||
* ![][9] ![Linux Release Roundups][14]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/kate/
|
||||
|
||||
作者:[Jacob Crume][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://news.itsfoss.com/author/jacob/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUwNycgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUxMCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzNScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM3Nycgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[5]: https://kate-editor.org/post/2021/2021-03-29-kate-21.04-feature-preview/
|
||||
[6]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
|
||||
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[8]: https://news.itsfoss.com/kde-plasma-5-22-dev/
|
||||
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[10]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/kde-plasma-22-dev-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[11]: https://news.itsfoss.com/kde-plasma-5-21-release/
|
||||
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/kde-plasma-5-21-feat.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[13]: https://news.itsfoss.com/linux-release-roundup-2021-12/
|
||||
[14]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200
|
@ -1,132 +0,0 @@
|
||||
[#]: subject: (Confusion Erupts Around Misleading News Surrounding Youtube-dl Takedown)
|
||||
[#]: via: (https://news.itsfoss.com/youtube-dl-repo-fork/)
|
||||
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Confusion Erupts Around Misleading News Surrounding Youtube-dl Takedown
|
||||
======
|
||||
|
||||
In November 2020, [GitHub took down the Youtube-dl repository][1] after a complaint from the [RIAA][2]. This action caused a huge backlash within the open-source community, with many developers boycotting GitHub altogether.
|
||||
|
||||
The RIAA claimed that [Youtube-dl][3] was using copyright-protection avoidance technologies, which resulted in immense criticism from multiple open-source organizations. In a surprise move, GitHub reinstated the repository several weeks later.
|
||||
|
||||
![][4]
|
||||
|
||||
To complement this reinstatement, they created a 1 million dollar takedown defense fund, designed to prevent situations like this in the future.
|
||||
|
||||
### False News Surrounding Youtube-dl’s Forks
|
||||
|
||||
![][5]
|
||||
|
||||
Among the confusion caused by this takedown, some recent reports have surfaced claiming that forks of the Youtube-dl repository are still disabled. **This is not true**. If we look at the [list of forks,][6] we can see a huge list of repositories, with each one working as normal.
|
||||
|
||||
Multiple sources reference [this repository][7], which has been taken down and has still not been reinstated by GitHub. However, it is not actually forked from the [official Youtube-dl repository][8]. Instead, this repository is based on an unofficial version of Youtube-dl and is not actually a Youtube-dl fork.
|
||||
|
||||
This isn’t to say that GitHub is without blame, as they have still ignored this developer’s counternotice. However, this warrants nowhere near the amount of criticism GitHub has received because of this.
|
||||
|
||||
### GitHub Working on Preventing a Situation Like This In The Future
|
||||
|
||||
GitHub reinstated the Youtube-dl repository back then (and its forks), many were pleased to hear that they had also started work on preventing a situation like this in the future. Some of these initiatives include:
|
||||
|
||||
* A 1,000,000 USD fund aimed to help developers fight DMCA notices
|
||||
* Giving the option to developers to dispute the notice
|
||||
* Requiring additional proof for part 1201 takedown notices
|
||||
|
||||
|
||||
|
||||
#### New Fund to Fight DMCA Notices
|
||||
|
||||
As a result of the community backlash GitHub received, they have invested one million USD into a fund designed to help developers fight unfair DMCA notices. According to the official [GitHub post:][9]
|
||||
|
||||
> Developers who want to push back against unwarranted takedowns may face the risk of taking on personal liability and legal defense costs. To help them, GitHub will establish and donate $1M to a developer defense fund to help protect open source developers on GitHub from unwarranted DMCA Section 1201 takedown claims.
|
||||
|
||||
GitHub
|
||||
|
||||
Although providing legal support for open-source developers is not a new idea, GitHub providing this support directly is worth appreciating.
|
||||
|
||||
If you are interested in other ways to get support with legal disputes over open-source software, you may want to look at the [SFLC][10] and [EFF][11]. If possible, it would also be great if you could support them whether that’s through donations of time or money.
|
||||
|
||||
#### New Way For Developers To Dispute DMCA Notices
|
||||
|
||||
Another way GitHub is working to improve its relationship with developers is through a new way to dispute takedown notices. This will improve the transparency between developers and the notice issuers, reducing the likelihood of another situation like this.
|
||||
|
||||
> Every single credible 1201 takedown claim will be reviewed by technical experts, including (when appropriate) independent specialists retained by GitHub, to ensure that the project actually circumvents a technical protection measure as described in the claim.
|
||||
>
|
||||
> The claim will also be carefully scrutinized by legal experts to ensure that unwarranted claims or claims that extend beyond the boundaries of the DMCA are rejected.
|
||||
>
|
||||
> In the case where the claim is ambiguous, we will err on the side of the developer, and leave up the repository unless there is clear evidence of illegal circumvention.
|
||||
|
||||
Yet again, it seems that GitHub is putting in a lot of effort to improve its policies on DMCA takedown notices. These improvements will definitely help with the number of false claims that are currently being accepted.
|
||||
|
||||
#### More Proof Required for Future Part 1201 Notices
|
||||
|
||||
For those without a background in law, Part 1201 DMCA Takedown Notices are a special kind of takedown notice used in cases where the offending party is using code designed to circumvent technical measures to protect copyrighted content. According to GitHub:
|
||||
|
||||
> Section 1201 dates back to the late 1990s and did not anticipate the various implications it has for software use today. As a result, Section 1201 makes it illegal to use or distribute technology (including source code) that bypasses technical measures that control access or copying of copyrighted works, even if that technology can be used in a way that would not be copyright infringement.
|
||||
|
||||
GitHub has now changed its policies so that anyone issuing a part 1201 notice must include additional evidence. This is beneficial to all involved parties as it means that most of the illegitimate claims will be void anyway.
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
With the huge mess, this situation has created, I believe GitHub handled this as well as they reasonably could have. Additionally, it brought to light many legal issues surrounding part 1201 notices, which are being remedied right now.
|
||||
|
||||
Overall, the outcome of this has actually been positive, with a huge step in the right direction in developer rights. Amidst the rumors and fake news that has been circling lately, I think it is important to recognize the changes that have been made, and what they mean for the future of open-source software.
|
||||
|
||||
_What are your thoughts on the removal of Youtube-dl and then reinstating it? Let me know in the comments below!_
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
#### _Related_
|
||||
|
||||
* [PHP Repository Moves to GitHub After its Git Server Was Hacked][12]
|
||||
* ![][13] ![][14]
|
||||
|
||||
|
||||
* [10 Biggest Linux Stories of the Year 2020 [That Made the Biggest Impact]][15]
|
||||
* ![][13] ![Biggest Linux Stories][16]
|
||||
|
||||
|
||||
* [After Rocky Linux, We Have Another RHEL Fork in Works to Replace CentOS][17]
|
||||
* ![][13] ![CloudLinux][18]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/youtube-dl-repo-fork/
|
||||
|
||||
作者:[Jacob Crume][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://news.itsfoss.com/author/jacob/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/youtube-dl-github-takedown/
|
||||
[2]: https://www.riaa.com/
|
||||
[3]: https://youtube-dl.org/
|
||||
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzOCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM3NScgd2lkdGg9Jzc0MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[6]: https://github.com/ytdl-org/youtube-dl/network/members
|
||||
[7]: https://github.com/spookyahell/youtube-dl
|
||||
[8]: https://github.com/ytdl-org/youtube-dl
|
||||
[9]: https://github.blog/2020-11-16-standing-up-for-developers-youtube-dl-is-back/
|
||||
[10]: https://softwarefreedom.org/donate/
|
||||
[11]: https://www.eff.org/
|
||||
[12]: https://news.itsfoss.com/php-repository-github/
|
||||
[13]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/php-github-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[15]: https://news.itsfoss.com/biggest-linux-stories-2020/
|
||||
[16]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/biggest-linux-stories-2020.jpg?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[17]: https://news.itsfoss.com/rhel-fork-by-cloudlinux/
|
||||
[18]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Untitled-design-2.png?fit=800%2C450&ssl=1&resize=350%2C200
|
@ -1,118 +0,0 @@
|
||||
[#]: subject: (Fedora 34 Releases with GNOME 40, Linux Kernel 5.11, and a New i3 Spin)
|
||||
[#]: via: (https://news.itsfoss.com/fedora-34-release/)
|
||||
[#]: author: (Arish V https://news.itsfoss.com/author/arish/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Fedora 34 Releases with GNOME 40, Linux Kernel 5.11, and a New i3 Spin
|
||||
======
|
||||
|
||||
After the release of the [Fedora 34 beta][1] a week ago, Fedora 34 stable release is finally here with exciting changes and improvements.
|
||||
|
||||
As expected this release of Fedora arrives with the latest Linux kernel 5.11 along with significant changes such as [Gnome 40][2], [PipeWire][3], availability of a [Fedora i3 Spin][4], and various other changes.
|
||||
|
||||
Let’s take a look at the important changes coming to Fedora 34.
|
||||
|
||||
### Major Highlights of Fedora 34 Release
|
||||
|
||||
Here is an overview of the major changes in this release of Fedora.
|
||||
|
||||
#### Desktop Environment Updates
|
||||
|
||||
![][5]
|
||||
|
||||
One of the biggest highlights is the arrival of the [GNOME 40][2] desktop. Fedora 34 is one of the few distributions in which you can experience the latest Gnome 40 right now. So, this change is worth noting.
|
||||
|
||||
Taking a look at KDE Plasma, Wayland becomes the default display server for KDE Plasma in Fedora 34. Moreover, KDE Plasma Desktop image is available for AArch64 ARM devices as well.
|
||||
|
||||
Coming to other Desktop Environments, the latest Xfce 4.16 is available with this release of Fedora and LXQT also receives an update to the latest version LXQT 0.16.
|
||||
|
||||
#### PipeWire to Replace PulseAudio
|
||||
|
||||
A noteworthy change happening with this release of Fedora is the replacement of PulseAudio by PipeWire. It replaces PulseAudio and JACK by providing a PulseAudio-compatible server implementation and ABI-compatible libraries for JACK clients.
|
||||
|
||||
![][6]
|
||||
|
||||
Besides, with this release, there’s also a Fedora i3 Spin that provides the popular i3 tiling window manager and offers a complete experience with a minimalist user interface.
|
||||
|
||||
#### Zstd Compression by Default
|
||||
|
||||
BTRSF file system was made default with Fedora 34, with this release zstd algorithm is made default for transparent compression when using BTRSF. The developers hope that this would increase the life span of flash-based media by reducing write amplification.
|
||||
|
||||
#### Other Changes
|
||||
|
||||
Some of the other changes include package the following package updates.
|
||||
|
||||
* Binutils 2.53
|
||||
* Golang 1.16
|
||||
* Ruby 3.0
|
||||
* BIND 9.16
|
||||
* MariaDB 10.5
|
||||
* Ruby on Rails 6.1
|
||||
* Stratis 2.3.0
|
||||
|
||||
|
||||
|
||||
Other changes include replacement of The ntp package with ntpsec. Also, the collection packages xorg-x11 are revoked, and the individual utilities within them will be packaged separately.
|
||||
|
||||
If you want to see the entire list of changes in Fedora 34, please take a look at the [official announcement post][7] and the [changeset][8] for more technical details.
|
||||
|
||||
### Wrapping up
|
||||
|
||||
Most of the above changes in Fedora 34 were expected changes, and fortunately nothing went south after the beta release last week. Above all Fedora 34 in powered by the latest Linux kernel 5.11, and you can experience the latest GNOME desktop as well.
|
||||
|
||||
_So, what do you think about these exciting additions to Fedora 34? Let me know in the comments below._
|
||||
|
||||
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
#### _Related_
|
||||
|
||||
* [Fedora 34 Beta Arrives With Awesome GNOME 40 (Unlike Ubuntu 21.04)][1]
|
||||
* ![][9] ![][10]
|
||||
|
||||
|
||||
* [Linux Release Roundup #21.13: GNOME 40, Manjaro 21.0, Fedora 34 and More New Releases][11]
|
||||
* ![][9] ![Linux Release Roundups][12]
|
||||
|
||||
|
||||
* [Manjaro 21.0 Ornara Comes Packed With GNOME 3.38, KDE Plasma 5.21, Xfce 4.16 and Linux Kernel 5.10][13]
|
||||
* ![][9] ![][14]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/fedora-34-release/
|
||||
|
||||
作者:[Arish V][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://news.itsfoss.com/author/arish/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://news.itsfoss.com/fedora-34-beta-release/
|
||||
[2]: https://news.itsfoss.com/gnome-40-release/
|
||||
[3]: https://pipewire.org/
|
||||
[4]: https://spins.fedoraproject.org/i3/
|
||||
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ2OCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUzNicgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[7]: https://fedoramagazine.org/announcing-fedora-34/
|
||||
[8]: https://fedoraproject.org/wiki/Releases/34/ChangeSet#i3_Spin
|
||||
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
|
||||
[10]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/fedora-34-beta-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
||||
[11]: https://news.itsfoss.com/linux-release-roundup-2021-13/
|
||||
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200
|
||||
[13]: https://news.itsfoss.com/manjaro-21-0-ornara-release/
|
||||
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/manjaro-21.png?fit=1200%2C675&ssl=1&resize=350%2C200
|
@ -0,0 +1,77 @@
|
||||
[#]: subject: (Huawei Has Launched an ARM-Based Linux Laptop)
|
||||
[#]: via: (https://news.itsfoss.com/huawei-arm-linux-laptop/)
|
||||
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Huawei Has Launched an ARM-Based Linux Laptop
|
||||
======
|
||||
|
||||
Huawei, is still a major manufacturer even after its significant decline in the market share after its sore business relations with the United States.
|
||||
|
||||
Now, in a decision to move away from Microsoft/Google for its Laptops, Huawei has launched an ARM-based laptop that runs on Linux, **with a catch** (find out as you read on).
|
||||
|
||||
Of course, potentially a good decision for them. But, this should also turn the heads of other major manufacturers to follow the suite, at least for specific countries to start with.
|
||||
|
||||
### Huawei **Qingyun L410**: Overview
|
||||
|
||||
Huawei’s own Kirin 990 processor powers the **Huawei Qingyun L410** laptop as originally spotted by [ITHome][1] to be listed in an e-commerce website in China. While it is a fairly old 8-core ARM chip originally meant for its flagship smartphones, it is a good start.
|
||||
|
||||
![Image Credits: JD.com / Huawei Qingyun L410][2]
|
||||
|
||||
You will find a webcam pop up integrated to the keyboard along with a fingerprint sensor that also acts as the power button.
|
||||
|
||||
It packs in 8 GB of RAM and offers up to 512 GB storage.
|
||||
|
||||
There’s no official listing for the specifications of this laptop, but it is very similar to [Huawei’s MateBook 14][3].
|
||||
|
||||
The laptop comes pre-installed with [Unity OS][4], which is a Deepin-based Linux distribution initially developed as part of a government initiative in China to move away from big foreign tech giants.
|
||||
|
||||
ITHome also believes that it will be replaced by [Harmony OS][5] in the near future. And, that won’t be a surprise considering Huawei wants to have a seamless experience across its smartphone and laptops in the process of ditching Google services and Microsoft’s Windows.
|
||||
|
||||
Especially, considering other manufacturers like Xiaomi, OPPO, Vivo, and others also [interested to use Harmony OS][6], this is bound to happen.
|
||||
|
||||
Also, it will be available with/without an OS as per the customer’s requirement.
|
||||
|
||||
### Availability & Pricing
|
||||
|
||||
While everything sounds exciting, **this laptop hasn’t been official announced** and **not available outside China**. It is only available for enterprises and government agencies in China.
|
||||
|
||||
I know it is a bummer for a laptop that runs Linux to start with. However, companies like Huawei usually launch a different model for global markets — so there’s still hope.
|
||||
|
||||
In case you did not know, you still have [places to buy Linux laptops][7] available outside China, but a MateBook with Linux sounds pretty exciting.
|
||||
|
||||
As of now, the laptop without any OS pre-installed is priced at **¥8,181 ($1,276)**, and the one with Unity OS costs **¥8,944 ($1,395)** as reported by [GizmoChina][8].
|
||||
|
||||
_Other than this, we do not have any official information on it, but I think this will be something interesting to keep an eye on. What do you think a Linux laptop by Huawei?_
|
||||
|
||||
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
|
||||
|
||||
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
|
||||
|
||||
I'm not interested
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://news.itsfoss.com/huawei-arm-linux-laptop/
|
||||
|
||||
作者:[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://news.itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.ithome.com/0/550/533.htm
|
||||
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ1MCIgd2lkdGg9IjQ1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiLz4=
|
||||
[3]: https://consumer.huawei.com/en/laptops/matebook-14-2021/
|
||||
[4]: https://en.wikipedia.org/wiki/Unity_Operating_System
|
||||
[5]: https://www.harmonyos.com/en/develop
|
||||
[6]: https://www.slashgear.com/huawei-harmony-os-might-be-adopted-by-xiaomi-oppo-and-vivo-09672055/
|
||||
[7]: https://itsfoss.com/get-linux-laptops/
|
||||
[8]: https://www.gizmochina.com/2021/05/10/huawei-qingyun-l410-is-the-companys-first-arm-laptop-featuring-a-kirin-990-soc/
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/3/sed-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -2,7 +2,7 @@
|
||||
[#]: via: (https://opensource.com/article/21/4/linux-scan-samba)
|
||||
[#]: author: (Marc Skinner https://opensource.com/users/marc-skinner)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,97 +0,0 @@
|
||||
[#]: subject: (Linux tips for using GNU Screen)
|
||||
[#]: via: (https://opensource.com/article/21/4/gnu-screen-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Linux tips for using GNU Screen
|
||||
======
|
||||
Learn the basics of terminal multiplexing with GNU Screen, then download
|
||||
our cheat sheet so you always have the essential shortcuts at hand.
|
||||
![Terminal command prompt on orange background][1]
|
||||
|
||||
To the average user, a terminal window can be baffling and cryptic. But as you learn more about the Linux terminal, it doesn't take long before you realize how efficient and powerful it is. It also doesn't take long for you to want it to be even _more_ efficient, though, and what better way to make your terminal better than to put more terminals into your terminal?
|
||||
|
||||
### Terminal multiplexing
|
||||
|
||||
One of the many advantages to the terminal is that it's a centralized interface with centralized controls. It's one window that affords you access to hundreds of applications, and all you need to interact with each one of them is a keyboard. But modern computers almost always have processing power to spare, and modern computerists love to multitask, so one window for hundreds of applications can be pretty limiting.
|
||||
|
||||
A common answer for this flaw is terminal multiplexing: the ability to layer virtual terminal windows on top of one another and then move between them all. With a multiplexer, you retain your centralized control, but you gain the ability to swap out the interface as you multitask. Better yet, you can split your virtual screens within your terminal so you can have multiple screens up at the same time.
|
||||
|
||||
### Choose the right multiplexer
|
||||
|
||||
Some terminals offer similar features, with tabbed interfaces and split views, but there are subtle differences. First of all, these terminals' features depend on a graphical desktop environment. Second, many graphical terminal features require mouse interaction or use inconvenient keyboard shortcuts. A terminal multiplexer's features work just as well in a text console as on a graphical desktop, and the keybindings are conveniently designed around common terminal sequences.
|
||||
|
||||
There are two popular multiplexers: [tmux][2] and [GNU Screen][3]. They do the same thing and mostly have the same features, although the way you interact with each is slightly different. This article is a getting-started guide for GNU Screen. For information about tmux, read Kevin Sonney's [introduction to tmux][4].
|
||||
|
||||
### Using GNU Screen
|
||||
|
||||
GNU Screen's basic usage is simple. Launch it with the `screen` command, and you're placed into the zeroeth window in a Screen session. You may hardly notice anything's changed until you decide you need a new prompt.
|
||||
|
||||
When one terminal window is occupied with an activity (for instance, you've launched a text editor like [Vim][5] or [Jove][6], or you're processing video or audio, or running a batch job), you can just open a new one. To open a new window, press **Ctrl+A**, release, and then press **c**. This creates a new window on top of your existing window.
|
||||
|
||||
You'll know you're in a new window because your terminal appears to be clear of anything aside from its default prompt. Your other terminal still exists, of course; it's just hiding behind the new one. To traverse through your open windows, press **Ctrl+A**, release, and then **n** for _next_ or **p** for _previous_. With just two windows open, **n** and **p** functionally do the same thing, but you can always open more windows (**Ctrl+A** then **c**) and walk through them.
|
||||
|
||||
### Split screen
|
||||
|
||||
GNU Screen's default behavior is more like a mobile device screen than a desktop: you can only see one window at a time. If you're using GNU Screen because you love to multitask, being able to focus on only one window may seem like a step backward. Luckily, GNU Screen lets you split your terminal into windows within windows.
|
||||
|
||||
To create a horizontal split, press **Ctrl+A** and then **s**. This places one window above another, just like window panes. The split space is, however, left unpurposed until you tell it what to display. So after creating a split, you can move into the split pane with **Ctrl+A** and then **Tab**. Once there, use **Ctrl+A** then **n** to navigate through all your available windows until the content you want to be displayed is in the split pane.
|
||||
|
||||
You can also create vertical splits with **Ctrl+A** then **|** (that's a pipe character, or the **Shift** option of the **\** key on most keyboards).
|
||||
|
||||
### Make GNU Screen your own
|
||||
|
||||
GNU Screen uses shortcuts based around **Ctrl+A**. Depending on your habits, this can either feel very natural or be supremely inconvenient because you use **Ctrl+A** to move to the beginning of a line anyway. Either way, GNU Screen permits all manner of customization through the `.screenrc` configuration file. You can change the trigger keybinding (called the "escape" keybinding) with this:
|
||||
|
||||
|
||||
```
|
||||
`escape ^jJ`
|
||||
```
|
||||
|
||||
You can also add a status line to help you keep yourself oriented during a Screen session:
|
||||
|
||||
|
||||
```
|
||||
# status bar, with current window highlighted
|
||||
hardstatus alwayslastline
|
||||
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
|
||||
|
||||
# enable 256 colors
|
||||
attrcolor b ".I"
|
||||
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
|
||||
defbce on
|
||||
```
|
||||
|
||||
Having an always-on reminder of what window has focus activity and which windows have background activity is especially useful during a session with multiple windows open. It's a sort of task manager for your terminal.
|
||||
|
||||
### Download the cheat sheet
|
||||
|
||||
When you're learning GNU Screen, you'll have a lot of new keyboard commands to remember. Some you'll remember right away, but the ones you use less often might be difficult to keep track of. You can always access a Help screen within GNU Screen with **Ctrl+A** then **?**, but if you prefer something you can print out and keep by your keyboard, **[download our GNU Screen cheat sheet][7]**.
|
||||
|
||||
Learning GNU Screen is a great way to increase your efficiency and alacrity with your favorite [terminal emulator][8]. Give it a try!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/4/gnu-screen-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
||||
[2]: https://github.com/tmux/tmux/wiki
|
||||
[3]: https://www.gnu.org/software/screen/
|
||||
[4]: https://opensource.com/article/20/1/tmux-console
|
||||
[5]: https://opensource.com/tags/vim
|
||||
[6]: https://opensource.com/article/17/1/jove-lightweight-alternative-vim
|
||||
[7]: https://opensource.com/downloads/gnu-screen-cheat-sheet
|
||||
[8]: https://opensource.com/article/21/2/linux-terminals
|
@ -1,154 +0,0 @@
|
||||
[#]: subject: (Access an alternate internet with OpenNIC)
|
||||
[#]: via: (https://opensource.com/article/21/4/opennic-internet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Access an alternate internet with OpenNIC
|
||||
======
|
||||
Take a detour on the super information highway.
|
||||
![An intersection of pipes.][1]
|
||||
|
||||
In the words of Dan Kaminsky, the legendary DNS hacker, "the Internet's proven to be a pretty big deal for global society." For the Internet to work, computers must be able to find one another on the most complex network of all: the World Wide Web. This was the problem posed to government workers and academic IT staff a few decades ago, and it's their solutions that we use today. They weren't, however, actually seeking to build _the Internet_, they were defining specifications for _internets_ (actually for _catenets_, or "concatenated networks", but the term that eventually fell out of vogue), a generic term for _interconnected networks_.
|
||||
|
||||
According to these specifications, a network uses a combination of numbers that serve as a sort of home address for each online computer and assigns a human-friendly but highly structured "hostname" (such as `example.com`) to each website. Because users primarily interact with the internet through website _names_, it can be said that the internet works only because we've all agreed to a standardized naming scheme. The Internet _could_ work differently, should enough people decide to use a different naming scheme. A group of users could form a parallel internet, one that exists using the same physical infrastructure (the cables and satellites and other modes of transport that get data from one place to another) but uses a different means of correlating hostnames with numbered addresses.
|
||||
|
||||
In fact, this already exists, and this article shows how you can access it.
|
||||
|
||||
### Understand name servers
|
||||
|
||||
The term "internet" is actually a portmanteau of the terms _interconnected_ and _networks_ because that's exactly what it is. Like neighborhoods in a city, or cities in a country, or countries on a continent, or continents on a planet, the internet spans the globe by transmitting data from one home or office network to data centers and server rooms or other home or office networks. It's a gargantuan task—but it's not without precedent. After all, phone companies long ago connected the world, and before that, telegraph and postal services did the same.
|
||||
|
||||
In a phone or mail system, there's a list, whether it's formal or informal, that relates human names to physical addresses. This used to be delivered to houses in the form of telephone books, a directory of every phone owner in that phone book's community. Post offices operate differently: they usually rely on the person sending the letter to know the name and address of the intended recipient, but postcodes and city names are used to route the letter to the correct post office. Either way, the need for a standard organizational scheme is necessary.
|
||||
|
||||
For computers, the [IP protocol][2] describes how addresses on the internet must be formatted. The domain name server [(DNS) protocol][3] describes how human-friendly names may be assigned to and resolved from IP addresses. Whether you're using IPv4 or IPv6, the idea is the same: When a node (which could be a computer or a gateway leading to another network) joins a network, it is assigned an IP address.
|
||||
|
||||
If you wish, you may register a domain name with [ICANN][4] (a non-profit organization that helps coordinate website names on the internet) and register the name as a pointer to an IP address. There is no requirement that you "own" the IP address. Anyone can point any domain name to any IP address. The only restrictions are that only one person can own a specific domain name at a time, and the domain name must follow the recognized DNS naming scheme.
|
||||
|
||||
Records of a domain name and its associated IP address are entered into a DNS. When you navigate to a website in your browser, it quickly consults the DNS network to find what IP address is associated with whatever URL you've entered (or clicked on from a search engine).
|
||||
|
||||
### A different DNS
|
||||
|
||||
To avoid arguments over who owns which domain name, most domain name registrars charge a fee for domain registration. The fee is usually nominal, and sometimes it's even $0 (for instance, `freenom.com` offers gratis `.tk`, `.ml`, `.gq`, and `.cf` domains on a first-come, first-served basis).
|
||||
|
||||
For a very long time, there were only a few "top-level" domains, including `.org`, `.edu`, and `.com`. Now there are a lot more, including `.club`, `.biz`, `.name`, `.international`, and so on. Letter combinations being what they are, however, there are lots of potential top-level domains that aren't valid, such as `.null`. If you try to navigate to a website ending in `.null`, then you won't get very far. It's not available for registration, it's not a valid entry for a domain name server, and it just doesn't exist.
|
||||
|
||||
The [OpenNIC Project][5] has established an alternate DNS network to resolve domain names to IP addresses, but it includes names not currently used by the internet. Available top-level domains include:
|
||||
|
||||
* .geek
|
||||
* .indy
|
||||
* .bbs
|
||||
* .gopher
|
||||
* .o
|
||||
* .libre
|
||||
* .oss
|
||||
* .dyn
|
||||
* .null
|
||||
|
||||
|
||||
|
||||
You can register a domain within these (and more) top-level domains and register them on the OpenNIC DNS system so that they map to an IP address of your choice.
|
||||
|
||||
In other words, a website may exist in the OpenNIC network but remain inaccessible to anyone not using OpenNIC name servers. This isn't by any means a security measure or even a means of obfuscation; it's just a conscious choice to take a detour on the _super information highway_.
|
||||
|
||||
### How to use an OpenNIC DNS server
|
||||
|
||||
To access OpenNIC sites, you must configure your computer to use OpenNIC DNS servers. Luckily, this isn't a binary choice. By using an OpenNIC DNS server, you get access to both OpenNIC and the standard web.
|
||||
|
||||
To configure your Linux computer to use an OpenNIC DNS server, you can use the [nmcli][6] command, a terminal interface to Network Manager. Before starting the configuration, visit [opennic.org][5] and look for your nearest OpenNIC DNS server. As with standard DNS and [edge computing][7], the closer the server is to you geographically, the less delay you'll experience when your browser queries it.
|
||||
|
||||
Here's how to use OpenNIC:
|
||||
|
||||
1. First, get a list of connections:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli connection
|
||||
NAME TYPE DEVICE
|
||||
Wired connection 1 802-3-ethernet eth0
|
||||
MyPersonalWifi 802-11-wireless wlan0
|
||||
ovpn-phx2-tcp vpn --
|
||||
```
|
||||
|
||||
Your connections are sure to differ from this example, but focus on the first column. This provides the human-readable name of your connections. In this example, I'll configure my Ethernet connection, but the process is the same for a wireless connection.
|
||||
|
||||
2. Now that you know the name of the connection you need to modify, use `nmcli` to update its `ipv4.dns` property:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli con modify \
|
||||
"Wired connection 1" \
|
||||
ipv4.dns "134.195.4.2"
|
||||
```
|
||||
|
||||
In this example, `134.195.4.2` is my closest server.
|
||||
|
||||
3. Prevent Network Manager from auto-updating `/etc/resolv.conf` with what your router is set to use:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli con modify \
|
||||
"Wired connection 1" \
|
||||
ipv4.ignore-auto-dns yes
|
||||
```
|
||||
|
||||
4. Bring your network connection down and then up again to instantiate the new settings:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli con down \
|
||||
"Wired connection 1"
|
||||
$ sudo nmcli con up \
|
||||
"Wired connection 1"
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
That's it. You're now using the OpenNIC DNS servers.
|
||||
|
||||
#### DNS at your router
|
||||
|
||||
You can set your entire network to use OpenNIC by making this change to your router. You won't have to configure your computer's connection because the router will provide the correct DNS server automatically. I can't demonstrate this because router interfaces differ depending on the manufacturer. Furthermore, some internet service providers (ISP) don't allow you to modify your name server settings, so this isn't always an option.
|
||||
|
||||
### Test OpenNIC
|
||||
|
||||
To explore the "other" internet you've unlocked, try navigating to `grep.geek` in your browser. If you enter `http://grep.geek`, then your browser takes you to a search engine for OpenNIC. If you enter just `grep.geek`, then your browser interferes, taking you to your default search engine (such as [Searx][8] or [YaCy][9]), with an offer at the top of the window to navigate to the page you requested in the first place.
|
||||
|
||||
![OpenNIC][10]
|
||||
|
||||
(Klaatu, [CC BY-SA 4.0][11])
|
||||
|
||||
Either way, you end up at `grep.geek` and can now search the OpenNIC version of the web.
|
||||
|
||||
### Great wide open
|
||||
|
||||
The internet is meant to be a place of exploration, discovery, and equal access. OpenNIC helps ensure all of these things using existing infrastructure and technology. It's an opt-in internet alternative. If these ideas appeal to you, give it a try!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/4/opennic-internet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.)
|
||||
[2]: https://tools.ietf.org/html/rfc791
|
||||
[3]: https://tools.ietf.org/html/rfc1035
|
||||
[4]: https://www.icann.org/resources/pages/register-domain-name-2017-06-20-en
|
||||
[5]: http://opennic.org
|
||||
[6]: https://opensource.com/article/20/7/nmcli
|
||||
[7]: https://opensource.com/article/17/9/what-edge-computing
|
||||
[8]: http://searx.me
|
||||
[9]: https://opensource.com/article/20/2/open-source-search-engine
|
||||
[10]: https://opensource.com/sites/default/files/uploads/did-you-mean.jpg (OpenNIC)
|
||||
[11]: https://creativecommons.org/licenses/by-sa/4.0/
|
@ -1,138 +0,0 @@
|
||||
[#]: subject: (Learn essential Kubernetes commands with a new cheat sheet)
|
||||
[#]: via: (https://opensource.com/article/21/5/kubernetes-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Learn essential Kubernetes commands with a new cheat sheet
|
||||
======
|
||||
Start exploring kubectl, containers, pods, and more, then download our
|
||||
free cheat sheet so you always have the key commands at your fingertips.
|
||||
![Cheat Sheet cover image][1]
|
||||
|
||||
The cloud runs largely on Kubernetes, Kubernetes largely runs on Linux, and Linux runs best when it has a skilled sysadmin at the controls. Whether you consider yourself a cloud architect or just a humble sysadmin, the modern internet needs users who understand how applications and services can be created within containers, scaled on demand, and monitored and managed judiciously.
|
||||
|
||||
One of the first steps into the brave world of containers is learning Kubernetes and its quintessential command: `kubectl`.
|
||||
|
||||
### Installing kubectl
|
||||
|
||||
The `kubectl` command allows you to run commands on Kubernetes clusters. You use `kubectl` to deploy applications, view logs, inspect and manage cluster resources, and troubleshoot issues when they arise. The classic "problem" with `kubectl` (and Kubernetes as a whole) is that to run commands against a cluster, you first need a cluster. However, there are easy solutions.
|
||||
|
||||
First, you can create your own Kubernetes cluster for the cost of three Raspberry Pi boards and associated peripherals (power supplies, mostly). Once you've acquired the hardware, read Chris Collins' [_Build a Kubernetes cluster with the Raspberry Pi_][2], and you'll have your very own cluster with `kubectl` installed.
|
||||
|
||||
The other way to acquire a cluster is to use [Minikube][3], a practice environment for Kubernetes. Of all the methods of getting a cluster up and running, this is the easiest.
|
||||
|
||||
There are yet more options; for example, you can take a course on Kubernetes to gain access to a lab running a cluster, or you can buy time on a cloud. It doesn't matter how you gain access to a cluster, as long as you have a Kubernetes environment to practice on.
|
||||
|
||||
Once you have access to a cluster, you can start exploring the `kubectl` command.
|
||||
|
||||
### Understanding pods and containers
|
||||
|
||||
A container is a lightweight, partial Linux system dedicated to running an application or service. A container is constrained by a [kernel namespace][4], which provides it access to vital system components on its host (the computer running the container) while preventing it from sending data out to its host. Containers are kept as container images (or just _images_ for short) and defined by text files called _Containerfiles_ or _Dockerfiles_.
|
||||
|
||||
A pod is a formal collection of containers and an easy way for an administrator to scale, monitor, and maintain any number of containers.
|
||||
|
||||
Together, these are like the "apps" of Kubernetes. Creating or acquiring container images is how you run services on the cloud.
|
||||
|
||||
### Running a pod
|
||||
|
||||
Two reliable registries of container images are Docker Hub and Quay. You can search a registry website for a list of available images. There are usually official images of large projects provided by the project, as well as community images for specialized, customized, or niche projects. One of the simplest and smallest images is a [BusyBox][5] container, which provides a minimal shell environment and some common commands.
|
||||
|
||||
Whether you pull an image from a registry or write your own image definition and pull that into your cluster from a Git repository, the workflow is the same. When you want to start a pod in Kubernetes:
|
||||
|
||||
1. Find an image you want to use on [Docker Hub][6] or [Quay][7]
|
||||
2. Pull the image
|
||||
3. Create a pod
|
||||
4. Deploy the pod
|
||||
|
||||
|
||||
|
||||
If you want to use the example BusyBox container, you can do the last three steps in a single command:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl create deployment my-busybox --image=busybox`
|
||||
```
|
||||
|
||||
Wait for kubectl to complete the process, and in the end, you have a running BusyBox instance. The pod isn't exposed to the rest of the world. It's just quietly running on your cluster in the background.
|
||||
|
||||
To see what pods are running on your cluster:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl get pods --all-namespaces`
|
||||
```
|
||||
|
||||
You can also get information about the pod deployment:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl describe deployment my-busybox`
|
||||
```
|
||||
|
||||
### Interacting with a pod
|
||||
|
||||
Containers usually contain configuration files that cause them to be automated. For instance, installing the Nginx httpd server as a container should not require your interaction. You start the container running, and it just works. This is true for the first container you add to a pod and for every container thereafter.
|
||||
|
||||
One of the advantages of the Kubernetes model is that you can scale your services as needed. Should your web service become overwhelmed by unexpected traffic, you can start an identical container in your cloud (using the `scale` or `autoscale` subcommand), doubling your service's ability to handle incoming requests.
|
||||
|
||||
Even so, sometimes it's nice to see some proof that a pod is running as expected or to be able to troubleshoot something that doesn't appear to be functioning correctly. For this, you can run arbitrary commands in a container:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl exec my-busybox -- echo "hello cloud"`
|
||||
```
|
||||
|
||||
Alternately, you can open a shell in your container, piping your standard input into it and its output to your terminal's stdout:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl exec --stdin --tty my-busybox -- /bin/sh`
|
||||
```
|
||||
|
||||
### Exposing services
|
||||
|
||||
By default, pods aren't exposed to the outside world upon creation, giving you time to test and verify before going live. Assume you want to install and deploy the Nginx web server as a pod on your cluster and make it accessible. As with any service, you must point your pod to a port on your server. The `kubectl` subcommand `expose` can do this for you:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl create deployment \
|
||||
my-nginx --image=nginx
|
||||
$ kubectl expose deployment \
|
||||
my-nginx --type=LoadBalancer --port=8080
|
||||
```
|
||||
|
||||
As long as your cluster is accessible from the internet, you can test your new web server's accessibility by opening a browser and navigating to your public IP address.
|
||||
|
||||
### More than just pods
|
||||
|
||||
Kubernetes provides a lot more than just stock images of common services. In addition to being a system for [container orchestration][8], it's also a platform for cloud development. You can write and deploy applications, manage and monitor performance and traffic, implement intelligent load balancing strategies, and much more.
|
||||
|
||||
Kubernetes is a powerful system, and it has quickly become the foundation for all kinds of clouds, most significantly the [open hybrid cloud][9]. Start learning Kubernetes today. And as you learn more about Kubernetes, you'll need some quick reminders of its main concepts and general syntax, so [**download our Kubernetes cheat sheet**][10] and keep it nearby.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/kubernetes-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image)
|
||||
[2]: https://opensource.com/article/20/6/kubernetes-raspberry-pi
|
||||
[3]: https://opensource.com/article/18/10/getting-started-minikube
|
||||
[4]: https://opensource.com/article/19/10/namespaces-and-containers-linux
|
||||
[5]: https://www.busybox.net/
|
||||
[6]: http://hub.docker.com
|
||||
[7]: http://quay.io
|
||||
[8]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[9]: https://opensource.com/article/20/10/keep-cloud-open
|
||||
[10]: https://opensource.com/downloads/kubernetes-cheat-sheet
|
@ -0,0 +1,158 @@
|
||||
[#]: subject: (Getting started with edge development on Linux using open source)
|
||||
[#]: via: (https://opensource.com/article/21/5/edge-quarkus-linux)
|
||||
[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Getting started with edge development on Linux using open source
|
||||
======
|
||||
Leverage Quarkus to scale IoT application development and deployment
|
||||
environments.
|
||||
![Looking at a map][1]
|
||||
|
||||
There are many reasons why Linux is such a popular platform for processing Internet of Things (IoT) edge applications. A major one is transparency. Linux security capabilities are built on open source projects, giving users a transparent view of security risks and threats and enables them to apply fixes quickly with security module patches or kernel-level updates. Another Linux advantage is that developers can choose from various programming languages to develop, test, and run device communications over various networking protocols—other than HTTP(s)—when developing IoT edge applications. It also enables developers to address server programming for controlling data flow from IoT devices to front-end graphical user interface (GUI) applications.
|
||||
|
||||
This article explains how to get started with IoT edge development using [Quarkus][2], a cloud-native Java framework that enables you to integrate a lightweight [message broker][3] for processing data streams from IoT devices in a reactive way.
|
||||
|
||||
For this article, I'm using [CentOS Stream][4], which I feel provides a reliable open source platform to handle the business applications I work on, from traditional enterprise Java to cloud, IoT edge, artificial intelligence (AI), and machine learning (ML) environments. It's a midstream platform operating between [Fedora][5] and [Red Hat Enterprise Linux][6] (RHEL).
|
||||
|
||||
**[Read next: [Deploy Quarkus everywhere with RHEL][7]]**
|
||||
|
||||
![High-level architecture for IoT edge development][8]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][9])
|
||||
|
||||
You don't have to use CentOS to use Quarkus, of course. However, if you want to follow along with this article precisely, you can install [CentOS Stream][10] so there will be no difference between what you read here and what you see onscreen.
|
||||
|
||||
You can learn more about Quarkus by reading my article _[Writing Java with Quarkus in VS Code][11]_.
|
||||
|
||||
### Step 1: Send IoT data to the lightweight message broker
|
||||
|
||||
To quickly spin up a lightweight message broker, you can use [Eclipse Mosquitto][12]. It's an open source message broker that implements the MQTT protocol. [MQTT][13] processes messages across IoT devices, such as low-power sensors, mobile phones, embedded computers, and microcontrollers. Mosquitto can be [installed][14] on various devices and operating system platforms, but you can also spin up the broker container image after installing a container engine (e.g., [Docker][15]) and a command-line interface (CLI) tool.
|
||||
|
||||
I use the [Podman][16] tool for running Linux containers. Compared to other container engines, this saves resources (CPU and memory especially) when you install and run an extra container engine in your environment. If you haven't already, [install Podman][17] before continuing. Then run the Mosquitto message broker with this command:
|
||||
|
||||
|
||||
```
|
||||
$ podman run --name mosquitto \
|
||||
\--rm -p "9001:9001" -p "1883:1883" \
|
||||
eclipse-mosquitto:1.6.2
|
||||
```
|
||||
|
||||
You see this output:
|
||||
|
||||
|
||||
```
|
||||
1619384779: mosquitto version 1.6.2 starting
|
||||
1619384779: Config loaded from /mosquitto/config/mosquitto.conf.
|
||||
1619384779: Opening ipv4 listen to socket on port 1883.
|
||||
1619384779: Opening ipv6 listen socket on port 1883.
|
||||
```
|
||||
|
||||
### Step 2: Process reactive data streams with Quarkus
|
||||
|
||||
For this example, imagine you have IoT devices connected to a warehouse that continually send temperature and heat data to back-end servers to monitor the building's condition and save power resources.
|
||||
|
||||
Your imaginary setup uses one [ESP8266-01][18] WiFi module that streams temperature and heat data in the JSON data format. The stream's IoT edge data is transmitted to the Mosiquitto message broker server running on your machine.
|
||||
|
||||
Define the ESP8266-01 emulator in a Java application on Quarkus:
|
||||
|
||||
|
||||
```
|
||||
Device esp8266 = new Device("ESP8266-01");
|
||||
|
||||
@Outgoing("device-temp")
|
||||
public Flowable<String> generate() {
|
||||
return Flowable.interval(2, TimeUnit.SECONDS)
|
||||
.onBackpressureDrop()
|
||||
.map(t -> {
|
||||
[String][19] data = esp8266.toString();
|
||||
return data;
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
Quarkus also enables you to process data streams and event sources with the [SmallRye Reactive Messaging][20] extension, which interacts with various messaging technologies such as [Apache Kafka][21], [AMQP][22], and especially MQTT, the standard for IoT messaging. This code snippet shows how to specify incoming data streams with an `@Incoming()` annotation:
|
||||
|
||||
|
||||
```
|
||||
@Incoming("devices")
|
||||
@Outgoing("my-data-stream")
|
||||
@Broadcast
|
||||
public String process(byte[] data) {
|
||||
String d = new String(data);
|
||||
return d;
|
||||
}
|
||||
```
|
||||
|
||||
You can find this solution in my [GitHub repository][23].
|
||||
|
||||
#### Step 3: Monitor the real-time data channel
|
||||
|
||||
Quarkus uses reactive messaging and channels to receive, process, and showcase messages with a browser-based front-end application. You can run the Quarkus application in development mode for live coding or continue adding code in the inner-loop development workflow.
|
||||
|
||||
Issue the following Maven command to build and start the application:
|
||||
|
||||
|
||||
```
|
||||
`./mvnw compile quarkus:dev`
|
||||
```
|
||||
|
||||
Once your Quarkus application starts, you should see incoming IoT data from the ESP8266-01 device.
|
||||
|
||||
![Incoming IoT data in Quarkus][24]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][9])
|
||||
|
||||
You can use the dashboard to monitor how the IoT edge data (e.g., temperature, heat) is processing. Open a new web browser and navigate to [http://localhost:8080][25]. You should start seeing some statistics.
|
||||
|
||||
![IoT data graph][26]
|
||||
|
||||
(Daniel Oh, [CC BY-SA 4.0][9])
|
||||
|
||||
### Conclusion
|
||||
|
||||
With Quarkus, enterprises can scale application development and deployment environments with minimal cost and without high maintenance or licensing fees. From a DevOps perspective, enterprise developers can still use familiar open source technologies (such as Java) to implement IoT edge applications, while operators can control and monitor production using a Linux-based system (like CentOS Stream) with data gathered from big data, IoT, and artificial intelligence (AI) technologies.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/edge-quarkus-linux
|
||||
|
||||
作者:[Daniel Oh][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/daniel-oh
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tips_map_guide_ebook_help_troubleshooting_lightbulb_520.png?itok=L0BQHgjr (Looking at a map)
|
||||
[2]: https://quarkus.io/
|
||||
[3]: https://www.ibm.com/cloud/learn/message-brokers
|
||||
[4]: https://www.centos.org/centos-stream/
|
||||
[5]: https://getfedora.org/
|
||||
[6]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux
|
||||
[7]: https://developers.redhat.com/blog/2021/04/07/deploy-quarkus-everywhere-with-red-hat-enterprise-linux-rhel/
|
||||
[8]: https://opensource.com/sites/default/files/uploads/iot-edge-architecture.png (High-level architecture for IoT edge development)
|
||||
[9]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[10]: https://www.centos.org/download/
|
||||
[11]: https://opensource.com/article/20/4/java-quarkus-vs-code
|
||||
[12]: https://mosquitto.org/
|
||||
[13]: https://mqtt.org/
|
||||
[14]: https://mosquitto.org/download/
|
||||
[15]: https://opensource.com/resources/what-docker
|
||||
[16]: https://podman.io/
|
||||
[17]: https://podman.io/getting-started/installation
|
||||
[18]: https://www.instructables.com/Getting-Started-With-the-ESP8266-ESP-01/
|
||||
[19]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string
|
||||
[20]: https://smallrye.io/smallrye-reactive-messaging/smallrye-reactive-messaging/2/index.html
|
||||
[21]: https://kafka.apache.org/
|
||||
[22]: https://www.amqp.org/
|
||||
[23]: https://github.com/danieloh30/quarkus-edge-mqtt-demo
|
||||
[24]: https://opensource.com/sites/default/files/uploads/quarkus_incoming-iot-data.png (Incoming IoT data in Quarkus)
|
||||
[25]: http://localhost:8080/
|
||||
[26]: https://opensource.com/sites/default/files/uploads/iot-graph.png (IoT data graph)
|
183
sources/tech/20210510 Make Jenkins logs pretty.md
Normal file
183
sources/tech/20210510 Make Jenkins logs pretty.md
Normal file
@ -0,0 +1,183 @@
|
||||
[#]: subject: (Make Jenkins logs pretty)
|
||||
[#]: via: (https://opensource.com/article/21/5/jenkins-logs)
|
||||
[#]: author: (Evan "Hippy" Slatis https://opensource.com/users/hippyod)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (DCOLIVERSUN)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Make Jenkins logs pretty
|
||||
======
|
||||
Jenkins' default logs can be hard to read, but they don't have to be.
|
||||
![Person using a laptop][1]
|
||||
|
||||
Jenkins is a free and open source automation server for building, testing, and deploying code. It's the backbone of continuous integration and continuous delivery (CI/CD) and can save developers hours each day and protect them from having failed code go live. When code does fail, or when a developer needs to see the output of tests, [Jenkins][2] provides log files for review.
|
||||
|
||||
The default Jenkins pipeline logs can be difficult to read. This quick summary of Jenkins logging basics offers some tips (and code) on how to make them more readable.
|
||||
|
||||
### What you get
|
||||
|
||||
Jenkins pipelines are split into [stages][3]. Jenkins automatically logs the beginning of each stage, like this:
|
||||
|
||||
|
||||
```
|
||||
[Pipeline] // stage
|
||||
[Pipeline] stage (hide)
|
||||
[Pipeline] { (Apply all openshift resources)
|
||||
[Pipeline] dir
|
||||
```
|
||||
|
||||
The text is displayed without much contrast, and important things (like the beginning of a stage) aren't highlighted. In a pipeline log several hundred lines long, finding where one stage starts and another ends, especially if you're casually browsing the logs looking for a particular stage, can be daunting.
|
||||
|
||||
Jenkins pipelines are written as a mix of [Groovy][4] and shell scripting. In the Groovy code, logging is sparse; many times, it consists of grayed-out text in the command without details. In the shell scripts, debugging mode (`set -x`) is turned on, so every shell command is fully realized (variables are dereferenced and values printed) and logged in detail, as is the output.
|
||||
|
||||
It can be tedious to read through the logs to get relevant information, given that there can be so much. Since the Groovy logs that proceed and follow a shell script in a pipeline aren't very expressive, many times they lack context:
|
||||
|
||||
|
||||
```
|
||||
[Pipeline] dir
|
||||
Running in /home/jenkins/agent/workspace/devop-master/devops-server-pipeline/my-repo-dir/src
|
||||
[Pipeline] { (hide)
|
||||
[Pipeline] findFiles
|
||||
[Pipeline] findFiles
|
||||
[Pipeline] readYaml
|
||||
[Pipeline] }
|
||||
```
|
||||
|
||||
I can see what directory I am working in, and I know I was searching for file(s) and reading a YAML file using Jenkins' steps. But what was I looking for, and what did I find and read?
|
||||
|
||||
### What can be done?
|
||||
|
||||
I'm glad you asked because there are a few simple practices and some small snippets of code that can help. First, the code:
|
||||
|
||||
|
||||
```
|
||||
def echoBanner(def ... msgs) {
|
||||
echo createBanner(msgs)
|
||||
}
|
||||
|
||||
def errorBanner(def ... msgs) {
|
||||
error(createBanner(msgs))
|
||||
}
|
||||
|
||||
def createBanner(def ... msgs) {
|
||||
return """
|
||||
===========================================
|
||||
|
||||
${msgFlatten(null, msgs).join("\n ")}
|
||||
|
||||
===========================================
|
||||
"""
|
||||
}
|
||||
|
||||
// flatten function hack included in case Jenkins security
|
||||
// is set to preclude calling Groovy flatten() static method
|
||||
// NOTE: works well on all nested collections except a Map
|
||||
def msgFlatten(def list, def msgs) {
|
||||
list = list ?: []
|
||||
if (!(msgs instanceof String) && !(msgs instanceof GString)) {
|
||||
msgs.each { msg ->
|
||||
list = msgFlatten(list, msg)
|
||||
}
|
||||
}
|
||||
else {
|
||||
list += msgs
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
```
|
||||
|
||||
Add this code to the end of each pipeline or, to be more efficient, [load a Groovy file][5] or make it part of a [Jenkins shared library][6].
|
||||
|
||||
At the start of each stage (or at particular points within a stage), simply call `echoBanner`:
|
||||
|
||||
|
||||
```
|
||||
`echoBanner("MY STAGE", ["DOING SOMETHING 1", "DOING SOMETHING 2"])`
|
||||
```
|
||||
|
||||
Your logs in Jenkins will display the following:
|
||||
|
||||
|
||||
```
|
||||
===========================================
|
||||
|
||||
MY STAGE
|
||||
DOING SOMETHING 1
|
||||
DOING SOMETHING 2
|
||||
|
||||
===========================================
|
||||
```
|
||||
|
||||
The banners are very easy to pick out in the logs. They also help define the pipeline flow when used properly, and they break the logs up nicely for reading.
|
||||
|
||||
I have used this for a while now professionally in a few places. The feedback has been very positive regarding helping make pipeline logs more readable and the flow more understandable.
|
||||
|
||||
The `errorBanner` method above works the same way, but it fails the script immediately. This helps highlight where and what caused the failure.
|
||||
|
||||
### Best practices
|
||||
|
||||
1. Use `echo` Jenkins steps liberally throughout your Groovy code to inform the user what you're doing. These can also help with documenting your code.
|
||||
2. Use empty log statements (an empty echo step in Groovy, `echo ''`, or just `echo` in shell) to break up the output for easier readability. You probably use empty lines in your code for the same purpose.
|
||||
3. Avoid the trap of using `set +x` in your scripts, which hides logging executed shell statements. It doesn't so much clean up your logs as it makes your pipelines a black box that hides what your pipeline is doing and any errors that appear. Make sure your pipelines' functionality is as transparent as possible.
|
||||
4. If your pipeline creates intermediate artifacts that developers and/or DevOps personnel could use to help debug issues, then log their contents, too. Yes, it makes the logs longer, but it's only text. It will be useful information at some point, and what else is a log (if utilized properly) than a wealth of information about what happened and why?
|
||||
|
||||
|
||||
|
||||
### Kubernetes Secrets: Where full transparency won't work
|
||||
|
||||
There are some things that you _don't_ want to end up in your logs and be exposed. If you're using Kubernetes and referencing data held in a Kubernetes Secret, then you definitely don't want that data exposed in a log because the data is only obfuscated and not encrypted.
|
||||
|
||||
Imagine you want to take some data held in a Secret and inject it into a templated JSON file. (The full contents of the Secret and the JSON template are irrelevant for this example.) You want to be transparent and log what you're doing since that's best practice, but you don't want to expose your Secret data.
|
||||
|
||||
Change your script's mode from debugging (`set -x`) to command logging (`set -v`). At the end of the sensitive portion of the script, reset the shell to debugging mode:
|
||||
|
||||
|
||||
```
|
||||
sh """
|
||||
# change script mode from debugging to command logging
|
||||
set +x -v
|
||||
|
||||
# capture data from secret in shell variable
|
||||
MY_SECRET=\$(kubectl get secret my-secret --no-headers -o 'custom-column=:.data.my-secret-data')
|
||||
|
||||
# replace template placeholder inline
|
||||
sed s/%TEMPLATE_PARAM%/${MY_SECRET_DATA}/ my-template-file.json
|
||||
|
||||
# do something with modified template-file.json...
|
||||
|
||||
# reset the shell to debugging mode
|
||||
set -x +v
|
||||
"""
|
||||
```
|
||||
|
||||
This will output this line to the logs:
|
||||
|
||||
|
||||
```
|
||||
`sed s/%TEMPLATE_PARAM%/${MY_SECRET_DATA}/ my-template-file.json`
|
||||
```
|
||||
|
||||
This doesn't realize the shell variable `MY_SECRET_DATA`, unlike in shell debug mode. Obviously, this isn't as helpful as debug mode if a problem occurs at this point in the pipeline and you're trying to figure out what went wrong. But it's the best balance between keeping your pipeline execution transparent for both developers and DevOps while also keeping your Secrets hidden.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/jenkins-logs
|
||||
|
||||
作者:[Evan "Hippy" Slatis][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/hippyod
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop)
|
||||
[2]: https://www.jenkins.io/
|
||||
[3]: https://www.jenkins.io/doc/book/pipeline/syntax/#stage
|
||||
[4]: https://opensource.com/article/20/12/groovy
|
||||
[5]: https://www.jenkins.io/doc/pipeline/steps/workflow-cps/#load-evaluate-a-groovy-source-file-into-the-pipeline-script
|
||||
[6]: https://www.jenkins.io/doc/book/pipeline/shared-libraries/
|
@ -0,0 +1,104 @@
|
||||
[#]: subject: (SonoBus: An Open Source Peer-to-Peer Audio Streaming App with Cross-Platform Support)
|
||||
[#]: via: (https://itsfoss.com/sonobus/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
SonoBus: An Open Source Peer-to-Peer Audio Streaming App with Cross-Platform Support
|
||||
======
|
||||
|
||||
_**Brief: An interesting open-source peer-to-peer audio streaming app which offers a simple user interface with powerful functionalities.**_
|
||||
|
||||
### SonoBus: Cross-Platform Audio Streaming App
|
||||
|
||||
Audio streaming services are extremely popular nowadays when listening to music. However, a local collection is still a useful way that does not require to be constantly connected to the Internet.
|
||||
|
||||
Even though a streaming music service is convenient, you do not really own the music. So, if there is a licensing issue, the platform might remove your favorite music, and you cannot do anything about it.
|
||||
|
||||
And, with a local music collection, you do not have that problem. But, how do you stream your local music over a network of devices or share with a group?
|
||||
|
||||
![][1]
|
||||
|
||||
SonoBus can be a solution to the problem. Not just limited to music, but just any audio like practicing music with a group of friends remotely or collaborating to make music, why not?
|
||||
|
||||
Let us take a look at what it offers.
|
||||
|
||||
### Features of SonoBus
|
||||
|
||||
![][2]
|
||||
|
||||
SonoBus is relatively simple to use, but the features offered can be overwhelming. So, before proceeding, you might want to know what it lets you do to get a head start:
|
||||
|
||||
* Ability to connect to multiple users
|
||||
* Create a group with optional password
|
||||
* Share audio input from your microphone
|
||||
* Share audio stream from a file
|
||||
* Mono/Stereo support
|
||||
* Playback to the group
|
||||
* Record audio from everyone
|
||||
* Ability to mute individual users or everyone
|
||||
* Can be connected via the Internet or the local network
|
||||
* Metronome support for collaborating to make music or remote practice sessions
|
||||
* High-quality audio support up to 256 Kbps
|
||||
* Input mixer
|
||||
* Pan support
|
||||
* Useful effects supported (Noise Gate, Compressor, and EQ)
|
||||
* Works with JACK and ALSA
|
||||
* Cross-platform support (Windows, macOS, Android, iOS, and Linux)
|
||||
|
||||
|
||||
|
||||
While I tried to mention all the essential features, you get so much control to adjust the volume, quality, latency, and how the audio sounds with the help of effects.
|
||||
|
||||
![][3]
|
||||
|
||||
The best thing about it is **cross-platform support**, which makes it an interesting choice for any group of users no matter why you want to stream audio.
|
||||
|
||||
### Installing SonoBus in Linux
|
||||
|
||||
You can easily install the [Snap package][4] or [Flatpak package][5] no matter what Linux distribution you use. If you do not want to use them, you can add the official repository manually to get it installed:
|
||||
|
||||
```
|
||||
echo "deb http://pkg.sonobus.net/apt stable main" | sudo tee /etc/apt/sources.list.d/sonobus.list
|
||||
|
||||
sudo wget -O /etc/apt/trusted.gpg.d/sonobus.gpg https://pkg.sonobus.net/apt/keyring.gpg
|
||||
|
||||
sudo apt update && sudo apt install sonobus
|
||||
```
|
||||
|
||||
You can also download it for your preferred platform through its official website.
|
||||
|
||||
[SonoBus][6]
|
||||
|
||||
### Closing Thoughts
|
||||
|
||||
SonoBus is an impressive audio streaming application with plenty of potential use-cases, but it has its share of issues and may not be the perfect solution for everyone.
|
||||
|
||||
For instance, I noticed that the desktop app takes a significant amount of system resources, so that could be a problem for older systems.
|
||||
|
||||
Also, the Android app on Play Store is still in early access (beta). It works as expected for my quick test session, but I haven’t used it for a long time – so there could be expected hiccups when relying on it for cross-platform sessions.
|
||||
|
||||
In either case, it works quite well with plenty of features for every type of use-case. Do give it a try if you haven’t.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/sonobus/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/sonobus-screenshot.png?resize=800%2C605&ssl=1
|
||||
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/sonus-screenshot-1.png?resize=800%2C619&ssl=1
|
||||
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/sonobus-official.png?resize=800%2C545&ssl=1
|
||||
[4]: https://snapcraft.io/sonobus
|
||||
[5]: https://flathub.org/apps/details/net.sonobus.SonoBus
|
||||
[6]: https://sonobus.net/
|
@ -0,0 +1,352 @@
|
||||
[#]: subject: (Use the Alpine email client in your Linux terminal)
|
||||
[#]: via: (https://opensource.com/article/21/5/alpine-linux-email)
|
||||
[#]: author: (David Both https://opensource.com/users/dboth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Use the Alpine email client in your Linux terminal
|
||||
======
|
||||
Configure Alpine to handle your email the way you like it.
|
||||
![Chat via email][1]
|
||||
|
||||
Email is an important communications medium and will remain so for the foreseeable future. I have used many different email clients over the last 30 years, and [Thunderbird][2] is what I have used the most in recent years. It is an excellent and functional desktop application that provides all the features that most people need—including me.
|
||||
|
||||
One of the things that makes a good system administrator is curiosity—and I have more than my share. Over the last few months, I have become dissatisfied with Thunderbird—not because of anything particularly wrong with it. Rather, after many years, I grew tired of it. I was curious about whether I could find an email client to provide a better (or at least different) experience than Thunderbird and be at least as efficient.
|
||||
|
||||
I decided it was time for a change—and not just to a different graphical user interface (GUI) mail client. None of the other GUI-based email clients available on Linux have ever really appealed to me. I finally realized that what I wanted was to go back to [Alpine][3], the descendant of Pine, the text user interface (TUI) email client I used for a time about 20 years ago.
|
||||
|
||||
This desire to go retro with my email client started back in 2017 when I wrote an [article about Alpine][4] for Opensource.com. I described how I used Alpine to circumvent problems sending emails from ISP networks when I was traveling away from my home email system.
|
||||
|
||||
I recently decided to exclusively use Alpine for email. The main attraction is the ease of use offered by keeping my hands on the keyboard (and reducing the number of times I need to reach for the mouse). It is also about scratching my sysadmin itch to do something different and use an excellent text mode interface in the process.
|
||||
|
||||
## Getting started
|
||||
|
||||
I already had Alpine set up from my previous use, so it was just a matter of starting to use it again.
|
||||
|
||||
Well, not really.
|
||||
|
||||
I previously set up Alpine on my mail server—I used secure shell (SSH) to log into the email server using my email account and then launched Alpine to access my email. I explained this in my previous article, but the bottom line is that I wanted to circumvent ISPs that block outbound port 25 for mail transfer in the name of spam reduction. A bit of bother, really.
|
||||
|
||||
But now I want to run Alpine on my workstation or laptop. It's relatively simple to configure Alpine on the same host as the email server. Using it on a remote computer requires a good bit more.
|
||||
|
||||
## Install Alpine
|
||||
|
||||
Installing Alpine on Fedora is simple because it is available from the Fedora repository. Just use DNF as root:
|
||||
|
||||
|
||||
```
|
||||
`# dnf -y install alpine`
|
||||
```
|
||||
|
||||
This command installs Alpine and any prerequisite packages that are not already installed. Alpine's primary dependencies are Sendmail, Hunspell, OpenLDAP, OpenSSL, krb5-libs, ncurses, and a couple of others. In my case, Alpine was the only package installed.
|
||||
|
||||
## Launch Alpine
|
||||
|
||||
To launch Alpine, open a terminal session, type **alpine** on the command line, and press **Enter**.
|
||||
|
||||
The first time you start Alpine, it displays a message that it is creating the user directory structure on the localhost. It then displays a Welcome message, and if you press **Enter**, you are treated to a copy of Apache's license. That is good, and you should probably read the license at some point so that you know its terms. But the most important thing right now is to configure Alpine to get your email.
|
||||
|
||||
For now, just press lowercase **e** to exit from the greeting message. You should now see Alpine's Main menu (I deleted several blank lines of the output to save space):
|
||||
|
||||
|
||||
```
|
||||
+----------------------------------------------------+
|
||||
| ALPINE 2.24 MAIN MENU Folder: INBOX No Messages |
|
||||
| |
|
||||
| HELP - Get help using Alpine |
|
||||
| |
|
||||
| C COMPOSE MESSAGE - Compose and send a message |
|
||||
| |
|
||||
| I MESSAGE INDEX - View messages in current folder |
|
||||
| |
|
||||
| L FOLDER LIST - Select a folder to view |
|
||||
| |
|
||||
| A ADDRESS BOOK - Update address book |
|
||||
| |
|
||||
| S SETUP - Configure Alpine Options |
|
||||
| |
|
||||
| Q QUIT - Leave the Alpine program |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| For Copyright information press "?" |
|
||||
| |
|
||||
| ? Help P PrevCmd R RelNotes |
|
||||
| O OTHER CMDS > [ListFldrs] N NextCmd K KBLock |
|
||||
+----------------------------------------------------+
|
||||
```
|
||||
|
||||
_Figure 1: Alpine's Main menu_
|
||||
|
||||
Alpine creates the `~mail` directory localhost during initial use. When you configure the IMAP server, Alpine creates the default `~/mail`, `~/mail/sent-mail`, and `saved-messages` folders in your home directory on the IMAP server. You can change the defaults, but I recommend against it. When using IMAP, emails are not stored locally unless you copy them to local folders. All emails are stored in the Inbox on the SMTP server until they are saved to a folder on the IMAP server. The SMTP and IMAP servers might use the same or different hosts.
|
||||
|
||||
Alpine also assumes that the Inbox is located at `/var/spool/mail/user_name` on the email SMTP server. This article explains how to configure both IMAP and SMTP servers. The email administrator for your organization—that might be you—will add your account to the IMAP server and provide you with the initial password.
|
||||
|
||||
## The Alpine interface
|
||||
|
||||
The Alpine user interface (UI) is a text-mode, menu-driven UI, also known as a TUI. This type of interface is also sometimes called captive user interface (CUI), which does not provide a command-line interface that can be used in scripts, for example. You must exit from the program to perform other tasks.
|
||||
|
||||
By contrast, the [mailx][5] program is an email program that can be used with either a TUI, from the command line, or in scripts. For example, you can use the following command to send the results of the free command directly to the sysadmin's email account:
|
||||
|
||||
|
||||
```
|
||||
`$ free | mailx -s "Free memory" sysadmin@example.com`
|
||||
```
|
||||
|
||||
But enough of that little side trip; there is work to do. Let's start with an explanation.
|
||||
|
||||
Notice in Figure 1 that all of the possible options in the Main menu in the center of the interface and the menu items along the bottom of the Alpine UI are shown as uppercase letters. But you can use either uppercase or lowercase when issuing commands; Alpine recognizes and responds to both. Uppercase is easier to see and recognize in the interface, but it's easier to use lowercase to enter commands and make menu selections. I will use uppercase letters in bold throughout this article to indicate menu selections (to mimic the Alpine UI).
|
||||
|
||||
On the Main menu, you can use the **Up** and **Down** arrow keys to highlight a different option and then press **Enter** to select it. The only way to access the menu items along the bottom of the Alpine screen (which I call the secondary menu, for lack of a better term) is by using the letter designated for each. There are two sets of secondary menu items. You can press **O** (the letter, not the number) to switch to the next set of commands, and press **O** again to toggle back to the original set. This keystroke only changes the secondary menu items.
|
||||
|
||||
Use the **Page Down** and **Page Up** keys to scroll through the commands if you can't see them all. The secondary menu at the bottom of the page usually lists all the commands available on the current menu; you will also see a message similar to this:
|
||||
|
||||
|
||||
```
|
||||
`[START of Information About Setup Command]`
|
||||
```
|
||||
|
||||
Should you find yourself at a place you don't want to be, such as creating a new email, responding to one, or making changes to settings, and decide you don't want to do that, **Ctrl+C** allows you to cancel the current task. In most cases, you will be asked to confirm that you want to cancel by pressing the **C** key. Note that **^C** in the secondary menu represents **Ctrl+C**. Many commands use the **Ctrl** key, so you will see **^** quite frequently on some menus.
|
||||
|
||||
Finally, to quit Alpine, you can press **Q**; when it asks, "Really quit Alpine?" respond with **Y** to exit. Like many commands, **Q** is not available from all menus.
|
||||
|
||||
## Help
|
||||
|
||||
Help is available from all of the menus I have tried. You can access detailed help for each menu item by highlighting the item you need information for and pressing the **?** key to obtain context-sensitive help.
|
||||
|
||||
## Configuration
|
||||
|
||||
When I started using Alpine regularly, I made the minimum changes to the configuration needed to send and receive emails. As I gained more experience with Alpine, I changed other configuration items to make things work easier or more to my liking.
|
||||
|
||||
First, I will explain the basic configurations required to make Alpine work, then move on to ones that make it work better.
|
||||
|
||||
If you have been exploring a bit on your own—which is a good thing—return to the Main menu. To get to Alpine's Configuration menu from the Main menu, type **S** for Setup. You will see a menu like this:
|
||||
|
||||
|
||||
```
|
||||
ALPINE 2.24 SETUP Folder: INBOX No Messages
|
||||
|
||||
This is the Setup screen for Alpine. Choose from the following commands:
|
||||
|
||||
(E) Exit Setup:
|
||||
This puts you back at the Main Menu.
|
||||
|
||||
(P) Printer:
|
||||
Allows you to set a default printer and to define custom
|
||||
print commands.
|
||||
|
||||
(N) Newpassword:
|
||||
Change your password.
|
||||
|
||||
(C) Config:
|
||||
Allows you to set or unset many features of Alpine.
|
||||
You may also set the values of many options with this command.
|
||||
|
||||
(S) Signature:
|
||||
Enter or edit a custom signature which will
|
||||
be included with each new message you send.
|
||||
|
||||
(A) AddressBooks:
|
||||
Define a non-default address book.
|
||||
|
||||
(L) collectionLists:
|
||||
You may define groups of folders to help you better organize your mail.
|
||||
|
||||
(R) Rules:
|
||||
This has up to six sub-categories: Roles, Index Colors, Filters,
|
||||
[START of Information About Setup Command ]
|
||||
? Help E Exit Setup N Newpassword S Signature L collectionList D Directory
|
||||
O OTHER CMDS P Printer C Config A AddressBooks R Rules K Kolor
|
||||
```
|
||||
|
||||
_Figure 2: Alpine Setup menu_
|
||||
|
||||
The Setup menu groups the very large number of setup items into related categories to, hopefully, make the ones you want easier to locate. Use **Page Down** and **Page Up** to scroll through the commands if you can't see them all.
|
||||
|
||||
I'll start with the settings necessary to get email—Alpine's entire purpose—up and running.
|
||||
|
||||
## Config
|
||||
|
||||
The Config section contains 15 pages (on my large screen) of option- and feature-configuration items. These settings can be used to set up your SMTP and IMAP connections to the email server and define the way many aspects of Alpine work. In these examples, I'll use the `example.com` domain name (which is the virtual network I use for testing and experimenting). Alpine's configuration is stored in the `~/.pinerc` file, created the first time you start Alpine.
|
||||
|
||||
The first page of the Setup Configuration menu contains most of the settings required to configure Alpine to send and receive email:
|
||||
|
||||
|
||||
```
|
||||
ALPINE 2.24 SETUP CONFIGURATION Folder: INBOX No Messages
|
||||
|
||||
Personal Name = <No Value Set: using "Test User">
|
||||
User Domain = <No Value Set>
|
||||
SMTP Server (for sending) = <No Value Set>
|
||||
NNTP Server (for news) = <No Value Set>
|
||||
Inbox Path = <No Value Set: using "inbox">
|
||||
Incoming Archive Folders = <No Value Set>
|
||||
Pruned Folders = <No Value Set>
|
||||
Default Fcc (File carbon copy) = <No Value Set: using "sent-mail">
|
||||
Default Saved Message Folder = <No Value Set: using "saved-messages">
|
||||
Postponed Folder = <No Value Set: using "postponed-msgs">
|
||||
Read Message Folder = <No Value Set>
|
||||
Form Letter Folder = <No Value Set>
|
||||
Trash Folder = <No Value Set: using "Trash">
|
||||
Literal Signature = <No Value Set>
|
||||
Signature File = <No Value Set: using ".signature">
|
||||
Feature List =
|
||||
Set Feature Name
|
||||
\--- ----------------------
|
||||
[ Composer Preferences ]
|
||||
[X] Allow Changing From (default)
|
||||
[ ] Alternate Compose Menu
|
||||
[ ] Alternate Role (#) Menu
|
||||
[ ] Compose Cancel Confirm Uses Yes
|
||||
[ ] Compose Rejects Unqualified Addresses
|
||||
[ ] Compose Send Offers First Filter
|
||||
[ ] Ctrl-K Cuts From Cursor
|
||||
[ ] Delete Key Maps to Ctrl-D
|
||||
[ ] Do Not Save to Deadletter on Cancel
|
||||
[Already at start of screen]
|
||||
? Help E Exit Setup P Prev - PrevPage A Add Value % Print
|
||||
O OTHER CMDS C [Change Val] N Next Spc NextPage D Delete Val W WhereIs
|
||||
```
|
||||
|
||||
_Figure 3: First page of Alpine's Setup Configuration menu_
|
||||
|
||||
This is where you define the parameters required to communicate with the email server. To change a setting, use the **Arrow** keys to move the selection bar to the desired configuration item and press **Enter**. You can see in Figure 3 that none of the basic configuration items have any values set.
|
||||
|
||||
The **Personal Name** item uses the [Gecos field][6] of the Unix `/etc/passwd` entry for the logged-in user to obtain the default name. This is just a name Alpine uses for display and has no role in receiving or sending email. I usually call this the "pretty name." In this case, the default name is fine, so I will leave it as it is.
|
||||
|
||||
There are some configuration items that you must set. Start with the **User Domain**, which is the current computer's domain name. Mine is a virtual machine I use for testing and examples in my books. Use the command line to get the fully qualified domain name (FQDN) and the hostname. In Figure 4, you can see that the domain name is `example.com`:
|
||||
|
||||
|
||||
```
|
||||
$ hostnamectl
|
||||
Static hostname: testvm1.example.com
|
||||
Icon name: computer-vm
|
||||
Chassis: vm
|
||||
Machine ID: 616ed83d97594a53814c35bc6c078d43
|
||||
Boot ID: fd721c46a9c44c9ab8ea392cef77b661
|
||||
Virtualization: oracle
|
||||
Operating System: Fedora 33 (Xfce)
|
||||
CPE OS Name: cpe:/o:fedoraproject:fedora:33
|
||||
Kernel: Linux 5.10.23-200.fc33.x86_64
|
||||
Architecture: x86-64
|
||||
```
|
||||
|
||||
_Figure 4: Obtaining the hostname and domain name_
|
||||
|
||||
Once you have the FQDN, select the **User Domain** entry and press **Enter** to see the entry field at the bottom of the Alpine screen (as shown in Figure 5). Type your domain name and press **Enter** (using _your_ network's domain and server names):
|
||||
|
||||
|
||||
```
|
||||
ALPINE 2.24 SETUP CONFIGURATION Folder: INBOX No Messages
|
||||
|
||||
Personal Name = <No Value Set: using "Test User">
|
||||
User Domain = <No Value Set>
|
||||
SMTP Server (for sending) = <No Value Set>
|
||||
NNTP Server (for news) = <No Value Set>
|
||||
Inbox Path = <No Value Set: using "inbox">
|
||||
Incoming Archive Folders = <No Value Set>
|
||||
Pruned Folders = <No Value Set>
|
||||
Default Fcc (File carbon copy) = <No Value Set: using "sent-mail">
|
||||
Default Saved Message Folder = <No Value Set: using "saved-messages">
|
||||
Postponed Folder = <No Value Set: using "postponed-msgs">
|
||||
Read Message Folder = <No Value Set>
|
||||
Form Letter Folder = <No Value Set>
|
||||
Trash Folder = <No Value Set: using "Trash">
|
||||
Literal Signature = <No Value Set>
|
||||
Signature File = <No Value Set: using ".signature">
|
||||
Feature List =
|
||||
Set Feature Name
|
||||
\--- ----------------------
|
||||
[ Composer Preferences ]
|
||||
[X] Allow Changing From (default)
|
||||
[ ] Alternate Compose Menu
|
||||
[ ] Alternate Role (#) Menu
|
||||
[ ] Compose Cancel Confirm Uses Yes
|
||||
[ ] Compose Rejects Unqualified Addresses
|
||||
[ ] Compose Send Offers First Filter
|
||||
[ ] Ctrl-K Cuts From Cursor
|
||||
[ ] Delete Key Maps to Ctrl-D
|
||||
[ ] Do Not Save to Deadletter on Cancel
|
||||
Enter the text to be added : example.com
|
||||
^G Help
|
||||
^C Cancel Ret Accept
|
||||
```
|
||||
|
||||
_Figure 5: Type the domain name into the text entry field._
|
||||
|
||||
### Required config
|
||||
|
||||
These are the basic configuration items you need to send and receive email:
|
||||
|
||||
* **Personal Name**
|
||||
* Your name
|
||||
* This is the pretty name Alpine uses for the From and Return fields in emails.
|
||||
* **User Domain**
|
||||
* `example.com:25/user=SMTP_Authentication_UserName`
|
||||
* This is the email domain for your email client. This might be different from the User Domain name. This line also contains the SMTP port number and the user name for SMTP authentication.
|
||||
* **SMTP server**
|
||||
* SMTP
|
||||
* This is the name of the outbound SMTP email server. It combines with the User Domain name to create the FQDN for the email server.
|
||||
* **Inbox Path**
|
||||
* `{IMAP_server)}Inbox`
|
||||
* This is the name of the IMAP server enclosed in curly braces (`{}`) and the name of the Inbox. Note that this directory location is different from the inbound IMAP email. The usual location for the inbox on the server is `/var/spool/mail/user_name`.
|
||||
* **Default Fcc** (file carbon copy)
|
||||
* `{IMAP_server)}mail/sent`
|
||||
* This is the mailbox (folder) where sent mail is stored. The default mail directory on the server is usually `~/mail`, but `mail/` must be specified in this and the next two entries, or the folders will be placed in the home directory instead.
|
||||
* **Default Saved Message Folder**
|
||||
* `{IMAP_server)}mail/saved-messages`
|
||||
* This is the default folder when saving a message to a folder if you don't use `^t` to specify a different one.
|
||||
* **Trash Folder**
|
||||
* `{IMAP_server)}mail/Trash`
|
||||
* **Literal Signature**
|
||||
* A signature string
|
||||
* I don't use this, but it's an easy place to specify a simple signature.
|
||||
* **Signature File**
|
||||
* `~/MySignature.sig`
|
||||
* This points to the file that contains your signature file.
|
||||
|
||||
|
||||
|
||||
### Optional config
|
||||
|
||||
Here are the features I changed to make Alpine work more to my liking. They are not about getting Alpine to send and receive email, but about making Alpine work the way you want it to. Unless otherwise noted, I turned all of these features on. Features that are turned on by default have the string `(default)` next to them in the Alpine display. Because they are already turned on, I will not describe them.
|
||||
|
||||
* **Alternate Role (`#`) Menu:** This allows multiple identities using different email addresses on the same client and server. The server must be configured to allow multiple addresses to be delivered to your primary email account.
|
||||
* **Compose Rejects Unqualified Addresses:** Alpine will not accept an address that is not fully qualified. That is, it must be in the form `<username@example.com>`.
|
||||
* **Enable Sigdashes:** This enables Alpine to automatically add dashes (`--`) in the row just above the signature. This is a common way of delineating the start of the signature.
|
||||
* **Prevent User Lookup in Password File:** This prevents the lookup of the full user name from the Gecos field of the passwd file.
|
||||
* **Spell Check Before Sending:** Although you can invoke the spell checker at any time while composing an email, this forces a spell check when you use the `^X` keystroke to send an email.
|
||||
* **Include Header in Reply:** This includes a message's headers when you reply.
|
||||
* **Include Text in Reply:** This includes the text of the original message in your reply.
|
||||
* **Signature at Bottom:** Many people prefer to have their signature at the very bottom of the email. This setting changes the default, which puts the signature at the end of the reply and before the message being replied to.
|
||||
* **Preserve Original Fields:** This preserves the original addresses in the **To:** and **CC:** fields when you reply to a message. If this feature is disabled when you reply to a message, the original sender is added to the **To:** field, all other recipients are added to the **CC:** field, and your address is added to the **From:** field.
|
||||
* **Enable Background Sending:** This speeds the Alpine user interface response when sending an email.
|
||||
* **Enable Verbose SMTP Posting:** This produces more verbose information during SMTP conversations with the server. It is a problem-determination aid for the sysadmin.
|
||||
* **Warn if Blank Subject:** This prevents sending emails with no subject.
|
||||
* **Combined Folder Display:** This combines all folder collections into a single main display. Otherwise, collections will be in separate views.
|
||||
* **Combined Subdirectory Display:** This combines all subdirectories' collections into a single main display. Otherwise, subdirectories will be in separate views. This is useful when searching for a subdirectory to attach or save files.
|
||||
* **Enable Incoming Folders Collection:** This lists all incoming folders in the same collection as the Inbox. Incoming folders can be used with a tool like procmail to presort email into folders other than the Inbox and makes it easier to see the folders where new emails are sorted.
|
||||
* **Enable Incoming Folders Checking:** This enables Alpine to check for new emails in the incoming folders collection.
|
||||
* **Incoming Checking Includes Total:** This displays the number of old and new emails in the incoming folders.
|
||||
* **Expanded View of Folders:** This displays all folders in each collection when you view the **Folder List** screen. Otherwise, only the collections are shown, and the folders are not shown until selected.
|
||||
* **Separate Folder and Directory Entries:** If your mail directory has email folders and regular directories that use the same name, this causes Alpine to list them separately.
|
||||
* **Use Vertical Folder List:** This sorts mail folders vertically first and then horizontally. The default is horizontal, then vertical.
|
||||
* **Convert Dates To Localtime:** By default, all dates and times are displayed in their originating time zones. This converts the dates to display in local time.
|
||||
* **Show Sort in Titlebar:** Alpine can sort emails in a mail folder using multiple criteria. This causes the sort criteria to be displayed in the title bar.
|
||||
* **Enable Message View Address Links:** This highlights email addresses in the body of the email.
|
||||
* **Enable Message View Attachment Links:** This highlights URL links in the body of the email.
|
||||
* **Prefer Plain Text:** Many emails contain two versions, plain text and HTML. When this feature is turned on, Alpine always displays the plain text version. You can use the **A** key to toggle to the "preferred" version, usually the HTML one. I usually find the plain text easier to visualize the structure of and read the email. This can depend upon the sending client, so I use the **A** key when needed.
|
||||
* **Enable Print Via Y Command:** This prints a message using the previous default, **Y**. Because **Y** is also used to confirm many commands, the keystroke can inadvertently cause you to print a message. The new default is **%** to prevent accidental printing. I like the ease of using **Y**, but it has caused some extra print jobs, so I am thinking about turning this feature off.
|
||||
* **Print Formfeed Between Messages:** This prints each message on a new sheet of paper.
|
||||
* **Customized Headers:** Customized headers enables overriding the default **From:** and **Reply-To:** headers. I set mine to: [code] - From: "David Both" <[[david@example.com][7]](mailto:[david@both.org][8])>
|
||||
\- Reply-To: "David Both"
|
||||
<[[david@example.com][7]](mailto:[david@both.org][8])>
|
||||
```
|
||||
* **Sort key:** By default, Alpine sorts messages in a folder by arrival time. I found this to be a bit confusing, so I changed it to **Date**, which can be significantly different from arrival time. Many spammers use dates and times in the past or future, so this setting can sort the future ones to the top of the list (or bottom, depending on your preferences for forward or reverse sorts).
|
||||
* **Image Viewer:** This feature allows you to specify the image viewer to use when displaying graphics attached to or embedded in an email. This only works when using Alpine in a terminal window on the graphical desktop. It will not work in a text-only virtual console. I always set this to `=okular` because [Okular][9] is my preferred viewer.
|
||||
* **URL-Viewer:** This tells Alpine what web browser you
|
70
sources/tech/20210511 What is fog computing.md
Normal file
70
sources/tech/20210511 What is fog computing.md
Normal file
@ -0,0 +1,70 @@
|
||||
[#]: subject: (What is fog computing?)
|
||||
[#]: via: (https://opensource.com/article/21/5/fog-computing)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
What is fog computing?
|
||||
======
|
||||
Learn about the network comprised of all the connected devices in our
|
||||
lives.
|
||||
![Man at laptop on a mountain][1]
|
||||
|
||||
In the early days, computers were big and expensive. There were few users in the world, and they had to reserve time on a computer (and show up in person) to have their punchcards processed. Systems called [mainframes][2] made many innovations and enabled time-shared tasks on terminals (like desktop computers, but without their own CPU).
|
||||
|
||||
Skip forward to today, when powerful computation is [as cheap as US$35 and no larger than a credit card][3]. That doesn't even begin to cover all the little devices in modern life that gather and process data. Take a high-level view of this collection of computers, and you can imagine all of these devices outnumbering grains of sands or particles in a cloud.
|
||||
|
||||
It so happens that the term "cloud computing" is already occupied, so there needs to be a unique name for the network comprised of the Internet of Things (IoT) and other strategically situated servers. And besides, if there's already a cloud representing nodes of a data center, then there's surely something unique about the nodes intermingling with us folk outside that cloud.
|
||||
|
||||
### Welcome to fog computing
|
||||
|
||||
The cloud delivers computing services over the internet. But the data centers that make up the cloud are big and relatively few compared to their number of potential clients. This suggests potential bottlenecks when data is sent back and forth between the cloud and its many users.
|
||||
|
||||
Fog computing, by contrast, can outnumber its potential clients without risking a bottleneck because the devices perform much of the data collection or computation. It's the outer "edge" of the cloud, the part of a cloud that touches down to the ground.
|
||||
|
||||
### Fog and edge computing
|
||||
|
||||
Fog computing and [edge computing][4] are essentially synonymous. Both have strong associations with both the cloud and IoT and make the same architectural assumptions:
|
||||
|
||||
* The closer you are to the CPU doing the work, the faster the data transfer.
|
||||
* Like [Linux][5], there's a strong advantage to having small, purpose-built computers that can "do one thing and do it well." (Of course, our devices actually do more than just one thing, but from a high-level view, a smartwatch you bought to monitor your health is essentially doing "one" thing.)
|
||||
* Going offline is inevitable, but a good device can function just as effectively in the interim and then sync up when reconnected.
|
||||
* Local devices can be simpler and cheaper than large data centers.
|
||||
|
||||
|
||||
|
||||
### Networking on the edge
|
||||
|
||||
It's tempting to view fog computing as a completely separate entity from the cloud, but they're just two parts of the whole. The cloud needs the infrastructure of the digital enterprise, including public cloud providers, telecommunication companies, and even specialized corporations running their own services. Localized services are also important to provide waystations between the cloud core and its millions and millions of clients.
|
||||
|
||||
**[Read next: [An Architect's guide to edge computing essentials][6]]**
|
||||
|
||||
Fog computing, located at the edge of the cloud, intermingles with clients wherever they are located. Sometimes, this is a consumer setting, such as your own home or car, while other times, it's a business interest, such as price-monitoring devices in a retail store or vital safety sensors on a factory floor.
|
||||
|
||||
### Fog computing is all around you
|
||||
|
||||
Fog computing is built up of all the connected devices in our lives: drones, phones, watches, fitness monitors, security monitors, home automation, portable gaming devices, gardening automation, weather sensors, air-quality monitors, and much, much more. Ideally, the data it provides helps to build a better and more informed future. There are lots of great open source projects out there that are working toward improving health and wellness—or even just making life a little more entertaining—and it's all happening thanks to fog and cloud computing. _Our_ job, however, is to make sure it [stays open][7].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/fog-computing
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_laptop_code_programming_mountain_view.jpg?itok=yx5buqkr (Man at laptop on a mountain)
|
||||
[2]: https://opensource.com/article/19/9/linux-mainframes-part-1
|
||||
[3]: https://opensource.com/resources/raspberry-pi
|
||||
[4]: https://www.redhat.com/en/topics/edge-computing/what-is-edge-computing
|
||||
[5]: https://opensource.com/resources/linux
|
||||
[6]: https://www.redhat.com/architect/edge-computing-essentials
|
||||
[7]: https://opensource.com/article/20/10/keep-cloud-open
|
95
sources/tech/20210511 What is the OSI model.md
Normal file
95
sources/tech/20210511 What is the OSI model.md
Normal file
@ -0,0 +1,95 @@
|
||||
[#]: subject: (What is the OSI model?)
|
||||
[#]: via: (https://jvns.ca/blog/2021/05/11/what-s-the-osi-model-/)
|
||||
[#]: author: (Julia Evans https://jvns.ca/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
What is the OSI model?
|
||||
======
|
||||
|
||||
Today I tweeted something about how the OSI model doesn’t correspond well to the reality of how TCP/IP works and it made me think – what is the OSI model, exactly? From reading some of the replies on Twitter, it seems like there are at least 3 different ways to think about it:
|
||||
|
||||
1. A literal description of how TCP/IP works
|
||||
2. An abstract model that you can use to describe and compare a lot of different networking protocols
|
||||
3. A literal description of some computer networking protocols from the 1980s that are mostly no longer used today
|
||||
|
||||
|
||||
|
||||
In this post I’m not going to try to argue that any one of these is “really” what the OSI model is – it seems like different people think about the OSI model in all of these ways, and that’s okay.
|
||||
|
||||
### the OSI model has 7 layers
|
||||
|
||||
Before we talk about what the OSI model means, let’s very briefly discuss what it is: it’s an abstract model for how networking works with 7 numbered layers:
|
||||
|
||||
* Layer 1: physical layer
|
||||
* Layer 2: data link
|
||||
* Layer 3: network
|
||||
* Layer 4: transport
|
||||
* Layer 5: session
|
||||
* Layer 6: presentation
|
||||
* Layer 7: application
|
||||
|
||||
|
||||
|
||||
I won’t say more about what each of those is supposed to mean, there are a thousand explanations of it online.
|
||||
|
||||
### the OSI model as a literal description of how TCP/IP works
|
||||
|
||||
First, I want to talk about one common way people use the OSI model in practice: as a literal description of how TCP/IP works. Some layers of the OSI model are really easy to map to TCP/IP:
|
||||
|
||||
* Layer 2 corresponds to Ethernet
|
||||
* Layer 3 corresponds to IP
|
||||
* Layer 4 corresponds to TCP or UDP (or ICMP etc)
|
||||
* Layer 7 corresponds to whatever is inside the TCP or UDP packet (for example a DNS query)
|
||||
|
||||
|
||||
|
||||
This mapping makes a lot of sense for layers 2, 3, and 4 – TCP packets have 3 headers corresponding to these 3 layers (the Ethernet header, the IP header, and the TCP header).
|
||||
|
||||
Having numbers to describe the different headers in a TCP packet is pretty useful – if you say “layer 2”, it’s clear that that lives “underneath” layer 3, because 2 is a smaller number than 3.
|
||||
|
||||
The weird thing about “OSI model as literal description” is that layers 5 and 6 don’t really correspond to anything in TCP/IP – I’ve heard a lot of different interpretations of what layers 5 or 6 could be (you could say layer 5 is TLS or something!) but they don’t have a clear correspondence like “every layer has a corresponding header in the TCP packet” the way layers 2, 3, and 4 do.
|
||||
|
||||
Also, some parts of TCP/IP don’t fit well into the OSI model even around layers 2-4 – for example, what layer is an ARP packet? ARP packets send some data with an Ethernet header, so does that mean they’re layer 3? Layer 2? The Wikipedia article listing different OSI layers categorizes it under “layer 2.5” which is pretty unsatisfying.
|
||||
|
||||
This is only really a problem because the OSI model is sometimes used to teach TCP/IP, and it’s confusing if it’s not made clear which parts of the model map well to TCP/IP and which don’t.
|
||||
|
||||
### the OSI model as an abstraction for comparing networking protocols
|
||||
|
||||
Another way of thinking of OSI that I’ve heard is that it’s an abstraction you can use to draw analogies between lots of different networking protocols. For example, if you want to understand how Bluetooth works, maybe you can use the OSI model to help you – here’s an diagram I found on [this page][1] showing how Bluetooth fits into the OSI model.
|
||||
|
||||
![][2]
|
||||
|
||||
As another example of this, [this Wikipedia article][3] has a list of OSI layers and which specific networking protocols correspond to those OSI layers.
|
||||
|
||||
### the OSI model as a literal description of some obsolete protocols
|
||||
|
||||
Some very brief research on Wikipedia says that in addition to an abstract description of 7 layers, the OSI model also contained a [bunch of specific protocols implementing those layers][4]. Apparently this happened during the [Protocol Wars][5] in the 70s and 80s, where the OSI model lost and TCP/IP won.
|
||||
|
||||
This explains why the OSI model doesn’t really correspond that well to TCP/IP, since if the OSI protocols had “won” then the OSI model _would_ correspond exactly to how internet networking actually works.
|
||||
|
||||
### that’s all!
|
||||
|
||||
I’m writing this because when I originally learned about the OSI model I found it super confusing (what are all these layers? are they real? is this actually how networking works? what’s happening?) and I wish someone had told me that (as someone who does not work with any networking protocols other than TCP/IP) I could just learn how layers 2, 3, 4, and 7 relate to TCP/IP and then ignore everything else about it. So hopefully this will help clear things up for somebody!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://jvns.ca/blog/2021/05/11/what-s-the-osi-model-/
|
||||
|
||||
作者:[Julia Evans][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://jvns.ca/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://flylib.com/books/en/4.215.1.116/1/
|
||||
[2]: https://jvns.ca/images/bluetooth.gif
|
||||
[3]: https://en.wikipedia.org/wiki/List_of_network_protocols_(OSI_model)
|
||||
[4]: https://en.wikipedia.org/wiki/OSI_protocols
|
||||
[5]: https://en.wikipedia.org/wiki/Protocol_Wars
|
@ -0,0 +1,148 @@
|
||||
[#]: subject: (Test Your Typing Speed in Linux Terminal With Ttyper)
|
||||
[#]: via: (https://itsfoss.com/ttyper/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
Test Your Typing Speed in Linux Terminal With Ttyper
|
||||
======
|
||||
|
||||
There are several ways to test and improve your typing speed. You can use online tools, install dedicated applications on the desktop or test in the Linux terminal.
|
||||
|
||||
Linux terminal? That’s right. From [browsing internet][1] to [playing games][2], you can do [so many fun things in the mighty Linux terminal][3]. Testing your typing speed is one of them.
|
||||
|
||||
### Ttyper: Terminal-based typing test tool
|
||||
|
||||
[Ttyper][4] is a tool written in [Rust][5] that allows you to practice your touch typing.
|
||||
|
||||
It gives a random selection of some of the most common English words. The correct typed words are highlighted in green and the incorrect ones in red and this happens in real time. You can press backspace and correct the words but that will contribute to a reduced score.
|
||||
|
||||
![][6]
|
||||
|
||||
When you finish typing all the displayed words, you get the result with your typing speed in words per minute, accuracy and number of correct keypresses. You can _**use Ctrl+C to exit**_ Ttyper if you are not in a mood for typing the entire section.
|
||||
|
||||
![][7]
|
||||
|
||||
You can see Ttyper in action in this GIF recorded by the developer.
|
||||
|
||||
![][8]
|
||||
|
||||
By default, you get 50 words to practice but you may expand that with command options. You can also use a custom text file and use its content to practice typing.
|
||||
|
||||
Command | Contents
|
||||
---|---
|
||||
ttyper | 50 of the 200 most common English words
|
||||
ttyper -w 100 | 100 of the 200 most common English words
|
||||
ttyper -w 100 -l english1000 | 100 of the 1000 most common English words
|
||||
ttyper text.txt | contents of test.txt split at whitespace
|
||||
|
||||
Ttyper also focuses on developers. It supports several programming languages and if you are a programmer, you may use it to test and improve your typing while you code.
|
||||
|
||||
![][9]
|
||||
|
||||
As of now, C, Csharp, Go, HTML, Java, JavaScript, Python, Ruby and Rust languages are supported.
|
||||
|
||||
You may change the language in the following manner:
|
||||
|
||||
```
|
||||
ttyper -l html
|
||||
```
|
||||
|
||||
By the way, the double ‘T’ in ‘Ttyper’ is not a typo. It is deliberate as TTY (**T**ele**TY**pewriter) represent the [terminal emulator][10], an indication that it is a terminal tool.
|
||||
|
||||
**Recommended Read:**
|
||||
|
||||
![][11]
|
||||
|
||||
#### [Present Slides in Linux Terminal With This Nifty Python Tool][12]
|
||||
|
||||
There are so many amusing and fun stuff you can do in the terminal. Making and presenting slides is just one of them.
|
||||
|
||||
### Installing Ttyper on Linux
|
||||
|
||||
Ttyper is built with Rust and you can install it on any Linux distribution that has support for Rust programming language and its [Cargo package manager][13].
|
||||
|
||||
Cargo is the Rust equivalent to Python’s PIP. There is a [central repository][14] and you can download and install the Rust packages along with its dependencies easily with Cargo.
|
||||
|
||||
I am going to add the instructions for installing Cargo on Ubuntu-based Linux distributions. You should be able to install it using your [distribution’s package manager][15].
|
||||
|
||||
Please make sure that you have universe repository enabled on Ubuntu. You can install Cargo with this command:
|
||||
|
||||
```
|
||||
sudo apt install cargo
|
||||
```
|
||||
|
||||
It will install Cargo package manager along with `rustc` package for Rust language.
|
||||
|
||||
Once you have Cargo installed on your system, use it install Ttyper with this command:
|
||||
|
||||
```
|
||||
cargo install ttyper
|
||||
```
|
||||
|
||||
This will add an executable rust file in .cargo/bin directory under your home directory. It will be mentioned at the end of the output of the package installation.
|
||||
|
||||
![][16]
|
||||
|
||||
You may switch to this directory:
|
||||
|
||||
```
|
||||
cd ~/.cargo/bin
|
||||
```
|
||||
|
||||
and run the ttyper executable:
|
||||
|
||||
```
|
||||
ttyper
|
||||
```
|
||||
|
||||
Of course, it’s not very convenient. This is why you should [add this directory to the PATH variable][17]. If you are familiar with the Linux command line, you can easily do that.
|
||||
|
||||
Unfortunately, I cannot give you the exact commands here because you need to provide the absolute PATH to this directory and that path name will differ based on your username. For example, for me, it is /home/abhishek/.cargo/bin. This absolute PATH will be different for you.
|
||||
|
||||
I advise reading about [absolute and relative path][18] for more clarity on this topic.
|
||||
|
||||
You can uninstall Ttyper by removing the binary file or use Cargo command in this manner:
|
||||
|
||||
```
|
||||
cargo uninstall ttyper
|
||||
```
|
||||
|
||||
If you like this nifty terminal tool, [star it on GitHub][4] to appreciate the developer’s effort.
|
||||
|
||||
As I mentioned at the beginning of this article, you can do a lot of cool stuff in the terminal. If you want to surprise your colleagues, maybe you can try [making presentation slides entirely in the Linux terminal][12].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/ttyper/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/terminal-web-browsers/
|
||||
[2]: https://itsfoss.com/best-command-line-games-linux/
|
||||
[3]: https://itsfoss.com/funny-linux-commands/
|
||||
[4]: https://github.com/max-niederman/ttyper
|
||||
[5]: https://www.rust-lang.org/
|
||||
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/ttyper-typing-speed-test-linux.png?resize=800%2C441&ssl=1
|
||||
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/05/ttyper-typing-test-result.png?resize=800%2C547&ssl=1
|
||||
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/05/ttyper.gif?resize=800%2C498&ssl=1
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/05/ttyper-typing-test-html.png?resize=800%2C441&ssl=1
|
||||
[10]: https://itsfoss.com/linux-terminal-emulators/
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/linux-terminal-presentation.jpg?fit=800%2C450&ssl=1
|
||||
[12]: https://itsfoss.com/presentation-linux-terminal/
|
||||
[13]: https://doc.rust-lang.org/cargo/index.html
|
||||
[14]: https://crates.io/
|
||||
[15]: https://itsfoss.com/package-manager/
|
||||
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/05/installing-ttyper-linux.png?resize=800%2C399&ssl=1
|
||||
[17]: https://itsfoss.com/add-directory-to-path-linux/
|
||||
[18]: https://linuxhandbook.com/absolute-vs-relative-path/
|
@ -1,202 +0,0 @@
|
||||
[#]: subject: "Scheduling tasks with cron"
|
||||
[#]: via: "https://fedoramagazine.org/scheduling-tasks-with-cron/"
|
||||
[#]: author: "Darshna Das https://fedoramagazine.org/author/climoiselle/"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "MjSeven"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
使用 cron 调度任务
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
Photo by [Yomex Owo][2] on [Unsplash][3]
|
||||
|
||||
Cron 是一个调度守护进程,它以指定的时间间隔执行任务,这些任务称为 _corn_ 作业,主要用于自动执行系统维护或管理任务。例如,你可以设置一个 _cron_ 作业来自动执行重复的任务,比如备份数据库或数据,使用最新的安全补丁更新系统,检查磁盘空间使用情况,发送电子邮件等等。 _cron_ 作业可以按分钟、小时、日、月、星期或它们的任意组合运行。
|
||||
|
||||
### **cron 的一些优点**
|
||||
|
||||
以下是使用 _cron_ 作业的一些优点:
|
||||
|
||||
* 你可以更好地控制作业的运行时间。例如,你可以精确到分钟、小时、天等。
|
||||
* 它消除了为循环任务逻辑而去写代码的需要,当你不再需要执行任务时,可以直接关闭它。
|
||||
* 作业在不执行时不会占用内存,因此你可以节省内存分配。
|
||||
* 如果一个作业执行失败并由于某种原因退出,它将在指定的时间再次运行。
|
||||
|
||||
### 安装 cron 守护进程
|
||||
|
||||
幸运的是,Fedora Linux 预先配置了运行重要的系统任务来保持系统更新,有几个实用程序可以运行任务例如 _cron_、_anacorn_、_at_ 和 _batch_ 。本文只关注 _cron_ 实用程序的安装。Cron 和 _cronie_ 包一起安装,cronie 包也提供 _cron_ 服务。
|
||||
|
||||
要确定软件包是否已经存在,使用 rpm 命令:
|
||||
|
||||
```bash
|
||||
$ rpm -q cronie
|
||||
Cronie-1.5.2-4.el8.x86_64
|
||||
```
|
||||
|
||||
如果安装了 _cronie_ ,它将返回 _cronie_ 包的全名。如果你的系统中没有安装,则会显示未安装。
|
||||
|
||||
使用以下命令安装:
|
||||
|
||||
```bash
|
||||
$ dnf install cronie
|
||||
```
|
||||
|
||||
### 运行 cron 守护进程
|
||||
|
||||
一个 _cron_ 作业由 _crond_ 服务来执行,它会读取配置文件中的信息。在将作业添加到配置文件之前,必须启动 _crond_ 服务,或者安装它。什么是 _crond_ 呢?_Crond_ 是 cron 守护程序的简称。要确定 _crond_ 服务是否正在运行,输入以下命令:
|
||||
|
||||
```bash
|
||||
$ systemctl status crond.service
|
||||
● crond.service - Command Scheduler
|
||||
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor pre>
|
||||
Active: active (running) since Sat 2021-03-20 14:12:35 PDT; 1 day 21h ago
|
||||
Main PID: 1110 (crond)
|
||||
```
|
||||
|
||||
如果你没有看到类似的内容 "Active: active (running) since…",你需要启动 _crond_ 守护进程。要在当前会话中运行 _crond_ 服务,输入以下命令:
|
||||
|
||||
```bash
|
||||
$ systemctl run crond.service
|
||||
```
|
||||
|
||||
将其配置为开机自启动,输入以下命令:
|
||||
|
||||
```bash
|
||||
$ systemctl enable crond.service
|
||||
```
|
||||
|
||||
如果出于某种原因,你希望停止 _crond_ 服务,按以下方式使用 _stop_ 命令:
|
||||
|
||||
```bash
|
||||
$ systemctl stop crond.service
|
||||
```
|
||||
|
||||
要重新启动它,只需使用 _restart_ 命令:
|
||||
|
||||
```bash
|
||||
$ systemctl restart crond.service
|
||||
```
|
||||
|
||||
### **定义 cron 工作**
|
||||
|
||||
#### **cron 配置**
|
||||
|
||||
以下是一个 _cron_ 作业的配置细节示例。它定义了一个简单的 _cron_ 作业,将 _git_ master 分支的最新更改拉取到克隆的仓库中:
|
||||
|
||||
```shell
|
||||
*/59 * * * * username cd /home/username/project/design && git pull origin master
|
||||
```
|
||||
|
||||
主要有两部分:
|
||||
|
||||
* 第一部分是 “*/59 * * * *”。这表明计时器设置为每 59 分钟一次。
|
||||
* 该行的其余部分是命令,因为它将从命令行运行。
|
||||
在此示例中,命令本身包含三个部分:
|
||||
* 作业将以用户 ”username“ 的身份运行
|
||||
* 它将切换到目录 `/home/username/project/design`
|
||||
* 运行 git 命令拉取 master 分支中的最新更改
|
||||
|
||||
#### **时间语法**
|
||||
|
||||
如上所述,时间信息是 _cron_ 作业字符串的第一部分,如上所属。它决定了 cron 作业运行的频率和时间。它按以下顺序包括 5 个部分:
|
||||
|
||||
* 分钟
|
||||
* 小时
|
||||
* 一个月中的某天
|
||||
* 月份
|
||||
* 一周中的某天
|
||||
|
||||
下面是一种更图形化的方式来解释语法:
|
||||
|
||||
```bash
|
||||
.---------------- 分钟 (0 - 59)
|
||||
| .------------- 小时 (0 - 23)
|
||||
| | .---------- 一月中的某天 (1 - 31)
|
||||
| | | .------- 月份 (1 - 12) 或 jan,feb,mar,apr …
|
||||
| | | | .---- 一周中的某天 (0-6) (Sunday=0 or 7)
|
||||
| | | | | 或 sun,mon,tue,wed,thr,fri,sat
|
||||
| | | | |
|
||||
* * * * * user-name command-to-be-executed
|
||||
```
|
||||
|
||||
#### **星号**的使用
|
||||
|
||||
星号(*)可以用来替代数字,表示该位置的所有可能值。例如,分钟位置上的星号会使它每分钟运行一次。以下示例可能有助于更好地理解语法。
|
||||
|
||||
这个 cron 作业将每分钟运行一次:
|
||||
|
||||
```bash
|
||||
* * * * [command]
|
||||
```
|
||||
|
||||
斜杠表示分钟数。下面的示例将每小时运行 12 次,即每 5 分钟运行一次:
|
||||
|
||||
```bash
|
||||
*/5 * * * * [command]
|
||||
```
|
||||
|
||||
下一个示例将每月的第二天午夜(例如 1 月 2 日凌晨 12:00,2 月 2 日凌晨 12:00 等等):
|
||||
|
||||
```bash
|
||||
0 0 2 * * [command]
|
||||
```
|
||||
|
||||
#### 使用 crontab 创建一个 cron 作业
|
||||
|
||||
Cron 作业会在后台运行,它会不断检查 _/etc/crontab_ 文件和 _/etc/cron.*/_ 以及 _/var/spool/cron/_ 目录。每个用户在 _/var/spool/cron/_ 中都有一个唯一的 crontab 文件。
|
||||
|
||||
不应该直接编辑这些 _cron_ 文件。_crontab_ 命令是用于创建、编辑、安装、卸载和列出 cron 作业的方法。
|
||||
|
||||
更酷的是,在创建新文件或编辑现有文件后,你无需重新启动 cron。
|
||||
|
||||
```bash
|
||||
$ crontab -e
|
||||
```
|
||||
|
||||
这将打开你现有的 _crontab_ 文件,或者创建一个。调用 _crontab -e_ 时,默认情况下会使用 _vi_ 编辑器。注意:使用 Nano 编辑 _crontab_ 文件,可以选择设置 **EDITOR**=nano 环境变量。
|
||||
|
||||
使用 -l 选项列出所有 cron 作业。如果需要,使用 -u 选项指定一个用户。
|
||||
|
||||
```bash
|
||||
$ crontab -l
|
||||
$ crontab -u username -l
|
||||
```
|
||||
|
||||
使用以下命令删除所有 _cron_ 作业:
|
||||
|
||||
```bash
|
||||
$ crontab -r
|
||||
```
|
||||
|
||||
要删除特定用户的作业,你必须以 _root 用户_ 身份运行以下命令:
|
||||
|
||||
```bash
|
||||
$ crontab -r -u username
|
||||
```
|
||||
|
||||
感谢你的阅读。_cron_ 作业看起来可能只是系统管理员的工具,但它实际上与许多 Web 应用程序和用户任务有关。
|
||||
|
||||
#### 参考
|
||||
|
||||
Fedora Linux 文档的[自动化任务][4]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/scheduling-tasks-with-cron/
|
||||
|
||||
作者:[Darshna Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://fedoramagazine.org/author/climoiselle/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2021/03/schedule_with_cron-816x345.jpg
|
||||
[2]: https://unsplash.com/@yomex4life?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[3]: https://unsplash.com/s/photos/clock?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
|
||||
[4]: https://docs.fedoraproject.org/en-US/Fedora/12/html/Deployment_Guide/ch-autotasks.html
|
87
translated/tech/20210429 Linux tips for using GNU Screen.md
Normal file
87
translated/tech/20210429 Linux tips for using GNU Screen.md
Normal file
@ -0,0 +1,87 @@
|
||||
[#]: subject: (Linux tips for using GNU Screen)
|
||||
[#]: via: (https://opensource.com/article/21/4/gnu-screen-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (ddl-hust)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
|
||||
使用 GNU Screen 的 Linux 建议
|
||||
======
|
||||
学习基本的 GNU Screen 下的终端复用技术,然后下载我们的终端命令备忘录,以便你能够熟悉常用的终端指令快捷方式。
|
||||
![Terminal command prompt on orange background][1]
|
||||
对于一般用户而言,命令行终端窗口可能是令人困惑和神秘的。但随着你对 Linux 终端的进一步了解,你很快就会意识到它的高效和强大。过不了多久,你就会想让终端变得更加高效,除了将更多的终端放到你的终端,还有什么高好的方法能够提升你的终端效率呢?
|
||||
### 终端复用
|
||||
终端的许多优点之一是它是一个集中控制的界面。它是一个能让你访问数百个应用程序的窗口,而你与每一个应用程序进行交互所需要的只是一个键盘。但是,现代计算机几乎总是有多余的处理能力,而且现代计算机专家喜欢多任务处理,导致一个窗口处理数百个应用程序的能力是相当有限的。
|
||||
|
||||
解决这一问题的常见答案是终端复用——即将虚拟终端叠放在一起,然后在他们之间移动的能力。通过终端复用器,你保持了集中控制,但是当你进行多任务时,你能够进行终端切换。更好的是,你能够在终端中分屏,使得在同一时间显示多个屏幕窗口。
|
||||
|
||||
### 选择合适的复用器
|
||||
一些终端提供类似的功能,有标签式界面和分割式视图,但也有细微的差别。首先,这些终端的功能依赖于图形化的桌面环境。其次,许多图形化的终端功能需要鼠标交互或使用不方便的键盘快捷键。终端复用器的功能在文本控制台上和在图形桌面上一样好用,而且键位绑定是针对常见的终端序列设计的,很方便。
|
||||
|
||||
现有两种流行的复用器: [tmux][2] and [GNU Screen][3] 。尽管你与它们互动的方式略有不同,但它们做同样的事情,而且大多具有相同的功能。这篇文章是 GNU Screen 的入门指南。关于 tmux 的相关介绍,请阅读 Kevin Sonney's [introduction to tmux][4]。
|
||||
### 使用 GNU Screen
|
||||
GNU Screen 的基本用法很简单,通过 ` screen ` 命令启动,你被置于屏幕会话中的第 0 个窗口。你可能很难注意到有什么变化,直到你决定需要一个新的终端提示符。
|
||||
|
||||
但一个终端窗口被活动占用(比如,你启动了文本编辑器 [Vim][5] 或 [Jove][6] 或者你在处理音视频,或运行批处理任务),你能够新建一个窗口,要打开一个新的窗口,按 **Ctrl+A**,释放,然后按 **c**。这将在你现有窗口的基础上创建一个新的窗口。
|
||||
|
||||
你会知道当前你是在一个新的窗口中,因为你的终端除了默认的提示符外,似乎没有任何东西。当然,你的另一个终端仍然存在,它只是躲在新窗口的后面。要浏览打开的窗口,按 **Ctrl+A** ,松开,然后用 **n** 表示 _下一个_ 或 **p** 表示 _上一个_。在只打开两个窗口的情况下, **n** 和 **p** 的功能是一样的,但你可以随时打开更多的窗口( **Ctrl+A** ,然后 **c** ),并在它们之间切换。
|
||||
|
||||
### 分屏
|
||||
GNU Screen 的默认行为更像移动设备的屏幕,而不是桌面:你一次只能看到一个窗口。如果你因为喜欢多任务而使用 GNU Screen ,那么只关注一个窗口可能看起来是一种退步。幸运的是, GNU Screen 可以让您把终端分成窗中窗。
|
||||
|
||||
要创建一个水平分割窗口,按 **Ctrl+A** ,然后按 **s** 。这将把一个窗口置于另一个窗口之上,就像窗格一样。然而,在你告诉它要显示什么之前,分割的空间是没有用途的。 因此,在创建一个分割窗后,你可以用 **Ctrl+A** ,然后用 **Tab** 移动到分割窗中。一旦进入,使用 **Ctrl+A** 然后 **n** 浏览所有可用的窗口,直到你想显示的内容出现在分割窗格中。
|
||||
|
||||
你也可以按 **Ctrl+A** 然后按 **|** (这是一个管道字符,在大多数键盘上通过 **shift** 键接 **\** 选项)创建垂直分割窗口。
|
||||
|
||||
### 自定义 GNU Screen
|
||||
|
||||
GNU Screen 使用基于 **Ctrl+A** 的快捷键。根据你的习惯,这可能会让你感觉非常自然,也可能非常不方便,因为你可能会用 **Ctrl+A** 来移动到一行的开头。无论怎样, GNU Screen 允许通过 ` .screenrc ` 配置文件进行各种定制。你可以用这个来改变触发键的绑定(称为 "转义" 键绑定)。
|
||||
```
|
||||
`escape ^jJ`
|
||||
```
|
||||
|
||||
你还可以添加一个状态行,以帮助你在屏幕会话中保持自己不迷失。
|
||||
|
||||
```
|
||||
# status bar, with current window highlighted
|
||||
hardstatus alwayslastline
|
||||
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
|
||||
|
||||
# enable 256 colors
|
||||
attrcolor b ".I"
|
||||
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
|
||||
defbce on
|
||||
```
|
||||
在有多个窗口打开的会话中,有一个时刻提醒哪些窗口有焦点活动,哪些窗口有后台活动的提醒器特别有用。它类似一种终端的任务管理器。
|
||||
### 下载备忘单
|
||||
|
||||
Learning GNU Screen is a great way to increase your efficiency and alacrity with your favorite [terminal emulator][8]. Give it a try!
|
||||
|
||||
当你学习 GNU Screen 的使用方法时,需要记住很多新的键盘命令。有些命令你马上就能记住,但那些你不常使用的命令可能就很难记住了。你可以按 **Ctrl+A** 然后加 **?** 来访问 GNU Screen 的帮助界面,但如果您更喜欢一些可以打印出来并放在键盘边的东西,请 [下载我们的 GNU Screen 备忘单][7]。
|
||||
|
||||
学习 GNU Screen 是提高你使用你最喜欢的[终端模拟器][8]的效率和敏捷性的一个好方法。请试一试吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/4/gnu-screen-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[ddl-hust](https://github.com/ddl-hust)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由[LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/)荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background)
|
||||
[2]: https://github.com/tmux/tmux/wiki
|
||||
[3]: https://www.gnu.org/software/screen/
|
||||
[4]: https://opensource.com/article/20/1/tmux-console
|
||||
[5]: https://opensource.com/tags/vim
|
||||
[6]: https://opensource.com/article/17/1/jove-lightweight-alternative-vim
|
||||
[7]: https://opensource.com/downloads/gnu-screen-cheat-sheet
|
||||
[8]: https://opensource.com/article/21/2/linux-terminals
|
@ -0,0 +1,155 @@
|
||||
[#]: subject: (Access an alternate internet with OpenNIC)
|
||||
[#]: via: (https://opensource.com/article/21/4/opennic-internet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
用 OpenNIC 访问另一个互联网
|
||||
======
|
||||
在超级信息高速公路上绕行。
|
||||
![An intersection of pipes.][1]
|
||||
|
||||
用传奇的 DNS 黑客 Dan Kaminsky 的话说,"事实证明,互联网对全球社会来说是一个相当大的问题"。为了使互联网发挥作用,计算机必须能够在最复杂的网络中找到彼此:万维网。这是几十年前向政府工作人员和学术界 IT 人员提出的问题,我们今天使用的正是他们的解决方案。然而,他们实际上并不是在寻求建立_互联网_,他们是在为_互联网_(实际上是为 _catenets_,或“连接的网络”,但这个术语最终不再流行)定义规范,它是一个_互连网络_的通用术语。
|
||||
|
||||
根据这些规范,网络使用数字组合,作为每台在线计算机的一种家庭地址,并为每个网站分配一个人性化但高度结构化的“主机名”(如 `example.com`)。由于用户主要是通过网站_名称_与互联网互动,可以说互联网的运作只是因为我们都同意一个标准化的命名方案。如果有足够多的人决定使用不同的命名方案,互联网的工作方式_可能_会有所不同。一群用户可以形成一个平行的互联网,它使用相同的物理基础设施(电缆、卫星和其他传输方式,将数据从一个地方传送到另一个地方),但使用不同的方法将主机名与编号地址联系起来。
|
||||
|
||||
事实上,这已经存在了,这篇文章展示了你如何访问它。
|
||||
|
||||
### 了解名称服务器
|
||||
|
||||
术语“互联网”实际上是 _interconnected_(互联) 和 _networks_(网络)这两个术语的谐音,因为这正是它的本质。就像一个城市的邻里,或一个国家的城市,或一个大陆的国家,或一个星球的大陆一样,互联网通过将数据从一个家庭或办公室网络传输到数据中心和服务器房或其他家庭或办公室网络而跨越了全球。这是一项艰巨的任务,但它并非没有先例。毕竟,电话公司很久以前就把世界连接起来了,在那之前,电报和邮政服务也是这样做的。
|
||||
|
||||
在电话或邮件系统中,有一份名单,无论是正式的还是非正式的,都将人名与实际地址联系起来。这曾经是以电话簿的形式传递到家里,是该电话簿社区内每个电话所有者的目录。邮局的运作方式不同:他们通常依靠寄信人知道预定收信人的姓名和地址,但邮政编码和城市名称被用来把信送到正确的邮局。无论哪种方式,都需要有一个标准的组织方案。
|
||||
|
||||
对于计算机来说,[IP 协议][2]描述了互联网上的地址必须如何格式化。域名服务器 [(DNS) 协议][3]描述了如何将人类友好的名称分配给 IP 以及从 IP 解析。无论你使用的是 IPv4 还是 IPv6,想法都是一样的:当一个节点(可能是一台计算机或通往另一个网络的网关)加入一个网络时,它被分配一个 IP 地址。
|
||||
|
||||
如果你愿意,你可以在 [ICANN][4](一个帮助协调互联网上的网站名称的非营利组织)注册一个域名,并将该名称指向该 IP。没有要求你“拥有”该 IP 地址。任何人都可以将任何域名指向任何 IP 地址。唯一的限制是,一次只能有一个人拥有一个特定的域名,而且域名必须遵循公认的 DNS 命名方案。
|
||||
|
||||
域名及其相关 IP 地址的记录被输入到 DNS 中。当你在浏览器中导航到一个网站时,它会迅速查询 DNS 网络,以找到与你所输入的任何 URL(或从搜索引擎点击)相关的 IP 地址。
|
||||
|
||||
### 一个不同的 DNS
|
||||
|
||||
为了避免在谁拥有哪个域名的问题上发生争论,大多数域名注册商对域名注册收取一定的费用。该费用通常是象征性的,有时甚至是 0 美元(例如,`freenom.com` 提供免费的 `.tk`、`.ml`、`.gq` 和 `.cf` 域名,先到先得)。
|
||||
|
||||
在很长一段时间里,只有几个“顶级”域名,包括 `.org`、`.edu` 和 `.com`。现在有很多,包括 `.club`、`.biz`、`.name`、`.international` 等等。然而,由于字母组合的原因,有很多潜在的顶级域名是无效的,如 `.null`。如果你试图导航到一个以 `.null`结尾的网站,那么你不会成功。它不能注册,也不是域名服务器的有效条目,而且它根本就不存在。
|
||||
|
||||
[OpenNIC项目][5] 已经建立了一个备用的 DNS 网络,将域名解析为 IP 地址,但它包括目前互联网不使用的名字。可用的顶级域名包括:
|
||||
|
||||
|
||||
* .geek
|
||||
* .indy
|
||||
* .bbs
|
||||
* .gopher
|
||||
* .o
|
||||
* .libre
|
||||
* .oss
|
||||
* .dyn
|
||||
* .null
|
||||
|
||||
|
||||
|
||||
你可以在这些(以及更多的)顶级域名中注册一个域名,并在 OpenNIC 的 DNS 系统上注册,使它们映射到你选择的 IP 地址。
|
||||
|
||||
换句话说,一个网站可能存在于 OpenNIC 网络中,但对于不使用 OpenNIC 名称服务器的人来说,仍然无法访问。这绝不是一种安全措施,甚至不是一种混淆手段。这只是一种有意识的选择,在_超级信息高速公路上绕行_。
|
||||
|
||||
### 如何使用 OpenNIC 的 DNS 服务器
|
||||
|
||||
要访问 OpenNIC 网站,你必须配置你的计算机使用 OpenNIC 的 DNS 服务器。幸运的是,这并不是一个二元选择。通过使用一个 OpenNIC 的 DNS 服务器,你可以同时访问 OpenNIC 和标准网络。
|
||||
|
||||
要配置你的 Linux 电脑使用 OpenNIC 的 DNS 服务器,你可以使用 [nmcli][6] 命令,这是 Network Manager 的一个终端界面。在开始配置之前,请访问 [opennic.org][5],寻找离你最近的 OpenNIC DNS 服务器。与标准 DNS 和[边缘计算][7]一样,服务器在地理上离你越近,你的浏览器查询时的延迟就越少。
|
||||
|
||||
下面是如何使用 OpenNIC:
|
||||
|
||||
1. 首先,获得一个连接列表:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli connection
|
||||
NAME TYPE DEVICE
|
||||
Wired connection 1 802-3-ethernet eth0
|
||||
MyPersonalWifi 802-11-wireless wlan0
|
||||
ovpn-phx2-tcp vpn --
|
||||
```
|
||||
|
||||
你的连接肯定与这个例子不同,但要关注第一栏。这提供了你的连接的可读名称。在这个例子中,我将配置我的以太网连接,但这个过程对无线连接是一样的。
|
||||
|
||||
2. 现在你知道了需要修改的连接的名称,使用 `nmcli` 更新其 `ipv4.dns` 属性:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli con modify \
|
||||
"Wired connection 1" \
|
||||
ipv4.dns "134.195.4.2"
|
||||
```
|
||||
|
||||
在这个例子中,`134.195.4.2` 是离我最近的服务器。
|
||||
|
||||
3. 防止 Network Manager 使用你路由器设置的内容自动更新 `/etc/resolv.conf`:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli con modify \
|
||||
"Wired connection 1" \
|
||||
ipv4.ignore-auto-dns yes
|
||||
```
|
||||
|
||||
4. 将你的网络连接关闭,然后再次启动,以实例化新的设置:
|
||||
|
||||
|
||||
```
|
||||
$ sudo nmcli con down \
|
||||
"Wired connection 1"
|
||||
$ sudo nmcli con up \
|
||||
"Wired connection 1"
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
完成了。你现在正在使用 OpenNIC 的 DNS 服务器。
|
||||
|
||||
#### 路由器上的 DNS
|
||||
|
||||
你可以通过对你的路由器做这样的修改,将你的整个网络设置为使用 OpenNIC。你将不必配置你的计算机的连接,因为路由器将自动提供正确的 DNS 服务器。我无法演示这个,因为路由器的接口因制造商而异。此外,一些互联网服务提供商 (ISP) 不允许你修改名称服务器的设置,所以这并不总是一种选择。
|
||||
|
||||
### 测试 OpenNIC
|
||||
|
||||
为了探索你所解锁的”其他“互联网,尝试在你的浏览器中导航到 `grep.geek`。如果你输入 `http://grep.geek`,那么你的浏览器就会带你到 OpenNIC 的搜索引擎。如果你只输入 `grep.geek`,那么你的浏览器就会受到干扰,把你带到你的默认搜索引擎(如 [Searx][8] 或 [YaCy][9]),并在窗口的顶部提供一个导航到你首先请求的页面。
|
||||
|
||||
![OpenNIC][10]
|
||||
|
||||
(Klaatu, [CC BY-SA 4.0][11])
|
||||
|
||||
不管怎么说,你最终还是来到了 `grep.geek`,现在可以在网上搜索 OpenNIC 的版本了。
|
||||
|
||||
### 广阔天地
|
||||
|
||||
互联网旨在成为一个探索、发现和平等访问的地方。OpenNIC 利用现有的基础设施和技术帮助确保这些东西。它是一个可选择的互联网替代方案。如果这些想法吸引了你,那就试一试吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/4/opennic-internet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.)
|
||||
[2]: https://tools.ietf.org/html/rfc791
|
||||
[3]: https://tools.ietf.org/html/rfc1035
|
||||
[4]: https://www.icann.org/resources/pages/register-domain-name-2017-06-20-en
|
||||
[5]: http://opennic.org
|
||||
[6]: https://opensource.com/article/20/7/nmcli
|
||||
[7]: https://opensource.com/article/17/9/what-edge-computing
|
||||
[8]: http://searx.me
|
||||
[9]: https://opensource.com/article/20/2/open-source-search-engine
|
||||
[10]: https://opensource.com/sites/default/files/uploads/did-you-mean.jpg (OpenNIC)
|
||||
[11]: https://creativecommons.org/licenses/by-sa/4.0/
|
@ -0,0 +1,137 @@
|
||||
[#]: subject: (Learn essential Kubernetes commands with a new cheat sheet)
|
||||
[#]: via: (https://opensource.com/article/21/5/kubernetes-cheat-sheet)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
||||
用新的速查表学习 Kubernetes 的基本命令
|
||||
======
|
||||
开始探索 kubectl、容器、pod 等,接着下载我们的免费的速查表,这样你就可以随时掌握关键的命令了。
|
||||
![Cheat Sheet cover image][1]
|
||||
|
||||
云计算主要是在 Kubernetes 上运行,Kubernetes 主要是在 Linux 上运行,而 Linux 在有熟练的系统管理员控制时运行得最好。无论你认为自己是云计算架构师还是只是一个谦虚的系统管理员,现代互联网都需要了解如何在容器中创建应用和服务,按需扩展,按需扩展以及如何明智地进行监视和管理。
|
||||
|
||||
进入勇敢的容器世界的第一步是学习 Kubernetes 和它的基本命令:`kubectl`。
|
||||
|
||||
### 安装 kubectl
|
||||
|
||||
`kubectl` 命令允许你在 Kubernetes 集群上运行命令。你使用 `kubectl` 来部署应用,查看日志,检查和管理集群资源,并在出现问题时进行故障排除。`kubectl`(以及整个 Kubernetes)的典型”问题“是,要对集群运行命令,你首先需要一个集群。然而,有一些简单的解决方案。
|
||||
|
||||
首先,你可以创建自己的 Kubernetes 集群,只需买三块树莓派板和相关外围设备(主要是电源)。当你获得了硬件,阅读 Chris Collins 的[_使用树莓派构建 Kubernetes 集群_][2],你就会拥有自己的安装有 `kubectl` 的集群。
|
||||
|
||||
另一种获得集群的方法是使用 [Minikube][3],这是一个 Kubernetes 的实践环境。在所有建立和运行集群的方法中,这是最简单的。
|
||||
|
||||
还有更多的选择;例如,你可以参加一个关于 Kubernetes 的课程,以获得一个运行集群的实验室,或者你可以在云上购买时间。只要你有一个 Kubernetes 环境来练习,如何获得集群并不重要。
|
||||
|
||||
当你你能访问一个集群,你就可以开始探索 `kubectl` 命令。
|
||||
|
||||
### 了解 pod 和容器
|
||||
|
||||
容器是一个轻量级的、部分的 Linux 系统,专门用于运行一个应用或服务。容器受到[内核命名空间][4]的限制,这使它能够访问其主机(运行容器的计算机)上的重要系统组件,同时防止它向其主机发送数据。容器以容器镜像(或简称_镜像_)的形式保存,并由称为 _Containerfiles_ 或 _Dockerfiles_ 的文本文件定义。
|
||||
|
||||
一个 pod 是容器的正式集合,也是管理员扩展、监控和维护任何数量的容器的一种简单方法。
|
||||
|
||||
这些一起就像 Kubernetes 的”应用“。创建或获取容器镜像是你在云上运行服务的方式。
|
||||
|
||||
### 运行一个 pod
|
||||
|
||||
容器镜像的两个可靠仓库是 Docker Hub 和 Quay。你可以在仓库中搜索可用的镜像列表。通常有由项目提供的大型项目的官方镜像,也有专门的、定制的或特殊项目的社区镜像。最简单和最小的镜像之一是 [BusyBox][5] 容器,它提供了一个最小的 shell 环境和一些常用命令。
|
||||
|
||||
无论你是从仓库中拉取镜像,还是自己编写镜像定义并从 Git 仓库中拉取到集群中,其工作流程都是一样的。当你想在 Kubernetes 中启动一个 pod 时:
|
||||
|
||||
1. 在 [Docker Hub][6] 或 [Quay][7] 上找到一个你想使用的镜像
|
||||
2. 拉取镜像
|
||||
3. 创建一个 pod
|
||||
4. 部署 pod
|
||||
|
||||
|
||||
|
||||
如果你想使用 BusyBox 容器的例子,你可以用一条命令完成最后三个步骤:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl create deployment my-busybox --image=busybox`
|
||||
```
|
||||
|
||||
等待 kubectl 完成这个过程,最后你就有了一个正在运行的 BusyBox 实例。这个 pod 并没有暴露给其他人。它只是在后台安静地在你的集群上运行。
|
||||
|
||||
要看你的集群上有哪些 pod 在运行:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl get pods --all-namespaces`
|
||||
```
|
||||
|
||||
你也可以获得关于 pod 部署的信息:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl describe deployment my-busybox`
|
||||
```
|
||||
|
||||
### 与 pod 互动
|
||||
|
||||
容器通常包含使其自动化的配置文件。例如,将 Nginx httpd 服务器作为容器安装,应该不需要你的互动。你开始运行容器,它就会工作。对于你添加到 pod 中的第一个容器和之后的每个容器都是如此。
|
||||
|
||||
Kubernetes 模型的优点之一是,你可以根据需要扩展你的服务。如果你的网络服务被意外的流量淹没,你可以在你的云中启动一个相同的容器(使用 `scale` 或 `autoscale` 子命令),使你的服务处理传入请求的能力增加一倍。
|
||||
|
||||
即便如此,有时还是很高兴看到一些证明 pod 正在按预期运行的证据,或者能够对似乎无法正常运行的某些问题进行故障排除。为此,你可以在一个容器中运行任意的命令:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl exec my-busybox -- echo "hello cloud"`
|
||||
```
|
||||
|
||||
另外,你可以在你的容器中打开一个 shell,用管道将你的标准输入输入到其中,并将其输出到终端的标准输出:
|
||||
|
||||
|
||||
```
|
||||
`$ kubectl exec --stdin --tty my-busybox -- /bin/sh`
|
||||
```
|
||||
|
||||
### 暴露服务
|
||||
|
||||
默认情况下,pod 在创建时不会暴露给外界,这样你就有时间在上线前进行测试和验证。假设你想把 Nginx Web 服务器作为一个 pod 安装和部署在你的集群上,并使其可以访问。与任何服务一样,你必须将你的 pod 指向服务器上的一个端口。`kubectl` 子命令 `expose` 可以为你做到这点:
|
||||
|
||||
|
||||
```
|
||||
$ kubectl create deployment \
|
||||
my-nginx --image=nginx
|
||||
$ kubectl expose deployment \
|
||||
my-nginx --type=LoadBalancer --port=8080
|
||||
```
|
||||
|
||||
只要你的集群可以从互联网上访问,你就可以通过打开浏览器并导航到你的公共 IP 地址来测试你的新 Web 服务器的可访问性。
|
||||
|
||||
### 不仅仅是 pod
|
||||
|
||||
Kubernetes 提供了很多东西,而不仅仅是存储普通服务的镜像。除了作为一个[容器协调][8]的系统,它还是一个云开发的平台。你可以编写和部署应用,管理和监控性能和流量,实施智能负载平衡策略等。
|
||||
|
||||
Kubernetes 是一个强大的系统,它已经迅速成为各种云的基础,最主要的是[开放混合云][9]。今天就开始学习 Kubernetes 吧。随着你对 Kubernetes 的进一步了解,你会需要一些关于其主要概念和一般语法的快速提醒,所以[**下载我们的 Kubernetes 速查表**][10]并将它放在身边。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/5/kubernetes-cheat-sheet
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image)
|
||||
[2]: https://opensource.com/article/20/6/kubernetes-raspberry-pi
|
||||
[3]: https://opensource.com/article/18/10/getting-started-minikube
|
||||
[4]: https://opensource.com/article/19/10/namespaces-and-containers-linux
|
||||
[5]: https://www.busybox.net/
|
||||
[6]: http://hub.docker.com
|
||||
[7]: http://quay.io
|
||||
[8]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[9]: https://opensource.com/article/20/10/keep-cloud-open
|
||||
[10]: https://opensource.com/downloads/kubernetes-cheat-sheet
|
Loading…
Reference in New Issue
Block a user