From 6cc1f6004ecde00f336c875dd1229876cabdb65b Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 25 May 2017 11:55:21 +0800 Subject: [PATCH 01/33] PUB:20170511 How to Delete HUGE 100-200GB Files in Linux.md @geekpi @jasminepeng --- .../20170511 How to Delete HUGE 100-200GB Files in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170511 How to Delete HUGE 100-200GB Files in Linux.md (100%) diff --git a/translated/tech/20170511 How to Delete HUGE 100-200GB Files in Linux.md b/published/20170511 How to Delete HUGE 100-200GB Files in Linux.md similarity index 100% rename from translated/tech/20170511 How to Delete HUGE 100-200GB Files in Linux.md rename to published/20170511 How to Delete HUGE 100-200GB Files in Linux.md From 8eb184278b382fdc1a3aaf681ed57b5b598a288f Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 25 May 2017 13:09:17 +0800 Subject: [PATCH 02/33] PUB:20170111 The difference between development and deployment.md @geekpi @bestony --- ...ence between development and deployment.md | 59 +++++++++++++++++++ ...ence between development and deployment.md | 58 ------------------ 2 files changed, 59 insertions(+), 58 deletions(-) create mode 100644 published/20170111 The difference between development and deployment.md delete mode 100644 translated/talk/20170111 The difference between development and deployment.md diff --git a/published/20170111 The difference between development and deployment.md b/published/20170111 The difference between development and deployment.md new file mode 100644 index 0000000000..043217c594 --- /dev/null +++ b/published/20170111 The difference between development and deployment.md @@ -0,0 +1,59 @@ +一位老极客的眼中的开发和部署 +============================================================ + +![The difference between development and deployment](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUS_OpenSourceExperience_520x292_cm.png?itok=APna2N9Y "The difference between development and deployment") + +图片提供 : opensource.com + +多年前,我曾是一名 Smalltalk 程序员,这种经验让我以一种不同的视角来观察编程的世界,例如,需要花时间来适应源代码应该存储在文本文件中的这种做法。 + +我们作为程序员通常会区分“开发”和“部署”,特别是我们在开发的地方所使用的工具不同于我们在之后部署软件时的地点和工具时。而在 Smalltalk 世界里,没有这样的区别。 + +Smalltalk 构建于虚拟机包含了你的开发环境(IDE、调试器、文本编辑器、版本控制等)的思路之上,如果你需要修改任何一处代码,你得修改内存中运行副本。如果需要的话,你可以为运行中的机器做个快照;如果你想分发你的代码,你可以发送一个运行中的机器的镜像副本(包括 IDE、调试器、文本编辑器、版本控制等)给用户。这就是上世纪 90 年代软件开发的方式(对我们中的一些人来说)。 + +如今,部署环境与开发环境有了很大的不同。起初,你不要期望那里(指部署环境)有任何开发工具。一旦部署,就没有版本控制、没有调试、没有开发环境。有的是记录和监视,这些在我们的开发环境中都没有,而有一个“构建管道”,它将我们的软件从开发形式转换为部署形式。作为一个例证,Docker 容器则试图重新找回上世纪 90 年代 Smalltalk 程序员部署体验的那种简单性,而避免同样的开发体验。 + +我想如果 Smalltalk 世界是我唯一的编程方面的体验,让我无法区分开发和部署环境,我可能会偶尔回顾一下它。但是在我成为一名 Smalltalk 程序员之前,我还是一位 APL 程序员,这也是一个可修改的虚拟机镜像的世界,其中开发和部署是无法区分的。因此,我相信,在当前的时代,人们编辑单独的源代码文件,然后运行构建管道以创建在编辑代码时尚不存在的部署作品,然后将这些作品部署给用户。我们已经以某种方式将这种反模式的软件开发制度化,而不断发展的软件环境的需求正在迫使我们找回到上世纪 90 年代的更有效的技术方法。因此才会有 Docker 的成功,所以,我需要提出我的建议。 + +我有两个建议:我们在运行时系统中实现(并使用)版本控制,以及,我们通过更改运行中的系统来开发软件,而不是用新的运行系统替换它们。这两个想法是相关的。为了安全地更改正在运行的系统,我们需要一些版本控制功能来支持“撤消”功能。也许公平地说,我只提出了一个建议。让我举例来说明。 + +让我们开始假设一个静态网站。你要修改一些 HTML 文件。你应该如何工作?如果你像大多数开发者一样,你会有两个,也许三个网站 - 一个用于开发,一个用于 QA(或者预发布),一个用于生产。你将直接编辑开发实例中的文件。准备就绪后,你将把你的修改“部署”到预发布实例。在用户验收测试之后,你将再次部署,这次是生产环境。 + +使用 Occam 的 Razor,让我们可以避免不必要地创建实例。我们需要多少台机器?我们可以使用一台电脑。我们需要多少台 web 服务器?我们可以使用具有多个虚拟主机的单台 web 服务器。如果不使用多个虚拟主机的话,我们可以只使用单个虚拟主机吗?那么我们就需要多个目录,并需要使用 URL 的顶级路径来区分不同的版本,而不是虚拟主机名。但是为什么我们需要多个目录?因为 web 服务器将从文件系统中提供静态文件。我们的问题是,目录有三个不同的版本,我们的解决方案是创建目录的三个不同的副本。这不是正是 Subversion 和 Git 这样的版本控制系统解决的问题吗?制作目录的多个副本以存储多个版本的策略回到了版本控制 CVS 之前的日子。为什么不使用比如说一个空的的 Git 仓库来存储文件呢?要这样做,web 服务器将需要能够从 git 仓库读取文件(参见 [mod_git] [3])。 + +这将是一个支持版本控制的运行时系统。 + +使用这样的 web 服务器,使用的版本可以由 cookie 来标识。这样,任何人都可以推送到仓库,用户将继续看到他们发起会话时所分配的版本。版本控制系统有不可改变的提交; 一旦会话开始,开发人员可以在不影响正在运行的用户的情况下快速推送更改。开发人员可以重置其会话以跟踪他们的新提交,因此开发人员或测试人员就可能如普通用户一样查看在同台服务器上同一个 URL 上正在开发或正在测试的版本。作为偶然的副作用,A/B 测试仅仅是将不同的用户分配给不同的提交的情况。所有用于管理多个版本的 git 设施都可以在运行环境中发挥作用。当然,git reset 为我们提供了前面提到的“撤销”功能。 + +为什么不是每个人都这样做? + +一种可能性是,诸如版本控制系统的工具没有被设计为在生产环境中使用。例如,给某人推送到测试分支而不是生产分支的许可是不可能的。对这个方案最常见的反对是,如果发现了一个漏洞,你会想要将某些提交标记为不可访问。这将是另一种更细粒度的权限的情况;开发人员将具有对所有提交的读取权限,但外部用户不会。我们可能需要对现有工具进行一些额外的改造以支持这种模式,但是这些功能很容易理解,并已被设计到其他软件中。例如,Linux (或 PostgreSQL)实现了对不同用户的细粒度权限的想法。 + +随着云环境变得越来越普及,这些想法变得更加相关:云总是在运行。例如,我们可以看到,AWS 中等价的 “文件系统”(S3)实现了版本控制,所以你可能有一个不同的想法,使用一台 web 服务器提供来自 S3 的资源文件,并根据会话信息选择不同版本的资源文件。重要的并不是哪个实现是最好的,而是支持这种运行时版本控制的愿景。 + +部署的软件环境应该是“版本感知”的原则,应该扩展到除了服务静态文件的 web 服务器之外的其他工具。在将来的文章中,我将介绍版本库,数据库和应用程序服务器的方法。 + +_在 linux.conf.au 中了解更多 Robert Lefkowitz 2017 年 ([#lca2017][1])在 Hobart:[保持 Linux 伟大][2]的主题。_ + +-------------------------------------------------------------------------------- + +作者简介: + +![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/robert_lefkowitz.jpg?itok=CFoX-OUI) + +Robert M. Lefkowitz - Robert(即 r0ml)是一个喜欢复杂编程语言的编程语言爱好者。 他是一个提高清晰度、提高可靠性和最大限度地简化的编程技术收藏家。他通过让计算机更加容易获得来使它普及化。他经常演讲中世纪晚期和早期文艺复兴对编程艺术的影响。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/1/difference-between-development-deployment + +作者:[Robert M. Lefkowitz][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Bestony](https://github.com/Bestony) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/r0ml +[1]:https://twitter.com/search?q=%23lca2017&src=typd +[2]:https://www.linux.conf.au/schedule/presentation/107/ +[3]:https://github.com/r0ml/mod_git diff --git a/translated/talk/20170111 The difference between development and deployment.md b/translated/talk/20170111 The difference between development and deployment.md deleted file mode 100644 index fe68b606f0..0000000000 --- a/translated/talk/20170111 The difference between development and deployment.md +++ /dev/null @@ -1,58 +0,0 @@ -开发和部署的不同 -============================================================ -![The difference between development and deployment](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUS_OpenSourceExperience_520x292_cm.png?itok=APna2N9Y "The difference between development and deployment") - -图片提供 : opensource.com - -多年前,我是一名 Smalltalk 程序员,这种经验给让我在观察编程世界时有不同的想法。例如,花时间来适应源代码应该存储在文本文件中的想法。 - -我们作为程序员通常区分“开发”和“部署”,特别是我们在一个地方开发使用的工具不同于我们之后部署软件时的地点和工具。在 Smalltalk 世界里,没有这样的区别。 - -Smalltalk 构建在包含了你的开发环境(IDE、调试器、文本编辑器、版本控制等)的虚拟机的想法之上,如果你不得不修改任何一处代码,你要修改内存中运行副本。如果你可以为运行中的机器打个快照,如果你想做的话,如果你想分发你的代码,你可以发送一个运行中的机器的镜像(包括IDE、调试器、文本编辑器、版本控制等)的副本到用户。这就是 90 年代软件开发的工作原理(对我们中的一些人来说)。 - -如今部署环境与开发环境有了很大的不同。对于初学者,你不要期望那里有任何开发工具。一旦部署,就没有版本控制、没有调试、没有开发环境。有的是记录和监视,这些在我们的开发环境中没有,并且有一个“构建管道”,它将我们的软件从我们开发形式转换为部署形式。例如,Docker 容器试图重新抓住 1990 年代 Smalltalk 程序员部署经验的一些简单性,而不希望对开发体验做同样的事情。 - -我想如果 Smalltalk 世界是我唯一的编程隐喻体验,无法区分开发和部署环境,我可能偶尔回顾一下它。但在我是一名 Smalltalk 程序员之前,我是一位 APL 程序员,这也是一个可以修改虚拟机镜像的世界,其中开发和部署是无法区分的。因此,我相信,在当前的世界,人们编辑单独的源代码文件,然后运行构建管道以创建在编辑代码时不存在的部署工作,然后将这些作品部署到用户。我们已经以某种方式将这种反模式软件开发制度化,并且不断发展的软件环境的需求正在迫使我们找到回到 20 世纪 90 年代更有效的技术的方法。因此会有 Docker 的成功。因此,我需要提出建议。 - -我有两个建议:我们在运行时系统中实现(和使用)版本控制,我们通过更改运行系统来开发软件,而不是用新的运行系统替换它们。这两个想法是相关的。为了安全地更改正在运行的系统,我们需要一些版本控制功能来支持“撤消”功能。也许公平地说,我只提出一个建议。让我举例来说明。 - -让我们开始想象一个静态网站。你要修改一些 HTML 文件。你应该如何工作?如果你像大多数开发者一样,你会有两个,也许三个网站 - 一个用于开发,一个用于QA(或者预发布),一个用于生产。你将直接编辑开发实例中的文件。准备就绪后,你将“部署”你的修改到预发布实例。在用户验收测试之后,你将再次部署,这次是生产环境。 - -使用 Occam 的 Razor,让我们避免不必要地创建实例。我们需要多少台机器?我们可以使用一台电脑。我们需要多少台网络服务器?我们可以使用具有多个虚拟主机的单台 web 服务器,而不是多个虚拟主机,我们可以使用单台虚拟主机吗?然后,我们需要多个目录,并需要使用 URL 的顶级路径来区分不同的版本,而不是虚拟主机名。但是为什么我们需要多个目录?因为 web 服务器将从文件系统中提供静态文件。我们的问题是,目录有三个不同的版本,我们的解决方案是创建目录的三个不同的副本。这不是像 Subversion 和 Git 这样的版本控制系统解决的问题?制作目录的多个副本以存储多个版本的策略回到了 CVS 之前的日子。为什么不使用,也就是一个空的的 Git 仓库来存储文件?因为要这样做,web 服务器将需要能够从 git 仓库读取文件(参见[mod_git] [3])。 - -这将是一个支持版本控制的运行时系统。 - -使用这样的 web 服务器,使用的版本可以由 cookie 来标识。这样,任何人都可以推送到仓库,用户将继续看到他们发起会话时分配的版本。版本控制系统有不可改变的提交; 一旦会话开始,开发人员可以在不影响正在运行的用户的情况下快速推送更改。开发人员可以重置其会话以跟踪他们的新提交,因此开发人员或测试人员就可能如普通用户一样查看在同台服务器上同一个URL上正在开发或正在测试的版本。作为偶然的副作用,A/B 测试仅仅是将不同的用户分配给不同的提交的情况。所有用于管理多个版本的 git 设施都在运行环境中发挥作用。当然,git reset 为我们提供了前面提到的“撤销”功能。 - -为什么不是每个人都这样做? - -一种可能性是,诸如版本控制系统的工具不被设计为在生产环境中使用。例如,给某人许可推送到测试分支而不是生产分支是不可能的。对这个方案最常见的反对是,如果发现了一个漏洞,你会想要将某些提交标记为不可访问。这将是另一种更细粒度的权限的情况;开发人员将具有对所有提交的读取权限,但外部用户不会。我们可能需要对现有工具进行一些额外的工作以支持这种模式,但是这些功能很容易理解,并已被设计到其他软件中。例如,Linux (或 PostgreSQL)实现了对不同用户的细粒度权限的想法。 - -随着云环境变得越来越普及,这些想法变得更加相关:云总是在运行。例如,我们可以看到,AWS 中等价的 “文件系统”(S3)实现了版本控制,所以你可能有一个不同的想法,使用一台 web 服务器提供来自 S3 的资产,并使用会话信息选择不同版本的资产。重要的想法并不是实现是最好的,而是支持运行时版本控制的愿景。 - -部署的软件环境应该是“版本感知”的原则,扩展到除了服务静态资产的web服务器之外的其他工具。在将来的文章中,我将介绍版本库,数据库和应用程序服务器的方法。 - -_在 linux.conf.au 中了解更多 Robert Lefkowitz 2017 年 ([#lca2017][1])在 Hobart:[保持 Linux 伟大][2]的主题。_ - --------------------------------------------------------------------------------- - -作者简介: - -![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/robert_lefkowitz.jpg?itok=CFoX-OUI) - -Robert M. Lefkowitz - Robert(a / k / a r0ml)是一个喜欢复杂编程语言的编程语言爱好者。 他是一个提高清晰度、提高可靠性和最大限度地简化编程技术的收藏家。他通过让计算机更加容易获得来使它普及化。他经常演讲中世纪晚期和早期文艺复兴对编程艺术的影响。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/1/difference-between-development-deployment - -作者:[Robert M. Lefkowitz][a] -译者:[geekpi](https://github.com/geekpi) -校对:[Bestony](https://github.com/Bestony) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/r0ml -[1]:https://twitter.com/search?q=%23lca2017&src=typd -[2]:https://www.linux.conf.au/schedule/presentation/107/ -[3]:https://github.com/r0ml/mod_git From d2ec83609bf7b83d185e58e051aa6120476d8ea1 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 25 May 2017 14:55:09 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对完毕 谢谢 --- ...ow to make Vim user-friendly with Cream.md | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/translated/tech/20170518 How to make Vim user-friendly with Cream.md b/translated/tech/20170518 How to make Vim user-friendly with Cream.md index 49fdaf20f8..00206321b7 100644 --- a/translated/tech/20170518 How to make Vim user-friendly with Cream.md +++ b/translated/tech/20170518 How to make Vim user-friendly with Cream.md @@ -1,34 +1,30 @@ 如何使用 Cream 提高 Vim 的用户友好性 ============================================================ -### Cream 附加包通过把一个更加熟悉的"面孔"置于 Vim 文本编辑器之上,同时保留 Vim 的功能,使其更加容易使用 - - +### Cream 附加包通过把一个更加熟悉的“面孔”置于 Vim 文本编辑器之上,同时保留 Vim 的功能,使其更加容易使用 ![How to make Vim user-friendly with Cream](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/osdc_edu_rightmix_520.png?itok=SCsog_qv "How to make Vim user-friendly with Cream") -图片来自 :  - -opensource.com +图片来自 : opensource.com 大约 10 年前,我既使用 Emacs 进行文本编辑,也使用 Vim 进行文本编辑。说到底,我的确是一个热衷于 Emacs 的家伙。尽管 Emacs 在我的心里占据了很重要的地位,但我知道, Vim 也不赖。 -一些人,或者像我一样的人,在技术方面可能都会有些笨手笨脚的。多年来,我已经和很多下面这样的 Linux 新手交谈过,他们想使用 Vim,但是却失望的发现, Vim 编辑器和他们在其它操作系统上使用过的编辑器似乎不一样。 +一些人,或者像我一样的人,在技术方面有些笨手笨脚。多年来,我和一些 Linux 新手交流,了解到他们想使用 Vim,但是却失望的发现, Vim 编辑器和他们在其它操作系统上使用过的编辑器不一样。 但是,当我把 Cream 介绍给他们以后,他们的失望就变成了满意。Cream 是 Vim 的一个附加包,它使得 Vim 更加容易使用。Cream 让这些 Linux 新手变成了 Vim 的坚决拥护者和忠心用户。 让我们来看一看 Cream 是什么以及它是如何让 Vim 变得更加容易使用的。 -### Cream 安装 +### Cream 的安装 在安装 Cream 之前,你需要先在你的电脑上安装好 Vim 和 GVim 的 GUI 组件。我发现最容易完成这件事的方法是使用 Linux 版本的包管理器。 安装好 Vim 以后,便可[下载 Cream 的安装程序][2],或者你也可以再次使用 Linux 发行版的包管理器进行安装。 -安装好 Cream 以后,你可以通过从应用菜单选择输入(比如,**Applications**->**Cream**)或者在程序启动器中输入 **Cream**,从而启动 Cream 。 +安装好 Cream 以后,你可以从应用菜单选择它(比如,**Applications**->**Cream**)或者在程序启动器中输入 **Cream**,从而启动 Cream 。 ![Cream's main window](https://opensource.com/sites/default/files/resize/cream-main-window-520x336.png "Cream's main window") -### Cream 使用 +### Cream 的使用 如果你之前已经使用过 Gvim,那么你会注意到, Cream 几乎没改变编辑器的外观和感觉。最大的不同是 Cream 的菜单栏和工具栏,它们取代了 Gvim 陈旧的菜单栏和工具栏,新的菜单栏和工具栏的外观和群组功能看起来和其它编辑器的一样。 @@ -40,7 +36,7 @@ Cream 开始运行以后,打开一个文件,或者新建一个文件,然 ![Cream add-on for VIM in action](https://opensource.com/sites/default/files/cream-in-action.png "Cream add-on for VIM in action") -并不是说 Cream 是 Vim 的简化版,或者说 Cream “离” Vim 很远。事实上, Cream 保留了 Vim 的全部特性,同时,它还有一系列其他有用的特性。我发现的 Cream 的一些有用的特性包括: +并不是说 Cream 是 Vim 的简化版,远远不是。事实上, Cream 保留了 Vim 的全部特性,同时,它还有[一系列其他有用的特性][7]。我发现的 Cream 的一些有用的特性包括: * 一个标签式界面 * 语法高亮(特别是针对 Markdown、LaTeX 和 HTML) @@ -49,9 +45,9 @@ Cream 开始运行以后,打开一个文件,或者新建一个文件,然 * 内建文件浏览器 -Cream 也有许多附加包,可以给编辑器增加一些新的特性。这些特性包括文本加密、清理电子邮件内容,甚至还有一个使用教程。老实说,我还没有发现哪一个附加包是真正有用的,不过你的里程可能会有所不同。 +Cream 也有许多附加包,可以给编辑器增加一些新的特性。这些特性包括文本加密、清理电子邮件内容,甚至还有一个使用教程。老实说,我还没有发现哪一个附加包是真正有用的,不过你的感受可能会有所不同。 -我曾听过一些 Vi/Vim 的狂热分子谴责 Cream “简化”(它们的话)了 Vi/Vim 编辑器的功能。的确,Cream 并不是为他们设计的。它是为那些想快速使用 Vim ,同时保留他们曾经使用过的编辑器的外观和感觉的人准备的。在这种情况下, Cream 是值得赞赏的,它使得 Vim 更加容易使用,更加广泛的被人们使用。 +我曾听过一些 Vi/Vim 的狂热分子谴责 Cream “降低”(他们的话)了 Vi/Vim 编辑器的水准。的确,Cream 并不是为他们设计的。它是为那些想快速使用 Vim ,同时保留他们曾经使用过的编辑器的外观和感觉的人准备的。在这种情况下, Cream 是值得赞赏的,它使得 Vim 更加容易使用,更加广泛的被人们使用。 -------------------------------------------------------------------------------- @@ -70,3 +66,4 @@ via: https://opensource.com/article/17/5/stir-bit-cream-make-vim-friendlier [4]:https://opensource.com/user/14925/feed [5]:https://opensource.com/article/17/5/stir-bit-cream-make-vim-friendlier#comments [6]:https://opensource.com/users/scottnesbitt +[7]:http://cream.sourceforge.net/featurelist.html From 303a1cff4a5e16eb3b9d6e8243e36a6a0b374503 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 25 May 2017 16:11:48 +0800 Subject: [PATCH 04/33] PUB:20170518 How to make Vim user-friendly with Cream.md @ucasFL @jasminepeng --- ...How to make Vim user-friendly with Cream.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) rename {translated/tech => published}/20170518 How to make Vim user-friendly with Cream.md (70%) diff --git a/translated/tech/20170518 How to make Vim user-friendly with Cream.md b/published/20170518 How to make Vim user-friendly with Cream.md similarity index 70% rename from translated/tech/20170518 How to make Vim user-friendly with Cream.md rename to published/20170518 How to make Vim user-friendly with Cream.md index 00206321b7..66e289d214 100644 --- a/translated/tech/20170518 How to make Vim user-friendly with Cream.md +++ b/published/20170518 How to make Vim user-friendly with Cream.md @@ -1,9 +1,10 @@ 如何使用 Cream 提高 Vim 的用户友好性 ============================================================ -### Cream 附加包通过把一个更加熟悉的“面孔”置于 Vim 文本编辑器之上,同时保留 Vim 的功能,使其更加容易使用 +> Cream 附加包通过把一个更加熟悉的“面孔”置于 Vim 文本编辑器之上,同时保留 Vim 的功能,使其更加容易使用 ![How to make Vim user-friendly with Cream](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/osdc_edu_rightmix_520.png?itok=SCsog_qv "How to make Vim user-friendly with Cream") + 图片来自 : opensource.com 大约 10 年前,我既使用 Emacs 进行文本编辑,也使用 Vim 进行文本编辑。说到底,我的确是一个热衷于 Emacs 的家伙。尽管 Emacs 在我的心里占据了很重要的地位,但我知道, Vim 也不赖。 @@ -20,15 +21,15 @@ 安装好 Vim 以后,便可[下载 Cream 的安装程序][2],或者你也可以再次使用 Linux 发行版的包管理器进行安装。 -安装好 Cream 以后,你可以从应用菜单选择它(比如,**Applications**->**Cream**)或者在程序启动器中输入 **Cream**,从而启动 Cream 。 +安装好 Cream 以后,你可以从应用菜单选择它(比如,**Applications**->**Cream**)或者在程序启动器中输入 `Cream`,从而启动 Cream 。 -![Cream's main window](https://opensource.com/sites/default/files/resize/cream-main-window-520x336.png "Cream's main window") +![Cream’s main window](https://opensource.com/sites/default/files/resize/cream-main-window-520x336.png "Cream’s main window") ### Cream 的使用 -如果你之前已经使用过 Gvim,那么你会注意到, Cream 几乎没改变编辑器的外观和感觉。最大的不同是 Cream 的菜单栏和工具栏,它们取代了 Gvim 陈旧的菜单栏和工具栏,新的菜单栏和工具栏的外观和群组功能看起来和其它编辑器的一样。 +如果你之前已经使用过 Gvim,那么你会注意到, Cream 几乎没改变该编辑器的外观和感觉。最大的不同是 Cream 的菜单栏和工具栏,它们取代了 Gvim 陈旧的菜单栏和工具栏,新的菜单栏和工具栏的外观和功能分组看起来和其它编辑器的一样。 -Cream 的菜单栏隐藏了更多的技术选项,比如指定一个编译器的能力,以及来自用户的 `make` 命令的能力。当你通过使用 Cream 更加熟悉 Vim 以后,你只需要从 `Setting->Preferences->Behavior` 选择选项,就可以更容易的访问这些特性。有了这些选项,你可以(如果你想)体验到一个包含了 Cream 和传统 Vim 二者优点的强大编辑器。 +Cream 的菜单栏对用户隐藏了更多的技术选项,比如指定一个编译器的能力,以及运行 `make` 命令的能力。当你通过使用 Cream 更加熟悉 Vim 以后,你只需要从 **Setting**->**Preferences**->**Behavior** 选择选项,就可以更容易地访问这些特性。有了这些选项,你可以(如果你想)体验到一个兼有 Cream 和传统 Vim 二者优点的强大编辑器。 Cream 并不是仅由菜单驱动。尽管编辑器的功能仅有单击或双击两种方式,但是你也可以使用常见的键盘快捷键来执行操作,比如 `CTRL-O`(打开一个文件),`CTRL-C`(复制文本)。你不需要在几种模式之间切换,也不需要记住一些很难记住的命令。 @@ -44,16 +45,15 @@ Cream 开始运行以后,打开一个文件,或者新建一个文件,然 * 字数统计 * 内建文件浏览器 +Cream 本身也有许多附加包,可以给编辑器增加一些新的特性。这些特性包括文本加密、清理电子邮件内容,甚至还有一个使用教程。老实说,我还没有发现哪一个附加包是真正有用的,不过你的感受可能会有所不同。 -Cream 也有许多附加包,可以给编辑器增加一些新的特性。这些特性包括文本加密、清理电子邮件内容,甚至还有一个使用教程。老实说,我还没有发现哪一个附加包是真正有用的,不过你的感受可能会有所不同。 - -我曾听过一些 Vi/Vim 的狂热分子谴责 Cream “降低”(他们的话)了 Vi/Vim 编辑器的水准。的确,Cream 并不是为他们设计的。它是为那些想快速使用 Vim ,同时保留他们曾经使用过的编辑器的外观和感觉的人准备的。在这种情况下, Cream 是值得赞赏的,它使得 Vim 更加容易使用,更加广泛的被人们使用。 +我曾听过一些 Vi/Vim 的狂热分子谴责 Cream “降低”(这是他们的原话)了 Vi/Vim 编辑器的水准。的确,Cream 并不是为他们设计的。它是为那些想快速使用 Vim ,同时保留他们曾经使用过的编辑器的外观和感觉的人准备的。在这种情况下, Cream 是值得赞赏的,它使得 Vim 更加容易使用,更加广泛的被人们使用。 -------------------------------------------------------------------------------- via: https://opensource.com/article/17/5/stir-bit-cream-make-vim-friendlier -作者:[ Scott Nesbitt][a] +作者:[Scott Nesbitt][a] 译者:[ucasFL](https://github.com/ucasFL) 校对:[jasminepeng](https://github.com/jasminepeng) From b5e3cf9d4e4e0ba0b816eda713ce475830649732 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 26 May 2017 09:10:58 +0800 Subject: [PATCH 05/33] translating --- ... Vulnerability Scanner to Find Security Issues in WordPress.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md b/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md index c99a827a09..eaec79176f 100644 --- a/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md +++ b/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md @@ -1,3 +1,5 @@ +translating---geekpi + WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress ============================================================ From 54940a904340cdbd44b9ccdaddce51324a7b60ae Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:33:39 +0800 Subject: [PATCH 06/33] =?UTF-8?q?20170526-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...d with iRedMail for Samba4 AD – Part 13.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md diff --git a/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md b/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md new file mode 100644 index 0000000000..ee45584608 --- /dev/null +++ b/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md @@ -0,0 +1,177 @@ +How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13 +============================================================ + + +This tutorial will guide you on how to configure Mozilla Thunderbird client with an iRedMail server in order to send and receive mail via IMAPS and SMTP submission protocols, how to setup contacts database with Samba AD LDAP server and how to configure other related mail features, such as enabling Thunderbird contacts via LDAP database offline replica. + +The process of installing and configuring Mozilla Thunderbird client described here is valid for Thunderbird clients installed on Windows or Linux operating systems. + +#### Requirements + +1. [How to Configure and Integrate iRedMail Services to Samba4 AD DC][1] + +2. [Integrate iRedMail Roundcube with Samba4 AD DC][2] + +### Step 1: Configure Thunderbird for iRedMail Server + +1. After installing Thunderbird mail client, hit on the launcher or shortcut to open the program and on the first screen check E-mail System Integration and click on Skip Integration button to continue. + + [![Thunderbird System Integration](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-System-Integration.png)][3] + +Thunderbird System Integration + +2. On the welcome screen hit on Skip this and use my existing mail button and add your name, your Samba account e-mail address and password, check Remember password field and hit on Continue button to start your mail account setup. + +After Thunderbird client tries to identify the correct IMAP settings provided by iRedMail server hit on Manual config button to manually setup Thunderbird. + + [![Thunderbird Mail Account Setup](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Mail-Account-Setup.png)][4] + +Thunderbird Mail Account Setup + +3. After the Mail Account Setup window expands, manually edit IMAP and SMTP settings by adding your proper iRedMail server FQDN, add secured ports for both mail services (993 for IMAPS and 587 for submission), select the proper SSL communication channel for each port and authentication and hit Done to complete the setup. Use the below image as a guide. + + [![Thunderbird iRedMail Settings](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-iRedMail-Settings.png)][5] + +Thunderbird iRedMail Settings + +4. A new Security Exception window should appear on your screen due to the Self-Signed Certificates your iRedMail server enforces. Check on Permanently store this exception and hit on Confirm Security Exception button to add this security exception and the Thunderbird client should be successfully configured. + + [![Thunderbird Security Exception](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Security-Exception.png)][6] + +Thunderbird Security Exception + +You will see all received mail for your domain account and you should be able to send or receive mail to and from your domain or other domain accounts. + + [![Domain Mails Inbox](https://www.tecmint.com/wp-content/uploads/2017/05/Domain-Mails-Inbox.png)][7] + +Domain Mails Inbox + +### Step 2: Setup Thunderbird Contacts Database with Samba AD LDAP + +5. In order for Thunderbird clients to query Samba AD LDAP database for contacts, hit on Settings menu by right clicking on your account from the left plane and navigate to Composition & Addressing → Addressing → Use a different LDAP server → Edit Directories button as illustrated on the below images. + + [![Thunderbird Samba AD LDAP Settings](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Samba-AD-LDAP-Settings.png)][8] + +Thunderbird Samba AD LDAP Settings + + [![Thunderbird Composition & Addressing Settings](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Composition-Addressing-Settings.png)][9] + +Thunderbird Composition & Addressing Settings + +6. The LDAP Directory Servers windows should open by now. Hit on Add button and fill Directory Server Properties windows with the following content: + +On General tab add descriptive name for this object, add the name of your domain or the FQDN of a Samba domain controller, the base DN of your domain in the form dc=your_domain,dc=tld, LDAP port number 389 and the vmail Bind DN account used to query the Samba AD LDAP database in the form vmail@your_domain.tld. + +Use the below screenshot as a guide. + + [![Directory Server Properties](https://www.tecmint.com/wp-content/uploads/2017/05/Directory-Server-Properties.png)][10] + +Directory Server Properties + +7. On the next step, move to Advanced tab from Directory Server Properties, and add the following content in Search filter filed: + +``` +(&(mail=*)(|(&(objectClass=user)(!(objectClass=computer)))(objectClass=group))) +``` + [![Add Search Filter](https://www.tecmint.com/wp-content/uploads/2017/05/Add-Search-Filter.png)][11] + +Add Search Filter + +Leave the rest of the settings as default and hit on OK button to apply changes and again on OK button to close LDAP Directory Servers window and OK button again on Account Settings to close the window. + + [![Select LDAP Directory Server](https://www.tecmint.com/wp-content/uploads/2017/05/Select-LDAP-Directory-Server.png)][12] + +Select LDAP Directory Server + +8. To test if Thunderbird client can query Samba AD LDAP database for contacts, hit on the upper Address Book icon, select the name of the LDAP database created earlier. + +Add the password for the Bind DN account configured to interrogate the AD LDAP server (vmail@your_domain.tld), check Use Password Manager to remember the password and hit OK button to reflect changes and close the window. + + [![Thunderbird Samba AD LDAP Testing](https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Samba-AD-LDAP-Testing.png)][13] + +Thunderbird Samba AD LDAP Testing + +9. Search for a Samba AD contact by using the upper search filed and suppling a domain account name. Be aware that Samba AD accounts with no e-mail address declared in their AD E-mail field will not be listed in Thunderbird Address Book searches. + + [![Search Samba AD Mail Contacts](https://www.tecmint.com/wp-content/uploads/2017/05/Search-Samba-AD-Mail-Contacts.png)][14] + +Search Samba AD Mail Contacts + +10. To search for a contact while composing an e-mail, click on View → Contacts Sidebar or press F9 key to open Contacts panel. + + [![Search Mail Contacts in Thunderbird](https://www.tecmint.com/wp-content/uploads/2017/05/Search-Mail-Contact-in-Thunderbird.png)][15] + +Search Mail Contacts in Thunderbird + +11. Select the proper Address Book and you should be able to search and add an e-mail address for your recipient. When sending the first mail, a new security alert window should appear. Hit on Confirm Security Exception and the mail should be sent to your recipient e-mail address. + + [![Send Mail in Thunderbird](https://www.tecmint.com/wp-content/uploads/2017/05/Send-Mail-in-Thunderbird.jpg)][16] + +Send Mail in Thunderbird + +12. In case you want to search contacts through Samba LDAP database only for a specific AD Organizational Unit, edit the Address Book for your Directory Server name from the left plane, hit on Properties and add the custom Samba AD OU as illustrated on the below example. + +``` +ou=your_specific_ou,dc=your_domain,dc=tld +``` + [![Search Contacts in Samba LDAP Database](https://www.tecmint.com/wp-content/uploads/2017/05/Search-Contacts-in-Samba-LDAP-Database.png)][17] + +Search Contacts in Samba LDAP Database + +### Step 3: Setup LDAP Offline Replica + +13. To configure Samba AD LDAP offline replica for Thunderbird hit on Address Book button, select your LDAP Address Book, open Directory Server Properties -> General tab and change the port number to 3268. + +Then switch to Offline tab and hit on Download Now button to start replicate Samba AD LDAP database locally. + + [![Setup LDAP Offline Replica in Thunderbird](https://www.tecmint.com/wp-content/uploads/2017/05/Setup-LDAP-Offline-Replica-in-Thunderbird.png)][18] + +Setup LDAP Offline Replica in Thunderbird + + [![Download LDAP Database for Offline](https://www.tecmint.com/wp-content/uploads/2017/05/Download-Samba-LDAP-Database-Offline.png)][19] + +Download LDAP Database for Offline + +When the process of synchronizing contacts finishes you will be informed with the message Replication succeeded. Hit OK and close all windows. In case Samba domain controller cannot be reached you can still search for LDAP contacts by working in offline mode. + +-------------------------------------------------------------------------------- + +作者简介: + +I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting. + + + +-------------- + +via: 网址 + +作者:[Matei Cezar ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.tecmint.com/author/cezarmatei/ +[1]:https://www.tecmint.com/integrate-iredmail-to-samba4-ad-dc-on-centos-7/ +[2]:https://www.tecmint.com/integrate-iredmail-roundcube-with-samba4-ad-dc/ +[3]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-System-Integration.png +[4]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Mail-Account-Setup.png +[5]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-iRedMail-Settings.png +[6]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Security-Exception.png +[7]:https://www.tecmint.com/wp-content/uploads/2017/05/Domain-Mails-Inbox.png +[8]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Samba-AD-LDAP-Settings.png +[9]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Composition-Addressing-Settings.png +[10]:https://www.tecmint.com/wp-content/uploads/2017/05/Directory-Server-Properties.png +[11]:https://www.tecmint.com/wp-content/uploads/2017/05/Add-Search-Filter.png +[12]:https://www.tecmint.com/wp-content/uploads/2017/05/Select-LDAP-Directory-Server.png +[13]:https://www.tecmint.com/wp-content/uploads/2017/05/Thunderbird-Samba-AD-LDAP-Testing.png +[14]:https://www.tecmint.com/wp-content/uploads/2017/05/Search-Samba-AD-Mail-Contacts.png +[15]:https://www.tecmint.com/wp-content/uploads/2017/05/Search-Mail-Contact-in-Thunderbird.png +[16]:https://www.tecmint.com/wp-content/uploads/2017/05/Send-Mail-in-Thunderbird.jpg +[17]:https://www.tecmint.com/wp-content/uploads/2017/05/Search-Contacts-in-Samba-LDAP-Database.png +[18]:https://www.tecmint.com/wp-content/uploads/2017/05/Setup-LDAP-Offline-Replica-in-Thunderbird.png +[19]:https://www.tecmint.com/wp-content/uploads/2017/05/Download-Samba-LDAP-Database-Offline.png +[20]:https://www.tecmint.com/author/cezarmatei/ +[21]:https://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[22]:https://www.tecmint.com/free-linux-shell-scripting-books/ From cdef1fa1ed3ad95de1512011f7075611982dd4d4 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:36:56 +0800 Subject: [PATCH 07/33] =?UTF-8?q?20170526-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...introduction to Linux's EXT4 filesystem.md | 301 ++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md diff --git a/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md b/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md new file mode 100644 index 0000000000..64f1dd213a --- /dev/null +++ b/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md @@ -0,0 +1,301 @@ +An introduction to Linux's EXT4 filesystem +============================================================ + +### Take a walk through EXT4's history, features, and optimal use, and learn how it differs from previous iterations of the EXT filesystem. + + +![An introduction to the EXT4 filesystem](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/hard_drives.png?itok=yZWyaSO6 "An introduction to the EXT4 filesystem") +>Image credits : [WIlliam][8][ Warby][9]. Modified by [Jason Baker][10]. Creative Commons [BY-SA 2.0][11]. + +In previous articles about Linux filesystems, I wrote [an introduction to Linux filesystems][12] and about some higher-level concepts such as [everything is a file][13]. I want to go into more detail about the specifics of the EXT filesystems, but first, let's answer the question, "What is a filesystem?" A filesystem is all of the following: + +1. **Data storage: **The primary function of any filesystem is to be a structured place to store and retrieve data. + +2. **Namespace: **A naming and organizational methodology that provides rules for naming and structuring data. + +3. **Security model: **A scheme for defining access rights. + +4. **API: **System function calls to manipulate filesystem objects like directories and files. + +5. **Implementation: **The software to implement the above. + +This article concentrates on the first item in the list and explores the metadata structures that provide the logical framework for data storage in an EXT filesystem. + +### EXT filesystem history + +Although written for Linux, the EXT filesystem has its roots in the Minix operating system and the Minix filesystem, which predate Linux by about five years, being first released in 1987\. Understanding the EXT4 filesystem is much easier if we look at the history and technical evolution of the EXT filesystem family from its Minix roots. + +### Minix + +When writing the original Linux kernel, Linus Torvalds needed a filesystem but didn't want to write one then. So he simply included the [Minix filesystem][14], which had been written by [Andrew S. Tanenbaum][15] and was a part of Tanenbaum's Minix operating system. [Minix][16] was a Unix-like operating system written for educational purposes. Its code was freely available and appropriately licensed to allow Torvalds to include it in his first version of Linux. + +Minix has the following structures, most of which are located in the partition where the filesystem is generated: + +* A [**boot sector**][6] in the first sector of the hard drive on which it is installed. The boot block includes a very small boot record and a partition table. + +* The first block in each partition is a **superblock **that contains the metadata that defines the other filesystem structures and locates them on the physical disk assigned to the partition. + +* An **inode bitmap block**, which determines which inodes are used and which are free. + +* The **inodes**, which have their own space on the disk. Each inode contains information about one file, including the locations of the data blocks, i.e., zones belonging to the file. + +* A **zone bitmap** to keep track of the used and free data zones. + +* A **data zone**, in which the data is actually stored. + +For both types of bitmaps, one bit represents one specific data zone or one specific inode. If the bit is zero, the zone or inode is free and available for use, but if the bit is one, the data zone or inode is in use. + +What is an [inode][17]? Short for index-node, an inode is a 256-byte block on the disk and stores data about the file. This includes the file's size; the user IDs of the file's user and group owners; the file mode (i.e., the access permissions); and three timestamps specifying the time and date that: the file was last accessed, last modified, and the data in the inode was last modified. + +The inode also contains data that points to the location of the file's data on the hard drive. In Minix and the EXT1-3 filesystems, this is a list of data zones or blocks. The Minix filesystem inodes supported nine data blocks, seven direct and two indirect. If you'd like to learn more, there is an excellent PDF with a detailed description of the [Minix filesystem structure][18] and a quick overview of the [inode pointer structure][19] on Wikipedia. + +### EXT + +The original [EXT filesystem][20] (Extended) was written by [Rémy Card][21] and released with Linux in 1992 to overcome some size limitations of the Minix filesystem. The primary structural changes were to the metadata of the filesystem, which was based on the Unix filesystem (UFS), which is also known as the Berkeley Fast File System (FFS). I found very little published information about the EXT filesystem that can be verified, apparently because it had significant problems and was quickly superseded by the EXT2 filesystem. + +### EXT2 + +The [EXT2 filesystem][22] was quite successful. It was used in Linux distributions for many years, and it was the first filesystem I encountered when I started using Red Hat Linux 5.0 back in about 1997\. The EXT2 filesystem has essentially the same metadata structures as the EXT filesystem, however EXT2 is more forward-looking, in that a lot of disk space is left between the metadata structures for future use. + +Like Minix, EXT2 has a [boot sector][23] in the first sector of the hard drive on which it is installed, which includes a very small boot record and a partition table. Then there is some reserved space after the boot sector, which spans the space between the boot record and the first partition on the hard drive that is usually on the next cylinder boundary. [GRUB2][24]—and possibly GRUB1—uses this space for part of its boot code. + +The space in each EXT2 partition is divided into cylinder groups that allow for more granular management of the data space. In my experience, the group size usually amounts to about 8MB. Figure 1, below, shows the basic structure of a cylinder group. The data allocation unit in a cylinder is the block, which is usually 4K in size. + +![cylindergroup-01_1.png](https://opensource.com/sites/default/files/images/life-uploads/cylindergroup-01_1.png) + +Figure 1: The structure of a cylinder group in the EXT filesystems + +The first block in the cylinder group is a superblock, which contains the metadata that defines the other filesystem structures and locates them on the physical disk. Some of the additional groups in the partition will have backup superblocks, but not all. A damaged superblock can be replaced by using a disk utility such as **dd** to copy the contents of a backup superblock to the primary superblock. It does not happen often, but once, many years ago, I had a damaged superblock, and I was able to restore its contents using one of the backup superblocks. Fortunately, I had been foresighted and used the **dumpe2fs** command to dump the descriptor information of the partitions on my system. + +Following is the partial output from the **dumpe2fs** command. It shows the metadata contained in the superblock, as well as data about each of the first two cylinder groups in the filesystem. + +``` +# dumpe2fs /dev/sda1 +Filesystem volume name: boot +Last mounted on: /boot +Filesystem UUID: 79fc5ed8-5bbc-4dfe-8359-b7b36be6eed3 +Filesystem magic number: 0xEF53 +Filesystem revision #: 1 (dynamic) +Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir nlink extra_isize +Filesystem flags: signed_directory_hash +Default mount options: user_xattr acl +Filesystem state: clean +Errors behavior: Continue +Filesystem OS type: Linux +Inode count: 122160 +Block count: 488192 +Reserved block count: 24409 +Free blocks: 376512 +Free inodes: 121690 +First block: 0 +Block size: 4096 +Fragment size: 4096 +Group descriptor size: 64 +Reserved GDT blocks: 238 +Blocks per group: 32768 +Fragments per group: 32768 +Inodes per group: 8144 +Inode blocks per group: 509 +Flex block group size: 16 +Filesystem created: Tue Feb 7 09:33:34 2017 +Last mount time: Sat Apr 29 21:42:01 2017 +Last write time: Sat Apr 29 21:42:01 2017 +Mount count: 25 +Maximum mount count: -1 +Last checked: Tue Feb 7 09:33:34 2017 +Check interval: 0 () +Lifetime writes: 594 MB +Reserved blocks uid: 0 (user root) +Reserved blocks gid: 0 (group root) +First inode: 11 +Inode size: 256 +Required extra isize: 32 +Desired extra isize: 32 +Journal inode: 8 +Default directory hash: half_md4 +Directory Hash Seed: c780bac9-d4bf-4f35-b695-0fe35e8d2d60 +Journal backup: inode blocks +Journal features: journal_64bit +Journal size: 32M +Journal length: 8192 +Journal sequence: 0x00000213 +Journal start: 0 + +Group 0: (Blocks 0-32767) + Primary superblock at 0, Group descriptors at 1-1 + Reserved GDT blocks at 2-239 + Block bitmap at 240 (+240) + Inode bitmap at 255 (+255) + Inode table at 270-778 (+270) + 24839 free blocks, 7676 free inodes, 16 directories + Free blocks: 7929-32767 + Free inodes: 440, 470-8144 +Group 1: (Blocks 32768-65535) + Backup superblock at 32768, Group descriptors at 32769-32769 + Reserved GDT blocks at 32770-33007 + Block bitmap at 241 (bg #0 + 241) + Inode bitmap at 256 (bg #0 + 256) + Inode table at 779-1287 (bg #0 + 779) + 8668 free blocks, 8142 free inodes, 2 directories + Free blocks: 33008-33283, 33332-33791, 33974-33975, 34023-34092, 34094-34104, 34526-34687, 34706-34723, 34817-35374, 35421-35844, 35935-36355, 36357-36863, 38912-39935, 39940-40570, 42620-42623, 42655, 42674-42687, 42721-42751, 42798-42815, 42847, 42875-42879, 42918-42943, 42975, 43000-43007, 43519, 43559-44031, 44042-44543, 44545-45055, 45116-45567, 45601-45631, 45658-45663, 45689-45695, 45736-45759, 45802-45823, 45857-45887, 45919, 45950-45951, 45972-45983, 46014-46015, 46057-46079, 46112-46591, 46921-47103, 49152-49395, 50027-50355, 52237-52255, 52285-52287, 52323-52351, 52383, 52450-52479, 52518-52543, 52584-52607, 52652-52671, 52734-52735, 52743-53247 + Free inodes: 8147-16288 +Group 2: (Blocks 65536-98303) + Block bitmap at 242 (bg #0 + 242) + Inode bitmap at 257 (bg #0 + 257) + Inode table at 1288-1796 (bg #0 + 1288) + 6326 free blocks, 8144 free inodes, 0 directories + Free blocks: 67042-67583, 72201-72994, 80185-80349, 81191-81919, 90112-94207 + Free inodes: 16289-24432 +Group 3: (Blocks 98304-131071) + + +``` + +Each cylinder group has its own inode bitmap that is used to determine which inodes are used and which are free within that group. The inodes have their own space in each group. Each inode contains information about one file, including the locations of the data blocks belonging to the file. The block bitmap keeps track of the used and free data blocks within the filesystem. Notice that there is a great deal of data about the filesystem in the output shown above. On very large filesystems the group data can run to hundreds of pages in length. The group metadata includes a listing of all of the free data blocks in the group. + +The EXT filesystem implemented data-allocation strategies that ensured minimal file fragmentation. Reducing fragmentation improved filesystem performance. Those strategies are described below, in the section on EXT4. + +The biggest problem with the EXT2 filesystem, which I encountered on some occasions, was that it could take many hours to recover after a crash because the **fsck** (file system check) program took a very long time to locate and correct any inconsistencies in the filesystem. It once took over 28 hours on one of my computers to fully recover a disk upon reboot after a crash—and that was when disks were measured in the low hundreds of megabytes in size. + +### EXT3 + +The [EXT3 filesystem][25] had the singular objective of overcoming the massive amounts of time that the **fsck** program required to fully recover a disk structure damaged by an improper shutdown that occurred during a file-update operation. The only addition to the EXT filesystem was the [journal][26], which records in advance the changes that will be performed to the filesystem. The rest of the disk structure is the same as it was in EXT2. + +Instead of writing data to the disk's data areas directly, as in previous versions, the journal in EXT3 writes file data, along with its metadata, to a specified area on the disk. Once the data is safely on the hard drive, it can be merged in or appended to the target file with almost zero chance of losing data. As this data is committed to the data area of the disk, the journal is updated so that the filesystem will remain in a consistent state in the event of a system failure before all the data in the journal is committed. On the next boot, the filesystem will be checked for inconsistencies, and data remaining in the journal will then be committed to the data areas of the disk to complete the updates to the target file. + +Journaling does reduce data-write performance, however there are three options available for the journal that allow the user to choose between performance and data integrity and safety. My personal preference is on the side of safety because my environments do not require heavy disk-write activity. + +The journaling function reduces the time required to check the hard drive for inconsistencies after a failure from hours (or even days) to mere minutes, at the most. I have had many issues over the years that have crashed my systems. The details could fill another article, but suffice it to say that most were self-inflicted, like kicking out a power plug. Fortunately, the EXT journaling filesystems have reduced that bootup recovery time to two or three minutes. In addition, I have never had a problem with lost data since I started using EXT3 with journaling. + +The journaling feature of EXT3 can be turned off and it then functions as an EXT2 filesystem. The journal itself still exists, empty and unused. Simply remount the partition with the mount command using the type parameter to specify EXT2\. You may be able to do this from the command line, depending upon which filesystem you are working with, but you can change the type specifier in the **/etc/fstab** file and then reboot. I strongly recommend against mounting an EXT3 filesystem as EXT2 because of the additional potential for lost data and extended recovery times. + +An existing EXT2 filesystem can be upgraded to EXT3 with the addition of a journal using the following command. + +``` +tune2fs -j /dev/sda1 +``` + +Where **/dev/sda1** is the drive and partition identifier. Be sure to change the file type specifier in **/etc/fstab** and remount the partition or reboot the system to have the change take effect. + +### EXT4 + +The [EXT4 filesystem][27] primarily improves performance, reliability, and capacity. To improve reliability, metadata and journal checksums were added. To meet various mission-critical requirements, the filesystem timestamps were improved with the addition of intervals down to nanoseconds. The addition of two high-order bits in the timestamp field defers the [Year 2038 problem][28] until 2446—for EXT4 filesystems, at least. + +In EXT4, data allocation was changed from fixed blocks to extents. An extent is described by its starting and ending place on the hard drive. This makes it possible to describe very long, physically contiguous files in a single inode pointer entry, which can significantly reduce the number of pointers required to describe the location of all the data in larger files. Other allocation strategies have been implemented in EXT4 to further reduce fragmentation. + +EXT4 reduces fragmentation by scattering newly created files across the disk so that they are not bunched up in one location at the beginning of the disk, as many early PC filesystems did. The file-allocation algorithms attempt to spread the files as evenly as possible among the cylinder groups and, when fragmentation is necessary, to keep the discontinuous file extents as close as possible to others in the same file to minimize head seek and rotational latency as much as possible. Additional strategies are used to pre-allocate extra disk space when a new file is created or when an existing file is extended. This helps to ensure that extending the file will not automatically result in its becoming fragmented. New files are never allocated immediately after existing files, which also prevents fragmentation of the existing files. + +Aside from the actual location of the data on the disk, EXT4 uses functional strategies, such as delayed allocation, to allow the filesystem to collect all the data being written to the disk before allocating space to it. This can improve the likelihood that the data space will be contiguous. + +Older EXT filesystems, such as EXT2 and EXT3, can be mounted as EXT4 to make some minor performance gains. Unfortunately, this requires turning off some of the important new features of EXT4, so I recommend against this. + +EXT4 has been the default filesystem for Fedora since Fedora 14\. An EXT3 filesystem can be upgraded to EXT4 using the [procedure ][29]described in the Fedora documentation, however its performance will still suffer due to residual EXT3 metadata structures. The best method for upgrading to EXT4 from EXT3 is to back up all the data on the target filesystem partition, use the **mkfs** command to write an empty EXT4 filesystem to the partition, and then restore all the data from the backup. + +### Inode + +The inode, described previously, is a key component of the metadata in EXT filesystems. Figure 2 shows the relationship between the inode and the data stored on the hard drive. This diagram is the directory and inode for a single file which, in this case, may be highly fragmented. The EXT filesystems work actively to reduce fragmentation, so it is very unlikely you will ever see a file with this many indirect data blocks or extents. In fact, as you will see below, fragmentation is extremely low in EXT filesystems, so most inodes will use only one or two direct data pointers and none of the indirect pointers. + +![inodesanddataallocation-01_0.png](https://opensource.com/sites/default/files/images/life-uploads/inodesanddataallocation-01_0.png) + +Figure 2: The inode stores information about each file and enables the EXT filesystem to locate all data belonging to it. + +The inode does not contain the name of the file. Access to a file is via the directory entry, which itself is the name of the file and contains a pointer to the inode. The value of that pointer is the inode number. Each inode in a filesystem has a unique ID number, but inodes in other filesystems on the same computer (and even the same hard drive) can have the same inode number. This has implications for [links][30], and this discussion is beyond the scope of this article. + +The inode contains the metadata about the file, including its type and permissions as well as its size. The inode also contains space for 15 pointers that describe the location and length of data blocks or extents in the data portion of the cylinder group. Twelve of the pointers provide direct access to the data extents and should be sufficient to handle most files. However, for files that have significant fragmentation, it becomes necessary to have some additional capabilities in the form of indirect nodes. Technically these are not really inodes, so I use the term "node" here for convenience. + +An indirect node is a normal data block in the filesystem that is used only for describing data and not for storage of metadata, thus more than 15 entries can be supported. For example, a block size of 4K can support 512 4-byte indirect nodes, allowing **12 (direct) + 512 (indirect) = 524** extents for a single file. Double and triple indirect node support is also supported, but most of us are unlikely to encounter files requiring that many extents. + +### Data fragmentation + +For many older PC filesystems, such as FAT (and all its variants) and NTFS, fragmentation has been a significant problem resulting in degraded disk performance. Defragmentation became an industry in itself with different brands of defragmentation software that ranged from very effective to only marginally so. + +Linux's extended filesystems use data-allocation strategies that help to minimize fragmentation of files on the hard drive and reduce the effects of fragmentation when it does occur. You can use the **fsck** command on EXT filesystems to check the total filesystem fragmentation. The following example checks the home directory of my main workstation, which was only 1.5% fragmented. Be sure to use the **-n** parameter, because it prevents **fsck** from taking any action on the scanned filesystem. + +``` +fsck -fn /dev/mapper/vg_01-home +``` + +I once performed some theoretical calculations to determine whether disk defragmentation might result in any noticeable performance improvement. While I did make some assumptions, the disk performance data I used were from a new 300GB, Western Digital hard drive with a 2.0ms track-to-track seek time. The number of files in this example was the actual number that existed in the filesystem on the day I did the calculation. I did assume that a fairly large amount of the fragmented files (20%) would be touched each day. + +| **Total files** | **271,794** | +| % fragmentation | 5.00% | +| Discontinuities | 13,590 | +|   |   | +| % fragmented files touched per day | 20% (assume) | +| Number of additional seeks | 2,718 | +| Average seek time | 10.90 ms | +| Total additional seek time per day | 29.63 sec | +|   | 0.49 min | +|   |   | +| Track-to-track seek time | 2.00 ms | +| Total additional seek time per day | 5.44 sec | +|   | 0.091 min | + +Table 1: The theoretical effects of fragmentation on disk performance + +I have done two calculations for the total additional seek time per day, one based on the track-to-track seek time, which is the more likely scenario for most files due to the EXT file allocation strategies, and one for the average seek time, which I assumed would make a fair worst-case scenario. + +As you can see from Table 1, the impact of fragmentation on a modern EXT filesystem with a hard drive of even modest performance would be minimal and negligible for the vast majority of applications. You can plug the numbers from your environment into your own similar spreadsheet to see what you might expect in the way of performance impact. This type of calculation most likely will not represent actual performance, but it can provide a bit of insight into fragmentation and its theoretical impact on a system. + +Most of my partitions are around 1.5% or 1.6% fragmented; I do have one that is 3.3% fragmented but that is a large, 128GB filesystem with fewer than 100 very large ISO image files; I've had to expand the partition several times over the years as it got too full. + +That is not to say that some application environments don't require greater assurance of even less fragmentation. The EXT filesystem can be tuned with care by a knowledgeable admin who can adjust the parameters to compensate for specific workload types. This can be done when the filesystem is created or later using the **tune2fs** command. The results of each tuning change should be tested, meticulously recorded, and analyzed to ensure optimum performance for the target environment. In the worst case, where performance cannot be improved to desired levels, other filesystem types are available that may be more suitable for a particular workload. And remember that it is common to mix filesystem types on a single host system to match the load placed on each filesystem. + +Due to the low amount of fragmentation on most EXT filesystems, it is not necessary to defragment. In any event, there is no safe defragmentation tool for EXT filesystems. There are a few tools that allow you to check the fragmentation of an individual file or the fragmentation of the remaining free space in a filesystem. There is one tool, **e4defrag**, which will defragment a file, directory, or filesystem as much as the remaining free space will allow. As its name implies, it only works on files in an EXT4 filesystem, and it does have some limitations. + +If it becomes necessary to perform a complete defragmentation on an EXT filesystem, there is only one method that will work reliably. You must move all the files from the filesystem to be defragmented, ensuring that they are deleted after being safely copied to another location. If possible, you could then increase the size of the filesystem to help reduce future fragmentation. Then copy the files back onto the target filesystem. Even this does not guarantee that all the files will be completely defragmented. + +### Conclusions + +The EXT filesystems have been the default for many Linux distributions for more than 20 years. They offer stability, high capacity, reliability, and performance while requiring minimal maintenance. I have tried other filesystems but always return to EXT. Every place I have worked with Linux has used the EXT filesystems and found them suitable for all the mainstream loads used on them. Without a doubt, the EXT4 filesystem should be used for most Linux systems unless there is a compelling reason to use another filesystem. + +-------------------------------------------------------------------------------- + +作者简介: + +David Both - David Both is a Linux and Open Source advocate who resides in Raleigh, North Carolina. He has been in the IT industry for over forty years and taught OS/2 for IBM where he worked for over 20 years. While at IBM, he wrote the first training course for the original IBM PC in 1981. He has taught RHCE classes for Red Hat and has worked at MCI Worldcom, Cisco, and the State of North Carolina. He has been working with Linux and Open Source Software for almost 20 years. + +------------------- + +via: 网址 + +作者:[David Both ][a] +译者:[译者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/dboth +[1]:https://opensource.com/resources/what-is-linux?src=linux_resource_menu +[2]:https://opensource.com/resources/what-are-linux-containers?src=linux_resource_menu +[3]:https://developers.redhat.com/promotions/linux-cheatsheet/?intcmp=7016000000127cYAAQ +[4]:https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?src=linux_resource_menu&intcmp=7016000000127cYAAQ +[5]:https://opensource.com/tags/linux?src=linux_resource_menu +[6]:https://en.wikipedia.org/wiki/Boot_sector +[7]:https://opensource.com/article/17/5/introduction-ext4-filesystem?rate=B4QU3W_JYmEKsIKZf5yqMpztt7CRF6uzC0wfNBidEbs +[8]:https://www.flickr.com/photos/wwarby/11644168395 +[9]:https://www.flickr.com/photos/wwarby/11644168395 +[10]:https://opensource.com/users/jason-baker +[11]:https://creativecommons.org/licenses/by/2.0/ +[12]:https://opensource.com/life/16/10/introduction-linux-filesystems +[13]:https://opensource.com/life/15/9/everything-is-a-file +[14]:https://en.wikipedia.org/wiki/MINIX_file_system +[15]:https://en.wikipedia.org/wiki/Andrew_S._Tanenbaum +[16]:https://en.wikipedia.org/wiki/MINIX +[17]:https://en.wikipedia.org/wiki/Inode +[18]:http://ohm.hgesser.de/sp-ss2012/Intro-MinixFS.pdf +[19]:https://en.wikipedia.org/wiki/Inode_pointer_structure +[20]:https://en.wikipedia.org/wiki/Extended_file_system +[21]:https://en.wikipedia.org/wiki/R%C3%A9my_Card +[22]:https://en.wikipedia.org/wiki/Ext2 +[23]:https://en.wikipedia.org/wiki/Boot_sector +[24]:https://opensource.com/article/17/2/linux-boot-and-startup +[25]:https://en.wikipedia.org/wiki/Ext3 +[26]:https://en.wikipedia.org/wiki/Journaling_file_system +[27]:https://en.wikipedia.org/wiki/Ext4 +[28]:https://en.wikipedia.org/wiki/Year_2038_problem +[29]:https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/ext4converting.html +[30]:https://en.wikipedia.org/wiki/Hard_link +[31]:https://opensource.com/user/14106/feed +[32]:https://opensource.com/article/17/5/introduction-ext4-filesystem#comments +[33]:https://opensource.com/users/dboth From c2a933597b012bd30f288df407e1d5664f6d2c07 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:38:38 +0800 Subject: [PATCH 08/33] =?UTF-8?q?20170526-3=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... a systems management library for Linux.md | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 sources/tech/20170523 An introduction to Libral, a systems management library for Linux.md diff --git a/sources/tech/20170523 An introduction to Libral, a systems management library for Linux.md b/sources/tech/20170523 An introduction to Libral, a systems management library for Linux.md new file mode 100644 index 0000000000..f9e5a3957a --- /dev/null +++ b/sources/tech/20170523 An introduction to Libral, a systems management library for Linux.md @@ -0,0 +1,196 @@ +An introduction to Libral, a systems management library for Linux +============================================================ + +### Libral provides a uniform management API across system resources and serves as a solid foundation for scripting management tasks and building configuration-management systems. + + +![An introduction to Libral, a systems management library for Linux](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/yearbook-haff-rx-linux-file-lead_0.png?itok=48iDNoH8 "An introduction to Libral, a systems management library for Linux") +>Image by : [Internet Archive Book Images][10]. Modified by Opensource.com. CC BY-SA 4.0 + +Linux, in keeping with Unix traditions, doesn't have a comprehensive systems management API. Instead, management is done through a variety of special-purpose tools and APIs, all with their own conventions and idiosyncrasies. That makes scripting even simple systems-management tasks difficult and brittle. + +For example, changing the login shell of the "app" user is done by running **usermod -s /sbin/nologin app**. This works great until it is attempted on a system that does not have an app user. To fix the ensuing failure, the enterprising script writer might now resort to: + +``` +    grep -q app /etc/passwd \ +      && usermod -s /sbin/nologin app \ +      || useradd ... -s /sbin/nologin app +``` + +So that the change in the login shell is performed when the app user is present on the system, and the user is created if it is not present yet. Unfortunately, this approach to scripting systems-management tasks is not sustainable: For each kind of resource, a different set of tools and their idiosyncrasies must be taken into account; inconsistent and often incomplete error reporting makes error handling difficult; and it is easy to trip over small bugs caused by the ad hoc nature of the tools involved. + +In fact, the above example is not correct: **grep** doesn't look for the **app** user, it simply looks for any line in **/etc/passwd** that contains the string **app**, something that might work most of the time, but can fail—usually at the worst possible moment. + + + +Clearly, management tools that make it hard to perform simple tasks from scripts are, at best, a difficult basis for larger management systems. Recognizing this, existing configuration-management systems, such as Puppet, Chef, or Ansible, have gone to great lengths to build their own internal APIs around the management of basic operating system resources. These resource abstractions are internal APIs, and closely tied to the needs of their respective tools. This causes not only a colossal duplication of effort, but also creates a strong barrier to entry for new and innovative management tools. + +One area where this barrier to entry becomes evident is in building VM or container images: In the course of building such images, it is often necessary to either answer simple questions about them or make simple changes to them. But since the tools for this all require special treatment, these questions and changes face exactly the problems that somebody trying to script them faces. As a consequence, image building must rely on either ad hoc scripts or using (and installing) a quite substantial configuration-management system. + +[Libral][11] establishes a solid foundation for management tools and tasks by providing a common management API across system resources and by making it available through a command line tool, **ralsh**, that enables users to query and to modify system resources in a uniform way, with predictable error reporting. In the above example, checking whether the app user exists is done with **ralsh -aq user app**; checking whether the package **foo** is installed is done with **ralsh -aq package foo**; and, in general, checking whether a resource of type **TYPE** with name **NAME** is present is done with **ralsh -aq TYPE NAME**. Similarly, to create or change an existing user, one runs: + +``` +    ralsh user app home=/srv/app shell=/sbin/nologin +``` + +and to create or change an entry in **/etc/hosts**, one runs: + +``` + ralsh hostmyhost.example.com ip=10.0.0.1 \ + host_aliases=myhost,apphost +``` + +In this manner, the user of ralsh is isolated from the fact that these two commands work quite differently internally: The first one needs to use the proper invocation of **useradd** or **usermod**, whereas the second needs to edit the file **/etc/hosts**. For the user, though, they both appear to take the same shape: "Make sure that this resource is in the state that I need." + +### Where to get Libral and how to use it + +Libral is available from [this git repo][12]. Its core is written in C++, and instructions for building it can be found [in the repo][13]. That is only necessary if you actually want to contribute to Libral's C++ core. The Libral site also contains a [prebuilt tarball][14] that can be used on any Linux machine that uses **glibc 2.12** or later. The contents of that tarball can be used both to explore ralsh further and to develop new providers, which give Libral the capability to manage new kinds of resources. + +After downloading and unpacking the tarball, the **ralsh** command can be found in **ral/bin**. Running it without arguments will list all resource types that Libral knows about. Passing the **--help **option prints output that contains more example of how to use **ralsh**. + +### Relationship to configuration-management systems + +Well-known configuration-management systems, such as Puppet, Chef, or Ansible, address some of the same problems that Libral addresses. What sets Libral apart from them is mostly in the things that these systems do and Libral doesn't. Configuration-management systems are built to deal with the variety and complexity of managing many different things across large numbers of nodes. Libral, on the other hand, aims at providing a low-level systems management API that is well-defined, independent of any particular tool, and usable with a wide variety of programming languages. + +By removing the application logic that the large configuration-management systems contain, Libral is much more versatile in how it can be used, from the simple scripting tasks mentioned in the introduction, to serving as the building blocks for complex management applications. Focusing on these basics also allows it to be very small, currently less than 2.5 MB, an important consideration for resource-constrained environments, including containers and small devices. + +### The Libral API + +The design of the Libral API is guided by the experience of implementing large configuration-management systems over the last decade; while it is not directly tied to any of them, it takes them into account and makes choices to overcome their shortcomings. + +There are four important principles that the API design rests on: + +* Desired state  + +* Bidirectionality  + +* Lightweight abstractions + +* Ease of extension + +Basing a management API on desired state, i.e., the idea that the user expresses what the system should look like after an operation rather than how to get into that state, is hardly controversial at this point. Bidirectionality makes it possible to use the same API and, more importantly, the same resource abstractions to read existing state and to enforce changes to it. Lightweight abstractions ensure that it is easy to learn the API and make use of it quickly; past attempts at such management APIs have unduly burdened the user with learning a modeling framework, an important factor in their lack of adoption. + +Finally, it has to be easy to extend Libral's management capabilities so that users can teach Libral how to manage new kinds of resources. This is important both because of the sheer amount of resources that one might want to manage (and that Libral will manage in due time), as well as because even a fully built-out Libral will always fall short of a user's custom management needs. + +Currently, the main way to interact with the Libral API is through the **ralsh **command line tool. It exposes the underlying C++ API, which is still in flux, and is mainly geared at simple scripting tasks. The project also provides language bindings for CRuby, with others to follow. + +In the future, Libral will also provide a daemon with a remote API, so that it can serve as the basis for management systems that do not need to install additional agents on managed nodes. This, coupled with the ability to tailor the management capabilities of Libral, makes it possible to tightly control which aspects of a system can be managed and which ones are protected from any interference. + +For example, a Libral installation that is restricted to managing users and services will be guaranteed to not interfere with the packages installed on a node. Controlling what gets managed in this manner is currently not possible with any of the existing configuration-management systems; in particular, systems that require arbitrary SSH access to a managed node also expose that system to unwanted accidental or malicious interference. + +The basis of the Libral API is formed by two very simple operations: **get** to retrieve the current state of resources, and **set** to enforce the state of current resources. Idealizing a little from the actual implementation, they can be thought of as: + +``` + provider.get(names) -> List[resource] + provider.set(List[update]) -> List[change] +``` + +The **provider** is the object that knows how to manage a certain kind of resource, like a user, a service, or a package, and the Libral API provides ways to look up the provider for a certain kind of resource. + +The **get** operation receives a list of resource names, e.g., usernames, and needs to produce a list of resources, which are essentially hashes listing the attributes of each resource. This list must contain resources with the provided names, but might contain more, so that a naive **get** implementation can simply ignore the names and list all the resources it knows about. + +The **set** operation is used to enforce desired state and receives a list of updates. Each update contains **update.is**, a resource representing the current state, and **update.should**, a resource representing the desired state. Calling the **set** method will make sure that the resources mentioned in the update list will be in the state indicated in **update.should** and produces a list of the changes made to each resource. + +With **ralsh**, the current state of the **root** user can be retrieved with the command **ralsh user root**; by default, the command produces human-readable output, reminiscent of Puppet, but **ralsh** also supports a **--json** flag to make it produce JSON output for consumption by +scripts. The human-readable output is: + +``` + # ralsh user root + user::useradd { 'root': + ensure => 'present', + comment => 'root', + gid => '0', + groups => ['root'], + home => '/root', + shell => '/bin/bash', + uid => '0', + } +``` + +Similarly, the user can be changed with: + +``` + # ralsh user root comment='The superuser' + user::useradd { 'root': + ensure => 'present', + comment => 'The superuser', + gid => '0', + groups => ['root'], + home => '/root', + shell => '/bin/bash', + uid => '0', + } + comment(root->The superuser) +``` + +The output of ralsh lists both the new state of the root user, with the changed comment attribute, and what changes were made (solely to the **comment** attribute in this case). Running the same command a second time will produce much the same output, but without any change indication, as none will be needed. + +### Writing providers + +It is crucially important that writing new providers for ralsh is easy and requires a minimum amount of effort. For this reason, ralsh offers a number of calling conventions that make it possible to trade the complexity of implementing a provider against the power of what the provider can do. Providers can either be external scripts that adhere to a specific calling convention or be implemented in C++ and built into Libral. Currently, there are three calling conventions: + +* The [simple][6] calling convention is geared towards writing shell scripts that serve as providers + +* The [JSON][7] calling convention is meant for writing providers in scripting languages like Ruby or Python + +* The [internal C++ API][8] can be used to implement providers natively + +It is highly recommended to start provider development using the **simple** or the **JSON** calling convention. The file [simple.prov][15] on GitHub contains a skeleton for a simple shell provider, and it should be easy to adapt it for one's own provider. The file [python.prov][16] contains the skeleton of a JSON provider written in Python. + +One problem with using higher-level scripting languages for providers is that the runtimes, including all supporting libraries, for these languages need to be present on the system on which Libral will run. In some cases, that is not an obstacle; for example, a provider that does package management based on **yum** can expect that Python is present on the system, as **yum** is written in it. + +In many other cases though, there's no logical choice for a language beyond Bourne shell (or Bash) that can be expected to be installed on all managed systems. Often, provider writers need a more powerful scripting environment than just that. Unfortunately, bundling a full Ruby or Python interpreter with its runtime would increase Libral's size beyond what can reasonably be +used in resource-constrained environments. On the other hand, the canonical choices of Lua or Javascript as small embeddable scripting languages are not suitable for this context as they are both not familiar to most provider writers, and require quite a bit of work to expose commonly needed facilities for systems management. + +Libral bundles a version of [mruby][17], a small, embeddable version of Ruby, to give provider writers a stable foundation, and a powerful programming language for their implementation. mruby is a full implementation of the Ruby language, albeit with a much reduced standard library. The mruby bundled with Libral contains the parts of Ruby's standard library most important for scripting management tasks, which will be enhanced further over time based on the needs of provider writers. Libral's mruby also bundles an API adpater that makes writing providers to the json convention more comfortable, as it contains simple utilities (like [Augeas][18] for modifying structured files) and conveniences around parsing and outputting JSON. The file [mruby.prov][19] contains a skeleton example of a json provider written in mruby. + +### Future work + +The most important next steps for Libral are to make it more widely usable—the [precompiled tarball][20] is a great way to get started and sufficient to develop providers, but Libral also needs to be packaged and made available in mainstream distributions. In a similar vein, the utility of Libral strongly depends on the set of providers it ships with and those need to be expanded to cover a core set of management functionality. The Libral site contains [a todo list][21] showing the providers that are most urgently needed. + +There are also several ways in which the availability of Libral for different uses can be improved: from writing bindings for additional languages, for example, Python or Go, to making the use of **ralsh** in shell scripts even easier by offering, besides the existing human-readable output and JSON output, an output format that is easy to process in shell scripts. Use of Libral for larger-scale management can also be improved by adding the remote API discussed above, and by better supporting bulk installation of Libral via transports like SSH—that mostly requires providing prebuilt tarballs for more architectures and scripts that can select the right one based on the discovered architecture of the target system. + +There are many more ways in which Libral, its API, and its capabilities could evolve; one intriguing possibility is adding notification capabilities to the API so that Libral can report changes to system resources as they happen outside of its purview. The challenge for Libral will be to continue to be a small, lightweight and well-defined tool while covering an ever increasing set of uses and management capabilities—a challenge and a journey that I encourage every reader to become a part of. + +If any of this has made you curious, I would love to hear from you, be it in the form of a pull request, an enhancement request, or just a report of your experience trying out **ralsh**. + +-------------------------------------------------------------------------------- + +作者简介: + +David Lutterkort - David is a software engineer at Puppet, where he’s worked on projects such as Direct Puppet and Razor, the best provisioning tool, ever. He was one of the earliest contributors to Puppet and is the main author of Augeas, a configuration editing tool. + +------------------------ + +via: https://opensource.com/article/17/5/intro-libral-systems-management-library-linux + +作者:[David Lutterkort][a] +译者:[译者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/david-lutterkort +[1]:https://opensource.com/resources/what-is-linux?src=linux_resource_menu +[2]:https://opensource.com/resources/what-are-linux-containers?src=linux_resource_menu +[3]:https://developers.redhat.com/promotions/linux-cheatsheet/?intcmp=7016000000127cYAAQ +[4]:https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?src=linux_resource_menu&intcmp=7016000000127cYAAQ +[5]:https://opensource.com/tags/linux?src=linux_resource_menu +[6]:https://github.com/puppetlabs/libral/blob/master/doc/invoke-simple.md +[7]:https://github.com/puppetlabs/libral/blob/master/doc/invoke-json.md +[8]:https://github.com/puppetlabs/libral/blob/master/doc/invoke-native.md +[9]:https://opensource.com/article/17/5/intro-libral-systems-management-library-linux?rate=PqOZGb7A0LUlHQRwkzl23iaJZ2ZUy6gKcc6HOzaRL58 +[10]:https://www.flickr.com/photos/internetarchivebookimages/14803082483/in/photolist-oy6EG4-pZR3NZ-i6r3NW-e1tJSX-boBtf7-oeYc7U-o6jFKK-9jNtc3-idt2G9-i7NG1m-ouKjXe-owqviF-92xFBg-ow9e4s-gVVXJN-i1K8Pw-4jybMo-i1rsBr-ouo58Y-ouPRzz-8cGJHK-85Evdk-cru4Ly-rcDWiP-gnaC5B-pAFsuf-hRFPcZ-odvBMz-hRCE7b-mZN3Kt-odHU5a-73dpPp-hUaaAi-owvUMK-otbp7Q-ouySkB-hYAgmJ-owo4UZ-giHgqu-giHpNc-idd9uQ-osAhcf-7vxk63-7vwN65-fQejmk-pTcLgA-otZcmj-fj1aSX-hRzHQk-oyeZfR +[11]:https://github.com/puppetlabs/libral +[12]:https://github.com/puppetlabs/libral +[13]:https://github.com/puppetlabs/libral#building-and-installation +[14]:http://download.augeas.net/libral/ralsh-latest.tgz +[15]:https://github.com/puppetlabs/libral/blob/master/examples/providers/simple.prov +[16]:https://github.com/puppetlabs/libral/blob/master/examples/providers/python.prov +[17]:http://mruby.org/ +[18]:http://augeas.net/ +[19]:https://github.com/puppetlabs/libral/blob/master/examples/providers/mruby.prov +[20]:http://download.augeas.net/libral/ralsh-latest.tgz +[21]:https://github.com/puppetlabs/libral#todo-list +[22]:https://opensource.com/user/140051/feed +[23]:https://opensource.com/users/david-lutterkort From 14ed867ee5490441d124e37f22277d9d9b05285d Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:39:29 +0800 Subject: [PATCH 09/33] =?UTF-8?q?20170526-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nfigure Thunderbird with iRedMail for Samba4 AD – Part 13.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md b/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md index ee45584608..2cf0bee964 100644 --- a/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md +++ b/sources/tech/20170524 How to Configure Thunderbird with iRedMail for Samba4 AD – Part 13.md @@ -144,7 +144,7 @@ I'am a computer addicted guy, a fan of open source and linux based system softwa -------------- -via: 网址 +via: https://www.tecmint.com/configure-thunderbird-with-iredmail-for-samba4-ad-ldap/ 作者:[Matei Cezar ][a] 译者:[译者ID](https://github.com/译者ID) From 123c0a9199877f633d34364cd666c8b112563a24 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:39:48 +0800 Subject: [PATCH 10/33] =?UTF-8?q?20170526-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20170525 An introduction to Linux's EXT4 filesystem.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md b/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md index 64f1dd213a..d35168fcba 100644 --- a/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md +++ b/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md @@ -257,7 +257,7 @@ David Both - David Both is a Linux and Open Source advocate who resides in Ralei ------------------- -via: 网址 +via: https://opensource.com/article/17/5/introduction-ext4-filesystem 作者:[David Both ][a] 译者:[译者ID](https://github.com/译者ID) From c8ab6c885ff2294fcc705972ce2db9861b902acc Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 26 May 2017 09:40:48 +0800 Subject: [PATCH 11/33] translated --- ...nner to Find Security Issues in WordPress.md | 93 ------------------- ...nner to Find Security Issues in WordPress.md | 91 ++++++++++++++++++ 2 files changed, 91 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md create mode 100644 translated/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md diff --git a/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md b/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md deleted file mode 100644 index eaec79176f..0000000000 --- a/sources/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md +++ /dev/null @@ -1,93 +0,0 @@ -translating---geekpi - -WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress -============================================================ - -by [Aaron Kili][9] | Published: May 5, 2017 | Last Updated: May 5, 2017 - - Download Your Free eBooks NOW - [10 Free Linux eBooks for Administrators][10] | [4 Free Shell Scripting eBooks][11] - -WordPress is a free and open-source, highly customizable content management system (CMS) that is being used by millions around the world to run blogs and fully functional websites. Because it is the most used CMS out there, there are so many potential WordPress security issues/vulnerabilities to be concerned about. - -However, these security issues can be dealt with, if we follow common WordPress security best practices. In this article, we will show you how to use WPSeku, a WordPress vulnerability scanner in Linux, that can be used to find security holes in your WordPress installation and block potential threats. - -WPSeku is a simple WordPress vulnerability scanner written using Python, it can be used to scan local and remote WordPress installations to find security issues. - -### How to Install WPSeku – WordPress Vulnerability Scanner in Linux - -To install WPSeku in Linux, you need to clone the most recent version of WPSeku from its Github repository as shown. - -``` -$ cd ~ -$ git clone https://github.com/m4ll0k/WPSeku -``` - -Once you have obtained it, move into the WPSeku directory and run it as follows. - -``` -$ cd WPSeku -``` - -Now run the WPSeku using the `-u` option to specify your WordPress installation URL like this. - -``` -$ ./wpseku.py -u http://yourdomain.com -``` - [![WordPress Vulnerability Scanner](https://www.tecmint.com/wp-content/uploads/2017/05/WordPress-Vulnerability-Scanner.png)][1] - -WordPress Vulnerability Scanner - -The command below will search for cross site scripting, local file inclusion, and SQL injection vulnerabilities in your WordPress plugins using the `-p` option, you need to specify the location of plugins in the URL: - -``` -$ ./wpseku.py -u http://yourdomain.com/wp-content/plugins/wp/wp.php?id= -p [x,l,s] -``` - -The following command will execute a brute force password login and password login via XML-RPC using the option `-b`. Also, you can set a username and wordlist using the `--user` and `--wordlist` options respectively as shown below. - -``` -$ ./wpseku.py -u http://yourdomian.com --user username --wordlist wordlist.txt -b [l,x] -``` - -To view all WPSeku usage options, type. - -``` -$ ./wpseku.py --help -``` - [![WPSeku WordPress Vulnerability Scanner Help](https://www.tecmint.com/wp-content/uploads/2017/05/WPSeku-WordPress-Vulnerability-Scanner-Help.png)][2] - -WPSeku WordPress Vulnerability Scanner Help - -WPSeku Github repository: [https://github.com/m4ll0k/WPSeku][3] - -That’s it! In this article, we showed you how to get and use WPSeku for WordPress vulnerability scanning in Linux. WordPress is secure but only if we follow WordPress security best practices. Do you have any thoughts to share? If yes, then use the comment section below. - - --------------------------------------------------------------------------------- - -作者简介: - -Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge. - ------------------- - -via: https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/ - -作者:[Aaron Kili ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.tecmint.com/author/aaronkili/ -[1]:https://www.tecmint.com/wp-content/uploads/2017/05/WordPress-Vulnerability-Scanner.png -[2]:https://www.tecmint.com/wp-content/uploads/2017/05/WPSeku-WordPress-Vulnerability-Scanner-Help.png -[3]:https://github.com/m4ll0k/WPSeku -[4]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# -[5]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# -[6]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# -[7]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# -[8]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/#comments -[9]:https://www.tecmint.com/author/aaronkili/ -[10]:https://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ -[11]:https://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/translated/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md b/translated/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md new file mode 100644 index 0000000000..ddfc1d8eaf --- /dev/null +++ b/translated/tech/20170505 WPSeku – A Vulnerability Scanner to Find Security Issues in WordPress.md @@ -0,0 +1,91 @@ +WPSeku - 一个找出 WordPress 安全问题的漏洞扫描器 +============================================================ + +by [Aaron Kili][9] | Published: May 5, 2017 | Last Updated: May 5, 2017 + +立即下载你的免费电子书 - [10 本给管理员的免费 Linux 电子书][10] | [4 本免费的 Shell 脚本电子书][11] + +WordPress 是一个免费开源、高度可自定义的内容管理系统(CMS),它被全世界数以百万计的人来运行博客和完整的网站。因为它是被用的最多的 CMS,因此有许多潜在的 WordPress 安全问题/漏洞需要考虑。 + +然而,如果我们遵循通常的 WordPress 最佳实践,这些安全问题可以被处理。在本篇中,我们会向你展示如何使用 WPSeku,一个 Linux 中的 WordPress 漏洞扫描器,它可以被用来找出你的 WordPress 安装的安全漏洞,并阻止潜在的威胁。 + +WPSeku 是一个用 Python 写的简单 WordPress 漏洞扫描器,它可以被用来扫描本地以及远程的 WordPress 安装来找出安全问题。 + +### 如何安装 WPSeku - Linux 中的 WordPress 漏洞扫描器 + +要在 Linux 中安装 WPSeku,你需要如下从 Github clone 最新版本的 WPSeku。 + +``` +$ cd ~ +$ git clone https://github.com/m4ll0k/WPSeku +``` + +完成之后,进入 WPSeku 目录,并如下运行。 + +``` +$ cd WPSeku +``` + +使用 `-u` 选项指定 WordPress 的安装 URL,如下运行 WPSeku: + +``` +$ ./wpseku.py -u http://yourdomain.com +``` + [![WordPress Vulnerability Scanner](https://www.tecmint.com/wp-content/uploads/2017/05/WordPress-Vulnerability-Scanner.png)][1] + +WordPress 漏洞扫描器 + +以下命令使用 `-p` 选项搜索 WordPress 插件中的跨站脚本、本地文件夹入和 SQL 注入漏洞,你需要在 URL 中指定插件的位置: + +``` +$ ./wpseku.py -u http://yourdomain.com/wp-content/plugins/wp/wp.php?id= -p [x,l,s] +``` + +以下命令将使用 `-b` 选项通过 XML-RPC 执行暴力密码登录。另外,你可以使用 `--user` 和 `--wordlist` 选项分别设置用户名和单词列表,如下所示。 + +``` +$ ./wpseku.py -u http://yourdomian.com --user username --wordlist wordlist.txt -b [l,x] +``` + +要浏览所有 WPSeku 使用选项,输入: + +``` +$ ./wpseku.py --help +``` + [![WPSeku WordPress Vulnerability Scanner Help](https://www.tecmint.com/wp-content/uploads/2017/05/WPSeku-WordPress-Vulnerability-Scanner-Help.png)][2] + +WPSeku WordPress 漏洞扫描帮助 + +WPSeku Github 仓库:[https://github.com/m4ll0k/WPSeku][3] + +就是这样了!在本篇中,我们向你展示了如何在 Linux 中获取并使用 WPSeku 用于 WordPress 漏洞扫描。WordPress 是安全的,但仅在如果我们遵循 WordPress 安全最佳实践的情况下。你有要分享的想法么?如果有,请在评论区留言。 + + +-------------------------------------------------------------------------------- + +作者简介: + +Aaron Kili 是一个 Linux 及 F.O.S.S 热衷者,即将成为 Linux 系统管理员、web 开发者,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。 + +------------------ + +via: https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/ + +作者:[Aaron Kili ][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.tecmint.com/author/aaronkili/ +[1]:https://www.tecmint.com/wp-content/uploads/2017/05/WordPress-Vulnerability-Scanner.png +[2]:https://www.tecmint.com/wp-content/uploads/2017/05/WPSeku-WordPress-Vulnerability-Scanner-Help.png +[3]:https://github.com/m4ll0k/WPSeku +[4]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# +[5]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# +[6]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# +[7]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/# +[8]:https://www.tecmint.com/wpseku-wordpress-vulnerability-security-scanner/#comments +[9]:https://www.tecmint.com/author/aaronkili/ +[10]:https://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[11]:https://www.tecmint.com/free-linux-shell-scripting-books/ From 026bec432e93806c535e24fd8fd782b2b7c07d34 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:43:05 +0800 Subject: [PATCH 12/33] =?UTF-8?q?20170526-4=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...04 A beginner s guide to Linux syscalls.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20170504 A beginner s guide to Linux syscalls.md diff --git a/sources/tech/20170504 A beginner s guide to Linux syscalls.md b/sources/tech/20170504 A beginner s guide to Linux syscalls.md new file mode 100644 index 0000000000..4cdea16ab8 --- /dev/null +++ b/sources/tech/20170504 A beginner s guide to Linux syscalls.md @@ -0,0 +1,58 @@ +A beginner's guide to Linux syscalls +============================================================ + +![A beginner's guide to Linux syscalls](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/rh_003499_01_linux11x_cc.png?itok=ZivAkk-L "A beginner's guide to Linux syscalls") +>Image by : opensource.com + +Over the last couple of years, I've been doing a lot of work with containers. Early on I saw a fascinating talk by [Julien Friedman][7] where he wrote a bare-bones container in a few lines of Go. It gave me that "a-ha" moment where I grasped that containers are nothing more than Linux processes with a restricted view of the machine they're running on. + +Building this restricted view involved quite a few calls in [Golang's syscall package][8]. Initially, I just took that at face value, but after a while, I wanted to peel away the next layer of the onion to see what these syscalls are all about and how they work. I'll share what I learned in my talk at OSCON. + + +As the name suggests, [syscalls][9] are system calls, and they're the way that you can make requests from user space into the Linux kernel. The kernel does some work for you, like creating a process, then hands control back to user space. + +There is a common mechanism for making all system calls transition into the kernel, which is handled by the **libc **library. Userspace code sets up some registers including an ID of the system call it wants to make and any parameters it needs to pass to the system call. It triggers a "trap" to transition control to the kernel. + +That's how userspace code makes requests of the kernel, but Linux also has pseudo filesystems that allow the kernel to communicate information to user space. The contents look like ordinary directories and files. + +The **/proc** directory is a great example. Look inside, and you'll find all sorts of interesting information about the processes running on a machine. In some cases, like **cgroups **(control groups), user space can configure parameters by writing into files under these pseudo filesystems. + +It's particularly interesting when you're using containers because the host's **/proc** holds information about all the containerized processes. This includes environment variables, which are also stored in the **/proc**pseudo-filesystem, meaning that your host machine has access to the environment for all your running containers. This potentially has security consequences if you're passing secrets like certificates or database passwords into your containers through environment variables. + +Many programmers working on normal applications may not feel that they're using syscalls very often. In practice, they are, because even everyday activities like making files or changing directories involve syscalls on Linux. + +You don't have to be a systems programmer to have fun with syscalls! + + _If you’d like to learn more, Liz will be presenting _ [_A Beginner's Guide To Syscalls_][10] _at OSCON 2017 in Austin, Texas. If you’re interested in attending the conference, use this discount code _ [when you register][11] _:_  **PCOS** _._ + +-------------------------------------------------------------------------------- + +作者简介: + +Liz Rice - Liz Rice is the Technology Evangelist with container security specialists Aqua Security. Prior to that she co-founded Microscaling Systems and developed their real-time scaling engine, and the popular image metadata site MicroBadger.com. She has a wealth of software development, team, and product management experience from working on network protocols and distributed systems, and in digital technology sectors such as VOD, music, and VoIP. + +---------- + + +via: https://opensource.com/article/17/5/beginners-guide-syscalls + +作者:[Liz Rice ][a] +译者:[译者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/lizrice +[1]:https://opensource.com/resources/what-is-linux?src=linux_resource_menu +[2]:https://opensource.com/resources/what-are-linux-containers?src=linux_resource_menu +[3]:https://developers.redhat.com/promotions/linux-cheatsheet/?intcmp=7016000000127cYAAQ +[4]:https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?src=linux_resource_menu&intcmp=7016000000127cYAAQ +[5]:https://opensource.com/tags/linux?src=linux_resource_menu +[6]:https://opensource.com/article/17/5/beginners-guide-syscalls?rate=BT-vq0qMILAvJVxPFqug17N1RfhoAb_vkwNqRZFAqLQ +[7]:https://twitter.com/doctor_julz +[8]:https://golang.org/pkg/syscall/ +[9]:http://man7.org/linux/man-pages/man2/syscalls.2.html +[10]:https://conferences.oreilly.com/oscon/oscon-tx/public/schedule/detail/56840 +[11]:http://www.oreilly.com/pub/cpc/44407?sc_cid=701600000012BzSAAU%20target=%22_blank%22 +[12]:https://opensource.com/user/129431/feed +[13]:https://opensource.com/users/lizrice From dc4e45a0bb4b1ee2a3936a89704194347458246a Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:43:45 +0800 Subject: [PATCH 13/33] =?UTF-8?q?20170526-3=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...roduction to Libral a systems management library for Linux.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/tech/{20170523 An introduction to Libral, a systems management library for Linux.md => 20170523 An introduction to Libral a systems management library for Linux.md} (100%) diff --git a/sources/tech/20170523 An introduction to Libral, a systems management library for Linux.md b/sources/tech/20170523 An introduction to Libral a systems management library for Linux.md similarity index 100% rename from sources/tech/20170523 An introduction to Libral, a systems management library for Linux.md rename to sources/tech/20170523 An introduction to Libral a systems management library for Linux.md From 8b4ae54aad1b1caa2a862ed7ca45e3e520ddf062 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:44:03 +0800 Subject: [PATCH 14/33] =?UTF-8?q?20170526-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....md => 20170525 An introduction to Linux s EXT4 filesystem.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/tech/{20170525 An introduction to Linux's EXT4 filesystem.md => 20170525 An introduction to Linux s EXT4 filesystem.md} (100%) diff --git a/sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md b/sources/tech/20170525 An introduction to Linux s EXT4 filesystem.md similarity index 100% rename from sources/tech/20170525 An introduction to Linux's EXT4 filesystem.md rename to sources/tech/20170525 An introduction to Linux s EXT4 filesystem.md From d7f94709be34421e40d8d54022029b144f9f5bc2 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 26 May 2017 09:46:36 +0800 Subject: [PATCH 15/33] =?UTF-8?q?20170526-5=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...vices for hosting open source libraries.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20170426 Top 4 CDN services for hosting open source libraries.md diff --git a/sources/tech/20170426 Top 4 CDN services for hosting open source libraries.md b/sources/tech/20170426 Top 4 CDN services for hosting open source libraries.md new file mode 100644 index 0000000000..1f7cc2d7b4 --- /dev/null +++ b/sources/tech/20170426 Top 4 CDN services for hosting open source libraries.md @@ -0,0 +1,108 @@ +Top 4 CDN services for hosting open source libraries +============================================================ + +### Content delivery networks accelerate your website's images, CSS files, JS files, and other static content. + + +![Top 4 CDN services for hosting open source libraries](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/file_system.jpg?itok=s2b60oIB "Top 4 CDN services for hosting open source libraries") +>Image credits : [Open Clip Art Library][3], which released it explicitly into the **[public domain][1]** ([see here][4]). Modified by Jen Wike Huger. + +A CDN, or content delivery network, is a network of strategically placed servers located around the world used for the purpose of delivering files faster to users. A traditional CDN will allow you to accelerate your website's images, CSS files, JS files, and any other piece of static content. This allows website owners to accelerate all of their own content as well as provide them with additional features and configuration options. These premium services typically require payment based on the amount of bandwidth a project uses. + +However, if your project doesn't justify the cost of implementing a traditional CDN, the use of an open source CDN may be more suitable. Typically, these types of CDNs allow you to link to popular web-based libraries (CSS/JS frameworks, for example), which are then delivered to your web visitors from the free CDN's servers. Although CDN services for open source libraries do not allow you to upload your own content to their servers, they can help you accelerate libraries globally and improve your website's redundancy. + +CDNs host projects on a vast network of servers, so website maintainers need to modify their asset links in the website's HTML code to reflect the open source CDN's URL followed by the path to the resource. Depending upon whether you're linking to a JavaScript or CSS library, the links you'll include will live in either a