From 805f34ba77ff5d7f28f66b2de5679dbd17b26394 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 2 Mar 2017 01:13:50 +0800 Subject: [PATCH 001/190] PUB:20170119 Long-term Embedded Linux Maintenance Made Easier.md @geekpi --- ... Embedded Linux Maintenance Made Easier.md | 54 ++++++++++++++++++ ... Embedded Linux Maintenance Made Easier.md | 55 ------------------- 2 files changed, 54 insertions(+), 55 deletions(-) create mode 100644 published/20170119 Long-term Embedded Linux Maintenance Made Easier.md delete mode 100644 translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md diff --git a/published/20170119 Long-term Embedded Linux Maintenance Made Easier.md b/published/20170119 Long-term Embedded Linux Maintenance Made Easier.md new file mode 100644 index 0000000000..b78fd0ea8e --- /dev/null +++ b/published/20170119 Long-term Embedded Linux Maintenance Made Easier.md @@ -0,0 +1,54 @@ +长期维护嵌入式 Linux 内核变得容易 +============================================================ + + ![Jan Lübbe ](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jan-lubbe-elc.png?itok=6G5lADKu "Jan Lübbe ") + +*Pengutronix 内核黑客 Jan Lübbe 总结了嵌入式 Linux 中正在不断增长的安全威胁,并在这次欧洲嵌入式 Linux 会议上概述了一个计划,以保持长期设备的安全和功能完整。* [Linux 基金会][1] + +安全漏洞只发生在 Windows 上的好日子正在快速过去。恶意软件黑客和拒绝服务老手们正在越来越多地瞄准过时的嵌入式 Linux 设备,因此在 10 月的[欧洲嵌入式 Linux 会议Embedded Linux Conference Europe][3](ELCE)上的几个演讲的主题就与修复 Linux 安全漏洞相关。 + +最值得去听的讲演之一是 [Pengutronix][4] 内核黑客 Jan Lübbe 的《长期维护或管理(或免管理)嵌入式系统 10 年以上》。在总结嵌入式 Linux 中不断增长的安全威胁后,Lübbe 制定了一项计划,以确保长期设备的安全和功能完整。 Lübbe 说:“我们需要迁移到更新、更稳定的内核,并进行持续维护以修复关键漏洞。我们需要做上游更新和自动化流程,并建立一个可持续的工作流程。我们没有理由让系统中仍留有过时的软件。” + +随着 Linux 设备变得越来越老,传统的生命周期过程已经不再适用。 Lübbe 说:“通常,你会从 SoC 供应商或主线上获取内核、构建系统,并添加到用户空间。你可以定制和添加程序,并做一些测试。但是,在此之后有 15 年的维护阶段,你最好期望平台不会发生变化、不会想要添加新的功能、不需要实施管理调整。” + +所有这些变化,越来越多地导致你的系统暴露出新的错误,并需要大量更新以才能与上游软件保持同步。 Lübbe 说:“在内核中发生导致问题的错误并不总是无意的”。对于去年在 Allwinner 内核中发现的[后门][5],他又补充说:“这些供应商的内核从来不会执行主线内核社区的审查流程”。 + +Lübbe 继续说:“你不能认为你的供应商一直没问题。也许只有一两个工程师查看过后门代码这块。如果补丁发布在 Linux 内核邮件列表上,就不会有这种事,因为总会有人注意到。硬件供应商不关心安全或维护,也许你会在一两年后得到更新,但是即使这样,他们从一个固定版本开始开发,到他们发布稳定的版本通常需要几年的时间。如果你在这个基础上再开始开发,可能又过了半年,这就更过时了。” + +越来越多的嵌入式开发人员在长期稳定Long Term Stable(LTS)内核上构建长期产品。但这并不意味着没事了。Lübbe 说:“一个产品发布后,人们经常不再遵循稳定的发行链,也不再应用安全补丁。这样你会得到两个最糟糕的结果:过时的内核和没有安全性。你失去了多人测试的好处。” + +Lübbe 指出,使用像 Red Hat 这样的面向服务器的发行版的 Pengutronix 客户经常由于快速的定制、需要系统管理员干预的部署和升级系统而遇到问题。 + +“更新对一些东西有用,特别是在 x86 上,但每个项目基本上是自己建立基础设施来更新到新版本。” + +许多开发人员选择把向后移植作为更新长期产品的解决方案。Lübbe 说:“开始时很容易,但是一旦你不处于项目的维护范围,他们就不会告诉你所使用的版本是否受到一个 bug 的影响,因此很难判断一个修复是否相关。于是你不停打补丁和更新,而 bug 也在不断累积,而这些你必须自己维护,因为其他人不使用这些补丁。使用开源软件的好处就丢失了。” + +### 跟随上游项目 + +Lübbe 认为,最好的解决方案是跟踪由上游项目维护的版本。“我们主要关注基于主线内核的开发,所以我们在产品和主流内核及其他上游项目之间尽可能没有差别。长期系统在主线内核上得到很好的支持。大多数不使用 3D 图形的系统只需要很少的补丁。较新的内核版本还有很多[新的强化功能][6],这些可以减少漏洞的影响。 + +跟随主线发展对许多开发人员来说似乎令人畏惧,但是如果从一开始就这样,然后坚持下去,就会相对容易一些,Lübbe 说:“你需要为系统上做的一切制定流程。你总需要知道什么软件正在运行,这在使用良好的构建系统时会更容易。每个软件版本应定义完整的系统,以便你可以更新相关的一切。如果你不知道那里有什么,你就不能解决它。你也需要一个自动测试和自动部署更新。” + +为了“减少更新周期”,Lübbe 建议在开始开发时使用最新的 Linux 内核,并且在进入测试时才转到稳定的内核。之后,他建议每年将系统中的所有软件(包括内核、构建系统、用户空间、glibc 和组件(如 OpenSSL))更新为当年上游项目支持的版本。 + +Lübbe 说:“得到更新并不意味着你需要部署。如果没有看到安全漏洞,你可以把补丁放在一边,需要时它再用就行。” + +最后,Lübbe 建议每个月查看发布公告,并且每周检查 CVE 和主线列表上的安全公告。你只需要问自己“该安全公告是否影响到了你”。他补充说:“如果你的内核足够新,就没有太多的工作。你不会希望通过在新闻中看到你的设备才获得有关你的产品的反馈。” + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/event/ELCE/2017/long-term-embedded-linux-maintenance-made-easier + +作者:[ERIC BROWN][a] +译者:[geekpi](https://github.com/geekpi) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/ericstephenbrown +[1]:https://www.linux.com/licenses/category/linux-foundation +[2]:https://www.linux.com/files/images/jan-lubbe-elcpng +[3]:http://events.linuxfoundation.org/events/archive/2016/embedded-linux-conference-europe +[4]:http://www.pengutronix.de/index_en.html +[5]:http://arstechnica.com/security/2016/05/chinese-arm-vendor-left-developer-backdoor-in-kernel-for-android-pi-devices/ +[6]:https://www.linux.com/news/event/ELCE/2017hardening-kernel-protect-against-attackers diff --git a/translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md b/translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md deleted file mode 100644 index fc5f73c0d0..0000000000 --- a/translated/tech/20170119 Long-term Embedded Linux Maintenance Made Easier.md +++ /dev/null @@ -1,55 +0,0 @@ -长期维护嵌入式 Linux 内核变得容易 -============================================================ - - ![Jan Lübbe ](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jan-lubbe-elc.png?itok=6G5lADKu "Jan Lübbe ") -*Pengutronix 内核黑客 Jan Lübbe 总结了嵌入式 Linux 中正在增长的安全威胁,并在这次欧洲嵌入式 Linux 会议上概述了一个计划,以保持长期设备的安全和完整功能。* - [Linux 基金会][1] - - -安全漏洞只发生在 Windows 上的好日子在快速消退。恶意软件黑客和拒绝服务专家越来越多地针对过时的嵌入式 Linux 设备,因此在 10 月[欧洲嵌入式 Linux 会议Embedded Linux Conference Europe][3](ELCE)上的几个演讲的主题就与修复 Linux 安全漏洞相关。 - -最好的参加者之一是“长期维护、管理嵌入式系统 10 年以上”的 [Pengutronix][4] 内核黑客 Jan Lübbe。在总结嵌入式 Linux 中不断增长的安全威胁后,Lübbe 制定了一项计划,以确保长期设备的安全和完整的功能。 Lübbe 说:“我们需要迁移到更新、更稳定的内核,并进行持续维护以修复关键漏洞。我们需要做上游和自动化流程,并建立一个可持续的工作流程。我们没有任何借口,让系统中仍留有过时的软件。” - -随着 Linux 设备变得越来越老,传统的生命周期程序已经不再适用。 Lübbe 说:“通常,你会从 SoC 供应商或主线上获取内核、构建系统,并添加到用户空间。你自定义并添加了一个程序,在做了一些检测后就完成了。但是,在此之后有 15 年的维护阶段,你最好希望平台没有变化,或者想添加新的功能,或者需要实施管理调整。” - -所有这些变化,越来越多地导致系统暴露出新错误,并需要大量更新以与上游软件保持同步。 Lübbe 说:“在内核中发生导致问题的错误并不总是无意的”。对于去年在 Allwinner 内核中发现的[后门][5],他又补充说:“这些供应商内核从来不会执行主线社区的审查流程”。 - -Lübbe 继续说:“你不能相信你的供应商会做正确的事情。也许只有一两个工程师看了这个后门代码。如果补丁发布在 Linux 内核邮件列表上,这将永远不会发生。因为总会有人注意到。硬件供应商不关心安全或维护。也许你会在一两年后得到更新,但是即使这样,他们从一个固定版本开始开发到他们声明稳定的点通常需要几年的时间。如果你在这个基础上开始开发,你可能又增加了半年,这就更过时了。” - -越来越多的嵌入式开发人员在长期稳定Long Term Stable(LTS)内核上构建长期产品。但这并不意味着你的工作已经完成。Lübbe 说:“一个产品发布后,人们经常不再遵循稳定的发行链,也不再应用安全补丁。这样你会得到两个世界中最糟糕的:一个过时的内核以及没有安全性。你不会得到许多人测试的好处。” - -Lübbe 指出,使用像 Red Hat 这样的面向服务器的发行版的 Pengutronix 客户经常遇到问题,因为不断快速的定制、部署和升级系统,就像有系统管理员在当班。 - -“更新对一些东西有用,特别是如果它们是 x86,但每个项目基本上是自己建立基础设施更新到新版本。” - -许多开发人员选择向后移植作为更新长期产品的解决方案。Lübbe 说:“开始时很容易,但是一旦你不在项目的维护窗口,他们不会告诉你你使用的版本是否受到一个 bug 的影响,因此很难判断一个修复是否相关。于是你不停打补丁和更新,bug 也在累积,而这些你必须自己维护,因为其他人不使用这些补丁。使用开源软件的好处就丢失了。” - -### 跟随上游项目 - -Lübbe 认为,最好的解决方案是跟踪由上游项目维护的版本。“我们主要关注基于主线的开发,所以我们在产品和主流内核及其他上游项目之间尽可能没有差别。长期系统在主线上得到很好的支持。大多数不使用 3D 图形的系统可以运行很少的补丁。较新的内核版本还有很多[新的强化功能][6],这些可以减少漏洞的影响。 - -跟随主线对许多开发人员来说似乎是令人畏惧的,但是如果从一开始就这样,然后坚持下去,就会相对容易一些,Lübbe 说:“你需要为系统上做的一切制定流程。你总需要知道什么软件正在运行,这在使用良好的构建系统时会更容易。每个软件版本应定义完整的系统,以便你可以更新相关的一切。如果你不知道那里有什么,你就不能解决它。你还会想要更新的自动测试和自动部署。” - -为了“节省更新周期”,Lübbe 建议在开始开发时使用最新的 Linux 内核,并且在进入测试时才转到稳定的内核。之后,他建议每年将系统中的所有软件(包括内核、构建系统、用户空间、glibc 和组件(如 OpenSSL))更新为当年上游项目支持的版本。 - -Lübbe 说:“在这个时间点更新并不意味着你需要部署。如果没有看到安全漏洞,你可以把补丁放在一边,需要时它就准备好了。” - -最后,Lübbe 建议每个月查看发布公告,并且每周检查 CVE 和主线列表上的安全公告。你只需要问自己“安全公告是否影响到了你”。他补充说:“如果你的内核足够新,就没有太多的工作。你不会希望通过在新闻中看到你的设备来获得有关你的产品的反馈。” - --------------------------------------------------------------------------------- - -via: https://www.linux.com/news/event/ELCE/2017/long-term-embedded-linux-maintenance-made-easier - -作者:[ERIC BROWN][a] -译者:[geekpi](https://github.com/geekpi) -校对:[jasminepeng](https://github.com/jasminepeng) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/ericstephenbrown -[1]:https://www.linux.com/licenses/category/linux-foundation -[2]:https://www.linux.com/files/images/jan-lubbe-elcpng -[3]:http://events.linuxfoundation.org/events/archive/2016/embedded-linux-conference-europe -[4]:http://www.pengutronix.de/index_en.html -[5]:http://arstechnica.com/security/2016/05/chinese-arm-vendor-left-developer-backdoor-in-kernel-for-android-pi-devices/ -[6]:https://www.linux.com/news/event/ELCE/2017hardening-kernel-protect-against-attackers From 32a721e9279e72e9710eb57276607d5b29eb63d2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 2 Mar 2017 09:15:48 +0800 Subject: [PATCH 002/190] translating --- ...Generate random data for your applications with Elizabeth.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170215 Generate random data for your applications with Elizabeth.md b/sources/tech/20170215 Generate random data for your applications with Elizabeth.md index 1aa74112ae..2e518297be 100644 --- a/sources/tech/20170215 Generate random data for your applications with Elizabeth.md +++ b/sources/tech/20170215 Generate random data for your applications with Elizabeth.md @@ -1,3 +1,5 @@ +translating---geekpi + Generate random data for your applications with Elizabeth ============================================================ From cd4b33b08094c49f4e9e982b686ea6280fed249b Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 2 Mar 2017 09:57:17 +0800 Subject: [PATCH 003/190] PRF&PUB:Part 8 - LXD 2.0--LXD in LXD.md @geekpi --- .../LXD/Part 8 - LXD 2.0--LXD in LXD.md | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) rename {translated/tech => published}/LXD/Part 8 - LXD 2.0--LXD in LXD.md (64%) diff --git a/translated/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md b/published/LXD/Part 8 - LXD 2.0--LXD in LXD.md similarity index 64% rename from translated/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md rename to published/LXD/Part 8 - LXD 2.0--LXD in LXD.md index 82a25368a8..9c3c7a44f1 100644 --- a/translated/tech/LXD/Part 8 - LXD 2.0--LXD in LXD.md +++ b/published/LXD/Part 8 - LXD 2.0--LXD in LXD.md @@ -1,4 +1,4 @@ -LXD 2.0 系列(八):LXD中的LXD +LXD 2.0 系列(八):LXD 中的 LXD ====================================== 这是 [LXD 2.0 系列介绍文章][0]的第八篇。 @@ -7,35 +7,35 @@ LXD 2.0 系列(八):LXD中的LXD ### 介绍 -在上一篇文章中,我介绍了如何运行[LXD中的Docker][1],这是一个很好的方式来访问由Docker提供的应用程序组合,同时Docker还运行在LXD提供的安全环境中。 +在上一篇文章中,我介绍了如何[在 LXD 中运行 Docker][1],这是一个访问由 Docker 提供的应用程序组合的很好方式,同时 Docker 还运行在 LXD 提供的安全环境中。 -我提到的一个情况是为你的用户提供一个LXD容器,然后让他们使用他们的容器来运行Docker。那么,如果他们自己想使用LXD在其容器中运行其他Linux发行版,或者甚至运行容器允许另一组人来访问Linux系统? +我提到的一个情况是为你的用户提供一个 LXD 容器,然后让他们使用他们的容器来运行 Docker。那么,如果他们自己想要在其容器中使用 LXD 运行其他 Linux 发行版,或者甚至允许另一组人来访问运行在他们的容器中的 Linux 系统呢? -原来LXD使得用户运行嵌套容器变得非常简单。 +原来 LXD 使得用户运行嵌套容器变得非常简单。 -### 嵌套LXD +### 嵌套 LXD -最简单的情况可以使用Ubuntu 16.04镜像来展示。 Ubuntu 16.04云镜像预装了LXD。守护进程本身没有运行,因为它是套接字激活的,所以它不使用任何资源,直到你真正使用它。 +最简单的情况可以使用 Ubuntu 16.04 镜像来展示。 Ubuntu 16.04 云镜像预装了 LXD。守护进程本身没有运行,因为它是由套接字激活的,所以它不使用任何资源,直到你真正使用它。 -让我们启动一个启用了嵌套的Ubuntu 16.04容器: +让我们启动一个启用了嵌套的 Ubuntu 16.04 容器: ``` lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true ``` -你也可以在一个存在的容器上设置security.nesting: +你也可以在一个已有的容器上设置 `security.nesting`: ``` lxc config set security.nesting true ``` -或者对所有的容器使用一个配置文件: +或者对所有的容器使用一个指定的配置文件: ``` lxc profile set security.nesting true ``` -容器启动后,你可以从容器内部得到一个shell,配置LXD并生成一个容器: +容器启动后,你可以从容器内部得到一个 shell,配置 LXD 并生成一个容器: ``` stgraber@dakara:~$ lxc launch ubuntu-daily:16.04 c1 -c security.nesting=true @@ -79,20 +79,19 @@ root@c1:~# lxc list root@c1:~# ``` -就是这样简单 +就是这样简单。 ### 在线演示服务器 -因为这篇文章很短,我想我会花一点时间谈论我们运行中的[演示服务器][2]。我们今天早些时候刚刚达到了10000个会话! +因为这篇文章很短,我想我会花一点时间谈论我们运行中的[演示服务器][2]。我们今天早些时候刚刚达到了 10000 个会话! -这个服务器基本上只是一个运行在一个相当强大的虚拟机上的正常的LXD,一个小型的守护进程实现我们的网站使用的REST API。 +这个服务器基本上只是一个运行在一个相当强大的虚拟机上的正常的 LXD,一个小型的守护进程实现了我们的网站所使用的 REST API。 -当你接受服务条款时,将为你创建一个新的LXD容器,并启用security.nesting,如上所述,接着你就像使用“lxc exec”时一样连接到了那个容器,除了我们使用websockets和javascript来做这些。 +当你接受服务条款时,将为你创建一个新的 LXD 容器,并启用 `security.nesting`,如上所述。接着你就像使用 `lxc exec` 时一样连接到了那个容器,除了我们使用 websockets 和 javascript 来做这些。 -你在此环境中创建的容器都是嵌套的LXD容器。 -如果你想,你可以进一步地嵌套。 +你在此环境中创建的容器都是嵌套的 LXD 容器。如果你想,你可以进一步地嵌套。 -我们全范围地使用了[LXD资源限制][3],以防止一个用户的行为影响其他用户,并仔细监控服务器的任何滥用迹象。 +我们全范围地使用了 [LXD 资源限制][3],以防止一个用户的行为影响其他用户,并仔细监控服务器的任何滥用迹象。 如果你想运行自己的类似的服务器,你可以获取我们的网站和守护进程的代码: @@ -118,12 +117,12 @@ via: https://www.stgraber.org/2016/04/14/lxd-2-0-lxd-in-lxd-812/ 作者:[Stéphane Graber][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 组织翻译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.stgraber.org/author/stgraber/ [0]: https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ -[1]: https://www.stgraber.org/2016/04/13/lxd-2-0-docker-in-lxd-712/ +[1]: https://linux.cn/article-8235-1.html [2]: https://linuxcontainers.org/lxd/try-it/ [3]: https://www.stgraber.org/2016/03/26/lxd-2-0-resource-control-412/ From 43f6dc9388c893b5c59a0a5d5849cd54a6d8ddfa Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 2 Mar 2017 10:05:13 +0800 Subject: [PATCH 004/190] translated --- ...ta for your applications with Elizabeth.md | 96 ------------------- ...ta for your applications with Elizabeth.md | 94 ++++++++++++++++++ 2 files changed, 94 insertions(+), 96 deletions(-) delete mode 100644 sources/tech/20170215 Generate random data for your applications with Elizabeth.md create mode 100644 translated/tech/20170215 Generate random data for your applications with Elizabeth.md diff --git a/sources/tech/20170215 Generate random data for your applications with Elizabeth.md b/sources/tech/20170215 Generate random data for your applications with Elizabeth.md deleted file mode 100644 index 2e518297be..0000000000 --- a/sources/tech/20170215 Generate random data for your applications with Elizabeth.md +++ /dev/null @@ -1,96 +0,0 @@ -translating---geekpi - -Generate random data for your applications with Elizabeth -============================================================ - - - ![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") -Image by : Opensource.com - - _Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. _ - -No, I've not had my article hijacked by a [Lorem ipsum][2] generator. For this month's Nooks & Crannies column, I found an interesting little Python library to help developers generate random data for their applications. It's called [Elizabeth][3]. - -Written by Líkið Geimfari, and licensed under the MIT license, Elizabeth has a set of 18 data providers in 21 different locales that you can use to generate random information, including names and personal characteristics, addresses, text data, transportation information, networking and Internet social media data, numbers, and much more. Installation requires [Python 3.2][4] or higher, and you can either install it using **pip**, or from the **git** repository. - -For my test drive, I installed with pip, on a fresh [Debian][5] Jessie box. You'll need to **apt-get install python3-pip**, which will install Python and needed dependencies. Then **pip install elizabeth**, and you're ready to use it. - -Just for giggles, let's generate some random data on a person in the Python interactive interpreter: - -``` ->>> from elizabeth import Personal ->>> p=Personal('en') ->>> p.full_name(gender="male") -'Elvis Herring' ->>> p.blood_type() -'B+' ->>> p.credit_card_expiration_date() -'09/17' ->>> p.email(gender='male') -'jessie7517@gmail.com' ->>> p.favorite_music_genre() -'Ambient' ->>> p.identifier(mask='13064########') -'1306420450944' ->>> p.sexual_orientation() -'Heterosexual' ->>> p.work_experience() -39 ->>> p.occupation() -'Senior System Designer' ->>> -``` - -Using it in your code works just the same way—create an object, and then call the methods you want to fill in your data. - -There are 18 different generator tools built into Elizabeth, and adding a new one is not at all difficult; you just have to define the routines that get the data from a JSON collection of values. Here's some random text string generation, again in the interpreter: - -``` ->>> from elizabeth import Text ->>> t=Text('en') ->>> t.swear_word() -'Rat-fink' ->>> t.quote() -'Let them eat cake.' ->>> t.words(quantity=20) -['securities', 'keeps', 'accessibility', 'barbara', 'represent', 'hentai', 'flower', 'keys', 'rpm', 'queen', 'kingdom', 'posted', 'wearing', 'attend', 'stack', 'interface', 'quite', 'elementary', 'broadcast', 'holland'] ->>> t.sentence() -'She spent her earliest years reading classic literature, and writing poetry.' -``` - -It's not a difficult exercise to use Elizabeth to populate a [SQLite][6] or other database you might need for development or testing. The introductory documentation gives an example for a medical application using the [Flask][7] lightweight web framework. - -I'm very impressed with Elizabeth—it's super-fast, lightweight, easily extensible, and the community, while small, is active and engaged. As of this writing, there have been 25 committers to the project, and issues are being handled swiftly. The [full documentation][8] for Elizabeth is easy to read and follow, and provides an extensive API reference, at least for US English. - -I tried tinkering with the links to find if documentation was available in other languages, but I didn't have any success. Because the APIs are different in non-English locales, documenting those variations would be extremely helpful for users. To be fair, it's not terribly hard to read the code and find out what methods are available, even if your Python-fu is not strong. Another glaring lack, for me, was the lack of Arabic or Hebrew locale test data. These are notable right-to-left languages, and for developers who are trying to internationalize their application, proper handling of these languages is a major hurdle. Tools like Elizabeth that can assist with that effort are great to have. - -For developers needing sample data for their applications, Elizabeth is a valuable tool, and for those trying to create truly multilingual, localizable applications, it could be a treasure. - --------------------------------------------------------------------------------- - -作者简介: - -D Ruth Bavousett - D Ruth Bavousett has been a system administrator and software developer for a long, long time, getting her professional start on a VAX 11/780, way back when. She spent a lot of her career (so far) serving the technology needs of libraries, and has been a contributor since 2008 to the Koha open source library automation suite.Ruth is currently a Perl Developer at cPanel in Houston, and also serves as chief of staff for two cats. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/2/elizabeth-python-library - -作者:[D Ruth Bavousett][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/druthb -[1]:https://opensource.com/article/17/2/elizabeth-python-library?rate=kuXZVuHCdEv_hrxRnK1YQctlsTJeFJLcVx3Nf2VIW38 -[2]:https://en.wikipedia.org/wiki/Lorem_ipsum -[3]:https://github.com/lk-geimfari/elizabeth -[4]:https://www.python.org/ -[5]:https://www.debian.org/ -[6]:https://sqlite.org/ -[7]:https://flask.pocoo.org/ -[8]:http://elizabeth.readthedocs.io/en/latest/index.html -[9]:https://opensource.com/user/36051/feed -[10]:https://opensource.com/article/17/2/elizabeth-python-library#comments -[11]:https://opensource.com/users/druthb diff --git a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md b/translated/tech/20170215 Generate random data for your applications with Elizabeth.md new file mode 100644 index 0000000000..efaa8eb2cf --- /dev/null +++ b/translated/tech/20170215 Generate random data for your applications with Elizabeth.md @@ -0,0 +1,94 @@ +使用 Elizabeth 为你的应用生成随机数据 +============================================================ + + + ![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") +图片提供 : Opensource.com + + _Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. _ + +不,我的文章没有被 [Lorem ipsum][2] 生成器劫持。对于本月的 Nooks&Crannies 专栏,我发现了一个有趣的小 Python 库,以帮助开发人员为其应用程序生成随机数据。它被称为 [Elizabeth][3]。 + +它由 Líkið Geimfari 编写,并在 MIT 许可证下发行,Elizabeth 在 21 个不同地区设有一组 18 个数据提供器,它们可用于生成随机信息,包括姓名和个人特征、地址、文本数据、交通信息、网络和 Internet 社交媒体数据、数字等等。需要安装 [Python 3.2][4] 或更高版本,您可以使用 **pip** 或从 **git** 仓库安装它。 + +在我的测试机上,我在一个全新安装的 [Debian][5] Jessie 上使用 pip 来安装它。你要做的是 **apt-get install python3-pip**,它将安装 Python 和所需的依赖项。然后 **pip install elizabeth**,之后就安装好了。 + +只是为好玩,让我们在 Python 的交互式解释器中为一个人生成一些随机数据: + +``` +>>> from elizabeth import Personal +>>> p=Personal('en') +>>> p.full_name(gender="male") +'Elvis Herring' +>>> p.blood_type() +'B+' +>>> p.credit_card_expiration_date() +'09/17' +>>> p.email(gender='male') +'jessie7517@gmail.com' +>>> p.favorite_music_genre() +'Ambient' +>>> p.identifier(mask='13064########') +'1306420450944' +>>> p.sexual_orientation() +'Heterosexual' +>>> p.work_experience() +39 +>>> p.occupation() +'Senior System Designer' +>>> +``` + +在代码中使用它就像创建一个对象那样,然后调用要填充数据的方法。 + +Elizabeth 有 18 种不同的生成工具,添加新的生成器并不困难; 你只需要定义从 JSON 值集合中获取数据的例程。这里是一些随机文本字符串生成,再次打开解释器: + +``` +>>> from elizabeth import Text +>>> t=Text('en') +>>> t.swear_word() +'Rat-fink' +>>> t.quote() +'Let them eat cake.' +>>> t.words(quantity=20) +['securities', 'keeps', 'accessibility', 'barbara', 'represent', 'hentai', 'flower', 'keys', 'rpm', 'queen', 'kingdom', 'posted', 'wearing', 'attend', 'stack', 'interface', 'quite', 'elementary', 'broadcast', 'holland'] +>>> t.sentence() +'She spent her earliest years reading classic literature, and writing poetry.' +``` + +使用 Elizabeth 填充 [SQLite][6] 或其他可能需要开发或测试的数据库不是一个困难的练习。介绍文档给出了使用 [Flask][7] 这个轻量级 web 框架的医疗应用程序的示例。 + +我对 Elizabeth 印象很深刻 - 它超快、轻量级、易于扩展,它的社区虽然小,但是积极参与。截至本文写作时,已有 25 名贡献者提交,并且问题正在被迅速处理。Elizabeth 的[完整文档][8]至少对于美国英语而言易于阅读和遵循,并提供了广泛的 API 参考。 + +我曾尝试修改链接来找到文档是否有其他语言,但我没有成功。因为 API 在非英语区域中是不同的,所以记录这些变化将对用户非常有帮助。公平地说,阅读代码并找出可用的方法并不难,即使 Python-fu 不够强大。对我来说,另一个明显的缺陷是缺乏阿拉伯语或希伯来语区域测试数据。这些是著名的从右到左的语言,并且对于试图使其应用程序国际化的开发者,适当地处理这些语言是一个主要的障碍。像 Elizabeth 这种工具,可以协助这种努力是伟大的。 + +对于那些在应用中需要随机样本数据的开发员而言 Elizabeth 是一个有价值的工具,对于那些试图创建真正多语言、本地化的应用程序,它可能是一个宝藏。 + +-------------------------------------------------------------------------------- + +作者简介: + +D Ruth Bavousett - D Ruth Bavousett 成为一名系统管理员和软件开发人员很长时间了,她最初专注在 VAX 11/780。她花了很多她的职业生涯(迄今为止)为图书馆的技术需求服务,自 2008 年以来一直是 Koha 开源库自动化套件的贡献者。Ruth 目前是休斯顿 cPanel 的 Perl开发人员,并养了两只猫。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/2/elizabeth-python-library + +作者:[D Ruth Bavousett][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/druthb +[1]:https://opensource.com/article/17/2/elizabeth-python-library?rate=kuXZVuHCdEv_hrxRnK1YQctlsTJeFJLcVx3Nf2VIW38 +[2]:https://en.wikipedia.org/wiki/Lorem_ipsum +[3]:https://github.com/lk-geimfari/elizabeth +[4]:https://www.python.org/ +[5]:https://www.debian.org/ +[6]:https://sqlite.org/ +[7]:https://flask.pocoo.org/ +[8]:http://elizabeth.readthedocs.io/en/latest/index.html +[9]:https://opensource.com/user/36051/feed +[10]:https://opensource.com/article/17/2/elizabeth-python-library#comments +[11]:https://opensource.com/users/druthb From 9e7c1aa022bba4f82bef8703977bca091a7e4331 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 2 Mar 2017 11:04:56 +0800 Subject: [PATCH 005/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- ... to Auto Execute CommandsScripts During Reboot or Startup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md b/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md index 4d40b429eb..5d4d90e0c5 100644 --- a/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md +++ b/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md @@ -84,7 +84,7 @@ via: http://www.tecmint.com/auto-execute-linux-scripts-during-reboot-or-startup/ 作者:[Ravi Saive ][a] 译者:[zhb127](https://github.com/zhb127) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 997ee223db374d3c68ed7939e67c6c93af79b0dd Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 2 Mar 2017 10:37:01 +0800 Subject: [PATCH 006/190] =?UTF-8?q?PRF&PUB:20161207=20Manage=20Samba4=20AD?= =?UTF-8?q?=20Domain=20Controller=20DNS=20and=20Group=20Policy=20from=20Wi?= =?UTF-8?q?ndows=20=E2=80=93=20Part=204.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @rusking --- ... and Group Policy from Windows – Part 4.md | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) rename {translated/tech => published}/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md (64%) diff --git a/translated/tech/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md b/published/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md similarity index 64% rename from translated/tech/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md rename to published/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md index 9013125450..635e32f0f3 100644 --- a/translated/tech/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md +++ b/published/20161207 Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4.md @@ -1,58 +1,59 @@ -Manage Samba4 AD Domain Controller DNS and Group Policy from Windows – Part 4 +Samba 系列(四):在 Windows 下管理 Samba4 AD 域管制器 DNS 和组策略 ============================================================ -在 Windows 系统下管理 Samba4 AD 域管制器 DNS 和组策略(四) -接着前一篇教程写的关于[使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构][4],在这篇文章中我们将学习如何使用微软 DNS 管理器远程管理我们的 Samba AD 域控制器的 DNS 服务器,如何创建 DNS 记录,如何创建反向查找区域以及如何通过组策略管理工具来创建域策略。 +接着前一篇教程写的关于[使用 Windows 10 的 RSAT 工具来管理 Samba4 活动目录架构][4],在这篇文章中我们将学习如何使用微软 DNS 管理器远程管理我们的 Samba AD 域控制器的 DNS 服务器,如何创建 DNS 记录,如何创建反向查找区域以及如何通过组策略管理工具来创建域策略。 -#### 需求 +#### 要求 -1、 [在 Ubuntu16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1] -2、 [在 Linux 命令行下管理 Samba4 AD 架构(二)][2] -3、 [使用 Windows 10 系统的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3] +1、 [在 Ubuntu 16.04 系统上使用 Samba4 软件来创建活动目录架构(一)][1] + +2、 [在 Linux 命令行下管理 Samba4 AD 架构(二)][2] + +3、 [使用 Windows 10 的 RSAT 工具来管理 Samba4 活动目录架构 (三)][3] ### 第 1 步:管理 Samba DNS 服务器 -Samba4 AD DC 使用内部的 DNS 解析模块,该模块在初始化域提供的过程中被创建完成(如果 BIND9 DLZ 模块未特定使用的情况下)。 +Samba4 AD DC 使用内部的 DNS 解析器模块,该模块在初始化域提供的过程中创建(如果 BIND9 DLZ 模块未指定使用的情况下)。 -Samba4 内部的 DNS 域模块支持 AD 域控制器所必须的基本功能。有两种方式来管理域 DNS 服务器,直接在命令行下通过 samba-tool 接口来管理,或者使用已加入域的微软工作站中的 RSAT DNS 管理器远程进行管理。 +Samba4 内部的 DNS 模块支持 AD 域控制器所必须的基本功能。有两种方式来管理域 DNS 服务器,直接在命令行下通过 samba-tool 接口来管理,或者使用已加入域的微软工作站中的 RSAT DNS 管理器远程进行管理。 在这篇文章中,我们使用第二种方式来进行管理,因为这种方式很直观,也不容易出错。 1、要使用 RSAT 工具来管理域控制器上的 DNS 服务器,在 Windows 机器上,打开控制面板 -> 系统和安全 -> 管理工具,然后运行 DNS 管理器工具。 -当打开这个工具时,它会询问你将要连接到哪台正在运行的 DNS 服务器。选择使用下面的计算机,输入域名(IP 地址或 FQDN 地址都可以使用),勾选‘现在连接到指定计算机’,然后单击 OK 按钮以开启 Samba DNS 服务。 +当打开这个工具时,它会询问你将要连接到哪台正在运行的 DNS 服务器。选择“使用下面的计算机”,输入域名(IP 地址或 FQDN 地址都可以使用),勾选“现在连接到指定计算机”,然后单击 OK 按钮以开启 Samba DNS 服务。 [ ![Connect Samba4 DNS on Windows](http://www.tecmint.com/wp-content/uploads/2016/12/Connect-Samba4-DNS-on-Windows.png) ][5] -在 Windows 系统上连接 Samba4 DNS 服务器 +*在 Windows 系统上连接 Samba4 DNS 服务器* -2、为了添加一条 DNS 记录(比如我们添加一条指向 LAN 网关的记录 ‘A'),打开 DNS 管理器,找到域正向查找区,在右侧单击右键选择新的主机(’A‘ 或 ’AAA‘)。 +2、为了添加一条 DNS 记录(比如我们添加一条指向 LAN 网关的 A 记录),打开 DNS 管理器,找到域正向查找区,在右侧单击右键选择新的主机(A 或 AAAA)。 [ ![Add DNS A Record on Windows](http://www.tecmint.com/wp-content/uploads/2016/12/Add-DNS-A-Record.png) ][6] -在 Windows 下添加一条 DNS 记录 +*在 Windows 下添加一条 DNS 记录* -3、在打开的新主机窗口界面,输入 DNS 服务器的主机名和 IP 地址。 DNS 管理器工具会自动填写完成 FQDN 地址。填写完成后,点击添加主机按钮,之后会弹出一个新的窗口提示你 DNS A 记录已经创建完成。 +3、在打开的新主机窗口界面,输入 DNS 服务器的主机名和 IP 地址。 DNS 管理器工具会自动填写完成 FQDN 地址。填写完成后,点击“添加主机”按钮,之后会弹出一个新的窗口提示你 DNS A 记录已经创建完成。 -确保你添加的 DNS A 记录是你们网络中的资源[已配置静态 IP][7]。不要为那些从 DHCP 服务器自动获取 IP 地址或者经常变换 IP 地址的主机添加 DNS A 记录。 +确保仅为你的网络中[已配置静态 IP][7]的资源(设备)添加 DNS A 记录。不要为那些从 DHCP 服务器自动获取 IP 地址或者经常变换 IP 地址的主机添加 DNS A 记录。 [ ![Configure Samba Host on Windows](http://www.tecmint.com/wp-content/uploads/2016/12/Configure-Samba-Host-on-Windows.png) ][8] -在 Windows 系统下配置 Samba 主机 +*在 Windows 系统下配置 Samba 主机* -要更新一条 DNS 记录只需要双击那条记录,然后输入更改原因即可。要删除一条记录时,只需要在这条记录上单击右键,选择从菜单删除即可。 +要更新一条 DNS 记录只需要双击那条记录,然后输入更改即可。要删除一条记录时,只需要在这条记录上单击右键,选择从菜单删除即可。 -同样的方式,你也可以为你的域添加其它类型的 DNS 记录,比如说 CNAME 记录(也称为 DNS 别名记录),MX 记录(在邮件服务器上非常有用)或者其它类型的记录(SPE、TXT、SRVetc类型)。 +同样的方式,你也可以为你的域添加其它类型的 DNS 记录,比如说 CNAME 记录(也称为 DNS 别名记录),MX 记录(在邮件服务器上非常有用)或者其它类型的记录(SPE、TXT、SRV 等类型)。 ### 第 2 步:创建反向查找区域 -默认情况下, Samba4 AD DC 不会自动为你的域添加一个反向查找区域和 PTR 记录,因为这些类型的记录对于域控制器的正常工作来说是无关紧要的。 +默认情况下,Samba4 AD DC 不会自动为你的域添加一个反向查找区域和 PTR 记录,因为这些类型的记录对于域控制器的正常工作来说是无关紧要的。 相反,DNS 反向区和 PTR 记录在一些重要的网络服务中显得非常有用,比如邮件服务,因为这些类型的记录可以用于验证客户端请求服务的身份。 @@ -64,56 +65,56 @@ Samba4 内部的 DNS 域模块支持 AD 域控制器所必须的基本功能。 ![Create Reverse Lookup DNS Zone](http://www.tecmint.com/wp-content/uploads/2016/12/Create-Reverse-Lookup-DNS-Zone.png) ][9] -创建 DNS 反向查找区域 +*创建 DNS 反向查找区域* -5、下一步,单击下一步按钮,然后从区域类型向导中选择主区域。 +5、下一步,单击下一步按钮,然后从区域类型向导中选择主区域(Primary)。 [ ![Select DNS Zone Type](http://www.tecmint.com/wp-content/uploads/2016/12/Select-DNS-Zone-Type.png) ][10] -选择 DNS 区域类型 +*选择 DNS 区域类型* -6、下一步,在 AD 区域复制范围中选择复制到该域里运行在域控制器上的所有的 DNS 服务器,选择 IPv4 反向查找区域然后单击下一步继续。 +6、下一步,在 “AD 区域复制范围”中选择复制到该域里运行在域控制器上的所有的 DNS 服务器,选择 “IPv4 反向查找区域”然后单击下一步继续。 [ ![Select DNS for Samba Domain Controller](http://www.tecmint.com/wp-content/uploads/2016/12/Select-DNS-for-Samba-Domain-Controller.png) ][11] -为 Samba 域控制器选择 DNS 服务器 +*为 Samba 域控制器选择 DNS 服务器* [ ![Add Reverse Lookup Zone Name](http://www.tecmint.com/wp-content/uploads/2016/12/Add-Reverse-Lookup-Zone-Name.png) ][12] -添加反向查找区域名 +*添加反向查找区域名* 7、下一步,在网络ID 框中输入你的 LAN IP 地址,然后单击下一步继续。 -资源在这个区域内添加的所有 PTR 记录仅指向 192.168.1.0/24 网络段。如果你想要为一个不在该网段中的服务器创建一个 PTR 记录(比如邮件服务器位于 10.0.0.0/24 这个网段的时候),那么你还得为那个网段创建一个新的反向查找区域。 +在这个区域内添加的所有资源(设备)的 PTR 记录仅能指向 192.168.1.0/24 网络段。如果你想要为一个不在该网段中的服务器创建一个 PTR 记录(比如邮件服务器位于 10.0.0.0/24 这个网段的时候),那么你还得为那个网段创建一个新的反向查找区域。 [ ![Add IP Address of Reverse Lookup DNS Zone](http://www.tecmint.com/wp-content/uploads/2016/12/Add-IP-Address-of-Reverse-DNS-Zone.png) ][13] -添加 DNS 反向查找区域的 IP 地址 +*添加 DNS 反向查找区域的 IP 地址* -8、在下一个截图中选择仅允许安全的动态更新,单击下一步继续,最后单击完成按钮以完成反向查找区域的创建。 +8、在下一个截图中选择“仅允许安全的动态更新”,单击下一步继续,最后单击完成按钮以完成反向查找区域的创建。 [ ![Enable Secure Dynamic Updates](http://www.tecmint.com/wp-content/uploads/2016/12/Enable-Secure-Dynamic-Updates.png) ][14] -启用安全动态更新 +*启用安全动态更新* [ ![New DNS Zone Summary](http://www.tecmint.com/wp-content/uploads/2016/12/New-DNS-Zone-Summary.png) ][15] -新 DNS 区域概述 +*新 DNS 区域概览* 9、此时,你已经为你的域环境创建完成了一个有效的 DNS 反向查找区域。为了在这个区域中添加一个 PTR 记录,在右侧右键单击,选择为网络资源创建一个 PTR 记录。 -这个时候,我们已经为网关创建了一个指向。为了测试这条记录对于客户端是否添加正确和工作正常,打开命令行提示符执行 nslookup 查询资源名,再执行另外一条命令查询 IP 地址。 +这个时候,我们已经为网关创建了一个指向。为了测试这条记录对于客户端是否添加正确和工作正常,打开命令行提示符执行 `nslookup` 查询资源名,再执行另外一条命令查询 IP 地址。 两个查询都应该为你的 DNS 资源返回正确的结果。 @@ -121,19 +122,21 @@ Samba4 内部的 DNS 域模块支持 AD 域控制器所必须的基本功能。 nslookup gate.tecmint.lan nslookup 192.168.1.1 ping gate -``` +``` + [ ![Add DNS PTR Record and Query PTR](http://www.tecmint.com/wp-content/uploads/2016/12/Add-DNS-PTR-Record-and-Query.png) ][16] -添加及查询 PTR 记录 +*添加及查询 PTR 记录* + ### 第 3 步:管理域控制策略 10、域控制器最重要的作用就是集中控制系统资源及安全。使用域控制器的域组策略功能很容易实现这些类型的任务。 遗憾的是,在 Samba 域控制器上唯一用来编辑或管理组策略的方法是通过微软的 RSAT GPM 工具。 -在下面的实例中,我们将看到通过组策略来实现在 Samba 域环境中为域用户创建一种交互式的登录方式是多么的简单。 +在下面的实例中,我们将看到通过组策略来实现在 Samba 域环境中为域用户创建一种交互式的登录提示是多么的简单。 要访问组策略控制台,打开控制面板 -> 系统和安全 -> 管理工具,然后打开组策略管理控制台。 @@ -143,9 +146,9 @@ ping gate ![Manage Samba Domain Group Policy](http://www.tecmint.com/wp-content/uploads/2016/12/Manage-Samba-Domain-Group-Policy.png) ][17] -管理 Samba 域组策略 +*管理 Samba 域组策略* -11、在组策略管理编辑器窗口中,进入到电脑配置 -> 组策略 -> Windows 设置 -> 安全设置 -> 本地策略 -> 安全选项,你将在右侧看到一个新的选项列表。 +11、在组策略管理编辑器窗口中,进入到计算机配置 -> 组策略 -> Windows 设置 -> 安全设置 -> 本地策略 -> 安全选项,你将在右侧看到一个新的选项列表。 在右侧查询并编辑你的定制化设置,参考下图中的两条设置内容。 @@ -153,7 +156,7 @@ ping gate ![Configure Samba Domain Group Policy](http://www.tecmint.com/wp-content/uploads/2016/12/Configure-Samba-Domain-Group-Policy.png) ][18] -配置 Samba 域组策略 +*配置 Samba 域组策略* 12、这两个条目编辑完成后,关闭所有窗口,打开 CMD 窗口,执行以下命令来强制应用组策略。 @@ -164,14 +167,15 @@ gpupdate /force ![Update Samba Domain Group Policy](http://www.tecmint.com/wp-content/uploads/2016/12/Update-Samba-Domain-Group-Policy.png) ][19] -更新 Samba 域组策略 +*更新 Samba 域组策略* + +13、最后,重启你的电脑,当你准备登录进入系统的时候,你就会看到登录提示生效了。 -13、最后,重启你的电脑,当你准备登录进入系统的时候,你就会看到登录提示生效了。 [ ![Samba4 AD Domain Controller Logon Banner](http://www.tecmint.com/wp-content/uploads/2016/12/Samba4-Domain-Controller-User-Login.png) ][20] -Samba4 AD 域控制器登录提示 +*Samba4 AD 域控制器登录提示* 就写到这里吧!组策略是一个操作起来很繁琐和很谨慎的主题,在管理系统的过程中你得非常的小心。还有,注意你设置的组策略不会以任何方式应用到已加入域的 Linux 系统中。 @@ -184,17 +188,17 @@ Samba4 AD 域控制器登录提示 via: http://www.tecmint.com/manage-samba4-dns-group-policy-from-windows/ -作者:[Matei Cezar ][a] +作者:[Matei Cezar][a] 译者:[rusking](https://github.com/rusking) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/cezarmatei/ -[1]:http://www.tecmint.com/install-samba4-active-directory-ubuntu/ -[2]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/ -[3]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/ -[4]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/ +[1]:https://linux.cn/article-8065-1.html +[2]:https://linux.cn/article-8070-1.html +[3]:https://linux.cn/article-8097-1.html +[4]:https://linux.cn/article-8097-1.html [5]:http://www.tecmint.com/wp-content/uploads/2016/12/Connect-Samba4-DNS-on-Windows.png [6]:http://www.tecmint.com/wp-content/uploads/2016/12/Add-DNS-A-Record.png [7]:http://www.tecmint.com/set-add-static-ip-address-in-linux/ From 33c87d64a39f09dba319a43416913e18168c838c Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 2 Mar 2017 11:32:50 +0800 Subject: [PATCH 007/190] PRF:20170118 Do I need to provide access to source code under the AGPLv3 license.md @geekpi @bestony --- ...ess to source code under the AGPLv3 license.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md b/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md index 6e5ee19164..ae25c2986e 100644 --- a/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md +++ b/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md @@ -1,18 +1,17 @@ 我需要在 AGPLv3 许可证下提供源码么? ============================================================ + ![Do I need to provide access to source code under the AGPLv3 license?](https://opensource.com/sites/default/files/styles/image-full-size/public/images/law/LAW_PatentSpotlight_520x292_cm.png.png?itok=bCn-kMx2 "Do I need to provide access to source code under the AGPLv3 license?") -图片提供: +图片提供:opensource.com -opensource.com +[GNU Affero 通用公共许可证版本 3][1](AGPLv3)是与 GPLv3 几乎相同的左版(copyleft)许可证。两个许可证具有相同的公共版权范围,但在一个重要方面有重大差异。 AGPLv3 的第 13 节规定了 GPLv2 或 GPLv3 中不存在的附加条件: -[GNU Affero 通用公共许可证版本 3][1](AGPLv3)是与 GPLv3 几乎相同的公共版权许可证。两个许可证具有相同的公共版权范围,但在一个重要方面有重大差异。 AGPLv3 的第 13 节规定了 GPLv2 或 GPLv3 中不存在的附加条件: +> 在本许可证的其它条款之外,如果你修改了程序,你必须把你修改的版本,给你的那些使用计算机网络远程(如果你的版本支持此类交互)与之交互的用户,明确提供一个通过一些标准或者常规的复制手段,从网络服务器上免费获得与你所修改的版本相匹配的源码的机会。 ->你必须给你那些使用计算机网络远程(如果你的版本支持此类交互)与它交互的用户提供一个通过网络服务器利用一些标准或者常规复制手段免费获得相关你的版本的源码的机会。 +这个“通过计算机网络远程交互”的范围主要被认为是 SaaS 部署的情形,尽管其实际上读起来的意思超乎了惯例的 SaaS 部署情形。其目标是解决在用户在使用像 Web Services 这样的功能时,其代码没有公开的常规 GPL 协议所暴露出的漏洞。因此,该协议的第 13 节,在 GPLv2 第 3 节以及 GPLv3 和 AGPLv3 第 6 节中包含的目标代码分发的触发要求之外,提供了额外的源代码公开的要求。 -尽管“通过计算机网络远程交互”的范围应该被理解为涵盖超越常规 SaaS 的情况,但是这个条件主要适用于目前被认为是 SaaS 的部署。目标是在用户使用 web 服务提供功能但是不提供功能代码的分发的环境中关闭普通 GPL 中的感知漏洞。因此,第 13 节提供了超出 GPLv2 第 3 节以及 GPLv3 和 AGPLv3 第 6 节中包含的目标代码分发触发要求的额外源码公开要求。 - -常常被误解的是,AGPLv3 第 13 节中的源代码要求仅在 AGPLv3 软件已被“你”(例如,提供网络服务的实体)修改的地方触发。我的解释是,只要“你”不修改 AGPLv3 的代码,许可证不应该被理解为需要按照第 13 节规定的方式访问相应的源码。如我所见,尽管即使公开许可证不必要的源代码也是一个好主意,但在 AGPL 下许多未修改以及标准部署的软件模块根本不会触发第 13 节。 +常常被误解的是,AGPLv3 第 13 节中的源代码分发要求仅在 AGPLv3 软件已被“你”(例如,提供网络服务的实体)修改的地方才触发。我的理解是,只要“你”不修改 AGPLv3 的代码,许可证就不应该被理解为需要按照第 13 节规定的方式访问相应的源码。如我所见,尽管即使公开许可证中不要求公开的源代码也是一个好主意,但在 AGPL 下许多未修改以及标准部署的软件模块根本不会触发第 13 节。 如何解释 AGPL 的条款和条件,包括 AGPL 软件是否已被修改,可能需要根据具体情况的事实和细节进行法律层面的分析。 @@ -22,7 +21,7 @@ opensource.com ![](https://opensource.com/sites/default/files/styles/profile_pictures/public/pictures/kaufman-picture.jpg?itok=FPIizDR-) -Jeffrey R. Kaufman 是全球领先的开源软件解决方案提供商 Red Hat 公司的开源 IP 律师。Jeffrey 也是托马斯·杰斐逊法学院的兼职教授。在入职 Red Hat 之前,Jeffrey 曾经担任高通公司的专利顾问,向首席科学家办公室提供开源顾问。Jeffrey在 RFID、条形码、图像处理和打印技术方面拥有多项专利。 +Jeffrey R. Kaufman 是全球领先的开源软件解决方案提供商 Red Hat 公司的开源 IP 律师。Jeffrey 也是托马斯·杰斐逊法学院的兼职教授。在入职 Red Hat 之前,Jeffrey 曾经担任高通公司的专利顾问,向首席科学家办公室提供开源顾问。Jeffrey 在 RFID、条形码、图像处理和打印技术方面拥有多项专利。 -------------------------------------------------------------------------------- From cb54a98831dd6c0eb3770fdbf754a9ba0cd0cf73 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 2 Mar 2017 11:33:14 +0800 Subject: [PATCH 008/190] PUB:20170118 Do I need to provide access to source code under the AGPLv3 license.md @geekpi @bestony --- ...d to provide access to source code under the AGPLv3 license.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20170118 Do I need to provide access to source code under the AGPLv3 license.md (100%) diff --git a/translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md b/published/20170118 Do I need to provide access to source code under the AGPLv3 license.md similarity index 100% rename from translated/talk/20170118 Do I need to provide access to source code under the AGPLv3 license.md rename to published/20170118 Do I need to provide access to source code under the AGPLv3 license.md From eef344b78c5ea16ad89f2a26603eda1ff8b553f6 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 2 Mar 2017 11:33:50 +0800 Subject: [PATCH 009/190] PRF:20160917 A Web Crawler With asyncio Coroutines.md part --- ...7 A Web Crawler With asyncio Coroutines.md | 67 +++++++++++-------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md index 1bce0fd22a..8e9abf198f 100644 --- a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md +++ b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md @@ -1,24 +1,29 @@ -一个使用asyncio协程的网络爬虫 +一个使用 asyncio 协程的网络爬虫 === + +本文作者: + +A. Jesse Jiryu Davis 是纽约 MongoDB 的工程师。他编写了异步 MongoDB Python 驱动程序 Motor,也是 MongoDB C 驱动程序的开发领袖和 PyMongo 团队成员。 他也为 asyncio 和 Tornado 做了贡献,在 http://emptysqua.re 上写作。 + +Guido van Rossum 是主流编程语言 Python 的创造者,Python 社区称他为 BDFL (仁慈的终生大独裁者 (Benevolent Dictator For Life))——这是一个来自 Monty Python 短剧的称号。他的主页是 http://www.python.org/~guido/ 。 +### 介绍 -## 介绍 +经典的计算机科学强调高效的算法,尽可能快地完成计算。但是很多网络程序的时间并不是消耗在计算上,而是在等待许多慢速的连接或者低频事件的发生。这些程序暴露出一个新的挑战:如何高效的等待大量网络事件。一个现代的解决方案是异步 I/O。 -经典的计算机科学强调高效的算法,尽可能快地完成计算。但是很多网络程序的时间并不是消耗在计算上,而是在等待许多慢速的连接或者低频事件的发生。这些程序暴露出一个新的挑战:如何高效的等待大量网络事件。一个现代的解决方案是异步I/O。 +这一章我们将实现一个简单的网络爬虫。这个爬虫只是一个原型式的异步应用,因为它等待许多响应而只做少量的计算。一次爬的网页越多,它就能越快的完成任务。如果它为每个动态的请求启动一个线程的话,随着并发请求数量的增加,它会在耗尽套接字之前,耗尽内存或者线程相关的资源。使用异步 I/O 可以避免这个的问题。 -这一章我们将实现一个简单的网络爬虫。这个爬虫只是一个原型式的异步应用,因为它等待许多响应而只做少量的计算。一次爬的网页越多,它就能越快的完成任务。如果它为每个动态的请求启动一个线程的话,随着并发请求数量的增加,它会在耗尽套接字之前,耗尽内存或者线程相关的资源。使用异步I/O可以避免这个的问题。 +我们将分三个阶段展示这个例子。首先,我们会实现一个事件循环并用这个事件循环和回调来勾画出一只网络爬虫。它很有效,但是当把它扩展成更复杂的问题时,就会导致无法管理的混乱代码。然后,由于 Python 的协程不仅有效而且可扩展,我们将用 Python 的生成器函数实现一个简单的协程。在最后一个阶段,我们将使用 Python 标准库“asyncio”中功能完整的协程, 并通过异步队列完成这个网络爬虫。(在 [PyCon 2013](http://pyvideo.org/video/1667/keynote) 上,Guido 介绍了标准的 asyncio 库,当时称之为“Tulip”。) -我们将分三个阶段展示这个例子。首先,我们会实现一个事件循环并用这个事件循环和回调来勾画出一个网络爬虫。它很有效,但是当把它扩展成更复杂的问题时,就会导致无法管理的混乱代码。然后,由于Python的协程不仅有效而且可扩展,我们将用Python的生成器函数实现一个简单的协程。在最后一个阶段,我们将使用Python标准库"asyncio"中功能完整的协程和异步队列完成这个网络爬虫。 +### 任务 -## 任务 - -网络爬虫寻找并下载一个网站上的所有网页,也许还会把它们存档,为它们建立索引。从根URL开始,它获取每个网页,解析出没有遇到过的链接加到队列中。当网页没有未见到过的链接并且队列为空时,它便停止运行。 +网络爬虫寻找并下载一个网站上的所有网页,也许还会把它们存档,为它们建立索引。从根 URL 开始,它获取每个网页,解析出没有遇到过的链接加到队列中。当网页没有未见到过的链接并且队列为空时,它便停止运行。 我们可以通过同时下载大量的网页来加快这一过程。当爬虫发现新的链接,它使用一个新的套接字并行的处理这个新链接,解析响应,添加新链接到队列。当并发很大时,可能会导致性能下降,所以我们会限制并发的数量,在队列保留那些未处理的链接,直到一些正在执行的任务完成。 -## 传统方式 +### 传统方式 -怎么使一个爬虫并发?传统的做法是创建一个线程池,每个线程使用一个套接字在一段时间内负责一个网页的下载。比如,下载xkcd.com网站的一个网页: +怎么使一个爬虫并发?传统的做法是创建一个线程池,每个线程使用一个套接字在一段时间内负责一个网页的下载。比如,下载 xkcd.com 网站的一个网页: ```python def fetch(url): @@ -37,19 +42,19 @@ def fetch(url): q.add(links) ``` -套接字操作默认是阻塞的:当一个线程调用一个类似`connect`和`recv`方法时,它会阻塞,直到操作完成.[^15]因此,为了同一时间内下载多个网页,我们需要很多线程。一个复杂的应用会通过线程池保持空闲的线程来分摊创建线程的开销。同样的做法也适用于套接字,使用连接池。 +套接字操作默认是阻塞的:当一个线程调用一个类似 `connect` 和 `recv` 方法时,它会阻塞,直到操作完成。(即使是 `send` 也能被阻塞,比如接收端在接受外发消息时缓慢而系统的外发数据缓存已经满了的情况下)因此,为了同一时间内下载多个网页,我们需要很多线程。一个复杂的应用会通过线程池保持空闲的线程来分摊创建线程的开销。同样的做法也适用于套接字,使用连接池。 -到目前为止,线程是昂贵的,操作系统对一个进程,一个用户,一台机器能使用线程做了不同的硬性限制。在Jesse系统中,一个Python线程需要50K的内存,开启上万个线程会失败。每个线程的开销和系统的限制就是这种方式的瓶颈所在。 +到目前为止,使用线程的是成本昂贵的,操作系统对一个进程、一个用户、一台机器能使用线程做了不同的硬性限制。在 作者 Jesse 的系统中,一个 Python 线程需要 50K 的内存,开启上万个线程就会失败。每个线程的开销和系统的限制就是这种方式的瓶颈所在。 -在Dan Kegel那一篇很有影响力的文章"The C10K problem"[^8]中,它提出多线程方式在I/O并发上的局限性。他在开始写道, +在 Dan Kegel 那一篇很有影响力的文章“[The C10K problem](http://www.kegel.com/c10k.html)”中,它提出了多线程方式在 I/O 并发上的局限性。他在开始写道, ->是时候网络服务器要同时处理成千上万的客户啦,你不这样认为么?毕竟,现在网络是个很大的地方。 +> 网络服务器到了要同时处理成千上万的客户的时代了,你不这样认为么?毕竟,现在网络规模很大了。 -Kegel在1999年创造出"C10K"术语。一万个连接在今天看来还是可接受的,但是问题依然存在,只不过大小不同。回到那时候,对于C10K问题,每个连接启一个线程是不切实际的。现在这个限制已经成指数级增长。确实,我们的玩具网络爬虫使用线程也可以工作的很好。但是,对于有着千万级连接的大规模应用来说,限制依然存在:会消耗掉所有线程,即使套接字还够用。那么我们该如何解决这个问题? +Kegel 在 1999 年创造出“C10K”这个术语。一万个连接在今天看来还是可接受的,但是问题依然存在,只不过大小不同。回到那时候,对于 C10K 问题,每个连接启一个线程是不切实际的。现在这个限制已经成指数级增长。确实,我们的玩具网络爬虫使用线程也可以工作的很好。但是,对于有着千万级连接的大规模应用来说,限制依然存在:它会消耗掉所有线程,即使套接字还够用。那么我们该如何解决这个问题? -## 异步 +### 异步 -异步I/O框架在一个线程中完成并发操作。让我们看看这是怎么做到的。 +异步 I/O 框架在一个线程中完成并发操作。让我们看看这是怎么做到的。 异步框架使用*非阻塞*套接字。异步爬虫中,我们在发起到服务器的连接前把套接字设为非阻塞: @@ -62,9 +67,9 @@ except BlockingIOError: pass ``` -对一个非阻塞套接字调用`connect`方法会立即抛出异常,即使它正常工作。这个异常模拟了底层C语言函数的行为,它把`errno`设置为`EINPROGRESS`,告诉你操作已经开始。 +对一个非阻塞套接字调用 `connect` 方法会立即抛出异常,即使它可以正常工作。这个异常复现了底层 C 语言函数令人厌烦的行为,它把 `errno` 设置为 `EINPROGRESS`,告诉你操作已经开始。 -现在我们的爬虫需要一种知道连接何时建立的方法,这样它才能发送HTTP请求。我们可以简单地使用循环来重试: +现在我们的爬虫需要一种知道连接何时建立的方法,这样它才能发送 HTTP 请求。我们可以简单地使用循环来重试: ```python request = 'GET {} HTTP/1.0\r\nHost: xkcd.com\r\n\r\n'.format(url) @@ -80,9 +85,9 @@ while True: print('sent') ``` -这种方法不仅消耗CPU,也不能有效的等待*多个*套接字。在远古时代,BSD Unix的解决方法是`select`,一个C函数,它在一个或一组非阻塞套接字上等待事件发生。现在,互联网应用大量连接的需求,导致`select`被`poll`代替,以及BSD的`kqueue`和Linux的`epoll`。它们的API和`select`相似,但在大数量的连接中也能有较好的性能。 +这种方法不仅消耗 CPU,也不能有效的等待*多个*套接字。在远古时代,BSD Unix 的解决方法是 `select`,这是一个 C 函数,它在一个或一组非阻塞套接字上等待事件发生。现在,互联网应用大量连接的需求,导致 `select` 被 `poll` 所代替,在 BSD 上的实现是 `kqueue` ,在 Linux 上是 `epoll`。它们的 API 和 `select` 相似,但在大数量的连接中也能有较好的性能。 -Python 3.4的`DefaultSelector`使用你系统上最好的类`select`函数。去注册一个网络I/O事件,我们创建一个非阻塞套接字,并使用默认的selector注册。 +Python 3.4 的 `DefaultSelector` 会使用你系统上最好的 `select` 类函数。要注册一个网络 I/O 事件的提醒,我们会创建一个非阻塞套接字,并使用默认 selector 注册它。 ```python from selectors import DefaultSelector, EVENT_WRITE @@ -103,9 +108,9 @@ def connected(): selector.register(sock.fileno(), EVENT_WRITE, connected) ``` -我们不理会这个伪造的错误,调用`selector.register`,传递套接字文件描述符,一个表示我们想要监听什么事件的常量。为了当连接建立时收到提醒,我们使用`EVENT_WRITE`:它表示什么时候这个套接字可写。我们还传递了一个Python函数,`connected`,当对应事件发生时被调用。这样的函数被称为*回调*。 +我们不理会这个伪造的错误,调用 `selector.register`,传递套接字文件描述符和一个表示我们想要监听什么事件的常量表达式。为了当连接建立时收到提醒,我们使用 `EVENT_WRITE` :它表示什么时候这个套接字可写。我们还传递了一个 Python 函数 `connected`,当对应事件发生时被调用。这样的函数被称为*回调*。 -我们在一个循环中处理I/O提醒,随着selector接收到它们。 +在一个循环中,selector 接收到 I/O 提醒时我们处理它们。 ```python def loop(): @@ -116,13 +121,17 @@ def loop(): callback() ``` -`connected`回调函数被保存在`event_key.data`中,一旦这个非阻塞套接字建立连接,它就会被取出来执行。 +`connected` 回调函数被保存在 `event_key.data` 中,一旦这个非阻塞套接字建立连接,它就会被取出来执行。 -不像我们前面那个快速重试的循环,这里的`select`调用会阻塞,等待下一个I/O事件,接着执行等待这个事件的回调函数。 +不像我们前面那个快速轮转的循环,这里的 `select` 调用会暂停,等待下一个 I/O 事件,接着执行等待这些事件的回调函数。没有完成的操作会保持挂起,直到进到下一个事件循环时执行。 -到目前为止我们展现了什么?我们展示了如何开始一个I/O操作和当操作准备好时调用回调函数。异步*框架*,它在单线程中执行并发操作,建立在两个功能之上,非阻塞套接字和事件循环。 +到目前为止我们展现了什么?我们展示了如何开始一个 I/O 操作和当操作准备好时调用回调函数。异步*框架*,它在单线程中执行并发操作,其建立在两个功能之上,非阻塞套接字和事件循环。 + +我们这里达成了“并发性(concurrency)”,但不是传统意义上的“并行性(parallelism)”。也就是说,我们构建了一个可以进行重叠 I/O 的微小系统,它可以在其它操作还在进行的时候就开始一个新的操作。它实际上并没有利用多核来并行执行计算。这个系统是用于解决 I/O 限定(I/O-bound)问题的,而不是解决 CPU 限定(CPU-bound)问题的。(Python 的全局解释器锁禁止在一个进程中以任何方式并行执行 Python 代码。在 Python 中并行化 CPU 限定的算法需要多个进程,或者以将该代码移植为 C 语言并行版本。但是这是另外一个话题了。) + +所以,我们的事件循环在并发 I/O 上是有效的,因为它并不用为每个连接拨付线程资源。但是在我们开始前,我们需要澄清一个常见的误解:异步比多线程快。通常并不是这样的,事实上,在 Python 中,在处理少量非常活跃的连接时,像我们这样的事件循环是慢于多线程的。在运行时环境中是没有全局解释器锁的,在同样的负载下线程会执行的更好。异步 I/O 真正适用于事件很少、有许多缓慢或睡眠的连接的应用程序。(Jesse 在“[什么是异步,它如何工作,什么时候该用它?](http://pyvideo.org/video/2565/what-is-async-how-does-it-work-and-when-should)”一文中指出了异步所适用和不适用的场景。Mike Bayer 在“[异步 Python 和数据库](http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/)”一文中比较了不同负载情况下异步 I/O 和多线程的不同。) -## 回调 +### 回调 用我们刚刚建立的异步框架,怎么才能完成一个网络爬虫?即使是一个简单的网页下载程序也是很难写的。 @@ -1081,8 +1090,8 @@ class Task(Future): -------------------------------------- via: http://aosabook.org/en/500L/pages/a-web-crawler-with-asyncio-coroutines.html -作者: A. Jesse Jiryu Davis and Guido van Rossum +作者:A. Jesse Jiryu Davis , Guido van Rossum 译者:[qingyunha](https://github.com/qingyunha) -校对: +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 From a4d9bd5395484774fec79aacb35f71175190fab1 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 2 Mar 2017 14:25:37 +0800 Subject: [PATCH 010/190] =?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 校对完毕 @zhb127 谢谢 --- ...ommandsScripts During Reboot or Startup.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md b/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md index 5d4d90e0c5..6e303bd4e9 100644 --- a/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md +++ b/translated/tech/20170213 How to Auto Execute CommandsScripts During Reboot or Startup.md @@ -1,15 +1,13 @@ 如何在 Linux 启动时自动执行命令或脚本 ============================================================ -下载免费电子书 - [给管理员的 10 本 Linux 免费电子书] | [4 本 Shell 脚本免费电子书] +我一直很好奇,在[启动 Linux 系统并登录][1]的过程中到底发生了什么事情。按下开机键或启动一个虚拟机,你就启动了一系列事件,之后会进入到一个功能完备的系统中,有时,这个过程不到一分钟。当你注销或者关机时,也是这样。 -我一直很好奇,在[启动 Linux 系统并登录][1]的过程中到底发生了什么事情。按下开机键或运行一台虚拟机,经过一系列事件之后,进入到一个完整的系统中,有的时候,都不用一分钟就进入系统了。当你注销或者关机时,也是这样。 +更有意思的是,在系统启动以及用户登录或注销时,还可以让系统执行特定的操作。 -更有意思的是,在登录或注销时,你还可以让系统执行特定的操作。 +本文,我们将探讨一下在 Linux 操作系统中实现这些目标的传统方法。 -本文,我们将探讨一下在 Linux 操作系统中实现这些目标(在登录或注销时,让系统执行特定的操作)的传统方法。 - -注意:我们假定使用的是 Bash 作为登录及注销的主 Shell。如果你使用的是其他 Shell,那么有些方法可能会无效。如果有其他的疑问,请参考对应的 Shell 文档。 +**注意**:我们假定使用的是 **Bash** 作为登录及注销的主 Shell。如果你使用的是其他 Shell,那么有些方法可能会无效。如果有其他的疑问,请参考对应的 Shell 文档。 ### 在启动时执行 Linux 脚本 @@ -21,8 +19,8 @@ 然而,这种方法需要注意两点: -1. a) cron 守护进程必须处于运行状态(通常情况下都会运行),同时 -2. b) 脚本或 crontab 文件必须包含必要的环境变量(参考 StackOverflow 获取更多详细内容)。 +* a) cron 守护进程必须处于运行状态(通常情况下都会运行),同时 +* b) 脚本或 crontab 文件必须包含需要的环境变量(如果有的话,参考 StackOverflow 获取更多详细内容)。 #### 方法 #2 - 使用 /etc/rc.d/rc.local @@ -32,9 +30,9 @@ # chmod +x /etc/rc.d/rc.local ``` -然后在这个文件底部添加指定的脚本代码。 +然后在这个文件底部添加脚本。 -下图分别说明如何使用 cron 任务和 rc.local 文件运行两个示例脚本(`/home/gacanepa/script1.sh`、`/home/gacanepa/script2.sh`)。 +下图说明如何分别使用 **cron** 任务和 **rc.local** 运行两个示例脚本(`/home/gacanepa/script1.sh` 和 `/home/gacanepa/script2.sh`)。 script1.sh: ``` @@ -54,7 +52,7 @@ echo "$SITE rocks... add us to your bookmarks." > $DIR/file2.txt ![启动时执行 Linux 脚本](http://www.tecmint.com/wp-content/uploads/2017/02/Run-Linux-Commands-at-Startup.png) ][3] -启动时执行 Linux 脚本 +*启动时执行 Linux 脚本 * 记住,一定要提前给两个示例脚本授予执行权限: @@ -65,7 +63,7 @@ $ chmod +x /home/gacanepa/script2.sh ### 在登录或注销时执行 Linux 脚本 -要在登录或注销时执行脚本,分别需要使用 `~.bash_profile` 和 `~.bash_logout` 文件。多数情况下,需要手动创建后一个文件。在每个文件的底部,添加调用脚本代码,就可以实现这个功能。 +要在登录或注销时执行脚本,分别需要使用 `~.bash_profile` 和 `~.bash_logout` 文件。多数情况下,后者需要手动创建。在每个文件的底部,添加调用脚本代码,如前面例中所示,就可以实现这个功能。 ##### 总结 @@ -75,20 +73,20 @@ $ chmod +x /home/gacanepa/script2.sh 作者简介: -我叫 Ravi Saive,我是 TecMint 的作者。一名喜欢在互联网上分享 Linux 相关技巧的电脑极客和 Linux 大师。我的服务器大多数都是使用 Linux 系统。关注我:Twitter, Facebook, Google+ +Gabriel Cánepa 是 GNU/Linux 系统管理员, 阿根廷圣路易斯 Villa Mercedes 的 web 开发人员。他为一家国际大型消费品公司工作,在日常工作中使用 FOSS 工具以提高生产力,并从中获得极大乐趣。 -------------------------------------------------------------------------------- via: http://www.tecmint.com/auto-execute-linux-scripts-during-reboot-or-startup/ -作者:[Ravi Saive ][a] +作者:[Gabriel Cánepa][a] 译者:[zhb127](https://github.com/zhb127) 校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]:http://www.tecmint.com/author/admin/ +[a]:http://www.tecmint.com/author/gacanepa/ [00]:https://twitter.com/ravisaive [01]:https://www.facebook.com/ravi.saive [02]:https://plus.google.com/u/0/+RaviSaive From cbc698ba7f7ca897431b2de265f347e245ad130f Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 2 Mar 2017 14:40:03 +0800 Subject: [PATCH 011/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- .../tech/20170120 How to write web apps in R with Shiny.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170120 How to write web apps in R with Shiny.md b/translated/tech/20170120 How to write web apps in R with Shiny.md index e89a885718..cb3f0ec868 100644 --- a/translated/tech/20170120 How to write web apps in R with Shiny.md +++ b/translated/tech/20170120 How to write web apps in R with Shiny.md @@ -56,7 +56,7 @@ via: https://opensource.com/article/17/1/writing-new-web-apps-shiny 作者:[D Ruth Bavousett][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 689c873aec952c6149f84adce65b358732ebfbbf Mon Sep 17 00:00:00 2001 From: XLCYun Date: Thu, 2 Mar 2017 15:26:53 +0800 Subject: [PATCH 012/190] Update 20161202 Reactive programming vs. Reactive systems.md translating by XLCYun --- .../talk/20161202 Reactive programming vs. Reactive systems.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20161202 Reactive programming vs. Reactive systems.md b/sources/talk/20161202 Reactive programming vs. Reactive systems.md index 58b3387349..19bf7ccb1e 100644 --- a/sources/talk/20161202 Reactive programming vs. Reactive systems.md +++ b/sources/talk/20161202 Reactive programming vs. Reactive systems.md @@ -1,3 +1,5 @@ +translating by XLCYun + Reactive programming vs. Reactive systems ============================================================ From d90ce361eebe2306af78889ea9fcc39d69ddc96a Mon Sep 17 00:00:00 2001 From: Yoo-4x Date: Thu, 2 Mar 2017 16:46:08 +0800 Subject: [PATCH 013/190] Update 20170214 CentOS Vs. Ubuntu.md --- sources/tech/20170214 CentOS Vs. Ubuntu.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20170214 CentOS Vs. Ubuntu.md b/sources/tech/20170214 CentOS Vs. Ubuntu.md index d6730b9766..4b06c9b851 100644 --- a/sources/tech/20170214 CentOS Vs. Ubuntu.md +++ b/sources/tech/20170214 CentOS Vs. Ubuntu.md @@ -1,3 +1,4 @@ +Yoo-4x translating # [CentOS Vs. Ubuntu][5] [ From 91bb1078198521b252063d89b30567108e1b1850 Mon Sep 17 00:00:00 2001 From: Yoo-4x Date: Thu, 2 Mar 2017 17:36:22 +0800 Subject: [PATCH 014/190] Has Translated --- ...ence portfolio - Storytelling with data.md | 368 +++++++++--------- 1 file changed, 186 insertions(+), 182 deletions(-) rename {sources => translated}/tech/20160602 Building a data science portfolio - Storytelling with data.md (83%) diff --git a/sources/tech/20160602 Building a data science portfolio - Storytelling with data.md b/translated/tech/20160602 Building a data science portfolio - Storytelling with data.md similarity index 83% rename from sources/tech/20160602 Building a data science portfolio - Storytelling with data.md rename to translated/tech/20160602 Building a data science portfolio - Storytelling with data.md index 625b08efdc..281c2dee20 100644 --- a/sources/tech/20160602 Building a data science portfolio - Storytelling with data.md +++ b/translated/tech/20160602 Building a data science portfolio - Storytelling with data.md @@ -1,105 +1,107 @@ -Translated by Yoo-4x -Building a data science portfolio: Storytelling with data +建立一项数据科学组合:讲一个关于数据的故事 ======== ->This is the first in a series of posts on how to build a Data Science Portfolio. If you like this and want to know when the next post in the series is released, you can [subscribe at the bottom of the page][35]. +>这是如何建立科学组合系列文章中的第一篇。如果你喜欢这篇文章并且想知道此系列的下一篇文章何时发表,你可以[在页面底部订阅][35]。 -Data science companies are increasingly looking at portfolios when making hiring decisions. One of the reasons for this is that a portfolio is the best way to judge someone’s real-world skills. The good news for you is that a portfolio is entirely within your control. If you put some work in, you can make a great portfolio that companies are impressed by. +数据科学公司们在采用一个想法时越来越看重组合结果。其中一个原因就是运用组合是分析一个人真实技能的最好方式。对你来说好消息解释组合是完全可以被你掌控的。如果你针对一些事情做了一些工作,你就能的奥一个令那些公司印象深刻的组合结果。 -The first step in making a high-quality portfolio is to know what skills to demonstrate. The primary skills that companies want in data scientists, and thus the primary skills they want a portfolio to demonstrate, are: +建立一个高质量组合的第一步就是知道展示什么技能。那些公司们主要希望数据科学工作者拥有的技能,或者说他们主要希望组合所展示的技能是: -* Ability to communicate -* Ability to collaborate with others -* Technical competence -* Ability to reason about data -* Motivation and ability to take initiative +* 表达能力 +* 合作能力 +* 专业技能 +* 解释数据的能力 +* 有目标和有积极性的 -Any good portfolio will be composed of multiple projects, each of which may demonstrate 1-2 of the above points. This is the first post in a series that will cover how to make a well-rounded data science portfolio. In this post, we’ll cover how to make your first project for a data science portfolio, and how to tell an effective story using data. At the end, you’ll have a project that will help demonstrate your ability to communicate, and your ability to reason about data. +任何一个好的组合都由多个工程构成,每一个工程都会展示1-2个上面所说的点。这是涵盖了“如何完成一个完整的科学组合”系列文章的第一篇。在这篇文章中,我们将会涵括如何完成你的第一项数据科学组合工程,并且对此进行有效的解释。在ui后,你将会得到一个帮助展示你表达能力和解释数据能力的工程。 -### Storytelling with data +### 讲述一个关于数据的故事 -Data science is fundamentally about communication. You’ll discover some insight in the data, then figure out an effective way to communicate that insight to others, then sell them on the course of action you propose. One of the most critical skills in data science is being able to tell an effective story using data. An effective story can make your insights much more compelling, and help others understand your ideas. +于数据科学表达是基础。你将会发现数据的内含,并且找出一个高效的方式来向他人表达,之后向他们展示你所开展的课题。数据科学最关键的手法之一就是能够讲述一个关于使用数据的清晰的故事。一个好的故事能够使你得到的结果更加引人注目,并且能是别人理解你的想法。 -A story in the data science context is a narrative around what you found, how you found it, and what it means. An example might be the discovery that your company’s revenue has dropped 20% in the last year. It’s not enough to just state that fact – you’ll have to communicate why revenue dropped, and how to potentially fix it. +数据科学中的故事是一个讲述关于你发现了什么,你怎么发现它的,并且它意味着什么的故事。例如假使发现你公司的收入相对去年减少了百分之二十。这并不能够确定原因或者表达为什么收入会减少并且在尝试修复它。 -The main components of storytelling with data are: +讲述关于数据的故事主要包含: -* Understanding and setting the context -* Exploring multiple angles -* Using compelling visualizations -* Using varied data sources -* Having a consistent narrative +* 理解并确定内容 +* 从多角度发觉 +* 使用有趣的表示方法 +* 使用多种数据来源 +* 有一致的叙述 -The best tool to effectively tell a story with data is [Jupyter notebook][34]. If you’re unfamiliar, [here’s][33] a good tutorial. Jupyter notebook allows you to interactively explore data, then share your results on various sites, including Github. Sharing your results is helpful both for collaboration, and so others can extend your analysis. +用来讲述关于数据的故事最有效率的工具就是[Jupyter notebook][34]。如果你不熟悉,[此处][33]有一个好的教程。 Jupyter notebook 允许你交互式的发掘数据,并且将你的结果分享到多个网站,包括Github,分享你的结果有助于合作研究和其他人拓展你的分析。 -We’ll use Jupyter notebook, along with Python libraries like Pandas and matplotlib in this post. +我们将使用Jupyter notebook,Python库和matplotlib在这篇文章中。 -### Choosing a topic for your data science project +### 为你的数据科学工程选择一个主题 -The first step in creating a project is to decide on your topic. You want the topic to be something you’re interested in, and are motivated to explore. It’s very obvious when people are making projects just to make them, and when people are making projects because they’re genuinely interested in exploring the data. It’s worth spending extra time on this step, so ensure that you find something you’re actually interested in. +建立一个工程的第一步就是觉得你的主题。你需要你的主题是你兴趣所在的,并且有动力去挖掘。当人们为了完成一个项目而完成和当人们完成项目是因为有兴趣去进行数据挖掘时的区别是很明显的。这个步骤是值得花费时间的,所以确保你找到了你真正感兴趣的东西。 -A good way to find a topic is to browse different datasets and seeing what looks interesting. Here are some good sites to start with: +一个寻找主题的好的方法就是浏览不同的数据组并且寻找感兴趣的部分。这里有一些作为起点的好的网站: -* [Data.gov][20] – contains government data. -* [/r/datasets][19] – a subreddit that has hundreds of interesting datasets. -* [Awesome datasets][18] – a list of datasets, hosted on Github. -* [rs.io][17] – a great blog post with hundreds of interesting datasets. +* [Data.gov][20] - 包含了政府据。 +* [/r/datasets][19] – 一个有着上百个有趣数据组的reddit(reddit是一个类似于贴吧、论坛的网站)。 +* [Awesome datasets][18] – 一个数据组的列表,位于Github上。 +* [rs.io][17] – 一个有着上百个有趣数据组的博客。 -In real-world data science, you often won’t find a nice single dataset that you can browse. You might have to aggregate disparate data sources, or do a good amount of data cleaning. If a topic is very interesting to you, it’s worth doing the same here, so you can show off your skills better. +真实世界中的数据科学,经常无法找到合适的单个数据组。你可能需要合并多个独立的数据源,或者做数量庞大的数据清理。如果主题非常吸引你,这是值得这样做的,并且也能更好的展示你的技能。 -For the purposes of this post, we’ll be using data about New York city public schools, which can be found [here][32]. +关于这篇文章的主题,我们将使用纽约市公立学校的数据,我们可以在[这里][32]找到它。 -### Pick a topic +### 选择主题 -It’s important to be able to take the project from start to finish. In order to do this, it can be helpful to restrict the scope of the project, and make it something we know we can finish. It’s easier to add to a finished project than to complete a project that you just can’t seem to ever get enough motivation to finish. +对于完成项目来说这是十分重要的。因为主题能很好的限制项目的范围,并且使它能够是我们知道它可以被完成。比起一个没有足够动力完成的工程来说添加到一个完成的工程更加容易。 -In this case, we’ll look at the [SAT scores][31] of high schoolers, along with various demographic and other information about them. The SAT, or Scholastic Aptitude Test, is a test that high schoolers take in the US before applying to college. Colleges take the test scores into account when making admissions decisions, so it’s fairly important to do well on. The test is divided into 3 sections, each of which is scored out of 800 points. The total score is out of 2400 (although this has changed back and forth a few times, the scores in this dataset are out of 2400). High schools are often ranked by their average SAT scores, and high SAT scores are considered a sign of how good a school district is. +所以,我们将关注高中的[学术评估测试][31],伴随着多种人口统计和它们的其它数据。关于SAT,或者说学习评估测试,是美国高中生进入大学前的测试。大学在做判定时将成绩录入账号,所以高分是十分重要的。考试分为三个阶段,每个阶段总分为800。全部分数为2400(即使这个前后更改了几次,在数据中总分还是2400)。高中经常通过平均STA分数进行排名,并且SAT是评判高中有多好的标准。 -There have been allegations about the SAT being unfair to certain racial groups in the US, so doing this analysis on New York City data will help shed some light on the fairness of the SAT. +因为由关于STA分数对于美国中某些种族群体是不公平的。,所以这个纽约市数据分析能够帮助对SAT的公平性有轻许帮助。 -We have a dataset of SAT scores [here][30], and a dataset that contains information on each high school [here][29]. These will form the base of our project, but we’ll need to add more information to create compelling analysis. +我们有SAT成绩的数据组[这里][30],并且数据组中包含了每所高中的信息[这里][29]。这些将总成我们的工程的基础,但是我们将将如更多的信息来创建有趣的分析。 -### Supplementing the data +### 补充数据 -Once you have a good topic, it’s good to scope out other datasets that can enhance the topic or give you more depth to explore. It’s good to do this upfront, so you have as much data as possible to explore as you’re building your project. Having too little data might mean that you give up on your project too early. +如果你已经有了一个很好的主题,拓展其它可以提升主题或者更深入挖掘数据的的数据组是被推荐的。十分适合在前期做这些工作,那么你将会有尽可能多的数据来构建你的工程。有着越少的数据意味着你太早的放弃了你的工程。 -In this case, there are several related datasets on the same website that cover demographic information and test scores. +在包含人口统计信息和测试成绩的网站上这里有一些相关的数据组。 -Here are the links to all of the datasets we’ll be using: +这些是我们将会用到的所有数据组: -* [SAT scores by school][16] – SAT scores for each high school in New York City. -* [School attendance][15] – attendance information on every school in NYC. -* [Math test results][14] – math test results for every school in NYC. -* [Class size][13] – class size information for each school in NYC. +* [SAT scores by school][16] – 纽约市每所高中的STA成绩。 +* [School attendance][15] – 纽约市每所学校的出勤信息。 +* [Math test results][14] – 纽约市每所学校的数学成绩。 +* [Class size][13] - 纽约市每所学校课堂人数信息。 * [AP test results][12] – Advanced Placement exam results for each high school. Passing AP exams can get you college credit in the US. -* [Graduation outcomes][11] – percentage of students who graduated, and other outcome information. -* [Demographics][10] – demographic information for each school. -* [School survey][9] – surveys of parents, teachers, and students at each school. -* [School district maps][8] – contains information on the layout of the school districts, so that we can map them out. +* [AP test results][12] - 高阶位考试,在美国,通过AP测试就能获得大学学分。 +译者注:高阶位考试(AP)是美国和加拿大的一个由大学委员会创建的计划,该计划为高中学生提供大学水平的课程和考试。 美国学院和大学可以授予在考试中获得高分的学生的就学和课程学分。 -All of these datasets are interrelated, and we’ll be able to combine them before we do any analysis. +* [Graduation outcomes][11] – 由百分之几的学生毕业了,和其它去向信息。 +* [Demographics][10] – 每个学校的人口统计信息。 +* [School survey][9] – 学校的家长、教师,学生的问卷。 +* [School district maps][8] – 包含学校的区域布局信息,因此我们能将它们在地图上标出。 -### Getting background information +这些数据组合之间是相互关联的,并且我们能够在开始分析之前进行合并。 -Before diving into analyzing the data, it’s useful to research some background information. In this case, we know a few facts that will be useful: +### 获取背景信息 -* New York City is divided into `5` boroughs, which are essentially distinct regions. -* Schools in New York City are divided into several school district, each of which can contains dozens of schools. -* Not all the schools in all of the datasets are high schools, so we’ll need to do some data cleaning. -* Each school in New York City has a unique code called a `DBN`, or District Borough Number. -* By aggregating data by district, we can use the district mapping data to plot district-by-district differences. +在开始分析数据之前,搜索一些背景信息是有必要的。我们知道这些有用的信息: -### Understanding the data +* 纽约市被分为五个不同的辖区 +* 纽约市的学校坐落在学校区域内,每个都学校区域都可能包含数十所学校。 +* 数据组中的并不全是高中,所以我们需要对数据进行一些清理工作。 +* 纽约市的每所学校都有自己单独的编码,被称为‘DBN’,或者区域行政编号。 +* 为了通过区域进行合并数据,我们可以使用地图区域信息来绘制逐区差异。 -In order to really understand the context of the data, you’ll want to spend time exploring and reading about the data. In this case, each link above has a description of the data, along with the relevant columns. It looks like we have data on the SAT scores of high schoolers, along with other datasets that contain demographic and other information. +### 理解数据 -We can run some code to read in the data. We’ll be using [Jupyter notebook][28] to explore the data. The below code will: +为了真正的理解数据信息,你将需要花费时间挖掘和阅读数据。因此,每一个数据链接的描述信息都沿着相关列。假如我们拥有高中SAT成绩信息,包含图像和其它信息的数据组。 -* Loop through each data file we downloaded. -* Read the file into a [Pandas DataFrame][7]. -* Put each DataFrame into a Python dictionary. +我们可以运行一些代码来读取数据。我们将使用[Jupyter notebook][28]来挖掘数据。下面的代码将会执行一下操作: + +* 循环通过我们下载的所有数据文件。 +* 将文件读取到[Pandas DataFrame][7]。 +* 将所有数据框架导入Python数据库中。 In [100]: ``` @@ -115,7 +117,7 @@ for f in files: ``` -Once we’ve read the data in, we can use the [head][27] method on DataFrames to print the first `5` lines of each DataFrame: +一旦我们将数据读入,我们就可以使用数据框架中的[头部][27]方法打印每个数据框架的前五行。 In [103]: ``` @@ -379,21 +381,23 @@ hs_directory ``` -We can start to see some useful patterns in the datasets: +我们可以开始在数据组合中观察有用的部分: * Most of the datasets contain a `DBN` column -* Some fields look interesting for mapping, particularly `Location 1`, which contains coordinates inside a larger string. -* Some of the datasets appear to contain multiple rows for each school (repeated DBN values), which means we’ll have to do some preprocessing. +* 大部分数据组包含DBN列。 +* 一些条目看起来在地图上标出会很有趣,特别是`Location 1`,这列对应的信息会多一些。 +* 有些数据组会出现每所学校对应多行数据(DBN数据重复),这意味着我们要进行预处理。 ### Unifying the data +### 统一数据 -In order to work with the data more easily, we’ll need to unify all the individual datasets into a single one. This will enable us to quickly compare columns across datasets. In order to do this, we’ll first need to find a common column to unify them on. Looking at the output above, it appears that `DBN` might be that common column, as it appears in multiple datasets. +为了使工作更简单,我们将需要将全部零散的数据组统一为一个。这将使我们能够快速跨数据组对比数据列。因此,我们需要找到相同的列将他们统一起来。请查看上面的输出数据,当DBN出现在多个数据组中时它很可能成为共同列。 -If we google `DBN New York City Schools`, we end up [here][26], which explains that the `DBN` is a unique code for each school. When exploring datasets, particularly government ones, it’s often necessary to do some detective work to figure out what each column means, or even what each dataset is. +如果我们用google搜索`DBN New York City Schools`, 我们[在此][26]得到了结果。它解释了DBN是每个学校独特的编码。我们将挖掘数据组,特别是政府数据组。这通常需要做一些工作来找出每列的含义,或者每个数据组是的意图。 -The problem now is that two of the datasets, `class_size`, and `hs_directory`, don’t have a `DBN` field. In the `hs_directory` data, it’s just named `dbn`, so we can just rename the column, or copy it over into a new column called `DBN`. In the `class_size` data, we’ll need to try a different approach. +现在这两个数据组的主要的问题是,`class_size`, 和 `hs_directory`数据组, 没有 `DBN` 列。在`hs_directory` 数据中是dbn,那么我们只需重命名即可,或者将它复制到新的名为DBN的列中。在`class_size`数据中,我们将需要尝试不同的方法。 -The `DBN` column looks like this: +DBN列: In [5]: ``` @@ -411,7 +415,7 @@ Out[5]: Name: DBN, dtype: object ``` -If we look at the `class_size` data, here’s what we’d see in the first `5` rows: +如果我们看向`class_size`数据,我们将看到前五行: In [4]: ``` @@ -429,9 +433,9 @@ Out[4]: | 3 | 1 | M | M015 | P.S. 015 Roberto Clemente | 01 | CTT | - | - | - | 17.0 | 1.0 | 17.0 | 17.0 | 17.0 | ATS | NaN | | 4 | 1 | M | M015 | P.S. 015 Roberto Clemente | 02 | GEN ED | - | - | - | 15.0 | 1.0 | 15.0 | 15.0 | 15.0 | ATS | NaN | -As you can see above, it looks like the `DBN` is actually a combination of `CSD`, `BOROUGH`, and `SCHOOL CODE`. For those unfamiliar with New York City, it is composed of `5` boroughs. Each borough is an organizational unit, and is about the same size as a fairly large US City.`DBN` stands for `District Borough Number`. It looks like `CSD` is the District, `BOROUGH` is the borough, and when combined with the `SCHOOL CODE`, forms the `DBN`. There’s no systematized way to find insights like this in data, and it requires some exploration and playing around to figure out. +正如上面所见,DBN实际上是`CSD`, `BOROUGH`, 和 `SCHOOL CODE` 的组合。对那些不熟悉纽约市的人来说,纽约由五个行政区组成。每个行政区是一个组织团体,并且有着美国城市一样的面积。DBN全称为行政区域编号。看起来就像CSD是区域,BOROUGH是行政区,并且当与SCHOOL CODE合并时就组成了DBN。这里并没有系统的方法寻找像这个数据这样的内在规律,并且这需要一些探索和努力来发现。 -Now that we know how to construct the `DBN`, we can add it into the `class_size` and `hs_directory` datasets: +现在我们已经知道了DBN的组成,那么我们就可以将它加入到class_size和hs_directory数据组中了: In [ ]: ``` @@ -440,16 +444,16 @@ data["hs_directory"]["DBN"] = data["hs_directory"]["dbn"] ``` -### Adding in the surveys +### 加入问卷 -One of the most potentially interesting datasets to look at is the dataset on student, parent, and teacher surveys about the quality of schools. These surveys include information about the perceived safety of each school, academic standards, and more. Before we combine our datasets, let’s add in the survey data. In real-world data science projects, you’ll often come across interesting data when you’re midway through your analysis, and will want to incorporate it. Working with a flexible tool like Jupyter notebook will allow you to quickly add some additional code, and re-run your analysis. +最可能值得一看的数据组之一就是学生、家长和老师关于学校质量的问卷了。这些问卷包含了每所学校的安全度,教学水平等。之前我们所合并了数据组,让我们们添加问卷数据。在真实世界的数据科学工程中,你将要经常会在分析过程中碰到有趣的数据,并且希望合并它。使用灵活的工具就像Jupyter notebook 将允许你快速添加一些新的代码,并且重新开始你的分析。 -In this case, we’ll add the survey data into our `data` dictionary, and then combine all the datasets afterwards. The survey data consists of `2` files, one for all schools, and one for school district `75`. We’ll need to write some code to combine them. In the below code, we’ll: +因此,我们将添加问卷数据到我们的data文件夹,并且合并所有之前的数据。问卷数据分为两个文件,一个包含所有的学校,一个包含75号区域的学校。我们将需要写一些代码来合并它们。之后的代码我们将: -* Read in the surveys for all schools using the `windows-1252` file encoding. -* Read in the surveys for district 75 schools using the `windows-1252` file encoding. -* Add a flag that indicates which school district each dataset is for. -* Combine the datasets into one using the [concat][6] method on DataFrames. +* 读取所有学校的问卷,并使用windows-1252作为编码。 +* 使用windows-1252编码读取所有75号区域学校的问卷。 +* 添加标签来表明每个数据组包含哪个区域的学校。 +* 使用数据框架[concat][6]方法合并数据组为一个。 In [66]: ``` @@ -461,7 +465,7 @@ survey = pandas.concat([survey1, survey2], axis=0) ``` -Once we have the surveys combined, there’s an additional complication. We want to minimize the number of columns in our combined dataset so we can easily compare columns and figure out correlations. Unfortunately, the survey data has many columns that aren’t very useful to us: +一旦我们将问卷合并,这里将会有一些混乱。我们希望我们合并的数据组列数最少,那么我们将可以轻易的进行列之间的对比并找出期间的关联。不幸的是,问卷数据有很多列并不是很有用: In [16]: ``` @@ -480,11 +484,11 @@ Out[16]: 5 rows × 2773 columns -We can resolve this issue by looking at the data dictionary file that we downloaded along with the survey data. The file tells us the important fields in the data: +我们可以通过查看数据文件夹中伴随问卷数据下载下来的文件来解决这个问题。它告诉我们们数据中重要的部分是哪些: ![](https://www.dataquest.io/blog/images/misc/xj5ud4r.png) -We can then remove any extraneous columns in `survey`: +我们可以去除`survey`数据组中多余的列: In [17]: ``` @@ -501,11 +505,11 @@ Out[17]: (1702, 23) ``` -Making sure you understand what each dataset contains, and what the relevant columns are can save you lots of time and effort later on. +请确保理你已经了解了每个数据组的内容和相关联的列,者能节约你之后大量的时间和精力: -### Condensing datasets +### 精简数据组 -If we take a look at some of the datasets, including `class_size`, we’ll immediately see a problem: +如果我们看向某些数据组,包括`class_size`,我们将立刻发现问题: In [18]: ``` @@ -523,7 +527,7 @@ Out[18]: | 3 | 1 | M | M015 | P.S. 015 Roberto Clemente | 01 | CTT | - | - | - | 17.0 | 1.0 | 17.0 | 17.0 | 17.0 | ATS | NaN | 01M015 | | 4 | 1 | M | M015 | P.S. 015 Roberto Clemente | 02 | GEN ED | - | - | - | 15.0 | 1.0 | 15.0 | 15.0 | 15.0 | ATS | NaN | 01M015 | -There are several rows for each high school (as you can see by the repeated `DBN` and `SCHOOL NAME` fields). However, if we take a look at the `sat_results` dataset, it only has one row per high school: +每所高中都有许多行(正如你所见的重复的`DBN`和`SCHOOL NAME`)。然而,如果我们看向`sat_result`数据组,每所高中只有一行: In [21]: ``` @@ -541,12 +545,12 @@ Out[21]: | 3 | 01M458 | FORSYTH SATELLITE ACADEMY | 7 | 414 | 401 | 359 | | 4 | 01M509 | MARTA VALLE HIGH SCHOOL | 44 | 390 | 433 | 384 | -In order to combine these datasets, we’ll need to find a way to condense datasets like `class_size` to the point where there’s only a single row per high school. If not, there won’t be a way to compare SAT scores to class size. We can accomplish this by first understanding the data better, then by doing some aggregation. With the `class_size`dataset, it looks like `GRADE` and `PROGRAM TYPE` have multiple values for each school. By restricting each field to a single value, we can filter most of the duplicate rows. In the below code, we: +为了合并这些数据组,我们将需要找到方法精简数据组到如`class_size`般一行对应一所高中。否则,我们将不能将SAT成绩与班级大小进行比较。我们通过先更好的理解数据,然后做一些合并来完成。`class_size`数据组像`GRADE`和`PROGRAM TYPE`,每个学校有多个数据对应。为了将每个范围内的数据变为一个数据,我们将大部分重复行过滤掉,在下面的代码中我们将会: -* Only select values from `class_size` where the `GRADE` field is `09-12`. -* Only select values from `class_size` where the `PROGRAM TYPE` field is `GEN ED`. -* Group the `class_size` dataset by `DBN`, and take the average of each column. Essentially, we’ll find the average `class_size` values for each school. -* Reset the index, so `DBN` is added back in as a column. +* 只从`class_size`中选择`GRADE`范围为`09-12`的行。 +* 只从`class_size`中选择`PROGRAM TYPE`是`GEN ED`的值。 +* 将`class_size`以`DBN`分组,然后取每列的平均值。重要的是,我们将找到每所学校班级大小平均值。 +* 重置索引,将`DBN`重新加到列中。 In [68]: ``` @@ -559,9 +563,9 @@ data["class_size"] = class_size ``` -### Condensing other datasets +### 精简其它数据组 -Next, we’ll need to condense the `demographics` dataset. The data was collected for multiple years for the same schools, so there are duplicate rows for each school. We’ll only pick rows where the `schoolyear` field is the most recent available: +接下来,我们将需要精简`demographic`数据组。这里有每个学校收集多年的数据,所以这里每所学校有许多重复的行。我们将只选取`schoolyear`最近的可用行: In [69]: ``` @@ -571,7 +575,7 @@ data["demographics"] = demographics ``` -We’ll need to condense the `math_test_results` dataset. This dataset is segmented by `Grade`and by `Year`. We can select only a single grade from a single year: +我们需要精简`math_test_results` 数据组。这个数据组被`Grade`和`Year`划分。我们将只选取一年选取一个年级。 In [70]: ``` @@ -580,7 +584,7 @@ data["math_test_results"] = data["math_test_results"][data["math_test_results"][ ``` -Finally, `graduation` needs to be condensed: +最后,`graduation`需要被精简: In [71]: ``` @@ -589,14 +593,14 @@ data["graduation"] = data["graduation"][data["graduation"]["Demographic"] == "To ``` -Data cleaning and exploration is critical before working on the meat of the project. Having a good, consistent dataset will help you do your analysis more quickly. +在完成工程的主要部分之前数据清理和挖掘是十分重要的。有一个高质量的,一致的数据组将会使你的分析更加快速。 -### Computing variables +### 计算变量 -Computing variables can help speed up our analysis by enabling us to make comparisons more quickly, and enable us to make comparisons that we otherwise wouldn’t be able to do. The first thing we can do is compute a total SAT score from the individual columns `SAT Math Avg. Score`, `SAT Critical Reading Avg. Score`, and `SAT Writing Avg. Score`. In the below code, we: +计算变量可以通过使我们的比较更加快速来加快分析速度,并且能是我们做到本无法做到的比较。我们能做的第一件事就是从分开的列`SAT Math Avg. Score`, `SAT Critical Reading Avg. Score`, and `SAT Writing Avg. Score`计算SAT成绩: -* Convert each of the SAT score columns from a string to a number. -* Add together all of the columns to get the `sat_score` column, which is the total SAT score. +* 将SAT列数值从字符转转化为数字。 +* 将所有列相加以得到`sat_score`,即SAT成绩。 In [72]: ``` @@ -608,10 +612,10 @@ data['sat_results']['sat_score'] = data['sat_results'][cols[0]] + data['sat_resu ``` -Next, we’ll need to parse out the coordinate locations of each school, so we can make maps. This will enable us to plot the location of each school. In the below code, we: +接下来,我们将需要进行每所学校一致区域分析,所以我们将制作地图。这将是我们画出每所学校的位置,下面的代码,我们将会: -* Parse latitude and longitude columns from the `Location 1` column. -* Convert `lat` and `lon` to be numeric. +* 从`Location 1`列分析出经度和维度。 +* 转化`lat`(经度)和`lon`(维度)为数字。 In [73]: ``` @@ -623,7 +627,7 @@ for c in ['lat', 'lon']: ``` -Now, we can print out each dataset to see what we have: +现在,我们将输出每个数据组来查看我们有了什么数据: In [74]: ``` @@ -861,18 +865,18 @@ hs_directory ``` -### Combining the datasets +### 合并数据组 -Now that we’ve done all the preliminaries, we can combine the datasets together using the `DBN` column. At the end, we’ll have a dataset with hundreds of columns, from each of the original datasets. When we join them, it’s important to note that some of the datasets are missing high schools that exist in the `sat_results` dataset. To resolve this, we’ll need to merge the datasets that have missing rows using the `outer` join strategy, so we don’t lose data. In real-world data analysis, it’s common to have data be missing. Being able to demonstrate the ability to reason about and handle missing data is an important part of building a portfolio. +现在我们已经完成了全部准备工作,我们可以用`DBN`列将数据组合并在一起了。在最后,我们将会从原始数据组得到一个有着上百列的数据组。当我们合并它们。请注意有些数据组中会没有`sat_result`中出现的高中。为了解决这个问题,我们需要使用`outer`方法来合并缺少行的数据组,这样我们就不会丢失数据。在实际分析中,缺少数据是很常见的。能够展示解释和解决数据缺失的能力是科学投资组合的重要部分。 -You can read about different types of joins [here][25]. +你可以在[此][25]阅读关于不同类型的join。 -In the below code, we’ll: +接下来的代码,我们将会: -* Loop through each of the items in the `data` dictionary. -* Print the number of non-unique DBNs in the item. -* Decide on a join strategy – `inner` or `outer`. -* Join the item to the DataFrame `full` using the column `DBN`. +* 循环通过`data`文件夹中的每一个条目。 +* 输出条目中的DBN码。 +* 决定join类别 - `inner`或`outer`。 +* 使用`DBN`列将条目合并到数据框架`full`中。 In [75]: ``` @@ -915,19 +919,19 @@ Out[75]: (374, 174) ``` -### Enjoying this post? Learn data science with Dataquest! +### 喜欢这篇文章?通过数据查询学习数据科学! ##### -* Learn from the comfort of your browser. -* Work with real-life data sets. -* Build a portfolio of projects. +* 从浏览器舒适的学习。 +* 使用实际的数据组。 +* 建立科学组合工程。 -[Start for Free][5] +[开始免费][5] -### Adding in values +### 添加值 -Now that we have our `full` DataFrame, we have almost all the information we’ll need to do our analysis. There are a few missing pieces, though. We may want to correlate the [Advanced Placement][24] exam results with SAT scores, but we’ll need to first convert those columns to numbers, then fill in any missing values: +现在我们有了我们的`full`数据框架,我们几乎拥有分析需要的所有数据。虽然这里有一些缺少的部分。我们可能将[AP][24] 考试结果与 SAT 成绩相关联,但是我们首先需要将这些列转化为数字,然后填充缺失的数据。 In [76]: ``` @@ -940,7 +944,7 @@ full[cols] = full[cols].fillna(value=0) ``` -Then, we’ll need to calculate a `school_dist` column that indicates the school district of the school. This will enable us to match up school districts and plot out district-level statistics using the district maps we downloaded earlier: +然后我们将需要计算表示哦学校所在区域的`school_dist`列。这将是我们匹配学校区域并且使用我们之前下载的区域地图画出地区级别的地图。 In [77]: ``` @@ -948,7 +952,7 @@ full["school_dist"] = full["DBN"].apply(lambda x: x[:2]) ``` -Finally, we’ll need to fill in any missing values in `full` with the mean of the column, so we can compute correlations: +最终,我们将需要用列的平均值填充缺失的数据到`full`中。那么我们就可以计算关联了: In [79]: ``` @@ -956,9 +960,9 @@ full = full.fillna(full.mean()) ``` -### Computing correlations +### 计算关联 -A good way to explore a dataset and see what columns are related to the one you care about is to compute correlations. This will tell you which columns are closely related to the column you’re interested in. We can do this via the [corr][23] method on Pandas DataFrames. The closer to `0` the correlation, the weaker the connection. The closer to `1`, the stronger the positive correlation, and the closer to `-1`, the stronger the negative correlation`: +一个好的方法来挖掘数据并查看哪些列与你所关心的问题有联系就是计算关联。这将告诉你哪列与你所关心的列更加有关联。你可以通过Pandas DataFrame 的[corr][23]方法来完成。越接近0则关联越小。越接近1则正相关越强,越接近-1则负关联越强: In [80]: ``` @@ -1032,25 +1036,25 @@ lon -1.315241e-01 Name: sat_score, dtype: float64 ``` -This gives us quite a few insights that we’ll need to explore: +这给了我们一些我们需要探索的内在规律: -* Total enrollment correlates strongly with `sat_score`, which is surprising, because you’d think smaller schools, which focused more on the student, would have higher scores. -* The percentage of females at a school (`female_per`) correlates positively with SAT score, whereas the percentage of males (`male_per`) correlates negatively. -* None of the survey responses correlate highly with SAT scores. -* There is a significant racial inequality in SAT scores (`white_per`, `asian_per`, `black_per`, `hispanic_per`). -* `ell_percent` correlates strongly negatively with SAT scores. +* total_enrollment 与 `sat_score`强烈相关,这是令人惊讶的,因为你曾经认为越小的学校越专注与学生就会取得更高的成绩。 +* 女生所占学校的比例(`female_per`) 与SAT成绩呈正相关,而男生所占学生比例(`male_per`)成负相关。 +* 没有问卷与SAT成绩成正相关。 +* SAT成绩由明显的种族不平等(`white_per`, `asian_per`, `black_per`, `hispanic_per`)。 +* `ell_percent` 与SAT成绩明显负相关。 -Each of these items is a potential angle to explore and tell a story about using the data. +每一个条目都是一个潜在的角度来挖掘和讲述一个关于数据的故事。 -### Setting the context +### 设置上下文 -Before we dive into exploring the data, we’ll want to set the context, both for ourselves, and anyone else that reads our analysis. One good way to do this is with exploratory charts or maps. In this case, we’ll map out the positions of the schools, which will help readers understand the problem we’re exploring. +在我们开始数据挖掘之前,我们将希望设置上下文,不仅为了我们自己,也是为了其它阅读我们分析的人。一个好的方法就是建立挖掘图标或者地图。因此,我们将在地图标出所有学校的位置,这将有助于读者理解我们所探索的问题。 -In the below code, we: +在下面的代码中,我们将会: -* Setup a map centered on New York City. -* Add a marker to the map for each high school in the city. -* Display the map. +* 建立纽约市为中心的地图。 +* 为城市里的每所高中添加一个标号。 +* 显示地图。 In [82]: ``` @@ -1068,7 +1072,7 @@ schools_map Out[82]:![](https://www.dataquest.io/blog/images/storytelling/map.png) -This map is helpful, but it’s hard to see where the most schools are in NYC. Instead, we’ll make a heatmap: +这个地图十分有用,但是不容易查看纽约哪里学校最多。因此,我们将用热图来代替它: In [84]: ``` @@ -1081,15 +1085,15 @@ schools_heatmap Out[84]:![](https://www.dataquest.io/blog/images/storytelling/heatmap.png) -### District level mapping +### 区域级别映射 -Heatmaps are good for mapping out gradients, but we’ll want something with more structure to plot out differences in SAT score across the city. School districts are a good way to visualize this information, as each district has its own administration. New York City has several dozen school districts, and each district is a small geographic area. +热图能够很好的标出梯度,但是我们将需要更结构化的画出不同城市之间的SAT分数差距。学校地区是一个很好的方式图形化信息,就像每个区域都有自己的管理者。纽约市数十个学校区域,并且每个区域都是一个小的地理区域。 -We can compute SAT score by school district, then plot this out on a map. In the below code, we’ll: +我们可以通过学校区域来计算SAT分数,然后将它们画在地图上。在下面的代码中,我们将会: -* Group `full` by school district. -* Compute the average of each column for each school district. -* Convert the `school_dist` field to remove leading `0`s, so we can match our geograpghic district data. +* 通过学校区域对`full`进行分组。 +* 计算每个学校区域的每列的平均值。 +* 去掉`school_dist`头部的0,然后我们就可以匹配地理数据了。 In [ ]: ``` @@ -1099,7 +1103,7 @@ district_data["school_dist"] = district_data["school_dist"].apply(lambda x: str( ``` -We’ll now we able to plot the average SAT score in each school district. In order to do this, we’ll read in data in [GeoJSON][22] format to get the shapes of each district, then match each district shape with the SAT score using the `school_dist` column, then finally create the plot: +我们现在将可以画出SAT在每个学校区域的平均值了。因此,我们将会读取[GeoJSON][22]中的数据,转化为每个区域的形状,然后通过`school_dist`列对每个区域图形和SAT成绩进行匹配。最终我们将创建一个图形: In [85]: ``` @@ -1124,11 +1128,11 @@ show_district_map("sat_score") Out[85]:![](https://www.dataquest.io/blog/images/storytelling/district_sat.png) -### Exploring enrollment and SAT scores +### 挖掘注册人数与SAT分数 -Now that we’ve set the context by plotting out where the schools are, and SAT score by district, people viewing our analysis have a better idea of the context behind the dataset. Now that we’ve set the stage, we can move into exploring the angles we identified earlier, when we were finding correlations. The first angle to explore is the relationship between the number of students enrolled in a school and SAT score. +现在我们已经依地区画出学校位置和STA成绩确定了上下文,浏览我们分析的人将会对数据的上下文有更好的理解。现在我们已经完成了基础工作,我们可以开始从我们上面寻找关联时所提到的角度分析了。第一个分析角度是学校注册学生人数与SAT成绩。 -We can explore this with a scatter plot that compares total enrollment across all schools to SAT scores across all schools. +我们可以通过所有学校的注册学生与SAT成绩的散点图来分析。 In [87]: ``` @@ -1145,9 +1149,9 @@ Out[87]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZQAAAEQCAYAAACX5IJuAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnX28XVV557+/8BITSAg3KAhBgwq12FiQUWjFEmshtOOISKt0lEakONOUXiDB8tIXM9Wh+BLUzFSpKBCqMKVaEKcZSLCktZ1KNBiIRoQoOBAEJCmG15CXZ/5Y6+Tue+6595577z7n7HPu7/v5rM/Ze+23Z+9zznr2Ws/LUkRgjDHGTJQpnRbAGGNMb2CFYowxphSsUIwxxpSCFYoxxphSsEIxxhhTClYoxhhjSqGlCkXS4ZLulPR9Sd+T1J/rPyHpB5LukfT3kg4oHHOppAck3SfplEL9cZI25G2faaXcxhhjxo5aGYci6RDgkIhYL2l/YB3wTmAO8I2I2C3pCoCIuETS0cANwBuBw4A7gCMjIiStBc6LiLWSVgLLI+K2lglvjDFmTLS0hxIRj0XE+rz8DPAD4NCIWB0Ru/Nud5EUDMBpwI0RsSMiHgI2AcdLejkwIyLW5v2uJykmY4wxFaFtNhRJc4FjSQqkyAeAlXn5UOCRwrZHSD2V+vrNud4YY0xFaItCycNdXwHOzz2VWv2fAC9GxA3t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vr5ktZI+julWfK+VDjmIUlXSFoH/I6k382ybZB0xSjXmy/pnyTdIulH+Txn5evfK+lVeb+XKs3QtzaXX831S5Vm37wzH/9HDZ7Zx8bysI0Zlnbn9XFxKbsAryRPBAacQcpTJOBlwE9IUyKcRJ7kKe83DZial48Evp2X51KYVKzBtT4I/ElenkrKlzQXmA88RZpDQsD/BX417/cgcFFePjTLNJs0W+c3gNMK+/Xl5afz53zg30lzV+xLyva6NG/rBz6Vl28gpVuHlEl7Y15eCvwLaTa+2cCT+bp7npmLS1mlUunrjRknxezTJwI3REQAT0j6J+CNwLa6Y/YF/qekXwZ2kaaXboZTgHmSfjuvzwReA+wgZWh9FEBpYqy5JMUC8Lf5842kybK25P2+DPwaA5mwG/HtyBMjSdoE3J7rv0eaDRFSRtlf1MB8LzNyltwA/iEidgBbJD1BUk7FZ2ZMKVihmF4jGNpYNrJHXAj8NCLOkrQX8MIYrnFeRKwuVihNIrW9ULWLwf+vZ4eRT8PIV6R43t2F9d2Fa4g0rfWLdXJByhg9nFzGlIZtKKYXeBqYkZf/BXiP0vS5LyW9/a8FninsA6ln8Vhe/j3SMFAz3A4sUpqYDUlHSZo+Blm/DZwkaXZWZGcC/zSG44djFWkIjCzXL4+yf/GZGVMKViim68nDR/+a3X1PIM0fcg/JPvGhiHgir++StF7S+cBngYV5aOoXSApnzylHuNwXgI3A3fl6nyO98ccox9Vk/SlpOtY7SXNtfCcaT2/djMdX8Zr9wH/IjgLfB/7LSMcXn5mN8qYsPB+KMcaYUnAPxRhjTCnYOGdMAyQtIMVqFPlxRJzRCXmM6QY85GWMMaYUPORljDGmFKxQjDHGlIIVijHGmFKwQjHGGFMKVijGGGNK4f8D5wfWJYWhjXwAAAAASUVORK5CYII=) -As you can see, there’s a cluster at the bottom left with low total enrollment and low SAT scores. Other than this cluster, there appears to only be a slight positive correlation between SAT scores and total enrollment. Graphing out correlations can reveal unexpected patterns. +如你所见,底部左边低注册人数低SAT成绩有一个集群。这个集群意外,SAT成绩与全部注册人数只有轻微正相关。画出的关联显示了意想不到的图形. -We can explore this further by getting the names of the schools with low enrollment and low SAT scores: +我们可以通过获取低注册人数且低SAT成绩的学校的名字进行进一步的分析。 In [88]: ``` @@ -1172,11 +1176,11 @@ Out[88]: Name: School Name, dtype: object ``` -Some searching on Google shows that most of these schools are for students who are learning English, and are low enrollment as a result. This exploration showed us that it’s not total enrollment that’s correlated to SAT score – it’s whether or not students in the school are learning English as a second language or not. +在Google上进行了一些搜索确定了这些学校大多数是为了正在学习英语而开设的,所以由这低注册人数。这个挖掘向我们展示了并不是所有的注册人数都与SAT成绩有关联 - 这里是否由学习英语作为第二语言的学生。 -### Exploring English language learners and SAT scores +### 挖掘英语学习者和SAT成绩 -Now that we know the percentage of English language learners in a school is correlated with lower SAT scores, we can explore the relationship. The `ell_percent` column is the percentage of students in each school who are learning English. We can make a scatterplot of this relationship: +现在我们知道英语学习者所占学校学生比例与低的SAT成绩有关联,我们可以探索其中的规律。`ell_percent`列表示一个学校英语学习者所占的比例。我们可以制作关于这个关联的散点图。 In [89]: ``` @@ -1191,7 +1195,7 @@ Out[89]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZEAAAEQCAYAAABxzUkqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnX2cXVV577/PYBLyPpmB8pYUUKIQjEKoEAuWKA2hVkWhvlUsoBevjd4hJKgQtdIrF6GSCKlVKkIIKlSuig29ERLQaa1eiQ4Eo0kktMI1sYmSiKOBvM0894+1ds4+Z86ZOXNe5uxz5vf9fNZn9l5777XXPnPOevZaz5u5O0IIIUQltDW6A0IIIZoXCREhhBAVIyEihBCiYiREhBBCVIyEiBBCiIqREBFCCFExdRUiZjbDzL5jZj81s5+YWVes/7SZbTazJ8zsG2Y2NXXNtWa21cy2mNn5qfozzGxjPHZrPfsthBCiPKyefiJmdjRwtLtvMLNJQA/wZmA68Ii795vZjQDufo2ZzQLuAV4FHAc8DMx0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QFSMhIoQQomIkRIQQQlSMhIgQBZjZ02bWEbd/3+j+lIOZLW10H8ToREJEiIF4ie2aUuP8NtfWsC0hykZCRIxqzOwSM3s0ZiG8LSYBK/faeWb2b2b2LzEL3OdjvCXM7Hwz+76Z9ZjZfTFcejLLudHMeoC3Wsha2WNmG8zs4XjOxJiN7tEYbv1Nsf4yC9k7vxUz0t0U628Exsdn+FKtPyMhBqMpovgKUQ9iNsW3AX/s7n1m9g/Au4bZzKuAUwj5Jx4ELjKzfwU+Cpzn7i9YSGm8GPgkYWbzrLufYWZHAj2EJE/PpFKUfhR4xN3fE+seTQQMIW7VaYQ4SD8zsxXufo2ZfcDdT6/woxCiYiRExGjmPOAM4EdxAnE4ww/xvd5DBjjM7F5CcMm9hPSi34/tjgW+n7rmq/HvXOBf3f0ZAHd/LtafD7zRzK6O++OAPyQIoEc85l4xs03A8TRnigPRIkiIiNHOKnfPU0rH/DTlktaZWNw3Qv7qvyxxzZ7UtUUTVwEXufvWgn6dBexLVfWh37BoMNKJiNHMI8BfxGUlzKzDzI4fZhtnxlwvbYSlse8CPwDOjlnyEh3HzCLXPgr8SUwRTGIRBjwEdCUnmVmyTFVK4AAciDnBhRhRJETEqMXdNwMfA9aa2ROEwftoyrfOckJejc8SEhf9p7vf7+7PApcB98Z2vw+8rMj9fw28D/iGmW0g5H2AoDsZY2Y/NrOfAH+bul+p/nwB+LEU62KkUT4RISrEzOYBS9z9jY3uixCNQjMRISpnsJmBEKMCzUSEGAIzmw3cXVC9191f3Yj+CJElJESEEEJUjJazhBBCVIyEiBBCiIqREBFCCFExEiJCCCEqRkJECCFExfx/pPXgqnK8qPcAAAAASUVORK5CYII=) -It looks like there are a group of schools with a high `ell_percentage` that also have low average SAT scores. We can investigate this at the district level, by figuring out the percentage of English language learners in each district, and seeing it if matches our map of SAT scores by district: +看起来这里有一组学校有着高的`ell_percentage`值并且有这低的SAT成绩。我们可以在区域层面调查这个关系,通过找出每个区域英语学习者所占的比例,并且查看是否与我们的区域层面SAT地图所匹配: In [90]: ``` @@ -1202,11 +1206,11 @@ Out[90]: ![](https://www.dataquest.io/blog/images/storytelling/district_ell.png) -As we can see by looking at the two district level maps, districts with a low proportion of ELL learners tend to have high SAT scores, and vice versa. +我们一可通过两个区域层面地图来查看,一个低ELL(English-language)学习者比例的地区更倾向有高SAT成绩,反之亦然。 -### Correlating survey scores and SAT scores +### 关联问卷分数和SAT分数 -It would be fair to assume that the results of student, parent, and teacher surveys would have a large correlation with SAT scores. It makes sense that schools with high academic expectations, for instance, would tend to have higher SAT scores. To test this theory, lets plot out SAT scores and the various survey metrics: +学生、家长和老师的问卷结果如果与SAT分数有很大的关联的假设是合理的。就使例如具有高学术期望的学校倾向于有着更高的SAT分数是合理的。为了测这个理论,让我们画出SAT分数和多种问卷指标: In [91]: ``` @@ -1221,11 +1225,11 @@ Out[91]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX4AAAEuCAYAAACJVHkLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAGXtJREFUeJzt3XuUZWV95vHvYxPGG6CdICh2xBgYhTGKzgBRZ9KJtw5mxJgBJIkxxKgrs1AZzSzUOIKXGJNBExXHRRQRr4wOXnAFBWLSjkYU0PYOCpp2ASoSb1wMI+pv/ti75FBUVRd96uyzu97vZ61aVft23l9Xdz97n/fs992pKiRJ7bjDvAuQJA3L4Jekxhj8ktQYg1+SGmPwS1JjDH5JaszUwZ9kS5LLklye5MQltt8/yYVJbkry3EXbtif5XJJtSS6athZJ0o7tNs3BSTYApwKPAq4GLk5yTlVdOrHbd4BnAk9Y4iUK2FxV352mDknS6k17xX8ocEVVba+qm4GzgCMnd6iqa6vqEuDmZV4jU9YgSbodpg3+/YArJ5av6tetVgF/n+SSJE+bshZJ0ipM1dVDF9zTeHhVfTPJ3sAFSS6rqo9O7pDEOSUkaSdU1ZI9KtNe8V8NbJpY3kR31b/aor7Zf78WeC9d19FS+2WaL+DF077GeqhhLHWMoY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Sxtcki10zwD4CN14hv8EPL2qPjRwHS8DLqyqv5t1W07ZILXpJ/333wLe0IfN7kMXkWRTkvcmubb/OjvJvYesoQ/4f0/3Lugs4DnAD4esoXcCXRfcTUmu77+um0VDdvVIbbo6yd8CjwZekeSOzOdC8Azg7cDR/fLv9esePVQBSZ4GPAvYRDdK9nDgQrpbXYe0F92f/75V9eIk92FGH7h7xS+16WjgPOAx/Qebdwf++xzq2Luqzqiqm/uvNwP3GLiGZwOHAtur6tfpPu/4wcA1ALwOOIxuqgboHgF56iwa8opfalBV3QicPbH8Tbrnvg7tO0meTPcs4NCF3r8MXMNNVfWvSUhyx6q6LMm/HbgGgMOq6pAk2wCq6rtJZtL9ZvBLmqfj6K5qF2YF/Xi/bkhX9re2vg+4IMn3gO0D1wDwo37qCACS7M2M7i7yrh5Jc5PkTOCEqvpev7wROGUWg5ZWWc9muikbPrSKZ/Guddu/T9cF91DgTLq5el5YVe9a87YMfknzsjD75I7WtSLJA4BH9osfrqpLZ9GOXT2S5ilJNlbVd/uFjcxnLvxR6IN+JmE/yeCXNE+vBC5M8i66D3ePAv58viWtf3b1SJqrfsqI36Cbl+YfqupLcy5p3TP4JakxDuCSpMYY/JLUGINfkhpj8EtSY/4/UzeqepUNQsYAAAAASUVORK5CYII=) -Surprisingly, the two factors that correlate the most are `N_p` and `N_s`, which are the counts of parents and students who responded to the surveys. Both strongly correlate with total enrollment, so are likely biased by the `ell_learners`. The other metric that correlates most is `saf_t_11`. That is how safe students, parents, and teachers perceived the school to be. It makes sense that the safer the school, the more comfortable students feel learning in the environment. However, none of the other factors, like engagement, communication, and academic expectations, correlated with SAT scores. This may indicate that NYC is asking the wrong questions in surveys, or thinking about the wrong factors (if their goal is to improve SAT scores, it may not be). +惊人的,关联最大的两个事实是`N_p`和`N_s`,分别是家长和学生回应的问卷。都与注册人数有着很强的关联,所以很可能偏离了`ell_learner`。此外指标关联最强的就是`saf_t_11`。就是学生、家长和老师对学校安全程度的感知。这说明了,越安全的学校,更能让学生在环境里安心学习。然而其它因子,像互动,交流和学术水平都与SAT分数无关,这也许表明了纽约在问卷中问了不理想的问题或者想错了因子(如果他们的目的是提高SAT分数的话)。 -### Exploring race and SAT scores +### 挖掘种族和SAT分数 -One of the other angles to investigate involves race and SAT scores. There was a large correlation differential, and plotting it out will help us understand what’s happening: +其中一个就读就是调查种族和SAT分数的联系。这是一个大相关微分,并且将其画出来帮助我们理解到底发生了什么: In [92]: ``` @@ -1240,7 +1244,7 @@ Out[92]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXcAAAE0CAYAAADXDHM8AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAGAdJREFUeJzt3X20JVV95vHvY7eACoQYFJSXEBURdDBoRHSMtm+BqIHENwYd3+IoMwY1zhoD6Epsk5iMZmmMulQGWcBoVhxRJ2JUEAkdUREFEURpBBUDGMhoRISggv7mj6qGy+Xee7pv3e7q2v39rMXiVp19Tv0ozn3uPrvq7J2qQpLUlruNXYAkaeUZ7pLUIMNdkhpkuEtSgwx3SWqQ4S5JDRoc7kkOS7I+yRVJjl3g8V2TnJHkq0kuTfLioceUJC0tQ+5zT7IKuBx4CnAt8GXgqKq6bE6btcD2VXV8kl379rtV1W1DCpckLW5oz/1g4MqquqqqbgU+CBwxr82/ADv3P+8M/MBgl6TNa/XA5+8BXD1n+xrg0fPanAj8Y5LvATsBzx14TEnSDEPDfWPGdF4HfLWq1iR5IHBWkodX1Y/nNkriPAiStAxVlfn7hob7tcBec7b3ouu9z/VY4E19Ad9K8h1gP+CCjSlwa5NkbVWtHbuOFnguV5bnc2VN5Xwu1jEeOuZ+AbBvkn2SbAccCZw+r816uguuJNmNLti/PfC4kqQlDOq5V9VtSY4BzgRWASdV1WVJju4fPwH4C+DkJBfT/TH5o6r6t4F1S5KWMOhWyJWUpCYyLLOmqtaNXUcLPJcry/O5sqZyPhfLTsNdkiZssex0+gFJapDhLkkNMtwlqUGGuyQ1yHCXpAYZ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SQ0y3CWpQf8f9xOebfTGNUUAAAAASUVORK5CYII=) -It looks like the higher percentages of white and asian students correlate with higher SAT scores, but higher percentages of black and hispanic students correlate with lower SAT scores. For hispanic students, this may be due to the fact that there are more recent immigrants who are ELL learners. We can map the hispanic percentage by district to eyeball the correlation: +看起来更高的白种和亚洲学生与更高的SAT分数有关联,但是更高的黑人和西班牙裔与更低的SAT分数有关联。对于西班牙学生,这可能因为近年的移民还是英语学习者的事实。我们可以标出区层面的西班牙裔的比例并观察联系。 In [93]: ``` @@ -1252,11 +1256,11 @@ Out[93]: ![](https://www.dataquest.io/blog/images/storytelling/district_hispanic.png) -It looks like there is some correlation with ELL percentage, but it will be necessary to do some more digging into this and other racial differences in SAT scores. +看起来这里与英语学习者比例有关联,但是这将有必要做一些挖掘这种和在SAT分数上的其它种族差异。 -### Gender differences in SAT scores +### SAT分数上的性别差异` -The final angle to explore is the relationship between gender and SAT score. We noted that a higher percentage of females in a school tends to correlate with higher SAT scores. We can visualize this with a bar graph: +挖掘性别与SAT分数之间的关系是最后一个角度。我们注意学校更高的女生比例倾向于与更高的SAT分数有关联。我们可以可视化为一个条形图: In [94]: ``` @@ -1271,7 +1275,7 @@ Out[94]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX4AAAEuCAYAAACJVHkLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAEvlJREFUeJzt3X+s3XV9x/Hny9Zl1mgYDiliEScgsmhgi6DOxJv4Ix0kxWVOgyQ6ZpRlQ92iCWw67bZMo4lmcUZliFgNkWiGriQqFGKNmwZkQ0RshTqb0QKVqUxxokXe++N8L5zWe2/Pvd97+709n+cjObnn8/1+Pue8c3vz6ud8vj9OqgpJUjseM3QBkqTDy+CXpMYY/JLUGINfkhpj8EtSYwx+SWpM7+BPsjHJziR3Jrl4jv2nJvlakgeTvOWgfbuTfDPJLUlu6luLJOnQ1vYZnGQN8EHgJcBe4OtJtlbVjrFuPwDeCLx8jp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kHVNO8/jn35XAB9hdG70DLAFuHLIgqQxnwSOBTYC24ENwANDFtQCl3qmXJL/rKrfSXJbVT17fNvQtUlJvlFVpyf5ZlU9J8ljgX+rqrOGrm2audQz/R5MsgbYleQi4G7g8QPXJM2avVXD/yZ5NnAvcMyA9TTBpZ7p92ZGa6dvBH4XOB947aAVSY+6LMnRwNuBrcC3gfcOW9L0c6lnyiV5LqObYJ3I6BNegIer6jlD1iVpOAb/lEtyB/BW4FuM3ZzNS+K1GiT5DeA1PDoxgdFZZ28arKgGuMY//e6rqq2H7iYN4vPA14Bv8uiFW85GV5gz/imX5GXAq4DrefRAWlXV1cNVJY14htkwDP4pl+RK4JnA7Ry41HPBYEVJnSRvBX4MXAP8fHZ7Vf1wsKIaYPBPuSTfAU4t/6G1CnWnGP8DcD+PTky8snyFucY//b7K6HL424cuRJrDW4BnVNX/DF1ISwz+6fd84BtJvsejH6XL0zm1StwJ/GzoIlpj8E+/jUMXIC3g/xhNTL7EgRMTT+dcQQb/lPN8fa1yn+ses8egvB//YeDBXUmDSrIOOKGqdg5dSyu8V4+kwSTZBNwCfLFrn5HECw5XmMEvaUibgbOAHwFU1S2Ap3KuMINf0pD2V9X9B217eM6eWjYe3JU0pG8lOR9Ym+Rk4E2Mrj3RCnLGL+mwS/LJ7ul3GV1g+HPgU4xu3/AXQ9XVCs/qkXTYJfk28BJGB3VnGJ3GOau8V8/KcqlH0hA+AtzA6EDufxy0r/AA74pyxi9pMEk+UlV/OnQdrTH4JakxHtyVpMYY/JLUGINfkhpj8EtSYwx+SWrM/wMaCBh+0KRiFQAAAABJRU5ErkJggg==) -To dig more into the correlation, we can make a scatterplot of `female_per` and `sat_score`: +为了在关联中挖掘更多,我们可以制作一个`female_per`和`sat_score`的散点图: In [95]: ``` @@ -1286,7 +1290,7 @@ Out[95]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZEAAAEQCAYAAABxzUkqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAAC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YlnMhYXEqIZqOprOEgHuA/uSDmSWdfebKhxlMJyyqNBk4i0KHb4B5WPXxl8kIwgKvz25q13nvjccdTLDdPB7lXBzXJsfMDktNuwmRC1IiopNJljX9LDDZzB42s58B/6Nkf/r40nMBPk1YY/6HBJtI1jEfBD5sZg8CPwNOHUOu/yQsBrQC+At33wF8lbCA0/1mtg74MmE01FbLyYqJhdYTEaLFMLMbgbvd/fa8ZRFiLDQSEUIIUTUyrAuRE2a2FHhvSfVt7n5OHvIIUQ2azhJCCFE1ms4SQghRNVIiQgghqkZKRAghRNVIiQghhKgaKREhhBBV8/8Bq3PAsBX5v8AAAAAASUVORK5CYII=) -It looks like there’s a cluster of schools with a high percentage of females, and very high SAT scores (in the top right). We can get the names of the schools in this cluster: +看起来这里有一个高女生比例高SAT成绩的簇(右上角)。我们可以获取簇中学校的名字: In [96]: ``` @@ -1306,11 +1310,11 @@ Out[96]: Name: School Name, dtype: object ``` -Searching Google reveals that these are elite schools that focus on the performing arts. These schools tend to have higher percentages of females, and higher SAT scores. This likely accounts for the correlation between higher female percentages and SAT scores, and the inverse correlation between higher male percentages and lower SAT scores. +使用Google进行搜索可以得到这些是专注于表演艺术的精英学校。这些学校有着更高比例的女生和更高的SAT分数。这可能解释了更高的女生比例和SAT分数的关联,并且相反的更高的男生比例与更低的SAT分数。 -### AP scores +### AP成绩 -So far, we’ve looked at demographic angles. One angle that we have the data to look at is the relationship between more students taking Advanced Placement exams and higher SAT scores. It makes sense that they would be correlated, since students who are high academic achievers tend to do better on the SAT. +至今,我们将关注人口统计角度。一个我们通过数据来看参加高阶测试的学生和SAT分数的角度。因为高学术获得者倾向于有着高的SAT分数说明了它们是有关联的。 In [98]: ``` @@ -1327,7 +1331,7 @@ Out[98]: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAY8AAAEPCAYAAAC6Kkg/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAIABJREFUeJztnX+cXFV5/9/PkiX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/8AnNbH9VPN7D4zewT4GJDb6+E7hCJ1AB8BvmNhS+XRHjYDA7iN5iw0KYYwUh5C9ENcGZxOKHR3AqHw3SG5jxN/9rU6uAWY5e7HA38OjIj93wdmmtkEwl4K/1ZKhIHIL0Q9kPIQon/GAi+6+24zeyswI/a3Ab8Xjz9KqGJbjtHAc2bWDlyQ63T3V4GfAouB73vgJeCVWNYbwopEiKaiqTeDEqJJWAl82sw2EEpa/yT27wBOMbOrCVshn1/meoAvEPZE/3X8c3Tis+8AdwCdib5LgCVm1kPwp7yMEE2ESrILUSVm9oq7j6nTvUe5+454fCVwmLtfUY9nCVENWnkIUT31fPN6n5ldRfg/+hTw8To+S4iK0cpDiBpiZl8HTi3qvt7dl2UhjxD1QspDCCFExSjaSgghRMVIeQghhKgYKQ8hhBAVI+UhhBCiYqQ8hBBCVMz/B9n2P5AJnyYcAAAAAElFTkSuQmCC) -It looks like there is indeed a strong correlation between the two. An interesting cluster of schools is the one at the top right, which has high SAT scores and a high proportion of students that take the AP exams: +看起来它们之间确实有着很强的关联。有趣的是右上角高SAT分数的学校有着高的AP测试通过比例: In [99]: ``` @@ -1348,24 +1352,24 @@ Out[99]: Name: School Name, dtype: object ``` -Some Google searching reveals that these are mostly highly selective schools where you need to take a test to get in. It makes sense that these schools would have high proportions of AP test takers. +功过google搜索解释了大多数高选择性的学校你需要经过测试才能进入。这就说明了为什么这些学校会有高的AP通过人数。 -### Wrapping up the story +### 包装故事 -With data science, the story is never truly finished. By releasing analysis to others, you enable them to extend and shape your analysis in whatever direction interests them. For example, in this post, there are quite a few angles that we explored inmcompletely, and could have dived into more. +在数据科学中,故事不可能真正完结。通过向其他人发布分析,你允许它们拓展并且运用你的分析到他们所感兴趣的方向。比如在本文中,这里有一些角度我们没有完成并且可以探索更加深入。 -One of the best ways to get started with telling stories using data is to try to extend or replicate the analysis someone else has done. If you decide to take this route, you’re welcome to extend the analysis in this post and see what you can find. If you do this, make sure to comment below so I can take a look. +一个最好的方式开始讲述故事就是尝试拓展或者复制别人已经完成的分析。如果你觉得采取这个方式,你被欢迎拓展这篇文章的分析并得知你的收获。如果你确实这么做了,请在下面评论,那么我就可以看到了。 -### Next steps +### 下一步 -If you’ve made it this far, you hopefully have a good understanding of how to tell a story with data, and how to build your first data science portfolio piece. Once you’re done with your data science project, it’s a good idea to post it on [Github][21] so others can collaborate with you on it. +如果你做的足够多,你将很有希望对讲一个关于数据的故事和构建你的第一个数据科学组合有很好的理解。一旦你完成了你的数据科学工程,发表在[Github][21]上是一个好的想法,这样别人就能够与你一起合作。 -_If you liked this, you might like to read the other posts in our ‘Build a Data Science Portfolio’ series:_ +_如果你洗管这篇文章,你可能希望阅读我们‘Build a Data Science Portfolio’系列文章的其它部分:_ -* _[How to setup up a data science blog][4]._ -* _[Building a machine learning project][3]._ -* _[The key to building a data science portfolio that will get you a job][2]._ -* _[17 places to find datasets for data science projects][1]_ +* _[如何建立一个数据科学博客][4]._ +* _[建立一个机器学习工程][3]._ +* _[将帮助你的到工作的数据科学组合的关键]._ +* _[17 你能找到其它数据科学工程数据组的地方]._ -------------------------------------------------------------------------------- @@ -1374,7 +1378,7 @@ via: https://www.dataquest.io/blog/data-science-portfolio-project/ 作者:[Vik Paruchuri ][a] -译者:[译者ID](https://github.com/译者ID) +译者:[Yoo-4x] 校对:[校对者ID](https://github.com/校对者ID) From edbb24a8d46d156c9aaf59b6ead09a28ebcaa9e6 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 2 Mar 2017 17:38:39 +0800 Subject: [PATCH 015/190] =?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 校对完毕 --- ...0 How to write web apps in R with Shiny.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/translated/tech/20170120 How to write web apps in R with Shiny.md b/translated/tech/20170120 How to write web apps in R with Shiny.md index cb3f0ec868..0fdc6da56d 100644 --- a/translated/tech/20170120 How to write web apps in R with Shiny.md +++ b/translated/tech/20170120 How to write web apps in R with Shiny.md @@ -1,15 +1,14 @@ 如何用 R 语言的 Shiny 库编写 web 程序 ============================================================ ![How to write web apps in R with Shiny](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUSINESS_lightbulbs.png?itok=70w-2-Ta "How to write web apps in R with Shiny") -图片提供:  -opensource.com +图片提供: opensource.com -新年快乐!我这个月在写一些更加长的文章,所以你可以在未来几个星期内寻找它们。对于这个月的 Nooks 和 Crannies,我想简要地提一个我一直在自己在玩的一个很棒的 R 库。 +我这个月在写一些更加长的文章,所以你们可以在几周后再来看看。本月,我想简要地提下我自己一直在玩的一个很棒的 R 库。 -我的一个亲密朋友最近在用 R 编写东西。我一直都对它很感兴趣,一直在试图挤一点时间,至少学习更多关于 R 以及你可以做的事情的种类。探索 R 的数字处理能力对我而言是一个持续斗争,因为我并不是如我朋友那样有一个数学头脑。这对我来说很慢,但我一直试图将它与我在其他领域的经验联系起来,我甚至开始考虑非常简单的 web 程序。 +我的一个亲密朋友最近在用 R 编写东西。我一直都对它很感兴趣,也一直在试图挤时间,学习更多关于 R 的知识以及可用它做的事情。探索 R 的超强数字处理能力对我而言有些困难,因为我并不如我朋友那样有一个数学头脑。我进展有点慢,但我一直试图将它与我在其他领域的经验联系起来,我甚至开始考虑非常简单的 web 程序。 -[Shiny][1]是一个来自 RStudio 的工具包,它让创建 web 程序变得更容易。它能从 R 控制台轻松安装,只需要一行,最新的稳定版本将加载供你使用。这里有一个很棒的[教程][2],它会通过设置应用程序的概念、通过前面的课程构建技能的方式引导你。 Shiny 的授权是 GPLv3,源代码可以在 [GitHub][3] 上获得。 +[Shiny][1]是一个来自 RStudio 的工具包,它让创建 web 程序变得更容易。它能从 R 控制台轻松安装,只需要一行,最新的稳定版本将加载供你使用。这里有一个很棒的[教程][2],它会带着你理解设置应用的概念,在前面课程基础上构建技能。 Shiny 的授权是 GPLv3,源代码可以在 [GitHub][3] 上获得。 这是一个用 Shiny 写的简单的小 web 程序: @@ -33,13 +32,13 @@ ui <- basicPage( shinyApp(ui = ui, server = server) ``` -当你在输入框中输入时文字时,它会复制提示语句后面的文字。这并没有什么奇特的,但它向你展示了一个 Shiny 程序的基本结构。“服务端”部分允许你处理所有后端工作,如计算、数据库检索或程序需要发生的任何其他操作。“UI”部分定义了接口,它可以根据需要变得简单或复杂。 +当你在输入框中输入文字时,它会被复制到输出框中提示语后。这并没有什么奇特的,但它向你展示了一个 Shiny 程序的基本结构。“服务端”部分允许你处理所有后端工作,如计算、数据库检索或程序需要发生的任何其他操作。“UI”部分定义了接口,它可以根据需要变得简单或复杂。 -Shiny 中包含的大量样式和主题使用的是 [Bootstrap][4],所以你可以在学习了一点后,就能用 R 创建广泛的、功能丰富的 web 程序。附加包可以扩展功能,甚至更高级的 JavaScript 程序、模板等。 +Shiny 中使用 [Bootstrap][4] 包含了大量样式和主题,所以在学习了一点后,就能用 R 创建广泛的、功能丰富的 web 程序。使用附加包可以将功能扩展到更高级的 JavaScript 程序、模板等。 -你可以以几种方式处理 Shiny 的后端工作。如果你只是在本地运行你的程序,加载库会就能做到。对于想要发布到网络上的程序,你可以在[ RStudio 的 Shiny 网站][5]上共享它们,运行开源版本的 Shiny 服务器,或通过年度订阅服务从 RStudio 处购买 Shiny Server Pro。 +有几种方式处理 Shiny 的后端工作。如果你只是在本地运行你的程序,加载库就能做到。对于想要发布到网络上的程序,你可以在[ RStudio 的 Shiny 网站][5]上共享它们,运行开源版本的 Shiny 服务器,或通过年度订阅服务从 RStudio 处购买 Shiny Server Pro。 -经验丰富的 R 大牛可能已经知道 Shiny 了;它已经存在大约几年了。对于像我这样从一个完全不同的编程语言来的人并希望学习一点 R 的人来说,我发现它是相当有帮助的。 +经验丰富的 R 大牛可能已经知道 Shiny 了;它已经存在大约几年了。对于像我这样来自一个完全不同的编程语言,并且希望学习一点 R 的人来说,它是相当有帮助的。 -------------------------------------------------------------------------------- @@ -48,7 +47,7 @@ Shiny 中包含的大量样式和主题使用的是 [Bootstrap][4],所以你 ![](https://opensource.com/sites/default/files/styles/profile_pictures/public/ruth1_avi.jpg?itok=I_EE7NmY) -D Ruth Bavousett - D Ruth Bavousett 已经成为一名系统管理员和软件开发人员很长时间了,他的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前是休斯敦 cPanel 的 Perl 开发人员, 的两只猫的工作人员。 +D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前是休斯敦 cPanel 的 Perl 开发人员。 -------------------------------------------------------------------------------- From ad7b922c4ff90e7e58b8a45789cbe7d10d23c7d9 Mon Sep 17 00:00:00 2001 From: Flynn Date: Fri, 3 Mar 2017 00:13:13 +0800 Subject: [PATCH 016/190] translated --- ...to Check Memory Usage Statistics in Linux.md | 219 ----------------- ...to Check Memory Usage Statistics in Linux.md | 220 ++++++++++++++++++ 2 files changed, 220 insertions(+), 219 deletions(-) delete mode 100644 sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md create mode 100644 translated/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md diff --git a/sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md b/sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md deleted file mode 100644 index 6171ac51df..0000000000 --- a/sources/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md +++ /dev/null @@ -1,219 +0,0 @@ -ucasFL translating -free – A Standard Command to Check Memory Usage Statistics (Free & Used) in Linux -============================================================ - -We all knows, most of the Servers (Including world Top Super Computers are running in Linux) are running in Linux platform on IT infrastructure because Linux is more flexible compare with other operating systems. Other operating systems required reboot for small small changes & patch updates but Linux systems doesn’t required reboot except critical patch updates. - -One of the big challenge for Linux administrator to maintain the system up and running without any downtime. To managing memory utilization on Linux is another challenging task for administrator, `free` is one of the standard & widely used command, to analyze Memory Statistics (Free & Used Memory) in Linux. Today we are going to cover free command with useful options. - -Suggested Articles : - -* [smem – Linux Memory Reporting/Statistics Tool][1] -* [vmstat – A Standard Nifty Tool to Report Virtual Memory Statistics][2] - -#### What’s Free Command - -free displays the total amount of `free` and `used` physical and `swap` memory in the system, as well as the `buffers` and `caches`used by the kernel. The information is gathered by parsing /proc/meminfo. - -#### Display System Memory - -Run the `free` command without any option to display system memory, including total amount of `free`, `used`, `buffers`, `caches`& `swap`. - -``` -# free - total used free shared buffers cached -Mem: 32869744 25434276 7435468 0 412032 23361716 --/+ buffers/cache: 1660528 31209216 -Swap: 4095992 0 4095992 -``` - -The output has three columns. - -* Column-1 : Indicates Total memory, used memory, free memory, shared memory (mostly used by tmpfs (Shmem in /proc/meminfo)), memory used for buffers, cached contents memory size. - -* Total : Total installed memory (MemTotal in /proc/meminfo) -* Used : Used memory (calculated as total – free + buffers + cache) -* Free : Unused memory (MemFree in /proc/meminfo) -* Shared : Memory used (mostly) by tmpfs (Shmem in /proc/meminfo) -* Buffers : Memory used by kernel buffers (Buffers in /proc/meminfo) -* Cached : Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo) - -* Column-2 : Indicates buffers/cache used & free. -* Column-3 : Indicates Total swap memory (SwapTotal in /proc/meminfo), free (SwapFree in /proc/meminfo)) & used swap memory. - -#### Display Memory in MB - -By default `free` command output display memory in `KB - Kilobytes` which is bit confusion to most of the administrator (Many of us convert the output to MB, to understand the size, when the system has more memory). To avoid the confusion, add `-m` option with free command to get instant output with `MB - Megabytes`. - -``` -# free -m - total used free shared buffers cached -Mem: 32099 24838 7261 0 402 22814 --/+ buffers/cache: 1621 30477 -Swap: 3999 0 3999 -``` - -How to check, how much free ram I really have From the above output based on `used` & `free` column, you may think, you have very low free memory, when it’s really just `10%`, How ? - -Total Actual Available RAM = (Total RAM – column2 used) -Total RAM = 32099 -Actual used RAM = -1621 - -Total actual available RAM = 30477 - -If you have latest distribution, you have a option to see the actual free memory called `available`, for older distribution, look at the `free` column in the row that says `-/+ buffers/cache`. - -How to check, how much RAM actually used From the above output based on `used` & `free` column, you may think, you have utilized morethan `95%` memory. - -Total Actual used RAM = column1 used – (column1 buffers + column1 cached) -Used RAM = 24838 -Used Buffers = 402 -Used Cache = 22814 - -Total Actual used RAM = 1621 - -#### Display Memory in GB - -By default `free` command output display memory in `KB - Kilobytes` which is bit confusion to most of the administrator, so we can use the above option to get the output in `MB - Megabytes` but when the server has huge memory (morethan 100 GB or 200 GB), the above option also get confuse, so in this situation, we can add `-g` option with free command to get instant output with `GB - Gigabytes`. - -``` -# free -g - total used free shared buffers cached -Mem: 31 24 7 0 0 22 --/+ buffers/cache: 1 29 -Swap: 3 0 3 -``` - -#### Display Total Memory Line - -By default `free` command output comes with three columns (Memory, Buffers/Cache & Swap). To display consolidated total in separate line (Total (Mem+Swap), Used (Mem+(Used – Buffers/Cache)+Swap) & Free (Mem+(Used – Buffers/Cache)+Swap), add `-t` option with free command. - -``` -# free -t - total used free shared buffers cached -Mem: 32869744 25434276 7435468 0 412032 23361716 --/+ buffers/cache: 1660528 31209216 -Swap: 4095992 0 4095992 -Total: 36965736 27094804 42740676 -``` - -#### Run free with delay for better statistic - -By default free command display single statistics output which is not enough to troubleshoot further so, add delay (delay is the delay between updates in seconds) which capture the activity periodically. If you want to run free with 2 second delay, just use the below command (If you want more delay you can change as per your wish). - -The following command will run every 2 seconds until you exit. - -``` -# free -s 2 - total used free shared buffers cached -Mem: 32849392 25935844 6913548 188 182424 24632796 --/+ buffers/cache: 1120624 31728768 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25935288 6914104 188 182424 24632796 --/+ buffers/cache: 1120068 31729324 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25934968 6914424 188 182424 24632796 --/+ buffers/cache: 1119748 31729644 -Swap: 20970492 0 20970492 -``` - -#### Run free with delay & counts - -Alternatively you can run free command with delay and specific counts, once it reach the given counts then exit automatically. - -The following command will run every 2 seconds with 5 counts then exit automatically. - -``` -# free -s 2 -c 5 - total used free shared buffers cached -Mem: 32849392 25931052 6918340 188 182424 24632796 --/+ buffers/cache: 1115832 31733560 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931192 6918200 188 182424 24632796 --/+ buffers/cache: 1115972 31733420 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931348 6918044 188 182424 24632796 --/+ buffers/cache: 1116128 31733264 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931316 6918076 188 182424 24632796 --/+ buffers/cache: 1116096 31733296 -Swap: 20970492 0 20970492 - - total used free shared buffers cached -Mem: 32849392 25931308 6918084 188 182424 24632796 --/+ buffers/cache: 1116088 31733304 -Swap: 20970492 0 20970492 -``` - -#### Human readable format - -To print the human readable output, add `h` option with `free` command, which will print more detailed output compare with other options like m & g. - -``` -# free -h - total used free shared buff/cache available -Mem: 2.0G 1.6G 138M 20M 188M 161M -Swap: 2.0G 1.8G 249M -``` - -#### Split Buffers & Cached memory output - -By default `Buffers/Cached` memory output comes together. To split Buffers & Cached memory output, add `-w` option with free command. (This option is available on version 3.3.12). - -Note : See the above output, `Buffers/Cached` comes together. - -``` -# free -wh - total used free shared buffers cache available -Mem: 2.0G 1.6G 137M 20M 8.1M 183M 163M -Swap: 2.0G 1.8G 249M -``` - -#### Show Low and High Memory Statistics - -By default `free` command output comes without Low and High Memory Statistics. To display Show Low and High Memory Statistics, add `-l` option with free command. - -``` -# free -l - total used free shared buffers cached -Mem: 32849392 25931336 6918056 188 182424 24632808 -Low: 32849392 25931336 6918056 -High: 0 0 0 --/+ buffers/cache: 1116104 31733288 -Swap: 20970492 0 20970492 -``` - -#### Read more about free - -If you want to know more option which is available for free, simply navigate to man page. - -``` -# free --help -or -# man free -``` - --------------------------------------------------------------------------------- - -via: http://www.2daygeek.com/free-command-to-check-memory-usage-statistics-in-linux/ - -作者:[MAGESH MARUTHAMUTHU][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.2daygeek.com/author/magesh/ -[1]:http://www.2daygeek.com/smem-linux-memory-usage-statistics-reporting-tool/ -[2]:http://www.2daygeek.com/linux-vmstat-command-examples-tool-report-virtual-memory-statistics/ -[3]:http://www.2daygeek.com/author/magesh/ diff --git a/translated/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md b/translated/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md new file mode 100644 index 0000000000..291e4c010f --- /dev/null +++ b/translated/tech/20170208 free – A Standard Command to Check Memory Usage Statistics in Linux.md @@ -0,0 +1,220 @@ +free - 一个在 Linux 中检查内存使用统计(空闲和已用)的标准命令 +============================================================ + +我们都知道, IT 基础设施方面的大多数服务器(包括世界顶级超级计算机)都运行在 Linux 平台上,因为和其他操作系统相比, Linux 更加灵活。其他操作系统对于一些微乎其微的改动和补丁更新都需要重启,但是 Linux 不需要,只有对于一些关键补丁的更新, Linux 才会需要重启。 + +Linux 系统管理员面临的一大挑战是如何在没有任何停机时间的情况下维护系统的良好运行。管理内存使用是 Linux 管理员又一个具有挑战性的任务。`free` 是 Linux 中一个标准的并且被广泛使用的命令,它被用来分析内存统计(空闲和已用)。今天,我们将要讨论 `free` 命令以及它的一些有用选项。 + +推荐文章: + +* [smem - Linux 内存报告/统计工具][1] +* [vmstat - 一个报告虚拟内存统计的标准而又漂亮的工具][2] + +#### Free 命令是什么 + +free 命令能够显示系统中物理上的`空闲`和`已用`内存,还有`交换`内存,同时,也能显示被内核使用的`缓冲`和`缓存`。这些信息是通过解析文件 /proc/meninfo 而收集到的。 + +#### 显示系统内存 + +不带任何选项运行 `free` 命令会显示系统内存,包括`空闲`、`已用`、`缓冲`、`缓存`和`交换`的内存总数。 + +``` +# free + 总共 已用 空闲 共用 缓冲 缓存大小 +内存: 32869744 25434276 7435468 0 412032 23361716 +-/+ 缓冲/缓存: 1660528 31209216 +交换: 4095992 0 4095992 +``` + +输出有三行: + +* 第一行:表明全部内存、已用内存、空闲内存、共用内存(主要被 tmpfs(/proc/meninfo 中的 Shmem 项)使用)、用于缓冲的内存以及缓存内容大小。 + +* 全部:全部已安装内存(/proc/meminfo 中的 MemTotal 项) +* 已用:已用内存(全部计算 - 空间+缓冲+缓存) +* 空闲:未使用内存(/proc/meminfo 中的 MemFree 项) +* 共用:主要被 tmpfs 使用的内存(/proc/meminfo 中的 Shmem 项) +* 缓冲:被内核缓冲使用的内存(/proc/meminfo 中的 Buffers 项) +* 缓存:被页面缓存使用的内存(/proc/meminfo 中的 Cached and SSReclaimable 项) + +* 第二行:表明已用和空闲缓冲/缓存 +* 第三行:表明总交换内存(/proc/meminfo 中的 SwapTotal 项)、空闲内存(/proc/meminfo 中的 SwapFree 项)和已用交换内存。 + +#### 以 MB 为单位显示系统内存 + +默认情况下, `free` 命令以 `KB - Kilobytes` 为单位输出系统内存,这对于绝大多数管理员来说会有一点迷糊(当系统内存很大的时候,我们中的许多人需要把输出转化为以 MB 为单位,从而才能够理解内存大小)。为了避免这个迷惑,我们在 ‘free’ 命令后面加上 `-m` 选项,就可以立即得到以 ‘MB - Megabytes’ 为单位的输出。 + +``` +# free -m + 全部 已用 空闲 公用 缓冲 缓存 +内存: 32099 24838 7261 0 402 22814 +-/+ 缓冲/缓存: 1621 30477 +交换: 3999 0 3999 +``` + +如何从上面的输出中检查剩余多少空闲内存?主要基于`已用`和`空闲`两列。你可能在想,你只有很低的空闲内存,因为它只有 `10%`, 为什么? + +全部实际可用内存 = (全部内存 - 第 2 行已用内存) +全部内存 = 32099 +实际已用内存 = -1621 + +全部实际可用内存 = 30477 + +如果你的 Linux 版本是最新的,那么有一个查看实际空闲内存的选项,叫做 `available` ,对于旧的版本,请看显示 `-/+ buffers/cache` 那一行对应的‘空闲’一列。 + +如何从上面的输出中检查有多少实际已用内存?基于`已用`和`空闲`一列。你可能想,你已经使用了超过 `95%` 的内存。 + +全部实际已用内存 = 第一列‘已用’ - (第一列‘缓冲’ + ‘第一列缓存’) +已用内存 = 24838 +已用缓冲 = 402 +已用缓存 = 22814 + +全部实际已用内存 = 1621 + +#### 以 GB 为单位显示内存 + +默认情况下, `free` 命令会以 `KB - kilobytes` 为单位显示输出,这对于大多数管理员来说会有一些迷惑,所以我们使用上面的选项来获得以 `MB - Megabytes` 为单位的输出。但是,当服务器的内存很大(超过 100 GB 或 200 GB)时,上面的选项也会让人很迷惑。所以,在这个时候,我们可以在 `free` 命令后面加上 `-g` 选项,从而立即得到以 `GB - Gigabytes` 为单位的输出。 + +``` +# free -g + 全部 已用 空闲 共用 缓冲 缓存 +内存: 31 24 7 0 0 22 +-/+ 缓冲/缓存: 1 29 +交换: 3 0 3 +``` + +#### 显示全部内存线 + +默认情况下, `free` 命令的输出只有三列(内存、缓冲/缓存以及交换)。为了统一以分割线显示(全部(内存+交换)、已用(内存+(已用-缓冲/缓存)+交换)以及空闲(内存+(已用-缓冲/缓存)+交换),在 ‘free’ 命令后面加上 `-t` 选项 + +``` +# free -t + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32869744 25434276 7435468 0 412032 23361716 +-/+ 缓冲/缓存: 1660528 31209216 +交换: 4095992 0 4095992 +交换: 36965736 27094804 42740676 +``` + +#### 伴有延迟运行 free 命令从而更好的统计 + +默认情况下, free 命令只会显示单一的统计输出,这是不足够进一步排除故障的,所以,可以通过添加延迟(在几秒内更新的延迟)来定期统计内存活动。如果你想以两秒的延迟运行 free 命令,可以使用下面的命令(如果你想要更多的延迟,你可以按照你的意愿更改数值)。 + +下面的命令将会每 2 秒运行一次直到你退出: + +``` +# free -s 2 + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32849392 25935844 6913548 188 182424 24632796 +-/+ 缓冲/缓存: 1120624 31728768 +交换: 20970492 0 20970492 + + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32849392 25935288 6914104 188 182424 24632796 +-/+ 缓冲/缓存: 1120068 31729324 +交换: 20970492 0 20970492 + + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32849392 25934968 6914424 188 182424 24632796 +-/+ 缓冲/缓存: 1119748 31729644 +交换: 20970492 0 20970492 +``` + +#### 伴有延迟和计数运行 free 命令 + +另外,你可以伴随延迟和具体计数运行 free 命令,一旦达到具体计数,便自动退出 + +下面的命令将会每 2 秒运行一次 free 命令,计数 5 次以后自动退出 + +``` +# free -s 2 -c 5 + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32849392 25931052 6918340 188 182424 24632796 +-/+ 缓冲/缓存: 1115832 31733560 +交换: 20970492 0 20970492 + + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32849392 25931192 6918200 188 182424 24632796 +-/+ 缓冲/缓存: 1115972 31733420 +Swap: 20970492 0 20970492 + + 全部 已用 空闲 共用 缓冲 缓存 +内存: 32849392 25931348 6918044 188 182424 24632796 +-/+ 缓冲/缓存: 1116128 31733264 +交换: 20970492 0 20970492 + + 全部 已用 空闲  共用 缓冲 缓存 +内存: 32849392 25931316 6918076 188 182424 24632796 +-/+ 缓冲/缓存: 1116096 31733296 +交换: 20970492 0 20970492 + + 全部 已用 空闲 共用 缓冲  缓存 +内存: 32849392 25931308 6918084 188 182424 24632796 +-/+ 缓冲/缓存: 1116088 31733304 +交换: 20970492 0 20970492 +``` + +#### 人类可读格式 + +为了以人类可读的格式输出,在 `free` 命令的后面加上 `-h` 选项,和其他选项比如 `-m` 和 `-g` 相比,这将会打印出更多的细节输出。 + +``` +# free -h + 全部 已用 空闲 共用   + 缓冲/缓存  可用 +内存: 2.0G 1.6G 138M 20M 188M 161M +交换: 2.0G 1.8G 249M +``` + +#### 分离缓冲区和缓存内存输出 + +默认情况下, `缓冲/缓存` 内存输出是在一起的。为了分离缓冲和缓存内存输出,可以在 free 命令后面加上 `-w` 选项。(该选项在版本 3.3.12 上可用) + +注意:看上面的输出,`缓冲/缓存`是在一起的。 + +``` +# free -wh + 全部 已用 空闲 共用    缓冲 缓存 可用 +内存: 2.0G 1.6G 137M 20M 8.1M 183M 163M +交换: 2.0G 1.8G 249M +``` + +#### 显示最低和最高的内存统计 + +默认情况下, `free` 命令不会显示最低和最高的内存统计。为了显示最低和最高的内存统计,在 free 命令后面加上 `-l` 选项。 + +``` +# free -l + 全部 已用 空闲 共用       缓冲  缓存 +内存: 32849392 25931336 6918056 188 182424 24632808 +底: 32849392 25931336 6918056 +高: 0 0 0 +-/+ 缓冲/缓存: 1116104 31733288 +交换: 20970492 0 20970492 +``` + +#### 阅读关于 free 命令的更过信息 + +如果你想了解 free 命令的更多可用选项,只需查看 man 手册。 + + +``` +# free --help +or +# man free +``` + +-------------------------------------------------------------------------------- + +via: http://www.2daygeek.com/free-command-to-check-memory-usage-statistics-in-linux/ + +作者:[MAGESH MARUTHAMUTHU][a] +译者:[ucasFL](https://github.com/ucasFL) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.2daygeek.com/author/magesh/ +[1]:http://www.2daygeek.com/smem-linux-memory-usage-statistics-reporting-tool/ +[2]:http://www.2daygeek.com/linux-vmstat-command-examples-tool-report-virtual-memory-statistics/ +[3]:http://www.2daygeek.com/author/magesh/ From 89f1e16cfcfa55fefdcc33e843e79108d7728ca0 Mon Sep 17 00:00:00 2001 From: Ezio Date: Fri, 3 Mar 2017 09:20:04 +0800 Subject: [PATCH 017/190] translating --- ...o create your own Linux Distribution with Yocto on Ubuntu.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md b/sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md index 4bf98e2469..dd05b3eeb1 100644 --- a/sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md +++ b/sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @@ -1,3 +1,5 @@ +ezio is translating + How to create your own Linux Distribution with Yocto on Ubuntu ============================================================ From baa398d6f861859d4914aa4586b99b716a0f4e4c Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 3 Mar 2017 09:33:24 +0800 Subject: [PATCH 018/190] translating --- sources/tech/20170124 Compile-time assertions in Go.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170124 Compile-time assertions in Go.md b/sources/tech/20170124 Compile-time assertions in Go.md index 643c27c9d4..a0e870403c 100644 --- a/sources/tech/20170124 Compile-time assertions in Go.md +++ b/sources/tech/20170124 Compile-time assertions in Go.md @@ -1,3 +1,5 @@ +translating---geekpi + Compile-time assertions in Go ============================================================ From c813a78d0717ee289e657104da0f1bad084934a0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 3 Mar 2017 10:09:51 +0800 Subject: [PATCH 019/190] translating --- .../20170124 Compile-time assertions in Go.md | 143 ------------------ .../20170124 Compile-time assertions in Go.md | 141 +++++++++++++++++ 2 files changed, 141 insertions(+), 143 deletions(-) delete mode 100644 sources/tech/20170124 Compile-time assertions in Go.md create mode 100644 translated/tech/20170124 Compile-time assertions in Go.md diff --git a/sources/tech/20170124 Compile-time assertions in Go.md b/sources/tech/20170124 Compile-time assertions in Go.md deleted file mode 100644 index a0e870403c..0000000000 --- a/sources/tech/20170124 Compile-time assertions in Go.md +++ /dev/null @@ -1,143 +0,0 @@ -translating---geekpi - -Compile-time assertions in Go -============================================================ - - -This post is about a little-known way to make compile-time assertions in Go. You probably shouldn’t use it, but it is interesting to know about. - -As a warm-up, here’s a fairly well-known form of compile-time assertions in Go: Interface satisfaction checks. - -In this code ([playground][1]), the `var _ =` line ensures that type `W` is a `stringWriter`, as checked for by [`io.WriteString`][2]. - -``` -package main - -import "io" - -type W struct{} - -func (w W) Write(b []byte) (int, error) { return len(b), nil } -func (w W) WriteString(s string) (int, error) { return len(s), nil } - -type stringWriter interface { - WriteString(string) (int, error) -} - -var _ stringWriter = W{} - -func main() { - var w W - io.WriteString(w, "very long string") -} -``` - -If you comment out `W`’s `WriteString` method, the code will not compile: - -``` -main.go:14: cannot use W literal (type W) as type stringWriter in assignment: - W does not implement stringWriter (missing WriteString method) -``` - -This is useful. For most types that satisfy both `io.Writer` and `stringWriter`, if you eliminate the `WriteString` method, everything will continue to work as it did before, but with worse performance. - -Rather than trying to write a fragile test for a performance regression using [`testing.T.AllocsPerRun`][3], you can simply protect your code with a compile-time assertion. - -Here’s [a real world example of this technique from package io][4]. - -* * * - -OK, onward to obscurity! - -Interface satisfaction checks are great. But what if you wanted to check a plain old boolean expression, like `1+1==2`? - -Consider this code ([playground][5]): - -``` -package main - -import "crypto/md5" - -type Hash [16]byte - -func init() { - if len(Hash{}) < md5.Size { - panic("Hash is too small") - } -} - -func main() { - // ... -} -``` - -`Hash` is perhaps some kind of abstracted hash result. The `init` function ensures that it will work with [crypto/md5][6]. If you change `Hash` to be (say) `[8]byte`, it’ll panic when the process starts. However, this is a run-time check. What if we wanted it to fail earlier? - -Here’s how. (There’s no playground link, because this doesn’t work on the playground.) - -``` -package main - -import "C" - -import "crypto/md5" - -type Hash [16]byte - -func hashIsTooSmall() - -func init() { - if len(Hash{}) < md5.Size { - hashIsTooSmall() - } -} - -func main() { - // ... -} -``` - -Now if you change `Hash` to be `[8]byte`, it will fail during compilation. (Actually, it fails during linking. Close enough for our purposes.) - -``` -$ go build . -# demo -main.hashIsTooSmall: call to external function -main.init.1: relocation target main.hashIsTooSmall not defined -main.init.1: undefined: "main.hashIsTooSmall" -``` - -What’s going on here? - -`hashIsTooSmall` is [declared without a function body][7]. The compiler assumes that someone else will provide an implementation, perhaps an assembly routine. - -When the compiler can prove that `len(Hash{}) < md5.Size`, it eliminates the code inside the if statement. As a result, no one uses the function `hashIsTooSmall`, so the linker eliminates it. No harm done. As soon as the assertion fails, the code inside the if statement is preserved.`hashIsTooSmall` can’t be eliminated. The linker then notices that no one else has provided an implementation for the function and fails with an error, which was the goal. - -One last oddity: Why `import "C"`? The go tool knows that in normal Go code, all functions must have bodies, and instructs the compiler to enforce that. By switching to cgo, we remove that check. (If you run `go build -x` on the code above, without the `import "C"` line, you will see that the compiler is invoked with the `-complete` flag.) An alternative to adding `import "C"` is to [add an empty file called `foo.s` to the package][8]. - -I know of only one use of this technique, in the [compiler test suite][9]. There are other [imaginable places to apply it][10], but no one has bothered. - -And that’s probably how it should be. :) - - --------------------------------------------------------------------------------- - -via: http://commaok.xyz/post/compile-time-assertions - -作者:[Josh Bleecher Snyder][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://twitter.com/commaok -[1]:https://play.golang.org/p/MJ6zF1oNsX -[2]:https://golang.org/pkg/io/#WriteString -[3]:https://golang.org/pkg/testing/#AllocsPerRun -[4]:https://github.com/golang/go/blob/go1.8rc2/src/io/multi.go#L72 -[5]:https://play.golang.org/p/mjIMWsWu4V -[6]:https://golang.org/pkg/crypto/md5/ -[7]:https://golang.org/ref/spec#Function_declarations -[8]:https://github.com/golang/go/blob/go1.8rc2/src/os/signal/sig.s -[9]:https://github.com/golang/go/blob/go1.8rc2/test/fixedbugs/issue9608.dir/issue9608.go -[10]:https://github.com/golang/go/blob/go1.8rc2/src/runtime/hashmap.go#L261 diff --git a/translated/tech/20170124 Compile-time assertions in Go.md b/translated/tech/20170124 Compile-time assertions in Go.md new file mode 100644 index 0000000000..ad987be541 --- /dev/null +++ b/translated/tech/20170124 Compile-time assertions in Go.md @@ -0,0 +1,141 @@ +Go 语言编译期断言 +============================================================ + + +这篇文章是关于一个鲜为人知的方法让 Go 在编译期断言。你可能不会使用它,但是了解一下也很有趣。 + +作为一个热身,这里是一个在 Go 中相当知名的编译时断言:接口满意度检查。 + +在这段代码([playground][1])中,`var _ =` 行确保类型 `W` 是一个 `stringWriter`,由 [`io.WriteString`][2] 检查。 + +``` +package main + +import "io" + +type W struct{} + +func (w W) Write(b []byte) (int, error) { return len(b), nil } +func (w W) WriteString(s string) (int, error) { return len(s), nil } + +type stringWriter interface { + WriteString(string) (int, error) +} + +var _ stringWriter = W{} + +func main() { + var w W + io.WriteString(w, "very long string") +} +``` + +如果你注释掉了 `W` 的 `WriteString` 方法,代码将无法编译: + +``` +main.go:14: cannot use W literal (type W) as type stringWriter in assignment: + W does not implement stringWriter (missing WriteString method) +``` + +这是很有用的。对于大多数同时满足 `io.Writer` 和 `stringWriter` 的类型,如果你删除 `WriteString` 方法,一切都会像以前一样继续工作,但性能较差。 + +你可以使用编译时断言保护你的代码,而不是试图使用[`testing.T.AllocsPerRun'][3]为性能回归编写一个脆弱的测试。 + +这是[一个实际的 io 包中的技术例子][4]。 + +* * * + +好的,让我们隐晦一点! + +接口满意检查是很棒的。但是如果你想检查一个简单的布尔表达式,如 `1 + 1 == 2` ? + +考虑这个代码([playground] [5]): + +``` +package main + +import "crypto/md5" + +type Hash [16]byte + +func init() { + if len(Hash{}) < md5.Size { + panic("Hash is too small") + } +} + +func main() { + // ... +} +``` + +`Hash` 可能是某种抽象的哈希结果。`init` 函数确保它将与[crypto/md5][6]一起工作。如果你改变 `Hash` 为(也就是)`[8]byte`,它会在进程启动时发生混乱。但是,这是一个运行时检查。如果我们想要早点发现怎么办? + +就是这样。(没有 playground 链接,因为这在 playground 上不起作用。) + +``` +package main + +import "C" + +import "crypto/md5" + +type Hash [16]byte + +func hashIsTooSmall() + +func init() { + if len(Hash{}) < md5.Size { + hashIsTooSmall() + } +} + +func main() { + // ... +} +``` + +现在如果你改变 `Hash` 为 `[8]byte`,它将在编译过程中失败。(实际上,它在链接过程中失败。足够接近我们的目标了。) + +``` +$ go build . +# demo +main.hashIsTooSmall: call to external function +main.init.1: relocation target main.hashIsTooSmall not defined +main.init.1: undefined: "main.hashIsTooSmall" +``` + +这里发生了什么? + +`hashIsTooSmall` 是[一个没有函数体的声明][7]。编译器假定别人将提供一个实现,也许是一个汇编程序。 + +当编译器可以证明 `len(Hash {}) Date: Fri, 3 Mar 2017 10:12:33 +0800 Subject: [PATCH 020/190] PUB:20170119 Get to know Tuleap for project management.md @geekpi --- ...t to know Tuleap for project management.md | 77 +++++++++++++++++++ ...t to know Tuleap for project management.md | 77 ------------------- 2 files changed, 77 insertions(+), 77 deletions(-) create mode 100644 published/20170119 Get to know Tuleap for project management.md delete mode 100644 translated/tech/20170119 Get to know Tuleap for project management.md diff --git a/published/20170119 Get to know Tuleap for project management.md b/published/20170119 Get to know Tuleap for project management.md new file mode 100644 index 0000000000..114618b6d8 --- /dev/null +++ b/published/20170119 Get to know Tuleap for project management.md @@ -0,0 +1,77 @@ +将 Tuleap 用于软件项目管理 +============================================================ + +> Tuleap 正在被 Eclipse 基金会使用,用来取代 Bugzilla + + ![Get to know Tuleap for project management](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=kOixOaEU "Get to know Tuleap for project management") + +图片提供:opensource.com + +Tuleap 是一个独特的开源项目管理工具,目前发展势头很好,现在,每个月它会出一个大版本。它还被列在 [2015 年五大开源项目管理工具][1]和 [2016 年十一个名列前茅项目管理工具][2]中。 + +Manuel Vacelet 是开发 Tuleap 项目的 Enalean 公司的联合创始人和 CTO,他说:“Tuleap 是一个完整用于托管软件项目的 GPLv2 平台,它提供了一个集中化的平台,在这里,团队可以找到他们所需的所有工具,追踪他们软件项目的生命周期。他们可以找到项目管理(Scrum、看板、瀑布、混合等等)、源码控制(git 和 svn)和代码审查(pull 请求和 gerrit)、持续集成、问题跟踪、wiki 和文档等的支持。” + +在这次采访中,我会和 Manuel 讨论如何开始使用它,以及如何以开源方式管理 Tuleap。 + +**Nitish Tiwari(以下简称 NT): 为什么 Tuleap 项目很重要? ** + +**Manuel Vacelet(以下简称 MV):** Tuleap 很重要是因为我们坚信一个成功的(软件)项目必须涉及所有利益相关者:开发人员、项目经理、QA、客户和用户。 + +很久以前,我还是一个 SourceForge 衍生项目的实习生(当时 SourceForge 还是一个自由开源项目),几年后它变成了 Tuleap。 我的第一个贡献是将 PhpWiki 集成到该工具中(不要告诉任何人,代码写的很糟)。 + +现在,我很高兴作为首席技术官和产品负责人在 Enalean 工作,该公司是 Tuleap 项目的主要贡献公司。 + +**NT:让我们聊聊技术方面。** + +**MV:** Tuleap 核心系统是基于 LAMP 并且架构于 CentOS 之上。如今的开发栈是 AngularJS (v1)、REST 后端(PHP)、基于 NodeJS 的实时推送服务器。但如果你想成为一名 Tuleap 全栈开发人员,你还将需要接触 bash、Perl、Python、Docker、Make 等等。 + +说到技术方面,需要重点强调的 Tuleap 的一个显著特征是它的可扩展性。一个运行在单服务器上的 Tuleap 单一实例、并且没有复杂的 IT 架构,可以处理超过 10000 人的访问。 + +**NT:给我们说下该项目的用户和社区。有谁参与?他们如何使用这个工具?** + +**MV:** 用户非常多样化。从使用 Tuleap 跟踪他们的项目进度并管理他们的源代码的小型初创公司,到非常大的公司,如法国电信运营商 Orange,它为超过 17000 用户部署了它,并托管了 5000 个项目。 + +许多用户依靠 Tuleap 来促进敏捷项目并跟踪其进度。开发人员和客户共享同一个工作区。客户不需要学习如何使用 GitHub,也不需要开发人员做额外的工作,就可以将其工作转换到“客户可访问”平台。 + +今年,Tuleap 被 [Eclipse 基金会][3]所使用,取代了 Bugzilla。 + +印度电子信息技术部使用 Tuleap 创建了印度政府开放电子政务的开放式协作开发平台。 + +Tuleap 有多种不同的使用方式和配置。有些人使用它作为 Drupal 客户门户网站的后端; 它们通过 REST API 插入到 Tuleap 中以管理 bug 和服务请求。 + +甚至一些建筑师也使用它来管理他们的工作进度和 AutoCAD 文件。 + +**NT:Tuleap 是否做了一些特别的事,使社区更安全,更多样化?** + +**MV:** 我们还没有创建“行为准则”;本社区非常平和而欢迎新人,但我们有计划这样做。Tuleap 的开发人员和贡献者来自不同的国家(例如加拿大、突尼斯、法国)。而且 35% 的活跃开发者和贡献者是女性。 + +**NT:由社区提议的 Tuleap 功能的百分比是多少?** + +**MV:** 几乎 100% 的功能是由社区驱动的。 + +这是 Enalean 的关键挑战之一:找到一种商业模式,使我们能以正确的方式做开源软件。对我们来说,“开放核心”模式(其中应用程序的核心是开放的,但有趣和有用的部分是封闭源的)不是正确的方法,因为你最终还是要依赖闭源。因此,我们发明了 [OpenRoadmap][4],这种方式是我们从社区和最终用户那里收集需求,并找公司来为此买单。 + + +-------------------------------------------------------------------------------- + +作者简介: + +![](https://opensource.com/sites/default/files/styles/profile_pictures/public/nitish-crop.png?itok=h4PaLDQq) + +Nitish 是一名专业的软件开发人员并对开源有热情。作为一本基于 Linux 的杂志的技术作者,他会尝试新的开源工具。他喜欢阅读和探索任何开源相关的事情。在他的空闲时间,他喜欢读励志书。他目前正在构建 DevUp - 一个让开发人员以真正的方式连接所有工具和拥抱 DevOps 的平台。你可以在 Twitter 上关注他 @tiwari_nitish。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/1/interview-Tuleap-project + +作者:[Nitish Tiwari][a] +译者:[geekpi](https://github.com/geeki) +校对:[jamsinepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/tiwarinitish86 +[1]:https://opensource.com/business/15/1/top-project-management-tools-2015 +[2]:https://opensource.com/business/16/3/top-project-management-tools-2016 +[3]:http://www.eclipse.org/ +[4]:https://blog.enalean.com/enalean-open-roadmap-how-it-works/ diff --git a/translated/tech/20170119 Get to know Tuleap for project management.md b/translated/tech/20170119 Get to know Tuleap for project management.md deleted file mode 100644 index 7045120b6d..0000000000 --- a/translated/tech/20170119 Get to know Tuleap for project management.md +++ /dev/null @@ -1,77 +0,0 @@ -开始了解 Tuleap 用于项目管理 -============================================================ - -### Tuleap 正在被 Eclipse 基金会使用,用来取代 Bugzilla - - ![Get to know Tuleap for project management](https://opensource.com/sites/default/files/styles/image-full-size/public/images/education/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=kOixOaEU "Get to know Tuleap for project management") - -图片提供:opensource.com - -Tuleap 是一个独特的开源项目管理工具,目前发展势头很好,现在,每个月它会出一个大版本。它还被列在[ 2015 年前 5 大开源项目管理工具][1]和[ 2016 年前 11 个项目管理工具][2]中。 - -Manuel Vacelet,Enalean 的联合创始人和 CTO,Tuleap 项目背后的公司说:“Tuleap 是一个完整的 GPLv2 平台,用于托管软件项目,它提供了一个中心位置,在这里团队可以找到他们所需的所有工具,成功地追踪他们软件项目的生命周期。他们可以找到项目管理(Scrum、看板、瀑布、混合等等)、源码控制(git 和 svn)和代码审查(pull 请求和 gerrit)、持续集成、问题跟踪、wiki 和文档等的支持。” - -在这次采访中,我会和 Manuel 讨论如何开始使用它,以及如何以开源方式管理 Tuleap。 - -**Nitish Tiwari (NT): 为什么 Tuleap 项目很重要? ** - -**Manuel Vacelet(MV):** Tuleap 很重要是因为我们坚信一个成功的(软件)项目必须涉及所有利益相关者:开发人员、项目经理、QA、客户和用户。 - -很久以前,我是 SourceForge 的一个实习生(当 SourceForge 还是一个自由开源项目时),它最终会在几年后将成为 Tuleap。 我的第一个贡献是将 PhpWiki 集成到该工具中(不要告诉任何人,代码写的很糟)。 - -现在,我很高兴作为首席技术官和产品负责人在 Enalean 工作,该公司是 Tuleap 项目的主要贡献公司。 - -**NT: 给我们说下技术方面。** - -**MV:** Tuleap 核心系统是基于 LAMP 并且依赖于 CentOS。如今的开发栈是 AngularJS (v1)、REST 后端(PHP)、基于 NodeJS 的实时推送服务器。但如果你想成为一名 Tuleap 全栈开发人员,你还将需要接触 bash、Perl、Python、Docker、Make。 - -说到技术方面,需要重点强调的 Tuleap 的一个显著特征是它的可扩展性。Tuleap 在单实例、单服务器上并且没有复杂的 IT,可以处理超过 10,000 人。 - -**NT:给我们说下关于项目的用户和社区。有谁参与?他们如何使用这个工具?** - -**MV:** 用户非常多样化。从小型初创公司使用 Tuleap 跟踪他们的项目进度并管理他们的源代码到非常大的公司,如法国电信运营商 Orange,它部署了超过 17,000 用户和 5000 个项目。 - -许多用户依靠 Tuleap 来促进敏捷项目并跟踪其进度。开发人员和客户共享同一个工作区。客户不需要学习如何使用 GitHub,也不需要开发人员做额外的工作,将其工作转换到“客户可访问”平台。 - -今年,Tuleap 被[ Eclipse 基金会][3]使用,取代了Bugzilla。 - -印度电子信息技术部使用 Tuleap 创建了印度政府开放电子政务的开放式协作开发平台。 - -Tuleap 有多种不同的使用方式和配置。有些人使用它作为 Drupal 客户门户网站的后端; 它们通过 REST API 插入到 Tuleap 中以管理 bug 和服务请求。 - -甚至一些建筑师也使用它来管理他们的工作进度和 AutoCAD 文件。 - -**NT:Tuleap 是否做了一些特别的事,使社区更安全,更多样化?** - -**MV:** 我们还没有创建“行为准则”; 本社区非常平和以及受欢迎,但我们有计划这样做。Tuleap 的开发人员和贡献者来自不同的国家(例如加拿大、突尼斯、法国)。而且 35% 的活跃开发者和贡献者是女性。 - -**NT:由社区建议的 Tuleap 功能的百分比是多少?** - -**MV:** 几乎 100% 的功能是由社区驱动的。 - -这是 Enalean 的关键挑战之一:找到一种商业模式,使我们能以正确的方式做开源软件。对我们来说,“开放核心”模式(其中应用程序的核心是开放的,但有趣和有用的部分是封闭源的)不是正确的方法,因为你最终还是要依赖闭源。因此,我们发明了[OpenRoadmap][4],这种方式是我们从社区和最终用户那里收集需求,并找公司来支付。 - - --------------------------------------------------------------------------------- - -作者简介: - -![](https://opensource.com/sites/default/files/styles/profile_pictures/public/nitish-crop.png?itok=h4PaLDQq) - -Nitish 是一名专业的软件开发人员并对开源有热情。作为基于 Linux 的杂志的技术作者,他会尝试新的开源工具。他喜欢阅读和探索任何开源。在他的空闲时间,他喜欢读励志书。他目前正在构建 DevUp - 一个让开发人员以真正的方式连接所有工具和拥抱 DevOps 的平台。你可以在 Twitter 上关注他 @tiwari_nitish。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/1/interview-Tuleap-project - -作者:[Nitish Tiwari][a] -译者:[geekpi](https://github.com/geeki) -校对:[jamsinepeng](https://github.com/jasminepeng) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/tiwarinitish86 -[1]:https://opensource.com/business/15/1/top-project-management-tools-2015 -[2]:https://opensource.com/business/16/3/top-project-management-tools-2016 -[3]:http://www.eclipse.org/ -[4]:https://blog.enalean.com/enalean-open-roadmap-how-it-works/ From 64ca2b00799bce2079169afcad61a51887e06271 Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 3 Mar 2017 10:36:22 +0800 Subject: [PATCH 021/190] PRF:20170116 Use Docker remotely on Atomic Host.md @geekpi --- ...0116 Use Docker remotely on Atomic Host.md | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/translated/tech/20170116 Use Docker remotely on Atomic Host.md b/translated/tech/20170116 Use Docker remotely on Atomic Host.md index 114aa07bd9..580271019b 100644 --- a/translated/tech/20170116 Use Docker remotely on Atomic Host.md +++ b/translated/tech/20170116 Use Docker remotely on Atomic Host.md @@ -1,21 +1,21 @@ -[远程在 Atomic 主机上使用 Docker][1] ---------------------- +在 Atomic 主机上远程使用 Docker +========== - ![remote-atomic-docker](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/remote-atomic-docker-945x400.jpg) +![remote-atomic-docker](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/remote-atomic-docker-945x400.jpg) -来自 [Atomic 项目][2] 的 Atomic 主机是一个基于轻量级容器的操作系统,它可以运行 Linux 容器。它已被优化为用作云环境的容器运行时系统。例如,它可以托管 Docker 守护进程和容器。有时,你可能需要在该主机上运行 docker 命令,并从其他地方管理服务器。本文介绍如何远程访问 Fedora Atomic 主机上的[Docker][3]守护进程,[你可以在这里下载到它][4]。整个过程由[Ansible][5]自动完成 - 在涉及到自动化的一切上,这是一个伟大的工具。 +来自 [Atomic 项目][2] 的 Atomic 主机是一个轻量级的容器基于的操作系统,它可以运行 Linux 容器。它已被优化为用作云环境的容器运行时系统。例如,它可以托管 Docker 守护进程和容器。有时,你可能需要在该主机上运行 docker 命令,并从其他地方管理服务器。本文介绍如何远程访问 Fedora Atomic 主机([你可以在这里下载到它][4])上的 [Docker][3] 守护进程。整个过程由 [Ansible][5] 自动完成 - 在涉及到自动化的一切上,这真是一个伟大的工具! -### 一份安全笔记 +### 安全备忘录 -由于我们通过网络连接,所以我们使用[TLS][6]保护 Docker 守护进程。此过程需要客户端证书和服务器证书。OpenSSL 包用于创建用于建立 TLS 连接的证书密钥。这里,Atomic 主机运行守护程序,我们的本地的 [Fedora Workstation][7] 充当客户端。 +由于我们通过网络连接,所以我们使用 [TLS][6] 保护 Docker 守护进程。此过程需要客户端证书和服务器证书。OpenSSL 包用于创建用于建立 TLS 连接的证书密钥。这里,Atomic 主机运行守护程序,我们的本地的 [Fedora Workstation][7] 充当客户端。 -在你按照这些步骤进行之前,请注意,_任何_在客户端上可以访问 TLS 证书的进程在服务器上具有**完全根访问权限。** 因此,客户端可以在服务器上做任何它想做的事情。因此,我们需要仅向可信任的特定客户端主机授予证书访问权限。你应该将客户端证书仅复制到完全由你控制的客户端主机。即使在这种情况下,客户端机器的安全也至关重要。 +在你按照这些步骤进行之前,请注意,_任何_在客户端上可以访问 TLS 证书的进程在服务器上具有**完全的 root 访问权限**。 因此,客户端可以在服务器上做任何它想做的事情。我们需要仅向可信任的特定客户端主机授予证书访问权限。你应该将客户端证书仅复制到完全由你控制的客户端主机。但即使在这种情况下,客户端机器的安全也至关重要。 -但是,此方法只是远程访问守护程序的一种方法。编排工具通常提供更安全的控制。下面的简单方法适用于个人实验,但可能不适合开放式网络。 +不过,此方法只是远程访问守护程序的一种方法。编排工具通常提供更安全的控制。下面的简单方法适用于个人实验,可能不适合开放式网络。 ### 获取 Ansible role -[Chris Houseknecht][8] 写了一个 Ansible role,它会创造所需的所有证书。这样,你不需要手动运行 _openssl_ 命令了。 这些在[ Ansible role 仓库][9]中提供。将它克隆到你当前的工作主机。 +[Chris Houseknecht][8] 写了一个 Ansible role,它会创造所需的所有证书。这样,你不需要手动运行 `openssl` 命令了。 这些在 [Ansible role 仓库][9]中提供。将它克隆到你当前的工作主机。 ``` $ mkdir docker-remote-access @@ -25,7 +25,7 @@ $ git clone https://github.com/ansible/role-secure-docker-daemon.git ### 创建配置文件 -接下来,你必须创建 Ansible 配置文件、inventory 和 playbook 文件以设置客户端和守护进程。以下说明在 Atomic 主机上创建客户端和服务器证书。然后,获取客户端证书到本地。最后,它们会配置守护进程以及客户端,使它们能彼此交互。 +接下来,你必须创建 Ansible 配置文件、清单(inventory)和剧本(playbook)文件以设置客户端和守护进程。以下说明在 Atomic 主机上创建客户端和服务器证书。然后,获取客户端证书到本地。最后,它们会配置守护进程以及客户端,使它们能彼此交互。 这里是你需要的目录结构。如下所示,创建下面的每个文件。 @@ -38,29 +38,34 @@ docker-remote-access/ └── role-secure-docker-daemon ``` -### _ansible.cfg_ +`ansible.cfg`: ``` - $ vim ansible.cfg +$ vim ansible.cfg +``` +``` [defaults] inventory=inventory ``` -### _inventory_ +清单文件(`inventory`): ``` - $ vim inventory +$ vim inventory +``` +``` [daemonhost] 'IP_OF_ATOMIC_HOST' ansible_ssh_private_key_file='PRIVATE_KEY_FILE' ``` -将 inventory 中的 _IP_OF_ATOMIC_HOST_ 替换为 Atomic 主机的 IP。将 _PRIVATE_KEY_FILE_ 替换为本地系统上的 SSH 私钥文件的位置。 +将清单文件(`inventory`) 中的 `IP_OF_ATOMIC_HOST` 替换为 Atomic 主机的 IP。将 `PRIVATE_KEY_FILE` 替换为本地系统上的 SSH 私钥文件的位置。 -### _remote-access.yml_ +剧本文件(`remote-access.yml`): ``` $ vim remote-access.yml ---- +``` +``` - name: Docker Client Set up hosts: daemonhost gather_facts: no @@ -130,7 +135,7 @@ $ vim remote-access.yml ### 访问 Atomic 主机 -现在运行 Ansible playbook: +现在运行 Ansible 剧本: ``` $ ansible-playbook remote-access.yml @@ -138,9 +143,9 @@ $ ansible-playbook remote-access.yml 确保 tcp 端口 2376 在你的 Atomic 主机上打开了。如果你在使用 Openstack,请在安全规则中添加 TCP 端口 2376。 如果你使用 AWS,请将其添加到你的安全组。 -现在,在你的工作站上作为普通用户运行的 _docker_ 命令与 Atomic 主机的守护进程通信了,并在那里执行命令。你不需要手动 _ssh_ 或在 Atomic 主机上发出命令。这允许你远程、轻松、安全地启动容器化应用程序。 +现在,在你的工作站上作为普通用户运行的 `docker` 命令与 Atomic 主机的守护进程通信,并在那里执行命令。你不需要手动 `ssh` 或在 Atomic 主机上发出命令。这可以让你远程、轻松、安全地启动容器化应用程序。 -如果你想克隆 playbook 和配置文件,这里有[一个可用的 git 仓库][10]。 +如果你想克隆 Ansible 剧本和配置文件,这里是 [git 仓库][10]。 [ ![docker-daemon](https://cdn.fedoramagazine.org/wp-content/uploads/2017/01/docker-daemon.jpg) @@ -152,7 +157,7 @@ via: https://fedoramagazine.org/use-docker-remotely-atomic-host/ 作者:[Trishna Guha][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 09256736ba3ecad57c30f796005471b28b7a10c7 Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 3 Mar 2017 10:36:36 +0800 Subject: [PATCH 022/190] PUB:20170116 Use Docker remotely on Atomic Host.md @geekpi --- .../20170116 Use Docker remotely on Atomic Host.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170116 Use Docker remotely on Atomic Host.md (100%) diff --git a/translated/tech/20170116 Use Docker remotely on Atomic Host.md b/published/20170116 Use Docker remotely on Atomic Host.md similarity index 100% rename from translated/tech/20170116 Use Docker remotely on Atomic Host.md rename to published/20170116 Use Docker remotely on Atomic Host.md From 1e8f4d3077be35e01b8d8ebc8915173cc878ebfc Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 3 Mar 2017 10:37:01 +0800 Subject: [PATCH 023/190] PRF:20160917 A Web Crawler With asyncio Coroutines.md PART --- ...7 A Web Crawler With asyncio Coroutines.md | 102 +++++++++--------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md index 8e9abf198f..da20b9ad1b 100644 --- a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md +++ b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md @@ -135,18 +135,18 @@ def loop(): 用我们刚刚建立的异步框架,怎么才能完成一个网络爬虫?即使是一个简单的网页下载程序也是很难写的。 -首先,我们有一个未获取的URL集合,和一个已经解析过的URL集合。 +首先,我们有一个尚未获取的 URL 集合,和一个已经解析过的 URL 集合。 ```python urls_todo = set(['/']) seen_urls = set(['/']) ``` -这两个集合加在一起就是所有的URL。用"/"初始化它们。 +`seen_urls` 集合包括 `urls_todo` 和已经完成的 URL。用根 URL `/` 初始化它们。 -获取一个网页需要一系列的回调。在套接字连接建立时`connected`回调触发,它向服务器发送一个GET请求。但是它要等待响应,所以我们需要注册另一个回调函数,当回调被调用,它也不能一次读取完整的请求,所以,需要再一次注册,如此反复。 +获取一个网页需要一系列的回调。在套接字连接建立时会触发 `connected` 回调,它向服务器发送一个 GET 请求。但是它要等待响应,所以我们需要注册另一个回调函数;当该回调被调用,它仍然不能读取到完整的请求时,就会再一次注册回调,如此反复。 -让我们把这些回调放在一个`Fetcher`对象中,它需要一个URL,一个套接字,还需要一个地方保存返回的字节: +让我们把这些回调放在一个 `Fetcher` 对象中,它需要一个 URL,一个套接字,还需要一个地方保存返回的字节: ```python class Fetcher: @@ -156,7 +156,7 @@ class Fetcher: self.sock = None ``` -我们的入口点在`Fetcher.fetch`: +我们的入口点在 `Fetcher.fetch`: ```python # Method on Fetcher class. @@ -174,7 +174,7 @@ class Fetcher: self.connected) ``` -`fetch`方法从连接一个套接字开始。但是要注意这个方法在连接建立前就返回了。它必须返回到事件循环中等待连接建立。为了理解为什么要要这样,假设我们程序的整体结构如下: +`fetch` 方法从连接一个套接字开始。但是要注意这个方法在连接建立前就返回了。它必须将控制返回到事件循环中等待连接建立。为了理解为什么要这样做,假设我们程序的整体结构如下: ```python # Begin fetching http://xkcd.com/353/ @@ -188,9 +188,9 @@ while True: callback(event_key, event_mask) ``` -所有的事件提醒都在事件循环中的`select`函数后处理。所以`fetch`必须把控制权交给事件循环。这样我们的程序才能知道什么时候连接已建立,接着循环调用`connected`回调,它已经在`fetch`方法中注册过。 +当调用 `select` 函数后,所有的事件提醒才会在事件循环中处理,所以 `fetch` 必须把控制权交给事件循环,这样我们的程序才能知道什么时候连接已建立,接着循环调用 `connected` 回调,它已经在上面的 `fetch` 方法中注册过。 -这里是我们`connected`方法的实现: +这里是我们的 `connected` 方法的实现: ```python # Method on Fetcher class. @@ -206,7 +206,7 @@ while True: self.read_response) ``` -这个方法发送一个GET请求。一个真正的应用会检查`send`的返回值,以防所有的信息没能一次发送出去。但是我们的请求很小,应用也不复杂。它只是简单的调用`send`,然后等待响应。当然,它必须注册另一个回调并把控制权交给事件循环。接下来也是最后一个回调函数`read_response`,它处理服务器的响应: +这个方法发送一个 GET 请求。一个真正的应用会检查 `send` 的返回值,以防所有的信息没能一次发送出去。但是我们的请求很小,应用也不复杂。它只是简单的调用 `send`,然后等待响应。当然,它必须注册另一个回调并把控制权交给事件循环。接下来也是最后一个回调函数 `read_response`,它处理服务器的响应: ```python # Method on Fetcher class. @@ -231,13 +231,13 @@ while True: stopped = True ``` -这个回调在每次selector发现套接字*可读*时被调用,可读有两种情况:套接字接受到数据或它被关闭。 +这个回调在每次 `selector` 发现套接字*可读*时被调用,可读有两种情况:套接字接受到数据或它被关闭。 -这个回调函数从套接字读取4K数据。如果没有4k,那么有多少读多少。如果比4K多,`chunk`只包4K数据并且这个套接字保持可读,这样在事件循环的下一个周期,会在次回到这个回调函数。当响应完成时,服务器关闭这个套接字,`chunk`为空。 +这个回调函数从套接字读取 4K 数据。如果不到 4k,那么有多少读多少。如果比 4K 多,`chunk` 中只包 4K 数据并且这个套接字保持可读,这样在事件循环的下一个周期,会再次回到这个回调函数。当响应完成时,服务器关闭这个套接字,`chunk` 为空。 -没有展示的`parse_links`方法,它返回一个URL集合。我们为每个新的URL启动一个fetcher。注意一个使用异步回调方式编程的好处:我们不需要为共享数据加锁,比如我们往`seen_urls`增加新链接时。这是一种非抢占式的多任务,它不会在我们代码中的任意一个地方中断。 +这里没有展示的 `parse_links` 方法,它返回一个 URL 集合。我们为每个新的 URL 启动一个 fetcher。注意一个使用异步回调方式编程的好处:我们不需要为共享数据加锁,比如我们往 `seen_urls` 增加新链接时。这是一种非抢占式的多任务,它不会在我们代码中的任意一个地方被打断。 -我们增加了一个全局变量`stopped`,用它来控制这个循环: +我们增加了一个全局变量 `stopped`,用它来控制这个循环: ```python stopped = False @@ -250,13 +250,13 @@ def loop(): callback() ``` -一旦所有的网页被下载下来,fetcher停止这个事件循环,程序退出。 +一旦所有的网页被下载下来,fetcher 停止这个事件循环,程序退出。 这个例子让异步编程的一个问题明显的暴露出来:意大利面代码。 -我们需要某种方式来表达一串计算和I/O操作,并且能够调度多个这样的操作让他们并发的执行。但是,没有线程你不能把这一串操作写在一个函数中:当函数开始一个I/O操作,它明确的把未来所需的状态保存下来,然后返回。你需要考虑如何写这个状态保存的代码。 +我们需要某种方式来表达一系列的计算和 I/O 操作,并且能够调度多个这样的系列操作让它们并发的执行。但是,没有线程你不能把这一系列操作写在一个函数中:当函数开始一个 I/O 操作,它明确的把未来所需的状态保存下来,然后返回。你需要考虑如何写这个状态保存的代码。 -让我们来解释下这到底是什么意思。考虑在线程中使用通常的阻塞套接字来获取一个网页时是多么简单。 +让我们来解释下这到底是什么意思。先来看一下在线程中使用通常的阻塞套接字来获取一个网页时是多么简单。 ```python # Blocking version. @@ -276,11 +276,11 @@ def fetch(url): q.add(links) ``` -在一个套接字操作和下一个操作之间这个函数到底记住了什么?它有一个套接字,一个URL和一个可增长的`response`。运行在线程中的函数使用编程语言的基本功能,栈中的局部变量来保存临时的状态。这样的函数有一个"continuation"----在I/O结束后它要执行的代码。运行时通过线程的指令指针来记住这个continuation。你不必考虑怎么在I/O操作后恢复局部变量和这个continuation。语言本身的特性帮你解决。 +在一个套接字操作和下一个操作之间这个函数到底记住了什么状态?它有一个套接字,一个 URL 和一个可增长的 `response`。运行在线程中的函数使用编程语言的基本功能来在栈中的局部变量保存这些临时状态。这样的函数也有一个“continuation”——它会在 I/O 结束后执行这些代码。运行时环境通过线程的指令指针来记住这个 continuation。你不必考虑怎么在 I/O 操作后恢复局部变量和这个 continuation。语言本身的特性帮你解决。 -但是用一个基于回调的异步框架,这些语言特性不能提供一点帮助。当等待I/O操作时,一个函数必须明确的保存它的状态,因为它会在I/O操作完成之前返回并清除栈帧。为了在我们基于回调的例子中代替局部变量,我们把`sock`和`response`作为Fetcher实例`self`属性。为了代替指令指针,它通过注册`connnected`和`read_response`回调来保存continuation。随着应用功能的增长,我们手动保存回调的复杂性也会增加。如此繁复的记账式工作会让编码者感到头痛。 +但是用一个基于回调的异步框架时,这些语言特性不能提供一点帮助。当等待 I/O 操作时,一个函数必须明确的保存它的状态,因为它会在 I/O 操作完成之前返回并清除栈帧。在我们基于回调的例子中,作为局部变量的替代,我们把 `sock` 和 `response` 作为 Fetcher 实例 `self` 的属性来存储。而作为指令指针的替代,它通过注册 `connected` 和 `read_response` 回调来保存它的 continuation。随着应用功能的增长,我们需要手动保存的回调的复杂性也会增加。如此繁复的记账式工作会让编码者感到头痛。 -更糟糕的是,当我们的回调函数抛出异常会发生什么?假设我们没有写好`parse_links`方法,它在解析HTML时抛出异常: +更糟糕的是,当我们的回调函数抛出异常会发生什么?假设我们没有写好 `parse_links` 方法,它在解析 HTML 时抛出异常: ``` Traceback (most recent call last): @@ -295,13 +295,13 @@ Traceback (most recent call last): Exception: parse error ``` -这个堆栈回溯只能显示出事件循环调用了一个回调。我们不知道是什么导致了这个错误。这条链的两边都被破坏:不知道从哪来也不知到哪去。这种丢失上下文的现象被称为"stack ripping",它还会阻止我们为回调链设置异常处理。 +这个堆栈回溯只能显示出事件循环调用了一个回调。我们不知道是什么导致了这个错误。这条链的两边都被破坏:不知道从哪来也不知到哪去。这种丢失上下文的现象被称为“堆栈撕裂(stack ripping)”,经常会导致无法分析原因。它还会阻止我们为回调链设置异常处理,即那种用“try / except”块封装函数调用及其调用树。(对于这个问题的更复杂的解决方案,参见 http://www.tornadoweb.org/en/stable/stack_context.html ) -所以,除了关于多线程和异步那个更高效的争议,还有一个关于这两者之间的争论,谁更容易出错。如果在同步上出现失误,线程更容易出现数据竞争的问题,而回调因为"stack ripping"问题而非常难于调试。 +所以,除了关于多线程和异步哪个更高效的长期争议之外,还有一个关于这两者之间的争论:谁更容易跪了。如果在同步上出现失误,线程更容易出现数据竞争的问题,而回调因为"堆栈撕裂(stack ripping)"问题而非常难于调试。 -## 协程 +### 协程 -还记得我们对你许下的承诺么?我们可以写出这样的异步代码,它既有回调方式的高效,也有多线程代码的简洁。这个结合是同过一种称为协程的模式来实现的。使用Python3.4标准库asyncio和一个叫"aiohttp"的包,在协程中获取一个网页是非常直接的[^10]: +还记得我们对你许下的承诺么?我们可以写出这样的异步代码,它既有回调方式的高效,也有多线程代码的简洁。这个结合是同过一种称为协程(coroutine)的模式来实现的。使用 Python3.4 标准库 asyncio 和一个叫“aiohttp”的包,在协程中获取一个网页是非常直接的( `@asyncio.coroutine` 修饰符并非魔法。事实上,如果它修饰的是一个生成器函数,并且没有设置 `PYTHONASYNCIODEBUG` 环境变量的话,这个修饰符基本上没啥用。它只是为了框架的其它部分方便,设置了一个属性 `_is_coroutine` 而已。也可以直接使用 asyncio 和裸生成器,而没有 `@asyncio.coroutine` 修饰符): ```python @asyncio.coroutine @@ -310,15 +310,17 @@ Exception: parse error body = yield from response.read() ``` -它也是可扩展的。在Jesse系统上,与每个线程50k内存相比,一个Python协程只需要3k内存。Python很容易就可以启动上千个协程。 +它也是可扩展的。在作者 Jesse 的系统上,与每个线程 50k 内存相比,一个 Python 协程只需要 3k 内存。Python 很容易就可以启动上千个协程。 -协程的概念可以追溯到计算机科学的远古时代,它很简单,一个可以暂停和恢复的子过程。线程是被操作系统控制的抢占式多任务,而协程是可合作的,它们自己选择什么时候暂停去执行下一个协程。 +协程的概念可以追溯到计算机科学的远古时代,它很简单,一个可以暂停和恢复的子过程。线程是被操作系统控制的抢占式多任务,而协程的多任务是可合作的,它们自己选择什么时候暂停去执行下一个协程。 -有很多协程的实现。甚至在Python中也有几种。Python3.4标准库asyncio中的协程,它是建立在生成器,一个Future类和"yield from"语句之上。从Python3.5开始,协程变成了语言本身的特性。然而,理解Python3.4中这个通过语言原有功能实现的协程,是我们处理Python3.5中原生协程的基础。 +有很多协程的实现。甚至在 Python 中也有几种。Python 3.4 标准库 asyncio 中的协程是建立在生成器之上的,这是一个 Future 类和“yield from”语句。从 Python 3.5 开始,协程变成了语言本身的特性([“PEP 492 Coroutines with async and await syntax”](https://www.python.org/dev/peps/pep-0492/) 中描述了 Python 3.5 内置的协程)。然而,理解 Python 3.4 中这个通过语言原有功能实现的协程,是我们处理 Python 3.5 中原生协程的基础。 + +要解释 Python 3.4 中基于生成器的协程,我们需要深入生成器的方方面面,以及它们是如何在 asyncio 中用作协程的。我很高兴就此写点东西,想必你也希望继续读下去。我们解释了基于生成器的协程之后,就会在我们的异步网络爬虫中使用它们。 -## 生成器如何工作 +### 生成器如何工作 -在你理解生成器之前,你需要知道普通的Python函数是怎么工作的。当一个函数调用一个子过程,这个被调用函数获得控制权。直到它返回或者有异常发生,才把控制权交给调用者: +在你理解生成器之前,你需要知道普通的 Python 函数是怎么工作的。正常情况下,当一个函数调用一个子过程,这个被调用函数获得控制权,直到它返回或者有异常发生,才把控制权交给调用者: ```python >>> def foo(): @@ -328,7 +330,7 @@ Exception: parse error ... pass ``` -标准的Python解释器是C语言写的。一个Python函数被调用对应的C函数是`PyEval_EvalFrameEx`。它获得一个Python栈帧结构并在这个栈帧的上下文中执行Python字节码。这里是`foo`的字节码: +标准的 Python 解释器是用 C 语言写的。一个 Python 函数被调用所对应的 C 函数是 `PyEval_EvalFrameEx`。它获得一个 Python 栈帧结构并在这个栈帧的上下文中执行 Python 字节码。这里是 `foo` 函数的字节码: ```python >>> import dis @@ -340,13 +342,11 @@ Exception: parse error 10 RETURN_VALUE ``` -`foo`函数在它栈中加载`bar`并调用它,然后把`bar`的返回值从栈中弹出,加载`None`值并返回。 +`foo` 函数在它栈中加载 `bar` 函数并调用它,然后把 `bar` 的返回值从栈中弹出,加载 `None` 值到堆栈并返回。 -当`PyEval_EvalFrameEx`遇到`CALL_FUNCTION`字节码时,它会创建一个新的栈帧,并用这个栈帧递归的调用`PyEval_EvalFrameEx`来执行`bar`函数。 +当 `PyEval_EvalFrameEx` 遇到 `CALL_FUNCTION` 字节码时,它会创建一个新的栈帧,并用这个栈帧递归的调用 `PyEval_EvalFrameEx` 来执行 `bar` 函数。 -图 - -非常重要的一点是,Python的栈帧在堆中分配!Python解释器是一个标准的C程序,所以他的栈帧是正常的栈帧。但是Python的栈帧是在堆中处理。这意味着Python栈帧在函数调用结束后依然可以存在。我们在`bar`函数中保存当前的栈帧,交互式的看看这种现象: +非常重要的一点是,Python 的栈帧在堆中分配!Python 解释器是一个标准的 C 程序,所以它的栈帧是正常的栈帧。但是 Python 的栈帧是在堆中处理。这意味着 Python 栈帧在函数调用结束后依然可以存在。我们在 `bar` 函数中保存当前的栈帧,交互式的看看这种现象: ```python >>> import inspect @@ -367,8 +367,10 @@ Exception: parse error >>> caller_frame.f_code.co_name 'foo' ``` + +![Figure 5.1 - Function Calls](http://aosabook.org/en/500L/crawler-images/function-calls.png) -现在该说Python生成器了,它使用同样构件--code object和栈帧--去完成一个不可思议的任务。 +现在该说 Python 生成器了,它使用同样构件——代码对象和栈帧——去完成一个不可思议的任务。 这是一个生成器函数: @@ -382,7 +384,7 @@ Exception: parse error ... ``` -在Python把`gen_fn`编译成字节码的过程中,一旦它看到`yield`语句就知道这是一个生成器函数而不是普通的函数。它就会设置一个标志来记住这个事实: +在 Python 把 `gen_fn` 编译成字节码的过程中,一旦它看到 `yield` 语句就知道这是一个生成器函数而不是普通的函数。它就会设置一个标志来记住这个事实: ```python >>> # The generator flag is bit position 5. @@ -391,7 +393,7 @@ Exception: parse error True ``` -当你调用一个生成器函数,Python看到这个标志,就不会运行它而是创建一个生成器: +当你调用一个生成器函数,Python 看到这个标志,就不会实际运行它而是创建一个生成器: ```python >>> gen = gen_fn() @@ -399,32 +401,32 @@ True ``` -Python生成器封装了一个栈帧和函数体代码: +Python 生成器封装了一个栈帧和函数体代码的引用: ```python >>> gen.gi_code.co_name 'gen_fn' ``` -所有通过调用`gen_fn`的生成器指向同一段代码,但都有各自的栈帧。这些栈帧不再任何一个C函数栈中,而是在堆空间中等待被使用: +所有通过调用 `gen_fn` 的生成器指向同一段代码,但都有各自的栈帧。这些栈帧不再任何一个C函数栈中,而是在堆空间中等待被使用: -图 +![Figure 5.2 - Generators](http://aosabook.org/en/500L/crawler-images/generator.png) -栈帧中有一个指向最后执行指令的指针。初始化为-1,意味着它没开始运行: +栈帧中有一个指向“最后执行指令”的指针。初始化为 -1,意味着它没开始运行: ```python >>> gen.gi_frame.f_lasti -1 ``` -当我们调用`send`时,生成器一直运行到第一个`yield`语句处停止。并且`send`返回1,yield语句后的表达式的值。 +当我们调用 `send` 时,生成器一直运行到第一个 `yield` 语句处停止,并且 `send` 返回 1,因为这是 `gen` 传递给 `yield` 表达式的值。 ```python >>> gen.send(None) 1 ``` -现在生成器的指令指针是3,字节码一共有56个字节: +现在,生成器的指令指针是 3,所编译的Python 字节码一共有 56 个字节: ```python >>> gen.gi_frame.f_lasti @@ -433,9 +435,9 @@ Python生成器封装了一个栈帧和函数体代码: 56 ``` -这个生成器可以在任何时候,任何函数中恢复运行,因为它的栈帧并不在真正的栈中,而是堆中。在调用链中它的位置也是不确定的,它不必遵循普通函数先进后出的顺序。它像云一样自由。 +这个生成器可以在任何时候、任何函数中恢复运行,因为它的栈帧并不在真正的栈中,而是堆中。在调用链中它的位置也是不固定的,它不必遵循普通函数先进后出的顺序。它像云一样自由。 -我们可以传递一个`hello`给生成器,它会成为yield语句的结果,并且生成器运行到第二个yield语句处。 +我们可以传递一个值 `hello` 给生成器,它会成为 `yield` 语句的结果,并且生成器会继续运行到第二个 `yield` 语句处。 ```python >>> gen.send('hello') @@ -443,16 +445,16 @@ result of yield: hello 2 ``` -现在栈帧中包含局部变量`result`: +现在栈帧中包含局部变量 `result`: ```python >>> gen.gi_frame.f_locals {'result': 'hello'} ``` -其它从`gen_fn`创建的生成器有着它自己的栈帧和局部变量。 +其它从 `gen_fn` 创建的生成器有着它自己的栈帧和局部变量。 -当我们在一次调用`send`,生成器从第二个yield开始运行,以抛出一个特殊的`StopIteration`异常为结束。 +当我们再一次调用 `send`,生成器继续从第二个 `yield` 开始运行,以抛出一个特殊的 `StopIteration` 异常为结束。 ```python >>> gen.send('goodbye') @@ -462,9 +464,9 @@ Traceback (most recent call last): StopIteration: done ``` -这个异常有一个值"done",它就是生成器的返回值。 +这个异常有一个值 `"done"`,它就是生成器的返回值。 -## 使用生成器构建协程 +### 使用生成器构建协程 所以生成器可以暂停,可以给它一个值让它恢复,并且它还有一个返回值。这些特性看起来很适合去建立一个不使用回调的异步编程模型。我们想创造一个协程:一个在程序中可以和其他过程合作调度的过程。我们的协程将会是标准库`asyncio`中协程的一个简化版本,我们将使用生成器,futures和`yield from`语句。 From fb840a91a57e89ff5cb50ffa419cba8bfaa58c8c Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Fri, 3 Mar 2017 11:23:21 +0800 Subject: [PATCH 024/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- ...Generate random data for your applications with Elizabeth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md b/translated/tech/20170215 Generate random data for your applications with Elizabeth.md index efaa8eb2cf..d773e173af 100644 --- a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md +++ b/translated/tech/20170215 Generate random data for your applications with Elizabeth.md @@ -76,7 +76,7 @@ via: https://opensource.com/article/17/2/elizabeth-python-library 作者:[D Ruth Bavousett][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 26c810f17243cb8a05341d840af352159f618029 Mon Sep 17 00:00:00 2001 From: xiaow6 Date: Fri, 3 Mar 2017 20:54:18 +0800 Subject: [PATCH 025/190] translated 20170210 How to perform search operations in Vim.md Delete source/tech /20170210 How to perform search operations in Vim.md Add translated/tech /20170210 How to perform search operations in Vim.md --- ...How to perform search operations in Vim.md | 162 ------------------ ...How to perform search operations in Vim.md | 150 ++++++++++++++++ 2 files changed, 150 insertions(+), 162 deletions(-) delete mode 100644 sources/tech/20170210 How to perform search operations in Vim.md create mode 100644 translated/tech/20170210 How to perform search operations in Vim.md diff --git a/sources/tech/20170210 How to perform search operations in Vim.md b/sources/tech/20170210 How to perform search operations in Vim.md deleted file mode 100644 index 52967f4a90..0000000000 --- a/sources/tech/20170210 How to perform search operations in Vim.md +++ /dev/null @@ -1,162 +0,0 @@ -translating by xiaow6 -How to perform search operations in Vim -============================================================ - -### On this page - -1. [Customize your search][5] - 1. [1\. Search highlighting][1] - 2. [2\. Making search case-insensitive][2] - 3. [3\. Smartcase search][3] - 4. [4\. Incremental search][4] -2. [Some other cool Vim search tips/tricks][6] -3. [Conclusion][7] - -While we've already [covered][8] several features of Vim until now, the editor's feature-set is so vast that no matter how much you learn, it doesn't seem to be enough. So continuing with our Vim tutorial series, in this write-up, we will discuss the various search techniques that the editor offers. - -But before we do that, please note that all the examples, commands, and instructions mentioned in this tutorial have been tested on Ubuntu 14.04, and the Vim version we've used is 7.4. - -### Basic search operations in Vim - -If you have opened a file in the Vim editor, and want to search a particular word or pattern, the first step that you have to do is to come out of the Insert mode (if you that mode is currently active). Once that is done, type '**/**' (without quotes) followed by the word/pattern that you want to search. - -For example, if the word you want to search is 'linux', here's how it will appear at the bottom of your Vim window: - -[ - ![Search for words in vim](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-basic-search.png) -][9] - -After this, just hit the Enter key and you'll see that Vim will place the cursor on the first line (containing the word) that it encounters beginning from the line where the cursor was when you were in Insert mode. If you've just opened a file and began searching then the search operation will start from the very first line of the file. - -To move on to the next line containing the searched word, press the '**n**' key. When you've traversed through all the lines containing the searched pattern, pressing the '**n**' key again will make the editor to repeat the search, and you'll be back to the first searched occurrence again. - -[ - ![Move to next search hit](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-end.png) -][10] - -While traversing the searched occurrences, if you want to go back to the previous occurrence, press '**N**' (shift+n). Also, it's worth mentioning that at any point in time, you can type '**ggn**' to jump to the first match, or '**GN**' to jump to the last. - -In case you are at the bottom of a file, and want to search backwards, then instead of initiating the search with **/**, use **?**. Here's an example: - -[ - ![search backwards](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-back.png) -][11] - -### Customize your search - -### 1\. Search highlighting - -While jumping from one occurrence of the searched word/pattern to another is easy using 'n' or 'N,' things become more user-friendly if the searched occurrences get highlighted. For example, see the screenshot below: - -[ - ![Search Highlighting in VIM](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-highlight-search.png) -][12] - -This can be made possible by setting the 'hlsearch' variable, something which you can do by writing the following in the normal/command mode: - -``` -:set hlsearch -``` - -[ - ![set hlsearch](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-set-hlsearch.png) -][13] - -### 2\. Making search case-insensitive - -By default, the search you do in Vim is case-sensitive. This means that if I am searching for 'linux', then 'Linux' won't get matched. However, if that's not what you are looking for, then you can make the search case-insensitive using the following command: - -``` -:set ignorecase -``` - -So after I set the 'ignorecase' variable using the aforementioned command, and searched for 'linux', the occurrences of 'LINUX' were also highlighted: - -[ - ![search case-insensitive](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-case.png) -][14] - -### 3\. Smartcase search - -Vim also offers you a feature using which you can ask the editor to be case-sensitive only when the searched word/pattern contains an uppercase character. For this you need to first set the 'ignorecase' variable and then set the 'smartcase' variable. - -``` -:set ignorecase -:set smartcase -``` - -For example, if a file contains both 'LINUX' and 'linux,' and smartcase is on, then only occurrences of the word LINUX will be searched if you search using '/LINUX'. However, if the search is '/linux', then all the occurrences will get matched irrespective of whether they are in caps or not. - -### 4\. Incremental search - -Just like, for example, Google, which shows search results as you type your query (updating them with each alphabet you type), Vim also provides incremental search. To access the feature, you'll have to execute the following command before you start searching: - -``` -:set incsearch -``` - -### Some other cool Vim search tips/tricks - -There are several other search-related tips tricks that you may find useful. - -To start off, if you want to search for a word that's there in the file, but you don't want to type it, you can just bring your cursor below it and press ***** (or **shift+8**). And if you want to launch a partial search (for example: search both 'in' and 'terminal'), then you can bring the cursor under the word (in our example, in) and search by pressing **g*** (press 'g' once and then keep pressing *) on the keyboard. - -Note: Press **#** or **g#** in case you want to search backwards. - -Next up, if you want, you can get a list of all occurrences of the searched word/pattern along with the respective lines and line numbers at one place. This can be done by type **[I** after you've initiated the search. Following is an example of how the results are grouped and displayed at the bottom of Vim window: - -[ - ![grouped search results](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-results-list.png) -][15] - -Moving on, as you might already know, the Vim search wraps by default, meaning after reaching the end of the file (or to the last occurrence of the searched word), pressing "search next" brings the cursor to the first occurrence again. If you want, you can disable this search wrapping by running the following command: - -``` -:set nowrapscan -``` - -To enable wrap scan again, use the following command: - -``` -:set wrapscan -``` - -Finally, suppose you want to make a slight change to an already existing word in the file, and then perform the search operation, then one way is to type **/** followed by that word. But if the word in long or complicated, then it may take time to type it. - -An easy way out is to bring the cursor under the word you want to slightly edit, then press '/' and then press Ctrl-r followed by Ctrl-w. The word under the cursor will not only get copied, it will be pasted after '/' as well, allowing you to easily edit it and go ahead with the search operation. - -For more tricks (including how you can use your mouse to make things easier in Vim), head to the [official Vim documentation][16]. - -### Conclusion - -Of course, nobody expects you to mug up all the tips/tricks mentioned here. What you can do is, start with the one you think will be the most beneficial to you, and practice it regularly. Once it gets embedded in your memory and becomes a habit, come here again, and see which one you should learn next. - -Do you know any more such tricks? Want to share it with everyone in the HTF community? Then leave it as a comment below. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/ - -作者:[Himanshu Arora][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/ -[1]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-search-highlighting -[2]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-making-searchnbspcaseinsensitive -[3]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-smartcase-search -[4]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-incremental-search -[5]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#customize-your-search -[6]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#some-other-cool-vim-search-tipstricks -[7]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#conclusion -[8]:https://www.howtoforge.com/tutorial/vim-editor-modes-explained/ -[9]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-basic-search.png -[10]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-end.png -[11]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-back.png -[12]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-highlight-search.png -[13]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-set-hlsearch.png -[14]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-case.png -[15]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-results-list.png -[16]:http://vim.wikia.com/wiki/Searching diff --git a/translated/tech/20170210 How to perform search operations in Vim.md b/translated/tech/20170210 How to perform search operations in Vim.md new file mode 100644 index 0000000000..48a0e88d11 --- /dev/null +++ b/translated/tech/20170210 How to perform search operations in Vim.md @@ -0,0 +1,150 @@ + +如何在Vim中实现搜索 +================================ + +### 本页中 + +1. [自定义你的搜索][5] + + [1\.1\.高亮搜索结果][1] + + [1\.2\.使搜索不区分大小写][2] + + [1\.3\.智能大小写搜索][3] + + [1\.4\.递进搜索][4] + +2. [其他很酷的在Vim中搜索的小技巧][6] + +3. [结语][7] + +尽管目前我们已经[涉及][8] Vim 的多种特性,但此编辑器的特征集如此庞大,不管我们学习多少,似乎仍然远远不足。承接我们的 Vim 教程系列,本文我们将讨论 Vim 提供的多种搜索技术。 + +不过在此之前,请注意文中涉及到的所有的例子、命令、指令均是在 Ubuntu 14.04,Vim 7.4 下测试的。 + +### Vim 中的基础搜索操作 + +当你在 Vim 中打开一个文件并且想要搜索一个特定的单词或模板,第一步你必须要先从插入模式中退出(如果你正处于插入模式中)。之后输入 ‘**/**’(不带引号)并紧接着输入你要搜索的单词或模板。 + +例如,如果你想要搜索的单词是 ’linux',下图显示的就是在 Vim 窗口底部的搜索命令: + +[![Search for words in vim](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-basic-search.png) ][9] + +敲击回车键之后,你会看到 Vim 会将光标停留在从光标在插入模式中的位置开始,找到的包含此单词的第一行。如果你刚刚打开一个文件并且立即开始了搜索操作,搜索将从文件的首行开始。 + +如果想要移动到下一处包含被搜索单词位置,按 ‘**n**' 键。当你遍历完所有被搜索模板所在之处,继续按 ’**n**' 键 Vim将重复搜索操作,光标将回到第一次搜索结果出现位置。 + +[ ![Move to next search hit](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-end.png) ][10] + +在遍历搜索结果时,如果你想要回到上一匹配处,按 '**N**' (shift + n)。同时,值得注意的是不管在什么时候,你都可以输入 '**ggn**' 来跳转到第一个匹配处,或者 ’**GN**' 来跳转到最后一处。 + +当你恰好在文件的底部,而且想要逆向搜索的情况下,使用 **?** 代替 **/** 来开始搜索。下图是一个例子: + +[![search backwards](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-back.png)][11] + +### 自定义你的搜索 + +### 1\. 高亮搜索结果 + +尽管通过 ‘n' 或 'N' 从被搜索单词 / 模板的匹配处跳转到另一处很简单,但是如果匹配处能够高亮就更加人性化了。例如,请看下附截图: + +[![Search Highlighting in VIM](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-highlight-search.png) ][12] + +这可以通过设置 ’hlsearch‘ 变量来实现,例如在普通/命令行模式中执行下述命令: + +``` +:set hlsearch +``` + +[![set hlsearch](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-set-hlsearch.png) ][13] + +### 2\. 使搜索不区分大小写 + +在 Vim 中进行搜索默认是区分大小写的。这就意味着如果我要搜索 ’linux',那么 ‘Linux’ 是不会匹配的。然而,如果这不是你想要的搜索方式,你可以使用如下命令来使搜索变得不区分大小写: + +``` +:set ignorecase +``` +所以当我设置 ignorecase 变量后再使用前边提到的命令,搜索 'linux',那么 ’Linux‘ 所在处也会被高亮。 + +[![search case-insensitive](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-search-case.png) ][14] + +### 3\. 智能大小写搜索 + +Vim 提供了一个功能,只有当要搜索的单词 / 模板包含大写字母时,编辑器才会区分大小写。要想实现这种功能,必须先设置 ‘ignorecase',再接着设置 ‘smartcase' 变量。 + +``` +:set ignorecase +:set smartcase +``` +例如,如果一个文件中既包含 ’LINUX‘ 也包含 ’linux',在开启智能大小写搜索功能时,如果使用 ‘/LINUX' 进行搜索,只有单词LINUX处会被搜到。反之,如果搜索 ’/linux',那么不论大小写的搜索结果都会被匹配。 + +### 4\. 递进搜索 + +就如谷歌一样,随着你输入查询字串(字串随你每输入一个字符不断更新)显示不同的搜索结果,Vim 也同样提供了递进搜索。要想使用这种特性,你必须在搜索前执行下述命令: + +``` +:set incsearch +``` +### 一些很酷的在Vim中搜索的小技巧 + +你可能会发现还有一些其他的与搜索相关的小技巧很有用。 + +开始吧!如果你想要搜索一个文件中的一个单词,但是又不想输入它,你只需要将你的光标移到这个单词下然后按 ***** (或者 **shift + 8**)。如果你想要启动一次部分搜索(例如:同时搜索 ‘in' 和 ’terminal'),那你需要将光标移到到单词(在本例中, ‘in')下,然后通过在键盘上按 **g*** (按一次 ’g'然后不断按 * )。 + +注意:按 **#** 或者 **g#** 如果你想要逆向搜索。 + +下一个,只要你想要,你可以获得所有被搜索单词 / 模板匹配处所在的行和行号的一个列表。这可以在你开始搜索后通过按 **[I** 来实现。如下图是一个列表结果如何在 Vim 窗口底部被分组和显示的例子: + +[![grouped search results](https://www.howtoforge.com/images/perform-search-operations-in-vim/vim-results-list.png) ][15] + +接下来,你可能已经得知,Vim 默认是环形搜索的,意味着在到达文件结尾处(或者被搜索单词的最后一处匹配)时,如果继续按 “搜索下一个”会将光标再次带回第一处匹配处。如果你希望禁止环形搜索,可以使用如下命令: + +``` +:set nowrapscan +``` + +再次开启环形搜索,使用如下命令即可: + +``` +:set wrapscan +``` +最后,假设你想要对文件中已经存在的单词做一点小小的修改,然后对修改后的单词执行搜索操作,一种方法是输入 **/** 与要搜索的单词。但是如果这个单词又长又复杂,那么可能需要一点时间来输入它。 + +一个简单的办法是将光标移到你想要略微修改的单词下,按 ‘/' 之后再按 Ctrl - r 最后按 Ctrl - w。这个在光标下的单词不仅仅会被拷贝,也会被复制到 ’/' 后,允许你对它进行修改并且继续进行搜索操作。 + +如果想要获得更多小技巧(包括如何使用鼠标来使在 Vim 中的操作变得简单),请前往 [Vim 官方文档][16]。 + +### 结语 + +当然,没有人希望你死记硬背这里提到的所有小技巧。你应该做的是,从一个你认为对你最有益的技巧开始不断练习。当它成为一种习惯并且嵌入你的记忆后,重新来这儿找找你应该开始学习的下一个技巧。 + +你知道其他像这样的技巧吗?并且希望能够和大家一起分享?那就在下边留言吧! + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/ + +作者:[Himanshu Arora][a] +译者:[xiaow6](https://github.com/xiaow6) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/ +[1]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-search-highlighting +[2]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-making-searchnbspcaseinsensitive +[3]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-smartcase-search +[4]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#-incremental-search +[5]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#customize-your-search +[6]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#some-other-cool-vim-search-tipstricks +[7]:https://www.howtoforge.com/tutorial/perform-search-operations-in-vim/#conclusion +[8]:https://www.howtoforge.com/tutorial/vim-editor-modes-explained/ +[9]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-basic-search.png +[10]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-end.png +[11]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-back.png +[12]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-highlight-search.png +[13]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-set-hlsearch.png +[14]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-search-case.png +[15]:https://www.howtoforge.com/images/perform-search-operations-in-vim/big/vim-results-list.png +[16]:http://vim.wikia.com/wiki/Searching \ No newline at end of file From 1f9619e57d557a1e597facb818eafa41ceb92281 Mon Sep 17 00:00:00 2001 From: xiaow6 Date: Fri, 3 Mar 2017 21:08:54 +0800 Subject: [PATCH 026/190] translating by xiaow6 --- ...ing Scripting Languages in IoT Challenges and Approaches.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md b/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md index 7b1ac69089..47447d62bd 100644 --- a/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md +++ b/sources/tech/20170215 Using Scripting Languages in IoT Challenges and Approaches.md @@ -1,3 +1,4 @@ +translating by xiaow6 Using Scripting Languages in IoT: Challenges and Approaches ============================================================ @@ -65,6 +66,6 @@ via: https://www.linux.com/news/event/elcna/2017/2/using-scripting-languages-iot [2]:https://www.linux.com/licenses/category/creative-commons-zero [3]:https://www.linux.com/files/images/paul-sokolovsky-2014-09-21jpg [4]:https://www.linux.com/files/images/scripting-languages-iotjpg -[5]:http://events.linuxfoundation.org/events/embedded-linux-conference/program/schedule?utm_source=linux&utm_campaign=elc17&utm_medium=blog&utm_content=video-blog +[5]:http://events.linuxfoundation.org/events/embedded-linux-conference/program/schedule?utm_source=linux&utm_campaign=elc17&utm_medium=blog&utm_content=video-blog [6]:http://events.linuxfoundation.org/events/embedded-linux-conference [7]:https://events.linuxfoundation.org/events/openiot-summit/program/schedule From bf5da1a9dc6fc82b930f21a539cb3a7e1bf775ef Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 4 Mar 2017 09:20:54 +0800 Subject: [PATCH 027/190] =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20140507 What is Linux A brief Description.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{linux-ditro -explain => linux-distro -explain}/20140507 What is Linux A brief Description.md (100%) diff --git a/translated/tech/linux-ditro -explain/20140507 What is Linux A brief Description.md b/translated/tech/linux-distro -explain/20140507 What is Linux A brief Description.md similarity index 100% rename from translated/tech/linux-ditro -explain/20140507 What is Linux A brief Description.md rename to translated/tech/linux-distro -explain/20140507 What is Linux A brief Description.md From 094081ad3d2798aa67e516daef667065e55e2dbd Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 4 Mar 2017 10:18:58 +0800 Subject: [PATCH 028/190] PRF&PUB:Part 9 - LXD 2.0--Live migration.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @geekpi 胜利在望~ --- .../LXD/Part 9 - LXD 2.0--Live migration.md | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) rename {translated/tech => published}/LXD/Part 9 - LXD 2.0--Live migration.md (72%) diff --git a/translated/tech/LXD/Part 9 - LXD 2.0--Live migration.md b/published/LXD/Part 9 - LXD 2.0--Live migration.md similarity index 72% rename from translated/tech/LXD/Part 9 - LXD 2.0--Live migration.md rename to published/LXD/Part 9 - LXD 2.0--Live migration.md index afbbd8bd24..df0fae0d05 100644 --- a/translated/tech/LXD/Part 9 - LXD 2.0--Live migration.md +++ b/published/LXD/Part 9 - LXD 2.0--Live migration.md @@ -7,26 +7,26 @@ LXD 2.0 系列(九):实时迁移 ### 介绍 -LXD 2.0中的有一个尽管是实验性质的但非常令人兴奋的功能,那就是支持容器检查点和恢复。 +LXD 2.0 中的有一个尽管是实验性质的但非常令人兴奋的功能,那就是支持容器检查点和恢复。 -简单地说,检查点/恢复意味着正在运行的容器状态可以被序列化到磁盘,然后在与容器状态快照相同的主机上或者在等同于实时迁移的另一主机上恢复。 +简单地说,检查点/恢复意味着正在运行的容器状态可以被序列化到磁盘,要么可以作为同一主机上的有状态快照,要么放到另一主机上相当于实时迁移。 ### 要求 -要访问容器实时迁移和有状态快照,你需要以下条件: +要使用容器实时迁移和有状态快照,你需要以下条件: -- 一个最近的Linux内核,4.4或更高版本。 -- CRIU 2.0,可能有一些cherry-pick的提交,具体取决于你确切的内核配置。 -- 直接在主机上运行LXD。 不能在容器嵌套下使用这些功能。 -- 对于迁移,目标机器必须至少实现源的指令集,目标内核必须至少提供与源相同的系统调用,并且在源上挂载的任何内核文件系统也必须可挂载到目标主机上。 +- 一个非常新的 Linux 内核,4.4 或更高版本。 +- CRIU 2.0,可能需要一些 cherry-pick 的提交,具体取决于你确切的内核配置。 +- 直接在主机上运行 LXD。 不能在容器嵌套下使用这些功能。 +- 对于迁移,目标主机必须至少实现源主机的指令集,目标主机内核必须至少提供与源主机相同的系统调用,并且在源主机上挂载的任何内核文件系统也必须可挂载到目标主机上。 -Ubuntu 16.04 LTS已经提供了所有需要的依赖,在这种情况下,您只需要安装CRIU本身: +Ubuntu 16.04 LTS 已经提供了所有需要的依赖,在这种情况下,您只需要安装 CRIU 本身: ``` apt install criu ``` -### 使用CRIU +### 使用 CRIU #### 有状态快照 @@ -46,7 +46,7 @@ stgraber@dakara:~$ lxc info c1 | grep second second (taken at 2016/04/25 19:36 UTC) (stateful) ``` -这意味着所有容器运行时状态都被序列化到磁盘并且作为了快照的一部分。就像你还原无状态快照那样还原一个有状态快照: +这意味着所有容器运行时状态都被序列化到磁盘并且作为了快照的一部分。可以像你还原无状态快照那样还原一个有状态快照: ``` stgraber@dakara:~$ lxc restore c1 second @@ -55,7 +55,7 @@ stgraber@dakara:~$ #### 有状态快照的停止/启动 -比方说你想要升级内核或者其他类似的维护。与其等待所有的容器启动,你可以: +比方说你由于升级内核或者其他类似的维护而需要重启机器。与其等待重启后启动所有的容器,你可以: ``` stgraber@dakara:~$ lxc stop c1 --stateful @@ -266,38 +266,37 @@ stgraber@dakara:~$ lxc list s-tollana: ### 限制 -正如我之前说的,容器的检查点/恢复还是非常新的功能,我们还在努力地开发这个功能、修复问题已知问题。我们确实需要更多的人来尝试这个功能,并给我们反馈,但我不建议在生产中使用这个功能。 +正如我之前说的,容器的检查点/恢复还是非常新的功能,我们还在努力地开发这个功能、修复已知的问题。我们确实需要更多的人来尝试这个功能,并给我们反馈,但我不建议在生产中使用这个功能。 -我们跟踪的问题列表在[Launchpad上][1]。 +我们跟踪的问题列表在 [Launchpad上][1]。 -我们期望在Ubuntu 16.04上有一个基本的带有几个服务的Ubuntu容器能够与CRIU一起工作。然而在更复杂的容器、使用设备传递、复杂的网络服务或特殊的存储配置可能会失败。 +我们估计在带有 CRIU 的 Ubuntu 16.04 上带有几个服务的基本的 Ubuntu 容器能够正常工作。然而在更复杂的容器、使用了设备直通、复杂的网络服务或特殊的存储配置下可能会失败。 -只要有可能,CRIU会在转储时失败,而不是在恢复时。在这种情况下,源容器将继续运行,快照或迁移将会失败,并生成一个日志文件用于调试。 +要是有问题,CRIU 会尽可能地在转储时失败,而不是在恢复时。在这种情况下,源容器将继续运行,快照或迁移将会失败,并生成一个日志文件用于调试。 -在极少数情况下,CRIU无法恢复容器,在这种情况下,源容器仍然存在但将被停止,并且必须手动重新启动。 +在极少数情况下,CRIU 无法恢复容器,在这种情况下,源容器仍然存在但将被停止,并且必须手动重新启动。 -### 发送bug报告 +### 发送 bug 报告 -我们正在跟踪Launchpad上关于CRIU Ubuntu软件包的检查点/恢复相关的错误。大多数修复bug工作是在上游的CRIU或Linux内核上,但是这种方式我们更容易跟踪。 +我们正在跟踪 Launchpad 上关于 CRIU Ubuntu 软件包的检查点/恢复相关的错误。大多数修复 bug 工作是在上游的 CRIU 或 Linux 内核上进行,但是这种方式我们更容易跟踪。 -要提交新的bug报告,请看这里。 +要提交新的 bug 报告,请看这里。 请务必包括: -你运行的命令和显示给你的错误消息 +- 你运行的命令和显示给你的错误消息 +- `lxc info` 的输出(*) +- `lxc info `的输出 +- `lxc config show -expanded ` 的输出 +- `dmesg`(*)的输出 +- `/proc/self/mountinfo` 的输出(*) +- `lxc exec - cat /proc/self/mountinfo` 的输出 +- `uname -a`(*)的输出 +- `/var/log/lxd.log`(*)的内容 +- `/etc/default/lxd-bridge`(*)的内容 +- `/var/log/lxd//` 的 tarball(*) -- “lxc info”的输出(*) -- “lxc info ”的输出 -- “lxc config show -expanded ”的输出 -- “dmesg”(*)的输出 -- “/proc/self/mountinfo”的输出(*) -- “lxc exec - cat /proc/self/mountinfo”的输出 -- “uname -a”(*)的输出 -- /var/log/lxd.log(*)的内容 -- /etc/default/lxd-bridge(*)的内容 -- /var/log/lxd// 的tarball(*) - -如果报告迁移错误,而不是状态快照或有状态停止错误,请将上面所有含有(*)标记的源与目标主机的信息发来。 +如果报告迁移错误,而不是状态快照或有状态停止的错误,请将上面所有含有(*)标记的源与目标主机的信息发来。 ### 额外信息 @@ -314,11 +313,11 @@ LXD 的 IRC 频道: #lxcontainers on irc.freenode.net -------------------------------------------------------------------------------- -via: https://www.stgraber.org/2016/03/19/lxd-2-0-your-first-lxd-container-312/ +via: https://stgraber.org/2016/04/25/lxd-2-0-live-migration-912/ 作者:[Stéphane Graber][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 组织翻译,[Linux中国](https://linux.cn/) 荣誉推出 From 99825f05cd2adb5bb62594d14803a0e3cb2e625c Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 4 Mar 2017 10:56:44 +0800 Subject: [PATCH 029/190] PUB:20170120 How to write web apps in R with Shiny.md @geekpi --- .../20170120 How to write web apps in R with Shiny.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) rename {translated/tech => published}/20170120 How to write web apps in R with Shiny.md (73%) diff --git a/translated/tech/20170120 How to write web apps in R with Shiny.md b/published/20170120 How to write web apps in R with Shiny.md similarity index 73% rename from translated/tech/20170120 How to write web apps in R with Shiny.md rename to published/20170120 How to write web apps in R with Shiny.md index 0fdc6da56d..4505678b6a 100644 --- a/translated/tech/20170120 How to write web apps in R with Shiny.md +++ b/published/20170120 How to write web apps in R with Shiny.md @@ -8,12 +8,11 @@ 我的一个亲密朋友最近在用 R 编写东西。我一直都对它很感兴趣,也一直在试图挤时间,学习更多关于 R 的知识以及可用它做的事情。探索 R 的超强数字处理能力对我而言有些困难,因为我并不如我朋友那样有一个数学头脑。我进展有点慢,但我一直试图将它与我在其他领域的经验联系起来,我甚至开始考虑非常简单的 web 程序。 -[Shiny][1]是一个来自 RStudio 的工具包,它让创建 web 程序变得更容易。它能从 R 控制台轻松安装,只需要一行,最新的稳定版本将加载供你使用。这里有一个很棒的[教程][2],它会带着你理解设置应用的概念,在前面课程基础上构建技能。 Shiny 的授权是 GPLv3,源代码可以在 [GitHub][3] 上获得。 +[Shiny][1] 是一个来自 RStudio 的工具包,它让创建 web 程序变得更容易。它能从 R 控制台轻松安装,只需要一行,就可以加载好最新的稳定版本来使用。这里有一个很棒的[教程][2],它可以在前面课程基础上,带着你理解应用架设的概念。 Shiny 的授权是 GPLv3,源代码可以在 [GitHub][3] 上获得。 这是一个用 Shiny 写的简单的小 web 程序: ``` - library(shiny) server <- function(input, output, session) { @@ -32,11 +31,11 @@ ui <- basicPage( shinyApp(ui = ui, server = server) ``` -当你在输入框中输入文字时,它会被复制到输出框中提示语后。这并没有什么奇特的,但它向你展示了一个 Shiny 程序的基本结构。“服务端”部分允许你处理所有后端工作,如计算、数据库检索或程序需要发生的任何其他操作。“UI”部分定义了接口,它可以根据需要变得简单或复杂。 +当你在输入框中输入文字时,它会被复制到输出框中提示语后。这并没有什么奇特的,但它向你展示了一个 Shiny 程序的基本结构。“server”部分允许你处理所有后端工作,如计算、数据库检索或程序需要发生的任何其他操作。“ui”部分定义了接口,它可以根据需要变得简单或复杂。 -Shiny 中使用 [Bootstrap][4] 包含了大量样式和主题,所以在学习了一点后,就能用 R 创建广泛的、功能丰富的 web 程序。使用附加包可以将功能扩展到更高级的 JavaScript 程序、模板等。 +包括在 Shiny 中的 [Bootstrap][4] 有了大量样式和主题,所以在学习了一点后,就能用 R 创建大量功能丰富的 web 程序。使用附加包可以将功能扩展到更高级的 JavaScript 程序、模板等。 -有几种方式处理 Shiny 的后端工作。如果你只是在本地运行你的程序,加载库就能做到。对于想要发布到网络上的程序,你可以在[ RStudio 的 Shiny 网站][5]上共享它们,运行开源版本的 Shiny 服务器,或通过年度订阅服务从 RStudio 处购买 Shiny Server Pro。 +有几种方式处理 Shiny 的后端工作。如果你只是在本地运行你的程序,加载库就能做到。对于想要发布到网络上的程序,你可以在 [RStudio 的 Shiny 网站][5]上共享它们,运行开源版本的 Shiny 服务器,或通过按年订阅服务从 RStudio 处购买 Shiny Server Pro。 经验丰富的 R 大牛可能已经知道 Shiny 了;它已经存在大约几年了。对于像我这样来自一个完全不同的编程语言,并且希望学习一点 R 的人来说,它是相当有帮助的。 @@ -47,7 +46,7 @@ Shiny 中使用 [Bootstrap][4] 包含了大量样式和主题,所以在学习 ![](https://opensource.com/sites/default/files/styles/profile_pictures/public/ruth1_avi.jpg?itok=I_EE7NmY) -D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前是休斯敦 cPanel 的 Perl 开发人员。 +D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前在休斯敦的 cPanel 任 Perl 开发人员,他也作为首席员工效力于双猫公司。 -------------------------------------------------------------------------------- From bb0423832189b6b535a4ed2edec716af4b9e5f8c Mon Sep 17 00:00:00 2001 From: Flynn Date: Sat, 4 Mar 2017 14:44:10 +0800 Subject: [PATCH 030/190] translating --- ...o Install MariaDB 10 on Debian and Ubuntu.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md b/sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md index c044b6dcb5..f7f46916b1 100644 --- a/sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md +++ b/sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @@ -1,3 +1,4 @@ +ucasFL translating How to Install MariaDB 10 on Debian and Ubuntu ============================================================ @@ -77,7 +78,7 @@ $ sudo apt-get install mariadb-server During the course of installation, you’ll be asked to configure the MariaDB server; set a secure root user password in the interface below. [ - ![Set New Root Password for MariaDB](http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png) + ![Set New Root Password for MariaDB](http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png) ][6] Set New Root Password for MariaDB @@ -85,7 +86,7 @@ Set New Root Password for MariaDB Re-enter the password and press [Enter] to continue with the installation process. [ - ![Repeat MariaDB Password](http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png) + ![Repeat MariaDB Password](http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png) ][7] Repeat MariaDB Password @@ -93,19 +94,19 @@ Repeat MariaDB Password 3. When the installation of MariaDB packages completes, start the database server daemon for the mean time and enable it to start automatically at the next boot as follows: ``` -------------- On SystemD Systems ------------- +------------- On SystemD Systems ------------- $ sudo systemctl start mariadb $ sudo systemctl enable mariadb $ sudo systemctl status mariadb -------------- On SysVinit Systems ------------- -$ sudo service mysql start +------------- On SysVinit Systems ------------- +$ sudo service mysql start $ chkconfig --level 35 mysql on OR $ update-rc.d mysql defaults $ sudo service mysql status ``` [ - ![Start MariaDB Service](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service.png) + ![Start MariaDB Service](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service.png) ][8] Start MariaDB Service @@ -122,7 +123,7 @@ Start MariaDB Service $ sudo mysql_secure_installation ``` [ - ![Secure MariaDB Installation](http://www.tecmint.com/wp-content/uploads/2017/02/sudo-mysql-secure-installation.png) + ![Secure MariaDB Installation](http://www.tecmint.com/wp-content/uploads/2017/02/sudo-mysql-secure-installation.png) ][9] Secure MariaDB Installation @@ -134,7 +135,7 @@ $ mysql -V $ mysql -u root -p ``` [ - ![Check MariaDB Version](http://www.tecmint.com/wp-content/uploads/2017/02/Check-MariaDB-Version.png) + ![Check MariaDB Version](http://www.tecmint.com/wp-content/uploads/2017/02/Check-MariaDB-Version.png) ][10] Check MariaDB Version From dc622bc579c03c9785643aaa4431c64f9500c8c8 Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 4 Mar 2017 15:17:33 +0800 Subject: [PATCH 031/190] PRF:20160917 A Web Crawler With asyncio Coroutines.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Final——累死我了,以后最多一个月校对一篇长文。 @qingyunha 辛苦了,这篇文章翻译的很好,有部分段落遗失(也有可能是作者后来补充了),我也试着补充了。 --- ...7 A Web Crawler With asyncio Coroutines.md | 242 +++++++++--------- 1 file changed, 124 insertions(+), 118 deletions(-) diff --git a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md index da20b9ad1b..a559a95e81 100644 --- a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md +++ b/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md @@ -127,7 +127,7 @@ def loop(): 到目前为止我们展现了什么?我们展示了如何开始一个 I/O 操作和当操作准备好时调用回调函数。异步*框架*,它在单线程中执行并发操作,其建立在两个功能之上,非阻塞套接字和事件循环。 -我们这里达成了“并发性(concurrency)”,但不是传统意义上的“并行性(parallelism)”。也就是说,我们构建了一个可以进行重叠 I/O 的微小系统,它可以在其它操作还在进行的时候就开始一个新的操作。它实际上并没有利用多核来并行执行计算。这个系统是用于解决 I/O 限定(I/O-bound)问题的,而不是解决 CPU 限定(CPU-bound)问题的。(Python 的全局解释器锁禁止在一个进程中以任何方式并行执行 Python 代码。在 Python 中并行化 CPU 限定的算法需要多个进程,或者以将该代码移植为 C 语言并行版本。但是这是另外一个话题了。) +我们这里达成了“并发性(concurrency)”,但不是传统意义上的“并行性(parallelism)”。也就是说,我们构建了一个可以进行重叠 I/O 的微小系统,它可以在其它操作还在进行的时候就开始一个新的操作。它实际上并没有利用多核来并行执行计算。这个系统是用于解决 I/O 密集(I/O-bound)问题的,而不是解决 CPU 密集(CPU-bound)问题的。(Python 的全局解释器锁禁止在一个进程中以任何方式并行执行 Python 代码。在 Python 中并行化 CPU 密集的算法需要多个进程,或者以将该代码移植为 C 语言并行版本。但是这是另外一个话题了。) 所以,我们的事件循环在并发 I/O 上是有效的,因为它并不用为每个连接拨付线程资源。但是在我们开始前,我们需要澄清一个常见的误解:异步比多线程快。通常并不是这样的,事实上,在 Python 中,在处理少量非常活跃的连接时,像我们这样的事件循环是慢于多线程的。在运行时环境中是没有全局解释器锁的,在同样的负载下线程会执行的更好。异步 I/O 真正适用于事件很少、有许多缓慢或睡眠的连接的应用程序。(Jesse 在“[什么是异步,它如何工作,什么时候该用它?](http://pyvideo.org/video/2565/what-is-async-how-does-it-work-and-when-should)”一文中指出了异步所适用和不适用的场景。Mike Bayer 在“[异步 Python 和数据库](http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/)”一文中比较了不同负载情况下异步 I/O 和多线程的不同。) @@ -468,9 +468,9 @@ StopIteration: done ### 使用生成器构建协程 -所以生成器可以暂停,可以给它一个值让它恢复,并且它还有一个返回值。这些特性看起来很适合去建立一个不使用回调的异步编程模型。我们想创造一个协程:一个在程序中可以和其他过程合作调度的过程。我们的协程将会是标准库`asyncio`中协程的一个简化版本,我们将使用生成器,futures和`yield from`语句。 +所以生成器可以暂停,可以给它一个值让它恢复,并且它还有一个返回值。这些特性看起来很适合去建立一个不使用那种乱糟糟的意面似的回调异步编程模型。我们想创造一个这样的“协程”:一个在程序中可以和其他过程合作调度的过程。我们的协程将会是标准库 `asyncio` 中协程的一个简化版本,我们将使用生成器,futures 和 `yield from` 语句。 -首先,我们需要一种方法去代表协程需要等待的未来事件。一个简化的版本是: +首先,我们需要一种方法去代表协程所需要等待的 future 事件。一个简化的版本是: ```python class Future: @@ -487,9 +487,9 @@ class Future: fn(self) ``` -一个future初始化为未解决的,它同过调用`set_result`来解决。[^12] +一个 future 初始化为“未解决的”,它通过调用 `set_result` 来“解决”。(这个 future 缺少很多东西,比如说,当这个 future 解决后,生成(yield)的协程应该马上恢复而不是暂停,但是在我们的代码中却不没有这样做。参见 asyncio 的 Future 类以了解其完整实现。) -让我们用futures和协程来改写我们的fetcher。我们之前用回调写的fetcher如下: +让我们用 future 和协程来改写我们的 fetcher。我们之前用回调写的 `fetch` 如下: ```python class Fetcher: @@ -509,7 +509,7 @@ class Fetcher: # And so on.... ``` -`fetch`方法开始连接一个套接字,然后注册`connected`回调函数,它会在套接字建立连接后调用。现在我们使用协程把这两步合并: +`fetch` 方法开始连接一个套接字,然后注册 `connected` 回调函数,它会在套接字建立连接后调用。现在我们使用协程把这两步合并: ```python def fetch(self): @@ -533,9 +533,9 @@ class Fetcher: print('connected!') ``` -现在,`fetch`是一个生成器,因为他有一个`yield`语句。我们创建一个未决的future,然后yield它,暂停执行直到套接字连接建立。内函数`on_connected`解决这个future。 +现在,`fetch` 是一个生成器,因为它有一个 `yield` 语句。我们创建一个未决的 future,然后 yield 它,暂停 `fetch` 直到套接字连接建立。内联函数 `on_connected` 解决这个 future。 -但是当future被解决,谁来恢复这个生成器?我们需要一个协程驱动器。让我们叫它`task`: +但是当 future 被解决,谁来恢复这个生成器?我们需要一个协程*驱动器*。让我们叫它 “task”: ```python class Task: @@ -560,11 +560,11 @@ Task(fetcher.fetch()) loop() ``` -task通过传递一个None值给`fetch`来启动它。`fetch`运行到它yeild一个future,这个future被task捕获作为`next_future`。当套接字连接建立,事件循环运行回调函数`on_connected`,这里future被解决,`step`被调用,生成器恢复运行。 +task 通过传递一个 None 值给 `fetch` 来启动它。`fetch` 运行到它 yeild 出一个 future,这个 future 被作为 `next_future` 而捕获。当套接字连接建立,事件循环运行回调函数 `on_connected`,这里 future 被解决,`step` 被调用,`fetch` 恢复运行。 -## 用`yield from`重构协程 +### 用 yield from 重构协程 -一旦套接字连接建立,我们就可以发送HTTP请求,然后读取服务器响应。不再需要哪些分散在各处的回调函数,我们把它们放在同一个生成器函数中: +一旦套接字连接建立,我们就可以发送 HTTP GET 请求,然后读取服务器响应。不再需要哪些分散在各处的回调函数,我们把它们放在同一个生成器函数中: ```python def fetch(self): @@ -589,9 +589,9 @@ task通过传递一个None值给`fetch`来启动它。`fetch`运行到它yeild break ``` -从套接字中读取所有信息的代码看起来很通用。我们能不把它提取成一个子过程?现在该Python3的`yield from`登场了。它能让一个生成器委托另一个生成器。 +从套接字中读取所有信息的代码看起来很通用。我们能不把它从 `fetch` 中提取成一个子过程?现在该 Python 3 热捧的 `yield from` 登场了。它能让一个生成器*委派*另一个生成器。 -让我们先回到原来那个简单的生成器: +让我们先回到原来那个简单的生成器例子: ```python >>> def gen_fn(): @@ -603,8 +603,7 @@ task通过传递一个None值给`fetch`来启动它。`fetch`运行到它yeild ... ``` -为了从其他生成器调用这个生成器,我们使用`yield from`: - +为了从其他生成器调用这个生成器,我们使用 `yield from` 委派它: ```python >>> # Generator function: @@ -619,7 +618,7 @@ task通过传递一个None值给`fetch`来启动它。`fetch`运行到它yeild >>> caller = caller_fn() ``` -这个`caller`的行为的和它委派的生成器表现的完全一致: +这个 `caller` 生成器的行为的和它委派的生成器 `gen` 表现的完全一致: ```python >>> caller.send(None) @@ -639,15 +638,15 @@ Traceback (most recent call last): StopIteration ``` -注意到`caller`的指令指针保持15不变,就是`yield from`的地方,即使内部的生成器从一个yield语句运行到下一个yield,它始终不变。[^13]从`caller`外部来看,我们无法分辨yield出的值是来自`caller`还是它委派的生成器。而从`gen`内部来看,我们也不能分辨传给它的值是来自`caller`还是`caller`的外面。`yield from`是一个光滑的管道,值通过它进出`gen`,一直到`gen`结束。 +当 `caller` 自 `gen` 生成(`yield`),`caller` 就不再前进。注意到 `caller` 的指令指针保持15不变,就是 `yield from` 的地方,即使内部的生成器 `gen` 从一个 yield 语句运行到下一个 yield,它始终不变。(事实上,这就是“yield from”在 CPython 中工作的具体方式。函数会在执行每个语句之前提升其指令指针。但是在外部生成器执行“yield from”后,它会将其指令指针减一,以保持其固定在“yield form”语句上。然后其生成其 caller。这个循环不断重复,直到内部生成器抛出 StopIteration,这里指向外部生成器最终允许它自己进行到下一条指令的地方。)从 `caller` 外部来看,我们无法分辨 yield 出的值是来自 `caller` 还是它委派的生成器。而从 `gen` 内部来看,我们也不能分辨传给它的值是来自 `caller` 还是 `caller` 的外面。`yield from` 语句是一个光滑的管道,值通过它进出 `gen`,一直到 `gen` 结束。 -协程可以用`yield from`把工作委派给子协程,还可以接受子协程的返回值。注意到上面的`caller`打印出"return value of yield-from: done"。当`gen`完成后,它的返回值成为`caller`中`yield from`语句的值。 +协程可以用 `yield from` 把工作委派给子协程,并接收子协程的返回值。注意到上面的 `caller` 打印出“return value of yield-from: done”。当 `gen` 完成后,它的返回值成为 `caller` 中 `yield from` 语句的值。 ```python rv = yield from gen ``` -我们批评过基于回调的异步编程模式,其中最大的不满是关于`stack ripping`:当一个回调抛出异常,它的堆栈回溯通常是毫无用处的。它只显示出事件循环运行了它,而没有说为什么。那么协程怎么样? +前面我们批评过基于回调的异步编程模式,其中最大的不满是关于 “stack ripping”:当一个回调抛出异常,它的堆栈回溯通常是毫无用处的。它只显示出事件循环运行了它,而没有说为什么。那么协程怎么样? ```python >>> def gen_fn(): @@ -661,7 +660,7 @@ Traceback (most recent call last): Exception: my error ``` -这还是比较有用的,当异常抛出时,堆栈回溯显示出`caller_fn`委派了`gen_fn`。令人更欣慰的是,你可以像正常函数一样使用异常处理: +这还是非常有用的,当异常抛出时,堆栈回溯显示出 `caller_fn` 委派了 `gen_fn`。令人更欣慰的是,你可以在一次异常处理器中封装这个调用到一个子过程中,像正常函数一样: ```python >>> def gen_fn(): @@ -681,7 +680,7 @@ Exception: my error caught uh oh ``` -所以我们可以像提取子过程一样提取子协程。让我们从fetcher中提取一些有用的子协程。我们先写一个可以读一块数据的协程`read`: +所以我们可以像提取子过程一样提取子协程。让我们从 fetcher 中提取一些有用的子协程。我们先写一个可以读一块数据的协程 `read`: ```python def read(sock): @@ -696,7 +695,7 @@ def read(sock): return chunk ``` -在`read`的基础上,`read_all`协程读取整个信息: +在 `read` 的基础上,`read_all` 协程读取整个信息: ```python def read_all(sock): @@ -710,9 +709,9 @@ def read_all(sock): return b''.join(response) ``` -如果你换个角度看,它们看起来就像在做阻塞I/O的普通函数一样。但是事实上,`read`和`read_all`都是协程。yield from`read`暂停`read_all`直到I/O操作完成。当`read_all`暂停时,事件循环正在做其它的工作等待其他的I/O操作。`read`在下次循环中完成I/O操作时,`read_all`恢复运行。 +如果你换个角度看,抛开 `yield form` 语句的话,它们就像在做阻塞 I/O 的普通函数一样。但是事实上,`read` 和 `read_all` 都是协程。`yield from` `read` 暂停 `read_all` 直到 I/O 操作完成。当 `read_all` 暂停时,asyncio 的事件循环正在做其它的工作并等待其他的 I/O 操作。`read` 在下次循环中当事件就绪,完成 I/O 操作时,`read_all` 恢复运行。 -现在,`fetch`可以直接调用`read_all`: +最终,`fetch` 调用了 `read_all`: ```python class Fetcher: @@ -722,20 +721,50 @@ class Fetcher: self.response = yield from read_all(sock) ``` -神奇的是,Task类不需要做任何改变,它像以前一样驱动`fetch`协程: +神奇的是,Task 类不需要做任何改变,它像以前一样驱动外部的 `fetch` 协程: ```python Task(fetcher.fetch()) loop() ``` -当`read`yield一个future时,task从`yield from`管道中接受它,就像直接从`fetch`接受一样。当循环解决一个future时,task把它的结果送给`fetch`,通过管道,`read`接受到这个值,这完全就像task直接驱动`read`一样: +当 `read` yield 一个 future 时,task 从 `yield from` 管道中接收它,就像这个 future 直接从 `fetch` yield 一样。当循环解决一个 future 时,task 把它的结果送给 `fetch`,通过管道,`read` 接受到这个值,这完全就像 task 直接驱动 `read` 一样: -图 +![Figure 5.3 - Yield From](http://aosabook.org/en/500L/crawler-images/yield-from.png) + +为了完善我们的协程实现,我们再做点打磨:当等待一个 future 时,我们的代码使用 yield;而当委派一个子协程时,使用 yield from。不管是不是协程,我们总是使用 yield form 会更精炼一些。协程并不需要在意它在等待的东西是什么类型。 + +在 Python 中,我们从生成器和迭代器的高度相似中获得了好处,将生成器进化成 caller,迭代器也可以同样获得好处。所以,我们可以通过特殊的实现方式来迭代我们的 Future 类: + +```python + # Method on Future class. + def __iter__(self): + # Tell Task to resume me here. + yield self + return self.result +``` + +future 的 `__iter__` 方法是一个 yield 它自身的一个协程。当我们将代码替换如下时: + +```python +# f is a Future. +yield f +``` + +以及……: + +```python +# f is a Future. +yield from f +``` + +……结果是一样的!驱动 Task 从它的调用 `send` 中接收 future,并当 future 解决后,它发回新的结果给该协程。 + +在每个地方都使用 `yield from` 的好处是什么?为什么比用 `field` 等待 future 并用 `yield from` 委派子协程更好?之所以更好的原因是,一个方法可以自由地改变其实行而不影响到其调用者:它可以是一个当 future 解决后返回一个值的普通方法,也可以是一个包含 `yield from` 语句并返回一个值的协程。无论是哪种情况,调用者仅需要 `yield from` 该方法以等待结果就行。 -亲爱的读者,我们已经完成了对asyncio协程探索。我们深入观察了生成器的机制,实现了简单的future和task。我们指出协程是如何利用两个世界的优点:比线程高效,比回调清晰。当然真正的asyncio比我们这个简化版本要复杂的多。真正的框架需要处理zero-copyI/0,公平调度,异常处理和其他大量特性。 +亲爱的读者,我们已经完成了对 asyncio 协程探索。我们深入观察了生成器的机制,实现了简单的 future 和 task。我们指出协程是如何利用两个世界的优点:比线程高效、比回调清晰的并发 I/O。当然真正的 asyncio 比我们这个简化版本要复杂的多。真正的框架需要处理zero-copy I/0、公平调度、异常处理和其他大量特性。 -使用asyncio编写协程代码比你现在看到的要简单的多。在前面的代码中,我们从基本原理去实现协程,所以你看到了回调,task和future,甚至非阻塞套接字和``select``调用。但是当用asyncio编写应用,这些都不会出现在你的代码中。我们承诺过,你可以像这样下载一个网页: +使用 asyncio 编写协程代码比你现在看到的要简单的多。在前面的代码中,我们从基本原理去实现协程,所以你看到了回调,task 和 future,甚至非阻塞套接字和 `select` 调用。但是当用 asyncio 编写应用,这些都不会出现在你的代码中。我们承诺过,你可以像这样下载一个网页: ```python @asyncio.coroutine @@ -744,17 +773,17 @@ loop() body = yield from response.read() ``` -对我们的探索还满意么?回到我们原始的任务:使用asyncio写一个网络爬虫。 +对我们的探索还满意么?回到我们原始的任务:使用 asyncio 写一个网络爬虫。 -## 使用协程 +### 使用协程 -我们从描述爬虫如何工作开始。现在是时候用asynio去实现它了。 +我们将从描述爬虫如何工作开始。现在是时候用 asynio 去实现它了。 -我们爬虫从获取第一个网页开始,解析出链接并把它们加到队列中。此后它开始傲游整个网站,并发的获取网页。倒是由于客户端和服务端的限制,我们希望有一个最大数目的worker。任何时候一个worker完成一个网页的获取,它应该立即从队列中取出下一个链接。我们会遇到没有事干的时候,所以worker必须能够暂停。一旦又有worker获取一个有很多链接的网页,队列会突增,暂停的worker立马被唤醒。最后,当任务完成后我们的程序必须能退出。 +我们的爬虫从获取第一个网页开始,解析出链接并把它们加到队列中。此后它开始傲游整个网站,并发地获取网页。但是由于客户端和服务端的负载限制,我们希望有一个最大数目的运行的 worker,不能再多。任何时候一个 worker 完成一个网页的获取,它应该立即从队列中取出下一个链接。我们会遇到没有那么多事干的时候,所以一些 worker 必须能够暂停。一旦又有 worker 获取一个有很多链接的网页,队列会突增,暂停的 worker 立马被唤醒干活。最后,当任务完成后我们的程序必须马上退出。 -假如你的worker是线程,怎样去描述你的算法?我们可以使用Python标准库中的同步队列。每次有新的一项加入,队列增加它的tasks计数器。线程worker完成一个任务后调用`task_done`。主线程阻塞在`Queue.join`,直到tasks计数器与`task_done`调用次数相匹配,然后退出。 - -通过个一asynio队列,协程使用和线程一样的模式来实现。首先我们导入它[^6]: +假如你的 worker 是线程,怎样去描述你的爬虫算法?我们可以使用 Python 标准库中的[同步队列](https://docs.python.org/3/library/queue.html)。每次有新的一项加入,队列增加它的 “tasks” 计数器。线程 worker 完成一个任务后调用 `task_done`。主线程阻塞在 `Queue.join`,直到“tasks”计数器与 `task_done` 调用次数相匹配,然后退出。 + +协程通过 asyncio 队列,使用和线程一样的模式来实现!首先我们[导入它](https://docs.python.org/3/library/asyncio-sync.html): ```python try: @@ -765,7 +794,7 @@ except ImportError: from asyncio import Queue ``` -我们把worker的共享状态收集在一个crawler类中,主要的逻辑写在`crawl`方法中。我们在一个协程中启动`crawl`,运行asyncio的事件循环直到`crawl`完成: +我们把 worker 的共享状态收集在一个 crawler 类中,主要的逻辑写在 `crawl` 方法中。我们在一个协程中启动 `crawl`,运行 asyncio 的事件循环直到 `crawl` 完成: ```python loop = asyncio.get_event_loop() @@ -776,7 +805,7 @@ crawler = crawling.Crawler('http://xkcd.com', loop.run_until_complete(crawler.crawl()) ``` -crawler用一个跟URL和最大重定向数来初始化,它把`(URL, max_redirect`)序对放入队列中。(为什么要这样做,敬请期待) +crawler 用一个根 URL 和最大重定向数 `max_redirect` 来初始化,它把 `(URL, max_redirect)` 序对放入队列中。(为什么要这样做,请看下文) ```python class Crawler: @@ -794,12 +823,12 @@ class Crawler: self.q.put((root_url, self.max_redirect)) ``` -现在队列中未完成的任务数是1。回到我们的主程序,启动事件循环和`crawl`方法: +现在队列中未完成的任务数是 1。回到我们的主程序,启动事件循环和 `crawl` 方法: ```python loop.run_until_complete(crawler.crawl()) ``` -`crawl`协程唤起workers。它像一个主线程:阻塞在`join`上直到所有任务完成,同时workers在后台运行。 +`crawl` 协程把 worker 们赶起来干活。它像一个主线程:阻塞在 `join` 上直到所有任务完成,同时 worker 们在后台运行。 ```python @asyncio.coroutine @@ -814,15 +843,15 @@ loop.run_until_complete(crawler.crawl()) w.cancel() ``` -如果worker是线程,可能我们不会一次把它们全部创建出来。为了避免创建线程的昂贵代价,通常一个线程池会按需增长。但是协程很便宜,我们简单的把他们全部创建出来。 +如果 worker 是线程,可能我们不会一次把它们全部创建出来。为了避免创建线程的昂贵代价,通常一个线程池会按需增长。但是协程很廉价,我们可以直接把他们全部创建出来。 -怎么关闭这个`crawler`很有趣。当`join`完成,worker存活但是被暂停:他们等待更多的URL。所以主协程在退出之前清除它们。否则Python解释器关闭调用所有对象的析构函数,活着的worker叫喊到: +怎么关闭这个 `crawler` 很有趣。当 `join` 完成,worker 存活但是被暂停:他们等待更多的 URL,所以主协程要在退出之前清除它们。否则 Python 解释器关闭并调用所有对象的析构函数时,活着的 worker 会哭喊到: ``` ERROR:asyncio:Task was destroyed but it is pending! ``` -`cancel`又是如何工作的呢?生成器还有一个我们还没介绍的特点。你可以从外部抛一个异常给它: +`cancel` 又是如何工作的呢?生成器还有一个我们还没介绍的特点。你可以从外部抛一个异常给它: ```python @@ -836,7 +865,7 @@ Traceback (most recent call last): Exception: error ``` -生成器被`throw`恢复,但是他现在抛出一个异常。如何生成器没有捕获异常的代码,这个异常被传递到顶层。所以注销一个协程: +生成器被 `throw` 恢复,但是它现在抛出一个异常。如过生成器的调用堆栈中没有捕获异常的代码,这个异常被传递到顶层。所以注销一个协程: ```python # Method of Task class. @@ -844,17 +873,31 @@ Exception: error self.coro.throw(CancelledError) ``` -任何时候生成器在`yield from`语句暂停,被恢复并且抛出一个异常。我们在task的`step`方法中处理撤销。 +任何时候生成器暂停,在某些 `yield from` 语句它恢复并且抛出一个异常。我们在 task 的 `step` 方法中处理注销。 + +```python + # Method of Task class. + def step(self, future): + try: + next_future = self.coro.send(future.result) + except CancelledError: + self.cancelled = True + return + except StopIteration: + return + + next_future.add_done_callback(self.step) +``` -现在worker直到他被注销了,所以当它被销毁时,它不再抱怨。 +现在 task 知道它被注销了,所以当它被销毁时,它不再抱怨。 -一旦`crawl`注销了worker,它就退出。同时事件循环看见这个协程结束了,也就退出l。 +一旦 `crawl` 注销了 worker,它就退出。同时事件循环看见这个协程结束了(我们后面会见到的),也就退出。 ```python loop.run_until_complete(crawler.crawl()) ``` -`crawl`方法包含了所有主协程需要做的事。而worker则完成了从队列中获取URL,获取网页,解析它们得到新的链接。每个worker独立的运行`worker`协程: +`crawl` 方法包含了所有主协程需要做的事。而 worker 则完成从队列中获取 URL、获取网页、解析它们得到新的链接。每个 worker 独立地运行 `work` 协程: ```python @asyncio.coroutine @@ -867,19 +910,19 @@ loop.run_until_complete(crawler.crawl()) self.q.task_done() ``` -Python看见这段代码包含`yield from`语句,就把它编译成生成器函数。所以在`crawl`方法中,我们调用了10次`self.work`,但并没有真正执行,它仅仅创建了10个生成器对象并把它们包装成Task对象。task接收生成器yield的future,通过调用send方法,future的结果做为send的参数,来驱动它。由于生成器有自己的栈帧,它们可以独立运行,独立的局部变量和指令指针。 +Python 看见这段代码包含 `yield from` 语句,就把它编译成生成器函数。所以在 `crawl` 方法中,我们调用了 10 次 `self.work`,但并没有真正执行,它仅仅创建了 10 个指向这段代码的生成器对象并把它们包装成 Task 对象。task 接收每个生成器所 yield 的 future,通过调用 `send` 方法,当 future 解决时,用 future 的结果做为 `send` 的参数,来驱动它。由于生成器有自己的栈帧,它们可以独立运行,带有独立的局部变量和指令指针。 -worker使用队列来协调, 等待新的URL: +worker 使用队列来协调其小伙伴。它这样等待新的 URL: ```python url, max_redirect = yield from self.q.get() ``` -队列的`get `方法也是一个协程,它一直暂停到有新的URL进入队列。 +队列的 `get` 方法自身也是一个协程,它一直暂停到有新的 URL 进入队列,然后恢复并返回该条目。 -碰巧,这也是最后crawl停止时,协程暂停的地方。当主协程注销worker时,从协程的角度,`yield from`抛出`CancelledError`结束了它在循环中的最后旅程。 +碰巧,这也是当主协程注销 worker 时,最后 crawl 停止,worker 协程暂停的地方。从协程的角度,`yield from` 抛出`CancelledError` 结束了它在循环中的最后旅程。 -worker获取一个网页,解析链接,把新的链接放入队列中,接着调用`task_done`减小计数器。最终一个worker遇到一个没有新链接的网页,并且队列里也没有任务,这次`task_done`的调用使计数器减为0,而`crawl`正阻塞在`join`方法上,现在它就可以结束了。 +worker 获取一个网页,解析链接,把新的链接放入队列中,接着调用`task_done`减小计数器。最终一个worker遇到一个没有新链接的网页,并且队列里也没有任务,这次`task_done`的调用使计数器减为0,而`crawl`正阻塞在`join`方法上,现在它就可以结束了。 我们承诺过要解释为什么队列中要使用序对,像这样: @@ -888,16 +931,19 @@ worker获取一个网页,解析链接,把新的链接放入队列中,接 ('http://xkcd.com/353', 10) ``` -新的URL的重定向次数是10。获取一个特别的URL会重定向一个新的位置。我们减小重定向次数,并把新的URL放入队列中。 +新的 URL 的重定向次数是10。获取一个特别的 URL 会重定向一个新的位置。我们减小重定向次数,并把新的 URL 放入队列中。 ```python # URL with a trailing slash. Nine redirects left. ('http://xkcd.com/353/', 9) ``` -我们使用的`aiohttp`默认的会重定向返回最终的结果。但是,我们告诉它不要这样做,爬虫自己处理重定向。所以它可以合并那些目的相同的重定向路径:如果我们已经看到一个URL,说明它已经从其他的地方走过这条路了。 - - +我们使用的 `aiohttp` 默认会跟踪重定向并返回最终结果。但是,我们告诉它不要这样做,爬虫自己来处理重定向,以便它可以合并那些目的相同的重定向路径:如果我们已经在 `self.seen_urls` 看到一个 URL,说明它已经从其他的地方走过这条路了。 + +![Figure 5.4 - Redirects](http://aosabook.org/en/500L/crawler-images/redirects.png) + +crawler 获取“foo”并发现它重定向到了“baz”,所以它会加“baz”到队列和 `seen_urls` 中。如果它获取的下一个页面“bar” 也重定向到“baz”,fetcher 不会再次将 “baz”加入到队列中。如果该响应是一个页面,而不是一个重定向,`fetch` 会解析它的链接,并把新链接放到队列中。 + ```python @asyncio.coroutine def fetch(self, url, max_redirect): @@ -929,17 +975,17 @@ worker获取一个网页,解析链接,把新的链接放入队列中,接 yield from response.release() ``` -如果这是多进程代码,就有可能遇到讨厌的竞争条件。比如,一个work检查一个链接是否在`seen_urls`中,如果没有它就把这个链接加到队列中并把它放到`seen_urls`中。如果它在这两步操作之间被中断,而另一个work解析到相同的链接,发现它并没有出现在`seen_urls`中就把它加入队列中。这导致同样的链接在队列中出现两次,做了重复的工作和错误的统计。 +如果这是多进程代码,就有可能遇到讨厌的竞争条件。比如,一个 worker 检查一个链接是否在 `seen_urls` 中,如果没有它就把这个链接加到队列中并把它放到 `seen_urls` 中。如果它在这两步操作之间被中断,而另一个 worker 解析到相同的链接,发现它并没有出现在 `seen_urls` 中就把它加入队列中。这(至少)导致同样的链接在队列中出现两次,做了重复的工作和错误的统计。 -然而,一个协程只在`yield from`是才会被中断。这是协程比多线程少遇到竞争条件的关键。多线程必须获得锁来明确的进入一个临界区,否则它就是可中断的。而Python的协程默认是不会被中断的,只有它yield主动放弃控制权。 +然而,一个协程只在 `yield from` 时才会被中断。这是协程比多线程少遇到竞争条件的关键。多线程必须获得锁来明确的进入一个临界区,否则它就是可中断的。而 Python 的协程默认是不会被中断的,只有它明确 yield 时才主动放弃控制权。 -我们不再需要在用回调方式时的fetcher类了。这个类只是不高效回调的一个变通方法:在等待I/O时,它需要一个存储状态的地方,因为局部变量并不能在函数调用间保留。倒是`fetch`协程可以像普通函数一样用局部变量保存它的状态,所以我们不再需要一个类。 +我们不再需要在用回调方式时用的 fetcher 类了。这个类只是不高效回调的一个变通方法:在等待 I/O 时,它需要一个存储状态的地方,因为局部变量并不能在函数调用间保留。倒是 `fetch` 协程可以像普通函数一样用局部变量保存它的状态,所以我们不再需要一个类。 -当`fetch`完成对服务器回应的处理,它返回到调用它的work。work调用`task_done`,接着从队列中取出一个URL。 +当 `fetch` 完成对服务器响应的处理,它返回到它的调用者 `work`。`work` 方法对队列调用 `task_done`,接着从队列中取出一个要获取的 URL。 -当`fetch`把新的链接放入队列中,它增加未完成的任务计数器。主协程在等待`q.join`。而当没有新的链接并且这是队列中最后一个URL,work调用`task_done`,任务计数器变为0,主协程从`join`中退出。 +当 `fetch` 把新的链接放入队列中,它增加未完成的任务计数器,并停留在主协程,主协程在等待 `q.join`,处于暂停状态。而当没有新的链接并且这是队列中最后一个 URL 时,当 `work 调用 `task_done`,任务计数器变为 0,主协程从 `join` 中退出。 -与work和主协程一起工作的队列代码像这样: +与 worker 和主协程一起工作的队列代码像这样(实际的 `asyncio.Queue` 实现在 Future 所展示的地方使用 `asyncio.Event` 。不同之处在于 Event 是可以重置的,而 Future 不能从已解决返回变成待决。) ```python class Queue: @@ -963,15 +1009,15 @@ class Queue: yield from self._join_future ``` -主协程`crawl`yield from`join`。所以当最后一个workd把计数器减为0,它告诉`crawl`恢复运行。 +主协程 `crawl` yield from `join`。所以当最后一个 worker 把计数器减为 0,它告诉 `crawl` 恢复运行并结束。 -旅程快要结束了。我们的程序从`crawl`调用开始: +旅程快要结束了。我们的程序从 `crawl` 调用开始: ```python loop.run_until_complete(self.crawler.crawl()) ``` -程序如何结束?因为`crawl`是一个生成器函数。调用它返回一个生成器。为了驱动它,asyncio把它包装成一个task: +程序如何结束?因为 `crawl` 是一个生成器函数,调用它返回一个生成器。为了驱动它,asyncio 把它包装成一个 task: class EventLoop: @@ -991,16 +1037,16 @@ def stop_callback(future): raise StopError ``` -当这个任务完成,它抛出`StopError`, 事件循环把这个异常当作正常退出的信号。 +当这个任务完成,它抛出 `StopError`,事件循环把这个异常当作正常退出的信号。 -但是,task的`add_done_callbock`和`result`方法又是什么呢?你可能认为task就像一个future,不错,你的直觉是对的。我们必须承认一个向你隐藏的细节,task是future。 +但是,task 的 `add_done_callbock` 和 `result` 方法又是什么呢?你可能认为 task 就像一个 future,不错,你的直觉是对的。我们必须承认一个向你隐藏的细节,task 是 future。 ```python class Task(Future): """A coroutine wrapped in a Future.""" ``` -通常,一个future被别人调用`set_result`。但是task,当协程结束时,它自己解决自己。记得我们解释过当Python生成器返回时,它抛出一个特殊的`StopIteration`异常: +通常,一个 future 被别人调用 `set_result` 解决。但是 task,当协程结束时,它自己解决自己。记得我们解释过当 Python 生成器返回时,它抛出一个特殊的 `StopIteration` 异常: ```python # Method of class Task. @@ -1020,7 +1066,7 @@ class Task(Future): next_future.add_done_callback(self.step) ``` -所以当事件循环调用`task.add_done_callback(stop_callback)`,它就准备被这个task结束。在看一次`run_until_complete`; +所以当事件循环调用 `task.add_done_callback(stop_callback)`,它就准备被这个 task 停止。在看一次`run_until_complete`: ```python # Method of event loop. @@ -1033,61 +1079,21 @@ class Task(Future): pass ``` -当task捕获`StopIteration`并解决自己,这个回调重循环中抛出`StopError`。循环结束调用栈回到`run_until_complete`。我们的程序结束。 +当 task 捕获 `StopIteration` 并解决自己,这个回调从循环中抛出 `StopError`。循环结束,调用栈回到`run_until_complete`。我们的程序结束。 -## 总结 +### 总结 -现代的程序越来越多是I/O密集型而不是CPU密集型。对于这样的程序,Python的线程和不合适:全局锁阻止真正的并行计算,并且抢占切换也导致他们更容易出现竞争。异步通常是正确的选择。但是随着基于回调的异步代码增加,它会变得非常混乱。协程是一个更整洁的替代者。它们自然的重构成子过程,有健全的异常处理和栈追溯。 +现代的程序越来越多是 I/O 密集型而不是 CPU 密集型。对于这样的程序,Python 的线程在两个方面不合适:全局解释器锁阻止真正的并行计算,并且抢占切换也导致他们更容易出现竞争。异步通常是正确的选择。但是随着基于回调的异步代码增加,它会变得非常混乱。协程是一个更整洁的替代者。它们自然地重构成子过程,有健全的异常处理和栈追溯。 -如果我们换个角度看`yield from`语句,一个协程看起来像一个传统的线程。甚至我们采用金典的多线程模式编程,不需要重新发明。因此,与回调相比,协程更适合有经验的多线程的编码者。 +如果我们换个角度看 `yield from` 语句,一个协程看起来像一个传统的做阻塞 I/O 的线程。甚至我们可以采用经典的多线程模式编程,不需要重新发明。因此,与回调相比,协程更适合有经验的多线程的编码者。 -但是当我们打开眼睛关注`yield from`语句,我们能看到协程放弃控制权的标志点。不像多线程,协程展示出我们的代码哪里可以被中断哪里不能。在Glyph Lefkowitz富有启发性的文章"Unyielding"[^4]:"线程让局部推理变得困难,然而局部推理可能是软件开发中最重要的事"。然而,明确的yield,让"通过子过程本身而不是整个系统理解它的行为(应此,正确性)"成为可能。 +但是当我们睁开眼睛关注 `yield from` 语句,我们能看到协程放弃控制权、允许其它人运行的标志点。不像多线程,协程展示出我们的代码哪里可以被中断哪里不能。在 Glyph Lefkowitz 富有启发性的文章“[Unyielding](https://glyph.twistedmatrix.com/2014/02/unyielding.html)”:“线程让局部推理变得困难,然而局部推理可能是软件开发中最重要的事”。然而,明确的 yield,让“通过过程本身而不是整个系统理解它的行为(和因此、正确性)”成为可能。 -这章写于Python和异步的复兴时期。你刚学到的基于生成器的的协程,在2014年发布在Python 3.4的"asyncio"模块。2015年9月,Python 3.5发布,协程成为语言的一部分。这个原生的协程通过"async def"来声明, 使用"await"而不是"yield from"委托一个协程或者等待Future。 +这章写于 Python 和异步的复兴时期。你刚学到的基于生成器的的协程,在 2014 年发布在 Python 3.4 的 asyncio 模块中。2015 年 9 月,Python 3.5 发布,协程成为语言的一部分。这个原生的协程通过“async def”来声明, 使用“await”而不是“yield from”委托一个协程或者等待 Future。 +除了这些优点,核心的思想不变。Python 新的原生协程与生成器只是在语法上不同,工作原理非常相似。事实上,在 Python 解释器中它们共用同一个实现方法。Task、Future 和事件循环在 asynico 中扮演着同样的角色。 -除了这些优点,核心的思想不变。Python新的原生协程与生成器只是在语法上不同,工作原理非常相似。事实上,在Python解释器中它们公用同一个实现方法。Task,Future和事件循环扮演这在asynico中同样的角色。 - -你已经知道asyncio协程是如何工作的了,现在你可以忘记大部分的细节。这些机制隐藏在一个整洁的接口下。但是你对这基本原理的理解能让你在现代异步环境下正确而高效的编写代码。 - -[^4]: [https://glyph.twistedmatrix.com/2014/02/unyielding.html](https://glyph.twistedmatrix.com/2014/02/unyielding.html) - -[^5]: [https://docs.python.org/3/library/queue.html](https://docs.python.org/3/library/queue.html) - -[^6]: [https://docs.python.org/3/library/asyncio-sync.html](https://docs.python.org/3/library/asyncio-sync.html) - -[^7]: For a complex solution to this problem, see [http://www.tornadoweb.org/en/stable/stack_context.html](http://www.tornadoweb.org/en/stable/stack_context.html) - -[^8]: [http://www.kegel.com/c10k.html](http://www.kegel.com/c10k.html) - -[^9]: The actual `asyncio.Queue` implementation uses an `asyncio.Event` in place of the Future shown here. The difference is an Event can be reset, whereas a Future cannot transition from resolved back to pending. - -[^10]: The `@asyncio.coroutine` decorator is not magical. In fact, if it decorates a generator function and the `PYTHONASYNCIODEBUG` environment variable is not set, the decorator does practically nothing. It just sets an attribute, `_is_coroutine`, for the convenience of other parts of the framework. It is possible to use asyncio with bare generators not decorated with `@asyncio.coroutine` at all. - - -[^11]: Jesse listed indications and contraindications for using async in "What Is Async, How Does It Work, And When Should I Use It?", available at pyvideo.org. -[^bayer]: Mike Bayer compared the throughput of asyncio and multithreading for different workloads in his "Asynchronous Python and Databases": http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/ - - -[^11]: Jesse listed indications and contraindications for using async in ["What Is Async, How Does It Work, And When Should I Use It?":](http://pyvideo.org/video/2565/what-is-async-how-does-it-work-and-when-should). Mike Bayer compared the throughput of asyncio and multithreading for different workloads in ["Asynchronous Python and Databases":](http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/) - - -[^12]: This future has many deficiencies. For example, once this future is resolved, a coroutine that yields it should resume immediately instead of pausing, but with our code it does not. See asyncio's Future class for a complete implementation. - -[^13]: In fact, this is exactly how "yield from" works in CPython. A function increments its instruction pointer before executing each statement. But after the outer generator executes "yield from", it subtracts 1 from its instruction pointer to keep itself pinned at the "yield from" statement. Then it yields to *its* caller. The cycle repeats until the inner generator throws `StopIteration`, at which point the outer generator finally allows itself to advance to the next instruction. - -[^14]: Python's global interpreter lock prohibits running Python code in parallel in one process anyway. Parallelizing CPU-bound algorithms in Python requires multiple processes, or writing the parallel portions of the code in C. But that is a topic for another day. - -[^15]: Even calls to `send` can block, if the recipient is slow to acknowledge outstanding messages and the system's buffer of outgoing data is full. - - -[^16]: Guido introduced the standard asyncio library, called "Tulip" then, at [PyCon 2013](http://pyvideo.org/video/1667/keynote). - - -[^16]: Guido introduced the standard asyncio library, called "Tulip" then, at PyCon 2013. - - -[^17]: Python 3.5's built-in coroutines are described in [PEP 492](https://www.python.org/dev/peps/pep-0492/), "Coroutines with async and await syntax." +你已经知道 asyncio 协程是如何工作的了,现在你可以忘记大部分的细节。这些机制隐藏在一个整洁的接口下。但是你对这基本原理的理解能让你在现代异步环境下正确而高效的编写代码。 -------------------------------------- via: http://aosabook.org/en/500L/pages/a-web-crawler-with-asyncio-coroutines.html From aa6e6d9466c03a7ea71e419c5e33731fa2653bdc Mon Sep 17 00:00:00 2001 From: wxy Date: Sat, 4 Mar 2017 16:05:01 +0800 Subject: [PATCH 032/190] PUB: 20160917 A Web Crawler With asyncio Coroutines.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://linux.cn/article-8265-1.html 等陆续三篇 @qingyunha --- .../20160917 A Web Crawler With asyncio Coroutines.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20160917 A Web Crawler With asyncio Coroutines.md (97%) diff --git a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md b/published/20160917 A Web Crawler With asyncio Coroutines.md similarity index 97% rename from translated/tech/20160917 A Web Crawler With asyncio Coroutines.md rename to published/20160917 A Web Crawler With asyncio Coroutines.md index a559a95e81..a18cdd49af 100644 --- a/translated/tech/20160917 A Web Crawler With asyncio Coroutines.md +++ b/published/20160917 A Web Crawler With asyncio Coroutines.md @@ -646,7 +646,7 @@ StopIteration rv = yield from gen ``` -前面我们批评过基于回调的异步编程模式,其中最大的不满是关于 “stack ripping”:当一个回调抛出异常,它的堆栈回溯通常是毫无用处的。它只显示出事件循环运行了它,而没有说为什么。那么协程怎么样? +前面我们批评过基于回调的异步编程模式,其中最大的不满是关于 “堆栈撕裂(stack ripping)”:当一个回调抛出异常,它的堆栈回溯通常是毫无用处的。它只显示出事件循环运行了它,而没有说为什么。那么协程怎么样? ```python >>> def gen_fn(): @@ -1019,7 +1019,7 @@ loop.run_until_complete(self.crawler.crawl()) 程序如何结束?因为 `crawl` 是一个生成器函数,调用它返回一个生成器。为了驱动它,asyncio 把它包装成一个 task: - +```python class EventLoop: def run_until_complete(self, coro): """Run until the coroutine is done.""" From 27de7694a4c90ba18043fd477c864315805f881c Mon Sep 17 00:00:00 2001 From: Flynn Date: Sat, 4 Mar 2017 16:30:28 +0800 Subject: [PATCH 033/190] translated --- ...Install MariaDB 10 on Debian and Ubuntu.md | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) rename {sources => translated}/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md (72%) diff --git a/sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md similarity index 72% rename from sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md rename to translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md index f7f46916b1..f13a3f437d 100644 --- a/sources/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md +++ b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @@ -1,18 +1,24 @@ -ucasFL translating How to Install MariaDB 10 on Debian and Ubuntu +如何在 Debian 和 Ubuntu 上安装 MariaDB 10 ============================================================ MariaDB is a free and open source fork of the popular MySQL database management server software. It is developed under the GPLv2 (General Public License version 2) by the original developers of MySQL and is intended to remain open source. +MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个免费并且开源的分支。它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源。 It is designed to achieve high compatibility with MySQL. For starters, you can read [MariaDB vs MySQL][5] features for more information and importantly, it is used by big companies/organizations such as Wikipedia, WordPress.com, Google plus and many more. +它被设计来实现 MySQL 的高兼容性。对于初学者,可以阅读 [MariaDB vs MySQL][5] 来了解关于它们的特性的更多信息。更重要的是,它被一些大公司/组织使用,比如 Wikipedia、WordPress.com 和 Google plus ,除此之外还有更多的。 In this article, we will show you how to install MariaDB 10.1 stable version in various Debian and Ubuntu distribution releases. +在这篇文章中,我将向你们展示如何在 Debian 和 Ubuntu 发行版中安装 MariaDB 10.1 稳定版。 ### Install MariaDB in Debian and Ubuntu +### 在 Debian 和 Ubuntu 上安装 MariaDB 1. Before installing MariaDB, you’ll have to import the repository key and add the MariaDB repository with the following commands: +1. 在安装之前 MariaDB 之前,你需要通过下面的命令导入仓库密匙并获取 MariaDB 仓库 #### On Debian 10(Sid) +#### 在 Debian 10(Sid) 上 ``` $ sudo apt-get install software-properties-common @@ -21,6 +27,7 @@ $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mari ``` #### On Debian 9 (Stretch) +#### 在 Debian 9(Stretch) 上 ``` $ sudo apt-get install software-properties-common @@ -29,6 +36,7 @@ $ sudo add-apt-repository 'deb [arch=amd64] http://www.ftp.saix.net/DB/mariadb/r ``` #### On Debian 8 (Jessie) +#### 在 Debian 8(Jessie) 上 ``` $ sudo apt-get install software-properties-common @@ -37,6 +45,7 @@ $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net ``` #### On Debian 7 (Wheezy) +#### 在 Debian 7(Wheezy) 上 ``` $ sudo apt-get install python-software-properties @@ -45,6 +54,7 @@ $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mari ``` #### On Ubuntu 16.10 (Yakkety Yak) +#### 在 Ubuntu 16.10(Yakkety Yak) 上 ``` $ sudo apt-get install software-properties-common @@ -53,6 +63,7 @@ $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mari ``` #### On Ubuntu 16.04 (Xenial Xerus) +#### 在 Ubuntu 16.04 (Xenial Xerus) 上 ``` $ sudo apt-get install software-properties-common @@ -61,6 +72,7 @@ $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net ``` #### On Ubuntu 14.04 (Trusty) +#### 在 Ubuntu 14.04 (Trusty) 上 ``` $ sudo apt-get install software-properties-common @@ -69,6 +81,7 @@ $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net ``` 2. Then update the system packages sources list, and install MariaDB server like so: +2. 然后,更新系统安装包列表,并像下面这样安装 MariaDB 服务器: ``` $ sudo apt-get update @@ -76,22 +89,28 @@ $ sudo apt-get install mariadb-server ``` During the course of installation, you’ll be asked to configure the MariaDB server; set a secure root user password in the interface below. +安装过程中,将会请求你配置 MariaDB 服务器;在下面的页面中设置一个安全的 root 用户密码: [ ![Set New Root Password for MariaDB](http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png) ][6] Set New Root Password for MariaDB +为 MariaDB 设置新的 Root 密码 Re-enter the password and press [Enter] to continue with the installation process. +重新输入密码并按下 [ENTER] 键来继续安装。 + [ ![Repeat MariaDB Password](http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png) ][7] Repeat MariaDB Password +重复输入 MariaDB 密码 3. When the installation of MariaDB packages completes, start the database server daemon for the mean time and enable it to start automatically at the next boot as follows: +当 MariaDB 安装包安装完成以后,启动数据库服务器 daemon,同时启用它,使得在下次开机时它能够像下面这样自动启动: ``` ------------- On SystemD Systems ------------- @@ -110,14 +129,21 @@ $ sudo service mysql status ][8] Start MariaDB Service +开启 MariaDB 服务 4. Then run the `mysql_secure_installation` script to secure the database where you can: +4. 然后,运行 `mysql_secure_installation` 脚本来保护数据库,在这儿你可以: 1. set root password (if not set in the configuration step above). 2. disable remote root login 3. remove test database 4. remove anonymous users and 5. reload privileges +1. 设置 root 密码(如果在上面的配置环节你没有进行设置的话)。 +2. 禁止远程 root 登录 +3. 移除测试数据库 +4. 移除匿名用户 +5. 重装特权 ``` $ sudo mysql_secure_installation @@ -127,8 +153,10 @@ $ sudo mysql_secure_installation ][9] Secure MariaDB Installation +保护 MariaDB 安装 5. Once the database server is secured, check it’s installed version and login to the MariaDB command shell as follows: +5. 一旦数据库服务器受保护以后,可以使用下面的 shell 命令查看已安装版本和登录 MariaDB: ``` $ mysql -V @@ -139,17 +167,25 @@ $ mysql -u root -p ][10] Check MariaDB Version +查看 MariaDB 版本 To start learning MySQL/MariaDB, read through: +开始学习 MySQL/MariaDB, 请阅读: 1. [Learn MySQL / MariaDB for Beginners – Part 1][1] 2. [Learn MySQL / MariaDB for Beginners – Part 2][2] 3. [MySQL Basic Database Administration Commands – Part III][3] 4. [20 MySQL (Mysqladmin) Commands for Database Administration – Part IV][4] +1. [MySQL / MariaDB 初学者学习指南 — Part 1][1] +2. [MySQL / MariaDB 初学者学习指南 — Part 2][2] +3. [MySQL 基本数据库管理命令 — Part III][3] +4. [针对数据库管理员的 20 个 MySQL (Mysqladmin) 命令][4] And check out these 4 useful commandline tools to [monitor MySQL/MariaDB performance][11] in Linux and also go through these [15 useful MySQL/MariaDB performance tuning and optimization tips][12]. +查看在 Linux 中[监控 MySQL/MariaDB 性能][11]的四个有用的命令行工具,同时浏览 [15 个有用的 MySQL/MariaDB 性能调整和优化技巧][12]。 That’s all. In this article, we showed you how to install MariaDB 10.1 stable version in various Debian and Ubuntu releases. You can send us any questions/thoughts via the comment form below. +这就是本文的全部内容了。在这篇文章中,我们向你展示了如何在 Debian 和 Ubuntu 的不同发行版中安装 MariaDB 10.1 稳定版。你可以通过下面的评论框给我们提任何问题或者想法。 -------------------------------------------------------------------------------- @@ -157,6 +193,9 @@ That’s all. In this article, we showed you how to install MariaDB 10.1 stabl 作者简介: 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. +Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux 系统管理员和网络开发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。 + + -------------------------------------------------------------------------------- From 0b5faaff4a1d6b23e5330cdd13d024643f2d8d0a Mon Sep 17 00:00:00 2001 From: Flynn Date: Sat, 4 Mar 2017 16:38:12 +0800 Subject: [PATCH 034/190] translating --- ...tall and Configure FTP Server in Ubuntu.md | 19 ++++---- ...Install MariaDB 10 on Debian and Ubuntu.md | 45 ++----------------- 2 files changed, 14 insertions(+), 50 deletions(-) diff --git a/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md b/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md index e1032d8adf..76e297cad5 100644 --- a/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md +++ b/sources/tech/20170221 How to Install and Configure FTP Server in Ubuntu.md @@ -1,3 +1,4 @@ +ucasfl translating How to Install and Configure FTP Server in Ubuntu ============================================================ @@ -21,10 +22,10 @@ $ sudo apt-get install vsftpd 2. Once the installation completes, the service will be disabled initially, therefore, we need to start it manually for the mean time and also enable it to start automatically from the next system boot: ``` -------------- On SystemD ------------- +------------- On SystemD ------------- # systemctl start vsftpd # systemctl enable vsftpd -------------- On SysVInit ------------- +------------- On SysVInit ------------- # service vsftpd start # chkconfig --level 35 vsftpd on ``` @@ -101,9 +102,9 @@ And we must as well understand that VSFTPD does not permit the chroot jail direc Save the file and close it. Then we have to restart VSFTPD services for the changes above to take effect: ``` -------------- On SystemD ------------- +------------- On SystemD ------------- # systemctl restart vsftpd -------------- On SysVInit ------------- +------------- On SysVInit ------------- # service vsftpd restart ``` @@ -164,7 +165,7 @@ Using binary mode to transfer files. ftp> ls ``` [ - ![Verify FTP Login in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-Login-in-Ubuntu.png) + ![Verify FTP Login in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-Login-in-Ubuntu.png) ][7] Verify FTP Login in Ubuntu @@ -210,16 +211,16 @@ $ sudo chmod -R 0770 /home/aaronkilik/ftp/files/ Afterwards, add/modify the options below in the VSFTPD config file with their corresponding values: ``` -user_sub_token=$USER # inserts the username in the local root directory +user_sub_token=$USER # inserts the username in the local root directory local_root=/home/$USER/ftp # defines any users local root directory ``` Save the file and close it. And restart the VSFTPD services with the recent settings: ``` -------------- On SystemD ------------- +------------- On SystemD ------------- # systemctl restart vsftpd -------------- On SysVInit ------------- +------------- On SysVInit ------------- # service vsftpd restart ``` @@ -238,7 +239,7 @@ Using binary mode to transfer files. ftp> ls ``` [ - ![FTP User Home Directory Login](http://www.tecmint.com/wp-content/uploads/2017/02/FTP-User-Home-Directory-Login.png) + ![FTP User Home Directory Login](http://www.tecmint.com/wp-content/uploads/2017/02/FTP-User-Home-Directory-Login.png) ][8] FTP User Home Directory Login diff --git a/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md index f13a3f437d..5ce7670d61 100644 --- a/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md +++ b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @@ -1,23 +1,16 @@ -How to Install MariaDB 10 on Debian and Ubuntu 如何在 Debian 和 Ubuntu 上安装 MariaDB 10 ============================================================ -MariaDB is a free and open source fork of the popular MySQL database management server software. It is developed under the GPLv2 (General Public License version 2) by the original developers of MySQL and is intended to remain open source. MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个免费并且开源的分支。它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源。 -It is designed to achieve high compatibility with MySQL. For starters, you can read [MariaDB vs MySQL][5] features for more information and importantly, it is used by big companies/organizations such as Wikipedia, WordPress.com, Google plus and many more. 它被设计来实现 MySQL 的高兼容性。对于初学者,可以阅读 [MariaDB vs MySQL][5] 来了解关于它们的特性的更多信息。更重要的是,它被一些大公司/组织使用,比如 Wikipedia、WordPress.com 和 Google plus ,除此之外还有更多的。 -In this article, we will show you how to install MariaDB 10.1 stable version in various Debian and Ubuntu distribution releases. 在这篇文章中,我将向你们展示如何在 Debian 和 Ubuntu 发行版中安装 MariaDB 10.1 稳定版。 -### Install MariaDB in Debian and Ubuntu ### 在 Debian 和 Ubuntu 上安装 MariaDB -1. Before installing MariaDB, you’ll have to import the repository key and add the MariaDB repository with the following commands: 1. 在安装之前 MariaDB 之前,你需要通过下面的命令导入仓库密匙并获取 MariaDB 仓库 -#### On Debian 10(Sid) #### 在 Debian 10(Sid) 上 ``` @@ -26,7 +19,6 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1 $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian sid main' ``` -#### On Debian 9 (Stretch) #### 在 Debian 9(Stretch) 上 ``` @@ -35,7 +27,6 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1 $ sudo add-apt-repository 'deb [arch=amd64] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian stretch main' ``` -#### On Debian 8 (Jessie) #### 在 Debian 8(Jessie) 上 ``` @@ -44,7 +35,6 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943 $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian jessie main' ``` -#### On Debian 7 (Wheezy) #### 在 Debian 7(Wheezy) 上 ``` @@ -53,7 +43,6 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943 $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian wheezy main' ``` -#### On Ubuntu 16.10 (Yakkety Yak) #### 在 Ubuntu 16.10(Yakkety Yak) 上 ``` @@ -62,7 +51,6 @@ $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656 $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu yakkety main' ``` -#### On Ubuntu 16.04 (Xenial Xerus) #### 在 Ubuntu 16.04 (Xenial Xerus) 上 ``` @@ -71,7 +59,6 @@ $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656 $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu xenial main' ``` -#### On Ubuntu 14.04 (Trusty) #### 在 Ubuntu 14.04 (Trusty) 上 ``` @@ -80,7 +67,6 @@ $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb0 $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu trusty main' ``` -2. Then update the system packages sources list, and install MariaDB server like so: 2. 然后,更新系统安装包列表,并像下面这样安装 MariaDB 服务器: ``` @@ -88,17 +74,14 @@ $ sudo apt-get update $ sudo apt-get install mariadb-server ``` -During the course of installation, you’ll be asked to configure the MariaDB server; set a secure root user password in the interface below. 安装过程中,将会请求你配置 MariaDB 服务器;在下面的页面中设置一个安全的 root 用户密码: [ ![Set New Root Password for MariaDB](http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png) ][6] -Set New Root Password for MariaDB 为 MariaDB 设置新的 Root 密码 -Re-enter the password and press [Enter] to continue with the installation process. 重新输入密码并按下 [ENTER] 键来继续安装。 @@ -106,10 +89,8 @@ Re-enter the password and press [Enter] to continue with the installation proc ![Repeat MariaDB Password](http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png) ][7] -Repeat MariaDB Password -重复输入 MariaDB 密码 +再次输入 MariaDB 密码 -3. When the installation of MariaDB packages completes, start the database server daemon for the mean time and enable it to start automatically at the next boot as follows: 当 MariaDB 安装包安装完成以后,启动数据库服务器 daemon,同时启用它,使得在下次开机时它能够像下面这样自动启动: ``` @@ -128,17 +109,10 @@ $ sudo service mysql status ![Start MariaDB Service](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service.png) ][8] -Start MariaDB Service 开启 MariaDB 服务 -4. Then run the `mysql_secure_installation` script to secure the database where you can: 4. 然后,运行 `mysql_secure_installation` 脚本来保护数据库,在这儿你可以: -1. set root password (if not set in the configuration step above). -2. disable remote root login -3. remove test database -4. remove anonymous users and -5. reload privileges 1. 设置 root 密码(如果在上面的配置环节你没有进行设置的话)。 2. 禁止远程 root 登录 3. 移除测试数据库 @@ -152,10 +126,8 @@ $ sudo mysql_secure_installation ![Secure MariaDB Installation](http://www.tecmint.com/wp-content/uploads/2017/02/sudo-mysql-secure-installation.png) ][9] -Secure MariaDB Installation 保护 MariaDB 安装 -5. Once the database server is secured, check it’s installed version and login to the MariaDB command shell as follows: 5. 一旦数据库服务器受保护以后,可以使用下面的 shell 命令查看已安装版本和登录 MariaDB: ``` @@ -166,33 +138,24 @@ $ mysql -u root -p ![Check MariaDB Version](http://www.tecmint.com/wp-content/uploads/2017/02/Check-MariaDB-Version.png) ][10] -Check MariaDB Version 查看 MariaDB 版本 -To start learning MySQL/MariaDB, read through: 开始学习 MySQL/MariaDB, 请阅读: -1. [Learn MySQL / MariaDB for Beginners – Part 1][1] -2. [Learn MySQL / MariaDB for Beginners – Part 2][2] -3. [MySQL Basic Database Administration Commands – Part III][3] -4. [20 MySQL (Mysqladmin) Commands for Database Administration – Part IV][4] 1. [MySQL / MariaDB 初学者学习指南 — Part 1][1] 2. [MySQL / MariaDB 初学者学习指南 — Part 2][2] 3. [MySQL 基本数据库管理命令 — Part III][3] -4. [针对数据库管理员的 20 个 MySQL (Mysqladmin) 命令][4] +4. [针对数据库管理员的 20 个 MySQL (Mysqladmin) 命令 — Part IV][4] -And check out these 4 useful commandline tools to [monitor MySQL/MariaDB performance][11] in Linux and also go through these [15 useful MySQL/MariaDB performance tuning and optimization tips][12]. 查看在 Linux 中[监控 MySQL/MariaDB 性能][11]的四个有用的命令行工具,同时浏览 [15 个有用的 MySQL/MariaDB 性能调整和优化技巧][12]。 -That’s all. In this article, we showed you how to install MariaDB 10.1 stable version in various Debian and Ubuntu releases. You can send us any questions/thoughts via the comment form below. -这就是本文的全部内容了。在这篇文章中,我们向你展示了如何在 Debian 和 Ubuntu 的不同发行版中安装 MariaDB 10.1 稳定版。你可以通过下面的评论框给我们提任何问题或者想法。 +这就是本文的全部内容了。在这篇文章中,我向你们展示了如何在 Debian 和 Ubuntu 的不同发行版中安装 MariaDB 10.1 稳定版。你可以通过下面的评论框给我们提任何问题或者想法。 -------------------------------------------------------------------------------- 作者简介: -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. Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux 系统管理员和网络开发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。 @@ -202,7 +165,7 @@ Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux 系统管理员和 via: http://www.tecmint.com/install-mariadb-in-ubuntu-and-debian/ 作者:[Aaron Kili][a] -译者:[译者ID](https://github.com/译者ID) +译者:[ucasFL](https://github.com/ucasFL) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b99badd53bea682c3321aa0361bcc845252a7fe7 Mon Sep 17 00:00:00 2001 From: ypingcn <1344632698@qq.com> Date: Sun, 5 Mar 2017 12:11:05 +0800 Subject: [PATCH 035/190] translated (#5225) * Delete:20170213 A beginners guide to understanding sudo on Ubuntu.md * Translated:20170213 A beginners guide to understanding sudo on Ubuntu.md --- ...s guide to understanding sudo on Ubuntu.md | 228 --------------- ...s guide to understanding sudo on Ubuntu.md | 262 ++++++++++++++++++ 2 files changed, 262 insertions(+), 228 deletions(-) delete mode 100644 sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md create mode 100644 translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md diff --git a/sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md deleted file mode 100644 index 681c337afc..0000000000 --- a/sources/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md +++ /dev/null @@ -1,228 +0,0 @@ -translating by ypingcn - -A beginner's guide to understanding sudo on Ubuntu -============================================================ - -### On this page - -1. [What is sudo?][4] -2. [Can any user use sudo?][5] -3. [What is a sudo session?][6] -4. [The sudo password][7] -5. [Some important sudo command line options][8] - 1. [The -k option][1] - 2. [The -s option][2] - 3. [The -i option][3] -6. [Conclusion][9] - -Ever got a 'Permission denied' error while working on the Linux command line? Chances are that you were trying to perform an operation that requires root permissions. For example, the following screenshot shows the error being thrown when I was trying to copy a binary file to one of the system directories: - -[ - ![permission denied on the shell](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) -][11] - -So what's the solution to this problem? Simple, use the **sudo** command. - -[ - ![run command with sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) -][12] - -The user who is running the command will be prompted for their login password. Once the correct password is entered, the operation will be performed successfully. - -While sudo is no doubt a must-know command for any and everyone who works on the command line in Linux, there are several other related (and in-depth) details that you should know in order to use the command more responsibly and effectively.  And that's exactly what we'll be discussing here in this article. - -But before we move ahead, it's worth mentioning that all the commands and instructions mentioned in this article have been tested on Ubuntu 14.04LTS with Bash shell version 4.3.11. - -### What is sudo? - -The sudo command, as most of you might already know, is used to execute a command with elevated privileges (usually as root). An example of this we've already discussed in the introduction section above. However, if you want, you can use sudo to execute command as some other (non-root) user. - -This is achieved through the -u command line option the tool provides. For example, in the example shown below, I (himanshu) tried renaming a file in some other user's (howtoforge) home directory, but got a 'permission denied' error. And then I tried the same 'mv' command with 'sudo -u howtoforge,' the command was successful: - -[ - ![What is sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) -][13] - -### Can any user use sudo? - -No. For a user to be able to use sudo, an entry corresponding to that user should be in the /etc/sudoers file. The following paragraph - taken from Ubuntu's website - should make it more clear: - -``` -The /etc/sudoers file controls who can run what commands as what users on what machines and can also control special things such as whether you need a password for particular commands. The file is composed of aliases (basically variables) and user specifications (which control who can run what). -``` - -If you are using Ubuntu, it's easy to make sure that a user can run the sudo command: all you have to do is to make that user account type 'administrator'. This can be done by heading to System Settings... -> User Accounts. - -[ - ![sudo users](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) -][14] - -Unlocking the window: - -[ - ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) -][15] - -Then selecting the user whose account type you want to change, and then changing the type to 'administrator' - -[ - ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) -][16] - -However, if you aren't on Ubuntu, or your distribution doesn't provide this feature, you can manually edit the /etc/sudoers file to make the change. You'll be required to add the following line in that file: - -``` -[user]    ALL=(ALL:ALL) ALL -``` - -Needless to say, [user] should be replaced by the user-name of the account you're granting the sudo privilege. An important thing worth mentioning here is that the officially suggested method of editing this file is through the **visudo** command - all you have to do is to run the following command: - -sudo visudo - -To give you an idea why exactly is that the case, here's an excerpt from the visudo manual: - -``` -visudo edits the sudoers file in a safe fashion. visudo locks the sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks for parse errors. If the sudoers file is currently being edited you will receive a message to try again later. -``` - -For more information on visudo, head [here][17]. - -### What is a sudo session? - -If you use the sudo command frequently, I am sure you'd have observed that after you successfully enter the password once, you can run multiple sudo commands without being prompted for the password. But after sometime, the sudo command asks for your password again. - -This behavior has nothing to do with the number of sudo-powered commands you run, but instead depends on time. Yes, by default, sudo won't ask for password for 15 minutes after the user has entered it once. Post these 15 minutes, you'll be prompted for password again. - -However, if you want, you can change this behavior. For this, open the /etc/sudoers file using the following command: - -sudo visudo - -And then go to the line that reads: - -``` -Defaults env_reset -``` - -[ - ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) -][18] - -and add the following variable (highlighted in bold below) at the end of the line - -``` -Defaults env_reset,timestamp_timeout=[new-value] -``` - -The [new-value] field should be replaced by the number of minutes you want your sudo session to last. For example, I used the value 40. - -[ - ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) -][19] - -In case you want to get prompted for password every time you use the sudo command, then in that case you can assign the value '0' to this variable. And for those of you who want that their sudo session should never time out, you can assign the value '-1'. - -Please note that using timestamp_timeout with value '-1' is strongly discouraged. - -### The sudo password - -As you might have observed, whenever sudo prompts you for a password and you start entering it, nothing shows up - not even asterisks that's usually the norm. While that's not a big deal in general, some users may want to have the asterisks displayed for whatever reason. - -The good thing is that's possible and pretty easy to do. All you have to do is to change the following line in /etc/sudoers file: - -``` -Defaults        env_reset -``` - -to - -``` -Defaults        env_reset,pwfeedback -``` - -And save the file. - -Now, whenever you'll type the sudo password, asterisk will show up. - -[ - ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) -][20] - -### Some important sudo command line options - -Aside from the -u command line option (which we've already discussed at the beginning of this tutorial), there are some other important sudo command line options that deserve a mention. In this section, we will discuss some of those. - -### The -k option - -Consider a case where-in you've just run a sudo-powered command after entering your password. Now, as you already know, the sudo session remains active for 15-mins by default. Suppose during this session, you have to give someone access to your terminal, but you don't want them to be able to use sudo. What will you do? - -Thankfully, there exists a command line option -k that allows user to revoke sudo permission. Here's what the sudo man page has to say about this option: - -``` --k, --reset-timestamp - -When used without a command, invalidates the user's cached credentials. In other words, the next time sudo is run a password will be required. This option does not require a password and was added to allow a user to revoke sudo permissions from a .logout file. - -When used in conjunction with a command or an option that may require a password, this option will cause sudo to ignore the user's cached credentials. As a result, sudo will prompt for a password (if one is required by the security policy) and will not update the user's cached credentials. -``` - -### The -s option - -There might be times when you work requires you to run a bucketload of commands that need root privileges, and you don't want to enter the sudo password every now and then. Also, you don't want to tweak the sudo session timeout limit by making changes to the /etc/sudoers file.  - -In that case, you may want to use the -s command line option of the sudo command. Here's how the sudo man page explains it: - -``` --s, --shell - -Run the shell specified by the SHELL environment variable if it is set or the shell specified by the invoking user's password database entry. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. -``` - -So basically, what this command line option does is: - -* Launches a new shell - as for which shell, the SHELL env variable is referred. In case $SHELL is empty, the shell defined in the /etc/passwd file is picked up. -* If you're also passing a command name along with the -s option (for example: sudo -s whoami), then the actual command that gets executed is: sudo /bin/bash -c whoami. -* If you aren't trying to execute any other command (meaning, you're just trying to run sudo -s) then you get an interactive shell with root privileges. - -What's worth keeping in mind here is that the -s command line option gives you a shell with root privileges, but you don't get the root environment - it's your .bashrc that gets sourced. This means that, for example, in the new shell that sudo -s runs, executing the whoami command will still return your username, and not 'root'. - -### The -i option - -The -i option is similar to the -s option we just discussed. However, there are some differences. One of the key differences is that -i gives you the root environment as well, meaning your (user's) .bashrc is ignored. It's like becoming root without explicitly logging as root. What more, you don't have to enter the root user's password as well. - -**Important**: Please note that there exists a **su** command which also lets you switch users (by default, it lets you become root). This command requires you to enter the 'root' password. To avoid this, you can also execute it with sudo ('sudo su'); in that case you'll just have to enter your login password. However, 'su' and 'sudo su' have some underlying differences - to understand them as well as know more about how 'sudo -i' compares to them, head [here][10]. - -### Conclusion - -I hope that by now you'd have at least got the basic idea behind sudo, and how you tweak it's default behavior. Do try out the /etc/sudoers tweaks we've explained here, also go through the forum discussion (linked in the last paragraph) to get more insight about the sudo command. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ - -作者:[Himanshu Arora][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/ -[1]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-k-option -[2]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-s-option -[3]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-i-option -[4]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-sudo -[5]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#can-any-user-use-sudo -[6]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-a-sudo-session -[7]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-sudo-password -[8]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#some-important-sudo-command-line-options -[9]:https://www.howtoforge.com/tutorial/sudo-beginners-guide/#conclusion -[10]:http://unix.stackexchange.com/questions/98531/difference-between-sudo-i-and-sudo-su -[11]:https://www.howtoforge.com/images/sudo-beginners-guide/big/perm-denied-error.png -[12]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-example.png -[13]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-switch-user.png -[14]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-accounts.png -[15]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-unlock.png -[16]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-admin-account.png -[17]:https://www.sudo.ws/man/1.8.17/visudo.man.html -[18]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-time-default.png -[19]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-timeout.png -[20]:https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-password.png diff --git a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md new file mode 100644 index 0000000000..9c5c4f3dd4 --- /dev/null +++ b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md @@ -0,0 +1,262 @@ + +一份关于理解 Ubuntu 上 sudo 的初学者指导 +============================================================ + +### 在这页面上 + +1. [什么是 sudo?][4] +2. [任何用户都能用 sudo 吗?][5] +3. [什么是一个 sudo 会话?][6] +4. [sudo 密码][7] +5. [一些重要的 sudo 命令行参数][8] + 1. [ -k 参数][1] + 2. [-s 参数][2] + 3. [-i 参数][3] +6. [总结][9] + +曾经在你使用 Linux 命令行时提示“拒绝访问”的错误?这可能是你正在尝试做一个需要根权限的命令。例如,下面的截图展示了当我正在尝试复制一个二进制文件到一个系统目录时显示的错误。 + +[ + ![shell 的拒绝访问](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) +][11] + +所以该怎么解决这个错误?很简单,使用 ** sudo ** 命令。 + +[ + ![用 sudo 运行命令](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) +][12] + +正在运行命令的用户被提示需要他们的登录密码。一旦输入了正确的密码,操作将会成功执行。 + +毫无疑问,sudo 是任何在 Linux 上使用命令行的人所必须知道的命令。但是,为了更负责有效地使用命令,你还是得知道一些相关(深入)的细节。这正是我们将会在这篇文章中讨论的。 + +但是在我们继续之前,值得提一下的是,这篇文章所提到的所有命令指示都已经在 Ubuntu 14.04LTS 下的 4.3.11版 Bash 通过测试。 + + +### 什么是 sudo + +正如你们大部分人所知道的,sudo 是用来执行需要提升权限(通常是作为 root 用户)的命令。在这篇文章之前的简介部分已经讨论过这样的一个例子。然而,如果你想的话,你能用 sudo 运行一些其他(非 root )用户的命令。 + +这点是由工具提供的 -u 命令行选项所实现的。举个例子,如下面的例子所展示的那样,我(himanshu)尝试留一个文件在其他用户(howtoforge)的家目录中,但是得到一个“访问拒绝”的错误。然后我尝试加上“sudo -u howtoforge”后用同样的“mv”命令,命令成功执行了: + +[ + ![什么是 sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) +][13] + +### 任何人都能用 sudo 吗? + +不,为了让一个用户能使用 sudo ,跟用户相关的信息应该在 /etc/sudoers 里。下述摘自 Ubuntu 网页的段落能讲得更清楚: + +``` +/etc/sudoers 文件控制了谁能以何种用户的身份在何种机器上运行何种命令,同样控制了特殊的事件例如对于特定的命令你是否需要输入密码。这个文件由 aliases (基本变量)和用户识别符(控制谁能运行什么命令)组成。 + +``` +如果你正在使用 Ubuntu,很容易去确认一个用户能运行 sudo 命令:你所需要做的就是把账户改成管理员。这能直接到 系统设置->用户账户里完成。 + + +[ + ![sudo 用户](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) +][14] + +解锁窗口 + + +[ + ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) +][15] + +然后选择你想改变用户类型的用户,然后将类型改成“管理员” + + +[ + ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) +][16] + +然而,如果你不使用 Ubuntu,或者你的发行版没有提供这个特性,你能手动编辑 /etc/sudoers 文件来实现改变。你要在文件添加这样的一行: + + +``` +[user] ALL=(ALL:ALL) ALL +``` + +无需赘言,[user] 应该被你想提升 sudo 权限的用户的用户名所代替。在这里值得提到的一件重要的事情是,官方建议的编辑该文件的方式是通过 **visudo** 命令——你需要做的就是运行下述命令: + + +sudo visudo + +为了说清究竟是怎么一回事,这里有段从 visudo 手册里的摘要: + + +``` +visudo 以安全的模式编辑 sudoers 文件。visudo 锁定 sudoers 文件以防重复同时的编辑,提供基本的检查(sanity checks)和语法错误检查。如果 sudoers 文件现在正在被编辑,你将会收到一个信息提示稍后再试。 + +``` + +关于 visudo 的更多信息,前往[这里][17] + + +### 什么是 sudo 会话 + +如果你经常使用 sudo 命令,我很确定你注意过当你成功输入一次密码后,你能不用密码提升权限地运行几次 sudo 命令。但是一段时间后,sudo 命令又再次要求你的密码。 + + +这种现象跟运行 sudo 命令数目无关,跟时间有关。是的,sudo 默认在输入一次密码后 15 分钟内不会再次要求密码。15 分钟后,你会再次被要求输入密码提升权限。 + + +然而,如果你想的话,你能改变这种现象。用以下命令打开 /etc/sudoers 文件 + +sudo visudo + +接下来的一行显示: + +``` +Defaults env_reset +``` + +[ + ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) +][18] + +然后在这行最后添加以下变量(下面用黑体字强调): + + +``` +Defaults env_reset,timestamp_timeout=[new-value] +``` + +[new-value] 应该用你想要 sudo 会话持续时间数替换。例如,我用数值 40。 + + +[ + ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) +][19] + +万一你想每次使用 sudo 命令时都要求输入密码提升权限,这样你能把这个变量赋值为 0 。想要 sudo 会话永远不过时,你得赋值为 -1。 + + +注意数值为 -1 的 timestamp_timeout 是强烈不推荐的。 + + +### sudo 密码 + + +正如你可能观察过的,当 sudo 要求输入密码然后你开始输入时,不会显示任何东西——甚至连标准的星号都没有。通常这不是什么大问题,一些用户无论什么原因想要显示星号、 + + +好消息是那有可能也很容易做到。所有你需要做的就是在 /etc/sudoers 文件里将下述的行: + + +``` +Defaults env_reset +``` + +改成 + +``` +Defaults env_reset,pwfeedback +``` + +然后保存文件 + + +现在,无论什么时候输入 sudo 密码,星号都会显示。 + + +[ + ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) +][20] + +## 一些重要的 sudo 命令行参数 + + +除了 -u命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 sudo 命令行参数值得注意。在这部分,我们将会讨论其中一些。 + + + +### -k 参数 +### The -k option + +考虑下一种情况:当你刚输入密码后运行了几个 sudo 驱动的命令时。现在,正如你已经知道的,sudo 会话默认保持 15 分钟。假设在这会话期间,你得给你终端一些权限,但你不想让他们使用 sudo ,你将会怎么做? + + +还好,有 -k 命令行参数允许用户取消 sudo 权限。这是 sudo 帮助页面(man page)关于这一点所讲的: + + +``` +-k, --reset-timestamp + +不带任何命令使用时,撤销用户缓存的凭据。换句话讲,下一次使用 sudo 将会要求输入密码。这个参数不需要密码,允许用户从一个 .logout 文件撤销 sudo 权限。 + +当与一个命令,或者一个可能需要密码的操作一起用时,这个参数将会导致 sudo 忽略用户缓存的凭据。结果是 sudo 要求输入密码(如果这是被安全策略所要求的),而且不会更新用户缓存的凭据。 + +``` + +### -s 参数 + + +或许有几次当你的工作要求你运行一堆需要 root 权限的命令时,你不想每次都输入密码。你也不想通过改变 /etc/sudoers 文件调整 sudo 会话的过期时限。 + +这种情况下,你可以用 sudo 的 -s 参数。这是 sudo 帮助页面(man page)所解释的: + + +``` +-s, --shell + +如果 SHELL 环境变量设置了或者 shell 调用了用户的密码数据库,就能用它运行 shell 。如果指定了命令,命令将会通过 shell 的 -c 参数传递给 shell 执行。如果没有指定命令,一个交互式 shell 将会执行。 + +``` + +所以,基本地,这命令参数做的是: + + +* 启动一个新的 shell ,对于哪一个 shell 来说,SHELL 赋值变量都有引用。万一 $SHELL 是空的,将会用 /etc/passwd 定义的内容。 + +* 如果你用 -s 参数传递了一个命令名(例如 sudo -s whoami),实际执行的是 sudo /bin/bash -c whoami。 + +* 如果你尝试执行其他命令(意思是 你只是正在尝试运行 sudo -s),你将会得到一个有有 root 权限的交互式的 shell。 + +这里值得记住的是 -s 命令行参数给你一个有 root 权限的 shell,但是你没有 root 环境——你的 .bashrc 决定的。这意思是,例如在一个用 sudo -s 运行的新 shell 里,执行 whoami 命令仍会返回你的用户名,而非 root 。 + +### -i 参数 +-i 参数跟我们讨论过的 -s 参数相像。然而,还是有点区别。一个重要的区别是 -i 也给了你 root 环境,意味着你的(用户的).bashrc 被忽略。这就像没有明确指明用 root 登录也能称为成为 root 。此外,你也不用输入 root 用户密码。 + + +** 重要 **:请注意有也能让你切换用户的 **su** 命令(默认的是切换到 root ) 这个命令需要你输入 root 密码。为了避免这一点,你也要用 sudo 执行(‘ sudo su’),这样你只需要输入你的登录密码。然而,su 和 sudo su 有隐含的区别 ——了解他们和跟相应的 sudo -i 区别,来[这里][10] +**Important**: Please note that there exists a **su** command which also + + +### 总结 + +我希望现在你至少知道了 sudo 的基本知识,和如何调整 sudo 的默认行为。请按我们解释过的那样全部尝试调整 /etc/sudoers 。同时也浏览一下论坛讨论(在最后一段中有链接)来更深入了解 sudo 命令。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ + +作者:[Himanshu Arora][a] +译者:[ypingcn](https://ypingcn.github.io/wiki/lctt) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ +[1]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-k-option +[2]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-s-option +[3]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-i-option +[4]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-sudo +[5]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#can-any-user-use-sudo +[6]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-a-sudo-session +[7]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-sudo-password +[8]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#some-important-sudo-command-line-options +[9]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#conclusion +[10]: http://unix.stackexchange.com/questions/98531/difference-between-sudo-i-and-sudo-su +[11]: https://www.howtoforge.com/images/sudo-beginners-guide/big/perm-denied-error.png +[12]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-example.png +[13]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-switch-user.png +[14]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-accounts.png +[15]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-unlock.png +[16]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-admin-account.png +[17]: https://www.sudo.ws/man/1.8.17/visudo.man.html +[18]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-time-default.png +[19]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-timeout.png +[20]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-password.png From ff1f4a51dc6f36b4ddf1c844f40d5be81cb3fcd3 Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 5 Mar 2017 14:43:49 +0800 Subject: [PATCH 036/190] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Linux Distribution with Yocto on Ubuntu.md | 224 +++++++++--------- 1 file changed, 117 insertions(+), 107 deletions(-) rename {sources => translated}/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md (62%) diff --git a/sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md b/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md similarity index 62% rename from sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md rename to translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md index dd05b3eeb1..213be14a67 100644 --- a/sources/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md +++ b/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @@ -1,191 +1,201 @@ -ezio is translating +如何在 Ubuntu 上用 Yocto 创建你自己的 Linux 发行版 +======================================== -How to create your own Linux Distribution with Yocto on Ubuntu -============================================================ +### 本文内容 -### On this page +1. [开发机的基本条件][1] +2. [Yocto 编译和构建的过程][2] -1. [Prerequisites for the development machine ][1] -2. [Yocto Compilation and Building Process][2] +In this article, our focus is the creation of a minimal Linux distribution using the Yocto project on the Ubuntu platform. The Yocto project is very famous in the embedded Linux world because of its flexibility and ease of use. The purpose of the Yocto project is to create a Linux distro for manufacturers of embedded hardware and software. A new minimal Linux distro will be created for qemu as the (qemu is a basic software emulator) target machine and we will run it in qemu. -In this article, our focus is the creation of a minimal Linux distribution using the Yocto project on the Ubuntu platform. The Yocto project is very famous in the embedded Linux world because of its flexibility and ease of use.  The purpose of the Yocto project is to create a Linux distro for manufacturers of embedded hardware and software. A new minimal Linux distro will be created for qemu as the (qemu is a basic software emulator) target machine and we will run it in qemu.  +本文的主要聚焦在如何使用 Yocto 在 Ubuntu 上穿件一个最小化的 Linux 发行版。Yocto 项目在嵌入式 Linux 的世界非常著名,这是因为它用户起来很灵活、方便。Yocto 的目标是为嵌入式软硬件开发商创建自己的 Linux 发行版。本文我们将会创建一个可以运行在 QEMU 上的最小化 Linux,并且在 QEMU 上实际运行。 -### Prerequisites for the development machine  +### 开发机的基本条件 -* At least 4 - 6 GB RAM. -* Recent Ubuntu OS (16.04 LTS in this case). -* At least 60-80 GB free space on the disk. -* Installation of following packages before creation of new Linux distro. -* Download latest Yocto (Poky which is minimal development environment) stable branch. +* 最少 4-6 GB 内存 +* 最新版的 Ubuntu 系统(本文使用了 16.04 LTS) +* 磁盘剩余空间至少 60-80 GB +* 在创建 Linux 发行版之前先安装下面的软件包 +* 下载最新的 Yocto(Poky 时最小开发环境)稳定分支 +``` apt-get update apt-get install wget git-core unzip make gcc g++ build-essential subversion sed autoconf automake texi2html texinfo coreutils diffstat python-pysqlite2 docbook-utils libsdl1.2-dev libxml-parser-perl libgl1-mesa-dev libglu1-mesa-dev xsltproc desktop-file-utils chrpath groff libtool xterm gawk fop +``` -### [ - ![Install prerequisites for Yocto](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/1-pre_requisite_packages-1.png) -][3] + ![Install prerequisites for Yocto](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/1-pre_requisite_packages-1.png) -As shown below, almost 1 GB size is required to install required development packages. +如下所示,开发环境要安装的软件包将近 1GB 大小。 -[ - ![Install the development packages](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/2-pre_requisite_packages-2.png) -][4] + ![Install the development packages](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/2-pre_requisite_packages-2.png) -In this tutorial, the "morty" stable release of poky is cloned on the system. +在这个教程中,系统上克隆的 poky 的分支时 `morty` 稳定分支。 - git clone -b morty git://git.yoctoproject.org/poky.git +``` + git clone -b morty git://git.yoctoproject.org/poky.git +``` -[ - ![install poky](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/download_morty_of_yocto.png) -][5] + ![install poky](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/download_morty_of_yocto.png) -Go inside the "poky" directory and run the following command to set/export some variables for yocto development. +进入 `poky` 目录,然后运行下面的命令为 Yocto 开发环境设置(set/export)一些环境变量。 +``` source oe-init-build-env +``` -As shown below, after running the open embedded (oe) build environment script, the path location in the terminal will be changed to a "build" directory for the further configuration and compilation of new distribution.  +如下所示,在运行了 oepn embeded (oe) 的构建环境脚本之后,为了之后的配置和构建新版本,终端里的路径会自动切换到 `build` 目录。 -[ - ![Prepare OE build environment](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/source_environment_script.png) -][6] -The above screenshot shows that the "local.conf" file is created inside the "conf" directory. This is the configuration file for yocto which specifies details of the target machine and SDK for desired architecture etc. + ![Prepare OE build environment](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/source_environment_script.png) -As shown below, setting target machine "qemux86-64". -[ - ![Set the target machine type](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/selected_target.png) -][7] +The above screenshot shows that the "local.conf" file is created inside the "conf" directory. This is the configuration file for yocto which specifies details of the target machine and SDK for desired architecture etc. -Uncomment following parameters in "local.conf" file as shown in the screenshots. +下面的截屏展示了在 `conf` 目录下创建的文件 `local.conf`。这是 Yocto 用来设置目标机器细节和 SDK 的目标架构的配置文件。 +如下所示,这里设置的目标机器时 `qemux86-64`。 + + ![Set the target machine type](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/selected_target.png) + +如下面截图所示,在 `local.conf` 中取消下面参数的注释符号。 + +``` DL_DIR ?= "${TOPDIR}/downloads" +``` -[ - ![Configure local.conf file](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/uncheck_Download_parameters.png) -][8] + ![Configure local.conf file](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/uncheck_Download_parameters.png) +``` SSTATE_DIR ?= "${TOPDIR}/sstate-cache" +``` -[ - ![Set SSTATE_DIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/uncheck_sstate_parametes.png) -][9] + ![Set SSTATE_DIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/uncheck_sstate_parametes.png) + +``` TMPDIR ?= "${TOPDIR}/tmp" +``` -[ - ![Set TMPDIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/tempdir_uncheck_paramerter.png) -][10] + ![Set TMPDIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/tempdir_uncheck_paramerter.png) +`` PACKAGE_CLASSES ?= "package_rpm" SDKMACHINE ?= "i686" +``` -[ - ![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/sdk_and_package_selection.png) -][11] + ![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/sdk_and_package_selection.png) -As shown below, set a blank password for the Yocto based Linux and include the following parameters in the local.conf file. Otherwise, the user will not be able to login in the new distro. +如下所示,在 `local.conf` 为基于 Yocto 的 Linux 设置空密码和后续的一些参数。否则的话用户就不能登录进新的发行版。 + +``` EXTRA_IMAGE_FEATURES ?= "debug-tweaks" +``` -[ - ![Set debug-tweaks option](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/extra-features_for_blank_password.png) -][12] + ![Set debug-tweaks option](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/extra-features_for_blank_password.png) -We are not using any GUI tool such as toaster (hob is no more supported) to create Linux OS. +我们并不准备使用任何图形化工具来创建 Linux OS,比如 `toaster` (hob 已经不再被支持了)。 -### Yocto Compilation and Building Process +### Yocto 编译构建过程 -Now run the following command of the bitbake utility to start the download and compilation of packages for the selected target machine. +现在运行下面的 bitbake 组件的命令开始为选定的目标机器下载和编译软件包。 +``` bitbake core-image-minimal +``` -[ - ![Start bitbake](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/bitbake_coreimageminimal.png) -][13] + ![Start bitbake](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/bitbake_coreimageminimal.png) -It is important to run the above command as a normal Linux user and not the root user. As shown in the following sscreenshot, an error is generated when you run the bitbake command as root user. -[ - ![Do not run bitbake as root](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/dont_user_as_a_root.png) -][14] +非常重要的是在普通 Linux 用户下运行上面的命令,而不是使用 root 用户。如下面截图所示,当你在 root 用户下运行 bitbake 命令会产生下卖弄所示的错误。 -Again, run the export of environment variables script (oe-init-build-env) and re-run the same command to start the downloading and compilation process. -[ - ![rerun commands](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runniing_bitbake_again-normal_user.png) -][15] + ![Do not run bitbake as root](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/dont_user_as_a_root.png) -As shown below, the first step of build script utility is to parse the recipe. -[ - ![Parse the build recipes](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/parsing-receipe.png) -][16] +再一次运行导出环境变量的脚本(`oe-init-build-env`),重新执行相同的命令来启动下载和编译进程。 -The following screenshot shows the completion of the parsing step of the build script. It also shows the details of the build system on which the new yocto based distro will be generated. -[ - ![Building proceeds](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/output_of_parsing.png) -][17] + ![rerun commands](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runniing_bitbake_again-normal_user.png) + +如下所示,构建脚本组件的第一步工作是解析配置(recipe)。 + + + ![Parse the build recipes](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/parsing-receipe.png) + + +下面的截图展示了构建脚本的解析过程。同时也显示了你要构建的新的基于 yocto 的发行版的构建系统的细节。 + + + ![Building proceeds](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/output_of_parsing.png) + After downloading the SDK and necessary libraries, the next step is to download and compile the packages. The following screenshot shows the task for the new distribution. This step will take 2-3 hours because first, it downloads the required packages and then compiles for the new Linux distribution. -[ - ![Compilation will take several hours](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/task_list.png) -][18] +在下载了 SDK 和必要的库之后,下一步是下载和编译软件包。如下的截图展示了为构建新发行版而执行的任务。这一步将会执行 2-3 小时,因为第一要下载需要的软件包,然后还要为新的 Linux 发行版编译这些软件包。 -The following screenshot shows the completion of the task list. -[ - ![](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/downloaded-all_packages_and_compiled.png) -][19] + ![Compilation will take several hours](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/task_list.png) -The compiled new images for the target machine type "qemux86-64" is inside the "build/tmp/deploy/images/qemux86-64" path as shown below. -[ - ![Build complete](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_compiled_under_qemux86_64.png) -][20] +下面的截图显示了任务列表执行完毕。 -As shown below, above command will produce an error if run in the Putty. -[ - ![command error in putty](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/error_on_putty.png) -][21] -Above command is again run inside the terminal via rdp on Ubuntu platform. + ![](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/downloaded-all_packages_and_compiled.png) -[ - ![Command works fine in rdp](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runqemu_command.png) -][22] -Another screen is opened for the qemu emulator for new yocto based Linux distro. +为目标机器类型 `qemux86-64` 编译好的新镜像位于 `build/tmp/deploy/images/qemux86-64`: -[ - ![Open Quemu emulator](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_inside_the_qemu_.png) -][23] -The login screen of the new distro is shown below which also shows the reference version of the yocto project. The default username is root and a blank password. -[ - ![Linux distribution started](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/reference_distro.png) -][24] + ![Build complete](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_compiled_under_qemux86_64.png) -Finally, login in the new distro with root username and an empty password. As shown in the following screenshot, basic commands (date,ifconfig and uname) are run in the minimal version of Linux. -[ - ![Test the Linux distribution](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/inside_new_linux_distro_running_on_qemu_3.png) -][25] +如下所示,上面的命令如果运行在 Putty 上会产生一个错误。 -The purpose of this article is to understand the procedure for the creation of new Linux distribution using yocto project. + + ![command error in putty](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/error_on_putty.png) + + +通过 rdp 在 Ubuntu 平台上再次运行上面的命令。 + + + ![Command works fine in rdp](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runqemu_command.png) + + + +为运行新的基于 Yocto 的 Linux 发行版的 qemu 打开一个新屏幕。 + + + + ![Open Quemu emulator](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_inside_the_qemu_.png) + + + +下面展示了新发行版的登录界面,同时也显示了使用的 yocto 项目的版本号。默认的用户名是 `root` ,密码为空。 + + + ![Linux distribution started](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/reference_distro.png) + + + +最后使用 root 用户名和空密码登录进新发行版。如下截图所示,在这个最小版本的 Linux 上运行了基本的命令(`data` 、 `ifconfig` 和 `uname`)。 + + + ![Test the Linux distribution](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/inside_new_linux_distro_running_on_qemu_3.png) + + +本文的目标是理解使用 Yocto 创建新的 Linux 发行版的过程。 -------------------------------------------------------------------------------- via: https://www.howtoforge.com/tutorial/how-to-create-your-own-linux-distribution-with-yocto-on-ubuntu/ 作者:[Ahmad][a] -译者:[译者ID](https://github.com/译者ID) +译者:[Ezio](https://github.com/oska874) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ac9ed8ee30b10d9b732197ca64dca24f472adbf3 Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 5 Mar 2017 14:45:20 +0800 Subject: [PATCH 037/190] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e your own Linux Distribution with Yocto on Ubuntu.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md b/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md index 213be14a67..603e4c89a4 100644 --- a/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md +++ b/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @@ -3,8 +3,8 @@ ### 本文内容 -1. [开发机的基本条件][1] -2. [Yocto 编译和构建的过程][2] +1. [开发机的基本条件][1] +2. [Yocto 编译和构建的过程][2] In this article, our focus is the creation of a minimal Linux distribution using the Yocto project on the Ubuntu platform. The Yocto project is very famous in the embedded Linux world because of its flexibility and ease of use. The purpose of the Yocto project is to create a Linux distro for manufacturers of embedded hardware and software. A new minimal Linux distro will be created for qemu as the (qemu is a basic software emulator) target machine and we will run it in qemu. @@ -79,13 +79,12 @@ TMPDIR ?= "${TOPDIR}/tmp" ![Set TMPDIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/tempdir_uncheck_paramerter.png) -`` +``` PACKAGE_CLASSES ?= "package_rpm" - SDKMACHINE ?= "i686" ``` - ![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/sdk_and_package_selection.png) +![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/sdk_and_package_selection.png) 如下所示,在 `local.conf` 为基于 Yocto 的 Linux 设置空密码和后续的一些参数。否则的话用户就不能登录进新的发行版。 From 751a0812be65898329deff58026b1da3ee74a63b Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 5 Mar 2017 14:53:09 +0800 Subject: [PATCH 038/190] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E9=81=8D=E6=A0=A1?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Linux Distribution with Yocto on Ubuntu.md | 59 +++++-------------- 1 file changed, 15 insertions(+), 44 deletions(-) diff --git a/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md b/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md index 603e4c89a4..87b4be2a81 100644 --- a/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md +++ b/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @@ -6,9 +6,7 @@ 1. [开发机的基本条件][1] 2. [Yocto 编译和构建的过程][2] -In this article, our focus is the creation of a minimal Linux distribution using the Yocto project on the Ubuntu platform. The Yocto project is very famous in the embedded Linux world because of its flexibility and ease of use. The purpose of the Yocto project is to create a Linux distro for manufacturers of embedded hardware and software. A new minimal Linux distro will be created for qemu as the (qemu is a basic software emulator) target machine and we will run it in qemu. - -本文的主要聚焦在如何使用 Yocto 在 Ubuntu 上穿件一个最小化的 Linux 发行版。Yocto 项目在嵌入式 Linux 的世界非常著名,这是因为它用户起来很灵活、方便。Yocto 的目标是为嵌入式软硬件开发商创建自己的 Linux 发行版。本文我们将会创建一个可以运行在 QEMU 上的最小化 Linux,并且在 QEMU 上实际运行。 +本文主要聚焦在如何使用 Yocto 在 Ubuntu 上创建一个最小化的 Linux 发行版。Yocto 项目在嵌入式 Linux 的世界非常著名,这是因为它用起来非常灵活、方便。Yocto 的目标是为嵌入式软硬件开发商创建自己的 Linux 发行版。本文我们将会创建一个可以运行在 QEMU 上的最小化的 Linux,并且在 QEMU 上实际运行。 ### 开发机的基本条件 @@ -38,21 +36,18 @@ apt-get install wget git-core unzip make gcc g++ build-essential subversion sed ![install poky](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/download_morty_of_yocto.png) -进入 `poky` 目录,然后运行下面的命令为 Yocto 开发环境设置(set/export)一些环境变量。 +进入 `poky` 目录,然后运行下面的命令为 Yocto 开发环境设置(设置/导出)一些环境变量。 ``` source oe-init-build-env ``` -如下所示,在运行了 oepn embeded (oe) 的构建环境脚本之后,为了之后的配置和构建新版本,终端里的路径会自动切换到 `build` 目录。 +如下所示,在运行了 open embedded (oe) 的构建环境脚本之后,为了之后的配置和构建新版本,终端里的路径会自动切换到 `build` 目录。 ![Prepare OE build environment](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/source_environment_script.png) - -The above screenshot shows that the "local.conf" file is created inside the "conf" directory. This is the configuration file for yocto which specifies details of the target machine and SDK for desired architecture etc. - -下面的截屏展示了在 `conf` 目录下创建的文件 `local.conf`。这是 Yocto 用来设置目标机器细节和 SDK 的目标架构的配置文件。 +上面的截屏展示了在 `conf` 目录下创建的文件 `local.conf`。这是 Yocto 用来设置目标机器细节和 SDK 的目标架构的配置文件。 如下所示,这里设置的目标机器时 `qemux86-64`。 @@ -87,7 +82,7 @@ SDKMACHINE ?= "i686" ![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/sdk_and_package_selection.png) -如下所示,在 `local.conf` 为基于 Yocto 的 Linux 设置空密码和后续的一些参数。否则的话用户就不能登录进新的发行版。 +如下所示,在 `local.conf` 中为基于 Yocto 的 Linux 设置空密码和后续的一些参数。否则的话用户就不能登录进新的发行版。 ``` EXTRA_IMAGE_FEATURES ?= "debug-tweaks" @@ -95,11 +90,11 @@ EXTRA_IMAGE_FEATURES ?= "debug-tweaks" ![Set debug-tweaks option](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/extra-features_for_blank_password.png) -我们并不准备使用任何图形化工具来创建 Linux OS,比如 `toaster` (hob 已经不再被支持了)。 +我们并不准备使用任何图形化工具来创建 Linux OS,比如 `toaster` (`hob` 已经不再被支持了)。 ### Yocto 编译构建过程 -现在运行下面的 bitbake 组件的命令开始为选定的目标机器下载和编译软件包。 +现在运行下面的 `bitbake` 组件的命令开始为选定的目标机器下载和编译软件包。 ``` bitbake core-image-minimal @@ -108,7 +103,7 @@ bitbake core-image-minimal ![Start bitbake](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/bitbake_coreimageminimal.png) -非常重要的是在普通 Linux 用户下运行上面的命令,而不是使用 root 用户。如下面截图所示,当你在 root 用户下运行 bitbake 命令会产生下卖弄所示的错误。 +**非常重要的是在普通 Linux 用户下运行上面的命令,而不是使用 root 用户**。如下面截图所示,当你在 root 用户下运行 bitbake 命令会产生下面所示的错误。 ![Do not run bitbake as root](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/dont_user_as_a_root.png) @@ -119,74 +114,50 @@ bitbake core-image-minimal ![rerun commands](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runniing_bitbake_again-normal_user.png) -如下所示,构建脚本组件的第一步工作是解析配置(recipe)。 +如下所示,构建脚本组件的第一步工作是解析配置(`recipe`)。 ![Parse the build recipes](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/parsing-receipe.png) -下面的截图展示了构建脚本的解析过程。同时也显示了你要构建的新的基于 yocto 的发行版的构建系统的细节。 +下面的截图展示了构建脚本的解析过程。同时也显示了用来构建你的新的基于 yocto 的发行版的构建系统的细节。 ![Building proceeds](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/output_of_parsing.png) - -After downloading the SDK and necessary libraries, the next step is to download and compile the packages. The following screenshot shows the task for the new distribution. This step will take 2-3 hours because first, it downloads the required packages and then compiles for the new Linux distribution. - -在下载了 SDK 和必要的库之后,下一步是下载和编译软件包。如下的截图展示了为构建新发行版而执行的任务。这一步将会执行 2-3 小时,因为第一要下载需要的软件包,然后还要为新的 Linux 发行版编译这些软件包。 +在下载了 SDK 和必要的库之后,下一步工作是下载和编译软件包。如下截图展示了为构建新发行版而执行的任务。这一步将会执行 2-3 小时,因为第一要下载需要的软件包,然后还要为新的 Linux 发行版编译这些软件包。 ![Compilation will take several hours](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/task_list.png) - -下面的截图显示了任务列表执行完毕。 - - +下面的截图表明了任务列表执行完毕。 ![](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/downloaded-all_packages_and_compiled.png) - 为目标机器类型 `qemux86-64` 编译好的新镜像位于 `build/tmp/deploy/images/qemux86-64`: - - ![Build complete](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_compiled_under_qemux86_64.png) - -如下所示,上面的命令如果运行在 Putty 上会产生一个错误。 - +如下所示,上面的命令如果运行在 `Putty` 上会产生一个错误。 ![command error in putty](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/error_on_putty.png) - -通过 rdp 在 Ubuntu 平台上再次运行上面的命令。 - +通过 `rdp` 在 Ubuntu 平台上再次运行上面的命令。 ![Command works fine in rdp](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runqemu_command.png) - - 为运行新的基于 Yocto 的 Linux 发行版的 qemu 打开一个新屏幕。 - - ![Open Quemu emulator](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_inside_the_qemu_.png) - - 下面展示了新发行版的登录界面,同时也显示了使用的 yocto 项目的版本号。默认的用户名是 `root` ,密码为空。 - ![Linux distribution started](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/reference_distro.png) - - -最后使用 root 用户名和空密码登录进新发行版。如下截图所示,在这个最小版本的 Linux 上运行了基本的命令(`data` 、 `ifconfig` 和 `uname`)。 - +最后使用 `root` 用户名和空密码登录新发行版。如下截图所示,在这个最小版本的 Linux 上运行了基本的命令(`data` 、 `ifconfig` 和 `uname`)。 ![Test the Linux distribution](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/inside_new_linux_distro_running_on_qemu_3.png) - 本文的目标是理解使用 Yocto 创建新的 Linux 发行版的过程。 -------------------------------------------------------------------------------- From d34e75e4c24e4aacd22326e1935f5ed58692d6eb Mon Sep 17 00:00:00 2001 From: Ezio Date: Sun, 5 Mar 2017 15:01:17 +0800 Subject: [PATCH 039/190] =?UTF-8?q?20170305-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160412 How to use the ZYBO Yocto BSP.md | 274 ++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 sources/tech/20160412 How to use the ZYBO Yocto BSP.md diff --git a/sources/tech/20160412 How to use the ZYBO Yocto BSP.md b/sources/tech/20160412 How to use the ZYBO Yocto BSP.md new file mode 100644 index 0000000000..eee4b9be82 --- /dev/null +++ b/sources/tech/20160412 How to use the ZYBO Yocto BSP.md @@ -0,0 +1,274 @@ +### Introduction +This section provides a quick guide to +* Build Yocto image with meta-xilinx provided by Digilent + +# Prepare build sources and configuration +This section provides the basic steps to setup build system and configurations + +#### Prerequisites +* Internet access +* required tools + * git + * repo +* Vivado tools for JTAG boot +* SD card for SD Boot + SD Card reader for programing the SD card. +* Linux workstation - currently tested with 64bit Ubuntu 14.04.4 + +##### Install git +Ubuntu: + + $ sudo apt-get install git-core + +##### Install repo +Repo is a tool that makes it easier to work with Git in the context of Android. +We use it to simplify the process of preparing yocto layers. + + $ mkdir ~/bin + $ PATH=~/bin:$PATH + $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo + $ chmod a+x ~/bin/repo + +[repo command reference](https://source.android.com/source/using-repo.html) + +#### Notes +* Ensure Yocto build is not over NFS/CIFD +* Only support jethro release at this point + +#### Preparation +Fetch/clone the required layer repos and assume the layer repos are store in +"~/tmp/layers" folder. + + $ export branch=jethro + $ export layer_root=${HOME}/tmp/layers + $ mkdir -p $layer_root + $ cd $layer_root + +Fetch required layers and hardware project with 'repo' + + $ repo init -u https://github.com/Digilent/meta-manifest.git -b ${branch} + $ repo sync + +#### Initialize build directory +This section provides the general step to create and config the build directory + +Follow the commands to create a build directory "${HOME}/tmp/zybo-linux-bd-zynq7" + + $ cd ${HOME}/tmp + $ export target_machine="zybo-linux-bd-zynq7" + $ . ${layer_root}/poky/oe-init-build-env ${target_machine} + $ tree . + . + └── conf + ├── bblayers.conf + ├── local.conf + └── templateconf.cfg +oe-init-build-env generates some generic configuration files in the build/conf +directory. +* The "bblayer.conf" file defines layers that are include in the build +* The "local.conf" file defines the configuration of the build. + +##### Add required layers +Add meta-oe and meta-xilinx layer to the BBLAYERS variable + + $ cd ${HOME}/tmp/${target_machine} + $ sed -i "/meta-yocto-bsp/a \ ${layer_root}/meta-openembedded/meta-oe \\\ " conf/bblayers.conf + $ sed -i "/meta-yocto-bsp/a \ ${layer_root}/meta-xilinx \\\ " conf/bblayers.conf +you can also use vim/nano/other editor to add the layer to conf/bblayers.conf + +If you check the conf/bblayers.conf, you should see similar output to the follows: + + LCONF_VERSION = "6" + BBPATH = "${TOPDIR}" + BBFILES ?= "" + + BBLAYERS ?= " \ + ${HOME}/tmp/layers/poky/meta \ + ${HOME}/tmp/layers/poky/meta-yocto \ + ${HOME}/tmp/layers/poky/meta-yocto-bsp \ + ${HOME}/tmp/layers/meta-xilinx \ + ${HOME}/tmp/layers/meta-openembedded/meta-oe \ + " + BBLAYERS_NON_REMOVABLE ?= " \ + ${HOME}/tmp/layers/poky/meta \ + ${HOME}/tmp/layers/poky/meta-yocto \ + " +Where the ${HOME} is the path to your home directory. + +##### Customize the build configuration +The variables you need to customize: +* MACHINE + +[MACHINE]: +Defines the target build machine. In our case, it is zynq-hdmi_out-zynq7. +Modify the conf/local.conf to correct MACHINE with the following commands. + + $ sed -i "s/MACHINE ??= \"qemux86\"/MACHINE ?= \"${target_machine}\"/" conf/local.conf + +or you can use text editor replacing the following + + MACHINE ?= "qemux86" + +with + + MACHINE ?= "zybo-linux-bd-zynq7" + +Optional variables you may want to customize: +* DL_DIR +* SSTATE_DIR +* TMPDIR +* PACKAGE_CLASSES + +[DL_DIR]: +Defines where the upstream source code tarballs are stored. This allows multiple +builds without re-download the source code again. + +[SSTATE_DIR]: +Defines where to store the shared state files. It also allows multiple build +share the same state files and speed up the build processes. + +[TMPDIR]: +Define where to store the build outputs. Not recommended to share with other +builds. + +[PACKAGE_CLASSES] +Defines which packing formats to enable and used in the system. + +[Useful link](http://www.yoctoproject.org/docs/2.0/ref-manual/ref-manual.html#speeding-up-the-build) to speed up the build. + +##### Set up preferred kernel and u-boot +Since there are multiple u-boot/kernel recipes can be use for zynq-linux-bd-zynq7 +machine. We will need to define the preferred provider by adding the following +lines to conf/local.conf file + + PREFERRED_PROVIDER_virtual/bootloader = "u-boot-digilent" + PREFERRED_PROVIDER_u-boot = "u-boot-digilent" + PREFERRED_PROVIDER_virtual/kernel = "linux-digilent" + PREFERRED_PROVIDER_virtual/boot-bin = "u-boot-digilent" + +or + + $ echo 'PREFERRED_PROVIDER_virtual/bootloader = "u-boot-digilent"' >> conf/local.conf + $ echo 'PREFERRED_PROVIDER_u-boot = "u-boot-digilent"' >> conf/local.conf + $ echo 'PREFERRED_PROVIDER_virtual/kernel = "linux-digilent"' >> conf/local.conf + $ echo 'PREFERRED_PROVIDER_virtual/boot-bin = "u-boot-digilent"' >> conf/local.conf + +Note: currently supported kernel and u-boot recipe are as follows table: + +recipe name| Description +--- | --- +linux-digilent | Stable kernel that has been tested - fixed commit id +linux-digilent-dev | base on latest commit of [linux-digilent](https://github.com/Digilent/u-boot-digilent) master branch +u-boot-digilent | Stable U-Boot that has been tested - fixed commit id +u-boot-digilent-dev | base on latest commit of [u-boot-digilent](https://github.com/Digilent/u-boot-digilent) master branch + +##### Including additional pacakges +An example of adding mtd-utils to the image. Add the following line to +conf/local.conf file + + IMAGE_INSTALL_append = " mtd-utils" + +Another example of adding kernel modules to the rootfs. Add the following line to +conf/local.conf file + + IMAGE_INSTALL_append = " kernel-modules" + +##### Kernel configuration +Enter kernel menuconfig for the preferred kernel. + + $ bitbake virtual/kernel -c menuconfig + +or specific kernel receipt + + $ bitbake linux-digilent-dev -c menuconfig + +### Build +This section provides the basic yocto build + +#### Yocto default images types +Yocto poky distribution provides a set of reference image recipe to create +your own distribution. You can find them under poky directory. In here, we +only try to build **core-imiage-minimal** and **core-imiage-sato** + +##### minimal image +A image provides a console based Linux OS. Build core-image-minimal run: + + $ bitbake core-image-minimal + +Intall alsa-utils to test the audio on the zybo-linux-bd-zynq7 machine +(still issues, please refer to the known issue section for detail) by adding +"alsa-utils" to IMAGE_INSTALL_append variable in the conf/local.conf file + + IMAGE_INSTALL_append = " mtd-utils alsa-utils" + +##### sato image +Image with Sato, a mobile environment and visual style for mobile devices. +The image supports X11 with a Sato theme, Pimlico applications, and contains +terminal, editor, and file manager. To build it run: + + $ bitbake core-image-sato + +You can also append xterm to the image by adding the "xterm" to +IMAGE_INSTALL_append variable in conf/local.conf file. e.g. + + IMAGE_INSTALL_append = " mtd-utils xterm" + +#### build products +if you did not specify your own TMPDIR in local.conf, the default TMPDIR is under the +build directory, in this case, it should ${HOME}/tmp/${target_machine}/tmp. Image stores +at {HOME}/tmp/${target_machine}/tmp/deploy/images/zybo-linux-bd-zynq7. You can find a +list of build images in the directory. + + ${IMG_TYPE} refers to the build image, for example, core-image-minimal. + ${target_machine} refers to zybo-linux-bd-zynq7 in this example. + +File | Description +--- | --- +boot.bin | Zynq Boot Image that only contents the U-Boot SPL +download.bit | FPGA bitstream if applicable +fit.itb | fitImage with kernel + dtb + rootfs +sdroot-fitImage | fitImage with modified dtb which use use SD root (second partition of SD) +uImage | U-Boot image format of kernel image +linux.bin | Linux kernel in binary format +modules-${target_machine}.tgz | Kernel modules +sdimg | SD card image that can be used to program SD with dd (Linux/MAC) or Win32DiskImage(Windows) +system.dtb | Device Tree Binary (DTB) +uImage-its-${target_machine}.its | its that used to create the fitImage +u-boot.bin | U-Boot binary file +u-boot-dtb.bin | U-Boot binary file with DTB +u-boot-dtb.img | U-Boot image format of u-boot-dtb.bin +u-boot-spl.bin | SPL Preloader Binary +${IMG_TYPE}-${target_machine}.cpio | Root filesystem in cpio archive format +${IMG_TYPE}-${target_machine}.cpio.gz.uboot | Root filesystem in U-Boot image format with compression +${IMG_TYPE}-${target_machine}.ext4 | Root filesystem as ext4 image + + + +### Useful commands +Show list of package available in the yocto recipes + + $ bitbake -s +or + + $ bitbake-layers show-recipes + +Removes all output files and shared state cache for a target. Becareful +of using this command. This will force everything to be rebuild from scratch. + + $ bitbake cleansstate + +Removes all output files and shared state cache for a recipe + + $ bitbake -c cleansstate + +Build specific pkg, linux-digilent-dev as an example: + + $ bitbake linux-digilent-dev + + +List out the task available for a recipe, linux-digilent-dev as an example: + + $ bitbake -c listtasks linux-digilent-dev + +Run specific task for a recipe, linux-digilent-dev as an example: + + $ bitbake -c deploy linux-digilent-dev From 834c07f154556a0a62b6fd209c735378a119b726 Mon Sep 17 00:00:00 2001 From: wxy Date: Sun, 5 Mar 2017 19:36:12 +0800 Subject: [PATCH 040/190] PRF&PUB:20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @oska874 --- ...Linux Distribution with Yocto on Ubuntu.md | 85 ++++++++----------- 1 file changed, 36 insertions(+), 49 deletions(-) rename {translated/tech => published}/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md (65%) diff --git a/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md b/published/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md similarity index 65% rename from translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md rename to published/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md index 87b4be2a81..d9d2fca8f6 100644 --- a/translated/tech/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md +++ b/published/20170220 How to create your own Linux Distribution with Yocto on Ubuntu.md @@ -3,9 +3,6 @@ ### 本文内容 -1. [开发机的基本条件][1] -2. [Yocto 编译和构建的过程][2] - 本文主要聚焦在如何使用 Yocto 在 Ubuntu 上创建一个最小化的 Linux 发行版。Yocto 项目在嵌入式 Linux 的世界非常著名,这是因为它用起来非常灵活、方便。Yocto 的目标是为嵌入式软硬件开发商创建自己的 Linux 发行版。本文我们将会创建一个可以运行在 QEMU 上的最小化的 Linux,并且在 QEMU 上实际运行。 ### 开发机的基本条件 @@ -14,27 +11,28 @@ * 最新版的 Ubuntu 系统(本文使用了 16.04 LTS) * 磁盘剩余空间至少 60-80 GB * 在创建 Linux 发行版之前先安装下面的软件包 -* 下载最新的 Yocto(Poky 时最小开发环境)稳定分支 +* 下载最新的 Yocto(Poky 是其最小开发环境)稳定分支 ``` apt-get update - +``` +``` apt-get install wget git-core unzip make gcc g++ build-essential subversion sed autoconf automake texi2html texinfo coreutils diffstat python-pysqlite2 docbook-utils libsdl1.2-dev libxml-parser-perl libgl1-mesa-dev libglu1-mesa-dev xsltproc desktop-file-utils chrpath groff libtool xterm gawk fop ``` - ![Install prerequisites for Yocto](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/1-pre_requisite_packages-1.png) +![Install prerequisites for Yocto](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/1-pre_requisite_packages-1.png) 如下所示,开发环境要安装的软件包将近 1GB 大小。 - ![Install the development packages](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/2-pre_requisite_packages-2.png) + ![Install the development packages](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/2-pre_requisite_packages-2.png) -在这个教程中,系统上克隆的 poky 的分支时 `morty` 稳定分支。 +在这个教程中,系统上克隆的是 poky 的 `morty` 稳定分支。 ``` git clone -b morty git://git.yoctoproject.org/poky.git ``` - ![install poky](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/download_morty_of_yocto.png) +![install poky](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/download_morty_of_yocto.png) 进入 `poky` 目录,然后运行下面的命令为 Yocto 开发环境设置(设置/导出)一些环境变量。 @@ -42,16 +40,15 @@ apt-get install wget git-core unzip make gcc g++ build-essential subversion sed source oe-init-build-env ``` -如下所示,在运行了 open embedded (oe) 的构建环境脚本之后,为了之后的配置和构建新版本,终端里的路径会自动切换到 `build` 目录。 +如下所示,在运行了 open embedded (oe) 的构建环境脚本之后,终端里的路径会自动切换到 `build` 目录,以便进行之后行发行版的的配置和构建。 - - ![Prepare OE build environment](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/source_environment_script.png) + ![Prepare OE build environment](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/source_environment_script.png) 上面的截屏展示了在 `conf` 目录下创建的文件 `local.conf`。这是 Yocto 用来设置目标机器细节和 SDK 的目标架构的配置文件。 -如下所示,这里设置的目标机器时 `qemux86-64`。 +如下所示,这里设置的目标机器是 `qemux86-64`。 - ![Set the target machine type](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/selected_target.png) + ![Set the target machine type](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/selected_target.png) 如下面截图所示,在 `local.conf` 中取消下面参数的注释符号。 @@ -59,28 +56,26 @@ source oe-init-build-env DL_DIR ?= "${TOPDIR}/downloads" ``` - ![Configure local.conf file](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/uncheck_Download_parameters.png) +![Configure local.conf file](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/uncheck_Download_parameters.png) ``` SSTATE_DIR ?= "${TOPDIR}/sstate-cache" ``` - - ![Set SSTATE_DIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/uncheck_sstate_parametes.png) +![Set SSTATE_DIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/uncheck_sstate_parametes.png) ``` TMPDIR ?= "${TOPDIR}/tmp" ``` - ![Set TMPDIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/tempdir_uncheck_paramerter.png) +![Set TMPDIR](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/tempdir_uncheck_paramerter.png) ``` PACKAGE_CLASSES ?= "package_rpm" SDKMACHINE ?= "i686" ``` -![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/sdk_and_package_selection.png) - +![Set PACKAGE_CLASSES and SDKMACHINE](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/sdk_and_package_selection.png) 如下所示,在 `local.conf` 中为基于 Yocto 的 Linux 设置空密码和后续的一些参数。否则的话用户就不能登录进新的发行版。 @@ -88,75 +83,67 @@ SDKMACHINE ?= "i686" EXTRA_IMAGE_FEATURES ?= "debug-tweaks" ``` - ![Set debug-tweaks option](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/extra-features_for_blank_password.png) +![Set debug-tweaks option](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/extra-features_for_blank_password.png) -我们并不准备使用任何图形化工具来创建 Linux OS,比如 `toaster` (`hob` 已经不再被支持了)。 +我们并不准备使用任何图形化工具来创建 Linux OS,比如 `toaster` (`hob` 已经不再支持了)。 ### Yocto 编译构建过程 -现在运行下面的 `bitbake` 组件的命令开始为选定的目标机器下载和编译软件包。 +现在运行下面的 `bitbake` 工具命令开始为选定的目标机器下载和编译软件包。 ``` bitbake core-image-minimal ``` - ![Start bitbake](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/bitbake_coreimageminimal.png) +![Start bitbake](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/bitbake_coreimageminimal.png) +**非常重要的是要在普通 Linux 用户下运行上面的命令,而不是使用 root 用户**。如下面截图所示,当你在 root 用户下运行 bitbake 命令会产生下面所示的错误。 -**非常重要的是在普通 Linux 用户下运行上面的命令,而不是使用 root 用户**。如下面截图所示,当你在 root 用户下运行 bitbake 命令会产生下面所示的错误。 +![Do not run bitbake as root](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/dont_user_as_a_root.png) +再一次运行导出环境变量的脚本(`oe-init-build-env`),重新执行相同的命令来启动下载和编译过程。 - ![Do not run bitbake as root](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/dont_user_as_a_root.png) - - -再一次运行导出环境变量的脚本(`oe-init-build-env`),重新执行相同的命令来启动下载和编译进程。 - - - ![rerun commands](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runniing_bitbake_again-normal_user.png) +![rerun commands](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/runniing_bitbake_again-normal_user.png) 如下所示,构建脚本组件的第一步工作是解析配置(`recipe`)。 - - ![Parse the build recipes](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/parsing-receipe.png) - +![Parse the build recipes](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/parsing-receipe.png) 下面的截图展示了构建脚本的解析过程。同时也显示了用来构建你的新的基于 yocto 的发行版的构建系统的细节。 +![Building proceeds](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/output_of_parsing.png) - ![Building proceeds](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/output_of_parsing.png) +在下载了 SDK 和必要的库之后,下一步工作是下载并编译软件包。如下截图展示了为构建新发行版而执行的任务。这一步将会执行 2-3 小时,因为首先要下载需要的软件包,然后还要为新的 Linux 发行版编译这些软件包。 -在下载了 SDK 和必要的库之后,下一步工作是下载和编译软件包。如下截图展示了为构建新发行版而执行的任务。这一步将会执行 2-3 小时,因为第一要下载需要的软件包,然后还要为新的 Linux 发行版编译这些软件包。 - - - ![Compilation will take several hours](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/task_list.png) +![Compilation will take several hours](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/task_list.png) 下面的截图表明了任务列表执行完毕。 - ![](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/downloaded-all_packages_and_compiled.png) + ![](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/downloaded-all_packages_and_compiled.png) -为目标机器类型 `qemux86-64` 编译好的新镜像位于 `build/tmp/deploy/images/qemux86-64`: +为目标机器类型 `qemux86-64` 编译好的新镜像位于 `build/tmp/deploy/images/qemux86-64`: - ![Build complete](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_compiled_under_qemux86_64.png) +![Build complete](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/new_linux_compiled_under_qemux86_64.png) 如下所示,上面的命令如果运行在 `Putty` 上会产生一个错误。 - ![command error in putty](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/error_on_putty.png) +![command error in putty](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/error_on_putty.png) 通过 `rdp` 在 Ubuntu 平台上再次运行上面的命令。 - ![Command works fine in rdp](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/runqemu_command.png) +![Command works fine in rdp](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/runqemu_command.png) 为运行新的基于 Yocto 的 Linux 发行版的 qemu 打开一个新屏幕。 - ![Open Quemu emulator](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/new_linux_inside_the_qemu_.png) +![Open Quemu emulator](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/new_linux_inside_the_qemu_.png) 下面展示了新发行版的登录界面,同时也显示了使用的 yocto 项目的版本号。默认的用户名是 `root` ,密码为空。 - ![Linux distribution started](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/reference_distro.png) + ![Linux distribution started](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/reference_distro.png) 最后使用 `root` 用户名和空密码登录新发行版。如下截图所示,在这个最小版本的 Linux 上运行了基本的命令(`data` 、 `ifconfig` 和 `uname`)。 - ![Test the Linux distribution](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/inside_new_linux_distro_running_on_qemu_3.png) + ![Test the Linux distribution](https://www.howtoforge.com/images/how-to-create-your-own-linux-distribution-with-yocto/big/inside_new_linux_distro_running_on_qemu_3.png) 本文的目标是理解使用 Yocto 创建新的 Linux 发行版的过程。 @@ -166,7 +153,7 @@ via: https://www.howtoforge.com/tutorial/how-to-create-your-own-linux-distributi 作者:[Ahmad][a] 译者:[Ezio](https://github.com/oska874) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6c326e53fbca9feec1b3424c99b1672a9c96565e Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Sun, 5 Mar 2017 21:08:05 +0800 Subject: [PATCH 041/190] =?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 校对完毕 --- ...ta for your applications with Elizabeth.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md b/translated/tech/20170215 Generate random data for your applications with Elizabeth.md index d773e173af..e8f47b6d8a 100644 --- a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md +++ b/translated/tech/20170215 Generate random data for your applications with Elizabeth.md @@ -1,15 +1,16 @@ -使用 Elizabeth 为你的应用生成随机数据 +使用 Elizabeth 为应用生成随机数据 ============================================================ ![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") + 图片提供 : Opensource.com _Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. _ -不,我的文章没有被 [Lorem ipsum][2] 生成器劫持。对于本月的 Nooks&Crannies 专栏,我发现了一个有趣的小 Python 库,以帮助开发人员为其应用程序生成随机数据。它被称为 [Elizabeth][3]。 +不,我的文章没有被 [Lorem ipsum][2] 生成器劫持(LCTT 译注:Lorem ipsum,中文又称“乱数假文”,只是一段用来测试排版效果的占位文字,没有实际的含义)。对于本月的 Nooks&Crannies 专栏,我发现了一个有趣的小 Python 库,以帮助开发人员为其应用程序生成随机数据。它被称为 [Elizabeth][3]。 -它由 Líkið Geimfari 编写,并在 MIT 许可证下发行,Elizabeth 在 21 个不同地区设有一组 18 个数据提供器,它们可用于生成随机信息,包括姓名和个人特征、地址、文本数据、交通信息、网络和 Internet 社交媒体数据、数字等等。需要安装 [Python 3.2][4] 或更高版本,您可以使用 **pip** 或从 **git** 仓库安装它。 +它由 Líkið Geimfari 编写,并在 MIT 许可证下发行,Elizabeth 在 21 个不同地区设有 18 个数据提供器,可用于生成随机信息,包括姓名和个人特征、地址、文本数据、交通信息、网络和 Internet 社交媒体数据、数字等等。安装它需要 [Python 3.2][4] 或更高版本,您可以使用 **pip** 或从 **git** 仓库安装它。 在我的测试机上,我在一个全新安装的 [Debian][5] Jessie 上使用 pip 来安装它。你要做的是 **apt-get install python3-pip**,它将安装 Python 和所需的依赖项。然后 **pip install elizabeth**,之后就安装好了。 @@ -41,7 +42,7 @@ 在代码中使用它就像创建一个对象那样,然后调用要填充数据的方法。 -Elizabeth 有 18 种不同的生成工具,添加新的生成器并不困难; 你只需要定义从 JSON 值集合中获取数据的例程。这里是一些随机文本字符串生成,再次打开解释器: +Elizabeth 内置了 18 种不同的生成工具,添加新的生成器并不困难; 你只需要定义从 JSON 值集合中获取数据的例程。这里是一些随机文本字符串生成,再次打开解释器: ``` >>> from elizabeth import Text @@ -56,19 +57,19 @@ Elizabeth 有 18 种不同的生成工具,添加新的生成器并不困难; 'She spent her earliest years reading classic literature, and writing poetry.' ``` -使用 Elizabeth 填充 [SQLite][6] 或其他可能需要开发或测试的数据库不是一个困难的练习。介绍文档给出了使用 [Flask][7] 这个轻量级 web 框架的医疗应用程序的示例。 +使用 Elizabeth 填充 [SQLite][6] 或其他可能需要开发或测试的数据库并不困难。介绍文档给出了使用 [Flask][7] 这个轻量级 web 框架的一个医疗应用程序示例。 -我对 Elizabeth 印象很深刻 - 它超快、轻量级、易于扩展,它的社区虽然小,但是积极参与。截至本文写作时,已有 25 名贡献者提交,并且问题正在被迅速处理。Elizabeth 的[完整文档][8]至少对于美国英语而言易于阅读和遵循,并提供了广泛的 API 参考。 +我对 Elizabeth 印象很深刻 - 它超快、轻量级、易于扩展,它的社区虽然小,但是很活跃。截至本文写作时,项目已有 25 名贡献者,并且提交的问题处理迅速。Elizabeth 的[完整文档][8]至少对于美国英语而言易于阅读和遵循,并提供了广泛的 API 参考。 -我曾尝试修改链接来找到文档是否有其他语言,但我没有成功。因为 API 在非英语区域中是不同的,所以记录这些变化将对用户非常有帮助。公平地说,阅读代码并找出可用的方法并不难,即使 Python-fu 不够强大。对我来说,另一个明显的缺陷是缺乏阿拉伯语或希伯来语区域测试数据。这些是著名的从右到左的语言,并且对于试图使其应用程序国际化的开发者,适当地处理这些语言是一个主要的障碍。像 Elizabeth 这种工具,可以协助这种努力是伟大的。 +我曾尝试通过修改链接来查找文档是否有其他语言,但没有成功。因为 API 在非英语区域中是不同的,所以记录这些变化将对用户非常有帮助。公平地说,阅读代码并找出可用的方法并不难,即使你的 Python-fu 能力并不强。对我来说,另一个明显的缺陷是缺乏阿拉伯语或希伯来语区域测试数据。这些是著名的从右到左的语言,对于试图使其应用程序国际化的开发者来说,适当地处理这些语言是一个主要的障碍。像 Elizabeth 这种在此方面可以协助的工具是值得拥有的。 -对于那些在应用中需要随机样本数据的开发员而言 Elizabeth 是一个有价值的工具,对于那些试图创建真正多语言、本地化的应用程序,它可能是一个宝藏。 +对于那些在应用中需要随机样本数据的开发员而言,Elizabeth 是一个有价值的工具,而对于那些试图创建真正多语言、本地化应用程序的开发者来说,它可能是一个宝藏。 -------------------------------------------------------------------------------- 作者简介: -D Ruth Bavousett - D Ruth Bavousett 成为一名系统管理员和软件开发人员很长时间了,她最初专注在 VAX 11/780。她花了很多她的职业生涯(迄今为止)为图书馆的技术需求服务,自 2008 年以来一直是 Koha 开源库自动化套件的贡献者。Ruth 目前是休斯顿 cPanel 的 Perl开发人员,并养了两只猫。 +D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前在休斯敦的 cPanel 任 Perl 开发人员,她也作为首席员工效力于双猫公司。 -------------------------------------------------------------------------------- From 0ea72781522e8ab4699ec68c968db5c4cc3125ff Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Sun, 5 Mar 2017 21:10:24 +0800 Subject: [PATCH 042/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- ...0170213 A beginners guide to understanding sudo on Ubuntu.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md index 9c5c4f3dd4..2776006a92 100644 --- a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md +++ b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md @@ -235,7 +235,7 @@ via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ 作者:[Himanshu Arora][a] 译者:[ypingcn](https://ypingcn.github.io/wiki/lctt) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 280d2da018db01536dcbe305d458c8dd11e86469 Mon Sep 17 00:00:00 2001 From: wxy Date: Sun, 5 Mar 2017 23:54:09 +0800 Subject: [PATCH 043/190] PUB:20170118 Why Linux Installers Need to Add Security Features.md @geekpi @bestony --- ...nstallers Need to Add Security Features.md | 71 +++++++++++++++++++ ...nstallers Need to Add Security Features.md | 71 ------------------- 2 files changed, 71 insertions(+), 71 deletions(-) create mode 100644 published/20170118 Why Linux Installers Need to Add Security Features.md delete mode 100644 translated/tech/20170118 Why Linux Installers Need to Add Security Features.md diff --git a/published/20170118 Why Linux Installers Need to Add Security Features.md b/published/20170118 Why Linux Installers Need to Add Security Features.md new file mode 100644 index 0000000000..bb67bc515b --- /dev/null +++ b/published/20170118 Why Linux Installers Need to Add Security Features.md @@ -0,0 +1,71 @@ +为何 Linux 安装器需要添加安全功能 +============================================================ + +> 由于安全问题越来越严重,Linux 发行版需要在安装程序中突出显示基本安全选项,而不是让用户稍后手动添加这些选项。 + +十二年前,Linux 发行版努力使安装变得简单。在 Ubuntu 和 Fedora 的引领下,它们很早就实现了这一目标。现在,随着对安全性越来越关注,它们需要稍微转变下方向,并在安装程序中突出显示基本安全选项,而不是让用户稍后手动添加这些选项。 + +当然,即便是在最好的情况下,说服用户来设置安全功能都是困难的。太多用户甚至不愿意添加如非特权用户帐户或密码这样简单的功能,他们显然更喜欢用重装或者以每小时 80 美元的价格咨询专家来减少风险。 + +然而,即便一般用户不会专门注意安全,但他也可能会在安装过程中注意。他们可能永远不会再想到它,但也许在安装过程中,当他们的注意力集中时,特别是如果有可见的在线帮助来解释其好处时,他们可能被说服选择一个复选框。 + +这种转变也并不伟大。许多安装程序已经提供了自动登录的选择 - 这对于不包含个人数据的安装来说或许是可以接受的功能,但更可能会被那些觉得登录不方便的用户使用。同样感谢 Ubuntu,它选择加密文件系统 - 至少在主目录中是这样 - 它已经成为许多安装程序的标准。我真正建议的也是这样的。 + +此外,外部安装程序如 Firefox 已经无缝合并了隐私浏览,而 [Signal Private Messenger][8] 则是一个可替代标准 的 Android 手机和联系人的应用程序。 + +这些建议远不算激进。它只需要意志和想象力来实现它。 + +### Linux 安全第一步 + +应该将什么类型的安全功能添加到安装程序呢? + +首先是防火墙。有许多图形界面程序可以设置防火墙。尽管十七年的经验,但是就像拜伦对柯尔律治的形而上的思想的讨论一样,我有时还是希望有人能来解释一下。 + +尽管出于好意,大多数防火墙工具对 iptables 的处理看起来都很直接。有一个现在已经停止维护的加固系统 [Bastille Linux][9] 可以用于安装一个基本的防火墙,我看不出为什么其他发行版做不到同样的事情。 + +一些工具可以用于安装后处理,并且对于安装器而言可以毫无困难地添加使用。例如,对于 [Grub 2][10],这个大多数发行版使用的引导管理器包含了基本密码保护。诚然,密码可以通过 Live CD 绕过,但它仍然在包括远程登录在内的日常情况下提供一定程度的保护。 + +类似地,一个类似于 [pwgen][11] 的密码生成器也可以添加到安装程序设置帐户的环节。这些工具强制可接受密码的长度、以及它们的大小写字母、数字和特殊字符的组合。它们许多都可以为你生成密码,有些甚至可以使生成的密码可拼读,以便你记住密码。 + +还有些工具也可以添加到安装过程的这个部分。例如,安装程序可以请求定期备份的计划,并添加一个计划任务和一个类似 [kbackup][12] 的简单的备份工具。 + +那么加密电子邮件怎么办?如今最流行的邮件阅读器包括了加密邮件的能力,但是设置和使用加密需要用户采取额外的设置,这使常见的任务复杂化,以至于用户会忽略它。然而,看看 Signal 在手机上的加密有多么简单,很显然,在笔记本电脑和工作站上加密会更容易。大多数发行版可能都喜欢对等加密,而不喜欢 Signal 那样的集中式服务器,但像 [Ring][13] 这样的程序可以提供这种功能。 + +无论在安装程序中添加了什么功能,也许这些预防措施也可以扩展到生产力软件,如 LibreOffice。大多数安全工作都集中在电子邮件、网络浏览和聊天中,但文字处理程序和电子表格及其宏语言,是一个明显的恶意软件感染的来源和隐私关注点。除了像 [Qubes OS][14] 或 [Subgraph][15] 这样的几个例外之外,很少有人努力将生产力软件纳入其安全预防措施 - 这可能会留下一个安全漏洞空缺。 + +### 适应现代 + +当然,在意安全的用户也许会采取一些安全的方法,这样的用户可以为自己负责。 + +我关心的是那些不太了解安全或不太愿意自己做修补的用户。我们越来越需要易于使用的安全性,并且亟待解决。 + +这些例子只是开始。所需要的工具大多数已经存在,只是需要以这样的方式来实现它们,使得用户不能忽略它们,并且能够不用懂什么就可以使用它们。可能实现所有这些只需要一个人月而已,包括原型、UI 设计和测试等等。 + +然而,在添加这些功能前,大多数主流的 Linux 发行版几乎不能说是关注到了安全性。毕竟,如果用户从不使用它们,那怎么会是好工具? + +-------------------------------------------------------------------------------- + +via: http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html + +作者:[Bruce Byfield][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Bestony](https://github.com/Bestony), [wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.datamation.com/author/Bruce-Byfield-6030.html +[1]:http://www.datamation.com/feedback/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html +[2]:http://www.datamation.com/author/Bruce-Byfield-6030.html +[3]:http://www.datamation.com/e-mail/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html +[4]:http://www.datamation.com/print/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html +[5]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html#comment_form +[6]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html# +[7]:http://www.datamation.com/author/Bruce-Byfield-6030.html +[8]:https://whispersystems.org/ +[9]:http://bastille-linux.sourceforge.net/ +[10]:https://help.ubuntu.com/community/Grub2/Passwords +[11]:http://pwgen-win.sourceforge.net/downloads.html +[12]:http://kbackup.sourceforge.net/ +[13]:https://savannah.gnu.org/projects/ring/ +[14]:https://www.qubes-os.org/ +[15]:https://subgraph.com/sgos/ diff --git a/translated/tech/20170118 Why Linux Installers Need to Add Security Features.md b/translated/tech/20170118 Why Linux Installers Need to Add Security Features.md deleted file mode 100644 index 547fda8c5d..0000000000 --- a/translated/tech/20170118 Why Linux Installers Need to Add Security Features.md +++ /dev/null @@ -1,71 +0,0 @@ -为何 Linux 安装器需要添加安全功能 -============================================================ - -> _由于安全问题越来越严重,Linux 发行版需要在安装程序中突出显示基本安全选项,而不是用户稍后可以手动添加的选项。_ - -十二年前,Linux 发行版努力使安装变得简单。在 Ubuntu 和 Fedora 的领导下,它们很早就实现了这一目标。现在,随着对安全性越来越关注,它们需要稍微转变下方向,并在安装程序中突出显示基本安全选项,而不是用户稍后可以手动添加的选项。 - -当然,在最好的情况下,说服用户来设置安全功能都是困难的。太多用户不愿意添加如非特权用户帐户或密码一样简单的功能,他们显然更喜欢用重装或者以每小时 80 美元的价格咨询专家来减少风险。 - -然而,如果一般用户不会注意安全,但他可能会在安装过程中注意。他们可能永远不会再想到它,但也许在安装过程中,当他们的注意力集中时,特别是如果有可见的在线帮助来解释,他们可能被说服选择一个复选框。 - -这种转变也并不伟大。许多安装程序已经提供了自动登录的选择 - 一个不包含个人数据的安装功能或许是可以接受的,但很可能不会被那些觉得登录不方便的用户使用。同样感谢 Ubuntu,它选择加密文件系统 - 至少在主目录中是这样 - 它已经成为许多安装程序的标准。我真正建议的是这样的。 - -此外,外部安装程序如 Firefox 已经无缝合并了隐私浏览,[Signal Private Messenger][8] 是一个替代标准 Android 手机和联系人应用程序。 - -这些建议远不是激进的。它只需要意志和想象力来实现它。 - -### Linux 安全第一步 - -应该将什么类型的安全功能添加到安装程序? - -首先是防火墙。有许多图形界面程序可以设置防火墙。尽管十七年的经验,但是为了解释 Byron 谈论 Coleridge 的形而上学的猜测,我有时希望有人解释他们的说明。 - -尽管有良好的意图,大多数防火墙工具让处理 iptables 似乎很直接。[Bastille Linux][9],一个现在已经停止维护加固系统,可以用于安装一个基本的防火墙,我看不出为什么其他发行版不能做同样的事情。 - -一些工具在安装后就可以使用,并且对安装者而言可以没有困难地添加。例如,[Grub 2][10],大多数发行版使用的引导管理器包含了基本密码保护。但不可否认的是,密码仍可以通过 Live CD 绕过,但它仍然在日常情况下提供一定程度的保护,包括远程登录。 - -类似地,一个后安装的密码管理器(如 [pwgen][11])可以添加到安装程序的设置帐户部分。这些工具强制可接受密码的长度,以及它们的大小写字母,数字和特殊字符的组合。它们许多都可以为你生成密码,有些甚至可以记住密码。 - -还有些工具可以在安装中添加。例如,安装程序可以请求定期备份的计划,并添加一个 cronjob 和一个简单的备份工具,如[kbackup][12]。 - -那么加密电子邮件怎么办?如今最流行的邮件阅读器包括了加密邮件的能力,但是设置和使用加密需要用户采取额外的设置,这使常见的任务复杂化,以至于用户会忽略它。然而,看看 Signal 在手机上的加密有多么简单,很显然,在笔记本电脑和工作站上加密会更容易。这大多数发行版可能都喜欢对等加密,而不喜欢 Signal 那样的集中式服务器,但像 [Ring][13] 这样的程序可以提供这种功能。 - -无论在安装程序中添加了什么功能,也许预防措施也可以扩展到生产力软件,如 LibreOffice。大多数安全工作都集中在电子邮件、网络浏览和聊天中,但文字处理程序和电子表格,以及他们的宏语言,是一个明显的恶意软件感染的来源和隐私关注。除了像 [Qubes OS][14] 或 [Subgraph][15] 这样的几个意外之外,很少有人努力将生产力软件纳入其安全预防措施 - 这可能会留下一个空白的安全漏洞。 - -### 适应现代 - -当然,在意安全的用户也许会采取一些安全的方法。然而,这样的用户可以是信任自己。 - -我关心的是那些不太了解或不太愿意自己做修补的用户。我们越来越需要易于使用的安全性,并且亟待解决。 - -这些例子只是开始。它们中的大多数已经存在,并且需要以这样的方式来实现它们,使得用户不能忽略它们,并且能够以最少的知识来使用它们。可能实现所有这些只需要一个程序员,包括原型、UI 设计和测试,且不用超过一个月。 - -然而,直到添加这些功能后,大多数主流的 Linux 发行版几乎不能说是对安全性关注。毕竟,如果用户从不使用它们,那怎么会是好工具? - --------------------------------------------------------------------------------- - -via: http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html - -作者:[Bruce Byfield][a] -译者:[geekpi](https://github.com/geekpi) -校对:[Bestony](https://github.com/Bestony) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.datamation.com/author/Bruce-Byfield-6030.html -[1]:http://www.datamation.com/feedback/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html -[2]:http://www.datamation.com/author/Bruce-Byfield-6030.html -[3]:http://www.datamation.com/e-mail/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html -[4]:http://www.datamation.com/print/http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html -[5]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html#comment_form -[6]:http://www.datamation.com/security/why-linux-installers-need-to-add-security-features.html# -[7]:http://www.datamation.com/author/Bruce-Byfield-6030.html -[8]:https://whispersystems.org/ -[9]:http://bastille-linux.sourceforge.net/ -[10]:https://help.ubuntu.com/community/Grub2/Passwords -[11]:http://pwgen-win.sourceforge.net/downloads.html -[12]:http://kbackup.sourceforge.net/ -[13]:https://savannah.gnu.org/projects/ring/ -[14]:https://www.qubes-os.org/ -[15]:https://subgraph.com/sgos/ From a2a7a811910aa7bb0e1d8996e68fb8e41c0df87e Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 6 Mar 2017 09:31:25 +0800 Subject: [PATCH 044/190] PUB:20170215 Generate random data for your applications with Elizabeth.md @geekpi @jasminepeng --- ...ta for your applications with Elizabeth.md | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) rename {translated/tech => published}/20170215 Generate random data for your applications with Elizabeth.md (55%) diff --git a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md b/published/20170215 Generate random data for your applications with Elizabeth.md similarity index 55% rename from translated/tech/20170215 Generate random data for your applications with Elizabeth.md rename to published/20170215 Generate random data for your applications with Elizabeth.md index e8f47b6d8a..0888f912ba 100644 --- a/translated/tech/20170215 Generate random data for your applications with Elizabeth.md +++ b/published/20170215 Generate random data for your applications with Elizabeth.md @@ -1,18 +1,17 @@ -使用 Elizabeth 为应用生成随机数据 +使用 Elizabeth 为应用生成随机样本数据 ============================================================ - - ![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") +![Generate random data for your applications with Elizabeth](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/osdc_520x292_opendata_0613mm.png?itok=mzC0Tb28 "Generate random data for your applications with Elizabeth") 图片提供 : Opensource.com - _Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. _ + > Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.  -不,我的文章没有被 [Lorem ipsum][2] 生成器劫持(LCTT 译注:Lorem ipsum,中文又称“乱数假文”,只是一段用来测试排版效果的占位文字,没有实际的含义)。对于本月的 Nooks&Crannies 专栏,我发现了一个有趣的小 Python 库,以帮助开发人员为其应用程序生成随机数据。它被称为 [Elizabeth][3]。 +不,我的文章没有被 [Lorem ipsum][2] 生成器劫持(LCTT 译注:Lorem ipsum,中文又称“乱数假文”,只是一段用来测试排版效果的占位文字,没有实际的含义)。作为本月的 Nooks&Crannies 专栏文章,我发现了一个有趣的小 Python 库,以帮助开发人员为其应用程序生成随机数据。它被称为 [Elizabeth][3]。 -它由 Líkið Geimfari 编写,并在 MIT 许可证下发行,Elizabeth 在 21 个不同地区设有 18 个数据提供器,可用于生成随机信息,包括姓名和个人特征、地址、文本数据、交通信息、网络和 Internet 社交媒体数据、数字等等。安装它需要 [Python 3.2][4] 或更高版本,您可以使用 **pip** 或从 **git** 仓库安装它。 +它由 Líkið Geimfari 编写,并在 MIT 许可证下发行,Elizabeth 以 21 个不同本地化信息提供了 18 种数据提供器,可用于生成随机信息(LCTT 译注:不仅是随机数),包括姓名和个人特征、地址、文本数据、交通信息、网络和 Internet 社交媒体数据、数字等等。安装它需要 [Python 3.2][4] 或更高版本,您可以使用 `pip` 或从 `git` 仓库安装它。 -在我的测试机上,我在一个全新安装的 [Debian][5] Jessie 上使用 pip 来安装它。你要做的是 **apt-get install python3-pip**,它将安装 Python 和所需的依赖项。然后 **pip install elizabeth**,之后就安装好了。 +在我的测试机上,我在一个全新安装的 [Debian][5] Jessie 上使用 pip 来安装它,要做的就是 `apt-get install python3-pip`,它将安装 Python 和所需的依赖项。然后 `pip install elizabeth`,之后就安装好了。 只是为好玩,让我们在 Python 的交互式解释器中为一个人生成一些随机数据: @@ -40,9 +39,9 @@ >>> ``` -在代码中使用它就像创建一个对象那样,然后调用要填充数据的方法。 +在代码中使用它就像创建一个对象那样,然后调用要你需要填充数据的对应方法。 -Elizabeth 内置了 18 种不同的生成工具,添加新的生成器并不困难; 你只需要定义从 JSON 值集合中获取数据的例程。这里是一些随机文本字符串生成,再次打开解释器: +Elizabeth 内置了 18 种不同的生成工具,添加新的生成器并不困难;你只需要定义从 JSON 值集合中获取数据的例程。以下是一些随机文本字符串生成,再次打开解释器: ``` >>> from elizabeth import Text @@ -57,11 +56,11 @@ Elizabeth 内置了 18 种不同的生成工具,添加新的生成器并不困 'She spent her earliest years reading classic literature, and writing poetry.' ``` -使用 Elizabeth 填充 [SQLite][6] 或其他可能需要开发或测试的数据库并不困难。介绍文档给出了使用 [Flask][7] 这个轻量级 web 框架的一个医疗应用程序示例。 +使用 Elizabeth 填充 [SQLite][6] 或其它你可能需要用于开发或测试的数据库并不困难。其介绍文档给出了使用 [Flask][7] 这个轻量级 web 框架的一个医疗应用程序示例。 我对 Elizabeth 印象很深刻 - 它超快、轻量级、易于扩展,它的社区虽然小,但是很活跃。截至本文写作时,项目已有 25 名贡献者,并且提交的问题处理迅速。Elizabeth 的[完整文档][8]至少对于美国英语而言易于阅读和遵循,并提供了广泛的 API 参考。 -我曾尝试通过修改链接来查找文档是否有其他语言,但没有成功。因为 API 在非英语区域中是不同的,所以记录这些变化将对用户非常有帮助。公平地说,阅读代码并找出可用的方法并不难,即使你的 Python-fu 能力并不强。对我来说,另一个明显的缺陷是缺乏阿拉伯语或希伯来语区域测试数据。这些是著名的从右到左的语言,对于试图使其应用程序国际化的开发者来说,适当地处理这些语言是一个主要的障碍。像 Elizabeth 这种在此方面可以协助的工具是值得拥有的。 +我曾尝试通过修改链接来查找该文档是否有其他语言,但没有成功。因为其 API 在非英语区域中是不同的,所以记录这些变化将对用户非常有帮助。公平地说,通过阅读其代码并找出可用的方法并不难,即使你的 Python 功力并不深厚。对我来说,另一个明显的缺陷是缺乏阿拉伯语或希伯来语区域测试数据。这些是著名的从右到左的语言,对于试图使其应用程序国际化的开发者来说,适当地处理这些语言是一个主要的障碍。像 Elizabeth 这种在此方面可以协助的工具是值得拥有的。 对于那些在应用中需要随机样本数据的开发员而言,Elizabeth 是一个有价值的工具,而对于那些试图创建真正多语言、本地化应用程序的开发者来说,它可能是一个宝藏。 @@ -69,7 +68,7 @@ Elizabeth 内置了 18 种不同的生成工具,添加新的生成器并不困 作者简介: -D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她花费了大量的时间在满足库的需求上,她自 2008 年以来一直是 Koha 开源库自动化套件的贡献者. Ruth 目前在休斯敦的 cPanel 任 Perl 开发人员,她也作为首席员工效力于双猫公司。 +D Ruth Bavousett - D Ruth Bavousett 作为一名系统管理员和软件开发人员已经很长时间了,她的专业生涯开始于 VAX 11/780。在她的职业生涯(迄今为止)中,她在解决图书馆需求上有大量的经验,她自 2008 年以来一直是 Koha 开源图书馆自动化套件的贡献者。Ruth 目前在休斯敦的 cPanel 任 Perl 开发人员,她也作为首席员工效力于双猫公司。 -------------------------------------------------------------------------------- From 949ddb626f4c3d981a30e1f5e1f05a04c1c8642e Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 6 Mar 2017 09:37:19 +0800 Subject: [PATCH 045/190] translating --- ...ing System for Linux Gaming Which One Do You Use and Why.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md index 3a638b150b..51635d3201 100644 --- a/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md +++ b/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @@ -1,3 +1,5 @@ +translating---geekpi + The Best Operating System for Linux Gaming: Which One Do You Use and Why? ============================================================ From 4deca66922205cb70500d8c0020ff6d2fa844792 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 6 Mar 2017 10:11:10 +0800 Subject: [PATCH 046/190] translated --- ...ux Gaming Which One Do You Use and Why.md | 50 ------------------- ...ux Gaming Which One Do You Use and Why.md | 48 ++++++++++++++++++ 2 files changed, 48 insertions(+), 50 deletions(-) delete mode 100644 sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md create mode 100644 translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md diff --git a/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md deleted file mode 100644 index 51635d3201..0000000000 --- a/sources/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md +++ /dev/null @@ -1,50 +0,0 @@ -translating---geekpi - -The Best Operating System for Linux Gaming: Which One Do You Use and Why? -============================================================ - - -### Tell us which is the best Linux distro for Linux gaming - - -In the last few months, we tried multiple GNU/Linux distributions for gaming purposes, and we have come to the conclusion that there's no perfect operating system out there designed for Linux gaming. - -We all know that the world of gaming is split between Nvidia and AMD users. Now, if you're using an Nvidia graphics card, even one from five years ago, chances are it's supported on most Linux-based operating systems because Nvidia provides up-to-date video drivers for most, if not all of its GPUs. - -Of course, this means that you shouldn't have any major issues with most GNU/Linux distributions if you have an Nvidia GPU. At least not related to graphical artifacts or other performance problems when playing games, which will drastically affect your gaming experiences. - -The best Linux gaming OS for AMD Radeon users - -Now, things are totally different if you're using an AMD Radeon GPU. We all know that AMD's proprietary graphics drivers still need a lot of work to be compatible with the latest GNU/Linux distributions and all the AMD GPUs that exist out there, as well as the latest X.Org Server and Linux kernel releases. - -Currently, the AMDGPU-PRO video driver works only on Ubuntu 16.04 LTS, CentOS 6.8/7.3, Red Hat Enterprise Linux 6.8/7.3, and SUSE Linux Enterprise Desktop and Server 12 SP2\. With the exception of Ubuntu 16.04 LTS, we have no idea why AMD provides support for all those server-oriented and enterprise-ready operating systems. - -We refuse to believe that there are Linux gamers out there who use any of these OSes for anything gaming related. The [latest AMDGPU-PRO update][1] finally brought support for AMD Radeon GPUs from the HD 7xxx and 8xxx series, but what if we don't want to use Ubuntu 16.04 LTS? - -On the other hand, we have the Mesa 3D Graphics Library, which is found on most distros out there. The Mesa graphics stack provides us with quite powerful open-source Radeon and AMDGPU drivers for our AMD GPUs, but to enjoy the best gaming experience possible, you also need to have the latest X.Org Server and Linux kernels. - -Not all Linux operating systems come with the latest Mesa (13.0), X.Org Server (1.19), and Linux kernel (4.9) versions with support for older AMD GPUs. Some have only one or two of these technologies, but we need them all and the kernel needs to be compiled with AMD Radeon Southern Islands and Sea Island support for the AMDGPU driver to work. - -We found the entire situation quite disheartening, at least for some AMD Radeon gamers using a bit older graphics cards. For now, we have discovered that the best gaming experience with an AMD Radeon HD 8xxx GPU can be achieved only by using Mesa 17 from Git and Linux kernel 4.10 RC. - -So we're asking you now - if you've found the perfect GNU/Linux distribution for gaming, no matter if your using an AMD Radeon or Nvidia GPU, but we are most interested in those who are using AMD GPUs, what distro and settings are you using and can you play the latest games or are still experiencing issues? Thank you! - --------------------------------------------------------------------------------- - -via: http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml - -作者:[Marius Nestor ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/marius-nestor -[1]:http://news.softpedia.com/news/amdgpu-pro-16-60-linux-driver-finally-adds-amd-radeon-hd-7xxx-8xxx-support-512280.shtml -[2]:http://news.softpedia.com/editors/browse/marius-nestor -[3]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# -[4]:https://share.flipboard.com/bookmarklet/popout?v=2&title=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml&t=1487038258&utm_campaign=widgets&utm_medium=web&utm_source=flipit&utm_content=news.softpedia.com -[5]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# -[6]:http://twitter.com/intent/tweet?related=softpedia&via=mariusnestor&text=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml -[7]:https://plus.google.com/share?url=http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml -[8]:https://twitter.com/intent/follow?screen_name=mariusnestor diff --git a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md new file mode 100644 index 0000000000..0cca9b800b --- /dev/null +++ b/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @@ -0,0 +1,48 @@ +Linux 游戏最好的操作系统:该选哪个以及为什么? +============================================================ + + +### 告我我们哪个 Linux 发型版是对游戏支持最好的 + + +在过去几个月中,我们尝试了多种用于游戏的 GNU/Linux 发行版,我们得出的结论是没有完美的操作系统专为 Linux 游戏设计。 + +我们都知道,游戏世界在 Nvidia 和 AMD 用户之间分裂。现在,如果你使用的是 Nvidia 显卡,即使是五年前的一块显卡,也可以在大多数基于 Linux 的操作系统上使用,因为 Nvidia 为大多数(如果不是全部的话)GPU 提供了最新的视频驱动程序。 + +当然,这意味着如果你有一块 Nvidia GPU,你不应该有大多数 GNU/Linux 发行版的任何主要问题。至少与游戏中的图形或其他性能问题无关,这将严重影响你的游戏体验。 + +AMD Radeon 用户最好的游戏发行版 + +如果你使用 AMD Radeon GPU,事情会是完全不同的。我们都知道,AMD 的专有显卡驱动程序仍然需要大量的工作来兼容最新的 GNU/Linux 发行版本,以及所有的 AMD GPU,以及最新的 X.Org 服务端和 Linux 内核版本。 + +目前 AMDGPU-PRO 视频驱动程序只能在 Ubuntu 16.04 LTS、CentOS 6.8/7.3、Red Hat Enterprise Linux 6.8/7.3、SUSE Linux Enterprise Desktop 和 Server 12 SP2 上运行。除了 Ubuntu 16.04 LTS 之外,我们不知道为什么 AMD 为所有这些面向服务器和企业级的操作系统提供支持。 + +我们不相信有 Linux 玩家会在这些系统上面玩游戏。[最新的 AMDGPU-PRO 更新][1]终于支持了HD 7xxx 和 8xxx 系列的 AMD Radeon GPU,但是如果我们不想使用 Ubuntu 16.04 LTS 呢? + +另外我们有 Mesa 3D 图形库,这在大多数发行版上都有。Mesa 图形栈为我们的 AMD GPU 提供了功能强大的开源 Radeon 和 AMDGPU 驱动程序,但是为了享受最好的游戏体验,你还需要拥有最新的 X.Org 服务端和 Linux 内核。 + +并不是所有的 Linux 操作系统都附带最新的 Mesa(13.0)、X.Org服务端(1.19)和 Linux 内核(4.9)版本,它们支持较旧的AMD GPU。有些只有一两种技术,但我们需要它们,内核需要编译 AMD Radeon Southern Islands 和 Sea Island 来支持 AMDGPU 驱动程序工作。 + +我们发现整个情况相当令人沮丧,至少对于一些使用 AMD Radeon 老式一点显卡的玩家。现在,我们发现,使用 AMD Radeon HD 8xxx GPU 的最佳游戏体验只能通过使用 Git 和 Linux 内核 4.10 RC 的 Mesa 17 来实现。 + +所以我们现在请求你 - 如果你找到了游戏的完美的 GNU/Linux 发行版,无论你使用 AMD Radeon 还是 Nvidia GPU,但我们最感兴趣的是那些使用 AMD GPU,使用的是什么发行版,设置是什么,能不能玩最新的游戏后者有体验问题?谢谢! + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml + +作者:[Marius Nestor ][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor +[1]:http://news.softpedia.com/news/amdgpu-pro-16-60-linux-driver-finally-adds-amd-radeon-hd-7xxx-8xxx-support-512280.shtml +[2]:http://news.softpedia.com/editors/browse/marius-nestor +[3]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# +[4]:https://share.flipboard.com/bookmarklet/popout?v=2&title=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml&t=1487038258&utm_campaign=widgets&utm_medium=web&utm_source=flipit&utm_content=news.softpedia.com +[5]:http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml# +[6]:http://twitter.com/intent/tweet?related=softpedia&via=mariusnestor&text=The+Best+Operating+System+for+Linux+Gaming%3A+Which+One+Do+You+Use+and+Why%3F&url=http%3A%2F%2Fnews.softpedia.com%2Fnews%2Fthe-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml +[7]:https://plus.google.com/share?url=http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml +[8]:https://twitter.com/intent/follow?screen_name=mariusnestor From 8514ce404f6cc9b95b5136dfb10ee9a3f603d6f8 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 6 Mar 2017 11:35:33 +0800 Subject: [PATCH 047/190] PUB:20161018 Suspend to Idle.md @beyondworld @jasminepeng --- published/20161018 Suspend to Idle.md | 146 +++++++++++++++++++ translated/tech/20161018 Suspend to Idle.md | 149 -------------------- 2 files changed, 146 insertions(+), 149 deletions(-) create mode 100644 published/20161018 Suspend to Idle.md delete mode 100644 translated/tech/20161018 Suspend to Idle.md diff --git a/published/20161018 Suspend to Idle.md b/published/20161018 Suspend to Idle.md new file mode 100644 index 0000000000..d968c0a764 --- /dev/null +++ b/published/20161018 Suspend to Idle.md @@ -0,0 +1,146 @@ +浅述内核中“挂起到空闲”的实现 +=============== + +### 简介 + +Linux 内核提供了多种睡眠状态,各个状态通过设置系统中的不同部件进入低耗电模式来节约能源。目前总共有四种睡眠状态,分别是:挂起到空闲(suspend to idle)、加电待机(power-on standby(standby))、挂起到内存(suspend to ram)和挂起到磁盘(suspend to disk)。这些状态分别对应 ACPI 的 4 种状态:S0,S1,S3 和 S4。挂起到空闲(suspend to idle)是纯软件实现的,用于将 CPU 维持在尽可能深的 idle 状态。加电待机(power-on standby(standby))则使设备处于低功耗状态,并且关闭所有非引导 CPU。挂起到内存(suspend to ram)就更进一步,关闭所有 CPU 并且设置 RAM 进入自刷新模式。挂起到磁盘(suspend to disk)则是最省功耗的模式,关闭尽可能多的系统,包括关闭内存。然后内存中的内容会被写到硬盘,待唤醒计算机的时候将硬盘中的内容重新恢复到内存中。 + +这篇博文主要介绍挂起到空闲(suspend to idle)的实现。如上所说,它主要通过软件实现。一般平台的挂起过程包括冻结用户空间并将外围设备调至低耗电模式。但是,系统并不是直接关闭和热插拔掉 CPU,而是静静地强制将 CPU 进入空闲(idle)状态。随着外围设备进入了低耗电模式,除了唤醒相关的中断外不应有其他中断产生。唤醒中断包括那些设置用于唤醒系统的计时器(比如 RTC,普通计时器等)、或者电源开关、USB 和其它外围设备等。 + +在冻结过程中,当系统进入空闲状态时会调用一个特殊的 cpu 空闲函数。这个 `enter_freeze()` 函数可以和调用使 cpu 空闲的 `enter()` 函数一样简单,也可以复杂得多。该函数复杂的程度由将 SoC 置为低耗电模式的条件和方法决定。 + +### 先决条件 + +#### `platform_suspend_ops` + +一般情况,为了支持 S2I,系统必须实现 `platform_suspend_ops` 并提供最低限度的挂起支持。这意味着至少要完成 `platform_suspend_ops` 中的 `valid()` 函数。如果挂起到空闲(suspend to idle)和挂起到内存(suspend to ram)都要支持,valid 函数中应使用 `suspend_valid_only_mem`。 + +不过,最近内核增加了对 S2I 的自动支持。Sudeep Holla 提出了一个变更,可以让系统不需要满足 `platform_suspend_ops` 条件也能提供 S2I 支持。这个补丁已经被接收并将合并在 4.9 版本中,该补丁可从这里获取: [https://lkml.org/lkml/2016/8/19/474][1]。 + +如果定义了 `suspend_ops`,那么可以通过查看 `/sys/power/state` 文件得知系统具体支持哪些挂起状态。如下操作: + +``` +# cat /sys/power/state +freeze mem +``` + +这个示例的结果显示该平台支持 S0(挂起到空闲(suspend to idle))和 S3(挂起到内存(suspend to ram))。按 Sudeep 的变更,那些没有实现 `platform_suspend_ops` 的平台将只显示 freeze 状态。 + +#### 唤醒中断 + +一旦系统处于某种睡眠状态,系统必须要接收某个唤醒事件才能恢复系统。这些唤醒事件一般由系统的设备产生。因此一定要确保这些设备驱动使用唤醒中断,并且将自身配置为接收唤醒中断后产生唤醒事件。如果没有正确识别唤醒设备,系统收到中断后会继续保持睡眠状态而不会恢复。 + +一旦设备正确实现了唤醒接口的调用,就可用来生成唤醒事件。请确保 DT 文件正确配置了唤醒源。下面是一个配置唤醒源示例,该文件来自(`arch/arm/boot/dst/am335x-evm.dts`): + +``` +    gpio_keys: volume_keys@0 {__ +               compatible = “gpio-keys”; +               #address-cells = <1>; +               #size-cells = <0>; +               autorepeat; + +               switch@9 { +                       label = “volume-up”; +                       linux,code = <115>; +                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; +                       wakeup-source; +               }; + +               switch@10 { +                       label = “volume-down”; +                       linux,code = <114>; +                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; +                       wakeup-source; +               }; +       }; +``` +如上所示,有两个 gpio 键被配置为唤醒源,在系统挂起期间,其中任何一个键被按下都会产生一个唤醒事件。 + +可替代 DT 文件配置的另一个唤醒源配置就是设备驱动,如果设备驱动自身在代码里面配置了唤醒支持,那么就会使用该默认唤醒配置。 + +### 实施 + +#### 冻结功能 + +如果系统希望能够充分使用挂起到空闲(suspend to idle),那么应该在 CPU 空闲驱动代码中定义 `enter_freeze()` 函数。`enter_freeze()` 与 `enter()` 的函数原型略有不同。因此,不能将 `enter()` 同时指定给 `enter` 和 `enter_freeze`。至少,系统会直接调用 `enter()`。如果没有定义 `enter_freeze()`,系统会挂起,但是不会触发那些只有当 `enter_freeze()` 定义了才会触发的函数,比如 `tick_freeze()` 和 `stop_critical_timing()` 都不会发生。这会导致计时器中断唤醒系统,但不会导致系统恢复,因为系统处理完中断后会继续挂起。 + +在挂起过程中,中断越少越好(最好一个也没有)。 + +下图显示了能耗和时间的对比。图中的两个尖刺分别是挂起和恢复。挂起前后的能耗尖刺是系统退出空闲态进行记录操作,进程调度,计时器处理等。因延迟的缘故,系统进入更深层次空闲状态需要花费一段时间。 + + ![blog-picture-one](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-one-1024x767.png) + +*能耗使用时序图* + +下图为 ftrace 抓取的 4 核 CPU 在系统挂起和恢复操作之前、之中和之后的活动。可以看到,在挂起期间,没有请求或者中断被处理。 + +![blog-picture-2](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-2-1024x577.png) + +*Ftrace 抓取的挂起/恢复活动图* + +#### 空闲状态 + +你必须确定哪个空闲状态支持冻结。在冻结期间,电源相关代码会决定用哪个空闲状态来实现冻结。这个过程是通过在每个空闲状态中查找谁定义了 `enter_freeze()` 来决定的。CPU 空闲驱动代码或者 SoC 挂起相关代码必须确定哪种空闲状态实现冻结操作,并通过给每个 CPU 的可应用空闲状态指定冻结功能来进行配置。 + +例如, Qualcomm 会在平台挂起代码的挂起初始化函数处定义 `enter_freeze` 函数。这个工作是在 CPU 空闲驱动已经初始化后进行,以便所有结构已经定义就位。 + +#### 挂起/恢复相关驱动支持 + +你可能会在第一次成功挂起操作后碰到驱动相关的 bug。很多驱动开发者没有精力完全测试挂起和恢复相关的代码。你甚至可能会发现挂起操作并没有多少工作可做,因为 `pm_runtime` 已经做了你要做的挂起相关的一切工作。由于用户空间已经被冻结,设备此时已经处于休眠状态并且 `pm_runtime` 已经被禁止。 + +### 测试相关 + +测试挂起到空闲(suspend to idle)可以手动进行,也可以使用脚本/进程等实现自动挂起、自动睡眠,或者使用像 Android 中的 `wakelock` 来让系统挂起。如果手动测试,下面的操作会将系统冻结。 + +``` +/ # echo freeze > /sys/power/state +[  142.580832] PM: Syncing filesystems … done. +[  142.583977] Freezing user space processes … (elapsed 0.001 seconds) done. +[  142.591164] Double checking all user space processes after OOM killer disable… (elapsed 0.000 seconds) +[  142.600444] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done._ +_[  142.608073] Suspending console(s) (use no_console_suspend to debug) +[  142.708787] mmc1: Reset 0x1 never completed. +[  142.710608] msm_otg 78d9000.phy: USB in low power mode +[  142.711379] PM: suspend of devices complete after 102.883 msecs +[  142.712162] PM: late suspend of devices complete after 0.773 msecs +[  142.712607] PM: noirq suspend of devices complete after 0.438 msecs +< system suspended > +…. +< wake irq triggered > +[  147.700522] PM: noirq resume of devices complete after 0.216 msecs +[  147.701004] PM: early resume of devices complete after 0.353 msecs +[  147.701636] msm_otg 78d9000.phy: USB exited from low power mode +[  147.704492] PM: resume of devices complete after 3.479 msecs +[  147.835599] Restarting tasks … done. +/ # +``` + +在上面的例子中,需要注意 MMC 驱动的操作占了 102.883ms 中的 100ms。有些设备驱动在挂起的时候有很多工作要做,比如将数据刷出到硬盘,或者其他耗时的操作等。 + +如果系统定义了冻结(freeze),那么系统将尝试挂起操作,如果没有冻结功能,那么你会看到下面的提示: + +``` +/ # echo freeze > /sys/power/state  +sh: write error: Invalid argument +/ # +``` + +### 未来的发展 + +目前在 ARM 平台上的挂起到空闲(suspend to idle)有两方面的工作需要做。第一方面工作在前面 `platform_suspend_ops` 小节中提到过,是总允许接受冻结状态以及合并到 4.9 版本内核中的工作。另一方面工作是冻结功能的支持。 + +如果你希望设备有更好的响应及表现,那么应该继续完善冻结功能的实现。然而,由于很多 SoC 会使用 ARM 的 CPU 空闲驱动,这使得 ARM 的 CPU 空闲驱动完善它自己的通用冻结功能的工作更有意义了。而事实上,ARM 正在尝试添加此通用支持。如果 SoC 供应商希望实现他们自己的 CPU 空闲驱动或者需要在进入更深层次的冻结休眠状态时提供额外的支持,那么只有实现自己的冻结功能。 + + +-------------------------------------------------------------------------------- + +via: http://www.linaro.org/blog/suspend-to-idle/ + +作者:[Andy Gross][a] +译者:[beyondworld](https://github.com/beyondworld) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linaro.org/author/andygross/ +[1]:https://lkml.org/lkml/2016/8/19/474 diff --git a/translated/tech/20161018 Suspend to Idle.md b/translated/tech/20161018 Suspend to Idle.md deleted file mode 100644 index 31ffa5be8e..0000000000 --- a/translated/tech/20161018 Suspend to Idle.md +++ /dev/null @@ -1,149 +0,0 @@ - -# Suspend to Idle - -### 简介 - -Linux 内核提供了多种睡眠状态,各个状态通过设置系统中的不同部件进入低耗电模式来节约能源。目前总共有四种状态,分别是:suspend to idle,power-on standby(standby),suspend to ram 和 suspend to disk。这些状态分别对应 ACPI 的 4 种状态:S0,S1,S3 和 S4。suspend to idle 是纯软件实现的,用于将 CPU 维持在尽可能深的 idle 状态。powder-on standby 则使设备处于低功耗状态,并且关闭所有 non-boot CPU。suspend to ram 就更进一步,关闭所有CPU 并且设置 RAM 进入自刷新模式。suspend to disk 则是最省功耗的模式,关闭尽可能多的系统,包括关闭内存。然后内存中的内容会被写到硬盘,待唤醒计算机的时候将硬盘中的内容重新恢复到内存中。 - -这篇博文主要介绍 suspend to idle 的实现。如上所说,suspend to idle 主要通过软件实现。一般平台的挂起过程包括冻结用户空间并将外围设备调至低耗电模式。但是,系统并不是直接关闭和拔掉 cpu,而是静静地强制将 CPU 进入空闲状态。随着外围设备进入了低耗电模式,除了唤醒相关的中断外不应有其他中断产生。唤醒中断包括那些设置用于唤醒系统的计时器(比如 RTC,普通计时器等)、或者电源开关、USB 和其它外围设备等。 - -在冻结过程中,当系统进入空闲状态时会调用一个特殊的 cpu 空闲函数。这个 enter_freeze() 函数可以和调用使 cpu 空闲的 enter() 函数一样简单,也可以复杂得多。该函数复杂的程度由将 SoCs 置为低耗电模式的条件和方法决定。 - -## 先决条件 - -### platform_suspend_ops - -一般情况,为了支持 S2I,系统必须实现 platform_suspend_ops 并提供最低限度的挂起支持。这意味着至少要完成 platform_suspend_ops 中的 valid() 函数。如果 suspend to idle 和 suspend to ram 都要支持,valid 函数中应使用 suspend_valid_only_men。 - -不过,最近内核开始自动支持 S2I。Sudeep Holla 提出了一个变更,系统不需满足 platform_suspend_ops 条件也能提供 S2I 支持。这个补丁已经被接收并将合并在 4.9 版本中,该补丁可从这里获取: [https://lkml.org/lkml/2016/8/19/474][1]。 - -如果定义了 suspend_ops,那么可以通过查看 /sys/power/state 文件得知系统具体支持哪些挂起状态。如下操作: - -``` -# cat /sys/power/state -``` - -freeze mem_ - -这个示例的结果显示该平台支持 S0(suspend to idle)和 S3(suspend to ram)。按 Sudeep 的变更,那些没有实现 platform_suspend_ops 的平台只显示 freeze 状态。 - -### 唤醒中断 - -一旦系统处于某种睡眠状态,系统必须要接收某个唤醒事件才能恢复系统。这些唤醒事件一般由系统的设备产生。因此一定要确保这些设备驱动使用唤醒中断,并且将自身配置为接收唤醒中断后产生唤醒事件。如果没有正确识别唤醒设备,系统收到中断后会继续保持睡眠状态而不会恢复。 - -一旦设备正确实现了唤醒接口的调用,就可用来生成唤醒事件。请确保 DT 文件正确配置了唤醒源。下面是一个配置唤醒源示例,该文件来自(arch/arm/boot/dst/am335x-evm.dts): - -``` -    gpio_keys: volume_keys@0 {__ -               compatible = “gpio-keys”; -               #address-cells = <1>; -               #size-cells = <0>; -               autorepeat; - -               switch@9 { -                       label = “volume-up”; -                       linux,code = <115>; -                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; -                       wakeup-source; -               }; - -               switch@10 { -                       label = “volume-down”; -                       linux,code = <114>; -                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; -                       wakeup-source; -               }; -       }; -``` -如上所示,有两个 gpio 键被配置为唤醒源,在系统挂起期间,其中任何一个键被按下都会产生一个唤醒事件。 - -可替代 DT 文件配置的另一个唤醒源配置就是设备驱动,如果设备驱动自身在代码里面配置了唤醒支持,那么就会使用该默认唤醒配置。 - -## 实施 - -### freeze 功能 - -如果系统希望能够充分使用 suspend to idle,那么应该在 cpu 空闲驱动代码中定义 enter_freeze() 函数。enter_freeze() 与enter() 的函数原型略有不同。因此,不能将 enter() 同时指定给 enter 和 enter_freeze。至少,系统会直接调用 enter()。如果没有定义 enter_freeze(),系统会挂起,但是不会触发那些只有当 enter_freeze() 定义了才会触发的函数,比如 tick_freeze() 和 stop_critical_timing() 都不会发生。这会导致计时器中断唤醒系统,但不会导致系统恢复,因为系统处理完中断后会继续挂起。 - -在挂起过程中,中断越少越好(最好一个也没有)。 - -下图显示了能耗和时间的对比。图中的两个尖刺分别是挂起和恢复。挂起前后的能耗尖刺是系统退出空闲态进行记录操作,进程调度,计时器处理等。因延迟的缘故,系统进入更深层次空闲状态需要花费一段时间。 - - ![blog-picture-one](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-one-1024x767.png) - -*能耗使用时序图* - -下图为 ftrace 抓取的 4 核 CPU 在系统挂起和恢复操作之前,之中和之后的活动。可以看到,在挂起期间,没有请求或者中断被处理。 - - ![blog-picture-2](http://www.linaro.org/wp-content/uploads/2016/10/blog-picture-2-1024x577.png) - -*Ftrace 抓取的 挂起/恢复 活动图* - -### 空闲状态 - -你必须确定哪个空闲状态支持冻结。在冻结期间,电源相关代码会决定用哪个空闲状态来实现冻结。这个过程是通过在每个空闲状态中查找谁定义了 enter_freeze() 来决定的。cpu 空闲驱动代码或者 SoC 挂起相关代码必须确定哪种空闲状态实现冻结操作,并通过给每个 CPU 的可应用空闲状态指定冻结功能来进行配置。 - -例如, Qualcomm 会在平台挂起代码的挂起初始化函数处定义 enter_freeze 函数。这个工作是在 cpu 空闲驱动已经初始化后进行,以便所有结构已经定义就位。 - -### 挂起/恢复相关驱动支持 - -你可能会在第一次成功挂起操作后碰到驱动相关的 bug。很多驱动开发者没有精力完全测试挂起和恢复相关的代码。你甚至可能会发现挂起操作并没有多少工作可做,因为 pm_runtime 已经做了你要做的挂起相关的一切工作。由于用户空间已经被冻结,设备此时已经处于休眠状态并且 pm_runtime 已经被禁止。 - -## 测试相关 - -测试 suspend to idle 可以手动进行,也可以使用脚本/进程等实现自动挂起、自动睡眠,或者使用像 Android 中的 wakelock 来让系统挂起。如果手动测试,下面的操作会将系统冻结。 - -``` -/ # echo freeze > /sys/power/state -[  142.580832] PM: Syncing filesystems … done. -[  142.583977] Freezing user space processes … (elapsed 0.001 seconds) done. -[  142.591164] Double checking all user space processes after OOM killer disable… (elapsed 0.000 seconds) -[  142.600444] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done._ -_[  142.608073] Suspending console(s) (use no_console_suspend to debug) -[  142.708787] mmc1: Reset 0x1 never completed. -[  142.710608] msm_otg 78d9000.phy: USB in low power mode -[  142.711379] PM: suspend of devices complete after 102.883 msecs -[  142.712162] PM: late suspend of devices complete after 0.773 msecs -[  142.712607] PM: noirq suspend of devices complete after 0.438 msecs -< system suspended > -…. -< wake irq triggered > -[  147.700522] PM: noirq resume of devices complete after 0.216 msecs -[  147.701004] PM: early resume of devices complete after 0.353 msecs -[  147.701636] msm_otg 78d9000.phy: USB exited from low power mode -[  147.704492] PM: resume of devices complete after 3.479 msecs -[  147.835599] Restarting tasks … done. -/ # -``` - -在上面的例子中,需要注意 MMC 驱动的操作占了 102.883ms 中的 100ms。有些设备驱动在挂起的时候有很多工作要做,比如将数据刷出到硬盘,或者其他耗时的操作等。 - -如果系统定义了 freeze,那么系统将尝试挂起操作,如果没有 freeze 功能,那么你会看到下面的提示: - -``` -/ # echo freeze > /sys/power/state  -sh: write error: Invalid argument -/ # -``` - -### 未来的发展 - -目前在 ARM 平台上的 suspend to idle 有两方面的工作需要做。第一方面工作在前面 platform_suspend_ops 小节中提到过,是总允许接受冻结状态以及合并到 4.9 版本内核中的工作。另一方面工作是 freeze_function 支持。 - -如果你希望设备有更好的响应及表现,那么应该继续完善 freeze_function 的实现。然而,由于很多 SoC 会使用 ARM 的 cpu 空闲驱动,这使得 ARM 的 cpu 空闲驱动完善它自己的通用冻结功能的工作更有意义了。而事实上,ARM 正在尝试添加此通用支持。如果 SoC 供应商希望实现他们自己的 cpu 空闲驱动或者需要在进入更深层次的冻结休眠状态时提供额外的支持,那么只有实现自己的冻结功能。 - - --------------------------------------------------------------------------------- - -via: http://www.linaro.org/blog/suspend-to-idle/ - -作者:[Andy Gross][a] - -译者:[beyondworld](https://github.com/beyondworld) - -校对:[jasminepeng](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linaro.org/author/andygross/ -[1]:https://lkml.org/lkml/2016/8/19/474 From d3f8a1be19ca0f236582d6c2cd2844f2619a9cd1 Mon Sep 17 00:00:00 2001 From: wxy Date: Mon, 6 Mar 2017 12:51:46 +0800 Subject: [PATCH 048/190] =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- published/20161018 Suspend to Idle.md | 68 +++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/published/20161018 Suspend to Idle.md b/published/20161018 Suspend to Idle.md index d968c0a764..62a9f9b81c 100644 --- a/published/20161018 Suspend to Idle.md +++ b/published/20161018 Suspend to Idle.md @@ -33,26 +33,26 @@ freeze mem 一旦设备正确实现了唤醒接口的调用,就可用来生成唤醒事件。请确保 DT 文件正确配置了唤醒源。下面是一个配置唤醒源示例,该文件来自(`arch/arm/boot/dst/am335x-evm.dts`): ``` -    gpio_keys: volume_keys@0 {__ -               compatible = “gpio-keys”; -               #address-cells = <1>; -               #size-cells = <0>; -               autorepeat; + gpio_keys: volume_keys@0 { + compatible = “gpio-keys”; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; -               switch@9 { -                       label = “volume-up”; -                       linux,code = <115>; -                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; -                       wakeup-source; -               }; + switch@9 { + label = “volume-up”; + linux,code = <115>; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + wakeup-source; + }; -               switch@10 { -                       label = “volume-down”; -                       linux,code = <114>; -                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; -                       wakeup-source; -               }; -       }; + switch@10 { + label = “volume-down”; + linux,code = <114>; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + wakeup-source; + }; + }; ``` 如上所示,有两个 gpio 键被配置为唤醒源,在系统挂起期间,其中任何一个键被按下都会产生一个唤醒事件。 @@ -94,24 +94,24 @@ freeze mem ``` / # echo freeze > /sys/power/state -[  142.580832] PM: Syncing filesystems … done. -[  142.583977] Freezing user space processes … (elapsed 0.001 seconds) done. -[  142.591164] Double checking all user space processes after OOM killer disable… (elapsed 0.000 seconds) -[  142.600444] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done._ -_[  142.608073] Suspending console(s) (use no_console_suspend to debug) -[  142.708787] mmc1: Reset 0x1 never completed. -[  142.710608] msm_otg 78d9000.phy: USB in low power mode -[  142.711379] PM: suspend of devices complete after 102.883 msecs -[  142.712162] PM: late suspend of devices complete after 0.773 msecs -[  142.712607] PM: noirq suspend of devices complete after 0.438 msecs +[ 142.580832] PM: Syncing filesystems … done. +[ 142.583977] Freezing user space processes … (elapsed 0.001 seconds) done. +[ 142.591164] Double checking all user space processes after OOM killer disable… (elapsed 0.000 seconds) +[ 142.600444] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done. +[ 142.608073] Suspending console(s) (use no_console_suspend to debug) +[ 142.708787] mmc1: Reset 0x1 never completed. +[ 142.710608] msm_otg 78d9000.phy: USB in low power mode +[ 142.711379] PM: suspend of devices complete after 102.883 msecs +[ 142.712162] PM: late suspend of devices complete after 0.773 msecs +[ 142.712607] PM: noirq suspend of devices complete after 0.438 msecs < system suspended > …. < wake irq triggered > -[  147.700522] PM: noirq resume of devices complete after 0.216 msecs -[  147.701004] PM: early resume of devices complete after 0.353 msecs -[  147.701636] msm_otg 78d9000.phy: USB exited from low power mode -[  147.704492] PM: resume of devices complete after 3.479 msecs -[  147.835599] Restarting tasks … done. +[ 147.700522] PM: noirq resume of devices complete after 0.216 msecs +[ 147.701004] PM: early resume of devices complete after 0.353 msecs +[ 147.701636] msm_otg 78d9000.phy: USB exited from low power mode +[ 147.704492] PM: resume of devices complete after 3.479 msecs +[ 147.835599] Restarting tasks … done. / # ``` @@ -120,7 +120,7 @@ _[  142.608073] Suspending console(s) (use no_console_suspend to debug) 如果系统定义了冻结(freeze),那么系统将尝试挂起操作,如果没有冻结功能,那么你会看到下面的提示: ``` -/ # echo freeze > /sys/power/state  +/ # echo freeze > /sys/power/state sh: write error: Invalid argument / # ``` From d11441d5978d85c0a930771deccf664187f70e64 Mon Sep 17 00:00:00 2001 From: zhb127 <1224680008@qq.com> Date: Mon, 6 Mar 2017 13:52:43 +0800 Subject: [PATCH 049/190] Update 20170217 Understanding the difference between sudo and su.md --- .../20170217 Understanding the difference between sudo and su.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20170217 Understanding the difference between sudo and su.md b/sources/tech/20170217 Understanding the difference between sudo and su.md index bebe069551..c62dd17bc0 100644 --- a/sources/tech/20170217 Understanding the difference between sudo and su.md +++ b/sources/tech/20170217 Understanding the difference between sudo and su.md @@ -1,3 +1,4 @@ +申请翻译 Understanding the difference between sudo and su ============================================================ From a06690a3a5145c1f1f45286b006aed511600eb7f Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Mon, 6 Mar 2017 17:57:38 +0800 Subject: [PATCH 050/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- ...s guide to understanding sudo on Ubuntu.md | 122 ++++++++---------- 1 file changed, 51 insertions(+), 71 deletions(-) diff --git a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md index 2776006a92..69ea90c302 100644 --- a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md +++ b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md @@ -1,43 +1,42 @@ -一份关于理解 Ubuntu 上 sudo 的初学者指导 +理解 Ubuntu 上 sudo 的初学者指南 ============================================================ -### 在这页面上 +### 本文内容 -1. [什么是 sudo?][4] -2. [任何用户都能用 sudo 吗?][5] -3. [什么是一个 sudo 会话?][6] -4. [sudo 密码][7] -5. [一些重要的 sudo 命令行参数][8] - 1. [ -k 参数][1] - 2. [-s 参数][2] - 3. [-i 参数][3] -6. [总结][9] +*  [什么是 sudo?][4] +* [任何用户都能用 sudo 吗?][5] +*  [什么是一个 sudo 会话?][6] +* [sudo 密码][7] +* [一些重要的 sudo 命令行参数][8] + * [-k 参数][1] + * [-s 参数][2] + * [-i 参数][3] +* [总结][9] -曾经在你使用 Linux 命令行时提示“拒绝访问”的错误?这可能是你正在尝试做一个需要根权限的命令。例如,下面的截图展示了当我正在尝试复制一个二进制文件到一个系统目录时显示的错误。 +你在使用 Linux 命令行时曾经得到过“拒绝访问”的错误提示吗?这可能是因为你正在尝试执行一个需要 root 权限的操作。例如,下面的截图展示了当我尝试复制一个二进制文件到一个系统目录时产生的错误。 [ ![shell 的拒绝访问](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) ][11] -所以该怎么解决这个错误?很简单,使用 ** sudo ** 命令。 +那么该怎么解决这个错误?很简单,使用 **sudo** 命令。 [ ![用 sudo 运行命令](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) ][12] -正在运行命令的用户被提示需要他们的登录密码。一旦输入了正确的密码,操作将会成功执行。 +运行此命令的用户被提示输入他们的登录密码。一旦输入了正确的密码,操作将会成功执行。 -毫无疑问,sudo 是任何在 Linux 上使用命令行的人所必须知道的命令。但是,为了更负责有效地使用命令,你还是得知道一些相关(深入)的细节。这正是我们将会在这篇文章中讨论的。 - -但是在我们继续之前,值得提一下的是,这篇文章所提到的所有命令指示都已经在 Ubuntu 14.04LTS 下的 4.3.11版 Bash 通过测试。 +毫无疑问,sudo 是任何在 Linux 上使用命令行的人都必须知道的命令。但是,为了更负责更有效地使用该命令,你还是要知道一些相关(深入)的细节。这正是我们将会在这篇文章中讨论的。 +*在我们继续之前,值得提一下的是,这篇文章所提到的所有命令指示都已经在 Ubuntu 14.04LTS 下的 4.3.11版 Bash 通过测试。* ### 什么是 sudo -正如你们大部分人所知道的,sudo 是用来执行需要提升权限(通常是作为 root 用户)的命令。在这篇文章之前的简介部分已经讨论过这样的一个例子。然而,如果你想的话,你能用 sudo 运行一些其他(非 root )用户的命令。 +正如你们大部分人所知道的,sudo 用来执行需要提升权限(通常是作为 root 用户)的命令。在这篇文章之前的简介部分已经讨论过这样的一个例子。然而,如果你想的话,你能用 sudo 作为其他(非 root )用户运行命令。 -这点是由工具提供的 -u 命令行选项所实现的。举个例子,如下面的例子所展示的那样,我(himanshu)尝试留一个文件在其他用户(howtoforge)的家目录中,但是得到一个“访问拒绝”的错误。然后我尝试加上“sudo -u howtoforge”后用同样的“mv”命令,命令成功执行了: +这是由工具提供的 -u 命令行选项所实现的。举个例子,如下例所展示的那样,我(himanshu)尝试将一个在其他用户(howtoforge)的 Home 目录中的文件重命名,但是得到一个“访问拒绝”的错误。然后我加上“sudo -u howtoforge”后用同样的“mv”命令,命令成功执行了: [ ![什么是 sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) @@ -45,69 +44,67 @@ ### 任何人都能用 sudo 吗? -不,为了让一个用户能使用 sudo ,跟用户相关的信息应该在 /etc/sudoers 里。下述摘自 Ubuntu 网页的段落能讲得更清楚: +不是。一个用户要能使用 sudo ,应该在 /etc/sudoers 文件里有一条跟该用户相关的信息。下述摘自 Ubuntu 网站的一段能讲得更清楚: ``` -/etc/sudoers 文件控制了谁能以何种用户的身份在何种机器上运行何种命令,同样控制了特殊的事件例如对于特定的命令你是否需要输入密码。这个文件由 aliases (基本变量)和用户识别符(控制谁能运行什么命令)组成。 +/etc/sudoers 文件控制了谁能以何种用户的身份在何种机器上运行何种命令,还可以控制特别的情况,例如对于特定的命令是否需要输入密码。这个文件由别名aliases(基本变量)和用户标识user specifications(控制谁能运行什么命令)组成。 ``` -如果你正在使用 Ubuntu,很容易去确认一个用户能运行 sudo 命令:你所需要做的就是把账户改成管理员。这能直接到 系统设置->用户账户里完成。 +如果你正在使用 Ubuntu,让一个用户能运行 sudo 命令很容易:你所需要做的就是把账户类型改成“管理员”administrator。这可直接在 系统设置System Settings -> 用户账户 User Accounts里完成。 [ ![sudo 用户](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) ][14] -解锁窗口 - +解锁窗口: [ ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) ][15] -然后选择你想改变用户类型的用户,然后将类型改成“管理员” - +然后选择你想改变用户类型的用户,然后将类型改成“管理员”。 [ ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) ][16] -然而,如果你不使用 Ubuntu,或者你的发行版没有提供这个特性,你能手动编辑 /etc/sudoers 文件来实现改变。你要在文件添加这样的一行: +然而,如果你不使用 Ubuntu,或者你的发行版没有提供这个特性,你可以手动编辑 /etc/sudoers 文件来实现此改变。要在文件中添加这样的一行: ``` [user] ALL=(ALL:ALL) ALL ``` -无需赘言,[user] 应该被你想提升 sudo 权限的用户的用户名所代替。在这里值得提到的一件重要的事情是,官方建议的编辑该文件的方式是通过 **visudo** 命令——你需要做的就是运行下述命令: - +无需赘言,[user] 应该被你想提升 sudo 权限的用户的用户名所代替。在这里值得提到的一件重要的事情是,官方建议通过 **visudo** 命令编辑该文件 —— 你需要做的就是运行下述命令: +``` sudo visudo +``` 为了说清究竟是怎么一回事,这里有段从 visudo 手册里的摘要: ``` -visudo 以安全的模式编辑 sudoers 文件。visudo 锁定 sudoers 文件以防重复同时的编辑,提供基本的检查(sanity checks)和语法错误检查。如果 sudoers 文件现在正在被编辑,你将会收到一个信息提示稍后再试。 +visudo 以安全的模式编辑 sudoers 文件。visudo 锁定 sudoers 文件以防多个编辑同时进行,提供基本的检查(sanity checks)和语法错误检查。如果 sudoers 文件现在正在被编辑,你将会收到一个信息提示稍后再试。 ``` -关于 visudo 的更多信息,前往[这里][17] - +关于 visudo 的更多信息,前往[这里][17]。 ### 什么是 sudo 会话 -如果你经常使用 sudo 命令,我很确定你注意过当你成功输入一次密码后,你能不用密码提升权限地运行几次 sudo 命令。但是一段时间后,sudo 命令又再次要求你的密码。 +如果你经常使用 sudo 命令,你肯定注意到过当你成功输入一次密码后,可以不用输入密码再运行几次 sudo 命令。但是一段时间后,sudo 命令会再次要求你的密码。 +这种现象跟运行 sudo 命令数目无关,跟时间有关。是的,sudo 默认在输入一次密码后 15 分钟内不会再次要求密码。15 分钟后,你会再次被要求输入密码。 -这种现象跟运行 sudo 命令数目无关,跟时间有关。是的,sudo 默认在输入一次密码后 15 分钟内不会再次要求密码。15 分钟后,你会再次被要求输入密码提升权限。 - - -然而,如果你想的话,你能改变这种现象。用以下命令打开 /etc/sudoers 文件 +然而,如果你想的话,你能改变这种现象。用以下命令打开 /etc/sudoers 文件: +``` sudo visudo +``` -接下来的一行显示: +找到这一行: ``` Defaults env_reset @@ -119,33 +116,27 @@ Defaults env_reset 然后在这行最后添加以下变量(下面用黑体字强调): - ``` -Defaults env_reset,timestamp_timeout=[new-value] +Defaults env_reset,**timestamp_timeout=[new-value]** ``` -[new-value] 应该用你想要 sudo 会话持续时间数替换。例如,我用数值 40。 +[new-value] 为想要 sudo 会话持续的时间数。例如,用数值 40。 [ ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) ][19] -万一你想每次使用 sudo 命令时都要求输入密码提升权限,这样你能把这个变量赋值为 0 。想要 sudo 会话永远不过时,你得赋值为 -1。 - - -注意数值为 -1 的 timestamp_timeout 是强烈不推荐的。 +如果你希望每次使用 sudo 命令时都要求输入密码,你可以把这个变量赋值为 0 。想要 sudo 会话永远不过时,应赋值为 -1。 +注意将 timestamp_timeout 的值赋为 “-1” 是强烈不推荐的。 ### sudo 密码 - -正如你可能观察过的,当 sudo 要求输入密码然后你开始输入时,不会显示任何东西——甚至连标准的星号都没有。通常这不是什么大问题,一些用户无论什么原因想要显示星号、 - +你可能注意过,当 sudo 要求输入密码然后你开始输入时,不会显示任何东西 —— 甚至连常规的星号都没有。虽然这不是什么大问题,不过一些用户就是希望显示星号。 好消息是那有可能也很容易做到。所有你需要做的就是在 /etc/sudoers 文件里将下述的行: - ``` Defaults env_reset ``` @@ -156,8 +147,7 @@ Defaults env_reset Defaults env_reset,pwfeedback ``` -然后保存文件 - +然后保存文件。 现在,无论什么时候输入 sudo 密码,星号都会显示。 @@ -169,18 +159,13 @@ Defaults env_reset,pwfeedback ## 一些重要的 sudo 命令行参数 -除了 -u命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 sudo 命令行参数值得注意。在这部分,我们将会讨论其中一些。 - - +除了 -u 命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 sudo 命令行参数值得注意。在这部分,我们将会讨论其中一些。 ### -k 参数 -### The -k option -考虑下一种情况:当你刚输入密码后运行了几个 sudo 驱动的命令时。现在,正如你已经知道的,sudo 会话默认保持 15 分钟。假设在这会话期间,你得给你终端一些权限,但你不想让他们使用 sudo ,你将会怎么做? - - -还好,有 -k 命令行参数允许用户取消 sudo 权限。这是 sudo 帮助页面(man page)关于这一点所讲的: +考虑下这种情况:输入密码后你刚刚运行了几个 sudo 驱动的命令。现在,如你所知,sudo 会话默认保持 15 分钟。假设在这会话期间,你得给你终端一些权限,但你不想让他们使用 sudo ,你将会怎么做? +还好,有 -k 命令行参数允许用户取消 sudo 权限。这是 sudo 帮助页面(man page)对此的解释: ``` -k, --reset-timestamp @@ -193,11 +178,9 @@ Defaults env_reset,pwfeedback ### -s 参数 +有时你的工作要求你运行一堆需要 root 权限的命令,你不想每次都输入密码。你也不想通过改变 /etc/sudoers 文件调整 sudo 会话的过期时限。 -或许有几次当你的工作要求你运行一堆需要 root 权限的命令时,你不想每次都输入密码。你也不想通过改变 /etc/sudoers 文件调整 sudo 会话的过期时限。 - -这种情况下,你可以用 sudo 的 -s 参数。这是 sudo 帮助页面(man page)所解释的: - +这种情况下,你可以用 sudo 的 -s 参数。这是 sudo 帮助页面(man page)对此的解释: ``` -s, --shell @@ -208,22 +191,19 @@ Defaults env_reset,pwfeedback 所以,基本地,这命令参数做的是: - -* 启动一个新的 shell ,对于哪一个 shell 来说,SHELL 赋值变量都有引用。万一 $SHELL 是空的,将会用 /etc/passwd 定义的内容。 +*   启动一个新的 shell - 至于是哪一个 shell,参照 SHELL 环境变量赋值。如果 $SHELL 是空的,将会用 /etc/passwd 中定义的 shell。 * 如果你用 -s 参数传递了一个命令名(例如 sudo -s whoami),实际执行的是 sudo /bin/bash -c whoami。 -* 如果你尝试执行其他命令(意思是 你只是正在尝试运行 sudo -s),你将会得到一个有有 root 权限的交互式的 shell。 +*   如果你没有尝试执行其他命令(也就是说,你只是要运行 sudo -s),你将会得到一个有 root 权限的交互式的 shell。 -这里值得记住的是 -s 命令行参数给你一个有 root 权限的 shell,但是你没有 root 环境——你的 .bashrc 决定的。这意思是,例如在一个用 sudo -s 运行的新 shell 里,执行 whoami 命令仍会返回你的用户名,而非 root 。 +请记住,-s 命令行参数给你一个有 root 权限的 shell,但不是 root 环境 —— 你的 .bashrc 决定的。这意思是,例如在一个用 sudo -s 运行的新 shell 里,执行 whoami 命令仍会返回你的用户名,而非 root 。 ### -i 参数 --i 参数跟我们讨论过的 -s 参数相像。然而,还是有点区别。一个重要的区别是 -i 也给了你 root 环境,意味着你的(用户的).bashrc 被忽略。这就像没有明确指明用 root 登录也能称为成为 root 。此外,你也不用输入 root 用户密码。 +-i 参数跟我们讨论过的 -s 参数相像。然而,还是有点区别。一个重要的区别是 -i 也给了你 root 环境,意味着你的(用户的).bashrc 被忽略。这就像没有明确指明用 root 登录也能成为 root 。此外,你也不用输入 root 用户密码。 -** 重要 **:请注意有也能让你切换用户的 **su** 命令(默认的是切换到 root ) 这个命令需要你输入 root 密码。为了避免这一点,你也要用 sudo 执行(‘ sudo su’),这样你只需要输入你的登录密码。然而,su 和 sudo su 有隐含的区别 ——了解他们和跟相应的 sudo -i 区别,来[这里][10] -**Important**: Please note that there exists a **su** command which also - +** 重要 **:请注意 **su** 命令也能让你切换用户(默认切换到 root )。这个命令需要你输入 root 密码。为了避免这一点,你可以使用 sudo 执行它(‘sudo su’),这样你只需要输入你的登录密码。然而,su 和 sudo su 有隐含的区别 —— 要了解它们,以及它们和 sudo -i 的区别,请看[这里][10] 。 ### 总结 From 381e7d7e72dc128c4659f57b64b17baddc15e017 Mon Sep 17 00:00:00 2001 From: GHLandy Date: Mon, 6 Mar 2017 18:51:56 +0800 Subject: [PATCH 051/190] [Translated] 20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md --- ...H Connections to Simplify Remote Access.md | 168 ----------------- ...H Connections to Simplify Remote Access.md | 172 ++++++++++++++++++ 2 files changed, 172 insertions(+), 168 deletions(-) delete mode 100644 sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md create mode 100644 translated/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md diff --git a/sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md b/sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md deleted file mode 100644 index f9316f8a1b..0000000000 --- a/sources/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md +++ /dev/null @@ -1,168 +0,0 @@ -GHLandy Translating - -How to Configure Custom SSH Connections to Simplify Remote Access -============================================================ - -SSH (SSH client) is a program for remotely accessing a machine, it enables a user to [execute commands on a remote host][2]. It is one of the most recommended method for logging in to a remote host, since it is designed to provide secure encrypted communications between two untrusted hosts over an insecure network. - -SSH uses both a system-wide as well as a user-specific (custom) configuration file. In this tutorial, we will explain how to create a custom ssh configuration file and use certain options to connect to remote hosts. - -#### Requirements: - -1. You must have installed [OpenSSH client on your Linux desktop][1]. -2. Understand the common options used for remote connections via ssh. - -#### SSH Client Config Files - -Below are the locations of the ssh client configuration files: - -1. `/etc/ssh/ssh_config` – this is the default, system-wide configuration file. It contains settings that apply to all users of ssh client machine. -2. `~/.ssh/config` or `$HOME/.ssh/config` – is the user-specific/custom configuration file. It has configurations that apply to a specific user. It therefore overrides default settings in the system-wide config file. This is the file we will create and use. - -By default, users are authenticated in ssh using passwords, however, you can setup [ssh passwordless login using ssh keygen][3] in 5 simple steps. - -Note: In case the directory `~/.ssh` does not exist on your desktop system, create it with the following permissions. - -``` -$ mkdir -p ~/.ssh -$ chmod 0700 ~/.ssh -``` - -The chmod command above implies that only the user can have read, write and execute permissions on the directory as required by ssh settings. - -### How To Create User Specific SSH Configuration File - -This file is usually not created by default, so you need to create it with the read/write permissions for only the user. - -``` -$ touch ~/.ssh/config -$ chmod 0700 ~/.ssh/config -``` - -The above file contains sections defined by hosts specifications, and a section is only applied to hosts that match one of the patterns set in the specification. - -The conventional format of `~/.ssh/config` is as follows, and all empty lines as well as lines starting with `‘#’` are considered as comments: - -``` -Host host1 -ssh_option1=value1 -ssh_option2=value1 value2 -ssh_option3=value1 -Host host2 -ssh_option1=value1 -ssh_option2=value1 value2 -Host * -ssh_option1=value1 -ssh_option2=value1 value2 -``` - -From the format above: - -1. Host host1 – is a header definition for host1, this is where a host specification starts and it ends with the next header definition, Host host2 making a section. -2. host1, host2 are simply host aliases to use on the command line, they are not the actual hostnames of the remote hosts. -3. The configuration options such as ssh_option1=value1, ssh_option2=value1 value2 apply to a matched host and should be indented for well organized formatting. -4. For an option such as ssh_option2=value1 value2, the value value1 is considered first, then value2. -5. The header definition Host * (where `*` is a pattern – wildcard that matches zero or more characters) will match zero or more hosts. - -Still considering the format above, this is how ssh reads the config file. If you execute a ssh command to remotely access host1 like so: - -``` -$ ssh host1 -``` - -The above ssh command will does the following things: - -1. match the host alias host1 in the config file and applies the options set under the definition header, Host host1. -2. then moves to the next host section, Host host2 and finds that the name provided on the command line doesn’t match, so no options are used from here. -3. It proceeds to the last section, Host *, which matches all hosts. Here, it applies all the options in this section to the host connection. But it can not override any values of options that where already used in the previous section(s). -4. The same applies to host2. - -### How To Use User Specific SSH Configuration File - -Once you have understood how the ssh client config file works, you can create it as follows. Remember to use options and values (host aliases, port numbers, usernames and so on) applicable to your server environment. - -Open the config file with your favorite editor: - -``` -$ vi ~/.ssh/config -``` - -And define the necessary sections: - -``` -Host fedora25 -HostName 192.168.56.15 -Port 22 -ForwardX11 no -Host centos7 -HostName 192.168.56.10 -Port 22 -ForwardX11 no -Host ubuntu -HostName 192.168.56.5 -Port 2222 -ForwardX11 yes -Host * -User tecmint -IdentityFile ~/.ssh/id_rsa -Protocol 2 -Compression yes -ServerAliveInterval 60 -ServerAliveCountMax 20 -LogLevel INFO -``` - -A detailed explanation of the above ssh configuration options. - -1. HostName – defines the real host name to log into, alternatively, you can use a numeric IP addresses, it is also permitted (both on the command line and in HostName specifications). -2. User – specifies the user to log in as. -3. Port – sets the port number to connect on the remote host, the default is 22. Use the port number configured in the remote host’s sshd config file. -4. Protocol – this option defines the protocol versions ssh should support in order of preference. The usual values are ‘1’ and ‘2’, multiple versions must be comma-separated. -5. IdentityFile – specifies a file from which the user’s DSA, Ed25519, RSA or ECDSA authentication identity is read. -6. ForwardX11 – defines whether X11 connections will be automatically redirected over the secure channel and DISPLAY set. It has two possible values “yes” or “no”. -7. Compression – it’s used to set compression during the remote connection with the “yes” value. The default is “no”. -8. ServerAliveInterval – sets a timeout interval in seconds after which if no response (or data) has been received from the server, ssh will send a message through the encrypted channel to request a response from the server. The default value is 0, meaning no messages will be sent to the server, or 300 if the BatchMode option has been defined. -9. ServerAliveCountMax – sets the number of server alive messages which may be sent without ssh receiving any response from the server. -10. LogLevel – defines the verbosity level that is used when logging messages from ssh. The allowed values includes: QUIET, FATAL, ERROR, INFO, VERBOSE, DEBUG, DEBUG1, DEBUG2, and DEBUG3\. And the default is INFO. - -The standard way of connecting to any remote Linux host (CentOS 7 – in my case), defined in section two of the config file above, we would normally type the command below: - -``` -$ ssh -i ~/.ssh/id_rsa -p 22 tecmint@192.168.56.10 -``` - -However, with the use of the ssh client configuration file, we can simply type the following command: - -``` -$ ssh centos7 -``` - -You can find more options and usage examples in the ssh client config man page: - -``` -$man ssh_config -``` - -That’s it for now, in this guide, we explained you how to use a user-specific (custom) ssh client config file in Linux. Use the feedback form below to write back to us concerning this article. - --------------------------------------------------------------------------------- - -译者简介: - -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: http://www.tecmint.com/configure-custom-ssh-connection-in-linux/ - -作者:[Aaron Kili][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/aaronkili/ - -[1]:http://www.tecmint.com/install-openssh-server-in-linux/ -[2]:http://www.tecmint.com/execute-commands-on-multiple-linux-servers-using-pssh/ -[3]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ diff --git a/translated/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md b/translated/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md new file mode 100644 index 0000000000..d4890f7ad7 --- /dev/null +++ b/translated/tech/20170202 How to Configure Custom SSH Connections to Simplify Remote Access.md @@ -0,0 +1,172 @@ +如何配合自定义的 SSH 来简化远程访问 +=================== + +SSH (SSH 客户端) 是一个用于访问远程主机的程序,它使得用户能够 [在远程主机上执行命令][2]。这是在登录远程主机中的最受推崇的方法之一,因为其设计目的就是为两台不可信任主机通过不安全网络环境的通信提供安全加密。 + +SSH 使用系统全局以及用户指定 (用户自定义) 的配置文件。在本文中,我们将介绍如何创建一个自定义的 ssh 配置文件,并且通过确切的选项来链接到远程主机。 + +#### 先决条件: + +1. 你必须 [在你的桌面 Linux 上安装好 OpenSSH 客户端][1]。 +2. 理解通过 ssh 进行远程连接的常用选项 + +#### SSH 客户端配置文件 + +以下为 ssh 客户端配置文件: + +1. `/etc/ssh/ssh_config` 为默认的配置文件,属于系统全局配置文件,包含应用到所有用户的 ssh 客户端的设置。 +2. `~/.ssh/config` 或者 `$HOME/.ssh/config` 为用户指定/自定义配置文件,这个文件中的配置只对至指定的用户有效,因此,它是会覆盖掉默认的系统全局配置文件中的设置的。这也是我们要创建和使用的文件。 + +默认情况下,用户是是通过在 ssh 中输入密码来获取验证的,你可以以一个简单的步骤来 [使用 Keygen 来设置 ssh 无密码登录][3]。 + +注:如果你的系统上不存在 `~/.ssh`,那就手动创建它,并设置如下权限: + +``` +$ mkdir -p ~/.ssh +$ chmod 0700 ~/.ssh +``` + +以上的 chmod 命令表明,只有目录属主对该目录有读取、写入和执行权限,这也是 ssh 所要求的设置。 + +### 如何创建用户指定的 SSH 配置文件 + +该文件并不会被默认创建的,所以你需要使用具有读取/写入权限的用来来创建它。 + +``` +$ touch ~/.ssh/config +$ chmod 0700 ~/.ssh/config +``` + +上述文件包含由特定主机定义的各个部分,并且每个部分只应用到主机定义中相匹配的部分。 + +`~/.ssh/config` 文件的常见格式如下,其中所有的空行和以 `‘#’` 开头的行为注释: + +``` +Host host1 +ssh_option1=value1 +ssh_option2=value1 value2 +ssh_option3=value1 +Host host2 +ssh_option1=value1 +ssh_option2=value1 value2 +Host * +ssh_option1=value1 +ssh_option2=value1 value2 +``` + +如上格式详解: + +1. Host host1 为关于 host1 定义的头部,主机定义就从此处开始,直到下一个定义头部 Host host2 出现,这样形成一个完整的定义。 +2. host1 和 host2 是再命令行中使用的主机别名,并非实际的远程主机名。 +3. 其中,如 ssh_option1=value1、ssh_option2=value1 value2 等配置选项将应用到相匹配和想要以一定格式组织的主机。 +4. 对于 ssh_option2=value1 value2 这样的选项,ssh 执行时会按照顺序优先使用 value1 的值。 +5. Host * (其中 `*` 为匹配模式/通配符,匹配零个或多个字符) 定义头部会匹配零个或者多个主机。 + +仍旧以上述的格式为例,ssh 也是也这样的形式类读取配置文件的。如果你执行 shh 命令来访问远程主机 host1,如下: + +``` +$ ssh host1 +``` + +以上 ssh 命令会进行一下动作: + +1. 匹配配置文件中主机别名 host1,并使用定义头部中的各个设置项。 +2. 继续匹配下一个 host 定义,通过查找命令行中的名称发现不匹配,所有接下来的各个设置项会被略过。 +3. 最后执行到最后一个 host 定义,这会匹配所有的主机。这里,会将接下来的所有设置选项应用到所有的主机连接中。但是它不会覆写之前已经有 host 定义的那些选项。 +4. ssh host2 与此类似。 + +### 如何使用用户指定的 shh 配置文件 + +在你理解了 ssh 客户端配置文件的工作方式之后,你可以通过如下方式来创建它。记得使用你的服务器环境中对应的选项、值 (主机别名、端口号、用户名等)。 + +通过你最喜欢的编辑器来打开配置文件: + +``` +$ vi ~/.ssh/config +``` + +并定于必要的部分: + +``` +Host fedora25 +HostName 192.168.56.15 +Port 22 +ForwardX11 no +Host centos7 +HostName 192.168.56.10 +Port 22 +ForwardX11 no +Host ubuntu +HostName 192.168.56.5 +Port 2222 +ForwardX11 yes +Host * +User tecmint +IdentityFile ~/.ssh/id_rsa +Protocol 2 +Compression yes +ServerAliveInterval 60 +ServerAliveCountMax 20 +LogLevel INFO +``` + +以上 ssh 配置文件的详细解释: + +1. HostName - 定义真正要登录的主机名,此外,你也可以使用数字 IP 地址,不管是在命令行或是 HostName 定义中都运行使用其中任一种。 +2. User – 指定以哪一个用户来登录。 +3. Port – 设置连接远程主机的端口,默认是 22 端口。但必须是远程主机的 sshd 配置文件中定义的端口号。 +4. Protocol – 这个选项定义了优先使用 ssh 支持的协议版本。常用的值为 ‘1’ 和 ‘2’,同时使用两个协议版本则必须使用都厚隔开。 +5. IdentityFile – 指定读取用户 DSA、Ed25519、ECDSA 等授权验证信息的文件。 +6. ForwardX11 – 定义 X11 链接是否自动重定向到安全通道和 DISPLAY 设置。这两个可以设置的值,即 “yes” 或 “no”。 +7. Compression – 默认值为 “no”,如果设置为 “yes”,则在连接远程主机过程中使用压缩进程传输。 +8. ServerAliveInterval – 设置当不在收到服务器响应 (或者数据) 时的过期时间,单位为秒,ssh 会通过加密信道向发送信息,请求服务器响应。默认值为 0,这意味着 ssh 不会向服务器发送响应请求,如果 Batch 选项有定义,则默认是 300s。 +9. ServerAliveCountMax – 设置服务器活动信息的数值,以便在 ssh 在没有收到服务器响应的情况下发送信息。 +10. LogLevel – 定义 ssh 登录信息的的日志冗余级别。允许的值为:QUIET、 FATAL、ERROR、INFO、VERBOSE、DEBUG、DEBUG1、DEBUG2 和 DEBUG3,默认为 INFO。 + +以上,连接任意远程主机的标准方法, 我连接的是 CentOS 7,即定义的第二部分,我们可以简单的输入如下命令: + +``` +$ ssh -i ~/.ssh/id_rsa -p 22 tecmint@192.168.56.10 +``` + +然而,使用了 ssh 客户端配置文件之后,我们还可以这样: + +``` +$ ssh centos7 +``` + +你也可以在 man 帮助页面寻找更多的设置选项和使用实例: + +``` +$man ssh_config +``` + +至此,文毕。我们在文中想你介绍了在 Linux 中如何如何使用用户指定 (自定义) 的 ssh 客户端配置文件。通过下方的反馈表单来写一些与本文的相关的想法吧。 + +------------------------------------------------ + +作者简介: + +Aaron Kili 是一名 Linux 和 F.O.S.S 忠实拥护者、高级 Linux 系统管理员、Web 开发者,目前在 TecMint 是一名活跃的博主,热衷于计算机并有着强烈的只是分享意愿。 + +------------------------------------------------- + +译者简介: + +[GHLandy](http://GHLandy.com) —— 生活中所有欢乐与苦闷都应藏在心中,有些事儿注定无人知晓,自己也无从说起。 + +------------------------------------------------- + +via: http://www.tecmint.com/configure-custom-ssh-connection-in-linux/ + +作者:[Aaron Kili][a] +译者:[GHLandy](https://github.com/GHLandy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/install-openssh-server-in-linux/ +[2]:http://www.tecmint.com/execute-commands-on-multiple-linux-servers-using-pssh/ +[3]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ From b728e6e5f88d006a6f3651af09fb7b987af848e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B2?= <913502531@qq.com> Date: Mon, 6 Mar 2017 19:19:23 +0800 Subject: [PATCH 052/190] Update 20140513 What is Debian A brief introduction.md --- .../20140513 What is Debian A brief introduction.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md b/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md index 16ac5a6428..b661c1a8ff 100644 --- a/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md +++ b/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md @@ -1,3 +1,4 @@ +zschong 翻译中 ### What is Debian? A brief introduction Hello buddies.!!  From 671ac738eeb11774132bd25bd9320890763feb62 Mon Sep 17 00:00:00 2001 From: woniu <18810913096@163.com> Date: Mon, 6 Mar 2017 20:10:11 +0800 Subject: [PATCH 053/190] translating by DockerChen --- ...24 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md b/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md index ab5ba45450..70fef0c365 100644 --- a/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md +++ b/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md @@ -1,3 +1,5 @@ +translating by DockerChen + Setting Up a Secure FTP Server using SSL/TLS on Ubuntu ============================================================ From 5d0c140ec7c1fb6b9ee6265c91e4b09512f09bc2 Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 7 Mar 2017 06:15:24 +0800 Subject: [PATCH 054/190] PUB:The history of Android/16 - The history of Android.md @alim0x @bestony --- .../16 - The history of Android.md | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/translated/talk/The history of Android/16 - The history of Android.md b/translated/talk/The history of Android/16 - The history of Android.md index c790e623a5..1be1dea4cc 100644 --- a/translated/talk/The history of Android/16 - The history of Android.md +++ b/translated/talk/The history of Android/16 - The history of Android.md @@ -4,50 +4,53 @@ 尽管姜饼中做了许多改变,安卓仍然是移动世界里的丑小鸭。相比于 iPhone,它的优雅程度和设计完全抬不起头。另一方面来说,为数不多的能与 iOS 的美学智慧相当的操作系统之一是 Palm 的 WebOS。WebOS 有着优秀的整体设计,创新的功能,而且被寄予期望能够从和 iPhone 的长期竞争中拯救公司。 -尽管如此,一年之后,Palm 资金链断裂。Palm 公司未曾看到 iPhone 的到来,到 WebOS 就绪的时候已经太晚了。2010年4月,惠普花费10亿美元收购了 Palm。尽管惠普收购了一个拥有优秀用户界面的产品,界面的首席设计师,Matias Duarte,并没有加入惠普公司。2010年5月,就在惠普接手 Palm 之前,Duarte 加入了谷歌。惠普买下了面包,但谷歌雇佣了它的烘培师。 +尽管如此,一年之后,Palm 资金链断裂。Palm 公司未曾看到 iPhone 的到来,到 WebOS 就绪的时候已经太晚了。2010 年 4 月,惠普花费 10 亿美元收购了 Palm。尽管惠普收购了一个拥有优秀用户界面的产品,但界面的首席设计师,Matias Duarte,并没有加入惠普公司。2010 年 5 月,就在惠普接手 Palm 之前,Duarte 加入了谷歌。惠普买下了面包,但谷歌雇佣了它的烘培师。 ![第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/Motorola-XOOM-MZ604.jpg) -第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。 -在谷歌,Duarte 被任命为安卓用户体验主管。这是第一次有人公开掌管安卓的外观。尽管 Matias 在安卓 2.2 发布时就来到了谷歌,第一个真正受他影响的安卓版本是 3.0 蜂巢,它在2011年2月发布。 +*第一部蜂巢设备,摩托罗拉 Xoom 10英寸平板。* -按谷歌自己的说法,蜂巢是匆忙问世的。10个月前,苹果发布了 iPad,让平板变得更加现代,谷歌希望能够尽快做出回应。蜂巢就是那个回应,一个运行在10英寸触摸屏上的安卓版本。悲伤的是,将这个系统推向市场是如此优先的事项,以至于边边角角都被砍去了以节省时间。 +在谷歌,Duarte 被任命为安卓用户体验主管。这是第一次有人公开掌管安卓的外观。尽管 Matias 在安卓 2.2 发布时就来到了谷歌,第一个真正受他影响的安卓版本是 3.0 蜂巢(Honeycomb),它在 2011 年 2 月发布。 -新系统只用于平板——手机不能升级到蜂巢,这加大了谷歌让系统运行在差异巨大的不同尺寸屏幕上的难度。但是,仅支持平板而不支持手机也使得蜂巢源码没有泄露。之前的安卓版本是开源的,这使得黑客社区能够将其最新版本移植到所有的不同设备之上。谷歌不希望应用开发者在支持不完美的蜂巢手机移植版本时感到压力,所以谷歌将源码留在自己手中,并且严格控制能够拥有蜂巢的设备。匆忙的开发还导致了软件问题。在发布时,蜂巢不是特别稳定,SD卡不能工作,Adobe Flash——安卓最大的特色之一——还不被支持。 +按谷歌自己的说法,蜂巢是匆忙问世的。10 个月前,苹果发布了 iPad,让平板变得更加现代,谷歌希望能够尽快做出回应。蜂巢就是那个回应,一个运行在 10 英寸触摸屏上的安卓版本。悲伤的是,将这个系统推向市场是如此优先的事项,以至于边边角角都被砍去了以节省时间。 -[摩托罗拉 Xoom][1]是为数不多的拥有蜂巢的设备之一,它是这个新系统的旗舰产品。Xoom 是一个10英寸,16:9 的平板,拥有 1GB 内存和 1GHz Tegra 2 双核处理器。尽管是由谷歌直接控制更新的新版安卓发布设备,它并没有被叫做“Nexus”。对此最可能的原因是谷歌对它没有足够的信心称其为旗舰。 +新系统只用于平板——手机不能升级到蜂巢,这加大了谷歌让系统运行在差异巨大的不同尺寸屏幕上的难度。但是,仅支持平板而不支持手机也使得蜂巢源码没有泄露。之前的安卓版本是开源的,这使得黑客社区能够将其最新版本移植到所有的不同设备之上。谷歌不希望应用开发者在支持不完美的蜂巢手机移植版本时感到压力,所以谷歌将源码留在自己手中,并且严格控制能够拥有蜂巢的设备。匆忙的开发还导致了软件问题。在发布时,蜂巢不是特别稳定,SD 卡不能工作,Adobe Flash——安卓最大的特色之一——还不被支持。 -尽管如此,蜂巢是安卓的一个里程碑。在一个体验设计师的主管之下,整个安卓用户界面被重构,绝大多数奇怪的应用设计都得到改进。安卓的默认应用终于看起来像整体的一部分,不同的界面有着相似的布局和主题。然而重新设计安卓会是一个跨版本的项目——蜂巢只是将安卓塑造成型的开始。这第一稿为未来版本的安卓将如何运作奠定了基础,但它也用了过多的科幻主题,谷歌将花费接下来的数个版本来淡化它。 +[摩托罗拉 Xoom][1] 是为数不多的拥有蜂巢的设备之一,它是这个新系统的旗舰产品。Xoom 是一个 10 英寸,16:9 的平板,拥有 1GB 内存和 1GHz Tegra 2 双核处理器。尽管是由谷歌直接控制更新的新版安卓发布设备,它并没有被叫做“Nexus”。对此最可能的原因是谷歌对它没有足够的信心称其为旗舰。 + +尽管如此,蜂巢是安卓的一个里程碑。在一个体验设计师的主管之下,整个安卓用户界面被重构,绝大多数奇怪的应用设计都得到改进。安卓的默认应用终于看起来像整体的一部分,不同的界面有着相似的布局和主题。然而重新设计安卓会是一个跨越了多个版本的项目——蜂巢只是将安卓塑造成型的开始。这第一稿为未来版本的安卓将如何运作奠定了基础,但它也用了过多的科幻主题,谷歌将花费接下来的数个版本来淡化它。 ![蜂巢和姜饼的主屏幕。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/homeskreen.png) -蜂巢和姜饼的主屏幕。 -Ron Amadeo供图 + +*蜂巢和姜饼的主屏幕。 +[Ron Amadeo供图]* 姜饼只是在它的光子壁纸上试验了科幻外观,蜂巢整个系统的以电子为灵感的主题让它充满科幻意味。所有东西都是黑色的,如果你需要对比色,你可以从一些不同色调的蓝色中挑选。所有蓝色的东西还有“光晕”效果,让整个系统看起来像是外星科技创造的。默认背景是个六边形的全息方阵(一个蜂巢!明白了吗?),看起来像是一艘飞船上的传送阵的地板。 -蜂巢最重要的变化是增加了系统栏。摩托罗拉 Xoom 除了电源和音量键之外没有配备实体按键,所以蜂巢添加了一个大黑色底栏到屏幕底部,用于放置导航按键。这意味着默认安卓界面不再需要特别的实体按键。在这之前,安卓没有实体的返回,菜单和 Home 键就不能正常工作。现在,软件提供了所有必需的按钮,任何带有触摸屏的设备都能够运行安卓。 +蜂巢最重要的变化是增加了系统栏。摩托罗拉 Xoom 除了电源和音量键之外没有配备实体按键,所以蜂巢添加了一个大黑色底栏到屏幕底部,用于放置导航按键。这意味着默认安卓界面不再需要特别的实体按键。在这之前,安卓没有实体的返回、菜单和 Home 键就不能正常工作。现在,软件提供了所有必需的按钮,任何带有触摸屏的设备都能够运行安卓。 -新软件按键带来的最大的好处是灵活性。新的应用指南表明应用应不再要求实体菜单按键,需要用到的时候,蜂巢会自动检测并添加四个按钮到系统栏让应用正常工作。另一个软件按键的灵活属性是它们可以改变设备的屏幕方向。除了电源和音量键之外,Xoom 的方向实际上不是那么重要。从用户的角度来看,系统栏始终处于设备的“底部”。代价是系统栏明显占据了一些屏幕空间。为了在10英寸平板上节省空间,状态栏被合并到了系统栏中。所有的常用状态指示放在了右侧——有电源,连接状态,时间还有通知图标。 +新软件按键带来的最大的好处是灵活性。新的应用指南表明应用不再必需实体菜单按键,需要用到的时候,蜂巢会自动检测并添加四个按钮到系统栏让应用正常工作。另一个软件按键的灵活属性是它们可以改变设备的屏幕方向。除了电源和音量键之外,Xoom 的方向实际上不是那么重要。从用户的角度来看,系统栏始终处于设备的“底部”。代价是系统栏明显占据了一些屏幕空间。为了在10英寸平板上节省空间,状态栏被合并到了系统栏中。所有的常用状态指示放在了右侧——有电源、连接状态、时间还有通知图标。 主屏幕的整个布局都改变了,用户界面部件放在了设备的四个角落。屏幕底部左侧放置着之前讨论过的导航按键,右侧用于状态指示和通知,顶部左侧显示的是文本搜索和语音搜索,右侧有应用抽屉和添加小部件的按钮。 ![新锁屏界面和最近应用界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/lockscreen-and-recent.png) -新锁屏界面和最近应用界面。 -Ron Amadeo供图 -(因为 Xoom 是一部 [较重] 的10英寸,16:9平板设备,这意味着它主要是横屏使用。虽然大部分应用还支持竖屏模式,但是到目前为止,由于我们的版式限制,我们大部分使用的是竖屏模式的截图。请记住蜂巢的截图来自于10英寸的平板,而姜饼的截图来自3.7英寸的手机。二者所展现的信息密度是不能直接比较的。) +*新锁屏界面和最近应用界面。 +[Ron Amadeo供图]* + +(因为 Xoom 是一部 [较重] 的 10 英寸,16:9 平板设备,这意味着它主要是横屏使用。虽然大部分应用还支持竖屏模式,但是到目前为止,由于我们的版式限制,我们大部分使用的是竖屏模式的截图。请记住蜂巢的截图来自于 10 英寸的平板,而姜饼的截图来自 3.7 英寸的手机。二者所展现的信息密度是不能直接比较的。) 解锁界面——从菜单按钮到旋转式拨号盘再到滑动解锁——移除了解锁步骤的任何精度要求,它采用了一个环状解锁盘。从中间向任意方向向外滑动就能解锁设备。就像旋转式解锁,这种解锁方式更加符合人体工程学,而不用强迫你的手指完美地遵循一条笔直的解锁路径。 -第二张图中略缩图条带是由新增的“最近应用”按钮打开的界面,现在处在返回和 Home 键旁边。不像姜饼中长按 Home 键显示一组最近应用的图标,蜂巢在屏幕上显示应用图标和略缩图,使得在任务间切换变得更加方便。最近应用的灵感明显来自于 Duarte 在 WebOS 中的“卡片式”多任务管理,其使用全屏略缩图来切换任务。这个设计提供和 WebOS 的任务切换一样的易识别体验,但更小的略缩图允许更多的应用一次性显示在屏幕上。 +第二张图中略缩图条带是由新增的“最近应用”按钮打开的界面,现在处在返回键和 Home 键旁边。不像姜饼中长按 Home 键显示一组最近应用的图标,蜂巢在屏幕上显示应用图标和略缩图,使得在任务间切换变得更加方便。“最近应用”的灵感明显来自于 Duarte 在 WebOS 中的“卡片式”多任务管理,其使用全屏略缩图来切换任务。这个设计提供和 WebOS 的任务切换一样的易识别体验,但更小的略缩图允许更多的应用一次性显示在屏幕上。 尽管最近应用的实现看起来和你现在的设备很像,这个版本实际上是非常早期的。这个列表不能滚动,这意味着竖屏下只能显示七个应用,横屏下只能显示五个。任何超出范围的应用会从列表中去除。而且你也不能通过滑动略缩图来关闭应用——这只是个静态的列表。 -这里我们看到电子灵感影响的完整主题效果:略缩图的周围有蓝色的轮廓以及神秘的光晕。这张截图还展示软件按键的好处——上下文。返回按钮可以关闭略缩图列表,所以这里的箭头指向下方,而不是通常的样子。 +从这里我们可以看到电子灵感影响的完整主题效果:略缩图的周围有蓝色的轮廓以及神秘的光晕。这张截图还展示软件按键的好处——上下文。返回按钮可以关闭略缩图列表,所以这里的箭头指向下方,而不是通常的样子。 ---------- -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) +![Ron Amadeo](https://cdn.arstechnica.net/wp-content/uploads/2016/05/r.amadeo-45843.jpg) [Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 @@ -55,7 +58,7 @@ Ron Amadeo供图 -------------------------------------------------------------------------------- -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/16/ +via: http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-history-of-googles-mobile-os/16/ 译者:[alim0x](https://github.com/alim0x) 校对:[Bestony](https://github.com/Bestony) From c580cf36ae5ca5f1d65965ffe0987d41d385c12f Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 7 Mar 2017 06:16:41 +0800 Subject: [PATCH 055/190] PRF&PUB:Part 10 - LXD 2.0--LXD and Juju.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @oska874 已经发布了到 10 啦,快把 12 做了选题弄完吧~ @geekpi 拜托了~ --- .../LXD/Part 10 - LXD 2.0--LXD and Juju.md | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) rename {translated/tech => published}/LXD/Part 10 - LXD 2.0--LXD and Juju.md (78%) diff --git a/translated/tech/LXD/Part 10 - LXD 2.0--LXD and Juju.md b/published/LXD/Part 10 - LXD 2.0--LXD and Juju.md similarity index 78% rename from translated/tech/LXD/Part 10 - LXD 2.0--LXD and Juju.md rename to published/LXD/Part 10 - LXD 2.0--LXD and Juju.md index 969374da74..bfaf180bcb 100644 --- a/translated/tech/LXD/Part 10 - LXD 2.0--LXD and Juju.md +++ b/published/LXD/Part 10 - LXD 2.0--LXD and Juju.md @@ -1,26 +1,25 @@ -LXD 2.0 系列(十):LXD和Juju +LXD 2.0 系列(十):LXD 和 Juju ====================================== 这是 [LXD 2.0 系列介绍文章][1]的第十篇。 - ![LXD logo](https://linuxcontainers.org/static/img/containers.png) +![LXD logo](https://linuxcontainers.org/static/img/containers.png) -介绍 -============================================================ +### 介绍 -Juju是Canonical的服务建模和部署工具。 它支持非常广泛的云提供商,使您能够轻松地在任何云上部署任何您想要的服务。 +Juju 是 Canonical 的服务建模和部署工具。 它支持非常广泛的云服务提供商,使您能够轻松地在任何云上部署任何您想要的服务。 -此外,Juju 2.0还支持LXD,既适用于本地部署,也适合开发,并且可以在云实例或物理机上共同协作。 +此外,Juju 2.0 还支持 LXD,既适用于本地部署,也适合开发,并且可以在云实例或物理机上共同协作。 本篇文章将关注本地使用,通过一个没有任何Juju经验的LXD用户来体验。 -# 要求 +### 要求 -本篇文章假设你已经安装了LXD 2.0并且配置完毕(看前面的文章),并且是在Ubuntu 16.04 LTS上运行的。 +本篇文章假设你已经安装了 LXD 2.0 并且配置完毕(看前面的文章),并且是在 Ubuntu 16.04 LTS 上运行的。 -# 设置 Juju +### 设置 Juju -第一件事是在Ubuntu 16.04上安装Juju 2.0。这个很简单: +第一件事是在 Ubuntu 16.04 上安装 Juju 2.0。这个很简单: ``` stgraber@dakara:~$ sudo apt install juju @@ -52,7 +51,7 @@ Setting up juju-2.0 (2.0~beta7-0ubuntu1.16.04.1) ... Setting up juju (2.0~beta7-0ubuntu1.16.04.1) ... ``` -安装完成后,我们可以使用LXD启动一个新的“控制器”。这意味着Juju不会修改你主机上的任何东西,它会在LXD容器中安装它的管理服务。 +安装完成后,我们可以使用 LXD 启动一个新的“控制器”。这意味着 Juju 不会修改你主机上的任何东西,它会在 LXD 容器中安装它的管理服务。 现在我们创建一个“test”控制器: @@ -86,7 +85,7 @@ Waiting for API to become available: upgrade in progress (upgrade in progress) Bootstrap complete, local.test now available. ``` -这会花费一点时间,这时你可以看到一个正在运行的一个新的LXD容器: +这会花费一点时间,这时你可以看到一个正在运行的一个新的 LXD 容器: ``` stgraber@dakara:~$ lxc list juju- @@ -97,7 +96,7 @@ stgraber@dakara:~$ lxc list juju- +-----------------------------------------------------+---------+----------------------+------+------------+-----------+ ``` -在Juju这边,你可以确认它有响应,并且还没有服务运行: +在 Juju 这边,你可以确认它是有响应的,并且还没有服务运行: ``` stgraber@dakara:~$ juju status @@ -111,7 +110,7 @@ ID WORKLOAD-STATUS JUJU-STATUS VERSION MACHINE PORTS PUBLIC-ADDRESS MESSAGE ID STATE DNS INS-ID SERIES AZ ``` -你也可以在浏览器中访问Juju的GUI界面: +你也可以在浏览器中访问 Juju 的 GUI 界面: ``` stgraber@dakara:~$ juju gui @@ -120,13 +119,13 @@ If it does not open, open this URL: https://10.178.150.72:17070/gui/97fa390d-96ad-44df-8b59-e15fdcfc636b/ ``` - ![Juju web UI](https://www.stgraber.org/wp-content/uploads/2016/06/juju-gui.png) +![Juju web UI](https://www.stgraber.org/wp-content/uploads/2016/06/juju-gui.png) -尽管我更倾向使用命令行,因此我会在接下来使用。 +不过我更倾向使用命令行,因此我会在接下来使用。 -# 部署一个minecraft服务 +### 部署一个 minecraft 服务 -让我们先来一个简单的,部署在一个容器中使用一个Juju单元的服务。 +让我们先来一个简单的,部署在一个容器中使用一个 Juju 单元的服务。 ``` stgraber@dakara:~$ juju deploy cs:trusty/minecraft @@ -134,7 +133,7 @@ Added charm "cs:trusty/minecraft-3" to the model. Deploying charm "cs:trusty/minecraft-3" with the charm series "trusty". ``` -返回会很快,然而这不意味着服务已经启动并运行了。你应该使用“juju status”来查看: +命令返回会很快,然而这不意味着服务已经启动并运行了。你应该使用 `juju status` 来查看: ``` stgraber@dakara:~$ juju status @@ -152,7 +151,7 @@ ID STATE DNS INS-ID SERIES AZ ``` -我们可以看到它正在忙于在刚刚创建的LXD容器中安装java。 +我们可以看到它正在忙于在刚刚创建的 LXD 容器中安装 java。 ``` stgraber@dakara:~$ lxc list juju- @@ -182,7 +181,7 @@ ID STATE DNS INS-ID SERIES AZ 1 started 10.178.150.74 juju-97fa390d-96ad-44df-8b59-e15fdcfc636b-machine-1 trusty ``` -这时你就可以启动你的Minecraft客户端了,它指向10.178.150.74,端口是25565。现在可以在新的minecraft服务器上玩了! +这时你就可以启动你的 Minecraft 客户端了,将其指向 10.178.150.74,端口是 25565。现在可以在新的 minecraft 服务器上玩了! 当你不再需要它,只需运行: @@ -192,13 +191,13 @@ stgraber@dakara:~$ juju destroy-service minecraft 只要等待几秒就好了。 -# 部署一个更复杂的web应用 +### 部署一个更复杂的 web 应用 -Juju的主要工作是建模复杂的服务,并以可扩展的方式部署它们。 +Juju 的主要工作是建模复杂的服务,并以可扩展的方式部署它们。 -为了更好地展示,让我们部署一个Juju “组合”。 这个组合是由网站,API,数据库,静态Web服务器和反向代理组成的基本Web服务。 +为了更好地展示,让我们部署一个 Juju “组合”。 这个组合是由网站,API,数据库,静态 Web 服务器和反向代理组成的基本 Web 服务。 -所以这将扩展到4个互联的LXD容器。 +所以这将扩展到 4 个互联的 LXD 容器。 ``` stgraber@dakara:~$ juju deploy cs:~charmers/bundle/web-infrastructure-in-a-box @@ -228,7 +227,7 @@ added nginx-proxy/0 unit to new machine deployment of bundle "cs:~charmers/bundle/web-infrastructure-in-a-box-10" completed ``` -几秒后,你会看到LXD容器在运行了: +几秒后,你会看到 LXD 容器在运行了: ``` stgraber@dakara:~$ lxc list juju- @@ -283,15 +282,15 @@ ID STATE DNS INS-ID SERIES AZ 5 started 10.178.150.214 juju-97fa390d-96ad-44df-8b59-e15fdcfc636b-machine-5 trusty ``` -这时你就可以在80端口访问http://10.178.150.214,并且会看到一个Juju学院页面。 +这时你就可以在 80 端口访问 http://10.178.150.214,并且会看到一个 Juju 学院页面。 [ ![Juju Academy web service](https://www.stgraber.org/wp-content/uploads/2016/06/juju-academy.png) ][2] -# 清理所有东西 +### 清理所有东西 -如果你不需要Juju创建的容器并且不在乎下次需要再次启动,最简单的方法是: +如果你不需要 Juju 创建的容器并且不在乎下次需要再次启动,最简单的方法是: ``` stgraber@dakara:~$ juju destroy-controller test --destroy-all-models @@ -328,24 +327,36 @@ stgraber@dakara:~$ lxc list juju- +------+-------+------+------+------+-----------+ ``` -# 总结 +### 总结 -Juju 2.0内置的LXD支持使得可以用一种非常干净的方式来测试各种服务。 +Juju 2.0 内置的 LXD 支持使得可以用一种非常干净的方式来测试各种服务。 -在Juju charm store中有很多预制的“组合”可以用来部署,甚至可以用多个“charm”来组合你想要的架构。 +在 Juju charm store 中有很多预制的“组合”可以用来部署,甚至可以用多个“charm”来组合你想要的架构。 -Juju与LXD是一个完美的解决方案,从一个小的Web服务到大规模的基础设施都可以简单开发,这些都在你自己的机器上,并且不会在你的系统上造成混乱! +Juju 与 LXD 是一个完美的解决方案,从一个小的 Web 服务到大规模的基础设施都可以简单开发,这些都在你自己的机器上,并且不会在你的系统上造成混乱! + +### 额外信息 + +Juju 网站: http://www.ubuntu.com/cloud/juju +Juju charm store : https://jujucharms.com + +LXD 的主站在: https://linuxcontainers.org/lxd +LXD 的 GitHub 仓库: https://github.com/lxc/lxd +LXD 的邮件列表: https://lists.linuxcontainers.org +LXD 的 IRC 频道: #lxcontainers on irc.freenode.net +如果你不想或者不能在你的机器上安装 LXD ,你可以在 web 上试试[在线版的 LXD](https://linuxcontainers.org/lxd/try-it)。 -------------------------------------------------------------------------- -作者简介:我是Stéphane Graber。我是LXC和LXD项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical有限公司担任LXD的技术主管。 + +作者简介:我是 Stéphane Graber。我是 LXC 和 LXD 项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical 有限公司担任 LXD 的技术主管。 -------------------------------------------------------------------------------- via: https://www.stgraber.org/2016/06/06/lxd-2-0-lxd-and-juju-1012/ -作者:[ Stéphane Graber][a] +作者:[Stéphane Graber][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cc6899399b5e90960bb7e8d7b1d9d3029219f7ef Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 7 Mar 2017 06:31:56 +0800 Subject: [PATCH 056/190] PRF&PUB:Part 11 - LXD 2.0--LXD and OpenStack.md @geekpi --- .../Part 11 - LXD 2.0--LXD and OpenStack.md | 147 ++++++++++++++++++ .../Part 11 - LXD 2.0--LXD and OpenStack.md | 128 --------------- 2 files changed, 147 insertions(+), 128 deletions(-) create mode 100644 published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md delete mode 100644 translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md diff --git a/published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md b/published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md new file mode 100644 index 0000000000..95a65fa44d --- /dev/null +++ b/published/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md @@ -0,0 +1,147 @@ +LXD 2.0 系列(十一):LXD 和 OpenStack +====================================== + +这是 [LXD 2.0 系列介绍文章][1]的第十一篇。 + +![LXD logo](https://linuxcontainers.org/static/img/containers.png) + +### 介绍 + +首先对这次的延期抱歉。为了让一切正常我花了很长时间。我第一次尝试是使用 devstack 时遇到了一些必须解决问题。 然而即使这样,我还是不能够使网络正常。 + +我终于放弃了 devstack,并使用用户友好的 Juju 尝试使用 “conjure-up” 部署完整的 Ubuntu OpenStack。它终于工作了! + +下面是如何运行一个完整的 OpenStack,使用 LXD 容器而不是 VM,并在 LXD 容器中运行所有这些(嵌套的!)。 + +### 要求 + +这篇文章假设你有一个可以工作的 LXD 设置,提供容器网络访问,并且你有一个非常强大的 CPU,大约 50GB 给容器空间和至少 16G B的内存。 + +记住,我们在这里运行一个完整的 OpenStack,这东西不是很轻量! + +### 设置容器 + +OpenStack 由大量不同做不同事情的组件组成。 一些需要一些额外的特权,为了可以使设置更简单,我们将使用特权容器。 + +我们将配置支持嵌套的容器,预加载所有需要的内核模块,并允许它访问 `/dev/mem`(显然是需要的)。 + +请注意,这意味着 LXD 容器的大部分安全特性对该容器被禁用。 然而由 OpenStack 自身产生的容器将是无特权的,并且可以正常使用 LXD 的安全特性。 + +``` +lxc launch ubuntu:16.04 openstack -c security.privileged=true -c security.nesting=true -c "linux.kernel_modules=iptable_nat, ip6table_nat, ebtables, openvswitch" +lxc config device add openstack mem unix-char path=/dev/mem +``` + +LXD 中有一个小 bug,它会尝试加载已经加载到主机上的内核模块。这已在LXD 2.5中得到修复,并将在LXD 2.0.6 中修复,但在此之前,可以使用以下方法: + +``` +lxc exec openstack -- ln -s /bin/true /usr/local/bin/modprobe +``` + +我们需要加几条 PPA 并安装 conjure-up,它是我们用来安装 OpenStack 的部署工具。 + +``` +lxc exec openstack -- apt-add-repository ppa:conjure-up/next -y +lxc exec openstack -- apt-add-repository ppa:juju/stable -y +lxc exec openstack -- apt update +lxc exec openstack -- apt dist-upgrade -y +lxc exec openstack -- apt install conjure-up -y +``` + +最后一步是在容器内部配置 LXD 网络。 + +所有问题都选择默认,除了: + +* 使用 `dir` 存储后端( `zfs` 不在嵌套容器中用) +* 不要配置 IPv6 网络(conjure-up/juju 不太兼容它) + +``` +lxc exec openstack -- lxd init +``` + +现在配置完容器了,现在我们部署 OpenStack! + +### 用 conjure-up 部署 OpenStack + +如先前提到的,我们用 conjure-up 部署 OpenStack。 + +这是一个很棒的用户友好的可以与 Juju 交互来部署复杂服务的工具。 + +首先: + +``` +lxc exec openstack -- sudo -u ubuntu -i conjure-up +``` + +* 选择 “OpenStack with NovaLXD” +* 选择 “localhost” 作为部署目标(使用 LXD) +* 点击 “Deploy all remaining applications” + +接下来会部署 OpenStack。整个过程会花费一个多小时,这取决于你运行的机器。你将看到所有服务会被分配一个容器,然后部署并最终互连。 + +![Conjure-Up deploying OpenStack](https://www.stgraber.org/wp-content/uploads/2016/10/conjure-up.png) + +部署完成后会显示一个安装完成的界面。它会导入一些初始镜像、设置 SSH 权限、配置网络最后会显示面板的 IP 地址。 + +### 访问面板并生成一个容器 + +面板运行在一个容器中,因此你不能直接从浏览器中访问。 + +最简单的方法是设置一条 NAT 规则: + +``` +lxc exec openstack -- iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to +``` + +其中 `` 是 conjure-up 在安装结束时给你的面板 IP 地址。 + +你现在可以获取 “openstack” 容器的 IP 地址(来自 `lxc info openstack`),并将浏览器指向:http://\/horizon 。 + +第一次加载可能需要几分钟。 一旦显示了登录界面,输入默认登录名和密码(admin/openstack),你就会看到OpenStack的欢迎面板! + +![oslxd-dashboard](https://www.stgraber.org/wp-content/uploads/2016/10/oslxd-dashboard.png) + +现在可以选择左边的 “Project” 选项卡,进入 “Instances” 页面。 要启动一个使用 nova-lxd 的新实例,点击 “Launch instance”,选择你想要的镜像,网络等,接着你的实例就产生了。 + +一旦它运行后,你可以为它分配一个浮动 IP,它将允许你从你的 “openstack” 容器中访问你的实例。 + +### 总结 + +OpenStack 是一个非常复杂的软件,你也不会想在家里或在单个服务器上运行它。 但是,不管怎样在你的机器上包含这些服务在一个容器中都是非常有趣的。 + +conjure-up 是部署这种复杂软件的一个很好的工具,背后使用 Juju 驱动部署,为每个单独的服务使用 LXD 容器,最后是实例本身。 + +它也是少数几个容器嵌套多层并实际上有意义的情况之一! + +### 额外信息 + +conjure-up 网站: http://conjure-up.io + +Juju 网站: http://www.ubuntu.com/cloud/juju + +LXD 的主站在: https://linuxcontainers.org/lxd + +LXD 的 GitHub 仓库: https://github.com/lxc/lxd + +LXD 的邮件列表: https://lists.linuxcontainers.org + +LXD 的 IRC 频道: #lxcontainers on irc.freenode.net + +如果你不想或者不能在你的机器上安装 LXD ,你可以在 web 上试试在线版的 LXD。 + +-------------------------------------------------------------------------- + +作者简介:我是Stéphane Graber。我是LXC和LXD项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical有限公司担任LXD的技术主管。 + +-------------------------------------------------------------------------------- + +via: https://www.stgraber.org/2016/10/26/lxd-2-0-lxd-and-openstack-1112/ + +作者:[Stéphane Graber][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.stgraber.org/author/stgraber/ +[1]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ diff --git a/translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md b/translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md deleted file mode 100644 index f1d6d241f9..0000000000 --- a/translated/tech/LXD/Part 11 - LXD 2.0--LXD and OpenStack.md +++ /dev/null @@ -1,128 +0,0 @@ -LXD 2.0 系列(十):LXD和OpenStack -====================================== - -这是 [LXD 2.0 系列介绍文章][1]的第十一篇。 - - ![LXD logo](https://linuxcontainers.org/static/img/containers.png) - -介绍 -============================================================ - -首先对这次的延期抱歉。为了让一切正常我花了很长时间。我第一次尝试是使用devstack时遇到了一些必须解决问题。 然而即使这样,我还是不能够使网络正常。 - -我终于放弃了devstack,并使用用户友好的Juju尝试使用“conjure-up”部署完整的Ubuntu OpenStack。它终于工作了! - -下面是如何运行一个完整的OpenStack,使用LXD容器而不是VM,并在LXD容器中运行所有这些(嵌套的!)。 - -# 要求 - -这篇文章假设你有一个可以工作的LXD设置,提供容器网络访问,并且你有一个非常强大的CPU,大约50GB给容器空间和至少16GB的内存。 - -记住,我们在这里运行一个完整的OpenStack,这东西不是很轻量! - -# 设置容器 - -OpenStack由大量不同做不同事情的组件组成。 一些需要一些额外的特权,这样可以使设置更简单,我们将使用特权容器。 - -我们将配置支持嵌套的容器,预加载所有需要的内核模块,并允许它访问/dev/mem(显然是需要的)。 - -请注意,这意味着LXD容器的大部分安全特性对该容器被禁用。 然而由OpenStack自身产生的容器将是无特权的,并且可以正常使用LXD的安全特性。 - -``` -lxc launch ubuntu:16.04 openstack -c security.privileged=true -c security.nesting=true -c "linux.kernel_modules=iptable_nat, ip6table_nat, ebtables, openvswitch" -lxc config device add openstack mem unix-char path=/dev/mem -``` - -LXD中有一个小bug,它会尝试加载已经加载到主机上的内核模块。这已在LXD 2.5中得到修复,并将在LXD 2.0.6中修复,但在此之前,可以使用以下方法: - -``` -lxc exec openstack -- ln -s /bin/true /usr/local/bin/modprobe -``` - -我们需要加几条PPA并安装conjure-up,它是我们用来安装Openstack的部署工具。 - -``` -lxc exec openstack -- apt-add-repository ppa:conjure-up/next -y -lxc exec openstack -- apt-add-repository ppa:juju/stable -y -lxc exec openstack -- apt update -lxc exec openstack -- apt dist-upgrade -y -lxc exec openstack -- apt install conjure-up -y -``` - -最后一步是在容器内部配置LXD网络。 -所有问题都选择默认,除了: - -* 使用“dir”存储后端(“zfs”不在嵌套容器中有用) -* 不要配置IPv6网络(conjure-up/juju不太兼容它) - -``` -lxc exec openstack -- lxd init -``` - -现在配置完容器了,现在我们部署OpenStack! - -# 用conjure-up部署OpenStack - -如先前提到的,我们用conjure-up部署OpenStack。 -这是一个很棒的用户友好的可以与Juju交互来部署复杂服务的工具。 - -首先: - -``` -lxc exec openstack -- sudo -u ubuntu -i conjure-up -``` - -* 选择“OpenStack with NovaLXD” -* 选择“localhost”作为部署目标(使用LXD) -* 点击“Deploy all remaining applications” - -接下来会部署OpenStack。整个过程会花费一个多小时,这取决于你运行的机器。你将看到所有服务会被分配一个容器,然后部署并最终互连。 - - ![Conjure-Up deploying OpenStack](https://www.stgraber.org/wp-content/uploads/2016/10/conjure-up.png) - -部署完成后会显示一个安装完成的界面。它会导入一些初始镜像、设置SSH权限、配置网络最后会显示面板的IP地址。 - -# 访问面板并生成一个容器 - -面板运行在一个容器中,因此你不能直接从浏览器中访问。 -最简单的方法是设置一条NAT规则: - -``` -lxc exec openstack -- iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to -``` - -其中“”是conjure-up在安装结束时给你的面板IP地址。 - -你现在可以获取“openstack”容器的IP地址(来自“lxc info openstack”),并将浏览器指向:http:///horizon - -第一次加载可能需要几分钟。 一旦显示了登录界面,输入默认登录名和密码(admin/openstack),你就会看到OpenStack的欢迎面板! - -  ![oslxd-dashboard](https://www.stgraber.org/wp-content/uploads/2016/10/oslxd-dashboard.png) - -现在可以选择左边的“Project”选项卡,进入“Instances”页面。 要启动一个使用nova-lxd的新实例,点击“Launch instance”,选择你想要的镜像,网络等,接着你的实例就产生了。 - -一旦它运行后,你可以为它分配一个浮动IP,它将允许你从你的“openstack”容器中访问你的实例。 - -# 总结 - -OpenStack是一个非常复杂的软件,你也不会想在家里或在单个服务器上运行它。 但是,不管怎样在你的机器上包含这些服务在一个容器中都是非常有趣的。 - -conjure-up是部署这种复杂软件的一个很好的工具,背后使用Juju驱动部署,为每个单独的服务使用LXD容器,最后是实例本身。 - -它也是少数几个容器嵌套多层并实际上有意义的情况之一! - --------------------------------------------------------------------------- -作者简介:我是Stéphane Graber。我是LXC和LXD项目的领导者,目前在加拿大魁北克蒙特利尔的家所在的Canonical有限公司担任LXD的技术主管。 - --------------------------------------------------------------------------------- - -via: https://www.stgraber.org/2016/10/26/lxd-2-0-lxd-and-openstack-1112/ - -作者:[Stéphane Graber ][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.stgraber.org/author/stgraber/ -[1]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ From 671270bbca9e2e59f0f87c307e0935e930a56f1d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 7 Mar 2017 09:37:58 +0800 Subject: [PATCH 057/190] translating --- ...170208 4 open source tools for conducting online surveys.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20170208 4 open source tools for conducting online surveys.md b/sources/tech/20170208 4 open source tools for conducting online surveys.md index e16ddfcf63..3e93ad2304 100644 --- a/sources/tech/20170208 4 open source tools for conducting online surveys.md +++ b/sources/tech/20170208 4 open source tools for conducting online surveys.md @@ -1,3 +1,5 @@ +translating---geekpi + 4 open source tools for conducting online surveys ============================================================ @@ -11,6 +13,7 @@ Millions turn to proprietary tools like SurveyGizmo, Polldaddy, SurveyMonkey, or Let's take a look at four open source survey tools that can suit your needs, no matter how simple or complex those needs are. + ### LimeSurvey [LimeSurvey][2] is where you turn to when you want a survey tool that can do just about everything you want it to do. You can use LimeSurvey for doing simple surveys and polls, and more complex ones that span multiple pages. If you work in more than one language, LimeSurvey supports 80 of them. From 02a2e47b25cff742570c432be1fa43b25cd6f56c Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 7 Mar 2017 10:22:20 +0800 Subject: [PATCH 058/190] PUB:The history of Android/16 - The history of Android.md @alim0x --- .../The history of Android/16 - The history of Android.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/The history of Android/16 - The history of Android.md (100%) diff --git a/translated/talk/The history of Android/16 - The history of Android.md b/published/The history of Android/16 - The history of Android.md similarity index 100% rename from translated/talk/The history of Android/16 - The history of Android.md rename to published/The history of Android/16 - The history of Android.md From 2e81d18736638fa8442ebbe5c017bdf4d5208fb5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 7 Mar 2017 10:23:32 +0800 Subject: [PATCH 059/190] translated --- ...rce tools for conducting online surveys.md | 88 ------------------- ...rce tools for conducting online surveys.md | 85 ++++++++++++++++++ 2 files changed, 85 insertions(+), 88 deletions(-) delete mode 100644 sources/tech/20170208 4 open source tools for conducting online surveys.md create mode 100644 translated/tech/20170208 4 open source tools for conducting online surveys.md diff --git a/sources/tech/20170208 4 open source tools for conducting online surveys.md b/sources/tech/20170208 4 open source tools for conducting online surveys.md deleted file mode 100644 index 3e93ad2304..0000000000 --- a/sources/tech/20170208 4 open source tools for conducting online surveys.md +++ /dev/null @@ -1,88 +0,0 @@ -translating---geekpi - -4 open source tools for conducting online surveys -============================================================ - - - ![4 open source tools for doing online surveys](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_question_B.png?itok=UVCz8ld_ "4 open source tools for doing online surveys") -Image by : opensource.com - -Ah, the venerable survey. It can be a fast, simple, cheap, and effective way gather the opinions of friends, family, classmates, co-workers, customers, readers, and others. - -Millions turn to proprietary tools like SurveyGizmo, Polldaddy, SurveyMonkey, or even Google Forms to set up their surveys. But if you want more control, not just over the application but also the data you collect, then you'll want to go open source. - -Let's take a look at four open source survey tools that can suit your needs, no matter how simple or complex those needs are. - - -### LimeSurvey - -[LimeSurvey][2] is where you turn to when you want a survey tool that can do just about everything you want it to do. You can use LimeSurvey for doing simple surveys and polls, and more complex ones that span multiple pages. If you work in more than one language, LimeSurvey supports 80 of them. - -LimeSurvey also lets you customize your surveys with your own JavaScript, photos, and videos, and even by editing your survey's HTML directly. And all that is only scratching the surface of [its features][3]. - -You can install LimeSurvey on your own server, or [get a hosted plan][4] that will set you back a few hundred euros a year (although there is a free option too). - -### JD Esurvey - -If LimeSurvey doesn't pack enough features for you and Java-powered web applications are your thing, then give [JD Esurvey ][5]a look. It's described as "an open source enterprise survey web application." It's definitely powerful, and ticks a number of boxes for organizations looking for a high-volume, robust survey tool. - -Using JD Esurvey, you can collect a range of information including answers to "Yes/No" questions and star ratings for products and services. You can even process answers to questions with multiple parts. JD Esurvey supports creating and managing surveys with tablets and smartphones, and your published surveys are mobile friendly too. According to the developer, the application is usable by [people with disabilities][6]. - -To give it a go, you can either [fork JD Esurvey on GitHub][7] or [download and install][8] a pre-compiled version of the application. - -### Quick Survey - -For many of us, tools like LimeSurvey and JD Esurvey are overkill. We just want a quick and dirty way to gather opinions or feedback. That's where [Quick Survey][9] comes in. - -Quick Survey only lets you create question-and-answer or multiple choice list surveys. You add your questions or create your list, then publish it and share the URL. You can add as many items to your survey as you need to, and the responses appear on Quick Survey's admin page. You can download the results of your surveys as a CSV file, too. - -While you can download the code for Quick Survey from GitHub, it's currently optimized for [Sandstorm.io][10] and [Sandstorm Oasis][11] where you can grab it from the [Sandstorm App Market][12]. - -### TellForm - -In terms of features, [TellForm][13] lies somewhere between LimeSurvey and Quick Survey. It's one of those tools for people who need more than a minimal set of functions, but who don't need everything and the kitchen sink. - -In addition to having 11 different types of surveys, TellForm has pretty good analytics attached to its surveys. You can easily customize the look and feel of your surveys, and the application's interface is simple and clean. - -If you want to host TellForm yourself, you can grab the code from the [GitHub repository][14]. Or, you can sign up for a [free hosted account][15]. - -* * * - -Do you have a favorite open source tool for doing online surveys? Feel free to share it with our community by leaving a comment. - --------------------------------------------------------------------------------- - -作者简介: - -Scott Nesbitt - Writer. Editor. Soldier of fortune. Ocelot wrangler. Husband and father. Blogger. Collector of pottery. Scott is a few of these things. He's also a long-time user of free/open source software who extensively writes and blogs about it. You can find Scott on Twitter, GitHub - --------------------------------------------------------------------------------- - - -via: https://opensource.com/article/17/2/tools-online-surveys-polls - -作者:[Scott Nesbitt ][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/scottnesbitt -[1]:https://opensource.com/article/17/2/tools-online-surveys-polls?rate=IvQATPRT8VEAJbe667E6i5txmmDenX8cL7YtkAxasWQ -[2]:https://www.limesurvey.org/ -[3]:https://www.limesurvey.org/about-limesurvey/features -[4]:https://www.limesurvey.org/services -[5]:https://www.jdsoft.com/jd-esurvey.html -[6]:https://www.ada.gov/508/ -[7]:https://github.com/JD-Software/JDeSurvey -[8]:https://github.com/JD-Software/JDeSurvey/wiki/Download-and-Installation -[9]:https://github.com/simonv3/quick-survey/ -[10]:http://sandstorm.io/ -[11]:http://oasis.sandstorm.io/ -[12]:https://apps.sandstorm.io/app/wupmzqk4872vgsye9t9x5dmrdw17mad97dk21jvcm2ph4jataze0 -[13]:https://www.tellform.com/ -[14]:https://github.com/whitef0x0/tellform -[15]:https://admin.tellform.com/#!/signup -[16]:https://opensource.com/user/14925/feed -[17]:https://opensource.com/article/17/2/tools-online-surveys-polls#comments -[18]:https://opensource.com/users/scottnesbitt diff --git a/translated/tech/20170208 4 open source tools for conducting online surveys.md b/translated/tech/20170208 4 open source tools for conducting online surveys.md new file mode 100644 index 0000000000..262e7efb57 --- /dev/null +++ b/translated/tech/20170208 4 open source tools for conducting online surveys.md @@ -0,0 +1,85 @@ +4 个开源的指导在线调查的工具 +============================================================ + + + ![4 open source tools for doing online surveys](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_question_B.png?itok=UVCz8ld_ "4 open source tools for doing online surveys") +图片提供: opensource.com + +啊,一个好的调查。它会是一个以快速、简单、便宜、有效的方式收集朋友、家人、同学、同事、客户、读者和其他人的意见。 + +许多人开始使用专有工具,如 SurveyGizmo、Polldaddy、SurveyMonkey 甚至 Google 表单来设置他们的调查。但是如果你想不仅对应用程序还有你收集的数据有更多的控制,那么你会选择开源工具。 + +让我们来看看四个开源调查工具,无论这些需求是多么简单或复杂,它们都可以满足你的需求。 + +### LimeSurvey + +[LimeSurvey][2]是一个可以做任何你想要的一切的一个调查工具。你可以使用 LimeSurvey 进行简单的调查和投票,以及跨越多个页面的更复杂的调查和投票。如果你使用多种语言,LimeSurvey 支持其中的 80 种。 + +LimeSurvey 还允许你使用自己的 JavaScript、照片和视频自定义调查,甚至直接编辑调查的 HTML。所有这一切只是[它的功能][3]的一部分。 + +你可以在自己的服务器上安装 LimeSurvey,或者[购买一个托管计划][4],这将使你每年花费数百欧元(尽管还有一个免费选项)。 + +### JD Esurvey + +如果 LimeSurvey 没有为你提供足够的功能,同时你接受 Java 驱动的 web 程序,那么我推荐 [JD Esurvey][5]。它被称为“一个开源企业调查 web 程序”。它绝对强大,并为那些寻找大容量,强大的调查工具的组织解决了问题。 + +使用 JD Esurvey,你可以收集一系列信息,包括 “是/否” 问题的答案以及产品和服务的星级。你甚至可以处理多个部分的问题的答案。JD Esurvey 支持使用平板电脑和智能手机创建和管理调查,你发布的调查也是移动友好的。根据开发者的说法,该程序[残疾人也可使用][6]。 + +要使用它,你可以[在 GitHub 上 fork JD Esurvey][7]或者[下载并安装][8]程序的预编译版本。 + +### Quick Survey + +对于很多人来说,像 LimeSurvey 和 JD Esurvey 这样的工具是过度的。我们只是想要一个快速、肮脏的方式来收集意见或反馈。这里推荐[Quick Survey][9]。 + +Quick Survey 只允许你创建问答和多选列表调查。你可以添加问题或创建列表,然后发布并共享网址。你可以根据需要在调查中添加任意数量的条目,回复将显示在 Quick Survey 的管理页面上。你也可以将调查结果下载为 CSV 文件。 + +虽然你可以从 GitHub 下载 Quick Survey 的代码,但它目前针对 [Sandstorm.io][10]和 [Sandstorm Oasis][11]进行了优化,你可以从 [Sandstorm 应用市场][12]中获取。 + +### TellForm + +在功能方面,[TellForm][13]位于 LimeSurvey 和 Quick Survey 之间。它是那些不只需要最少功能,但也不需要完全功能的人的工具之一。 + +除了有 11 种不同类型的调查之外,TellForm 还有很好的分析功能。你可以轻松地自定义调查的外观和感觉,而且程序的界面简单干净。 + +如果你想自己托管 TellForm,你可以从[ GitHub 仓库][14]中获取代码。或者,你可以注册[免费托管帐户][15]。 + +* * * + +你有你最喜欢的的做在线调查的开源工具么?请在评论区与我们的社区分享。 + +-------------------------------------------------------------------------------- + +作者简介: + +Scott Nesbitt - 作家、编辑、江湖客(Soldier of fortune)、豹猫牧马人(Ocelot wrangler)、丈夫和父亲、博客主、陶器收藏家。Scott 是以上的混合体。他也是一个自由/开源软件的长期用户,他为此写了很多[博客][12]。你可以在 [Twitter][13]、[GitHub][14] 找到他。 + +-------------------------------------------------------------------------------- + + +via: https://opensource.com/article/17/2/tools-online-surveys-polls + +作者:[Scott Nesbitt ][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/scottnesbitt +[1]:https://opensource.com/article/17/2/tools-online-surveys-polls?rate=IvQATPRT8VEAJbe667E6i5txmmDenX8cL7YtkAxasWQ +[2]:https://www.limesurvey.org/ +[3]:https://www.limesurvey.org/about-limesurvey/features +[4]:https://www.limesurvey.org/services +[5]:https://www.jdsoft.com/jd-esurvey.html +[6]:https://www.ada.gov/508/ +[7]:https://github.com/JD-Software/JDeSurvey +[8]:https://github.com/JD-Software/JDeSurvey/wiki/Download-and-Installation +[9]:https://github.com/simonv3/quick-survey/ +[10]:http://sandstorm.io/ +[11]:http://oasis.sandstorm.io/ +[12]:https://apps.sandstorm.io/app/wupmzqk4872vgsye9t9x5dmrdw17mad97dk21jvcm2ph4jataze0 +[13]:https://www.tellform.com/ +[14]:https://github.com/whitef0x0/tellform +[15]:https://admin.tellform.com/#!/signup +[16]:https://opensource.com/user/14925/feed +[17]:https://opensource.com/article/17/2/tools-online-surveys-polls#comments +[18]:https://opensource.com/users/scottnesbitt From a868b7add1bb375f9219bd1140ac899470cde558 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 7 Mar 2017 10:48:36 +0800 Subject: [PATCH 060/190] =?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 校对完毕 --- ...s guide to understanding sudo on Ubuntu.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md index 69ea90c302..d38c047227 100644 --- a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md +++ b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md @@ -114,14 +114,13 @@ Defaults env_reset ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) ][18] -然后在这行最后添加以下变量(下面用黑体字强调): +然后在这行最后添加以下变量: ``` -Defaults env_reset,**timestamp_timeout=[new-value]** +Defaults env_reset,timestamp_timeout=[new-value] ``` -[new-value] 为想要 sudo 会话持续的时间数。例如,用数值 40。 - +[new-value] 为想要 sudo 会话持续的时间数。例如,设数值为 40。 [ ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) @@ -151,14 +150,12 @@ Defaults env_reset,pwfeedback 现在,无论什么时候输入 sudo 密码,星号都会显示。 - [ ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) ][20] ## 一些重要的 sudo 命令行参数 - 除了 -u 命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 sudo 命令行参数值得注意。在这部分,我们将会讨论其中一些。 ### -k 参数 @@ -185,7 +182,7 @@ Defaults env_reset,pwfeedback ``` -s, --shell -如果 SHELL 环境变量设置了或者 shell 调用了用户的密码数据库,就能用它运行 shell 。如果指定了命令,命令将会通过 shell 的 -c 参数传递给 shell 执行。如果没有指定命令,一个交互式 shell 将会执行。 +如果设置了 SHELL 环境变量或者调用用户的密码数据库指定了 shell,就运行该 shell 。如果指定了命令,命令将会通过 shell 的 -c 参数传递给 shell 执行。如果没有指定命令,一个交互式 shell 将会执行。 ``` @@ -197,17 +194,17 @@ Defaults env_reset,pwfeedback *   如果你没有尝试执行其他命令(也就是说,你只是要运行 sudo -s),你将会得到一个有 root 权限的交互式的 shell。 -请记住,-s 命令行参数给你一个有 root 权限的 shell,但不是 root 环境 —— 你的 .bashrc 决定的。这意思是,例如在一个用 sudo -s 运行的新 shell 里,执行 whoami 命令仍会返回你的用户名,而非 root 。 +请记住,-s 命令行参数给你一个有 root 权限的 shell,但不是 root 环境 —— 那是由你的 .bashrc 决定的。例如,在 sudo -s 运行的新 shell 里,执行 whoami 命令仍会返回你的用户名,而非 root 。 ### -i 参数 --i 参数跟我们讨论过的 -s 参数相像。然而,还是有点区别。一个重要的区别是 -i 也给了你 root 环境,意味着你的(用户的).bashrc 被忽略。这就像没有明确指明用 root 登录也能成为 root 。此外,你也不用输入 root 用户密码。 +-i 参数跟我们讨论过的 -s 参数相像。然而,还是有点区别。一个重要的区别是 -i 也给了你 root 环境,意味着你的(用户的).bashrc 被忽略。这就像没有显式地用 root 登录也能成为 root 。此外,你也不用输入 root 用户密码。 -** 重要 **:请注意 **su** 命令也能让你切换用户(默认切换到 root )。这个命令需要你输入 root 密码。为了避免这一点,你可以使用 sudo 执行它(‘sudo su’),这样你只需要输入你的登录密码。然而,su 和 sudo su 有隐含的区别 —— 要了解它们,以及它们和 sudo -i 的区别,请看[这里][10] 。 +** 重要 **:请注意 **su** 命令也能让你切换用户(默认切换到 root )。这个命令需要你输入 root 密码。为了避免这一点,你可以使用 sudo 执行它(“sudo su”),这样你只需要输入你的登录密码。然而,su 和 sudo su 有隐含的区别 —— 要了解它们,以及它们和 sudo -i 的区别,请看[这里][10] 。 ### 总结 -我希望现在你至少知道了 sudo 的基本知识,和如何调整 sudo 的默认行为。请按我们解释过的那样全部尝试调整 /etc/sudoers 。同时也浏览一下论坛讨论(在最后一段中有链接)来更深入了解 sudo 命令。 +我希望现在你至少知道了 sudo 的基本知识,以及如何调整 sudo 的默认行为。请按我们解释过的那样全部尝试调整 /etc/sudoers 。同时也浏览一下论坛讨论来更深入了解 sudo 命令。 -------------------------------------------------------------------------------- From d23c2347a67ff42a8b3816be8d067c7ed5148a34 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 7 Mar 2017 10:51:58 +0800 Subject: [PATCH 061/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- ...0170208 4 open source tools for conducting online surveys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170208 4 open source tools for conducting online surveys.md b/translated/tech/20170208 4 open source tools for conducting online surveys.md index 262e7efb57..96395040dd 100644 --- a/translated/tech/20170208 4 open source tools for conducting online surveys.md +++ b/translated/tech/20170208 4 open source tools for conducting online surveys.md @@ -60,7 +60,7 @@ via: https://opensource.com/article/17/2/tools-online-surveys-polls 作者:[Scott Nesbitt ][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ff2deb7152c697cd218c6c11ba4bdc21366a01da Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 7 Mar 2017 14:44:29 +0800 Subject: [PATCH 062/190] =?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 校对完毕 @geekpi 谢谢 --- ...rce tools for conducting online surveys.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20170208 4 open source tools for conducting online surveys.md b/translated/tech/20170208 4 open source tools for conducting online surveys.md index 96395040dd..b030851d94 100644 --- a/translated/tech/20170208 4 open source tools for conducting online surveys.md +++ b/translated/tech/20170208 4 open source tools for conducting online surveys.md @@ -1,19 +1,19 @@ -4 个开源的指导在线调查的工具 +4 个开源在线调查工具 ============================================================ - ![4 open source tools for doing online surveys](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BIZ_question_B.png?itok=UVCz8ld_ "4 open source tools for doing online surveys") + 图片提供: opensource.com -啊,一个好的调查。它会是一个以快速、简单、便宜、有效的方式收集朋友、家人、同学、同事、客户、读者和其他人的意见。 +啊,一个好的调查,能够以快速、简单、便宜、有效的方式收集朋友、家人、同学、同事、客户、读者和其他人的意见。 -许多人开始使用专有工具,如 SurveyGizmo、Polldaddy、SurveyMonkey 甚至 Google 表单来设置他们的调查。但是如果你想不仅对应用程序还有你收集的数据有更多的控制,那么你会选择开源工具。 +许多人开始使用专有工具,如 SurveyGizmo、Polldaddy、SurveyMonkey 甚至 Google 表单来设置他们的调查。但是如果你想对应用还有收集到的数据有更多的控制,那么你会希望使用开源工具。 -让我们来看看四个开源调查工具,无论这些需求是多么简单或复杂,它们都可以满足你的需求。 +让我们来看看四个开源调查工具,无论需求简单还是复杂,它们都可以满足你的需求。 ### LimeSurvey -[LimeSurvey][2]是一个可以做任何你想要的一切的一个调查工具。你可以使用 LimeSurvey 进行简单的调查和投票,以及跨越多个页面的更复杂的调查和投票。如果你使用多种语言,LimeSurvey 支持其中的 80 种。 +[LimeSurvey][2] 是一个可以满足你几乎所有需求的调查工具。你可以使用 LimeSurvey 进行简单的调查和投票,以及跨越多个页面的更复杂的调查和投票。如果你使用多种语言,LimeSurvey 支持其中的 80 种。 LimeSurvey 还允许你使用自己的 JavaScript、照片和视频自定义调查,甚至直接编辑调查的 HTML。所有这一切只是[它的功能][3]的一部分。 @@ -21,7 +21,7 @@ LimeSurvey 还允许你使用自己的 JavaScript、照片和视频自定义调 ### JD Esurvey -如果 LimeSurvey 没有为你提供足够的功能,同时你接受 Java 驱动的 web 程序,那么我推荐 [JD Esurvey][5]。它被称为“一个开源企业调查 web 程序”。它绝对强大,并为那些寻找大容量,强大的调查工具的组织解决了问题。 +如果 LimeSurvey 没有为你提供足够的功能,并且对 Java 驱动的 web 程序感兴趣,那么我推荐 [JD Esurvey][5]。它被称为“一个开源的企业调查 web 应用”。它绝对强大,并满足了那些寻找大容量、健壮的调查工具的组织的很多需求。 使用 JD Esurvey,你可以收集一系列信息,包括 “是/否” 问题的答案以及产品和服务的星级。你甚至可以处理多个部分的问题的答案。JD Esurvey 支持使用平板电脑和智能手机创建和管理调查,你发布的调查也是移动友好的。根据开发者的说法,该程序[残疾人也可使用][6]。 @@ -29,15 +29,15 @@ LimeSurvey 还允许你使用自己的 JavaScript、照片和视频自定义调 ### Quick Survey -对于很多人来说,像 LimeSurvey 和 JD Esurvey 这样的工具是过度的。我们只是想要一个快速、肮脏的方式来收集意见或反馈。这里推荐[Quick Survey][9]。 +对于很多人来说,像 LimeSurvey 和 JD Esurvey 这样的工具过于复杂了。我们只是想要一个快速、简单易行的方式来收集意见或反馈。这里推荐 [Quick Survey][9]。 -Quick Survey 只允许你创建问答和多选列表调查。你可以添加问题或创建列表,然后发布并共享网址。你可以根据需要在调查中添加任意数量的条目,回复将显示在 Quick Survey 的管理页面上。你也可以将调查结果下载为 CSV 文件。 +Quick Survey 只允许你创建问答和多选调查列表。你可以添加问题或创建列表,然后发布并共享网址。你可以根据需要在调查中添加任意数量的条目,回复将显示在 Quick Survey 的管理页面上。你也可以将调查结果下载为 CSV 文件。 -虽然你可以从 GitHub 下载 Quick Survey 的代码,但它目前针对 [Sandstorm.io][10]和 [Sandstorm Oasis][11]进行了优化,你可以从 [Sandstorm 应用市场][12]中获取。 +虽然你可以从 GitHub 下载 Quick Survey 的代码,但它目前针对 [Sandstorm.io][10]和 [Sandstorm Oasis][11] 进行了优化,你可以从 [Sandstorm 应用市场][12]中获取。 ### TellForm -在功能方面,[TellForm][13]位于 LimeSurvey 和 Quick Survey 之间。它是那些不只需要最少功能,但也不需要完全功能的人的工具之一。 +在功能方面,[TellForm][13] 位于 LimeSurvey 和 Quick Survey 之间。它适合那些功能需求超出最小需求,但无需完全功能的人使用。 除了有 11 种不同类型的调查之外,TellForm 还有很好的分析功能。你可以轻松地自定义调查的外观和感觉,而且程序的界面简单干净。 @@ -51,7 +51,7 @@ Quick Survey 只允许你创建问答和多选列表调查。你可以添加问 作者简介: -Scott Nesbitt - 作家、编辑、江湖客(Soldier of fortune)、豹猫牧马人(Ocelot wrangler)、丈夫和父亲、博客主、陶器收藏家。Scott 是以上的混合体。他也是一个自由/开源软件的长期用户,他为此写了很多[博客][12]。你可以在 [Twitter][13]、[GitHub][14] 找到他。 +Scott Nesbitt - 作家、编辑、雇佣兵(Soldier of fortune)、豹猫牧人(Ocelot wrangler)、丈夫和父亲、博客主、陶器收藏家。Scott 是以上的混合体。他也是一个自由/开源软件的长期用户,他为此写了很多[博客][12]。你可以在 [Twitter][13]、[GitHub][14] 找到他。 -------------------------------------------------------------------------------- From effa77f38bc09f2cb2cf612ed3f992cf5456c9de Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 7 Mar 2017 14:46:36 +0800 Subject: [PATCH 063/190] =?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 校对完毕 又调下格式 --- ...70208 4 open source tools for conducting online surveys.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20170208 4 open source tools for conducting online surveys.md b/translated/tech/20170208 4 open source tools for conducting online surveys.md index b030851d94..9e7b0aff0b 100644 --- a/translated/tech/20170208 4 open source tools for conducting online surveys.md +++ b/translated/tech/20170208 4 open source tools for conducting online surveys.md @@ -25,7 +25,7 @@ LimeSurvey 还允许你使用自己的 JavaScript、照片和视频自定义调 使用 JD Esurvey,你可以收集一系列信息,包括 “是/否” 问题的答案以及产品和服务的星级。你甚至可以处理多个部分的问题的答案。JD Esurvey 支持使用平板电脑和智能手机创建和管理调查,你发布的调查也是移动友好的。根据开发者的说法,该程序[残疾人也可使用][6]。 -要使用它,你可以[在 GitHub 上 fork JD Esurvey][7]或者[下载并安装][8]程序的预编译版本。 +要使用它,你可以[在 GitHub 上 fork JD Esurvey][7] 或者[下载并安装][8]程序的预编译版本。 ### Quick Survey @@ -33,7 +33,7 @@ LimeSurvey 还允许你使用自己的 JavaScript、照片和视频自定义调 Quick Survey 只允许你创建问答和多选调查列表。你可以添加问题或创建列表,然后发布并共享网址。你可以根据需要在调查中添加任意数量的条目,回复将显示在 Quick Survey 的管理页面上。你也可以将调查结果下载为 CSV 文件。 -虽然你可以从 GitHub 下载 Quick Survey 的代码,但它目前针对 [Sandstorm.io][10]和 [Sandstorm Oasis][11] 进行了优化,你可以从 [Sandstorm 应用市场][12]中获取。 +虽然你可以从 GitHub 下载 Quick Survey 的代码,但它目前针对 [Sandstorm.io][10] 和 [Sandstorm Oasis][11] 进行了优化,你可以从 [Sandstorm 应用市场][12]中获取。 ### TellForm From c396381b2d1ea099c6b79f1148ce7d1055556d5b Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 7 Mar 2017 15:00:26 +0800 Subject: [PATCH 064/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- ...ing System for Linux Gaming Which One Do You Use and Why.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md index 0cca9b800b..5867b08dbf 100644 --- a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md +++ b/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @@ -33,7 +33,7 @@ via: http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-w 作者:[Marius Nestor ][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bb4fb12742521868ce669ead5c005a46f6cd6e2b Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Tue, 7 Mar 2017 16:11:22 +0800 Subject: [PATCH 065/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E5=AE=8C=E6=AF=95=20?= =?UTF-8?q?@geekpi=20=E8=B0=A2=E8=B0=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对完毕 --- ...ux Gaming Which One Do You Use and Why.md | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md index 5867b08dbf..4db4b11dd8 100644 --- a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md +++ b/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @@ -1,31 +1,29 @@ Linux 游戏最好的操作系统:该选哪个以及为什么? ============================================================ +### 告诉我们哪个 Linux 发型版对游戏支持的最好 -### 告我我们哪个 Linux 发型版是对游戏支持最好的 - - -在过去几个月中,我们尝试了多种用于游戏的 GNU/Linux 发行版,我们得出的结论是没有完美的操作系统专为 Linux 游戏设计。 +在过去几个月中,出于游戏目的,我们尝试了多种 GNU/Linux 发行版,我们得出的结论是没有专为 Linux 游戏设计的完美的操作系统。 我们都知道,游戏世界在 Nvidia 和 AMD 用户之间分裂。现在,如果你使用的是 Nvidia 显卡,即使是五年前的一块显卡,也可以在大多数基于 Linux 的操作系统上使用,因为 Nvidia 为大多数(如果不是全部的话)GPU 提供了最新的视频驱动程序。 -当然,这意味着如果你有一块 Nvidia GPU,你不应该有大多数 GNU/Linux 发行版的任何主要问题。至少与游戏中的图形或其他性能问题无关,这将严重影响你的游戏体验。 +当然,这意味着如果你有一块 Nvidia GPU,在大多数 GNU/Linux 发行版上你不会有什么大问题。至少与游戏中的图形或其他性能问题无关,这将严重影响你的游戏体验。 AMD Radeon 用户最好的游戏发行版 -如果你使用 AMD Radeon GPU,事情会是完全不同的。我们都知道,AMD 的专有显卡驱动程序仍然需要大量的工作来兼容最新的 GNU/Linux 发行版本,以及所有的 AMD GPU,以及最新的 X.Org 服务端和 Linux 内核版本。 +如果你使用 AMD Radeon GPU,事情会是完全不同的。我们都知道,AMD 的专有显卡驱动程序仍然需要大量的工作来兼容最新的 GNU/Linux 发行版本,所有的 AMD GPU,以及最新的 X.Org 服务端和 Linux 内核版本。 -目前 AMDGPU-PRO 视频驱动程序只能在 Ubuntu 16.04 LTS、CentOS 6.8/7.3、Red Hat Enterprise Linux 6.8/7.3、SUSE Linux Enterprise Desktop 和 Server 12 SP2 上运行。除了 Ubuntu 16.04 LTS 之外,我们不知道为什么 AMD 为所有这些面向服务器和企业级的操作系统提供支持。 +目前,AMDGPU-PRO 视频驱动程序只能在 Ubuntu 16.04 LTS、CentOS 6.8/7.3、Red Hat Enterprise Linux 6.8/7.3、SUSE Linux Enterprise Desktop 和 Server 12 SP2 上运行。除了 Ubuntu 16.04 LTS 之外,我们不知道为什么 AMD 为所有这些面向服务器和企业级的操作系统提供支持。 我们不相信有 Linux 玩家会在这些系统上面玩游戏。[最新的 AMDGPU-PRO 更新][1]终于支持了HD 7xxx 和 8xxx 系列的 AMD Radeon GPU,但是如果我们不想使用 Ubuntu 16.04 LTS 呢? -另外我们有 Mesa 3D 图形库,这在大多数发行版上都有。Mesa 图形栈为我们的 AMD GPU 提供了功能强大的开源 Radeon 和 AMDGPU 驱动程序,但是为了享受最好的游戏体验,你还需要拥有最新的 X.Org 服务端和 Linux 内核。 +另外,我们有 Mesa 3D 图形库,这在大多数发行版上都有。Mesa 图形栈为我们的 AMD GPU 提供了功能强大的开源 Radeon 和 AMDGPU 驱动程序,但是为了享受最好的游戏体验,你还需要拥有最新的 X.Org 服务端和 Linux 内核。 -并不是所有的 Linux 操作系统都附带最新的 Mesa(13.0)、X.Org服务端(1.19)和 Linux 内核(4.9)版本,它们支持较旧的AMD GPU。有些只有一两种技术,但我们需要它们,内核需要编译 AMD Radeon Southern Islands 和 Sea Island 来支持 AMDGPU 驱动程序工作。 +并不是所有的 Linux 操作系统都附带最新的 Mesa(13.0)、X.Org 服务端(1.19)和 Linux 内核(4.9)版本,它们支持较旧的 AMD GPU。有些系统只有一两种技术,但我们这些都需要,而且内核需要编译 AMD Radeon Southern Islands 和 Sea Island 来支持 AMDGPU 驱动程序工作。 -我们发现整个情况相当令人沮丧,至少对于一些使用 AMD Radeon 老式一点显卡的玩家。现在,我们发现,使用 AMD Radeon HD 8xxx GPU 的最佳游戏体验只能通过使用 Git 和 Linux 内核 4.10 RC 的 Mesa 17 来实现。 +我们发现整个情况相当令人沮丧,至少对于一些使用 AMD Radeon 老式显卡的玩家。现在,我们发现,使用 AMD Radeon HD 8xxx GPU 的最佳游戏体验只能通过使用 Git 和 Linux 内核 4.10 RC 的 Mesa 17 来实现。 -所以我们现在请求你 - 如果你找到了游戏的完美的 GNU/Linux 发行版,无论你使用 AMD Radeon 还是 Nvidia GPU,但我们最感兴趣的是那些使用 AMD GPU,使用的是什么发行版,设置是什么,能不能玩最新的游戏后者有体验问题?谢谢! +所以我们现在请求你 - 如果你找到了玩游戏的完美的 GNU/Linux 发行版,无论你使用的是 AMD Radeon 还是 Nvidia GPU,但我们最感兴趣的是那些使用 AMD GPU 的玩家,请告知我们你使用的是什么发行版,设置是什么,能不能玩最新的游戏,或者有无体验问题。谢谢! -------------------------------------------------------------------------------- From 668b516b5ddfa5ba0edc6ec8c6a45636f4db121e Mon Sep 17 00:00:00 2001 From: xiaojin Date: Tue, 7 Mar 2017 20:47:22 +0800 Subject: [PATCH 066/190] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=9A=20Best=20Windows=20Like=20Linux=20Distributions=20For?= =?UTF-8?q?=20New=20Linux=20Users=20(#5237)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Delete 20170215 Best Windows Like Linux Distributions For New Linux Users.md 翻译完成,删除原文。 * 翻译完成_Best Windows Like Linux Distributions For New Linux Users --- ...Linux Distributions For New Linux Users.md | 72 ----------------- ...Linux Distributions For New Linux Users.md | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 72 deletions(-) delete mode 100644 sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md create mode 100644 translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md diff --git a/sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md b/sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md deleted file mode 100644 index 7b6dfb9140..0000000000 --- a/sources/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md +++ /dev/null @@ -1,72 +0,0 @@ -# rusking translating -# [Best Windows Like Linux Distributions For New Linux Users][12] - - -[ - ![Best Windows Like Linux Distributions](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/best-windows-like-linux-distributions_1_orig.jpg) -][5]Hey new Linux users, you may be wondering that which Linux distro to choose after seeing so many distros based on Linux. Most of you might be switching from windows to Linux and want those distros which are easy and simple, resemble like windows. So today I will cover those Linux distros whose Desktop Environment is much similar to windows, so let’s start. - -### Linux Mint - -[ - ![linux mint for new linux users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/linux-mint-for-new-linux-users.jpg?1487173522) -][6]The first distro on my list is the famous Linux distro i.e. “[Linux Mint”][14]. You might have heard about Linux mint somewhere when you decided to move from windows to Linux. It is considered as one of the best Linux distros alongside Ubuntu as it is very simple, powerful and easier to operate due to its famous Desktop environment cinnamon. [Cinnamon][15] is very easy to use and there are even [themes][16], icon pack, desklets, applets are available that you can use to make it fully look like any windows rather XP, 7, 8, or 10. [Cinnamon][17] is one of the famous DE in Linux world. You will surely find it easy, powerful and lovable.Also read - -[Linux Mint 18.1 "Serena" Is One Of The Finest Linux Distro -​][1][Cinnamon The Best Linux Desktop Environment For New Users][2] - -### Zorin OS - -[ - ![zorin os for windows users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/zorin-os-for-windows-users.jpg?1487174149) -][7][Zorin OS][18] is also the famous Linux distro replacement for windows 7\. Beautiful start menu, taskbar, animation while no compromise on speed and stability. Zorin OS will be the best choice for you if you love windows 7 and not windows 10\. It also comes with preloaded software, so you won't be troubled while looking for software. I was really fell in love with the animations and look. Go grab it.Also read - [Zorin OS 12 Review | LinuxAndUbuntu Distro Review Of The Week][3] - -### Robolinux - -[ - ![robolinux for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/robolinux-for-new-users.jpg?1487174455) -][8][Robolinux][9] is the Linux distribution that comes with built-in wine. Yeah! It has built-in support for windows applications so you won't miss your favorite applications from Windows. They call it “[Stealth VM][10]”. I was really impressed by this feature as it is unique. Also, there are a lot of DE, so can choose any DE that will suit your needs and love. They also have a tool to copy your whole C drive, so no file misses out. Unique. Isn’t it? - -### ChaletOS - -[ - ![chalet os for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/chalet-os-for-new-users.jpg?1487174713) -][11]Did someone say [ChaletOS][19]? It is one of those [Linux distros][20] that feature the closest look and feel to windows. The above pic is after I used windows 10 icons and theme, so you get the idea that it can be easily themed. Pre Handy apps also help to make distro better. You will really feel at home while using it. It's screenshot even fooled my friends. Go ahead and try it, you will love it.Also read - [ChaletOS A New Beautiful Linux Distribution][4] - -### Conclusion - -I wanted to keep this list as short as possible as I didn’t want to confuse a new user to find it difficult to choose among so many options. Still many users have got a distro that isn’t mentioned here. I would invite you to comment below your distro and help new Linux user to choose his best distro for the first time. -​ -Well, these four were the most used **Linux distros** to switch from windows to Linux, however Kubuntu, Elementary OS also put a competition. It overall depends upon users. Most of time [Linux Mint][21] always comes as a winner. I will really recommend it to you if this is your first time to Linux. Go ahead and grab your Linux today and be the part of change. | - --------------------------------------------------------------------------------- - -via: http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users - -作者:[linuxandubuntu.com][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users -[1]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever -[2]:http://www.linuxandubuntu.com/home/cinnamon-desktop-the-best-desktop-environment-for-new-linux-user -[3]:http://www.linuxandubuntu.com/home/zorin-os-12-review-linuxandubuntu-distro-review-of-the-week -[4]:http://www.linuxandubuntu.com/home/chaletos-new-beautiful-linux-distribution-based-on-xubuntu-and-a-clone-of-windows -[5]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users -[6]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/linux-mint-for-new-linux-users_orig.jpg -[7]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/zorin-os-for-windows-users_orig.jpg -[8]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/robolinux-for-new-users_orig.jpg -[9]:https://www.robolinux.org/ -[10]:https://www.robolinux.org/stealth-vm-info/ -[11]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/chalet-os-for-new-users_orig.jpg -[12]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users -[13]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users#comments -[14]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever -[15]:http://www.developer.linuxmint.com/ -[16]:http://www.linuxandubuntu.com/linux-themes/mintilicious-cinnamon-theme-install-in-linux-mint -[17]:http://www.linuxandubuntu.com/linux-apps-releases/cinnamon-2610 -[18]:https://zorinos.com/ -[19]:https://sites.google.com/site/chaletoslinux/home -[20]:http://www.linuxandubuntu.com/home/how-to-create-a-linux-distro -[21]:http://www.linuxandubuntu.com/home/linux-mint-18-sarah-review diff --git a/translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md b/translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md new file mode 100644 index 0000000000..f14b1d2868 --- /dev/null +++ b/translated/tech/20170215 Best Windows Like Linux Distributions For New Linux Users.md @@ -0,0 +1,80 @@ +# [Best Windows Like Linux Distributions For New Linux Users][12] + [给新手的最佳类 Windows 界面的 Linux 发行版][12] + +[ + ![Best Windows Like Linux Distributions](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/best-windows-like-linux-distributions_1_orig.jpg) +][5] + +Linux 世界的新同学们,大家好,当你看到这么多基于 Linux 内核的发行版后,是不是在选择的过程中无从下手呢。很多同学都是刚刚从熟悉的 Windows 系统来到陌生的 Linux 世界里,都希望使用一款即简单易用,又跟 Windows 长得很像的 Linux 发行版,因此我今天将给大家介绍几款这样的 Linux 发行版,它们的桌面环境跟 Windows 系统界面十分相似,咱们开始吧! + +### Linux Mint + +[ + ![linux mint for new linux users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/linux-mint-for-new-linux-users.jpg?1487173522) +][6] + +我给大家介绍的第一款非常流行的 Linux 发行版就是 “[Linux Mint 操作系统”][14] 。当你决定使用 Linux 系统来代替 Windows 系统时,你应该在某些地方听说过 Linux Mint 这个发行版吧。 Linux Mint 和 Ubuntu 系统一样被公认为是最好用的 Linux 发行版之一, Linux Mint 系统因其简洁易用、功能强大的 Cinnamon 桌面环境而出名。 [Cinnamon][15] 使用起来非常简单,而且你还可以使用各种[桌面主题][16]、图标库、桌面小工具和应用组件来把 Linux Mint 系统配置得跟 Windows XP 、 Windows 7 、 Winows 8 或者 Windows 10 系统的界面一样。 [Cinnamon][17] 也是 Linux 系统中非常流行的桌面环境之一。你一定会对这个简单易用、功能强大的桌面环境爱不释手。同时,你也可以阅读这两篇文章 [Linux Mint 18.1 "Serena" —— 最幽雅的 Linux 发行版之一​][1] 以及 [Cinnamon ——给新手的最佳 Linux 桌面环境][2] 来进一步了解 Linux Mint 操作系统和 Cinnamon 桌面环境。 + +### Zorin OS + +[ + ![zorin os for windows users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/zorin-os-for-windows-users.jpg?1487174149) +][7] + +[Zorin OS 操作系统][18] 也是可以用来替代 Windows 7\ 系统的一款非常流行的 Linux 发行版。其开始菜单和任务栏非常漂亮,整体界面美观充满活力,而且在速度和稳定性方面也相当出色。如果你喜欢的是 Windows 7 而不是 Windows 10\ 系统,那么 Zorin OS 将会是你最好的选择。 Zorin OS 同样预安装了很多软件,因此你再也不用费尽周折的去找软件来安装了。其华丽的仿 Windows 7 系统的界面风格更是让人一见如故。大胆去尝试吧。你还可以阅读[Zorin OS 12 评测 | 本周 Linux 和 Ubuntu 发行版评测][3]这篇文章来进一步了解 Zorin OS 系统。 + +### Robolinux + +[ + ![robolinux for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/robolinux-for-new-users.jpg?1487174455) +][8] + +[Robolinux 操作系统][9] 是一个内嵌了 Windows 运行环境的 Linux 发行版。它支持用户在 Linux 系统中运行 Windows 应用程序,因此,你再也不用担心自己喜欢的 Windows 应用程序在 Linux 系统中无法使用的问题了。在 Robolinux 系统中,这个特性被称为“[隐形虚拟机][10]”。我对这个新颖独特的功能非常感兴趣。同时, Rololinux 系统还包括其它几个桌面环境,你可以根据自己的喜好选择某一个桌面环境。这个系统中还有一个用于完全备份 C 盘的工具,不会让你丢失任何文件。很独特吧,对不对? + +### ChaletOS + +[ + ![chalet os for new users](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/chalet-os-for-new-users.jpg?1487174713) +][11] + +大家有谁用过 [ChaletOS 操作系统][19] 吗?这是一款在界面外观和使用感觉上最接近于 Windows 的 [Linux 发行版][20] 之一。上面的截图是在我使用了 Windows 10 图标和主题包后的效果,使用这个主题包后,可以让 ChaletOS 的桌面变得和 Windows 10 界面一样。一些预安装的应用程序也可以帮助你更好的使用 ChaletOS 系统。在使用的过程中你仿佛又回到了熟悉的 Windows 世界里。上面的截图竟然让我的朋友们信以为真了。去试一试吧,你肯定会喜欢这个发行版。你还可以通过 [ChaletOS —— Linux 发行版中的新秀][4] 这篇文章来进一步了解 ChaletOS 系统。 + +### 总结 + +这篇文章中列出的发行版我尽量写得简短一些,否则会给新手们在选择的过程中造成太多的困惑,无从下手。还有一些大家正在使用的 Linux 发行版在本文中并未提及。希望你们在下面的评论中提出来,以帮助我们的新朋友们在选择 Linux 发行版的过程中作出正确的选择。 + +​ +好吧,到此为止吧,这 4 款操作系统都是从 Windows 转向 Linux 的新用户在学习过程中使用最广泛的 **Linux 发行版** ,当然 Kubuntu 和 Elementary OS 系统也不甘示弱。想安装哪个版本,完全由你自己决定。大多数情况下 [Linux Mint 操作系统][21] 一直独占鳌头。如果你刚踏入 Linux 的世界,我建议你从 Linux Mint 系统开始。行动起来吧,现在就安装一个自己喜欢的 Linux 系统,勇往直前,成为改变 Linux 开源世界的一员。| + +-------------------------------------------------------------------------------- + +via: http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users + +作者:[linuxandubuntu.com][a] +译者:[rusking](https://github.com/rusking) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users +[1]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever +[2]:http://www.linuxandubuntu.com/home/cinnamon-desktop-the-best-desktop-environment-for-new-linux-user +[3]:http://www.linuxandubuntu.com/home/zorin-os-12-review-linuxandubuntu-distro-review-of-the-week +[4]:http://www.linuxandubuntu.com/home/chaletos-new-beautiful-linux-distribution-based-on-xubuntu-and-a-clone-of-windows +[5]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users +[6]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/linux-mint-for-new-linux-users_orig.jpg +[7]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/zorin-os-for-windows-users_orig.jpg +[8]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/robolinux-for-new-users_orig.jpg +[9]:https://www.robolinux.org/ +[10]:https://www.robolinux.org/stealth-vm-info/ +[11]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/chalet-os-for-new-users_orig.jpg +[12]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users +[13]:http://www.linuxandubuntu.com/home/best-windows-like-linux-distributions-for-new-linux-users#comments +[14]:http://www.linuxandubuntu.com/home/linux-mint-181-sarah-one-of-the-finest-linux-distro-ever +[15]:http://www.developer.linuxmint.com/ +[16]:http://www.linuxandubuntu.com/linux-themes/mintilicious-cinnamon-theme-install-in-linux-mint +[17]:http://www.linuxandubuntu.com/linux-apps-releases/cinnamon-2610 +[18]:https://zorinos.com/ +[19]:https://sites.google.com/site/chaletoslinux/home +[20]:http://www.linuxandubuntu.com/home/how-to-create-a-linux-distro +[21]:http://www.linuxandubuntu.com/home/linux-mint-18-sarah-review From 459177b42232e24f486c45473ced89f4e70e8f0f Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 20:57:05 +0800 Subject: [PATCH 067/190] =?UTF-8?q?20170307-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20170111 Git in 2016.md | 726 +++++++++++++++++++++++++++ 1 file changed, 726 insertions(+) create mode 100644 sources/tech/20170111 Git in 2016.md diff --git a/sources/tech/20170111 Git in 2016.md b/sources/tech/20170111 Git in 2016.md new file mode 100644 index 0000000000..95df7aa668 --- /dev/null +++ b/sources/tech/20170111 Git in 2016.md @@ -0,0 +1,726 @@ + + +Git in 2016 +============================================================ + + ![](https://cdn-images-1.medium.com/max/2000/1*1SiSsLMsNSyAk6khb63W9g.png) + + +Git had a  _huge_  year in 2016, with five feature releases[¹][57] ( _v2.7_  through  _v2.11_ ) and sixteen patch releases[²][58]. 189 authors[³][59] contributed 3,676 commits[⁴][60] to `master`, which is up 15%[⁵][61] over 2015! In total, 1,545 files were changed with 276,799 lines added and 100,973 lines removed[⁶][62]. + +However, commit counts and LOC are pretty terrible ways to measure productivity. Until deep learning develops to the point where it can qualitatively grok code, we’re going to be stuck with human judgment as the arbiter of productivity. + +With that in mind, I decided to put together a retrospective of sorts that covers changes improvements made to six of my favorite Git features over the course of the year. This article is pretty darn long for a Medium post, so I will forgive you if you want to skip ahead to a feature that particularly interests you: + +* [Rounding out the ][41]`[git worktree][25]`[ command][42] +* [More convenient ][43]`[git rebase][26]`[ options][44] +* [Dramatic performance boosts for ][45]`[git lfs][27]` +* [Experimental algorithms and better defaults for ][46]`[git diff][28]` +* `[git submodules][29]`[ with less suck][47] +* [Nifty enhancements to ][48]`[git stash][30]` + +Before we begin, note that many operating systems ship with legacy versions of Git, so it’s worth checking that you’re on the latest and greatest. If running `git --version` from your terminal returns anything less than Git `v2.11.0`, head on over to Atlassian's quick guide to [upgrade or install Git][63] on your platform of choice. + +### [`Citation` needed] + +One more quick stop before we jump into the qualitative stuff: I thought I’d show you how I generated the statistics from the opening paragraph (and the rather over-the-top cover image). You can use the commands below to do a quick  _year in review_  for your own repositories as well! + +``` +¹ Tags from 2016 matching the form vX.Y.0 +``` + +``` +$ git for-each-ref --sort=-taggerdate --format \ +'%(refname) %(taggerdate)' refs/tags | grep "v\d\.\d*\.0 .* 2016" +``` + +``` +² Tags from 2016 matching the form vX.Y.Z +``` + +``` +$ git for-each-ref --sort=-taggerdate --format '%(refname) %(taggerdate)' refs/tags | grep "v\d\.\d*\.[^0] .* 2016" +``` + +``` +³ Commits by author in 2016 +``` + +``` +$ git shortlog -s -n --since=2016-01-01 --until=2017-01-01 +``` + +``` +⁴ Count commits in 2016 +``` + +``` +$ git log --oneline --since=2016-01-01 --until=2017-01-01 | wc -l +``` + +``` +⁵ ... and in 2015 +``` + +``` +$ git log --oneline --since=2015-01-01 --until=2016-01-01 | wc -l +``` + +``` +⁶ Net LOC added/removed in 2016 +``` + +``` +$ git diff --shortstat `git rev-list -1 --until=2016-01-01 master` \ + `git rev-list -1 --until=2017-01-01 master` +``` + +The commands above were are run on Git’s `master` branch, so don’t represent any unmerged work on outstanding branches. If you use these command, remember that commit counts and LOC are not metrics to live by. Please don’t use them to rate the performance of your teammates! + +And now, on with the retrospective… + +### Rounding out Git worktrees + +The `git worktree` command first appeared in Git v2.5 but had some notable enhancements in 2016\. Two valuable new features were introduced in v2.7 — the `list` subcommand, and namespaced refs for bisecting — and the `lock`/`unlock` subcommands were implemented in v2.10. + +#### What’s a worktree again? + +The `[git worktree][49]` command lets you check out and work on multiple repository branches in separate directories simultaneously. For example, if you need to make a quick hotfix but don't want to mess with your working copy, you can check out a new branch in a new directory with: + +``` +$ git worktree add -b hotfix/BB-1234 ../hotfix/BB-1234 +Preparing ../hotfix/BB-1234 (identifier BB-1234) +HEAD is now at 886e0ba Merged in bedwards/BB-13430-api-merge-pr (pull request #7822) +``` + +Worktrees aren’t just for branches. You can check out multiple tags as different worktrees in order to build or test them in parallel. For example, I created worktrees from the Git v2.6 and v2.7 tags in order to examine the behavior of different versions of Git: + +``` +$ git worktree add ../git-v2.6.0 v2.6.0 +Preparing ../git-v2.6.0 (identifier git-v2.6.0) +HEAD is now at be08dee Git 2.6 +``` + +``` +$ git worktree add ../git-v2.7.0 v2.7.0 +Preparing ../git-v2.7.0 (identifier git-v2.7.0) +HEAD is now at 7548842 Git 2.7 +``` + +``` +$ git worktree list +/Users/kannonboy/src/git 7548842 [master] +/Users/kannonboy/src/git-v2.6.0 be08dee (detached HEAD) +/Users/kannonboy/src/git-v2.7.0 7548842 (detached HEAD) +``` + +``` +$ cd ../git-v2.7.0 && make +``` + +You could use the same technique to build and run different versions of your own applications side-by-side. + +#### Listing worktrees + +The `git worktree list` subcommand (introduced in Git v2.7) displays all of the worktrees associated with a repository: + +``` +$ git worktree list +/Users/kannonboy/src/bitbucket/bitbucket 37732bd [master] +/Users/kannonboy/src/bitbucket/staging d5924bc [staging] +/Users/kannonboy/src/bitbucket/hotfix-1234 37732bd [hotfix/1234] +``` + +#### Bisecting worktrees + +`[git bisect][50]` is a neat Git command that lets you perform a binary search of your commit history. It's usually used to find out which commit introduced a particular regression. For example, if a test is failing on the tip commit of my `master` branch, I can use `git bisect` to traverse the history of my repository looking for the commit that first broke it: + +``` +$ git bisect start +``` + +``` +# indicate the last commit known to be passing the tests +# (e.g. the latest release tag) +$ git bisect good v2.0.0 +``` + +``` +# indicate a known broken commit (e.g. the tip of master) +$ git bisect bad master +``` + +``` +# tell git bisect a script/command to run; git bisect will +# find the oldest commit between "good" and "bad" that causes +# this script to exit with a non-zero status +$ git bisect run npm test +``` + +Under the hood, bisect uses refs to track the good and bad commits used as the upper and lower bounds of the binary search range. Unfortunately for worktree fans, these refs were stored under the generic `.git/refs/bisect`namespace, meaning that `git bisect` operations that are run in different worktrees could interfere with each other. + +As of v2.7, the bisect refs have been moved to`.git/worktrees/$worktree_name/refs/bisect`, so you can run bisect operations concurrently across multiple worktrees. + +#### Locking worktrees + +When you’re finished with a worktree, you can simply delete it and then run `git worktree prune` or wait for it to be garbage collected automatically. However, if you're storing a worktree on a network share or removable media, then it will be cleaned up if the worktree directory isn't accessible during pruning — whether you like it or not! Git v2.10 introduced the `git worktree lock` and `unlock` subcommands to prevent this from happening: + +``` +# to lock the git-v2.7 worktree on my USB drive +$ git worktree lock /Volumes/Flash_Gordon/git-v2.7 --reason \ +"In case I remove my removable media" +``` + +``` +# to unlock (and delete) the worktree when I'm finished with it +$ git worktree unlock /Volumes/Flash_Gordon/git-v2.7 +$ rm -rf /Volumes/Flash_Gordon/git-v2.7 +$ git worktree prune +``` + +The `--reason` flag lets you leave a note for your future self, describing why the worktree is locked. `git worktree unlock` and `lock` both require you to specify the path to the worktree. Alternatively, you can `cd` to the worktree directory and run `git worktree lock .` for the same effect. + +### More Git r`ebase` options + +In March, Git v2.8 added the ability to interactively rebase whilst pulling with a `git pull --rebase=interactive`. Conversely, June's Git v2.9 release implemented support for performing a rebase exec without needing to drop into interactive mode via `git rebase -x`. + +#### Re-wah? + +Before we dive in, I suspect there may be a few readers who aren’t familiar or completely comfortable with the rebase command or interactive rebasing. Conceptually, it’s pretty simple, but as with many of Git’s powerful features, the rebase is steeped in some complex-sounding terminology. So, before we dive in, let’s quickly review what a rebase is. + +Rebasing means rewriting one or more commits on a particular branch. The `git rebase` command is heavily overloaded, but the name rebase originates from the fact that it is often used to change a branch's base commit (the commit that you created the branch from). + +Conceptually, rebase unwinds the commits on your branch by temporarily storing them as a series of patches, and then reapplying them in order on top of the target commit. + + + ![](https://cdn-images-1.medium.com/max/800/1*mgyl38slmqmcE4STS56nXA.gif) + +Rebasing a feature branch on master (`git rebase master`) is a great way to "freshen" your feature branch with the latest changes from master. For long-lived feature branches, regular rebasing minimizes the chance and severity of conflicts down the road. + +Some teams also choose to rebase immediately before merging their changes onto master in order to achieve a fast-forward merge (`git merge --ff ` ). Fast-forwarding merges your commits onto master by simply making the master ref point at the tip of your rewritten branch without creating a merge commit: + + ![](https://cdn-images-1.medium.com/max/800/1*QXa3znQiuNWDjxroX628VA.gif) + +Rebasing is so convenient and powerful that it has been baked into some other common Git commands, such as `git pull`. If you have some unpushed changes on your local master branch, running `git pull` to pull your teammates' changes from the origin will create an unnecessary merge commit: + + ![](https://cdn-images-1.medium.com/max/800/1*IxDdJ5CygvSWdD8MCNpZNg.gif) + +This is kind of messy, and on busy teams, you’ll get heaps of these unnecessary merge commits. `git pull --rebase` rebases your local changes on top of your teammates' without creating a merge commit: + + + ![](https://cdn-images-1.medium.com/max/800/1*HcroDMwBE9m21-hOeIwRmw.gif) + +This is pretty neat! Even cooler, Git v2.8 introduced a feature that lets you rebase  _interactively_  whilst pulling. + +#### Interactive rebasing + +Interactive rebasing is a more powerful form of rebasing. Like a standard rebase, it rewrites commits, but it also gives you a chance to modify them interactively as they are reapplied onto the new base. + +When you run `git rebase --interactive` (or `git pull --rebase=interactive`), you'll be presented with a list of commits in your text editor of choice: + +``` +$ git rebase master --interactive +``` + +``` +pick 2fde787 ACE-1294: replaced miniamalCommit with string in test +pick ed93626 ACE-1294: removed pull request service from test +pick b02eb9a ACE-1294: moved fromHash, toHash and diffType to batch +pick e68f710 ACE-1294: added testing data to batch email file +``` + +``` +# Rebase f32fa9d..0ddde5f onto f32fa9d (4 commands) +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup = like "squash", but discard this commit's log message +# x, exec = run command (the rest of the line) using shell +# d, drop = remove commit +# +# These lines can be re-ordered; they are executed from top to +# bottom. +# +# If you remove a line here THAT COMMIT WILL BE LOST. +``` + +Notice that each commit has the word `pick` next to it. That's rebase-speak for, "Keep this commit as-is." If you quit your text editor now, it will perform a normal rebase as described in the last section. However, if you change `pick` to `edit` or one of the other rebase commands, rebase will let you mutate the commit before it is reapplied! There are several available rebase commands: + +* `reword`: Edit the commit message. +* `edit`: Edit the files that were committed. +* `squash`: Combine the commit with the previous commit (the one above it in the file), concatenating the commit messages. +* `fixup`: Combine the commit with the commit above it, and uses the previous commit's log message verbatim (this is handy if you created a second commit for a small change that should have been in the original commit, i.e., you forgot to stage a file). +* `exec`: Run an arbitrary shell command (we'll look at a neat use-case for this later, in the next section). +* `drop`: This kills the commit. + +You can also reorder commits within the file, which changes the order in which they’re reapplied. This is handy if you have interleaved commits that are addressing different topics and you want to use `squash` or `fixup` to combine them into logically atomic commits. + +Once you’ve set up the commands and saved the file, Git will iterate through each commit, pausing at each `reword` and `edit` for you to make your desired changes and automatically applying any `squash`, `fixup`, `exec`, and `drop` commands for you. + +#### Non-interactive exec + +When you rebase, you’re essentially rewriting history by applying each of your new commits on top of the specified base. `git pull --rebase` can be a little risky because depending on the nature of the changes from the upstream branch, you may encounter test failures or even compilation problems for certain commits in your newly created history. If these changes cause merge conflicts, the rebase process will pause and allow you to resolve them. However, changes that merge cleanly may still break compilation or tests, leaving broken commits littering your history. + +However, you can instruct Git to run your project’s test suite for each rewritten commit. Prior to Git v2.9, you could do this with a combination of `git rebase −−interactive` and the `exec` command. For example, this: + +``` +$ git rebase master −−interactive −−exec=”npm test” +``` + +…would generate an interactive rebase plan that invokes `npm test` after rewriting each commit, ensuring that your tests still pass: + +``` +pick 2fde787 ACE-1294: replaced miniamalCommit with string in test +exec npm test +pick ed93626 ACE-1294: removed pull request service from test +exec npm test +pick b02eb9a ACE-1294: moved fromHash, toHash and diffType to batch +exec npm test +pick e68f710 ACE-1294: added testing data to batch email file +exec npm test +``` + +``` +# Rebase f32fa9d..0ddde5f onto f32fa9d (4 command(s)) +``` + +In the event that a test fails, rebase will pause to let you fix the tests (and apply your changes to that commit): + +``` +291 passing +1 failing +``` + +``` +1) Host request “after all” hook: +Uncaught Error: connect ECONNRESET 127.0.0.1:3001 +… +npm ERR! Test failed. +Execution failed: npm test +You can fix the problem, and then run + git rebase −−continue +``` + +This is handy, but needing to do an interactive rebase is a bit clunky. As of Git v2.9, you can perform a non-interactive rebase exec, with: + +``` +$ git rebase master -x “npm test” +``` + +Just replace `npm test` with `make`, `rake`, `mvn clean install`, or whatever you use to build and test your project. + +#### A word of warning + +Just like in the movies, rewriting history is risky business. Any commit that is rewritten as part of a rebase will have it’s SHA-1 ID changed, which means that Git will treat it as a totally different commit. If rewritten history is mixed with the original history, you’ll get duplicate commits, which can cause a lot of confusion for your team. + +To avoid this problem, you only need to follow one simple rule: + +> _Never rebase a commit that you’ve already pushed!_ + +Stick to that and you’ll be fine. + +### Performance boosts for `Git LFS` + +[Git is a distributed version control system][64], meaning the entire history of the repository is transferred to the client during the cloning process. For projects that contain large files — particularly large files that are modified regularly _ — _ the initial clone can be expensive, as every version of every file has to be downloaded by the client. [Git LFS (Large File Storage)][65] is a Git extension developed by Atlassian, GitHub, and a few other open source contributors that reduces the impact of large files in your repository by downloading the relevant versions of them lazily. Specifically, large files are downloaded as needed during the checkout process rather than during cloning or fetching. + +Alongside Git’s five huge releases in 2016, Git LFS had four feature-packed releases of its own: v1.2 through v1.5. You could write a retrospective series on Git LFS in its own right, but for this article, I’m going to focus on one of the most important themes tackled in 2016: speed. A series of improvements to both Git and Git LFS have greatly improved the performance of transferring files to and from the server. + +#### Long-running filter processes + +When you `git add` a file, Git's system of clean filters can be used to transform the file’s contents before being written to the Git object store. Git LFS reduces your repository size by using a clean filter to squirrel away large file content in the LFS cache and adds a tiny “pointer” file to the Git object store instead. + + + ![](https://cdn-images-1.medium.com/max/800/0*Ku328eca7GLOo7sS.png) + +Smudge filters are the opposite of clean filters — hence the name. When file content is read from the Git object store during a `git checkout`, smudge filters have a chance to transform it before it’s written to the user’s working copy. The Git LFS smudge filter transforms pointer files by replacing them with the corresponding large file, either from your LFS cache or by reading through to your Git LFS store on Bitbucket. + +![](https://cdn-images-1.medium.com/max/800/0*CU60meE1lbCuivn7.png) + +Traditionally, smudge and clean filter processes were invoked once for each file that was being added or checked out. So, a project with 1,000 files tracked by Git LFS invoked the `git-lfs-smudge` command 1,000 times for a fresh checkout! While each operation is relatively quick, the overhead of spinning up 1,000 individual smudge processes is costly. + +As of Git v2.11 (and Git LFS v1.5), smudge and clean filters can be defined as long-running processes that are invoked once for the first filtered file, then fed subsequent files that need smudging or cleaning until the parent Git operation exits. [Lars Schneider][66], who contributed long-running filters to Git, neatly summarized the impact of the change on Git LFS performance: + +> The filter process is 80x faster on macOS and 58x faster on Windows for the test repo with 12k files. On Windows, that means the tests runs in 57 seconds instead of 55 minutes! + +That’s a seriously impressive performance gain! + +#### Specialized LFS clones + +Long-running smudge and clean filters are great for speeding up reads and writes to the local LFS cache, but they do little to speed up transferring of large objects to and from your Git LFS server. Each time the Git LFS smudge filter can’t find a file in the local LFS cache, it has to make two HTTP calls to retrieve it: one to locate the file and one to download it. During a `git clone`, your local LFS cache is empty, so Git LFS will naively make two HTTP calls for every LFS tracked file in your repository: + + + ![](https://cdn-images-1.medium.com/max/800/0*ViL7r3ZhkGvF0z3-.png) + +Fortunately, Git LFS v1.2 shipped the specialized `[git lfs clone][51]` command. Rather than downloading files one at a time; `git lfs clone` disables the Git LFS smudge filter, waits until the checkout is complete, and then downloads any required files as a batch from the Git LFS store. This allows downloads to be parallelized and halves the number of required HTTP requests: + + ![](https://cdn-images-1.medium.com/max/800/0*T43VA0DYTujDNgkH.png) + +### Custom Transfer Adapters + +As discussed earlier, Git LFS shipped support for long running filter processes in v1.5\. However, support for another type of pluggable process actually shipped earlier in the year. Git LFS v1.3 included support for pluggable transfer adapters so that different Git LFS hosting services could define their own protocols for transferring files to and from LFS storage. + +As of the end of 2016, Bitbucket is the only hosting service to implement their own Git LFS transfer protocol via the [Bitbucket LFS Media Adapter][67]. This was done to take advantage of a unique feature of Bitbucket’s LFS storage API called chunking. Chunking means large files are broken down into 4MB chunks before uploading or downloading. + ![](https://cdn-images-1.medium.com/max/800/1*N3SpjQZQ1Ge8OwvWrtS1og.gif) + +Chunking gives Bitbucket’s Git LFS support three big advantages: + +1. Parallelized downloads and uploads. By default, Git LFS transfers up to three files in parallel. However, if only a single file is being transferred (which is the default behavior of the Git LFS smudge filter), it is transferred via a single stream. Bitbucket’s chunking allows multiple chunks from the same file to be uploaded or downloaded simultaneously, often dramatically improving transfer speed. +2. Resumable chunk transfers. File chunks are cached locally, so if your download or upload is interrupted, Bitbucket’s custom LFS media adapter will resume transferring only the missing chunks the next time you push or pull. +3. Deduplication. Git LFS, like Git itself, is content addressable; each LFS file is identified by a SHA-256 hash of its contents. So, if you flip a single bit, the file’s SHA-256 changes and you have to re-upload the entire file. Chunking allows you to re-upload only the sections of the file that have actually changed. To illustrate, imagine we have a 41MB spritesheet for a video game tracked in Git LFS. If we add a new 2MB layer to the spritesheet and commit it, we’d typically need to push the entire new 43MB file to the server. However, with Bitbucket’s custom transfer adapter, we only need to push ~7Mb: the first 4MB chunk (because the file’s header information will have changed) and the last 3MB chunk containing the new layer we’ve just added! The other unchanged chunks are skipped automatically during the upload process, saving a huge amount of bandwidth and time. + +Customizable transfer adapters are a great feature for Git LFS, as they allow different hosts to experiment with optimized transfer protocols to suit their services without overloading the core project. + +### Better `git diff` algorithms and defaults + +Unlike some other version control systems, Git doesn’t explicitly store the fact that files have been renamed. For example, if I edited a simple Node.js application and renamed `index.js` to `app.js` and then ran `git diff`, I’d get back what looks like a file deletion and an addition: + + + ![](https://cdn-images-1.medium.com/max/800/1*ohMUBpSh_jqz2ffScJ7ApQ.png) + +I guess moving or renaming a file is technically just a delete followed by an add, but this isn’t the most human-friendly way to show it. Instead, you can use the `-M` flag to instruct Git to attempt to detect renamed files on the fly when computing a diff. For the above example, `git diff -M` gives us: + + ![](https://cdn-images-1.medium.com/max/800/1*ywYjxBc1wii5O8EhHbpCTA.png) + +The similarity index on the second line tells us how similar the content of the files compared was. By default, `-M` will consider any two files that are more than 50% similar. That is, you need to modify less than 50% of their lines to make them identical as a renamed file. You can choose your own similarity index by appending a percentage, i.e., `-M80%`. + +As of Git v2.9, the `git diff` and `git log` commands will both detect renames by default as if you'd passed the `-M` flag. If you dislike this behavior (or, more realistically, are parsing the diff output via a script), then you can disable it by explicitly passing the `−−no-renames` flag. + +#### Verbose Commits + +Do you ever invoke `git commit` and then stare blankly at your shell trying to remember all the changes you just made? The verbose flag is for you! + +Instead of: + +``` +Ah crap, which dependency did I just rev? +``` + +``` +# Please enter the commit message for your changes. Lines starting +# with ‘#’ will be ignored, and an empty message aborts the commit. +# On branch master +# Your branch is up-to-date with ‘origin/master’. +# +# Changes to be committed: +# new file: package.json +# +``` + +…you can invoke `git commit −−verbose` to view an inline diff of your changes. Don’t worry, it won’t be included in your commit message: + + + ![](https://cdn-images-1.medium.com/max/800/1*1vOYE2ow3ZDS8BP_QfssQw.png) + +The `−−verbose` flag isn’t new, but as of Git v2.9 you can enable it permanently with `git config --global commit.verbose true`. + +#### Experimental Diff Improvements + +`git diff` can produce some slightly confusing output when the lines before and after a modified section are the same. This can happen when you have two or more similarly structured functions in a file. For a slightly contrived example, imagine we have a JS file that contains a single function: + +``` +/* @return {string} "Bitbucket" */ +function productName() { + return "Bitbucket"; +} +``` + +Now imagine we’ve committed a change that prepends  _another_  function that does something similar: + +``` +/* @return {string} "Bitbucket" */ +function productId() { + return "Bitbucket"; +} +``` + +``` +/* @return {string} "Bitbucket" */ +function productName() { + return "Bitbucket"; +} +``` + +You’d expect `git diff` to show the top five lines as added, but it actually incorrectly attributes the very first line to the original commit: + + + ![](https://cdn-images-1.medium.com/max/800/1*9C7DWMObGHMEqD-QFGHmew.png) + +The wrong comment is included in the diff! Not the end of the world, but the couple of seconds of cognitive overhead from the  _Whaaat?_  every time this happens can add up. + +In December, Git v2.11 introduced a new experimental diff option, `--indent-heuristic`, that attempts to produce more aesthetically pleasing diffs: + + + ![](https://cdn-images-1.medium.com/max/800/1*UyWZ6JjC-izDquyWCA4bow.png) + +Under the hood, `--indent-heuristic` cycles through the possible diffs for each change and assigns each a “badness” score. This is based on heuristics like whether the diff block starts and ends with different levels of indentation (which is aesthetically bad) and whether the diff block has leading and trailing blank lines (which is aesthetically pleasing). Then, the block with the lowest badness score is output. + +This feature is experimental, but you can test it out ad-hoc by applying the `--indent-heuristic` option to any `git diff` command. Or, if you like to live on the bleeding edge, you can enable it across your system with: + +``` +$ git config --global diff.indentHeuristic true +``` + +### Submodules with less suck + +Submodules allow you to reference and include other Git repositories from inside your Git repository. This is commonly used by some projects to manage source dependencies that are also tracked in Git, or by some companies as an alternative to a [monorepo][68] containing a collection of related projects. + +Submodules get a bit of a bad rap due to some usage complexities and the fact that it’s reasonably easy to break them with an errant command. + + + ![](https://cdn-images-1.medium.com/max/800/1*xNffiElY7BZNMDM0jm0JNQ.gif) + +However, they do have their uses and are, I think, still the best choice for vendoring dependencies. Fortunately, 2016 was a great year to be a submodule user, with some significant performance and feature improvements landing across several releases. + +#### Parallelized fetching + +When cloning or fetching a repository, appending the `--recurse-submodules`option means any referenced submodules will be cloned or updated, as well. Traditionally, this was done serially, with each submodule being fetched one at a time. As of Git v2.8, you can append the `--jobs=n` option to fetch submodules in  _n_  parallel threads. + +I recommend configuring this option permanently with: + +``` +$ git config --global submodule.fetchJobs 4 +``` + +…or whatever degree of parallelization you choose to use. + +#### Shallow submodules + +Git v2.9 introduced the `git clone -−shallow-submodules` flag. It allows you to grab a full clone of your repository and then recursively shallow clone any referenced submodules to a depth of one commit. This is useful if you don’t need the full history of your project’s dependencies. + +For example, consider a repository with a mixture of submodules containing vendored dependencies and other projects that you own. You may wish to clone with shallow submodules initially and then selectively deepen the few projects you want to work with. + +Another scenario would be configuring a continuous integration or deployment job. Git needs the super repository as well as the latest commit from each of your submodules in order to actually perform the build. However, you probably don’t need the full history for every submodule, so retrieving just the latest commit will save you both time and bandwidth. + +#### Submodule alternates + +The `--reference` option can be used with `git clone` to specify another local repository as an alternate object store to save recopying objects over the network that you already have locally. The syntax is: + +``` +$ git clone --reference +``` + +As of Git v2.11, you can use the `--reference` option in combination with `--recurse-submodules` to set up submodule alternates pointing to submodules from another local repository. The syntax is: + +``` +$ git clone --recurse-submodules --reference +``` + +This can potentially save a huge amount of bandwidth and local disk but it will fail if the referenced local repository does not have all the required submodules of the remote repository that you’re cloning from. + +Fortunately, the handy `--reference-if-able` option will fail gracefully and fall back to a normal clone for any submodules that are missing from the referenced local repository: + +``` +$ git clone --recurse-submodules --reference-if-able \ + +``` + +#### Submodule diffs + +Prior to Git v2.11, Git had two modes for displaying diffs of commits that updated your repository’s submodules: + +`git diff --submodule=short` displays the old commit and new commit from the submodule referenced by your project (this is also the default if you omit the `--submodule` option altogether): + + ![](https://cdn-images-1.medium.com/max/800/1*K71cJ30NokO5B69-a470NA.png) + +`git diff --submodule=log` is slightly more verbose, displaying the summary line from the commit message of any new or removed commits in the updated submodule: + + + ![](https://cdn-images-1.medium.com/max/800/1*frvsd_T44De8_q0uvNHB1g.png) + +Git v2.11 introduces a third much more useful option: `--submodule=diff`. This displays a full diff of all changes in the updated submodule: + + ![](https://cdn-images-1.medium.com/max/800/1*nPhJTjP8tcJ0cD8s3YOmjw.png) + +### Nifty enhancements to `git stash` + +Unlike submodules, `[git stash][52]` is almost universally beloved by Git users. `git stash` temporarily shelves (or  _stashes_ ) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on. + +#### Autostash + +If you’re a fan of `git rebase`, you might be familiar with the `--autostash`option. It automatically stashes any local changes made to your working copy before rebasing and reapplies them after the rebase is completed. + +``` +$ git rebase master --autostash +Created autostash: 54f212a +HEAD is now at 8303dca It's a kludge, but put the tuple from the database in the cache. +First, rewinding head to replay your work on top of it... +Applied autostash. +``` + +This is handy, as it allows you to rebase from a dirty worktree. There’s also a handy config flag named `rebase.autostash` to make this behavior the default, which you can enable globally with: + +``` +$ git config --global rebase.autostash true +``` + +`rebase.autostash` has actually been available since [Git v1.8.4][69], but v2.7 introduces the ability to cancel this flag with the `--no-autostash` option. If you use this option with unstaged changes, the rebase will abort with a dirty worktree warning: + +``` +$ git rebase master --no-autostash +Cannot rebase: You have unstaged changes. +Please commit or stash them. +``` + +#### Stashes as Patches + +Speaking of config flags, Git v2.7 also introduces `stash.showPatch`. The default behavior of `git stash show` is to display a summary of your stashed files. + +``` +$ git stash show +package.json | 2 +- +1 file changed, 1 insertion(+), 1 deletion(-) +``` + +Passing the `-p` flag puts `git stash show` into "patch mode," which displays the full diff: + + ![](https://cdn-images-1.medium.com/max/800/1*HpcT3quuKKQj9CneqPuufw.png) + +`stash.showPatch` makes this behavior the default. You can enable it globally with: + +``` +$ git config --global stash.showPatch true +``` + +If you enable `stash.showPatch` but then decide you want to view just the file summary, you can get the old behavior back by passing the `--stat` option instead. + +``` +$ git stash show --stat +package.json | 2 +- +1 file changed, 1 insertion(+), 1 deletion(-) +``` + +As an aside: `--no-patch` is a valid option but it doesn't negate `stash.showPatch` as you'd expect. Instead, it gets passed along to the underlying `git diff` command used to generate the patch, and you'll end up with no output at all! + +#### Simple Stash IDs + +If you’re a `git stash` fan, you probably know that you can shelve multiple sets of changes, and then view them with `git stash list`: + +``` +$ git stash list +stash@{0}: On master: crazy idea that might work one day +stash@{1}: On master: desperate samurai refactor; don't apply +stash@{2}: On master: perf improvement that I forgot I stashed +stash@{3}: On master: pop this when we use Docker in production +``` + +However, you may not know why Git’s stashes have such awkward identifiers (`stash@{1}`, `stash@{2}`, etc.) and may have written them off as "just one of those Git idiosyncrasies." It turns out that like many Git features, these weird IDs are actually a symptom of a very clever use (or abuse) of the Git data model. + +Under the hood, the `git stash` command actually creates a set of special commit objects that encode your stashed changes and maintains a [reflog][70]that holds references to these special commits. This is why the output from `git stash list` looks a lot like the output from the `git reflog` command. When you run `git stash apply stash@{1}`, you're actually saying, “Apply the commit at position 1 from the stash reflog.” + +As of Git v2.11, you no longer have to use the full `stash@{n}` syntax. Instead, you can reference stashes with a simple integer indicating their position in the stash reflog: + +``` +$ git stash show 1 +$ git stash apply 1 +$ git stash pop 1 +``` + +And so forth. If you’d like to learn more about how stashes are stored, I wrote a little bit about it in [this tutorial][71]. + +### <2017> + +And we’re done. Thanks for reading! I hope you enjoyed reading this behemoth as much as I enjoyed spelunking through Git’s source code, release notes, and `man` pages to write it. If you think I missed anything big, please leave a comment or let me know [on Twitter][72] and I'll endeavor to write a follow-up piece. + +As for what’s next for Git, that’s up to the maintainers and contributors (which [could be you!][73]). With ever-increasing adoption, I’m guessing that simplification, improved UX, and better defaults will be strong themes for Git in 2017\. As Git repositories get bigger and older, I suspect we’ll also see continued focus on performance and improved handling of large files, deep trees, and long histories. + +If you’re into Git and excited to meet some of the developers behind the project, consider coming along to [Git Merge][74] in Brussels in a few weeks time. I’m [speaking there][75]! But more importantly, many of the developers who maintain Git will be in attendance for the conference and the annual Git Contributors Summit, which will likely drive much of the direction for the year ahead. + +Or if you can’t wait ’til then, head over to Atlassian’s excellent selection of [Git tutorials][76] for more tips and tricks to improve your workflow. + + _If you scrolled to the end looking for the footnotes from the first paragraph, please jump to the _ [ _[Citation needed]_ ][77] _ section for the commands used to generate the stats. Gratuitous cover image generated using _ [ _instaco.de_ ][78] _ ❤️_ + + +-------------------------------------------------------------------------------- + +via: https://hackernoon.com/git-in-2016-fad96ae22a15#.t5c5cm48f + +作者:[Tim Pettersen][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://hackernoon.com/@kannonboy?source=post_header_lockup +[1]:https://medium.com/@g.kylafas/the-git-config-command-is-missing-a-yes-at-the-end-as-in-git-config-global-commit-verbose-yes-7e126365750e?source=responses---------1---------- +[2]:https://medium.com/@kannonboy/thanks-giorgos-fixed-f3b83c61589a?source=responses---------1---------- +[3]:https://medium.com/@TomSwirly/i-read-the-whole-thing-from-start-to-finish-415a55d89229?source=responses---------0-31--------- +[4]:https://medium.com/@g.kylafas +[5]:https://medium.com/@g.kylafas?source=responses---------1---------- +[6]:https://medium.com/@kannonboy +[7]:https://medium.com/@kannonboy?source=responses---------1---------- +[8]:https://medium.com/@TomSwirly +[9]:https://medium.com/@TomSwirly?source=responses---------0-31--------- +[10]:https://medium.com/@g.kylafas/the-git-config-command-is-missing-a-yes-at-the-end-as-in-git-config-global-commit-verbose-yes-7e126365750e?source=responses---------1----------#--responses +[11]:https://hackernoon.com/@kannonboy +[12]:https://hackernoon.com/@kannonboy?source=placement_card_footer_grid---------0-44 +[13]:https://medium.freecodecamp.com/@BillSourour +[14]:https://medium.freecodecamp.com/@BillSourour?source=placement_card_footer_grid---------1-43 +[15]:https://blog.uncommon.is/@lut4rp +[16]:https://blog.uncommon.is/@lut4rp?source=placement_card_footer_grid---------2-43 +[17]:https://medium.com/@kannonboy +[18]:https://medium.com/@kannonboy +[19]:https://medium.com/@g.kylafas/the-git-config-command-is-missing-a-yes-at-the-end-as-in-git-config-global-commit-verbose-yes-7e126365750e?source=responses---------1---------- +[20]:https://medium.com/@kannonboy/thanks-giorgos-fixed-f3b83c61589a?source=responses---------1---------- +[21]:https://medium.com/@TomSwirly/i-read-the-whole-thing-from-start-to-finish-415a55d89229?source=responses---------0-31--------- +[22]:https://hackernoon.com/setting-breakpoints-on-a-snowy-evening-df34fc3168e2?source=placement_card_footer_grid---------0-44 +[23]:https://medium.freecodecamp.com/the-code-im-still-ashamed-of-e4c021dff55e?source=placement_card_footer_grid---------1-43 +[24]:https://blog.uncommon.is/using-git-to-generate-versionname-and-versioncode-for-android-apps-aaa9fc2c96af?source=placement_card_footer_grid---------2-43 +[25]:https://hackernoon.com/git-in-2016-fad96ae22a15#fd10 +[26]:https://hackernoon.com/git-in-2016-fad96ae22a15#cc52 +[27]:https://hackernoon.com/git-in-2016-fad96ae22a15#42b9 +[28]:https://hackernoon.com/git-in-2016-fad96ae22a15#4208 +[29]:https://hackernoon.com/git-in-2016-fad96ae22a15#a5c3 +[30]:https://hackernoon.com/git-in-2016-fad96ae22a15#c230 +[31]:https://hackernoon.com/tagged/git?source=post +[32]:https://hackernoon.com/tagged/web-development?source=post +[33]:https://hackernoon.com/tagged/software-development?source=post +[34]:https://hackernoon.com/tagged/programming?source=post +[35]:https://hackernoon.com/tagged/atlassian?source=post +[36]:https://hackernoon.com/@kannonboy +[37]:https://hackernoon.com/?source=footer_card +[38]:https://hackernoon.com/setting-breakpoints-on-a-snowy-evening-df34fc3168e2?source=placement_card_footer_grid---------0-44 +[39]:https://medium.freecodecamp.com/the-code-im-still-ashamed-of-e4c021dff55e?source=placement_card_footer_grid---------1-43 +[40]:https://blog.uncommon.is/using-git-to-generate-versionname-and-versioncode-for-android-apps-aaa9fc2c96af?source=placement_card_footer_grid---------2-43 +[41]:https://hackernoon.com/git-in-2016-fad96ae22a15#fd10 +[42]:https://hackernoon.com/git-in-2016-fad96ae22a15#fd10 +[43]:https://hackernoon.com/git-in-2016-fad96ae22a15#cc52 +[44]:https://hackernoon.com/git-in-2016-fad96ae22a15#cc52 +[45]:https://hackernoon.com/git-in-2016-fad96ae22a15#42b9 +[46]:https://hackernoon.com/git-in-2016-fad96ae22a15#4208 +[47]:https://hackernoon.com/git-in-2016-fad96ae22a15#a5c3 +[48]:https://hackernoon.com/git-in-2016-fad96ae22a15#c230 +[49]:https://git-scm.com/docs/git-worktree +[50]:https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git#Binary-Search +[51]:https://www.atlassian.com/git/tutorials/git-lfs/#speeding-up-clones +[52]:https://www.atlassian.com/git/tutorials/git-stash/ +[53]:https://hackernoon.com/@kannonboy?source=footer_card +[54]:https://hackernoon.com/?source=footer_card +[55]:https://hackernoon.com/@kannonboy?source=post_header_lockup +[56]:https://hackernoon.com/@kannonboy?source=post_header_lockup +[57]:https://hackernoon.com/git-in-2016-fad96ae22a15#c8e9 +[58]:https://hackernoon.com/git-in-2016-fad96ae22a15#408a +[59]:https://hackernoon.com/git-in-2016-fad96ae22a15#315b +[60]:https://hackernoon.com/git-in-2016-fad96ae22a15#dbfb +[61]:https://hackernoon.com/git-in-2016-fad96ae22a15#2220 +[62]:https://hackernoon.com/git-in-2016-fad96ae22a15#bc78 +[63]:https://www.atlassian.com/git/tutorials/install-git/ +[64]:https://www.atlassian.com/git/tutorials/what-is-git/ +[65]:https://www.atlassian.com/git/tutorials/git-lfs/ +[66]:https://twitter.com/kit3bus +[67]:https://confluence.atlassian.com/bitbucket/bitbucket-lfs-media-adapter-856699998.html +[68]:https://developer.atlassian.com/blog/2015/10/monorepos-in-git/ +[69]:https://blogs.atlassian.com/2013/08/what-you-need-to-know-about-the-new-git-1-8-4/ +[70]:https://www.atlassian.com/git/tutorials/refs-and-the-reflog/ +[71]:https://www.atlassian.com/git/tutorials/git-stash/#how-git-stash-works +[72]:https://twitter.com/kannonboy +[73]:https://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches +[74]:http://git-merge.com/ +[75]:http://git-merge.com/#git-aliases +[76]:https://www.atlassian.com/git/tutorials +[77]:https://hackernoon.com/git-in-2016-fad96ae22a15#87c4 +[78]:http://instaco.de/ +[79]:https://medium.com/@Medium/personalize-your-medium-experience-with-users-publications-tags-26a41ab1ee0c#.hx4zuv3mg +[80]:https://hackernoon.com/ From e701dfd2ddf9f1bd181c74ccf8ae577d2f22be71 Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:05:27 +0800 Subject: [PATCH 068/190] =?UTF-8?q?20170307-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Machine Part 3- Your Questions Answered.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md diff --git a/sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md b/sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md new file mode 100644 index 0000000000..c854001b0b --- /dev/null +++ b/sources/tech/20170124 How to Keep Hackers out of Your Linux Machine Part 3- Your Questions Answered.md @@ -0,0 +1,81 @@ +How to Keep Hackers out of Your Linux Machine Part 3: Your Questions Answered +============================================================ + + ![Computer security](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/keep-hackers-out.jpg?itok=lqgHDxDu "computer security") +Mike Guthrie answers some of the security-related questions received during his recent Linux Foundation webinar. Watch the free webinar on-demand.[Creative Commons Zero][1] + +Articles [one][6] and [two][7] in this series covered the five easiest ways to keep hackers out of your Linux machine, and know if they have made it in. This time, I’ll answer some of the excellent security questions I received during my recent Linux Foundation webinar. [Watch the free webinar on-demand.][8] + +**How can I store a passphrase for a private key if private key authentication is used by automated systems?** + +This is tough. This is something that we struggle with on our end, especially when we are doing Red Teams because we have stuff that calls back automatically. I use Expect but I tend to be old-school on that. You are going to have to script it and, yes, storing that passphrase on the system is going to be tough; you are going to have to encrypt it when you store it. + +My Expect script encrypts the passphrase stored and then decrypts, sends the passphrase, and re-encrypts it when it's done. I do realize there are some flaws in that, but it's better than having a no-passphrase key. + +If you do have a no-passphrase key, and you do need to use it. Then I would suggest limiting the user that requires that to almost nothing. For instance, if you are doing some automated log transfers or automated software installs, limit the access to only what it requires to perform those functions. + +You can run commands by SSH, so don't give them a shell, make it so they just run that command and it will actually prevent somebody from stealing that key and doing something other than just that one command. + +**What do you think of password managers such as KeePass2?** + +Password managers, for me, are a very juicy target. With the advent of GPU cracking and some of the cracking capabilities in EC2, they become pretty easy to get past.  I steal password vaults all the time. + +Now, our success rate at cracking those, that's a different story. We are still in about the 10 percent range of crack versus no crack. If a person doesn't do a good job at keeping a secure passphrase on their password vault, then we tend to get into it and we have a large amount of success. It's better than nothing but still you need to protect those assets. Protect the password vault as you would protect any other passwords. + +**Do you think it is worthwhile from a security perspective to create a new Diffie-Hellman moduli and limit them to 2048 bit or higher in addition to creating host keys with higher key lengths?** + +Yeah. There have been weaknesses in SSH products in the past where you could actually decrypt the packet stream. With that, you can pull all kinds of data across. People use this safes to transfer files and passwords and they do it thoughtlessly as an encryption mechanism. Doing what you can to use strong encryption and changing your keys and whatnot is important. I rotate my SSH keys -- not as often as I do my passwords -- but I rotate them about once a year. And, yeah, it's a pain, but it gives me peace of mind. I would recommend doing everything you can to make your encryption technology as strong as you possibly can. + +**Is using four completely random English words (around 100k words) for a passphrase okay?** + +Sure. My passphrase is actually a full phrase. It's a sentence. With punctuation and capitalization. I don't use anything longer than that. + +I am a big proponent of having passwords that you can remember that you don’t have to write down or store in a password vault. A password that you can remember that you don't have to write down is more secure than one that you have to write down because it's funky. + +Using a phrase or using four random words that you will remember is much more secure than having a string of numbers and characters and having to hit shift a bunch of times. My current passphrase is roughly 200 characters long. It's something that I can type quickly and that I remember. + +**Any advice for protecting Linux-based embedded systems in an IoT scenario?** + +IoT is a new space, this is the frontier of systems and security. It is starting to be different every single day. Right now, I try to keep as much offline as I possibly can. I don't like people messing with my lights and my refrigerator. I purposely did not buy a connected refrigerator because I have friends that are hackers, and I know that I would wake up to inappropriate pictures every morning. Keep them locked down. Keep them locked up. Keep them isolated. + +The current malware for IoT devices is dependent on default passwords and backdoors, so just do some research into what devices you have and make sure that there's nothing there that somebody could particularly access by default. Then make sure that the management interfaces for those devices are well protected by a firewall or another such device. + +**Can you name a firewall/UTM (OS or application) to use in SMB and large environments?** + +I use pfSense; it’s a BSD derivative. I like it a lot. There's a lot of modules, and there's actually commercial support for it now, which is pretty fantastic for small business. For larger devices, larger environments, it depends on what admins you can get a hold of. + +I have been a CheckPoint admin for most of my life, but Palo Alto is getting really popular, too. Those types of installations are going to be much different from a small business or home use. I use pfSense for any small networks. + +**Is there an inherent problem with cloud services?** + +There is no cloud; there are only other people's computers. There are inherent issues with cloud services. Just know who has access to your data and know what you are putting out there. Realize that when you give something to Amazon or Google or Microsoft, then you no longer have full control over it and the privacy of that data is in question. + +**What preparation would you suggest to get an OSCP?** + +I am actually going through that certification right now. My whole team is. Read their materials. Keep in mind that OSCP is going to be the offensive security baseline. You are going to use Kali for everything. If you don't -- if you decide not to use Kali -- make sure that you have all the tools installed to emulate a Kali instance. + +It's going to be a heavily tools-based certification. It's a good look into methodologies. Take a look at something called the Penetration Testing Framework because that would give you a good flow of how to do your test and their lab seems to be great. It's very similar to the lab that I have here at the house. + + _[Watch the full webinar on demand][3], for free. And see [parts one][4] and [two][5] of this series for five easy tips to keep your Linux machine secure._ + + _Mike Guthrie works for the Department of Energy doing Red Team engagements and penetration testing._ + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-3-your-questions-answered + +作者:[MIKE GUTHRIE][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/anch +[1]:https://www.linux.com/licenses/category/creative-commons-zero +[2]:https://www.linux.com/files/images/keep-hackers-outjpg +[3]:http://portal.on24.com/view/channel/index.html?showId=1101876&showCode=linux&partnerref=linco +[4]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-1-top-two-security-tips +[5]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-2-three-more-easy-security-tips +[6]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-1-top-two-security-tips +[7]:https://www.linux.com/news/webinar/2017/how-keep-hackers-out-your-linux-machine-part-2-three-more-easy-security-tips +[8]:http://portal.on24.com/view/channel/index.html?showId=1101876&showCode=linux&partnerref=linco From 862cddabd68ea3f202357e89297b00475cd9955a Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:10:03 +0800 Subject: [PATCH 069/190] =?UTF-8?q?20170307-4=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2.0 Debugging and contributing to LXD .md | 401 ++++++++++++++++++ 1 file changed, 401 insertions(+) create mode 100644 sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md diff --git a/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md new file mode 100644 index 0000000000..ec558f4363 --- /dev/null +++ b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md @@ -0,0 +1,401 @@ +# LXD 2.0: Debugging and contributing to LXD [12/12] + + + ![LXD logo](https://linuxcontainers.org/static/img/containers.png) + +### Introduction + + +This is finally it! The last blog post in this [series of 12][3] that started almost a year ago. + +If you followed the series from the beginning, you should have been using LXD for quite a bit of time now and be pretty familiar with its day to day operation and capabilities. + +But what if something goes wrong? What can you do to track down the problem yourself? And if you can’t, what information should you record so that upstream can track down the problem? + +And what if you want to fix issues yourself or help improve LXD by implementing the features you need? How do you build, test and contribute to the LXD code base? + +## Debugging LXD & filing bug reports + +### LXD log files + +#### /var/log/lxd/lxd.log + +This is the main LXD log file. To avoid filling up your disk very quickly, only log messages marked as INFO, WARNING or ERROR are recorded there by default. You can change that behavior by passing “–debug” to the LXD daemon. + +#### /var/log/lxd/CONTAINER/lxc.conf + +Whenever you start a container, this file is updated with the configuration that’s passed to LXC. +This shows exactly how the container will be configured, including all its devices, bind-mounts, … + +#### /var/log/lxd/CONTAINER/forkexec.log + +This file will contain errors coming from LXC when failing to execute a command. +It’s extremely rare for anything to end up in there as LXD usually handles errors much before that. + +#### /var/log/lxd/CONTAINER/forkstart.log + +This file will contain errors coming from LXC when starting the container. +It’s extremely rare for anything to end up in there as LXD usually handles errors much before that. + +### CRIU logs (for live migration) + +If you are using CRIU for container live migration or live snapshotting there are additional log files recorded every time a CRIU dump is generated or a dump is restored. + +Those logs can also be found in /var/log/lxd/CONTAINER/ and are timestamped so that you can find whichever matches your most recent attempt. They will contain a detailed record of everything that’s dumped and restored by CRIU and are far better for understanding a failure than the typical migration/snapshot error message. + +### LXD debug messages + +As mentioned above, you can switch the daemon to doing debug logging with the –debug option. +An alternative to that is to connect to the daemon’s event interface which will show you all log entries, regardless of the configured log level (even works remotely). + +An example for “lxc init ubuntu:16.04 xen” would be: +**lxd.log:** + +``` +INFO[02-24|18:14:09] Starting container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 +INFO[02-24|18:14:10] Started container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 +``` + +**lxc monitor –type=logging:** + +``` +metadata: + context: {} + level: dbug + message: 'New events listener: 9b725741-ffe7-4bfc-8d3e-fe620fc6e00a' +timestamp: 2017-02-24T18:14:01.025989062-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0 + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.341283344-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StorageCoreInit +timestamp: 2017-02-24T18:14:09.341536477-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0/containers/xen + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.347709394-05:00 +type: logging + +metadata: + context: + ip: '@' + method: PUT + url: /1.0/containers/xen/state + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.357046302-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'New task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:09.358387853-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Started task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:09.358578599-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0/operations/2e2cf904-c4c4-4693-881f-57897d602ad3/wait + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.366213106-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolInit +timestamp: 2017-02-24T18:14:09.369636451-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolCheck +timestamp: 2017-02-24T18:14:09.369771164-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.424696767-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + name: xen + level: dbug + message: ContainerUmount +timestamp: 2017-02-24T18:14:09.432723719-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.721067917-05:00 +type: logging + +metadata: + context: + action: start + created: 2017-02-24 23:11:45 +0000 UTC + ephemeral: "false" + name: xen + stateful: "false" + used: 1970-01-01 00:00:00 +0000 UTC + level: info + message: Starting container +timestamp: 2017-02-24T18:14:09.749808518-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0 + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.792551375-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StorageCoreInit +timestamp: 2017-02-24T18:14:09.792961032-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /internal/containers/23/onstart + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.800803501-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolInit +timestamp: 2017-02-24T18:14:09.803190248-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolCheck +timestamp: 2017-02-24T18:14:09.803251188-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.803306055-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Scheduler: container xen started: re-balancing' +timestamp: 2017-02-24T18:14:09.965080432-05:00 +type: logging + +metadata: + context: + action: start + created: 2017-02-24 23:11:45 +0000 UTC + ephemeral: "false" + name: xen + stateful: "false" + used: 1970-01-01 00:00:00 +0000 UTC + level: info + message: Started container +timestamp: 2017-02-24T18:14:10.162965059-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Success for task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:10.163072893-05:00 +type: logging +``` + +The format from “lxc monitor” is a bit different from what you’d get in a log file where each entry is condense into a single line, but more importantly you see all those “level: dbug” entries + +## Where to report bugs + +### LXD bugs + +The best place to report LXD bugs is upstream at [https://github.com/lxc/lxd/issues][4]. +Make sure to fill in everything in the bug reporting template as that information saves us a lot of back and forth to reproduce your environment. + +### Ubuntu bugs + +If you find a problem with the Ubuntu package itself, failing to install, upgrade or remove. Or run into issues with the LXD init scripts. The best place to report such bugs is on Launchpad. + +On an Ubuntu system, you can do so with: ubuntu-bug lxd +This will automatically include a number of log files and package information for us to look at. + +### CRIU bugs + +Bugs that are related to CRIU which you can spot by the usually pretty visible CRIU error output should be reported on Launchpad with: ubuntu-bug criu + +Do note that the use of CRIU through LXD is considered to be a beta feature and unless you are willing to pay for support through a support contract with Canonical, it may take a while before we get to look at your bug report. + +## Contributing to LXD + +LXD is written in [Go][5] and [hosted on Github][6]. +We welcome external contributions of any size. There is no CLA or similar legal agreement to sign to contribute to LXD, just the usual Developer Certificate of Ownership (Signed-off-by: line). + +We have a number of potential features listed on our issue tracker that can make good starting points for new contributors. It’s usually best to first file an issue before starting to work on code, just so everyone knows that you’re doing that work and so we can give some early feedback. + +### Building LXD from source + +Upstream maintains up to date instructions here: [https://github.com/lxc/lxd#building-from-source][7] + +You’ll want to fork the upstream repository on Github and then push your changes to your branch. We recommend rebasing on upstream LXD daily as we do tend to merge changes pretty regularly. + +### Running the testsuite + +LXD maintains two sets of tests. Unit tests and integration tests. You can run all of them with: + +``` +sudo -E make check +``` + +To run the unit tests only, use: + +``` +sudo -E go test ./... +``` + +To run the integration tests, use: + +``` +cd test +sudo -E ./main.sh +``` + +That latter one supports quite a number of environment variables to test various storage backends, disable network tests, use a ramdisk or just tweak log output. Some of those are: + +* LXD_BACKEND: One of “btrfs”, “dir”, “lvm” or “zfs” (defaults to “dir”) + Lets your run the whole testsuite with any of the LXD storage drivers. +* LXD_CONCURRENT: “true” or “false” (defaults to “false”) + This enables a few extra concurrency tests. +* LXD_DEBUG: “true” or “false” (defaults to “false”) + This will log all shell commands and run all LXD commands in debug mode. +* LXD_INSPECT: “true” or “false” (defaults to “false”) + This will cause the testsuite to hang on failure so you can inspect the environment. +* LXD_LOGS: A directory to dump all LXD log files into (defaults to “”) + The “logs” directory of all spawned LXD daemons will be copied over to this path. +* LXD_OFFLINE: “true” or “false” (defaults to “false”) + Disables any test which relies on outside network connectivity. +* LXD_TEST_IMAGE: path to a LXD image in the unified format (defaults to “”) + Lets you use a custom test image rather than the default minimal busybox image. +* LXD_TMPFS: “true” or “false” (defaults to “false”) + Runs the whole testsuite within a “tmpfs” mount, this can use quite a bit of memory but makes the testsuite significantly faster. +* LXD_VERBOSE: “true” or “false” (defaults to “false”) + A less extreme version of LXD_DEBUG. Shell commands are still logged but –debug isn’t passed to the LXC commands and the LXD daemon only runs with –verbose. + +The testsuite will alert you to any missing dependency before it actually runs. A test run on a reasonably fast machine can be done under 10 minutes. + +### Sending your branch + +Before sending a pull request, you’ll want to confirm that: + +* Your branch has been rebased on the upstream branch +* All your commits messages include the “Signed-off-by: First Last ” line +* You’ve removed any temporary debugging code you may have used +* You’ve squashed related commits together to keep your branch easily reviewable +* The unit and integration tests all pass + +Once that’s all done, open a pull request on Github. Our [Jenkins][8] will validate that the commits are all signed-off, a test build on MacOS and Windows will automatically be performed and if things look good, we’ll trigger a full Jenkins test run that will test your branch on all storage backends, 32bit and 64bit and all the Go versions we care about. + +This typically takes less than an hour to happen, assuming one of us is around to trigger Jenkins. + +Once all the tests are done and we’re happy with the code itself, your branch will be merged into master and your code will be in the next LXD feature release. If the changes are suitable for the LXD stable-2.0 branch, we’ll backport them for you. + +# Conclusion + +I hope this series of blog post has been helpful in understanding what LXD is and what it can do! + +This series’ scope was limited to the LTS version of LXD (2.0.x) but we also do monthly feature releases for those who want the latest features. You can find a few other blog posts covering such features listed in the original [LXD 2.0 series post][9]. + +# Extra information + +The main LXD website is at: [https://linuxcontainers.org/lxd +][10]Development happens on Github at: [https://github.com/lxc/lxd][11] +Mailing-list support happens on: [https://lists.linuxcontainers.org][12] +IRC support happens in: #lxcontainers on irc.freenode.net +Try LXD online: [https://linuxcontainers.org/lxd/try-it][13] + +-------------------------------------------------------------------------------- + +via: https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ + +作者:[Stéphane Graber ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://stgraber.org/author/stgraber/ +[1]:https://stgraber.org/author/stgraber/ +[2]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[3]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[4]:https://github.com/lxc/lxd/issues +[5]:https://golang.org/ +[6]:https://github.com/lxc/lxd +[7]:https://github.com/lxc/lxd#building-from-source +[8]:https://jenkins.linuxcontainers.org/ +[9]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[10]:https://linuxcontainers.org/lxd +[11]:https://github.com/lxc/lxd +[12]:https://lists.linuxcontainers.org/ +[13]:https://linuxcontainers.org/lxd/try-it +[14]:https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ From 6b76d0e26b39b833f5dcab1467101ddb6244a4d4 Mon Sep 17 00:00:00 2001 From: Chao-zhi Liu Date: Tue, 7 Mar 2017 21:10:24 +0800 Subject: [PATCH 070/190] Translated Translated --- ...x Deepin - A distro with a unique style.md | 88 ------------------- ...x Deepin - A distro with a unique style.md | 86 ++++++++++++++++++ 2 files changed, 86 insertions(+), 88 deletions(-) delete mode 100644 sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md create mode 100644 translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md diff --git a/sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md b/sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md deleted file mode 100644 index 8201e972e3..0000000000 --- a/sources/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md +++ /dev/null @@ -1,88 +0,0 @@ -Translating by Chao-zhi - -### Linux Deepin - A distro with a unique style - - -On the sixth segment of this series we have **Linux Deepin. **Well this distro is very interesting and must mention it's eye candy for sure. There are lot of distros, but lot of them are only making fair market by using what already is available. But the story is very different here, though this distro is based on ubuntu but they provide their own desktop environment. There are very few distros which make a great deal by making something of their own creation. Last time we have seen**Elementary OS **with thier own Pantheon desktop environment. Let's have a look how it is in case of Linux Deepin.  - -[ - ![](http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png) -][6] - -First of all just after after you log in to your account, you will get welcomed by a beautiful desktop with a well designed and good looking dock. This dock is customisable and have some interesting effects depending on softwares placed in dock. - -[ - ![](http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png) -][7] - -Now there is an launcher icon on the dock, but there's one more way to open launcher that is just hit the pointer onto the upper left corner. The launcher itself is well categorized and elegant.  - -[ - ![](http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png) -][8]  - - -As you can see in above screenshot the launcher is properly categorized and different software are sorted accordingly. and there's another good thing is if you hit the pointer on lower left corner then it will minimize all your running softwares an bring you on desktop. Again hitting on same corner will restore all the running tasks again. - - -[ - ![](http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png) -][9]  - -Now if you hit the lower right corner, it will slide out control center. From here one can change all the settings of the pc. - - -[ - ![](http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png) -][10]  - -As you can see in above screenshot control center is also well categorized and well designed you can change almost all the settings of PC from here. Even you can customize your boot screen with custom wallpapers. - - -[ - ![](http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png) -][11]  - -Linux deepin have it's software store bundled with the distro. You can fin most of the software here and it's very easy to install them as well. Software store is also properly designed and well sorted for easy navigation. - - -[ - ![](http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png) -][12]  - -Another interesting feature here is Deepin game. It offers lots of free to play online games which are quite interesting to play and good to keep one entertained. - - -[ - ![](http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png) -][13] - -Linux Deepin also offers a rich music player which have internet radio service built in too. Don't have offline music in your PC no worries just switch to network radio and enjoy music online. - -Overall Linux Deepin has lot more to offer plus they know how to keep users entertained while using their product. It's like their motto is "whatever we do, we gonna do it with some style". The support is quite good as it i given by people who us deepin in actual. Despite of being a chinese distro it offers english language too so there's no need to worry about language problem. The iso of Deepin is around 1.5 gb in size. You can also visit thier **[Official Site][14] **for more information and downloads. We would highly recommend you to try out this distro. With this we end today's segment of "**Introduction with Linux Distro**" series. We will be back with more distros n next segments so stay tuned with us. Till then, ciao. - --------------------------------------------------------------------------------- - -via: http://www.techphylum.com/2014/08/linux-deepin-distro-with-unique-style.html - -作者:[sumit rohankar https://plus.google.com/112160169713374382262][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/112160169713374382262 -[1]:http://www.techphylum.com/2014/06/linux-mint-introduction.html -[2]:http://www.techphylum.com/2014/05/elementary-os-brief-introduction.html -[3]:http://www.techphylum.com/2014/05/Introduction-to-fedora.html -[4]:http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html -[5]:http://www.techphylum.com/2014/05/what-is-opensuse-introduction.html -[6]:http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png -[7]:http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png -[8]:http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png -[9]:http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png -[10]:http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png -[11]:http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png -[12]:http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png -[13]:http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png -[14]:http://www.linuxdeepin.com/index.en.html diff --git a/translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md b/translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md new file mode 100644 index 0000000000..0af17c4f11 --- /dev/null +++ b/translated/tech/linux-distro -explain/20140826 Linux Deepin - A distro with a unique style.md @@ -0,0 +1,86 @@ +### Linux Deepin - 一个拥有独特风格的发行版 + + +这是本系列的第六篇 **Linux Deepin。**这个发行版真的是非常有意思,它有着许多吸引眼球的地方。许许多多的发行版,它们仅仅将已有的应用放入它的应用市场中,使得它们的应用市场十分冷清。但是 Deepin 却将一切变得不同,虽然这个发行版是基于 Debian 的,但是它提供了属于它自己的桌面环境。只有很少的发行版能够将他自己创造的软件做得很好。上次我们曾经提到了 **Elementary OS ** 有着自己的 Pantheon 桌面环境。让我们来看看 Deepin 做得怎么样。 + +[ + ![](http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png) +][6] + +首先,在你登录你的账户后,你会在你设计良好的桌面上看到一个欢迎界面和一个精美的 Dock。这个 Dock 是可定制的,当你将软件放到上面后,它可以有着各种特效。 + +[ + ![](http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png) +][7] + +可以看到 Dock 上有着一个启动器图标,但是还有一个办法可以打开启动器,就是将指针移动到左上角。启动器界面优雅,并且可以分类浏览。 + +[ + ![](http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png) +][8]  + +你可以做上面的截图中看到,启动器中的应用被分类得井井有条。还有一个好的地方是当你用鼠标点击到左下角,所有桌面上的应用将会最小化。再次点击则会回复原样。 + + +[ + ![](http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png) +][9]  + +如果你点击右下角,他将会滑出控制中心。这里可以更改所有电脑上的设置。 + + +[ + ![](http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png) +][10]  + +你可以看到截屏中的控制中心,设计得非常棒而且也是分类得井井有条,你可以在这里设置所有电脑上的项目。甚至可以自定义你的启动界面的壁纸。 + + +[ + ![](http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png) +][11]  + +Deepin 有一个自己的应用市场。你可以在这里找到绝大多数软件,并且他们很容易安装。应用市场也被设计得很好,分类齐全易于导航。 + + +[ + ![](http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png) +][12]  + +另一个亮点是 Deepin 的游戏。他提供许多免费的可联网玩耍的游戏,他们非常的有意思可以很好的用于消磨时光。 + +[ + ![](http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png) +][13] + +Deepin 也提供一个好用的音乐播放软件,它有着网络电台点播功能。如果你本地没有音乐你也不用害怕,你可以调到网络电台模式来享受音乐。 + +总的来说,Deepin 知道如何让用户享受它的产品。就像他们的座右铭那样:“要做,就做出风格”。他们提供的支持服务也非常棒。尽管是个中国的发行版,但是英语支持得也很好,不用担心语言问题。他的安装镜像大约 1.5 GB。你的访问他们的**[官网][14]**来获得更多信息或者下载。我们非常的推荐你试试这个发行版。 + +这就是本篇**Linux 发行版介绍** 的全部内容了,我们将会继续介绍其他的发行版。下次再见! + +-------------------------------------------------------------------------------- + +via: http://www.techphylum.com/2014/08/linux-deepin-distro-with-unique-style.html + +作者:[sumit rohankar https://plus.google.com/112160169713374382262][a] +译者:[Chao-zhi](https://github.com/Chao-zhi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/112160169713374382262 +[1]:http://www.techphylum.com/2014/06/linux-mint-introduction.html +[2]:http://www.techphylum.com/2014/05/elementary-os-brief-introduction.html +[3]:http://www.techphylum.com/2014/05/Introduction-to-fedora.html +[4]:http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html +[5]:http://www.techphylum.com/2014/05/what-is-opensuse-introduction.html +[6]:http://2.bp.blogspot.com/-xKbTZAtY2eg/U_xD1M8LocI/AAAAAAAAAp8/DXQP6iaLD00/s1600/DeepinScreenshot20140826131241.png +[7]:http://2.bp.blogspot.com/-WPddx-EYlZw/U_xD0bjQotI/AAAAAAAAApw/vDx8O8myVI4/s1600/DeepinScreenshot20140826131302.png +[8]:http://2.bp.blogspot.com/-FTOcyeJfs_k/U_xD0ErsgzI/AAAAAAAAAps/w4v1UFhaDWs/s1600/DeepinScreenshot20140826131320.png +[9]:http://3.bp.blogspot.com/-MVFLbWGTVJg/U_xD-xLuTrI/AAAAAAAAAqE/CD2bFiJsxqA/s1600/DeepinScreenshot20140826131333.png +[10]:http://2.bp.blogspot.com/-0EYqhY3WQFI/U_xEB8zO9RI/AAAAAAAAAqU/Jy54wrFZ2J8/s1600/DeepinScreenshot20140826131722.png +[11]:http://3.bp.blogspot.com/-Rpz5kyTxK_M/U_xD_1QkdaI/AAAAAAAAAqI/Wco4CDnWUHw/s1600/DeepinScreenshot20140826131837.png +[12]:http://2.bp.blogspot.com/-MDSiaRVT59c/U_xEJpwBSLI/AAAAAAAAAqk/s3As7rmqQxc/s1600/DeepinScreenshot20140826132205.png +[13]:http://2.bp.blogspot.com/-yx8wExwyjFs/U_xML8CxBEI/AAAAAAAAAq0/r2RfwtnrdhU/s1600/DeepinScreenshot20140826142428.png +[14]:http://www.linuxdeepin.com/index.en.html From 62d9b4ffee30bc17848939e9c50c4b9983a6906b Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:15:12 +0800 Subject: [PATCH 071/190] =?UTF-8?q?20170307-5=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...allation of Devuan Linux Fork of Debian.md | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md diff --git a/sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md b/sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md new file mode 100644 index 0000000000..4aabe33be1 --- /dev/null +++ b/sources/tech/20170302 Installation of Devuan Linux Fork of Debian.md @@ -0,0 +1,266 @@ +Installation of Devuan Linux (Fork of Debian) +============================================================ + + +Devuan Linux, the most recent fork of Debian, is a version of Debian that is designed to be completely free of systemd. + +Devuan was announced towards the end of 2014 and has been actively developed over that time. The most recently release is the beta2 release of codenamed: Jessie (Yes the same name as the current stable version of Debian). + +The final release for the current stable release is said to be ready in early 2017\. To read more about the project please visit the community’s home page: [https://devuan.org/][1]. + +This article will walk through the installation of Devuan’s current release. Most of the packages available in Debian are available in Devuan allowing for a fairly seamless transition for Debian users to Devuan should they prefer the freedom to choose their initialization system. + +#### System Requirements + +Devuan, like Debian. Is very light on system requirements. The biggest determining factor is the desktop environment the user wishes to use. This guide will assume that the user would like a ‘flashier’ desktop environment and will suggest the following minimums: + +1. At least 15GB of disk space; strongly encouraged to have more +2. At least 2GB of ram; more is encouraged +3. USB or CD/DVD boot support +4. Internet connection; installer will download files from the Internet + +### Devuan Linux Installation + +As with all of the author’s guides, this guide will be assuming that a USB drive is available to use as the installation media. Take note that the USB drive should be as close to 4/8GB as possible and ALL DATA WILL BE REMOVED! + +The author has had issues with larger USB drives but some may still work. Regardless, following the next few steps WILL RESULT IN DATA LOSS ON THE USB DRIVE. + +Please be sure to backup all data before proceeding. This bootable Kali Linux USB drive is going to be created from another Linux machine. + +1. First obtain the latest release of Devuan installation ISO from [https://devuan.org/][2] or you can obtain from a Linux station, type the following commands: + +``` +$ cd ~/Downloads +$ wget -c https://files.devuan.org/devuan_jessie_beta/devuan_jessie_1.0.0-beta2_amd64_CD.iso +``` + +2. The commands above will download the installer ISO file to the user’s ‘Downloads’ folder. The next process is to write the ISO to a USB drive to boot the installer. + +To accomplish this we can use the `'dd'` tool within Linux. First, the disk name needs to be located with [lsblk command][3] though. + +``` +$ lsblk +``` +[ + ![Find Device Name in Linux](http://www.tecmint.com/wp-content/uploads/2017/03/Find-Device-Name-in-Linux.png) +][4] + +Find Device Name in Linux + +With the name of the USB drive determined as `/dev/sdc`, the Devuan ISO can be written to the drive with the `dd` tool. + +``` +$ sudo dd if=~/Downloads/devuan_jessie_1.0.0-beta2_amd64_CD.iso of=/dev/sdc +``` + +Important: The above command requires root privileges so utilize ‘sudo’ or login as the root user to run the command. Also this command will REMOVE EVERYTHING on the USB drive. Be sure to backup needed data. + +3. Once the ISO is copied over to the USB drive, plug the USB drive into the respective computer that Devuan should be installed upon and proceed to boot to the USB drive. + +Upon successful booting to the USB drive, the user will be presented with the following screen and should proceed with the ‘Install’ or ‘Graphical Install’ options. + +This guide will be using the ‘Graphical Install’ method. + +[ + ![Devuan Graphic Installation](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Graphic-Installation.png) +][5] + +Devuan Graphic Installation + +4. Allow the installer to boot to the localization menus. Once here the user will be prompted with a string of windows asking about the user’s keyboard layout and language. Simply select the desired options to continue. + +[ + ![Devuan Language Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Language-Selection.png) +][6] + +Devuan Language Selection + +[ + ![Devuan Location Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Location-Selection.png) +][7] + +Devuan Location Selection + +[ + ![Devuan Keyboard Configuration](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Keyboard-Configuration.png) +][8] + +Devuan Keyboard Configuration + +5. The next step is to provide the installer with the hostname and domain name that this machine will be a member. + +The hostname should be something unique but the domain can be left blank if the computer won’t be part of a domain. + +[ + ![Set Devuan Linux Hostname](http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Hostname.png) +][9] + +Set Devuan Linux Hostname + +[ + ![Set Devuan Linux Domain Name](http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Domain-Name.png) +][10] + +Set Devuan Linux Domain Name + +6. Once the hostname and domain name information have been provided the installer will want the user to provide a ‘root’ user password. + +Take note to remember this password as it will be required to do administrative tasks on this Devuan machine! Devuan doesn’t install the sudo package by default so the admin user will be ‘root’ when this installation finishes. + +[ + ![Setup Devuan Linux Root User](http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-Root-User.png) +][11] + +Setup Devuan Linux Root User + +7. The next series of questions will be for the creation of a non-root user. It is always a good to avoid using your system as the root user whenever possible. The installer will prompt for the creation of a non-root user at this point. + +[ + ![Setup Devuan Linux User Account](http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-User-Account.png) +][12] + +Setup Devuan Linux User Account + +8. Once the root user password and user creation prompts have completed, the installer will request that the clock be [set up with NTP][13]. + +Again a connection to the internet will be required in order for this to work for most systems! + +[ + ![Devuan Linux Timezone Setup](http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Clock-on-Devuan-Linux.png) +][14] + +Devuan Linux Timezone Setup + +9. The next step will be the act of partitioning the system. For most user’s ‘Guided – use entire disk’ is typically sufficient. However, if advanced partitioning is desired, this would be the time to set them up. + +[ + ![Devuan Linux Partitioning](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Partitioning.png) +][15] + +Devuan Linux Partitioning + +Be sure to confirm the partition changes after clicking continue above in order to write the partitions to the disk! + +10. Once the partitioning is completed, the installer will begin to install the base files for Devuan. This process will take a few minutes but will stop when the system is ready to configure a network mirror (software repository). Most users will want to click ‘yes’ when prompted to use a network mirror. + +[ + ![Devuan Linux Configure Package Manager](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Configure-Package-Manager.png) +][16] + +Devuan Linux Configure Package Manager + +Clicking `yes` here will present the user with a list of network mirrors by country. It is typically best to pick the mirror that is geographically closest to the machines location. + +[ + ![Devuan Linux Mirror Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirror-Selection.png) +][17] + +Devuan Linux Mirror Selection + +[ + ![Devuan Linux Mirrors](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirrors.png) +][18] + +Devuan Linux Mirrors + +11. The next screen is the traditional Debian ‘popularity contest’ all this does is track what packages are downloaded for statistics on package usage. + +This can be enabled or disabled to the administrator’s preference during the installation process. + +[ + ![Configure Devuan Linux Popularity Contest](http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Devuan-Linux-Popularity-Contest.png) +][19] + +Configure Devuan Linux Popularity Contest + +12. After a brief scan of the repositories and a couple of package updates, the installer will present the user with a list of software packages that can be installed to provide a Desktop Environment, SSH access, and other system tools. + +While Devuan has some of the major Desktop Environments listed, it should be noted that not all of them are ready for use in Devuan yet. The author has had good luck with Xfce, LXDE, and Mate in Devuan (Future articles will walk the user through how to install Enlightenment from source in Devuan as well). + +If interested in installing a different Desktop Environment, un-check the ‘Devuan Desktop Environment’ check box. + +[ + ![Devuan Linux Software Selection](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Software-Selection.png) +][20] + +Devuan Linux Software Selection + +Depending on the number of items selected in the above installer screen, there may be a couple of minutes of downloads and installations taking place. + +When all the software installation is completed, the installer will prompt the user for the location to install ‘grub’. This is typically done on ‘/dev/sda’ as well. + +[ + ![Devuan Linux Grub Install](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install.png) +][21] + +Devuan Linux Grub Install + +[ + ![Devuan Linux Grub Install Disk](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install-Disk.png) +][22] + +Devuan Linux Grub Install Disk + +13. After GRUB successfully installs to the boot drive, the installer will alert the user that the installation is complete and to reboot the system. + +[ + ![Devuan Linux Installation Completes](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Installation-Completes.png) +][23] + +Devuan Linux Installation Completes + +14. Assuming that the installation was indeed successful, the system should either boot into the chosen Desktop Environment or if no Desktop Environment was selected, the machine will boot to a text based console. + +[ + ![Devuan Linux Console](http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Console.png) +][24] + +Devuan Linux Console + +This concludes the installation of the latest version of Devuan Linux. The next article in this short series will cover the [installation of the Enlightenment Desktop Environment][25] from source code on a Devuan system. Please let Tecmint know if you have any issues or questions and thanks for reading! + +-------------------------------------------------------------------------------- + +作者简介: + +He is an Instructor of Computer Technology with Ball State University where he currently teaches all of the departments Linux courses and co-teaches Cisco networking courses. He is an avid Debian user as well as many of the derivatives of Debian such as Mint, Ubuntu, and Kali. Rob holds a Masters in Information and Communication Sciences as well as several industry certifications from Cisco, EC-Council, and Linux Foundation. + +----------------------------- + +via: http://www.tecmint.com/installation-of-devuan-linux/ + +作者:[Rob Turner ][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/robturner/ +[1]:https://devuan.org/ +[2]:https://devuan.org/ +[3]:http://www.tecmint.com/find-usb-device-name-in-linux/ +[4]:http://www.tecmint.com/wp-content/uploads/2017/03/Find-Device-Name-in-Linux.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Graphic-Installation.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Language-Selection.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Location-Selection.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Keyboard-Configuration.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Hostname.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-Devuan-Linux-Domain-Name.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-Root-User.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/03/Setup-Devuan-Linux-User-Account.png +[13]:http://www.tecmint.com/install-and-configure-ntp-server-client-in-debian/ +[14]:http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Clock-on-Devuan-Linux.png +[15]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Partitioning.png +[16]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Configure-Package-Manager.png +[17]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirror-Selection.png +[18]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Mirrors.png +[19]:http://www.tecmint.com/wp-content/uploads/2017/03/Configure-Devuan-Linux-Popularity-Contest.png +[20]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Software-Selection.png +[21]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install.png +[22]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Grub-Install-Disk.png +[23]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Installation-Completes.png +[24]:http://www.tecmint.com/wp-content/uploads/2017/03/Devuan-Linux-Console.png +[25]:http://www.tecmint.com/install-enlightenment-on-devuan-linux/ +[26]:http://www.tecmint.com/author/robturner/ +[27]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[28]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 3a443a0bb16be6d56748e29a4fc53454b3ee0d80 Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:17:02 +0800 Subject: [PATCH 072/190] =?UTF-8?q?20170307-6=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...de to Latest Kernel Version in CentOS 7.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md diff --git a/sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md b/sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md new file mode 100644 index 0000000000..ea6600be78 --- /dev/null +++ b/sources/tech/20170301 How to Install or Upgrade to Latest Kernel Version in CentOS 7.md @@ -0,0 +1,177 @@ +How to Install or Upgrade to Latest Kernel Version in CentOS 7 +============================================================ + +by [Gabriel Cánepa][14] | Published: March 1, 2017 | Last Updated: March 6, 2017 + + Download Your Free eBooks NOW - [10 Free Linux eBooks for Administrators][15] | [4 Free Shell Scripting eBooks][16] + +Although some people use the word Linux to represent the operating system as a whole, it is important to note that, strictly speaking, Linux is only the kernel. On the other hand, a distribution is a fully-functional system built on top of the kernel with a wide variety of application tools and libraries. + +During normal operations, the kernel is responsible for performing two important tasks: + +1. Acting as an interface between the hardware and the software running on the system. +2. Managing system resources as efficiently as possible. + +To do this, the kernel communicates with the hardware through the drivers that are built into it or those that can be later installed as a module. + +For example, when an application running on your machine wants to connect to a wireless network, it submits that request to the kernel, which in turns uses the right driver to connect to the network. + +**Suggested Read:** [How to Upgrade Kernel in Ubuntu][1] + +With new devices and technology coming out periodically, it is important to keep our kernel up to date if we want to make the most of out them. Additionally, updating our kernel will help us to leverage new kernel functions and to protect ourselves from vulnerabilities that have been discovered in previous versions. + +Ready to update your kernel on CentOS 7 or one of their derivatives such as RHEL 7 and Fedora? If so, keep reading! + +### Step 1: Checking Installed Kernel Version + +When we install a distribution it includes a certain version of the Linux kernel. To show the current version installed on our system we can do: + +``` +# uname -sr +``` + +The following image shows the output of the above command in a CentOS 7 server: + +[ + ![Check Kernel Version in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-CentOS-7.png) +][2] + +Check Kernel Version in CentOS 7 + +If we now go to [https://www.kernel.org/][3], we will see that the latest kernel version is 4.10.1 at the time of this writing (other versions are available from the same site). + +One important thing to consider is the life cycle of a kernel version – if the version you are currently using is approaching its end of life, no more bug fixes will be provided after that date. For more info, refer to the [kernel Releases][4] page. + +### Step 2: Upgrading Kernel in CentOS 7 + +Most modern distributions provide a way to upgrade the kernel using a [package management system such as yum][5] and an officially-supported repository. + +However, this will only perform the upgrade to the most recent version available from the distribution’s repositories – not the latest one available in the [https://www.kernel.org/][6]. Unfortunately, Red Hat only allows to upgrade the kernel using the former option. + +As opposed to Red Hat, CentOS allows the use of ELRepo, a third-party repository that makes the upgrade to a recent version a kernel. + +To enable the ELRepo repository on CentOS 7, do: + +``` +# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org +# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm +``` +[ + ![Enable ELRepo in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Enable-ELRepo-in-CentOS-7.png) +][7] + +Enable ELRepo in CentOS 7 + +Once the repository has been enabled, you can use the following command to list the available kernel.related packages: + +``` +# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available +``` +[ + ![Yum - Find Available Kernel Versions](http://www.tecmint.com/wp-content/uploads/2017/03/Yum-Find-Available-Kernel-Versions.png) +][8] + +Yum – Find Available Kernel Versions + +Next, install the latest mainline stable kernel: + +``` +# yum --enablerepo=elrepo-kernel install kernel-ml +``` +[ + ![Install Latest Kernel Version in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Install-Latest-Kernel-Version-in-CentOS-7.png) +][9] + +Install Latest Kernel Version in CentOS 7 + +Finally, reboot your machine to apply the latest kernel, and then run following command to check the kernel version: + +``` +uname -sr +``` +[ + ![Verify Kernel Version](http://www.tecmint.com/wp-content/uploads/2017/03/Verify-Kernel-Version.png) +][10] + +Verify Kernel Version + +### Step 3: Set Default Kernel Version in GRUB + +To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows: + +Open and edit the file /etc/default/grub and set `GRUB_DEFAULT=0`. This means that the first kernel in the GRUB initial screen will be used as default. + +``` +GRUB_TIMEOUT=5 +GRUB_DEFAULT=0 +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet" +GRUB_DISABLE_RECOVERY="true" +``` + +Next, run the following command to recreate the kernel configuration. + +``` +# grub2-mkconfig -o /boot/grub2/grub.cfg +``` +[ + ![Set Kernel in GRUB](http://www.tecmint.com/wp-content/uploads/2017/03/Set-Kernel-in-GRUB.png) +][11] + +Set Kernel in GRUB + +Reboot and verify that the latest kernel is now being used by default. + +[ + ![Booting Default Kernel Version in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/03/Booting-Default-Kernel-Version.png) +][12] + +Booting Default Kernel Version in CentOS 7 + +Congratulations! You have upgraded your kernel in CentOS 7! + +##### Summary + +In this article we have explained how to easily upgrade the Linux kernel on your system. There is yet another method which we haven’t covered as it involves compiling the kernel from source, which would deserve an entire book and is not recommended on production systems. + +Although it represents one of the best learning experiences and allows for a fine-grained configuration of the kernel, you may render your system unusable and may have to reinstall it from scratch. + +If you are still interested in building the kernel as a learning experience, you will find instructions on how to do it at the [Kernel Newbies][13] page. + +As always, feel free to use the form below if you have any questions or comments about this article. + +-------------------------------------------------------------------------------- + +作者简介: + +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: http://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ + +作者:[Matei Cezar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/cezarmatei/ + +[1]:http://www.tecmint.com/upgrade-kernel-in-ubuntu/ +[2]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-CentOS-7.png +[3]:https://www.kernel.org/ +[4]:https://www.kernel.org/category/releases.html +[5]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[6]:https://www.kernel.org/ +[7]:http://www.tecmint.com/wp-content/uploads/2017/03/Enable-ELRepo-in-CentOS-7.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/03/Yum-Find-Available-Kernel-Versions.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/03/Install-Latest-Kernel-Version-in-CentOS-7.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/03/Verify-Kernel-Version.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/03/Set-Kernel-in-GRUB.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/03/Booting-Default-Kernel-Version.png +[13]:https://kernelnewbies.org/KernelBuild +[14]:http://www.tecmint.com/author/gacanepa/ +[15]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[16]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 7d0cba9edb035c5ff5a86c0b012f8bdbe1357262 Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:19:46 +0800 Subject: [PATCH 073/190] =?UTF-8?q?20170307-7=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Determine the File System Type in Linux.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md diff --git a/sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md b/sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md new file mode 100644 index 0000000000..0728657f09 --- /dev/null +++ b/sources/tech/20170304 7 Ways to Determine the File System Type in Linux.md @@ -0,0 +1,157 @@ +7 Ways to Determine the File System Type in Linux (Ext2, Ext3 or Ext4) +============================================================ + + +A file system is the way in which files are named, stored, retrieved as well as updated on a storage disk or partition; the way files are organized on the disk. + +A file system is divided in two segments called: User Data and Metadata (file name, time it was created, modified time, it’s size and location in the directory hierarchy etc). + +In this guide, we will explain seven ways to identify your Linux file system type such as Ext2, Ext3, Ext4, BtrFS, GlusterFS plus many more. + +### 1\. Using df Command + +df command reports file system disk space usage, to include the file system type on a particular disk partition, use the `-T` flag as below: + +``` +$ df -Th +OR +$ df -Th | grep "^/dev" +``` +[ + ![df Command - Find Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/Find-Filesystem-Type-Using-df-Command.png) +][3] + +df Command – Find Filesystem Type + +For a comprehensive guide for df command usage go through our articles: + +1. [12 Useful “df” Commands to Check Disk Space in Linux][1] +2. [Pydf – An Alternative ‘df’ Command That Shows Disk Usage in Colours][2] + +### 2\. Using fsck Command + +fsck is used to check and optionally [repair Linux file systems][4], it can also print the [file system type on specified disk partitions][5]. + +The flag `-N` disables checking of file system for errors, it just shows what would be done (but all we need is the file system type): + +``` +$ fsck -N /dev/sda3 +$ fsck -N /dev/sdb1 +``` +[ + ![fsck - Print Linux Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/fsck-Print-Linux-Filesystem-Type.png) +][6] + +fsck – Print Linux Filesystem Type + +### 3\. Using lsblk Command + +lsblk displays block devices, when used with the `-f` option, it prints file system type on partitions as well: + +``` +$ lsblk -f +``` +[ + ![lsblk - Shows Linux Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/lsblk-Shows-Linux-Filesystem-Type.png) +][7] + +lsblk – Shows Linux Filesystem Type + +### 4\. Using mount Command + +mount command is used to [mount a file system in Linux][8], it can also be used to [mount an ISO image][9], [mount remote Linux filesystem][10] and so much more. + +When run without any arguments, it prints [info about disk partitions][11] including the file system type as below: + +``` +$ mount | grep "^/dev" +``` +[ + ![Mount - Show Filesystem Type in Linux](http://www.tecmint.com/wp-content/uploads/2017/03/Mount-Show-Filesystem-Type.png) +][12] + +Mount – Show Filesystem Type in Linux + +### 5\. Using blkid Command + +blkid command is used to [find or print block device properties][13], simply specify the disk partition as an argument like so: + +``` +$ blkid /dev/sda3 +``` +[ + ![blkid - Find Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/blkid-Find-Filesystem-Type.png) +][14] + +blkid – Find Filesystem Type + +### 6\. Using file Command + +file command identifies file type, the `-s` flag enables reading of block or character files and `-L` enables following of symlinks: + +``` +$ sudo file -sL /dev/sda3 +``` +[ + ![file - Identifies Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/file-command-identifies-filesystem-type.png) +][15] + +file – Identifies Filesystem Type + +### 7\. Using fstab File + +The /etc/fstab is a static file system info (such as mount point, file system type, mount options etc) file: + +``` +$ cat /etc/fstab +``` +[ + ![Fstab - Shows Linux Filesystem Type](http://www.tecmint.com/wp-content/uploads/2017/03/fstab-shows-filesystem-types.png) +][16] + +Fstab – Shows Linux Filesystem Type + +That’s it! In this guide, we explained seven ways to identify your Linux file system type. Do you know of any method not mentioned here? Share it with us in the comments. + +-------------------------------------------------------------------------------- + +作者简介: + +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: http://www.tecmint.com/find-linux-filesystem-type/ + +作者:[Aaron Kili][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/how-to-check-disk-space-in-linux/ +[2]:http://www.tecmint.com/pyd-command-to-check-disk-usage/ +[3]:http://www.tecmint.com/wp-content/uploads/2017/03/Find-Filesystem-Type-Using-df-Command.png +[4]:http://www.tecmint.com/defragment-linux-system-partitions-and-directories/ +[5]:http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/ +[6]:http://www.tecmint.com/wp-content/uploads/2017/03/fsck-Print-Linux-Filesystem-Type.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/03/lsblk-Shows-Linux-Filesystem-Type.png +[8]:http://www.tecmint.com/sshfs-mount-remote-linux-filesystem-directory-using-ssh/ +[9]:http://www.tecmint.com/extract-files-from-iso-files-linux/ +[10]:http://www.tecmint.com/sshfs-mount-remote-linux-filesystem-directory-using-ssh/ +[11]:http://www.tecmint.com/linux-tools-to-monitor-disk-partition-usage/ +[12]:http://www.tecmint.com/wp-content/uploads/2017/03/Mount-Show-Filesystem-Type.png +[13]:http://www.tecmint.com/find-usb-device-name-in-linux/ +[14]:http://www.tecmint.com/wp-content/uploads/2017/03/blkid-Find-Filesystem-Type.png +[15]:http://www.tecmint.com/wp-content/uploads/2017/03/file-command-identifies-filesystem-type.png +[16]:http://www.tecmint.com/wp-content/uploads/2017/03/fstab-shows-filesystem-types.png +[17]:http://www.tecmint.com/find-linux-filesystem-type/# +[18]:http://www.tecmint.com/find-linux-filesystem-type/# +[19]:http://www.tecmint.com/find-linux-filesystem-type/# +[20]:http://www.tecmint.com/find-linux-filesystem-type/# +[21]:http://www.tecmint.com/find-linux-filesystem-type/#comments +[22]:http://www.tecmint.com/author/aaronkili/ +[23]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[24]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 1f0140f40aa5d60f6373077c25b70c7bc0d8dc0e Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:24:26 +0800 Subject: [PATCH 074/190] =?UTF-8?q?20170307-8=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...o a User on Specific Directory in Linux.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md diff --git a/sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md b/sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md new file mode 100644 index 0000000000..da5dec793d --- /dev/null +++ b/sources/tech/20170307 Assign Read-Write Access to a User on Specific Directory in Linux.md @@ -0,0 +1,152 @@ +Assign Read/Write Access to a User on Specific Directory in Linux +============================================================ + + +In a previous article, we showed you how to [create a shared directory in Linux][3]. Here, we will describe how to give read/write access to a user on a specific directory in Linux. + +There are two possible methods of doing this: the first is [using ACLs (Access Control Lists)][4] and the second is [creating user groups to manage file permissions][5], as explained below. + +For the purpose of this tutorial, we will use following setup. + +``` +Operating system: CentOS 7 +Test directory: /shares/project1/reports +Test user: tecmint +Filesystem type: Ext4 +``` + +Make sure all commands are executed as root user or use the the [sudo command][6] with equivalent privileges. + +Let’s start by creating the directory called `reports` using the mkdir command: + +``` +# mkdir -p /shares/project1/reports +``` + +### Using ACL to Give Read/Write Access to User on Directory + +Important: To use this method, ensure that your Linux filesystem type (such as Ext3 and Ext4, NTFS, BTRFS) support ACLs. + +1. First, [check the current file system type][7] on your system, and also whether the kernel supports ACL as follows: + +``` +# df -T | awk '{print $1,$2,$NF}' | grep "^/dev" +# grep -i acl /boot/config* +``` + +From the screenshot below, the filesystem type is Ext4 and the kernel supports POSIX ACLs as indicated by the CONFIG_EXT4_FS_POSIX_ACL=y option. + +[ + ![Check Filesystem Type and Kernel ACL Support](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Filesystem-Type-and-Kernel-ACL-Support.png) +][8] + +Check Filesystem Type and Kernel ACL Support + +2. Next, check if the file system (partition) is mounted with ACL option or not: + +``` +# tune2fs -l /dev/sda1 | grep acl +``` +[ + ![Check Partition ACL Support](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Partition-ACL-Support.png) +][9] + +Check Partition ACL Support + +From the above output, we can see that default mount option already has support for ACL. If in case it’s not enabled, you can enable it for the particular partition (/dev/sda3 for this case): + +``` +# mount -o remount,acl / +# tune2fs -o acl /dev/sda3 +``` + +3. Now, its time to assign a read/write access to a user `tecmint` to a specific directory called `reports`by running the following commands. + +``` +# getfacl /shares/project1/reports # Check the default ACL settings for the directory +# setfacl -m user:tecmint:rw /shares/project1/reports # Give rw access to user tecmint +# getfacl /shares/project1/reports # Check new ACL settings for the directory +``` +[ + ![Give Read/Write Access to Directory Using ACL](http://www.tecmint.com/wp-content/uploads/2017/03/Give-Read-Write-Access-to-Directory-Using-ACL.png) +][10] + +Give Read/Write Access to Directory Using ACL + +In the screenshot above, the user `tecmint` now has read/write (rw) permissions on directory /shares/project1/reports as seen from the output of the second getfacl command. + +For more information about ACL lists, do check out our following guides. + +1. [How to Use ACLs (Access Control Lists) to Setup Disk Quotas for Users/Groups][1] +2. [How to Use ACLs (Access Control Lists) to Mount Network Shares][2] + +Now let’s see the second method of assigning read/write access to a directory. + +### Using Groups to Give Read/Write Access to User on Directory + +1. If the user already has a default user group (normally with same name as username), simply change the group owner of the directory. + +``` +# chgrp tecmint /shares/project1/reports +``` + +Alternatively, create a new group for multiple users (who will be given read/write permissions on a specific directory), as follows. However, this will c[reate a shared directory][11]: + +``` +# groupadd projects +``` + +2. Then add the user `tecmint` to the group `projects` as follows: + +``` +# usermod -aG projects tecmint # add user to projects +# groups tecmint # check users groups +``` + +3. Change the group owner of the directory to projects: + +``` +# chgrp projects /shares/project1/reports +``` + +4. Now set read/write access for the group members: + +``` +# chmod -R 0760 /shares/projects/reports +# ls -l /shares/projects/ #check new permissions +``` + +That’s it! In this tutorial, we showed you how to give read/write access to a user on a specific directory in Linux. If any issues, do ask via 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: http://www.tecmint.com/give-read-write-access-to-directory-in-linux/ + +作者:[Aaron Kili][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ +[1]:http://www.tecmint.com/set-access-control-lists-acls-and-disk-quotas-for-users-groups/ +[2]:http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares/ +[3]:http://www.tecmint.com/create-a-shared-directory-in-linux/ +[4]:http://www.tecmint.com/secure-files-using-acls-in-linux/ +[5]:http://www.tecmint.com/manage-users-and-groups-in-linux/ +[6]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[7]:http://www.tecmint.com/find-linux-filesystem-type/ +[8]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Filesystem-Type-and-Kernel-ACL-Support.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Partition-ACL-Support.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/03/Give-Read-Write-Access-to-Directory-Using-ACL.png +[11]:http://www.tecmint.com/create-a-shared-directory-in-linux/ +[12]:http://www.tecmint.com/author/aaronkili/ +[13]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[14]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 4b0aba03d99f81de32a774fbee85393a67aea834 Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:25:55 +0800 Subject: [PATCH 075/190] =?UTF-8?q?20170307-9=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rade Kernel to Latest Version in Ubuntu.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md diff --git a/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md new file mode 100644 index 0000000000..8aaff488bf --- /dev/null +++ b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md @@ -0,0 +1,91 @@ +How to Upgrade Kernel to Latest Version in Ubuntu +============================================================ + + +Periodically new devices and technology coming out and it’s important to keep our Linux system kernel up-to-date if we want to get the most of out it. Moreover, updating system kernel will ease us to take advantage of new kernel fuctions and also it helps us to protect ourselves from vulnerabilities that have been found in earlier versions. + +**Suggested Read:** [How to Upgrade Kernel in CentOS 7][1] + +Ready to update your kernel on Ubuntu 16.04 or one of their derivatives such as Debian and Linux Mint? If so, keep reading! + +### Step 1: Check Installed Kernel Version + +To find the current version of installed kernel on our system we can do: + +``` +$ uname -sr +``` + +The following image shows the output of the above command in a Ubuntu 16.04 server: + +[ + ![Check Kernel Version in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png) +][2] + +Check Kernel Version in Ubuntu + +### Step 2: Upgrading Kernel in Ubuntu 16.04 + +To upgrade the kernel in Ubuntu 16.04, go to [http://kernel.ubuntu.com/~kernel-ppa/mainline/][3] and choose the desired version from the list by clicking on it. + +Next, download the `.deb` files for your system architecture (see highlighted in yellow below for a 32-bit system): + +``` +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913_4.9.13-040913.201702260631_all.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-image-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +``` + +Once you’ve downloaded all the above kernel files, now install them as follows: + +``` +$ sudo dpkg -i *.deb +``` + +Once the installation is complete, reboot your machine and verify that the new kernel version is being used: + +``` +$ uname -sr +``` + +And that’s it. You are now using a much more recent kernel version than the one installed by default with Ubuntu 16.04. + +##### Summary + +In this article we’ve shown how to easily upgrade the Linux kernel on Ubuntu system. There is yet another procedure which we haven’t showed here as it requires compiling the kernel from source, which is not recommended on production Linux systems. + +If you’re still interested in compiling the kernel as a learning experience, you will get the instructions on how to do it at the [Kernel Newbies][4] page. + +As always, feel free to use the form below if you have any questions or comments about this article. + +-------------------------------------------------------------------------------- + + +作者简介: + +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. + +-------------------------------------------------------------------------------- +作者简介: + +Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/upgrade-kernel-in-ubuntu/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ + +[1]:http://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ +[2]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png +[3]:http://kernel.ubuntu.com/~kernel-ppa/mainline/ +[4]:https://kernelnewbies.org/KernelBuild +[5]:http://www.tecmint.com/author/gacanepa/ +[6]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[7]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 2695f37e281f6b727a106143cbfb36c90dbcd45f Mon Sep 17 00:00:00 2001 From: Ezio Date: Tue, 7 Mar 2017 21:27:41 +0800 Subject: [PATCH 076/190] =?UTF-8?q?20170307-10=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...erstanding 7z command switches - part I.md | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 sources/tech/20170306 Understanding 7z command switches - part I.md diff --git a/sources/tech/20170306 Understanding 7z command switches - part I.md b/sources/tech/20170306 Understanding 7z command switches - part I.md new file mode 100644 index 0000000000..b804a053e8 --- /dev/null +++ b/sources/tech/20170306 Understanding 7z command switches - part I.md @@ -0,0 +1,272 @@ +Understanding 7z command switches - part I +============================================================ + +### On this page + +1. [Include files][1] +2. [Exclude files][2] +3. [Set password for your archive][3] +4. [Set output directory][4] +5. [Creating multiple volumes][5] +6. [Set compression level of archive][6] +7. [Display technical information of archive][7] + +7z is no doubt a feature-rich and powerful archiver (claimed to offer the highest compression ratio). Here at HowtoForge, we have [already discussed][9] how you can install and use it. But the discussion was limited to basic features that you can access using the 'function letters' the tool provides. + +Expanding our coverage on the tool, here in this tutorial, we will be discussing some of the 'switches' 7z offers. But before we proceed, it's worth sharing that all the instructions and commands mentioned in this tutorial have been tested on Ubuntu 16.04 LTS. + +**Note**: We will be using the files displayed in the following screenshot for performing various operations using 7zip. + +[ + ![ls from test directory](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/ls.png) +][10] + +### +Include files + +The 7z tool allows you selectively include files in an archive. This feature can be accessed using the -i switch. + +Syntax: + +-i[r[-|0]]{@listfile|!wildcard} + +For example, if you want to include only ‘.txt’ files in your archive, you can use the following command: + +$ 7z a ‘-i!*.txt’ include.7z + +Here is the output: + +[ + ![add files to 7zip](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/include.png) +][11] + +Now, to check whether the newly-created archive file contains only ‘.txt’ file or not, you can use the following command: + +$ 7z l include.7z + +Here is the output: + +[ + ![Result](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/includelist.png) +][12] + +In the above screenshot, you can see that only ‘testfile.txt’ file has been added to the archive. + +### Exclude files + +If you want, you can also exclude the files that you don’t need. This can be done using the -x switch. + +Syntax: + +-x[r[-|0]]]{@listfile|!wildcard} + +For example, if you want to exclude a file named ‘abc.7z’ from the archive that you are going to create, then you can use the following command: + +$ 7z a ‘-x!abc.7z’ exclude.7z + +Here is the output: + +[ + ![exclude files from 7zip](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/exclude.png) +][13] + +To check whether the resulting archive file has excluded ‘abc.7z’ or not, you can use the following command: + +$ 7z l exclude.7z + +Here is the output: + +[ + ![result of file exclusion](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/excludelist.png) +][14] + +In the above screenshot, you can see that ‘abc.7z’ file has been excluded from the new archive file. + +**Pro tip**: Suppose the task is to exclude all the .7z files with names starting with letter ‘t’ and include all .7z files with names starting with letter ‘a’ . This can be done by combining both ‘-i’ and ‘-x’ switches in the following way: + +$ 7z a '-x!t*.7z' '-i!a*.7z' combination.7z + +### Set password for your archive + +7z also lets you password protect your archive file. This feature can be accessed using the -p switch. + +$ 7z a [archive-filename] -p[your-password] -mhe=[on/off] + +**Note**: The -mhe option enables or disables archive header encryption (default is off). + +For example: + +$ 7z a password.7z -pHTF -mhe=on + +Needless to say, when you will extract your password protected archive, the tool will ask you for the password. To extract a password-protected file, use the 'e' function letter. Following is an example: + +$ 7z e password.7z + +[ + ![protect 7zip archive with a password](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/password.png) +][15] + +### Set output directory + +The tool also lets you extract an archive file in the directory of your choice. This can be done using the -o switch. Needless to say, the switch only works when the command contains either the ‘e’ function letter or the ‘x’ function letter. + +$ 7z [e/x] [existing-archive-filename] -o[path-of-directory] + +For example, suppose the following command is run in the present working directory: + +$ 7z e output.7z -ohow/to/forge + +And, as the value passed to the -o switch suggests, the aim is to extract the archive in the ./how/to/forge directory. + +Here is the output: + +[ + ![7zip output directory](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/output.png) +][16] + +In the above screenshot, you can see that all the contents of existing archive file has been extracted. But where? To check whether or not the archive file has been extracted in the ./how/to/forge directory or not, we can use the ‘ls -R’ command. + +[ + ![result](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/ls_-R.png) +][17] + +In the above screenshot, we can see that all the contents of output.7z have indeed been extracted to ./how/to/forge. + +### Creating multiple volumes + +With the help of the 7z tool, you can create multiple volumes (smaller sub-archives) of your archive file. This is very useful when transferring large files over a network or in a USB. This feature can be accessed using the -v switch. The switch requires you to specify size of sub-archives. + +We can specify size of sub-archives in bytes (b), kilobytes (k), megabytes (m) and gigabytes (g). + +$ 7z a [archive-filename] [files-to-archive] -v[size-of-sub-archive1] -v[size-of-sub-archive2] .... + +Let's understand this using an example. Please note that we will be using a new directory for performing operations on the -v switch. + +Here is the screenshot of the directory contents: + +[ + ![7zip volumes](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/volumels.png) +][18] + +Now, we can run the following command for creating multiple volumes (sized 100b each) of an archive file: + +7z a volume.7z * -v100b + +Here is the screenshot: + +[ + ![compressing volumes](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/volume.png) +][19] + +Now, to see the list of sub-archives that were created, use the ‘ls’ command. + +[ + ![list of archives](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/volumels2.png) +][20] + +As seen in the above screenshot, a total of four multiple volumes have been created - volume.7z.001, volume.7z.002, volume.7z.003, and volume.7z.004 + +**Note**: You can extract files using the .7z.001 archive. But, for that, all the other sub-archive volumes should be present in the same directory. + +### Set compression level of archive + +7z also allows you to set compression levels of your archives. This feature can be accessed using the -m switch. There are various compression levels in 7z, such as -mx0, -mx1, -mx3, -mx5, -mx7 and -mx9. + +Here's a brief summary about these levels: + +-**mx0** = Don't compress at all - just copy the contents to archive. +-**mx1** = Consumes least time, but compression is low. +-**mx3** = Better than -mx1. +-**mx5** = This is default (compression is normal). +-**mx7** = Maximum compression. +-**mx9** = Ultra compression. + +**Note**: For more information on these compression levels, head [here][8]. + +$ 7z a [archive-filename] [files-to-archive] -mx=[0,1,3,5,7,9] + +For example, we have a bunch of files and folders in a directory, which we tried compressing using a different compression level each time. Just to give you an idea, here's the command used when the archive was created with compression level '0'. + +$ 7z a compression(-mx0).7z * -mx=0 + +Similarly, other commands were executed. + +Here is the list of output archives (produced using the 'ls' command), with their names suggesting the compression level used in their creation, and the fifth column in the output revealing the effect of compression level on their size. + +[ + ![7zip compression level](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/compression.png) +][21] + +### +Display technical information of archive + +If you want, 7z also lets you display technical information of an archive - it's type, physical size, header size, and so on - on the standard output. This feature can be accessed using the -slt switch. This switch only works with the ‘l’ function letter. + +$ 7z l -slt [archive-filename] + +For example: + +$ 7z l -slt abc.7z + +Here is the output: + +[ + ![](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/slt.png) +][22] + +# Specify type of archive to create + +If you want to create a non 7zip archive (which gets created by default), you can specify your choice using the -t switch.  + +$ 7z a -t[specify-type-of-archive] [archive-filename] [file-to-archive] + +The following example shows a command to create a .zip file: + +7z a -tzip howtoforge * + +The output file produced is 'howtoforge.zip'. To cross verify its type, use the 'file' command: + +[ + ![](https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/type.png) +][23] + +So, howtoforge.zip is indeed a ZIP file. Similarly, you can create other kind of archives that 7z supports. + +# Conclusion + +As you would agree, the knowledge of 7z 'function letters' along with 'switches' lets you make the most out of the tool. We aren't yet done with switches - there are some more that will be discussed in part 2. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/understanding-7z-command-switches/ + +作者:[ Himanshu Arora][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/ +[1]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#include-files +[2]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#exclude-files +[3]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#set-password-for-your-archive +[4]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#set-output-directory +[5]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#creating-multiple-volumes +[6]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#set-compression-level-of-archive +[7]:https://www.howtoforge.com/tutorial/understanding-7z-command-switches/#display-technical-information-of-archive +[8]:http://askubuntu.com/questions/491223/7z-ultra-settings-for-zip-format +[9]:https://www.howtoforge.com/tutorial/how-to-install-and-use-7zip-file-archiver-on-ubuntu-linux/ +[10]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/ls.png +[11]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/include.png +[12]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/includelist.png +[13]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/exclude.png +[14]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/excludelist.png +[15]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/password.png +[16]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/output.png +[17]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/ls_-R.png +[18]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/volumels.png +[19]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/volume.png +[20]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/volumels2.png +[21]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/compression.png +[22]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/slt.png +[23]:https://www.howtoforge.com/images/understanding_7z_command_switches_part_i/big/type.png From e33df1b65808dcc93a797ecf70e90885501993df Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 7 Mar 2017 21:47:21 +0800 Subject: [PATCH 077/190] PUB:20170116 Terrible Ideas in Git.md @geekpi @bestony --- published/20170116 Terrible Ideas in Git.md | 36 +++++++++++++++++ .../talk/20170116 Terrible Ideas in Git.md | 39 ------------------- 2 files changed, 36 insertions(+), 39 deletions(-) create mode 100644 published/20170116 Terrible Ideas in Git.md delete mode 100644 translated/talk/20170116 Terrible Ideas in Git.md diff --git a/published/20170116 Terrible Ideas in Git.md b/published/20170116 Terrible Ideas in Git.md new file mode 100644 index 0000000000..ff4e171f13 --- /dev/null +++ b/published/20170116 Terrible Ideas in Git.md @@ -0,0 +1,36 @@ +Git 中的那些可怕的事 +============================================================ + + +![Corey Quinn](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/corey-quinn-lcna.png) + +在 LinuxCon 北美会议上 FutureAdvisor 的 Corey Quinn 说:“Git 的确让你可以做一些超级强大的事。‘强大’,在这次讲演中,这是一种说你愚蠢的委婉说法”。在使用 Git 时,谁没有经历让你感觉自己像个傻子的时刻?当然,Git 是很棒的,每个人都在使用它,你可以用几个基本命令完成你的大部分工作。但它也有一些强大的功能,让我们觉得我们不知道我们在做什么。 + +但这真的对我们来说不公平。没有人会知道一切,每个人知道的都不同。Quinn 提醒我们:“在我许多讲演的问答部分,人们有时举手说:“嗯,我有一个傻问题。” 你看到人们在那里说:“是啊!这是一个非常愚蠢的问题”。但是当他们得到答案时,那些这么说的人也正在低头记笔记。 + +![Git](https://www.linux.com/sites/lcom/files/styles/floated_images/public/heffalump-git-corey-quinn_0.png) + +Quinn 在演讲的开始做了一些有趣的演示,演示了一些你可以用 Git 做到的可怕的事情,例如变基主干然后进行强制推送来搞乱整个项目、胡乱输入一些命令让 git 吐槽、提交大型二进制文件等。然后他演示了如何使这些可怕的事情不怎么可怕,如更加明智地管理大型二进制文件。“你可以提交大型二进制文件,你可以在 Git 中暴力提交,如果你需要存储大的二进制文件,这里有两个工具会可以加速载入,一个是 git-annex,这是由 Debian 开发人员 Joey Hess 开发的,而 git-lfs 是由 GitHub 支持的。” + +你经常同样地错误输入么?例如,当你想要 `git status` 时却输入 `git stitis`?Quinn 有一个方案:“Git 有内置的别名支持,所以你可以将相对较长、复杂的东西命名为一个短的 Git 命令。” 此外,你还可以使用 shell 别名。 + +Quinn 说:“我们都听说过变基主干然后强制推送这样的搞笑恶作剧,它会改变版本历史,突然发生的事情让所有人都措手不及,每个人都被卷入了这种混乱当中。一群鲸鱼被称为“pod”,一群乌鸦中被称为“谋杀”,一群开发者被称为“合并冲突”……更严重的是,如果有人干了这种事情,你有几个选择。包括从备份中恢复主干,还原提交;或者把责任人从屋顶上尖叫着扔下去。或者,采取一定的预防措施并使用一个并不知名的 Git 功能称为分支保护。启用分支保护后,无法删除或强制推送分支,并且在接受前,拉取请求(pull request)必须至少有一个审核。” + +Quinn 演示了几个更奇妙的有用的工具,使 Git 更高效和万无一失,如 mr、vcsh 和定制的 shell 提示。你可以在下面看到完整的视频,了解更多有趣的事情。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/event/LinuxCon-Europe/2016/terrible-ideas-git-0 + +作者:[CARLA SCHRODER][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Bestony](https://github.com/Bestony) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/cschroder +[1]:https://www.linux.com/licenses/category/used-permission +[2]:https://www.linux.com/licenses/category/linux-foundation +[3]:https://www.linux.com/files/images/heffalump-git-corey-quinnpng-0 +[4]:https://www.linux.com/files/images/corey-quinn-lcnapng +[5]:http://events.linuxfoundation.org/events/linuxcon-north-america diff --git a/translated/talk/20170116 Terrible Ideas in Git.md b/translated/talk/20170116 Terrible Ideas in Git.md deleted file mode 100644 index 53b3c6c76a..0000000000 --- a/translated/talk/20170116 Terrible Ideas in Git.md +++ /dev/null @@ -1,39 +0,0 @@ -Git 中糟糕的想法 -============================================================ - - -![Corey Quinn](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/corey-quinn-lcna.png) -在 LinuxCon 北美会议上 FutureAdvisor 的 Corey Quinn 说:“Git 的确让你可以做一些额外的强大的事。但是在这次谈论中,强大是愚蠢的一种委婉说法” [Linux 基金会][2] - -在 LinuxCon 北美会议上 FutureAdvisor 的 Corey Quinn 说:“Git 的确让你可以做一些额外的强大的事。但是在这次谈论中,强大是愚蠢的委婉说法”。在使用 Git 时,谁没有至少经历一个时刻让你感觉自己像个傻子?当然,Git 是很棒的,每个人都在使用它,你可以用几个基本命令完成你的大部分工作。但它也有一些强大的功能,让我们觉得我们不知道我们在做什么。 - -但这真的对我们自己不公平。没有人知道一切,每个人知道的都不同。Quinn 提醒我们:“在我许多谈话的 QA 部分,人们有时举手说:“嗯,我有一个傻问题。” 你看到人们在那里说:“是啊!这是一个非常愚蠢的问题”。但是当他们得到答案时,这些人正在大量记笔记。 - -![Git](https://www.linux.com/sites/lcom/files/styles/floated_images/public/heffalump-git-corey-quinn_0.png) - -[有权限使用][1] - -Quinn 开始了一些有趣的演示,你可以用 Git 做一些可怕的事情,例如 rebase master 然后进行强制推送搞乱整个项目、输入错误命令并收到 git 提示、提交大型二进制文件等。然后他演示了如何使这些可怕的事情不怎么可怕,如更加明智地管理大型二进制文件。“你可以提交大的二进制文件,你可以在 Git 中提交大文件,如果你需要存储大的二进制文件,这里有两个工具会真的加快加载,一个是 git-annex,这是由 Debian 开发人员 Joey Hess 开发的,而 git-lfs 是由 GitHub 支持的。 - -你有连续输入错误么?例如,当你想要 “git status” 时却输入 “git stitis”?Quinn 有一个方案:“Git 确实对别名有内置支持,所以你可以使用相对较长、复杂的东西,并把它命名为一个短的 Git 命令。” 你还可以使用 shell 别名。 - -Quinn 说:“我们都听说过 rebase master 然后强制推送,这样一个给你所有同事的搞笑恶作剧,它会改变历史,所以突然之前发生的事情并不是人们真正在做的事,而且其他人都被卷入了这个过程。。一群鲸鱼被称为“pod”,一群乌鸦中被称为“谋杀”,一群开发者被称为“合并冲突”。。。更严重的是,如果有人这样做,你有几个选择。包括从备份中恢复 master,还原提交,或者把责任人从屋顶扔下去。或者,采取一定的预防措施并使用一个并不知名的 Git 功能称为分支保护。启用分支保护后,无法删除或强制推送分支,并且在接受前,合并请求必须至少有一个审核。” - -Quinn 演示了几个更奇妙的有用的工具,使 Git 更高效和万无一失,如 mr、vcsh和定制的 shell 提示。你可以在下面看到完整的视频,了解更多有趣的事情。 - --------------------------------------------------------------------------------- - -via: https://www.linux.com/news/event/LinuxCon-Europe/2016/terrible-ideas-git-0 - -作者:[CARLA SCHRODER][a] -译者:[geekpi](https://github.com/geekpi) -校对:[Bestony](https://github.com/Bestony) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/cschroder -[1]:https://www.linux.com/licenses/category/used-permission -[2]:https://www.linux.com/licenses/category/linux-foundation -[3]:https://www.linux.com/files/images/heffalump-git-corey-quinnpng-0 -[4]:https://www.linux.com/files/images/corey-quinn-lcnapng -[5]:http://events.linuxfoundation.org/events/linuxcon-north-america From b273e7c989ee563891127435be6891d584ca6bb7 Mon Sep 17 00:00:00 2001 From: wxy Date: Tue, 7 Mar 2017 22:55:13 +0800 Subject: [PATCH 078/190] PUB:20170213 A beginners guide to understanding sudo on Ubuntu.md @ypingcn @jasminepeng --- ...s guide to understanding sudo on Ubuntu.md | 215 ++++++++++++++++ ...s guide to understanding sudo on Ubuntu.md | 239 ------------------ 2 files changed, 215 insertions(+), 239 deletions(-) create mode 100644 published/20170213 A beginners guide to understanding sudo on Ubuntu.md delete mode 100644 translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md diff --git a/published/20170213 A beginners guide to understanding sudo on Ubuntu.md b/published/20170213 A beginners guide to understanding sudo on Ubuntu.md new file mode 100644 index 0000000000..2c67da1011 --- /dev/null +++ b/published/20170213 A beginners guide to understanding sudo on Ubuntu.md @@ -0,0 +1,215 @@ +sudo 入门指南 +============================================================ + +你在使用 Linux 命令行时曾经得到过“拒绝访问(Permission denied)”的错误提示吗?这可能是因为你正在尝试执行一个需要 root 权限的操作。例如,下面的截图展示了当我尝试复制一个二进制文件到一个系统目录时产生的错误。 + +[ + ![shell 的拒绝访问](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) +][11] + +那么该怎么解决这个错误?很简单,使用 `sudo` 命令。 + +[ + ![用 sudo 运行命令](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) +][12] + +用户运行此命令后会被提示输入他们(**自己**)的登录密码。一旦输入了正确的密码,操作将会成功执行。 + +毫无疑问,`sudo` 是任何在 Linux 上使用命令行的人都必须知道的命令。但是,为了更负责、更有效地使用该命令,你还是要知道一些相关(及深入)的细节。这正是我们将会在这篇文章中讨论的。 + +*在我们继续之前,值得提一下的是,这篇文章所提到的所有命令指示都已经在 Ubuntu 14.04 LTS 下的 4.3.11 版 Bash 下通过测试。* + +### 什么是 sudo + +正如你们大部分人所知道的,`sudo` 用来执行需要提升权限(通常是作为 root 用户)的命令。在这篇文章之前的简介部分已经讨论过这样的一个例子。然而,如果你想的话,你能用 `sudo` 以其它(非 root )用户运行命令。 + +这是由工具提供的 `-u` 命令行选项所实现的。举个例子,如下例所展示的那样,我(`himanshu`)尝试将一个在其他用户(`howtoforge`)的 Home 目录中的文件重命名,但是得到一个“访问拒绝”的错误。然后我加上 `sudo -u howtoforge` 后用同样的“mv”命令,命令成功执行了: + +[ + ![什么是 sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) +][13] + +### 任何人都能用 sudo 吗? + +不是。一个用户要能使用 `sudo` ,应该在 `/etc/sudoers` 文件里有一条跟该用户相关的信息。下述摘自 Ubuntu 网站的一段能讲得更清楚: + +> `/etc/sudoers` 文件控制了谁能以哪个用户的身份在哪个机器上运行什么命令,还可以控制特别的情况,例如对于特定的命令是否需要输入密码。这个文件由别名aliases(基本变量)和用户标识user specifications(控制谁能运行什么命令)组成。 + +如果你正在使用 Ubuntu,让一个用户能运行 `sudo` 命令很容易:你所需要做的就是把账户类型改成管理员administrator。这可直接在 系统设置System Settings -> 用户账户 User Accounts里完成。 + + +[ + ![sudo 用户](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) +][14] + +首先解锁该窗口: + +[ + ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) +][15] + +然后选择你想改变用户类型的用户,然后将类型改成管理员administrator。 + +[ + ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) +][16] + +然而,如果你不使用 Ubuntu,或者你的发行版没有提供这个特性,你可以手动编辑 `/etc/sudoers` 文件来实现此改变。要在文件中添加这样的一行: + + +``` +[user] ALL=(ALL:ALL) ALL +``` + +无需赘言,`[user]` 应该用你想提升 sudo 权限的用户的用户名所代替。在这里值得提到的一件重要的事情是,官方建议通过 `visudo` 命令编辑该文件 —— 你需要做的就是运行下述命令: + +``` +sudo visudo +``` + +为了说清究竟是怎么一回事,这里有段从 `visudo` 手册里的摘要: + +> `visudo` 以安全的模式编辑 `sudoers` 文件。`visudo` 锁定 `sudoers` 文件以防多个编辑同时进行,提供基本的检查(sanity checks)和语法错误检查。如果 `sudoers` 文件现在正在被编辑,你将会收到一个信息提示稍后再试。 + +关于 visudo 的更多信息,前往[这里][17]。 + +### 什么是 sudo 会话 + +如果你经常使用 `sudo` 命令,你肯定注意到过当你成功输入一次密码后,可以不用输入密码再运行几次 `sudo` 命令。但是一段时间后,`sudo` 命令会再次要求你的密码。 + +这种现象跟运行 `sudo` 命令数目无关,跟时间有关。是的,`sudo` 默认在输入一次密码后 15 分钟内不会再次要求密码。15 分钟后,你会再次被要求输入密码。 + +然而,如果你想的话,你能改变这种现象。用以下命令打开 `/etc/sudoers` 文件: + +``` +sudo visudo +``` + +找到这一行: + +``` +Defaults env_reset +``` + +[ + ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) +][18] + +然后在这行最后添加以下变量: + +``` +Defaults env_reset,timestamp_timeout=[new-value] +``` + +`[new-value]` 为想要 `sudo` 会话持续的时间数。例如,设数值为 40。 + +[ + ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) +][19] + +如果你希望每次使用 `sudo` 命令时都要求输入密码,你可以把这个变量赋值为 0 。想要 `sudo` 会话永远不过时,应赋值为 -1。 + +注意将 `timestamp_timeout` 的值赋为 “-1” 是强烈不推荐的。 + +### sudo 密码 + +你可能注意过,当 `sudo` 要求输入密码然后你开始输入时,不会显示任何东西 —— 甚至连常规的星号都没有。虽然这不是什么大问题,不过一些用户就是希望显示星号。 + +好消息是那有可能也很容易做到。所有你需要做的就是在 `/etc/sudoers` 文件里将下述的行: + +``` +Defaults env_reset +``` + +改成 + +``` +Defaults env_reset,pwfeedback +``` + +然后保存文件。 + +现在,无论什么时候输入 `sudo` 密码,星号都会显示。 + +[ + ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) +][20] + +### 一些重要的 sudo 命令行参数 + +除了 `-u` 命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 `sudo` 命令行参数值得注意。在这部分,我们将会讨论其中一些。 + +#### -k 参数 + +考虑下这种情况:输入密码后你刚刚运行了几个 `sudo` 驱动的命令。现在,如你所知,sudo 会话默认保持 15 分钟。假设在这会话期间,你需要让某些人访问你的终端,但你不想让他们可以使用 `sudo` ,你将会怎么做? + +还好,有 `-k` 命令行参数允许用户取消 `sudo` 权限。这是 `sudo` 帮助页面(man page)对此的解释: + +> `-k`, `--reset-timestamp` + +> 不带任何命令使用时,撤销用户缓存的凭据。换句话讲,下一次使用 `sudo` 将会要求输入密码。使用这个参数不需要密码,也可以放到一个 `.logout` 文件中来撤销 sudo 权限。 + +> 当与一个命令,或者一个可能需要密码的操作一起用时,这个参数将会导致 `sudo` 忽略用户缓存的凭据。结果是 `sudo` 要求输入密码(如果这是被安全策略所要求的),而且不会更新用户缓存的凭据。 + + +#### -s 参数 + +有时你的工作要求你运行一堆需要 root 权限的命令,你不想每次都输入密码。你也不想通过改变 `/etc/sudoers` 文件调整 `sudo` 会话的过期时限。 + +这种情况下,你可以用 `sudo` 的 `-s` 参数。这是 `sudo` 帮助页面(man page)对此的解释: + +> `-s`, `--shell` + +> 如果设置了 SHELL 环境变量或者调用用户的密码数据库指定了 shell,就运行该 shell 。如果指定了命令,命令将会通过 shell 的 `-c` 参数将命令传递给该 shell 执行。如果没有指定命令,会执行一个交互式 shell。 + +所以,基本上这命令参数做的是: + +* 启动一个新的 shell - 至于是哪一个 shell,参照 SHELL 环境变量赋值。如果 `$SHELL` 是空的,将会用 `/etc/passwd` 中定义的 shell。 + +* 如果你用 `-s` 参数传递了一个命令名(例如 `sudo -s whoami`),实际执行的是 `sudo /bin/bash -c whoami`。 + +* 如果你没有尝试执行其他命令(也就是说,你只是要运行 `sudo -s`),你将会得到一个有 root 权限的交互式的 shell。 + +请记住,`-s` 命令行参数给你一个有 root 权限的 shell,但那不是 root 环境 —— 还是执行的你自己的 `.bashrc` 。例如,在 `sudo -s` 运行的新 shell 里,执行 `whoami` 命令仍会返回你的用户名,而非 root 。 + +#### -i 参数 + +`-i` 参数跟我们讨论过的 `-s` 参数相像。然而,还是有点区别。一个重要的区别是 `-i` 给你的是 root 环境,意味着你的(用户的)`.bashrc` 被忽略。这就像没有显式地用 root 登录也能成为 root 。此外,你也不用输入 root 用户密码。 + +**重要**:请注意 `su` 命令也能让你切换用户(默认切换到 root )。这个命令需要你输入 root 密码。为了避免这一点,你可以使用 `sudo` 执行它(`sudo su`),这样你只需要输入你的登录密码。然而,`su` 和 `sudo su` 有隐含的区别 —— 要了解它们,以及它们和 `sudo -i` 的区别,请看[这里][10] 。 + +### 总结 + +我希望现在你至少知道了 `sudo` 的基本知识,以及如何调整 `sudo` 的默认行为。请按我们解释过的那样去尝试调整 `/etc/sudoers` 。同时也浏览一下论坛讨论来更深入了解 `sudo` 命令。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ + +作者:[Himanshu Arora][a] +译者:[ypingcn](https://ypingcn.github.io/wiki/lctt) +校对:[jasminepeng](https://github.com/jasminepeng) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ +[1]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-k-option +[2]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-s-option +[3]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-i-option +[4]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-sudo +[5]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#can-any-user-use-sudo +[6]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-a-sudo-session +[7]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-sudo-password +[8]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#some-important-sudo-command-line-options +[9]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#conclusion +[10]: http://unix.stackexchange.com/questions/98531/difference-between-sudo-i-and-sudo-su +[11]: https://www.howtoforge.com/images/sudo-beginners-guide/big/perm-denied-error.png +[12]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-example.png +[13]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-switch-user.png +[14]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-accounts.png +[15]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-unlock.png +[16]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-admin-account.png +[17]: https://www.sudo.ws/man/1.8.17/visudo.man.html +[18]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-time-default.png +[19]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-timeout.png +[20]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-password.png diff --git a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md b/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md deleted file mode 100644 index d38c047227..0000000000 --- a/translated/tech/20170213 A beginners guide to understanding sudo on Ubuntu.md +++ /dev/null @@ -1,239 +0,0 @@ - -理解 Ubuntu 上 sudo 的初学者指南 -============================================================ - -### 本文内容 - -*  [什么是 sudo?][4] -* [任何用户都能用 sudo 吗?][5] -*  [什么是一个 sudo 会话?][6] -* [sudo 密码][7] -* [一些重要的 sudo 命令行参数][8] - * [-k 参数][1] - * [-s 参数][2] - * [-i 参数][3] -* [总结][9] - -你在使用 Linux 命令行时曾经得到过“拒绝访问”的错误提示吗?这可能是因为你正在尝试执行一个需要 root 权限的操作。例如,下面的截图展示了当我尝试复制一个二进制文件到一个系统目录时产生的错误。 - -[ - ![shell 的拒绝访问](https://www.howtoforge.com/images/sudo-beginners-guide/perm-denied-error.png) -][11] - -那么该怎么解决这个错误?很简单,使用 **sudo** 命令。 - -[ - ![用 sudo 运行命令](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-example.png) -][12] - -运行此命令的用户被提示输入他们的登录密码。一旦输入了正确的密码,操作将会成功执行。 - -毫无疑问,sudo 是任何在 Linux 上使用命令行的人都必须知道的命令。但是,为了更负责更有效地使用该命令,你还是要知道一些相关(深入)的细节。这正是我们将会在这篇文章中讨论的。 - -*在我们继续之前,值得提一下的是,这篇文章所提到的所有命令指示都已经在 Ubuntu 14.04LTS 下的 4.3.11版 Bash 通过测试。* - -### 什么是 sudo - -正如你们大部分人所知道的,sudo 用来执行需要提升权限(通常是作为 root 用户)的命令。在这篇文章之前的简介部分已经讨论过这样的一个例子。然而,如果你想的话,你能用 sudo 作为其他(非 root )用户运行命令。 - -这是由工具提供的 -u 命令行选项所实现的。举个例子,如下例所展示的那样,我(himanshu)尝试将一个在其他用户(howtoforge)的 Home 目录中的文件重命名,但是得到一个“访问拒绝”的错误。然后我加上“sudo -u howtoforge”后用同样的“mv”命令,命令成功执行了: - -[ - ![什么是 sudo](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-switch-user.png) -][13] - -### 任何人都能用 sudo 吗? - -不是。一个用户要能使用 sudo ,应该在 /etc/sudoers 文件里有一条跟该用户相关的信息。下述摘自 Ubuntu 网站的一段能讲得更清楚: - -``` -/etc/sudoers 文件控制了谁能以何种用户的身份在何种机器上运行何种命令,还可以控制特别的情况,例如对于特定的命令是否需要输入密码。这个文件由别名aliases(基本变量)和用户标识user specifications(控制谁能运行什么命令)组成。 - -``` -如果你正在使用 Ubuntu,让一个用户能运行 sudo 命令很容易:你所需要做的就是把账户类型改成“管理员”administrator。这可直接在 系统设置System Settings -> 用户账户 User Accounts里完成。 - - -[ - ![sudo 用户](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-accounts.png) -][14] - -解锁窗口: - -[ - ![unlocking window](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-user-unlock.png) -][15] - -然后选择你想改变用户类型的用户,然后将类型改成“管理员”。 - -[ - ![choose sudo accounts](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-admin-account.png) -][16] - -然而,如果你不使用 Ubuntu,或者你的发行版没有提供这个特性,你可以手动编辑 /etc/sudoers 文件来实现此改变。要在文件中添加这样的一行: - - -``` -[user] ALL=(ALL:ALL) ALL -``` - -无需赘言,[user] 应该被你想提升 sudo 权限的用户的用户名所代替。在这里值得提到的一件重要的事情是,官方建议通过 **visudo** 命令编辑该文件 —— 你需要做的就是运行下述命令: - -``` -sudo visudo -``` - -为了说清究竟是怎么一回事,这里有段从 visudo 手册里的摘要: - - -``` -visudo 以安全的模式编辑 sudoers 文件。visudo 锁定 sudoers 文件以防多个编辑同时进行,提供基本的检查(sanity checks)和语法错误检查。如果 sudoers 文件现在正在被编辑,你将会收到一个信息提示稍后再试。 - -``` - -关于 visudo 的更多信息,前往[这里][17]。 - -### 什么是 sudo 会话 - -如果你经常使用 sudo 命令,你肯定注意到过当你成功输入一次密码后,可以不用输入密码再运行几次 sudo 命令。但是一段时间后,sudo 命令会再次要求你的密码。 - -这种现象跟运行 sudo 命令数目无关,跟时间有关。是的,sudo 默认在输入一次密码后 15 分钟内不会再次要求密码。15 分钟后,你会再次被要求输入密码。 - -然而,如果你想的话,你能改变这种现象。用以下命令打开 /etc/sudoers 文件: - -``` -sudo visudo -``` - -找到这一行: - -``` -Defaults env_reset -``` - -[ - ![env_reset](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-time-default.png) -][18] - -然后在这行最后添加以下变量: - -``` -Defaults env_reset,timestamp_timeout=[new-value] -``` - -[new-value] 为想要 sudo 会话持续的时间数。例如,设数值为 40。 - -[ - ![sudo timeout value](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-session-timeout.png) -][19] - -如果你希望每次使用 sudo 命令时都要求输入密码,你可以把这个变量赋值为 0 。想要 sudo 会话永远不过时,应赋值为 -1。 - -注意将 timestamp_timeout 的值赋为 “-1” 是强烈不推荐的。 - -### sudo 密码 - -你可能注意过,当 sudo 要求输入密码然后你开始输入时,不会显示任何东西 —— 甚至连常规的星号都没有。虽然这不是什么大问题,不过一些用户就是希望显示星号。 - -好消息是那有可能也很容易做到。所有你需要做的就是在 /etc/sudoers 文件里将下述的行: - -``` -Defaults env_reset -``` - -改成 - -``` -Defaults env_reset,pwfeedback -``` - -然后保存文件。 - -现在,无论什么时候输入 sudo 密码,星号都会显示。 - -[ - ![hide the sudo password](https://www.howtoforge.com/images/sudo-beginners-guide/sudo-password.png) -][20] - -## 一些重要的 sudo 命令行参数 - -除了 -u 命令行参数(我们已经在这篇教程的开始部分讨论过了),还有其他重要的 sudo 命令行参数值得注意。在这部分,我们将会讨论其中一些。 - -### -k 参数 - -考虑下这种情况:输入密码后你刚刚运行了几个 sudo 驱动的命令。现在,如你所知,sudo 会话默认保持 15 分钟。假设在这会话期间,你得给你终端一些权限,但你不想让他们使用 sudo ,你将会怎么做? - -还好,有 -k 命令行参数允许用户取消 sudo 权限。这是 sudo 帮助页面(man page)对此的解释: - -``` --k, --reset-timestamp - -不带任何命令使用时,撤销用户缓存的凭据。换句话讲,下一次使用 sudo 将会要求输入密码。这个参数不需要密码,允许用户从一个 .logout 文件撤销 sudo 权限。 - -当与一个命令,或者一个可能需要密码的操作一起用时,这个参数将会导致 sudo 忽略用户缓存的凭据。结果是 sudo 要求输入密码(如果这是被安全策略所要求的),而且不会更新用户缓存的凭据。 - -``` - -### -s 参数 - -有时你的工作要求你运行一堆需要 root 权限的命令,你不想每次都输入密码。你也不想通过改变 /etc/sudoers 文件调整 sudo 会话的过期时限。 - -这种情况下,你可以用 sudo 的 -s 参数。这是 sudo 帮助页面(man page)对此的解释: - -``` --s, --shell - -如果设置了 SHELL 环境变量或者调用用户的密码数据库指定了 shell,就运行该 shell 。如果指定了命令,命令将会通过 shell 的 -c 参数传递给 shell 执行。如果没有指定命令,一个交互式 shell 将会执行。 - -``` - -所以,基本地,这命令参数做的是: - -*   启动一个新的 shell - 至于是哪一个 shell,参照 SHELL 环境变量赋值。如果 $SHELL 是空的,将会用 /etc/passwd 中定义的 shell。 - -* 如果你用 -s 参数传递了一个命令名(例如 sudo -s whoami),实际执行的是 sudo /bin/bash -c whoami。 - -*   如果你没有尝试执行其他命令(也就是说,你只是要运行 sudo -s),你将会得到一个有 root 权限的交互式的 shell。 - -请记住,-s 命令行参数给你一个有 root 权限的 shell,但不是 root 环境 —— 那是由你的 .bashrc 决定的。例如,在 sudo -s 运行的新 shell 里,执行 whoami 命令仍会返回你的用户名,而非 root 。 - -### -i 参数 - --i 参数跟我们讨论过的 -s 参数相像。然而,还是有点区别。一个重要的区别是 -i 也给了你 root 环境,意味着你的(用户的).bashrc 被忽略。这就像没有显式地用 root 登录也能成为 root 。此外,你也不用输入 root 用户密码。 - -** 重要 **:请注意 **su** 命令也能让你切换用户(默认切换到 root )。这个命令需要你输入 root 密码。为了避免这一点,你可以使用 sudo 执行它(“sudo su”),这样你只需要输入你的登录密码。然而,su 和 sudo su 有隐含的区别 —— 要了解它们,以及它们和 sudo -i 的区别,请看[这里][10] 。 - -### 总结 - -我希望现在你至少知道了 sudo 的基本知识,以及如何调整 sudo 的默认行为。请按我们解释过的那样全部尝试调整 /etc/sudoers 。同时也浏览一下论坛讨论来更深入了解 sudo 命令。 - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ - -作者:[Himanshu Arora][a] -译者:[ypingcn](https://ypingcn.github.io/wiki/lctt) -校对:[jasminepeng](https://github.com/jasminepeng) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/ -[1]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-k-option -[2]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-s-option -[3]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-i-option -[4]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-sudo -[5]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#can-any-user-use-sudo -[6]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#what-is-a-sudo-session -[7]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#the-sudo-password -[8]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#some-important-sudo-command-line-options -[9]: https://www.howtoforge.com/tutorial/sudo-beginners-guide/#conclusion -[10]: http://unix.stackexchange.com/questions/98531/difference-between-sudo-i-and-sudo-su -[11]: https://www.howtoforge.com/images/sudo-beginners-guide/big/perm-denied-error.png -[12]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-example.png -[13]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-switch-user.png -[14]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-accounts.png -[15]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-user-unlock.png -[16]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-admin-account.png -[17]: https://www.sudo.ws/man/1.8.17/visudo.man.html -[18]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-time-default.png -[19]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-session-timeout.png -[20]: https://www.howtoforge.com/images/sudo-beginners-guide/big/sudo-password.png From cf2c942b67e6267acbfe9c6c8ebfcc3f35d46f7c Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:42:20 +0800 Subject: [PATCH 079/190] =?UTF-8?q?20170308-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...stall and Secure MariaDB 10 in CentOS 7.md | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md diff --git a/sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md b/sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md new file mode 100644 index 0000000000..95edea40f1 --- /dev/null +++ b/sources/tech/20170228 How to Install and Secure MariaDB 10 in CentOS 7.md @@ -0,0 +1,148 @@ +How to Install and Secure MariaDB 10 in CentOS 7 +============================================================ + + +MariaDB is a free and open source fork of well known MySQL database management server software, developed by the brains behind MySQL, it’s envisioned to remain free/open source. + +In this tutorial, we will show you how to install MariaDB 10.1 stable version in the most widely used versions of RHEL/CentOS and Fedora distributions. + +For your information, Red Hat Enterprise Linux/CentOS 7.0 switched from supporting MySQL to MariaDB as the default database management system. + +Note that in this tutorial, we’ll assume your working on the server as root, otherwise, use the [sudo command][7] to run all the commands. + +### Step 1: Add MariaDB Yum Repository + +1. Start by adding the MariaDB YUM repository file `MariaDB.repo` for RHEL/CentOS and Fedora systems. + +``` +# vi /etc/yum.repos.d/MariaDB.repo +``` + +Now add the following lines to your respective Linux distribution version as shown. + +#### On CentOS 7 + +``` +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.1/centos7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +``` + +#### On RHEL 7 + +``` +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.1/rhel7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +``` +[ + ![Add MariaDB Yum Repo](http://www.tecmint.com/wp-content/uploads/2017/02/Add-MariaDB-Repo.png) +][8] + +Add MariaDB Yum Repo + +### Step 2: Install MariaDB in CentOS 7 + +2. Once MariaDB repository has been added, you can easily install it with just one single command. + +``` +# yum install MariaDB-server MariaDB-client -y +``` +[ + ![Install MariaDB in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/02/Install-MariaDB-in-CentOS-7.png) +][9] + +Install MariaDB in CentOS 7 + +3. As soon as the installation of MariaDB packages completes, start the database server daemon for the time being, and also enable it to start automatically at the next boot like so: + +``` +# systemctl start mariadb +# systemctl enable mariadb +# systemctl status mariadb +``` +[ + ![Start MariaDB Service in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service-in-CentOS-7.png) +][10] + +Start MariaDB Service in CentOS 7 + +### Step 3: Secure MariaDB in CentOS 7 + +4. Now its time to secure your MariaDB by setting root password, disabling remote root login, removing the test database as well as anonymous users and finally reload privileges as shown in the screen shot below: + +``` +# mysql_secure_installation +``` +[ + ![Secure MySQL in CentOS 7](http://www.tecmint.com/wp-content/uploads/2017/02/Secure-MySQL-in-CentOS-7.png) +][11] + +Secure MySQL in CentOS 7 + +5. After securing the database server, you may want to check certain MariaDB features such as: installed version, default program argument list, and also login to the MariaDB command shell as follows: + +``` +# mysql -V +# mysqld --print-defaults +# mysql -u root -p +``` +[ + ![Verify MySQL Version](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-MySQL-Version.png) +][12] + +Verify MySQL Version + +### Step 4: Learn MariaDB Administration + +If you are new to MySQL/MariaDB, start off by going through these guides: + +1. [Learn MySQL / MariaDB for Beginners – Part 1][1] +2. [Learn MySQL / MariaDB for Beginners – Part 2][2] +3. [MySQL Basic Database Administration Commands – Part III][3] +4. [20 MySQL (Mysqladmin) Commands for Database Administration – Part IV][4] + +Also check out these following articles to fine tune your MySQL/MariaDB performance and use the tools to monitor the activity of your databases. + +1. [15 Tips to Tune and Optimize Your MySQL/MariaDB Performance][5] +2. [4 Useful Tools to Monitor MySQL/MariaDB Database Activities][6] + +That’s it for now! In this simple tutorial, we showed you how to install MariaDB 10.1 stable version in various RHEL/CentOS and Fedora. Use the feedback form below to send us any questions or any thoughts concerning this guide. + +-------------------------------------------------------------------------------- + +作者简介: + +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: http://www.tecmint.com/install-mariadb-in-centos-7/ + +作者:[Aaron Kili][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/learn-mysql-mariadb-for-beginners/ +[2]:http://www.tecmint.com/learn-mysql-mariadb-advance-functions-sql-queries/ +[3]:http://www.tecmint.com/gliding-through-database-mysql-in-a-nutshell-part-i/ +[4]:http://www.tecmint.com/mysqladmin-commands-for-database-administration-in-linux/ +[5]:http://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization/ +[6]:http://www.tecmint.com/mysql-performance-monitoring/ +[7]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Add-MariaDB-Repo.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Install-MariaDB-in-CentOS-7.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service-in-CentOS-7.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Secure-MySQL-in-CentOS-7.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Verify-MySQL-Version.png +[13]:http://www.tecmint.com/author/aaronkili/ +[14]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[15]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 5d495bcfd7ed260dd0363ee2282e3966ffd25400 Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:44:33 +0800 Subject: [PATCH 080/190] =?UTF-8?q?20170308-2=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...personal web server with a Raspberry Pi.md | 307 ++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md diff --git a/sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md b/sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md new file mode 100644 index 0000000000..d23a96c22d --- /dev/null +++ b/sources/tech/20170307 How to set up a personal web server with a Raspberry Pi.md @@ -0,0 +1,307 @@ +How to set up a personal web server with a Raspberry Pi +============================================================ + + ![How to set up a personal web server with a Raspberry Pi](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/lightbulb_computer_person_general_.png?itok=ZY3UuQQa "How to set up a personal web server with a Raspberry Pi") +>Image by : opensource.com + +A personal web server is "the cloud," except you own and control it as opposed to a large corporation. + +Owning a little cloud has a lot of benefits, including customization, free storage, free Internet services, a path into open source software, high-quality security, full control over your content, the ability to make quick changes, a place to experiment with code, and much more. Most of these benefits are immeasurable, but financially these benefits can save you over $100 per month. + + ![Building your own web server with Raspberry Pi](https://opensource.com/sites/default/files/1-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Building your own web server with Raspberry Pi") + +Image by Mitchell McLaughlin, CC BY-SA 4.0 + +I could have used AWS, but I prefer complete freedom, full control over security, and learning how things are built. + +* Self web-hosting: No BlueHost or DreamHost +* Cloud storage: No Dropbox, Box, Google Drive, Microsoft Azure, iCloud, or AWS +* On-premise security +* HTTPS: Let’s Encrypt +* Analytics: Google +* OpenVPN: Do not need private Internet access (at an estimated $7 per month) + +Things I used: + +* Raspberry Pi 3 Model B +* MicroSD Card (32GB recommended, [Raspberry Pi Compatible SD Cards][1]) +* USB microSD card reader +* Ethernet cable +* Router connected to Wi-Fi +* Raspberry Pi case +* Amazon Basics MicroUSB cable +* Apple wall charger +* USB mouse +* USB keyboard +* HDMI cable +* Monitor (with HDMI input) +* MacBook Pro + +### Step 1: Setting up the Raspberry Pi + +Download the most recent release of Raspbian (the Raspberry Pi operating system). [Raspbian Jessie][6] ZIP version is ideal [1]. Unzip or extract the downloaded file. Copy it onto the SD card. [Pi Filler][7] makes this process easy. [Download Pi Filer 1.3][8] or the most recent version. Unzip or extract the downloaded file and open it. You should be greeted with this prompt: + + ![Pi Filler prompt](https://opensource.com/sites/default/files/2-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Pi Filler prompt") + +Make sure the USB card reader has NOT been inserted yet. If it has, eject it. Proceed by clicking Continue. A file explorer should appear. Locate the uncompressed Raspberry Pi OS file from your Mac or PC and select it. You should see another prompt like the one pictured below: + + ![USB card reader prompt](https://opensource.com/sites/default/files/3-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "USB card reader") + +Insert the MicroSD card (32GB recommended, 16GB minimum) into the USB MicroSD Card Reader. Then insert the USB reader into the Mac or PC. You can rename the SD card to "Raspberry" to distinguish it from others. Click Continue. Make sure the SD card is empty. Pi Filler will  _erase_  all previous storage at runtime. If you need to back up the card, do so now. When you are ready to continue, the Raspbian OS will be written to the SD card. It should take between one to three minutes. Once the write is completed, eject the USB reader, remove the SD card, and insert it into the Raspberry Pi SD card slot. Give the Raspberry Pi power by plugging the power cord into the wall. It should start booting up. The Raspberry Pi default login is: + +**username: pi +password: raspberry** + +When the Raspberry Pi has completed booting for the first time, a configuration screen titled "Setup Options" should appear like the image below [2]: + + ![Raspberry Pi software configuration setup](https://opensource.com/sites/default/files/4-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Raspberry Pi software configuration setup") + +Select the "Expand Filesystem" option and hit the Enter key [3]. Also, I recommend selecting the second option, "Change User Password." It is important for security. It also personalizes your Raspberry Pi. + +Select the third option in the setup options list, "Enable Boot To Desktop/Scratch" and hit the Enter key. It will take you to another window titled "Choose boot option" as shown in the image below. + + ![Choose boot option](https://opensource.com/sites/default/files/5-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Choose boot option") + +In the "Choose boot option" window, select the second option, "Desktop log in as user 'pi' at the graphical desktop" and hit the Enter button [4]. Once this is done you will be taken back to the "Setup Options" page. If not, select the "OK" button at the bottom of this window and you will be taken back to the previous window. + +Once both these steps are done, select the "Finish" button at the bottom of the page and it should reboot automatically. If it does not, then use the following command in the terminal to reboot. + +**$ sudo reboot** + +After the reboot from the previous step, if everything went well, you will end up on the desktop similar to the image below. + + ![Raspberry Pi desktop](https://opensource.com/sites/default/files/6-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Raspberry Pi desktop") + +Once you are on the desktop, open a terminal and enter the following commands to update the firmware of the Raspberry Pi. + +``` +$ sudo apt-get update + +$ sudo apt-get upgrade-y + +$ sudo apt-get dist-upgrade -y + +$ sudo rpi-update +``` + +This may take a few minutes. Now the Raspberry Pi is up-to-date and running. + +### Step 2: Configuring the Raspberry Pi + +SSH, which stands for Secure Shell, is a cryptographic network protocol that lets you securely transfer data between your computer and your Raspberry Pi. You can control your Raspberry Pi from your Mac's command line without a monitor or keyboard. + +To use SSH, first, you need your Pi's IP address. Open the terminal and type: + +``` +$ sudo ifconfig +``` + +If you are using Ethernet, look at the "eth0" section. If you are using Wi-Fi, look at the "wlan0" section. + +Find "inet addr" followed by an IP address—something like 192.168.1.115, a common default IP I will use for the duration of this article. + +With this address, open terminal and type: + +``` +$ ssh pi@192.168.1.115 +``` + +For SSH on PC, see footnote [5]. + +Enter the default password "raspberry" when prompted, unless you changed it. + +You are now logged in via SSH. + +### Remote desktop + +Using a GUI (graphical user interface) is sometimes easier than a command line. On the Raspberry Pi's command line (using SSH) type: + +``` +$ sudo apt-get install xrdp +``` + +Xrdp supports the Microsoft Remote Desktop Client for Mac and PC. + +On Mac, navigate to the app store and search for "Microsoft Remote Desktop." Download it. (For a PC, see footnote [6].) + +After installation, search your Mac for a program called "Microsoft Remote Desktop." Open it. You should see this: + + ![Microsoft Remote Desktop](https://opensource.com/sites/default/files/7-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Microsoft Remote Desktop") + +Image by Mitchell McLaughlin, CC BY-SA 4.0 + +Click "New" to set up a remote connection. Fill in the blanks as shown below. + + ![Setting up a remote connection](https://opensource.com/sites/default/files/8-image_by_mitchell_mclaughlin_cc_by-sa_4.0.png "Setting up a remote connection") + +Image by Mitchell McLaughlin, CC BY-SA 4.0 + +Save it by exiting out of the "New" window. + +You should now see the remote connection listed under "My Desktops." Double click it. + +After briefly loading, you should see your Raspberry Pi desktop in a window on your screen, which looks like this: + + ![Raspberry Pi desktop](https://opensource.com/sites/default/files/6-image_by_mitchell_mclaughlin_cc_by-sa_4.0_0.png "Raspberry Pi desktop") + +Perfect. Now, you don't need a separate mouse, keyboard, or monitor to control the Pi. This is a much more lightweight setup. + +### Static local IP address + +Sometimes the local IP address 192.168.1.115 will change. We need to make it static. Type: + +``` +$ sudo ifconfig +``` + +Write down from the "eth0" section or the "wlan0" section, the "inet addr" (Pi's current IP), the "bcast" (the broadcast IP range), and the "mask" (subnet mask address). Then, type: + +``` +$ netstat -nr +``` + +Write down the "destination" and the "gateway/network." + + ![Setting up a local IP address](https://opensource.com/sites/default/files/setting_up_local_ip_address.png "Setting up a local IP address") + +The cumulative records should look something like this: + +``` +net address 192.168.1.115 +bcast 192.168.1.255 +mask 255.255.255.0 +gateway 192.168.1.1 +network 192.168.1.1 +destination 192.168.1.0 +``` + +With this information, you can set a static internal IP easily. Type: + +``` +$ sudo nano /etc/dhcpcd.conf +``` + +Do not use **/etc/network/interfaces**. + +Then all you need to do is append this to the bottom of the file, substituting the correct IP address you want. + +``` +interface eth0 +static ip_address=192.168.1.115 +static routers=192.168.1.1 +static domain_name_servers=192.168.1.1 +``` + +Once you have set the static internal IP address, reboot the Raspberry Pi with: + +``` +$ sudo reboot +``` + +After rebooting, from terminal type: + +``` +$ sudo ifconfig +``` + +Your new static settings should appear for your Raspberry Pi. + +### Static global IP address + +If your ISP (internet service provider) has already given you a static external IP address, you can skip ahead to the port forwarding section. If not, continue reading. + +You have set up SSH, a remote desktop, and a static internal IP address, so now computers inside the local network will know where to find the Pi. But you still can't access your Raspberry Pi from outside the local Wi-Fi network. You need your Raspberry Pi to be accessible publicly from anywhere on the Internet. This requires a static external IP address [7]. + +It can be a sensitive process initially. Call your ISP and request a static external (sometimes referred to as static global) IP address. The ISP holds the decision-making power, so I would be extremely careful dealing with them. They may refuse your static external IP address request. If they do, you can't fault the ISP because there is a legal and operational risk with this type of request. They particularly do not want customers running medium- or large-scale Internet services. They might explicitly ask why you need a static external IP address. It is probably best to be honest and tell them you plan on hosting a low-traffic personal website or a similar small not-for-profit internet service. If all goes well, they should open a ticket and call you in a week or two with an address. + +### Port forwarding + +This newly obtained static global IP address your ISP assigned is for accessing the router. The Raspberry Pi is still unreachable. You need to set up port forwarding to access the Raspberry Pi specifically. + +Ports are virtual pathways where information travels on the Internet. You sometimes need to forward a port in order to make a computer, like the Raspberry Pi, accessible to the Internet because it is behind a network router. A YouTube video titled [What is TCP/IP, port, routing, intranet, firewall, Internet][9] by VollmilchTV helped me visually understand ports. + +Port forwarding can be used for projects like a Raspberry Pi web server, or applications like VoIP or peer-to-peer downloading. There are [65,000+ ports][10] to choose from, so you can assign a different port for every Internet application you build. + +The way to set up port forwarding can depend on your router. If you have a Linksys, a YouTube video titled  _[How to go online with your Apache Ubuntu server][2]_  by Gabriel Ramirez explains how to set it up. If you don't have a Linksys, read the documentation that comes with your router in order to customize and define ports to forward. + +You will need to port forward for SSH as well as the remote desktop. + +Once you believe you have port forwarding configured, check to see if it is working via SSH by typing: + +``` +$ ssh pi@your_global_ip_address +``` + +It should prompt you for the password. + +Check to see if port forwarding is working for the remote desktop as well. Open Microsoft Remote Desktop. Your previous remote connection settings should be saved, but you need to update the "PC name" field with the static external IP address (for example, 195.198.227.116) instead of the static internal address (for example, 192.168.1.115). + +Now, try connecting via remote desktop. It should briefly load and arrive at the Pi's desktop. + + ![Raspberry Pi desktop](https://opensource.com/sites/default/files/6-image_by_mitchell_mclaughlin_cc_by-sa_4.0_1.png "Raspberry Pi desktop") + +Good job. The Raspberry Pi is now accessible from the Internet and ready for advanced projects. + +As a bonus option, you can maintain two remote connections to your Pi. One via the Internet and the other via the LAN (local area network). It's easy to set up. In Microsoft Remote Desktop, keep one remote connection called "Pi Internet" and another called "Pi Local." Configure Pi Internet's "PC name" to the static external IP address—for example, 195.198.227.116\. Configure Pi Local's "PC name" to the static internal IP address—for example, 192.168.1.115\. Now, you have the option to connect globally or locally. + +If you have not seen it already, watch  _[How to go online with your Apache Ubuntu server][3]_  by Gabriel Ramirez as a transition into Project 2\. It will show you the technical architecture behind your project. In our case, you are using a Raspberry Pi instead of an Ubuntu server. The dynamic DNS sits between the domain company and your router, which Ramirez omits. Beside this subtlety, the video is spot on when explaining visually how the system works. You might notice this tutorial covers the Raspberry Pi setup and port forwarding, which is the server-side or back end. See the original source for more advanced projects covering the domain name, dynamic DNS, Jekyll (static HTML generator), and Apache (web hosting), which is the client-side or front end. + +### Footnotes + +[1] I do not recommend starting with the NOOBS operating system. I prefer starting with the fully functional Raspbian Jessie operating system. + +[2] If "Setup Options" does not pop up, you can always find it by opening Terminal and executing this command: + +``` +$ sudo-rasps-config +``` + +[3] We do this to make use of all the space present on the SD card as a full partition. All this does is expand the operating system to fit the entire space on the SD card, which can then be used as storage memory for the Raspberry Pi. + +[4] We do this because we want to boot into a familiar desktop environment. If we do not do this step, the Raspberry Pi boots into a terminal each time with no GUI. + +[5] + + ![PuTTY configuration](https://opensource.com/sites/default/files/putty_configuration.png "PuTTY configuration") + +[Download and run PuTTY][11] or another SSH client for Windows. Enter your IP address in the field, as shown in the above screenshot. Keep the default port at 22\. Hit Enter, and PuTTY will open a terminal window, which will prompt you for your username and password. Fill those in, and begin working remotely on your Pi. + +[6] If it is not already installed, download [Microsoft Remote Desktop][12]. Search your computer for Microsoft Remote Desktop. Run it. Input the IP address when prompted. Next, an xrdp window will pop up, prompting you for your username and password. + +[7] The router has a dynamically assigned external IP address, so in theory, it can be reached from the Internet momentarily, but you'll need the help of your ISP to make it permanently accessible. If this was not the case, you would need to reconfigure the remote connection on each use. + + _For the original source, visit [Mitchell McLaughlin's Full-Stack Computer Projects][4]._ + +-------------------------------------------------------------------------------- + +作者简介: + +Mitchell McLaughlin - I'm an open-web contributor and developer. My areas of interest are broad, but specifically I enjoy open source software/hardware, bitcoin, and programming in general. I reside in San Francisco. My work experience in the past has included brief stints at GoPro and Oracle. + +------------- + + +via: https://opensource.com/article/17/3/building-personal-web-server-raspberry-pi-3 + +作者:[Mitchell McLaughlin ][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/mitchm +[1]:http://elinux.org/RPi_SD_cards +[2]:https://www.youtube.com/watch?v=i1vB7JnPvuE#t=07m08s +[3]:https://www.youtube.com/watch?v=i1vB7JnPvuE#t=07m08s +[4]:https://mitchellmclaughlin.com/server.html +[5]:https://opensource.com/article/17/3/building-personal-web-server-raspberry-pi-3?rate=Zdmkgx8mzy9tFYdVcQZSWDMSy4uDugnbCKG4mFsVyaI +[6]:https://www.raspberrypi.org/downloads/raspbian/ +[7]:http://ivanx.com/raspberrypi/ +[8]:http://ivanx.com/raspberrypi/files/PiFiller.zip +[9]:https://www.youtube.com/watch?v=iskxw6T1Wb8 +[10]:https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers +[11]:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html +[12]:https://www.microsoft.com/en-us/store/apps/microsoft-remote-desktop/9wzdncrfj3ps +[13]:https://opensource.com/user/41906/feed +[14]:https://opensource.com/article/17/3/building-personal-web-server-raspberry-pi-3#comments +[15]:https://opensource.com/users/mitchm From 4d85c18dbb6b3ae913af01903b3b82fe839f0e0b Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:46:12 +0800 Subject: [PATCH 081/190] =?UTF-8?q?20170308-3=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0170307 How to make release notes count.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20170307 How to make release notes count.md diff --git a/sources/tech/20170307 How to make release notes count.md b/sources/tech/20170307 How to make release notes count.md new file mode 100644 index 0000000000..889d98e68b --- /dev/null +++ b/sources/tech/20170307 How to make release notes count.md @@ -0,0 +1,58 @@ +How to make release notes count +============================================================ + + ![How to make release notes count](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/rh_003784_02_os.comcareers_resume_rh1x.png?itok=CK6VJq5w "How to make release notes count") +>Image by : opensource.com + +Congratulations! You're ready to ship the latest release of your software package. Now you need to make sure your release notes are in order. Sure, you could just slap "bug fixes and performance improvements" on the box and call it a day, but that doesn't really tell your users anything. + +Release notes are for both support and marketing. They tell your current users why this new release is important to them and showcase your software to potential users. Thus, you want to make the content clear, understandable, and most importantly, relevant. There's no one way to write release notes, so this is general advice, not an edict. + +One popular trend is to make the release notes a narrative that includes a lot of silliness. If that's your thing, go for it—just remember that jokes are often context-sensitive, and what you think is hilarious might be totally lost on your readers. And, of course, you can't forget to include the important information. + +### Getting started + +Perhaps the single most important takeaway from this article is to write your release notes for the people who will read them. For user-facing software, focus on the user-facing behavior instead of the internal implementation. For example, say, "Clicking the 'Cancel' button will light your computer on fire," instead of "thermalEventTrigger defaulted to True in the cancelThatThing function." + +Try to limit each note to a sentence or two. The point is to highlight the important part, not give a detailed explanation. If you have a public issue tracker, include a link (or at least an issue number) where readers can go find details if they're so inclined. + +You don't have to lay out your release notes this way, but I like the following format. Start with the version number and release date. For major releases, you might also include a few sentences to highlight the major theme. For example, "This release focuses on adding an email client, because that's the eventual end state of all software." + +### Compatibility changes + +If the new release introduces changes in compatibility or default behavior, highlight those explicitly. Your users will thank you, as will anyone who provides user support. Describe the cases where the behavior change will be encountered, how to address the change, and what happens if the user doesn't act on the change. For minor releases, you probably don't have any incompatible changes, so you can leave out this section. + +### Features and enhancements + +Now is the time to brag about all of the cool, new stuff your software does, but remember to focus on the user's perspective. For example, "The software now supports the automatic detection of pictures of lunch and posts them to Instagram." + +### Issues resolved + +No software is perfect, and this is the section where you tell readers about all of the hard work your team did to make the project a little better. Write these notes in the past tense, because the bad behavior is dead and gone. If it's clear where the bug was introduced, include that information. Some projects include bugs in the documentation in this section as well. + +### Known issues + +Because no software is perfect, there are always bugs left unsquashed. This section is the place to list those. You don't have to confess everything; focus on the bugs that impact functionality, especially if they were discovered since the last release. Write these in the future tense, and when you've addressed it, you just have to change the verb tense and it's ready to move up a section. + +-------------------------------------------------------------------------------- + +作者简介: + +Ben Cotton - Ben Cotton is a meteorologist by training and a high-performance computing engineer by trade. Ben works as a technical evangelist at Cycle Computing. He is a Fedora user and contributor, co-founded a local open source meetup group, and is a member of the Open Source Initiative and a supporter of Software Freedom Conservancy. Find him on Twitter (@FunnelFiasco) + + +-------------- + +via: https://opensource.com/article/17/3/how-to-improve-release-notes + +作者:[Ben Cotton][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/bcotton +[1]:https://opensource.com/article/17/3/how-to-improve-release-notes?rate=81ry_1MGfmsPXV6_y_4St2DQI4XyJAqIzs4yTNtUrpA +[2]:https://opensource.com/user/30131/feed +[3]:https://opensource.com/article/17/3/how-to-improve-release-notes#comments +[4]:https://opensource.com/users/bcotton From 6bdcda62cca22ba02f7ac69c5e979852f85ba1ef Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:47:29 +0800 Subject: [PATCH 082/190] =?UTF-8?q?20170308-4=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...a multi-language LaTeX editor for Linux.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md diff --git a/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md b/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md new file mode 100644 index 0000000000..49405cbc24 --- /dev/null +++ b/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md @@ -0,0 +1,120 @@ +Introduction to LaTeXila - a multi-language LaTeX editor for Linux +============================================================ + +### On this page + +1. [Why LaTeX?][1] +2. [Starting work on a new document and setting up the structure][2] +3. [LaTeXila ease of use and mathematics][3] +4. [From .tex to .rtf][4] +5. [Conclusion][5] + +LaTeXila is a multi-language LaTeX editor for Linux users who prefer the GTK+ looks. The software is simple, easy to use, adequately powerful and customizable, so if you’re interested in LaTeX you should give this tool a try. In the following quick guide, I will showcase how to get started with LaTeXila and what its main features are. But first... + +### Why LaTeX? + +So, if I want to create a text document, why wouldn’t I simply use the standard LibreOffice or Abiword tools? The answer is because LaTeX editors in general offer more powerful formatting tools than your standard text editor, while the process of writing the content remains simple and pivotal. LaTeX is a document preparation system that is actually meant to simplify the formatting procedures for the most common forms of publishing like books and scientific reports that may contain a lot of mathematical formulas, multi-lingual typesetting elements, cross-references and citations, indexes, bibliographies, etc. While all of these things can actually be done in LibreOffice, they are way easier in LaTeXila while the end result is bound to be of a higher quality if done right. + +### Starting work on a new document and setting up the structure + +First, we need to create a new file on LaTeXila, and this can be done by clicking on the “New File” icon located on the upper left. This will open a dialog that allows us to select a template and get started quickly. + +[ + ![Start the LaTex Editor](https://www.howtoforge.com/images/introduction-to-latexila/pic_1.png) +][6] + +Let’s suppose that I will write a book so I select the book template, add the title and author in the corresponding brackets as shown in the following screenshot: + +[ + ![Open the book template](https://www.howtoforge.com/images/introduction-to-latexila/pic_2.png) +][7] + +Now let me explain a few things about the structure. I know it looks like coding, and if you are a writer and not a coder it may look strange to work like that but bear with me and I’ll explain. + +Between the first line and the ninth line, we have all the stuff that define some basic factors for the whole document. In the first line for example, we can define the paper format and the font size by changing the “[a4paper,11pt]” accordingly. More options can be added inside this particular square brackets space separated by commas. + +Between lines two and four, we can see entries that start with “\userpackage” followed by the options in square brackets and the command in brackets. These are enhancement packages that LaTeXila has installed by default in our system and uses them by default in most templates. The particular ones concern the font encoding, character encoding, and fonts quality respectively. + +Proceeding to the “\maketitle” row, here we can add a separate title page beyond the first one that will be placed on the top by default. Similarly, the row containing the “\tableofcontents” command is for the automatic creation of a table of contents for the book. + +Finally, we can name the chapter as we like by adding a title in the brackets next to the “\chapter”. This first chapter will be automatically marked as chapter one. You may add your content in the following lines, and the chapter ends when the next one begins by \chapter again on a new line. This new chapter will be automatically marked as chapter two, and so on. + +[ + ![LaTex Formatting](https://www.howtoforge.com/images/introduction-to-latexila/pic_3.png) +][8] + +Chapters can also be separated into smaller chunks by using the command “\section” and then even more with the command “\subsection”. Both sections and chapters should be automatically detected by the “\tableofcontents” command which will use their title and page number. See the following screenshot to correlate the way chapters and sections work for your book. + +[ + ![LaTex preview](https://www.howtoforge.com/images/introduction-to-latexila/pic_4.png) +][9] + +If you want to get an overview of the structure, you may change the left sidebar to the “Structure” setting and ensure that all is structured as intended. From the same tool, you may control any data tables or images that are placed in each section. + +[ + ![LaTex structure](https://www.howtoforge.com/images/introduction-to-latexila/pic_5.png) +][10] + +Talking about these, some people want to include the location of tables and images into their table of contents. To do this, you may add the following lines below the “\tableofcontents”: + +\listoffigures +\listoftables + +The final command that signifies the end of the book is the “\end{document}” so your structure must always end with this. + +### LaTeXila ease of use and mathematics + +While LaTeX is a document creation system based on commands that are independent of the editor one uses, it is important to note that LaTeXila offers a set of helpful tools that will save you time and effort while writing your report or book. For example, there’s an auto-completion function for LaTeX commands as that is conveniently activated every time you start typing a command. + +[ + ![Mathematic Formulas in LaTex](https://www.howtoforge.com/images/introduction-to-latexila/pic_6.png) +][11] + +There’s an integrated spell checking system based on gspell that you may set to the right language from the “Tools” menu on the top bar, and there’s the top toolbar that contains buttons for almost anything that you’ll need. From left to right, you can add chapters and parts, add cross-references, fiddle with the character size and styling for a selected part, add bullet lists, and mathematical functions. These can be done manually, but it is always nicer to have them one click away instead. + +For the creation of the mathematical formulas, you can use a combination of the toolbar options with the sidebar characters that are added with a simple click. Just select the “Symbols” in the left sidebar and you’ll find the relevant categories of “Relations”, “Greek symbols”, “Operators” etc. See the following screenshot as an example of what can be done: + +[ + ![Greek Symbols and Operators](https://www.howtoforge.com/images/introduction-to-latexila/pic_7.png) +][12] + +These graphical lists of symbols really make the creation of formulas and mathematical expressions a walk in the park. + +### From .tex to .rtf + +By default, LaTeXila saves your work in the standard “.tex” format which we can use to build a “rich text format” document that we can open with a word editor like LibreOffice. To do this, we need to install a package named “latex2rtf” which is available in all distributions. We then hop into the file destination, open a terminal there and type “latex2rtf filename” as shown: + +[ + ![LaTEX to RTF export](https://www.howtoforge.com/images/introduction-to-latexila/pic_8.png) +][13] + +Of course, LaTeXila offers its own building tools that you can access from the top toolbar or the top panel (Build), but I am giving you latex2rtf in case something goes wrong with the other system which in my case didn’t work. + +### Conclusion + +If the above sparked your interest to go ahead and discover the power of LaTeX, then good. My intention was to present a tool that is good for newcomers in the sense that it is easy to use and write on. If only LaTeXila had a dual screen mode with a live previewer, and it would be perfect… + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/ + +作者:[Bill Toulas][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/ +[1]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#why-latex +[2]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#starting-work-on-a-new-document-and-setting-up-the-structure +[3]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#latexila-ease-of-use-and-mathematics +[4]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#from-tex-to-rtf +[5]:https://www.howtoforge.com/tutorial/introduction-to-latexila-latex-editor/#conclusion +[6]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_1.png +[7]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_2.png +[8]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_3.png +[9]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_4.png +[10]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_5.png +[11]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_6.png +[12]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_7.png +[13]:https://www.howtoforge.com/images/introduction-to-latexila/big/pic_8.png From 92cf86f97d3dca4cab71e1e9fa69ed8a7f219b85 Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:48:40 +0800 Subject: [PATCH 083/190] =?UTF-8?q?20170308-5=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to install Arch Linux on VirtualBox.md | 491 ++++++++++++++++++ 1 file changed, 491 insertions(+) create mode 100644 sources/tech/20170223 How to install Arch Linux on VirtualBox.md diff --git a/sources/tech/20170223 How to install Arch Linux on VirtualBox.md b/sources/tech/20170223 How to install Arch Linux on VirtualBox.md new file mode 100644 index 0000000000..dd7b5f2999 --- /dev/null +++ b/sources/tech/20170223 How to install Arch Linux on VirtualBox.md @@ -0,0 +1,491 @@ +How to install Arch Linux on VirtualBox +============================================================ + +### On this page + +1. [Arch Linux Repositories][8] +2. [Install Arch Linux on Virtual Box][9] + 1. [Download Arch Linux][1] + 2. [Initializing Installation with Oracle VM VirtualBox Manager][2] + 3. [Partition the hard disk][3] + 4. [Bootstrap Arch Linux][4] + 5. [Setup hostname and networking][5] + 6. [Install the Bootloader][6] + 7. [Boot into the installed ArchLinux operating system][7] + +Arch Linux is a Linux-based operating system that is designed for i689 and 86-64 computers. Its unique package manager is responsible for providing updates to the latest software applications using “pacman” with complete tracking. Pacman is the package manager that is used to install, update, and remove the software packages. It is designed entirely for free and open-source software, along with the support from the Linux community. + +Arch Linux is also popular for having a comprehensive documentation in form of the community wiki known as ArchWiki. This Linux operating system is based on binary packages that are targeted for i832, 64-bit, and 32-bit systems and optimized for the best performance on the modern hardware systems. + +You can install Arch Linux directly to your home computer by following this guide but you can also install it on a virtual machine on your Windows computer by using VirtualBox. + +### Arch Linux Repositories + +To install Arch Linux on Virtual Box, you must know the basic repositories of this Linux-based operating system. A repository is a storage location from where the software packages are retrieved during the installation process. There are multiple repositories available for Arch Linux, which are accessible via pacman and maintained by package maintainers. Here is a list of some of the basic repositories used to install Arch Linux on Virtual Box: + +* The **core **repository contains all the packages that are needed to setup the base system like booting Arch Linux, and building packages. + +* The **extra **repository contains extra packages that do not fit in the core involving desktop environment. + +* The **community **repositoryhas packages that are adopted by trusted Linux community users, and most of them will transfer to the core or extra repository. + +* The **Multilib **repository contains 32-bit software and libraries for 32-bit application installation on 64-bit system. + +* The **testing **repository contains packages that are destined for core or extra repositories. + +* The **community-testing** repository is for the Linux community. + +* The **multilib testing **repositoryis similar to the testing repository, but for multilib candidates. + +* The **gnome-unstable **repository has the latest GNOME desktop environment. + +* The **kde-unstable **repository contains the latest KDE software before they are been released. + +### Install Arch Linux on Virtual Box + +### Download Arch Linux + +To install Arch Linux on Virtual Box, you must have the latest Arch Linux version that you can download from their [official website][10]. You can pick either the direct download option or torrent download, which is on a secure server. Before the installation, make sure you have 20 MB of free disk space and 1 GB of RAM in your system. + +[ + ![Download Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/1212.png) +][11] + +### Initializing Installation with Oracle VM VirtualBox Manager + +Open the Oracle VM VirtualBox manager, click on new, and type in the name of the new operating system you want to create; in this case, it is Arch Linux. The system will automatically pick up the type and version of the Arch Linux, based on your system’s configuration. Click on  _next_ . + +[ + ![Open VirtualBox](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12121.png) +][12] + +Allocate the desired  RAM size to your new operating system, which is ideally 1024 MB. Click on  _next _ and then click on  _create_ , to create a virtual disk now. + +[ + ![Set RAM size](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12122.png) +][13] + +On the nextpage, you will be asked to select the type of hard disk file you want for your new operating system. Select VirtualBox Disk Image usually. + +[ + ![Select disk file type](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12123.png) +][14] + +Choose dynamically allocated and click  _next_ . + +[ + ![Allocate disk space dynamically](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12124.png) +][15] + +Allocate 20 GB hard disk file location and size. + +[ + ![Choose a hard disk size of 20GB](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12125.png) +][16] + +Now you can see that your Arch Linux operating system is created. Now you can click  _start_ . + +[ + ![Start the Virtual Machine](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12126.png) +][17] + +Click on 'browser' and select the startup disk, which you downloaded from the Arch Linux official website. + +[ + ![Choose Arch Linux Disk image](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12127.png) +][18] + +[ + ![Browse for disk image file](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12128.png) +][19] + +Click on  _start_  and then open the full-screen view. + +[ + ![Open the full-screen view](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12129.png) +][20] + +[ + ![Start the Arch Linux VM](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121210.png) +][21] + +### **Booting to Install Arch Linux on Virtual Box** + +You will see the first opening page of Arch Linux. Click on “Boot Arch Linux (x86_64), which is for 64-bit or click on “Boot Arch Linux (i686)”, which is for 32-bit. + +[ + ![Choose to boot Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121211.png) +][22] + +As soon as you click on the first option, the system will start booting. While it completes the temporary boot, we are basically moving into the live version and are logged in as root user. + +[ + ![Booting into Arch Linux live version](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121212.png) +][23] + +Check the Internet connection by typing in the following command. + + _ping google.com_ + +The word ping stands for packet internet gopher. You will soon see the response that means Arch Linux has activated the Internet connection. This is essential to perform certain installation steps. + +[ + ![Test internet connectivity with ping](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121213.png) +][24] + +Clear the command by typing + + _clear_ + +Before we start the installation, you should partition your drive. Type  _# fdisk – 1 _ and you will see the current system’s disk partition. Focus on the 20 GB hard drives that you allocated to Arch in the beginning. + +[ + ![Partition the harddisk](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121214.png) +][25] + +### Partition the hard disk + +We are going to partition this 20 GB space into three partitions. The first one is the primary root partition that will be of 10 GB. The second will be the swap partition, which will be twice the initial RAM allocation that will be 2048 MB. The third will be the logical partition that will be 8 GB allocated. + +[ + ![Create 3 disk partitions](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121215.png) +][26] + +Type the command: + + _cfdisk_ + + You will see gpt, dos, sgi, and sun. Select the  _dos _ option and press  _enter_ . + +[ + ![Create a partition of type DOS](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121216.png) +][27] + +Here you will see the main disk space, which is 20 GB. To change this, press on the free space and type 10G. + +[ + ![Choose 10GB partition size](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121217.png) +][28] + +Press  _enter _ and then click on the “primary” partition. + +[ + ![](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121218.png) +][29] + +Now select the “bootable” type by pressing enter on bootable. + +[ + ![Make partition bootable.](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121219.png) +][30] + +Go to  _write _ and press enter, to write partition to disk. + +[ + ![Write partition to disk](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121220.png) +][31] + +Then type  _yes_  to make the changes, successfully. + +[ + ![Confirm changes](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121221.png) +][32] + +Now the 10 GB partition is created. Click on  _free space _ and then enter the partition size of 2048 M. + +[ + ![Create the 2GB swap partition](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121222.png) +][33] + +Now follow the same steps to create the logical partition. Then press enter on  _quit_  and clear the command by typing + + _clear_ . + +[ + ![quit cfdisk](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121223.png) +][34] + +Format the newly partitioned disk by typing: + + _mkfs.ext4 /dev/sda1_ + +Here  _sda1 _ is the partition name. Repeat this for the second drive by typing: + + _mkfs.ext4 /dev/sda3_ + +and for the swap partition, + + _mkswap/dev/sda2_ . + +[ + ![Format the swap partition with mkswap](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121224.png) +][35] + +Activate the swap by typing: + + _swapon/ dev/ sda2_ + +and clear the command by typing: + + _clear_ . + +[ + ![Enable swap](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121225.png) +][36] + +Mount the primary partition to start the installation part by typing: + + _mount /dev/ sda1 / mnt._ + +[ + ![Mount the partitions](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121226.png) +][37] + +### Bootstrap Arch Linux + +Bootstrap the system by typing: + + _pacstrap /mnt base base-devel_ + +You can see that it is synchronizing the data packages. + +[ + ![Bootstrap Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121227.png) +][38] + +The installation will start and will take a few minutes. + +[ + ![Arch Linux installation has been started](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121228.png) +][39] + +After the base installation create the fstab file by tying: + + _genfstab /mnt>> /mnt/etc/fstab_ + +[ + ![Generating /etc/fstab](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121229.png) +][40] + +Configure locale, time and root password + +Change the system root to the Arch Linux installation directory by typing: + + _arch-chroot /mnt /bin /bash_ + + Now to configure the language settings: + + _nano /etc / local.gen_ + +[ + ![Set language in Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121230.png) +][41] + +Select the following language configuration by deleting the # and pressing  _control + x, _ press  _y_ , and press  _enter_ . + +[ + ![select language](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121231.png) +][42] + +Now activate it by typing: + + _locale-gen_ + +and press  _enter_ . + +[ + ![Generate the locales in Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/121232.png) +][43] + +Create the  /etc/locale.conf file by typing: + + _nano /etc/locale.conf_ + +then press  _enter_ . Now you can add your language to the system by adding this line to the file: + +``` +LANG=en_US.UTF-8 +``` + + Then press  _control + x _ and press  _y_ , and press  _enter_ . + +[ + ![Set default language](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/1.png) +][44] + +Synchronize the zone information by typing: + +ls user/share/zoneinfo_ + +and you will find a list of all the zones of the world. + +[ + ![Set System language default](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/11.png) +][45] + +To select your zone, type: + + _ln –s /usr/share/zoneinfo/Asia/Kolkata/etc/localtime_ + +or you can select any name from the below list. + +[ + ![](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/12.png) +][46] + +Set the time standard using the command. + + _hwclock --systohc –utc_ + +And the hardware clock is synchronized. + +[ + ![Set time](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/13.png) +][47] + +Set the root user password by typing: + + _passwd_ + +And press  _enter_ . Then type your password and press enter. + +[ + ![Set the root password](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/14.png) +][48] + +### Setup hostname and networking + +Enter the host name of the network by typing: + + _nano /etc/hostname_ + +and press  _enter_ . Now type any name and then press  _control + x _ and press  _y_ , and press  _enter_ . + +[ + ![Set the hostname](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/15.png) +][49] + +Enable the dhcpcd by typing: + + _systemctl enable dhcpcd_ + +and it will be started at next boot time to fetch an IP address automatically. + +[ + ![Enable dhcpd](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/16.png) +][50] + +### Install the Bootloader + +The final step, initiate the grub installation. Type: + + _pacman –S grub os-rober_ + +then press  _y _ and the download part will begin. + +[ + ![Configure grub](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/17.png) +][51] + +Install the grub boot loader to the hard disk by typing: + + _grub-install /dev/sd_ + +and configure it: + + _grub-mkconfig –o/ boot/ grub/ grub.cfg_ + +[ + ![Install and configure grub boot loader](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/18.png) +][52] + +Finally reboot the system by typing: + + _reboot_ + +and press  _enter._ + +[ + ![Reboot the system](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/19.png) +][53] + +### Boot into the installed ArchLinux operating system + +Choose “Boot Existing OS” to boot Arch Linux on Virtual Box. + +[ + ![Boot Arch Linux](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/110.png) +][54] + +Login with your root name and password, and you will enter your new Arch Linux operating system. + +[ + ![Arch Linux installed successfully](https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/111.png) +][55] + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/ + +作者:[Dimitris][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/ +[1]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#download-arch-linux +[2]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#initializing-installation-with-oracle-vm-virtualbox-manager +[3]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#partition-the-hard-disk +[4]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#bootstrap-arch-linux +[5]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#setup-hostname-and-networking +[6]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#install-the-bootloader +[7]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#boot-into-the-installed-archlinux-operating-system +[8]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#arch-linux-repositories +[9]:https://www.howtoforge.com/tutorial/install-arch-linux-on-virtualbox/#install-arch-linux-on-virtual-box +[10]:https://www.archlinux.org/ +[11]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/1212.png +[12]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12121.png +[13]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12122.png +[14]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12123.png +[15]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12124.png +[16]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12125.png +[17]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12126.png +[18]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12127.png +[19]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12128.png +[20]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12129.png +[21]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121210.png +[22]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121211.png +[23]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121212.png +[24]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121213.png +[25]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121214.png +[26]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121215.png +[27]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121216.png +[28]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121217.png +[29]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121218.png +[30]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121219.png +[31]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121220.png +[32]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121221.png +[33]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121222.png +[34]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121223.png +[35]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121224.png +[36]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121225.png +[37]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121226.png +[38]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121227.png +[39]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121228.png +[40]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121229.png +[41]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121230.png +[42]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121231.png +[43]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/121232.png +[44]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/1.png +[45]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/11.png +[46]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/12.png +[47]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/13.png +[48]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/14.png +[49]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/15.png +[50]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/16.png +[51]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/17.png +[52]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/18.png +[53]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/19.png +[54]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/110.png +[55]:https://www.howtoforge.com/images/install_arch_linux_on_virtual_box/big/111.png From 1e5c7278c32daa789356d0be26c90b51b6187739 Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:50:50 +0800 Subject: [PATCH 084/190] =?UTF-8?q?20170308-6=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w to setup a Linux server on Amazon AWS.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20170227 How to setup a Linux server on Amazon AWS.md diff --git a/sources/tech/20170227 How to setup a Linux server on Amazon AWS.md b/sources/tech/20170227 How to setup a Linux server on Amazon AWS.md new file mode 100644 index 0000000000..24fcffa029 --- /dev/null +++ b/sources/tech/20170227 How to setup a Linux server on Amazon AWS.md @@ -0,0 +1,144 @@ +​How to setup a Linux server on Amazon AWS +============================================================ + +### On this page + +1. [Setup a Linux VM in AWS][1] +2. [Connect to an EC2 instance from Windows][2] + +AWS (Amazon Web Services) is one of the leading cloud server providers worldwide. You can setup a server within a minute using the AWS platform. On AWS, you can fine tune many techncal details of your server like the number of CPU's, Memory and HDD space, type of HDD (SSD which is faster or a classic IDE) and so on. And the best thing about the AWS is that you need to pay only for the services that you have used. To get started, AWS provides a special account called "Free tier" where you can use the AWS technology free for one year with some minor restrictions like you can use the server only upto 750 Hours a month, when you cross this theshold they will charge you. You can check all the rules related this on [aws portal][3]. + +Since I am writing this post about creating a Linux server on AWS, having a "Free Tier" account is the main pre-requisite. To sign up for this account you can use this [link][4]. Kindly note that you need to enter your credit card details while creating the account. + +So let's assume that you have created the "free tier" account. + +Before we proceed, you must know some of the terminologies in AWS to understand the setup: + +1. EC2 (Elastic compute cloud): This term used for the virtual machine. +2. AMI (Amazon machine image): Used for the OS instance. +3. EBS (Elastic block storage): one of the type Storage environment in AWS. + +Now login to AWS console at below location: + +[https://console.aws.amazon.com/][5] + +The AWS console will look like this: + +[ + ![Amazon AWS console](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_console.JPG) +][6] + +### Setup a Linux VM in AWS + +1: Create an EC2 (virtual machine) instance: Before installing the OS on you must create a VM in AWS. To create this, click on EC2 under compute menu: + +[ + ![Create an EC2 instance](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_console_ec21.png) +][7] + +2\. Now click on "Launch Instance" Button under Create instance. + +[ + ![Launch the EC2 instance](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_launch_ec2.png) +][8] + +3\. Now, when you are using a free tier account, then better select the Free Tier radio button so that AWS will filter the instances which are used for free usage. This will keep you aside from paying money to AWS for using billed resources under AWS. + +[ + ![Select Free Tier instances only](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_free_tier_radio1.png) +][9] + +4\. To proceed further, select following options: + +a. **Choose an AMI in the classic instance wizard: selection --> I'll use Red Hat Enterprise Linux 7.2 (HVM), SSD Volume Type here** + +b. Select "**t2.micro**" for the instance details. + +c. **Configure Instance Details**: Do not change anything simply click next. + +d. **Add Storage: **Do not change anything simply click next as we will using default Size 10 (GiB) Hard disk in this case. + +e. **Add Tags**: Do not change anything simply click next. + +f. **Configure Security Group**: Now select port 22 which is used for ssh so that you can access this server from anywhere. + +[ + ![Configure AWS server](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_ssh_port1.png) +][10] + +g. **Select review and launch button** + +h. If all the details are Ok now press the "**Launch**" button, + +i. Once you clicked the Launch button, a popup window gets displayed to create a "Key pair" as shown below: Select the option "create a new key pair" and give a name to key pair. Then download the same. You require this key pair while connecting to the server using ssh. At the end, click the "Launch Instance" button. + +[ + ![Create Key pair](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_key_pair.png) +][11] + +j. After clicking Launch instance Button, go to services at the left top side. Select Compute--> EC2\. Now click on running instance link as below: + +[ + ![Go to the running EC2 instance](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_running_instance.png) +][12] + +k. Now you can see that your new VM is ready with status "running" as shown below. Select the Instance and Please note down the "Public DNS value" which is required for logging on to the server. + +[ + ![Public DNS value of the VM](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_dns_value.png) +][13] + +Now you are done with creating a sample Linux installed VM. To connect to the server, follow below steps. + +### Connect to an EC2 instance from Windows + +1\. First of all, you need to have putty gen and Putty exe's for connecting to the server from Windows (or the SSH command on Linux). You can download putty by following this [Link][14]. + +2\. Now open the putty gen "puttygen.exe". + +3\. You need to click on the "Load button", browse and select the keypair file (pem file) that you downloaded above from Amazon. + +4\. You need to select the "ssh2-RSA" option and click on the save private key button. Kindly select yes on the next pop-up. + +5\. Save the file with the file extension .ppk. + +6\. Now you need to open Putty.exe. Go to connection at the left side menu then select "SSH" and then select "Auth". You need to click on the browse button to select the .ppk file that we created in the step 4. + +7\. Now click on the "session" menu and paste the DNS value captured during the 'k' step of this tutorial in the "host name" box and hit the open button. + +8\. Upon asking for username and password, enter "**ec2-user**" and blank password and then give below command. + +$sudo su - + +Hurray, you are now root on the Linux server which is hosted on AWS cloud. + +[ + ![Logged in to AWS EC2 server](https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/aws_putty1.JPG) +][15] + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/ + +作者:[MANMOHAN MIRKAR][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/ +[1]:https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/#setup-a-linux-vm-in-aws +[2]:https://www.howtoforge.com/tutorial/how-to-setup-linux-server-with-aws/#connect-to-an-ec-instance-from-windows +[3]:http://aws.amazon.com/free/ +[4]:http://aws.amazon.com/ec2/ +[5]:https://console.aws.amazon.com/ +[6]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_console.JPG +[7]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_console_ec21.png +[8]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_launch_ec2.png +[9]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_free_tier_radio1.png +[10]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_ssh_port1.png +[11]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_key_pair.png +[12]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_running_instance.png +[13]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_dns_value.png +[14]:http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html +[15]:https://www.howtoforge.com/images/how_to_setup_linux_server_with_aws/big/aws_putty1.JPG From 688f03cefbb6225b233cb4528a9fca51a5136b8b Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:53:53 +0800 Subject: [PATCH 085/190] =?UTF-8?q?20170308-7=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ovecot Pure-FTPD BIND and ISPConfig 3.1.md | 393 ++++++++++++++++++ 1 file changed, 393 insertions(+) create mode 100644 sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md diff --git a/sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md b/sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md new file mode 100644 index 0000000000..daf5f0819a --- /dev/null +++ b/sources/tech/20170222 The Perfect Server CentOS 7.3 with Apache Postfix Dovecot Pure-FTPD BIND and ISPConfig 3.1.md @@ -0,0 +1,393 @@ +The Perfect Server CentOS 7.3 with Apache, Postfix, Dovecot, Pure-FTPD, BIND and ISPConfig 3.1 +============================================================ + +### This tutorial exists for these OS versions + +* **CentOS 7.3** +* [CentOS 7.2][3] +* [CentOS 7.1][4] +* [CentOS 7][5] + +### On this page + +1. [1 Requirements][6] +2. [2 Preliminary Note][7] +3. [3 Prepare the server][8] +4. [4 Enable Additional Repositories and Install Some Software][9] +5. [5 Quota][10] + 1. [Enabling quota on the / (root) partition][1] + 2. [Enabling quota on a separate /var partition][2] +6. [6 Install Apache, MySQL, phpMyAdmin][11] + +This tutorial shows the installation of ISPConfig 3.1 on a CentOS 7.3 (64Bit) server. ISPConfig is a web hosting control panel that allows you to configure the following services through a web browser: Apache web server, Postfix mail server, MySQL, BIND nameserver, PureFTPd, SpamAssassin, ClamAV, Mailman, and many more. + +### 1 Requirements + +To install such a system you will need the following: + +* A Centos 7.3 minimal server system. This can be a server installed from scratch as described in our [Centos 7.3 minimal server tutorial][12] or a virtual-server or root-server from a hosting company that has a minimal Centos 7.3 setup installed. +* A fast Internet connection. + +### 2 Preliminary Note + +In this tutorial, I use the hostname server1.example.com with the IP address 192.168.1.100 and the gateway 192.168.1.1. These settings might differ for you, so you have to replace them where appropriate. + +Please note that HHVM and XMPP are not supported in ISPConfig for the CentOS platform yet. If you like to manage an XMPP chat server from within ISPConfig or use HHVM (Hip Hop Virtual Machine) in an ISPConfig website, then please use Debian 8 or Ubuntu 16.04 as server OS instead of CentOS 7.3. + +### 3 Prepare the server + +**Set the keyboard layout** + +In case that the keyboard layout of the server does not match your keyboard, you can switch to the right keyboard (in my case "de" for a german keyboard layout, with the localectl command: + +`localectl set-keymap de` + +To get a list of all available keymaps, run: + +`localectl list-keymaps` + +I want to install ISPConfig at the end of this tutorial, ISPConfig ships with the Bastille firewall script that I will use as firewall, therefor I disable the default CentOS firewall now. Of course, you are free to leave the CentOS firewall on and configure it to your needs (but then you shouldn't use any other firewall later on as it will most probably interfere with the CentOS firewall). + +Run... + +``` +yum -y install net-tools +systemctl stop firewalld.service +systemctl disable firewalld.service +``` + +to stop and disable the CentOS firewall. It is ok when you get errors here, this just indicates that the firewall was not installed. + +Then you should check that the firewall has really been disabled. To do so, run the command: + +`iptables -L` + +The output should look like this: + +[root@server1 ~]# iptables -L +Chain INPUT (policy ACCEPT) +target prot opt source destination + +Chain FORWARD (policy ACCEPT) +target prot opt source destination + +Chain OUTPUT (policy ACCEPT) +target prot opt source destination + +Or use the firewall-cmd command: + +firewall-cmd --state + +[root@server1 ~]# firewall-cmd --state +not running +[root@server1 ~]# + +Now I will install the network configuration editor and the shell based editor "nano" that I will use in the next steps to edit the config files: + +yum -y install nano wget NetworkManager-tui + +If you did not configure your network card during the installation, you can do that now. Run... + +nmtui + +... and go to Edit a connection: + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui1.png) +][13] + +Select your network interface: + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui2.png) +][14] + +Then fill in your network details - disable DHCP and fill in a static IP address, a netmask, your gateway, and one or two nameservers, then hit Ok: + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui3.png) +][15] + +Next select OK to confirm the changes that you made in the network settings + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui4.png) +][16] + +and Quit to close the nmtui network configuration tool. + +[ + ![](https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/nmtui5.png) +][17] + +You should run + +ifconfig + +now to check if the installer got your IP address right: + +``` +[root@server1 ~]# ifconfig +ens33: flags=4163 mtu 1500 + inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 + inet6 fe80::20c:29ff:fecd:cc52 prefixlen 64 scopeid 0x20 + + ether 00:0c:29:cd:cc:52 txqueuelen 1000 (Ethernet) + RX packets 55621 bytes 79601094 (75.9 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 28115 bytes 2608239 (2.4 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + inet6 ::1 prefixlen 128 scopeid 0x10 + loop txqueuelen 0 (Local Loopback) + RX packets 0 bytes 0 (0.0 B) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 0 bytes 0 (0.0 B) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + +If your network card does not show up there, then it not be enabled on boot, In this case, open the file /etc/sysconfig/network-scripts/ifcfg-eth0 + +nano /etc/sysconfig/network-scripts/ifcfg-ens33 + +and set ONBOOT to yes: + +[...] +ONBOOT=yes +[...] + +and reboot the server. + +Check your /etc/resolv.conf if it lists all nameservers that you've previously configured: + +cat /etc/resolv.conf + +If nameservers are missing, run + +nmtui + +and add the missing nameservers again. + +Now, on to the configuration... + +**Adjusting /etc/hosts and /etc/hostname** + +Next, we will edit /etc/hosts. Make it look like this: + +nano /etc/hosts + +``` +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 +192.168.1.100 server1.example.com server1 + +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +``` + +Set the hostname in the /etc/hostname file. The file shall contain the fully qualified domain name (e.g. server1.example.com in my case) and not just the short name like "server1". Open the file with the nano editor: + +nano /etc/hostname + +And set the hostname in the file. + +``` +server1.example.com +``` + +Save the file and exit nano. + +**Disable SELinux** + +SELinux is a security extension of CentOS that should provide extended security. In my opinion you don't need it to configure a secure system, and it usually causes more problems than advantages (think of it after you have done a week of trouble-shooting because some service wasn't working as expected, and then you find out that everything was ok, only SELinux was causing the problem). Therefore I disable it (this is a must if you want to install ISPConfig later on). + +Edit /etc/selinux/config and set SELINUX=disabled: + +nano /etc/selinux/config + +``` +# This file controls the state of SELinux on the system. +# SELINUX= can take one of these three values: +# enforcing - SELinux security policy is enforced. +# permissive - SELinux prints warnings instead of enforcing. +# disabled - No SELinux policy is loaded. +SELINUX=disabled +# SELINUXTYPE= can take one of these two values: +# targeted - Targeted processes are protected, +# mls - Multi Level Security protection. +SELINUXTYPE=targeted +``` + +Afterwards we must reboot the system: + +reboot + +### 4 Enable Additional Repositories and Install Some Software + +First, we import the GPG keys for software packages: + +rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* + +Then we enable the EPEL repository on our CentOS system as lots of the packages that we are going to install in the course of this tutorial are not available in the official CentOS 7 repository: + +yum -y install epel-release + +yum -y install yum-priorities + +Edit /etc/yum.repos.d/epel.repo... + +nano /etc/yum.repos.d/epel.repo + +... and add the line priority=10 to the [epel] section: + +``` +[epel] +name=Extra Packages for Enterprise Linux 7 - $basearch +#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch +mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch +failovermethod=priority +enabled=1 +priority=10 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 +[...] +``` + +Then we update our existing packages on the system: + +yum -y update + +Now we install some software packages that are needed later on: + +yum -y groupinstall 'Development Tools' + +### 5 Quota + +(If you have chosen a different partitioning scheme than I did, you must adjust this chapter so that quota applies to the partitions where you need it.) + +To install quota, we run this command: + +yum -y install quota + +Now we check if quota is already enabled for the filesystem where the website (/var/www) and maildir data (var/vmail) is stored. In this example setup, I have one big root partition, so I search for ' / ': + +mount | grep ' / ' + +[root@server1 ~]# mount | grep ' / ' +/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,noquota) +[root@server1 ~]# + +If you have a separate /var partition, then use: + +mount | grep ' /var ' + +instead. If the line contains the word "**noquota**", then proceed with the following steps to enable quota. + +### Enabling quota on the / (root) partition + +Normally you would enable quota in the /etc/fstab file, but if the filesystem is the root filesystem "/", then quota has to be enabled by a boot parameter of the Linux Kernel. + +Edit the grub configuration file: + +nano /etc/default/grub + +search fole the line that starts with GRUB_CMDLINE_LINUX and add rootflags=uquota,gquota to the commandline parameters so that the resulting line looks like this: + +``` +GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet rootflags=uquota,gquota" +``` + +and apply the changes by running the following command. + +cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg_bak +grub2-mkconfig -o /boot/grub2/grub.cfg + +and reboot the server. + +reboot + +Now check if quota is enabled: + +mount | grep ' / ' + +[root@server1 ~]# mount | grep ' / ' +/dev/mapper/centos-root on / type xfs (rw,relatime,attr2,inode64,usrquota,grpquota) +[root@server1 ~]# + +When quota is active, we can see "**usrquota,grpquota**" in the mount option list. + +### Enabling quota on a separate /var partition + +If you have a separate /var partition, then edit /etc/fstab and add ,uquota,gquota to the / partition (/dev/mapper/centos-var): + +nano /etc/fstab + +``` + +# +# /etc/fstab +# Created by anaconda on Sun Sep 21 16:33:45 2014 +# +# Accessible filesystems, by reference, are maintained under '/dev/disk' +# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info +# +/dev/mapper/centos-root / xfs defaults 1 1 +/dev/mapper/centos-var /var xfs defaults,uquota,gquota 1 2 +UUID=9ac06939-7e43-4efd-957a-486775edd7b4 /boot xfs defaults 1 3 +/dev/mapper/centos-swap swap swap defaults 0 0 +``` + +Then run + +mount -o remount /var + +quotacheck -avugm +quotaon -avug + +to enable quota. When you get an error that there is no partition with quota enabled, then reboot the server before you proceed. + +### 6 Install Apache, MySQL, phpMyAdmin + +We can install the needed packages with one single command: + +yum -y install ntp httpd mod_ssl mariadb-server php php-mysql php-mbstring phpmyadmin + +To ensure that the server can not be attacked trough the [HTTPOXY][18] vulnerability, we will disable the HTTP_PROXY header in apache globally.  + +Add the apache header rule at the end of the httpd.conf file: + +echo "RequestHeader unset Proxy early" >> /etc/httpd/conf/httpd.conf + +And restart httpd to apply the configuration change. + +service httpd restart + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ + +作者:[ Till Brehm][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ +[1]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#enabling-quota-on-the-root-partition +[2]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#enabling-quota-on-a-separate-var-partition +[3]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-2-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/ +[4]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-1-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig3/ +[5]:https://www.howtoforge.com/perfect-server-centos-7-apache2-mysql-php-pureftpd-postfix-dovecot-and-ispconfig3 +[6]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-requirements +[7]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-preliminary-note +[8]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#nbspprepare-the-server +[9]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#nbspenable-additional-repositories-and-install-some-software +[10]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-quota +[11]:https://www.howtoforge.com/tutorial/perfect-server-centos-7-3-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/#-install-apache-mysql-phpmyadmin +[12]:https://www.howtoforge.com/tutorial/centos-7-minimal-server/ +[13]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui1.png +[14]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui2.png +[15]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui3.png +[16]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui4.png +[17]:https://www.howtoforge.com/images/perfect_server_centos_7_1_x86_64_apache2_dovecot_ispconfig3/big/nmtui5.png +[18]:https://www.howtoforge.com/tutorial/httpoxy-protect-your-server/ From 283fb28cf1e2a9f4f5768150edd6cf20db659c2d Mon Sep 17 00:00:00 2001 From: Ezio Date: Wed, 8 Mar 2017 08:55:49 +0800 Subject: [PATCH 086/190] =?UTF-8?q?20170308-8=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rkers and perform text selection in Vim.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20170302 How to use markers and perform text selection in Vim.md diff --git a/sources/tech/20170302 How to use markers and perform text selection in Vim.md b/sources/tech/20170302 How to use markers and perform text selection in Vim.md new file mode 100644 index 0000000000..e611f74302 --- /dev/null +++ b/sources/tech/20170302 How to use markers and perform text selection in Vim.md @@ -0,0 +1,127 @@ +How to use markers and perform text selection in Vim +============================================================ + +When using GUI-based text/source code editors, some features are a given, such as selecting text. I mean, most of us won't even consider this a feature anymore. But that's not the case with command line based editors like Vim. Specifically for Vim, when only using keyboard, you'll have to learn certain commands in order to select text the way you want. In this tutorial we will discuss this feature as well as the 'marks' feature of Vim in detail. + +But before we start doing that, it's worth mentioning that all the examples, commands, and instructions mentioned in this tutorial have been tested on Ubuntu 16.04, and the Vim version we've used is 7.4. + +# Text selection options in Vim + +Assuming that you have the basic knowledge about the Vim editor (No? no problem, just head [here][2]), you would be knowing that the 'd' command lets you cut/delete a line. But what if you want to cut, say, 3 lines? Your answer could be: 'repeat the command thrice'. Fine, but what if the requirement is to cut 15 lines? Is running the 'd' command 15 times a practical solution? + +No, it's not. A better solution, in this case, would be to select the lines you want to cut/delete, and then run the 'd' command just once. Here's an example: + +Suppose I want to cut/delete the complete first paragraph of the INTRODUCTION section shown in the screenshot below: + +[ + ![Text edited in VIM](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-example.png) +][3] + +So what I'll do is, I'll bring the cursor in the beginning of the first line, and (making sure I am out of Insert mode) type the 'V' (Shift+v) command. This will result in the first line being selected and Vim enabling the Visual Line mode. + +[ + ![Select a line with VIM](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-initiated.png) +][4] + +Now, all I have to do is to use the down arrow key to select the whole paragraph. + +[ + ![Select multiple lines with Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-working.png) +][5] + +So that's what we wanted, right? Now just press 'd' and the selected paragraph will be cut/deleted. Needless to say, aside from cut/delete, you can perform any other option on the selected text. + +This brings us to another important aspect: not every time we need to delete the complete line or lines; what to do in those cases?  What that means is, the solution we just discussed only works when you want to perform operation on complete line(s). What if the requirement is to delete the first three sentences in a paragraph? + +Well, there's a command for this as well - just use 'v' instead of 'V' (without single quotes of course). Following is an example where-in I used 'v' and then selected the first three sentences in the paragraph: + +[ + ![Select the first three sentences in Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-partial-lines.png) +][6] + +Moving on, sometimes the data you are dealing with consists of separate columns, and the requirement may be to select a particular column. For example, consider the following screenshot: + +[ + ![Columns in Vom](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-columns.png) +][7] + +Suppose the requirement is to only select the name of countries, which mean the second column of the text. So what you can do in this case is, bring your cursor under the first element of the column in question and press Ctrl+v once. Now, using the down arrow key, select the first letter of each country name: + +[ + ![Select the first char of a column](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-column-1.png) +][8] + +And then using the right arrow key, select the complete column, or the whole names. + +[ + ![Select a whole column in Vim](https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/vim-select-column-2.png) +][9] + +**Tip**: In case you de-selected a block of text for some reason, and now want to again select it, just press 'gv' in the command mode. + +# Using marks + +Sometimes, while working on a large file (say, a source code file or a shell script), you might want to switch to particular location and then come back to the line where you were originally. That's not an issue if the lines in question aren't far away, or you have to do this occasionally. + +But what is it's the other way round - you have to frequently jump between your present location and various far off lines in the file. Well, the solution in that case is to use marks. Just mark your current location, then come back to this location from anywhere in the file by just mentioning the name of the mark. + +To mark a line in vim, use the m command followed by an alphabet that represents the name of the mark (available options are a-z in lowercase). For example, ma. Now, to come back to the mark a, use the 'a command (single quote included). + +**Tip**: You can use apostrophe (`'`) or backtick `(`) depending on whether you want to jump to the beginning of the marked line, or specifically to` the line and column of the mark. + +There can be various other useful applications of Vim markers. For example, you can put a mark on a line, then go to some other line and run the following command: + +``` +d'[mark-name] +``` + + to delete everything between your current position and the marked line. + +Moving on, here's an important tid-bid from the Vim's official documentation: + +``` +Each file has a set of marks identified by lowercase letters (a-z). In addition there is a global set of marks identified by uppercase letters (A-Z) that identify a position within a particular file. For example, you may be editing ten files. Each file could have mark a, but only one file can have mark A.  +``` + +So while we have discussed the basic usage of lowercase alphabets as Vim marks, how and where the uppercase letters are useful. Well, the following excerpt makes it amply clear: + +``` +Because of their limitations, uppercase marks may at first glance seem less versatile than their lowercase counterpart, but this feature allows them to be used as a quick sort of "file bookmark." For example, open your .vimrc, press mV, and close Vim. The next time you want to edit your .vimrc, just press 'V to open it. +``` + +And finally, to delete a mark, use the 'delmarks' command. For example: + +``` +:delmarks a +``` + +The aforementioned command will delete the mark a from the file. Of course, if you delete a line containing a mark, then that mark is also deleted automatically. For more information on marks, head to the [Vim documentation][11]. + +# Conclusion + +As you start using Vim as your primary editor, features like the ones explained in this tutorial become useful tools that save a lot of your time. As you'd agree, there's not much of a learning curve involved with selection and marks features explained here - all that's required is a bit of practice. + +For the complete coverage of Vim-related articles on HowtoForge, head [here][1]. + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-use-markers-and-perform-text-selection-in-vim/ + +作者:[Himanshu Arora][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com/tutorial/how-to-use-markers-and-perform-text-selection-in-vim/ +[1]:https://www.howtoforge.com/tutorials/shell/ +[2]:https://www.howtoforge.com/vim-basics +[3]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-example.png +[4]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-initiated.png +[5]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-working.png +[6]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-partial-lines.png +[7]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-columns.png +[8]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-column-1.png +[9]:https://www.howtoforge.com/images/how-to-use-markers-and-perform-text-selection-in-vim/big/vim-select-column-2.png +[10]:http://vim.wikia.com/wiki/Vimrc +[11]:http://vim.wikia.com/wiki/Using_marks From 50c4447931c0187b29f4c62103866cc64f55b68d Mon Sep 17 00:00:00 2001 From: lixiang23 Date: Wed, 8 Mar 2017 09:09:00 +0800 Subject: [PATCH 087/190] beyondworld translated --- ...170213 Orange Pi as Time Machine Server.md | 147 ------------------ ...170213 Orange Pi as Time Machine Server.md | 145 +++++++++++++++++ 2 files changed, 145 insertions(+), 147 deletions(-) delete mode 100644 sources/tech/20170213 Orange Pi as Time Machine Server.md create mode 100644 translated/tech/20170213 Orange Pi as Time Machine Server.md diff --git a/sources/tech/20170213 Orange Pi as Time Machine Server.md b/sources/tech/20170213 Orange Pi as Time Machine Server.md deleted file mode 100644 index 2b29f7c895..0000000000 --- a/sources/tech/20170213 Orange Pi as Time Machine Server.md +++ /dev/null @@ -1,147 +0,0 @@ -beyondworld translating - -Orange Pi as Time Machine Server -============================================================ - - ![Orange Pi as Time Machine Server](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=960%2C450) - -One of my projects has been to organize automated backups of the various computers in the house.  This includes a couple Macs with some precious data on them.  So, I decided to put my inexpensive [Orange Pi][3] with [Armbian][4] Linux to the test, with the goal of getting [Time Machine][5] working over the network to a USB drive attached to the pi board.  That being the case, I discovered and successfully installed Netatalk. - -[Netatalk][6] is open source software that acts as an Apple file server.  With a combination of [Avahi][7] and Netatalk running, your Mac can discover your pi board on the network and will even consider it to be a “Mac” type device.  This enables you to connect manually to the network drive but more importantly it enables Time Machine to find and use the remote drive.  The below guidance may help if you if you wish to set up a similar backup capability for your Macs. - -### Preparations - -To set up the USB drive, I first experimented with an HFS+ formatted file system.  Unfortunately, I could never get write permissions working.  So, I opted instead to create an EXT4 filesystem and ensured that my user “pi” had read/write permissions.  There are many ways to format a drive but my preferred (and recommended) method is to use [gparted][8] whenever possible.  Since gparted is included with the Armbian desktop, that I what I used. - -I wanted this drive to be automatically mounted to the same location every time the pi board boots or the USB drive is connected.  So, I created a location for it to be mounted, made a “tm” directory for the actual backups, and changed the ownership of “tm” to user pi: - -``` -cd /mnt -sudo mkdir timemachine -cd timemachine -sudo mkdir tm -sudo chown pi:pi tm -``` - -Then I opened a terminal and edited /etc/fstab… - -``` -sudo nano /etc/fstab -``` - -…and added a line at the end for the device  (in my case, is it sdc2): - -``` -/dev/sdc2 /mnt/timemachine ext4 rw,user,exec 0 0 -``` - -You will need to install some prerequisites packages via command line, some of which may already be installed on your system: - -``` -sudo apt-get install build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev avahi-daemon libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libio-socket-inet6-perl tracker libtracker-sparql-1.0-dev libtracker-miner-1.0-dev hfsprogs hfsutils avahi-daemon -``` - -### Install & Configure Netatalk - -The next action is to download Netatalk, extract the downloaded archive file, and navigate to the Netatalk software directory: - -``` -wget https://sourceforge.net/projects/netatalk/files/netatalk/3.1.10/netatalk-3.1.10.tar.bz2 -tar xvf netatalk-3.1.10.tar.bz2 -cd netatalk-3.1.10 -``` - -Now you need to configure, make, and make install the software.  In the netatalk-3.1.10 directory, run the following configure command and be prepared for it to take a bit of time: - -``` -./configure --with-init-style=debian-systemd --without-libevent --without-tdb --with-cracklib --enable-krbV-uam --with-pam-confdir=/etc/pam.d --with-dbus-daemon=/usr/bin/dbus-daemon --with-dbus-sysconf-dir=/etc/dbus-1/system.d --with-tracker-pkgconfig-version=1.0 -``` - -When that finishes, run: - -``` -make -``` - -Be prepared for this to take a rather long time to complete.  Seriously, grab a cup of coffee or something.  When that is finally done, run the following command: - -``` -sudo make install -``` - -That should complete in a brief moment.  Now you can verify installation and also find the location of configuration files with the following two commands: - -``` -sudo netatalk -V -sudo afpd -V -``` - -You will need to edit your afp.conf file so that your time machine backup location is defined, your user account has access to it, and to specify whether or not you want [Spotlight][9] to index your backups. - -``` -sudo nano /usr/local/etc/afp.conf -``` - -As an example, my afp.conf includes the following: - -``` -[My Time Machine Volume] -path = /mnt/timemachine/tm -valid users = pi -time machine = yes -spotlight = no -``` - -Finally, enable and start up Avahi and Netatalk: - -``` -sudo systemctl enable avahi-daemon -sudo systemctl enable netatalk -sudo systemctl start avahi-daemon -sudo systemctl start netatalk -``` - -### Connecting to the Network Drive - -At this point, your Mac may have already discovered your pi board and network drive. Open Finder on the Mac and see if you have something like this: - - ![](https://i2.wp.com/piboards.com/wp-content/uploads/2017/02/TM_drive.png?resize=241%2C89) - -You can also connect to the server by host name or IP address, for example: - -``` -afp://192.168.1.25 -``` - -### Time Machine Backup - -And at last…open Time Machine on the Mac, and select disk, and choose your Orange Pi. - - ![](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=579%2C381) - -This set up will definitely work and the Orange Pi handles the process like a champ, but keep in mind this may not be the fastest of backups.  But it is easy, inexpensive, and ‘just works’ like it should.  If you have success or improvements for this type of set up, please comment below or send me a note. - - ![](https://i0.wp.com/piboards.com/wp-content/uploads/2017/02/backup_complete.png?resize=300%2C71) - -Orange Pi boards are available at Amazon (affiliate links): - --------------------------------------------------------------------------------- - -via: http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ - -作者:[MIKE WILMOTH][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://piboards.com/author/piguy/ -[1]:http://piboards.com/author/piguy/ -[2]:http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ -[3]:https://www.amazon.com/gp/product/B018W6OTIM/ref=as_li_tl?ie=UTF8&tag=piboards-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B018W6OTIM&linkId=08bd6573c99ddb8a79746c8590776c39 -[4]:https://www.armbian.com/ -[5]:https://support.apple.com/kb/PH25710?locale=en_US -[6]:http://netatalk.sourceforge.net/ -[7]:https://en.wikipedia.org/wiki/Avahi_(software) -[8]:http://gparted.org/ -[9]:https://support.apple.com/en-us/HT204014 diff --git a/translated/tech/20170213 Orange Pi as Time Machine Server.md b/translated/tech/20170213 Orange Pi as Time Machine Server.md new file mode 100644 index 0000000000..893b476bd4 --- /dev/null +++ b/translated/tech/20170213 Orange Pi as Time Machine Server.md @@ -0,0 +1,145 @@ + +使用Orange Pi搭建Time Machine服务 +================================= + + ![Orange Pi as Time Machine Server](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=960%2C450) + +我有一个项目是安排各类家用计算机进行自动备份。该项目将重要数据存放在一组Macs中。但是我决定将那些运行[Armbian][4] Linux的[Orange Pi][3]用来做实验,目的是希望能够将[Time Machine][5]运行在安装了USB网络驱动的Orange Pi主板上。在这种情况下,我找到成功安装Netatalk的方法。 + +[Netatalk][6]是一个开源软件,用于苹果文件服务器。通过[Avahi][7]和Netatalk配合运行,你的Mac设备能够识别网络上的Orange Pi设备,并会将Orange pi设备当作Mac类型的设备。这使得你能够自动连接作为网络设备,更重要的是使得Time Machine能够发现并使用远程驱动。下面的指南能够帮助你在Macs上设置类似的备份机制。 + +### 准备工作 + +为了安装USB驱动,我首先尝试了HFS+格式文件系统,不幸的是我没能成功写入。所以我选择创建一个EXT4文件系统,并确保pi用户有读写权限。Linux有很多格式化磁盘的方法,但是我最喜欢(推荐)的仍然是[gparted][8]。由于gparted已经集成在Armbian桌面了,所以我直接使用了该工具。 + +我预期的是当Pi主板启动或者USB驱动连接的时候这个设备能够自动挂载到相同的位置。于是我创建了一个目录用于挂载:新建一个tm目录用于真正的备份地址,并将tm的所有者更改为pi。 + +``` +cd /mnt +sudo mkdir timemachine +cd timemachine +sudo mkdir tm +sudo chown pi:pi tm +``` + +下一步,我打开一个终端并编辑/etc/fstab文件 + +``` +sudo nano /etc/fstab +``` + +并在该文件末尾添加了一行我的设备信息(根据我的设备情况,设置为sdc2): + +``` +/dev/sdc2 /mnt/timemachine ext4 rw,user,exec 0 0 +``` + +你需要通过命名行预装一些包,可能其中一些已经安装在你的系统上了: + +``` +sudo apt-get install build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev avahi-daemon libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libio-socket-inet6-perl tracker libtracker-sparql-1.0-dev libtracker-miner-1.0-dev hfsprogs hfsutils avahi-daemon +``` + +### 安装并配置Netatalk + +下一步是下载Netatalk,解压下载的archive文件,然后切换到Netatalk目录: + +``` +wget https://sourceforge.net/projects/netatalk/files/netatalk/3.1.10/netatalk-3.1.10.tar.bz2 +tar xvf netatalk-3.1.10.tar.bz2 +cd netatalk-3.1.10 +``` + +然后需要顺序执行configure,make,make install命令安装软件。在netatalk-3.1.10目录中执行configure命令,这个命令需要花点时间才能执行完。 + +``` +./configure --with-init-style=debian-systemd --without-libevent --without-tdb --with-cracklib --enable-krbV-uam --with-pam-confdir=/etc/pam.d --with-dbus-daemon=/usr/bin/dbus-daemon --with-dbus-sysconf-dir=/etc/dbus-1/system.d --with-tracker-pkgconfig-version=1.0 +``` + +configure运行完成后执行make: + +``` +make +``` + +执行完make命令需要花较长时间,可以考虑喝杯咖啡或者做点其他什么。当执行完后执行以下命令: + +``` +sudo make install +``` + +这个命令能够快速执行完成。现在你可以通过下面两个命令验证安装是否成功以及查找配置文件位置。 + +``` +sudo netatalk -V +sudo afpd -V +``` + +然后你需要编辑afp.conf配置文件并在其中指定Time Machine备份路径,可以访问的帐号名并指定是否使用[Spotlight][9]用于搜索备份。 + +``` +sudo nano /usr/local/etc/afp.conf +``` + +下面是afp.conf的配置示例: + +``` +[My Time Machine Volume] +path = /mnt/timemachine/tm +valid users = pi +time machine = yes +spotlight = no +``` +最后,设置Avahi和Netatalk并启动。 + +``` +sudo systemctl enable avahi-daemon +sudo systemctl enable netatalk +sudo systemctl start avahi-daemon +sudo systemctl start netatalk +``` + +### 连接到网络驱动 + +此时,你的Mac可能已经发现并识别了你的Pi设备。打开Mac中的Finder访问下面地址看看以下内容: + + ![](https://i2.wp.com/piboards.com/wp-content/uploads/2017/02/TM_drive.png?resize=241%2C89) + +当然你也可以通过host或者ip地址访问,比如: + +``` +afp://192.168.1.25 +``` +### Time Machine备份 +### Time Machine Backup + +最后打开Mac上的Time Machine,然后选中硬盘,选择Orange pi。 + + ![](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=579%2C381) + +通过这样设置后Orange Pi肯定能够正常工作并能够像champ一样处理,不过这并不是最快速的备份方式。但是这个方法比较简单且便宜,并且正如其展示的一样能够正常工作。如果你已经成功或者改进了这些设置,请在下面留言或者发送消息给我。 + + ![](https://i0.wp.com/piboards.com/wp-content/uploads/2017/02/backup_complete.png?resize=300%2C71) + +Amazon上有售卖Orange Pi主板: + +-------------------------------------------------------------------------------- + +via: http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ + +作者:[MIKE WILMOTH][a] +译者:[beyondworld](https://github.com/beyondworld) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://piboards.com/author/piguy/ +[1]:http://piboards.com/author/piguy/ +[2]:http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ +[3]:https://www.amazon.com/gp/product/B018W6OTIM/ref=as_li_tl?ie=UTF8&tag=piboards-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B018W6OTIM&linkId=08bd6573c99ddb8a79746c8590776c39 +[4]:https://www.armbian.com/ +[5]:https://support.apple.com/kb/PH25710?locale=en_US +[6]:http://netatalk.sourceforge.net/ +[7]:https://en.wikipedia.org/wiki/Avahi_(software) +[8]:http://gparted.org/ +[9]:https://support.apple.com/en-us/HT204014 From 2aa619b0c89487a55404fb2da6da83b534ffa723 Mon Sep 17 00:00:00 2001 From: Kaixin Huang Date: Wed, 8 Mar 2017 09:14:02 +0800 Subject: [PATCH 088/190] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...219 Windows wins the desktop, but Linux takes the world.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md b/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md index 9fd0765f08..c2a4e32a8a 100644 --- a/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md +++ b/sources/talk/20170219 Windows wins the desktop, but Linux takes the world.md @@ -1,3 +1,7 @@ +Meditator-hkx 翻译中... + + + Windows wins the desktop, but Linux takes the world ============================================================ From a1587c91d18cab95e4776327911e82b23da9ef28 Mon Sep 17 00:00:00 2001 From: wxy Date: Wed, 8 Mar 2017 09:27:22 +0800 Subject: [PATCH 089/190] PUB:20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @geekpi --- ...ux Gaming Which One Do You Use and Why.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename {translated/tech => published}/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md (69%) diff --git a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md b/published/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md similarity index 69% rename from translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md rename to published/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md index 4db4b11dd8..b64f50a151 100644 --- a/translated/tech/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md +++ b/published/20170213 The Best Operating System for Linux Gaming Which One Do You Use and Why.md @@ -1,27 +1,27 @@ -Linux 游戏最好的操作系统:该选哪个以及为什么? +哪个 Linux 系统最适合玩游戏? ============================================================ -### 告诉我们哪个 Linux 发型版对游戏支持的最好 +> 告诉我们哪个 Linux 发型版对游戏支持的最好 在过去几个月中,出于游戏目的,我们尝试了多种 GNU/Linux 发行版,我们得出的结论是没有专为 Linux 游戏设计的完美的操作系统。 -我们都知道,游戏世界在 Nvidia 和 AMD 用户之间分裂。现在,如果你使用的是 Nvidia 显卡,即使是五年前的一块显卡,也可以在大多数基于 Linux 的操作系统上使用,因为 Nvidia 为大多数(如果不是全部的话)GPU 提供了最新的视频驱动程序。 +我们都知道,游戏世界分成 Nvidia 和 AMD 两个阵营。现在,如果你使用的是 Nvidia 显卡,即使是五年前的一块显卡,也可以在大多数基于 Linux 的操作系统上使用,因为 Nvidia 差不多为其所有的 GPU 都提供了最新的视频驱动程序。 -当然,这意味着如果你有一块 Nvidia GPU,在大多数 GNU/Linux 发行版上你不会有什么大问题。至少与游戏中的图形或其他性能问题无关,这将严重影响你的游戏体验。 +当然,这意味着如果你有一块 Nvidia GPU,在大多数 GNU/Linux 发行版上你不会有什么大问题。至少与游戏中的图形或其他性能问题无关,这种问题将严重影响你的游戏体验。 -AMD Radeon 用户最好的游戏发行版 +### AMD Radeon 用户最好的游戏发行版 -如果你使用 AMD Radeon GPU,事情会是完全不同的。我们都知道,AMD 的专有显卡驱动程序仍然需要大量的工作来兼容最新的 GNU/Linux 发行版本,所有的 AMD GPU,以及最新的 X.Org 服务端和 Linux 内核版本。 +如果你使用 AMD Radeon GPU,事情会是完全不同的。我们都知道,AMD 的专有显卡驱动程序仍然需要大量的工作来兼容最新的 GNU/Linux 发行版本。所有的 AMD GPU ,即便是在最新的 X.Org 服务端和 Linux 内核版本上都是这样。 目前,AMDGPU-PRO 视频驱动程序只能在 Ubuntu 16.04 LTS、CentOS 6.8/7.3、Red Hat Enterprise Linux 6.8/7.3、SUSE Linux Enterprise Desktop 和 Server 12 SP2 上运行。除了 Ubuntu 16.04 LTS 之外,我们不知道为什么 AMD 为所有这些面向服务器和企业级的操作系统提供支持。 -我们不相信有 Linux 玩家会在这些系统上面玩游戏。[最新的 AMDGPU-PRO 更新][1]终于支持了HD 7xxx 和 8xxx 系列的 AMD Radeon GPU,但是如果我们不想使用 Ubuntu 16.04 LTS 呢? +我们不相信有 Linux 玩家会在这些系统上面玩游戏。[最新的 AMDGPU-PRO 更新][1]终于支持了 HD 7xxx 和 8xxx 系列的 AMD Radeon GPU,但是如果我们不想使用 Ubuntu 16.04 LTS 呢? 另外,我们有 Mesa 3D 图形库,这在大多数发行版上都有。Mesa 图形栈为我们的 AMD GPU 提供了功能强大的开源 Radeon 和 AMDGPU 驱动程序,但是为了享受最好的游戏体验,你还需要拥有最新的 X.Org 服务端和 Linux 内核。 -并不是所有的 Linux 操作系统都附带最新的 Mesa(13.0)、X.Org 服务端(1.19)和 Linux 内核(4.9)版本,它们支持较旧的 AMD GPU。有些系统只有一两种技术,但我们这些都需要,而且内核需要编译 AMD Radeon Southern Islands 和 Sea Island 来支持 AMDGPU 驱动程序工作。 +并不是所有的 Linux 操作系统都附带最新的 Mesa(13.0)、X.Org 服务端(1.19)和 Linux 内核(4.9)版本,它们支持较旧的 AMD GPU。有些系统只有其中一两种技术,但我们这些都需要,而且内核需要编译进 AMD Radeon Southern Islands 和 Sea Island 驱动来支持 AMDGPU。 -我们发现整个情况相当令人沮丧,至少对于一些使用 AMD Radeon 老式显卡的玩家。现在,我们发现,使用 AMD Radeon HD 8xxx GPU 的最佳游戏体验只能通过使用 Git 和 Linux 内核 4.10 RC 的 Mesa 17 来实现。 +我们发现整个情况相当令人沮丧,至少对于一些使用 AMD Radeon 老式显卡的玩家来说是这样的。现在,我们发现,使用 AMD Radeon HD 8xxx GPU 的最佳游戏体验只能通过使用 Git 获取到的 Mesa 17 以及 Linux 内核 4.10 RC 来实现。 所以我们现在请求你 - 如果你找到了玩游戏的完美的 GNU/Linux 发行版,无论你使用的是 AMD Radeon 还是 Nvidia GPU,但我们最感兴趣的是那些使用 AMD GPU 的玩家,请告知我们你使用的是什么发行版,设置是什么,能不能玩最新的游戏,或者有无体验问题。谢谢! @@ -29,7 +29,7 @@ Linux 游戏最好的操作系统:该选哪个以及为什么? via: http://news.softpedia.com/news/the-best-operating-system-for-linux-gaming-which-one-do-you-use-and-why-512861.shtml -作者:[Marius Nestor ][a] +作者:[Marius Nestor][a] 译者:[geekpi](https://github.com/geekpi) 校对:[jasminepeng](https://github.com/jasminepeng) From c1c0b2583b4806427e0e8f850def2892044a97c6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 8 Mar 2017 09:44:56 +0800 Subject: [PATCH 090/190] translating --- ...227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md index ec558f4363..67d9ded1c0 100644 --- a/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md +++ b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md @@ -1,3 +1,5 @@ +translating---geekpi + # LXD 2.0: Debugging and contributing to LXD [12/12] From cfce754fc29eda5578152fd945ced239cb5cef58 Mon Sep 17 00:00:00 2001 From: Stdio A Date: Wed, 8 Mar 2017 09:54:59 +0800 Subject: [PATCH 091/190] Translating 20170307 How to make release notes count.md --- sources/tech/20170307 How to make release notes count.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170307 How to make release notes count.md b/sources/tech/20170307 How to make release notes count.md index 889d98e68b..88f9127350 100644 --- a/sources/tech/20170307 How to make release notes count.md +++ b/sources/tech/20170307 How to make release notes count.md @@ -1,3 +1,5 @@ +StdioA translating + How to make release notes count ============================================================ From 69a6fcc6df9745bbe385626c3cb4f9bd51a153df Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Wed, 8 Mar 2017 09:56:33 +0800 Subject: [PATCH 092/190] Update 20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md (#5241) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译。 --- ...ion to LaTeXila - a multi-language LaTeX editor for Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md b/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md index 49405cbc24..20f3950bfb 100644 --- a/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md +++ b/sources/tech/20170222 Introduction to LaTeXila - a multi-language LaTeX editor for Linux.md @@ -1,3 +1,5 @@ +FSSlc translating + Introduction to LaTeXila - a multi-language LaTeX editor for Linux ============================================================ From a16e4ff4ecb5488a642eb61293f9e3f3de81f966 Mon Sep 17 00:00:00 2001 From: cycoe <871873687@qq.com> Date: Wed, 8 Mar 2017 11:03:06 +0800 Subject: [PATCH 093/190] cycoe translating --- ...10 5 Linux Music Players You Should Consider Switching To.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170210 5 Linux Music Players You Should Consider Switching To.md b/sources/tech/20170210 5 Linux Music Players You Should Consider Switching To.md index a5e735385b..b4f995fd30 100644 --- a/sources/tech/20170210 5 Linux Music Players You Should Consider Switching To.md +++ b/sources/tech/20170210 5 Linux Music Players You Should Consider Switching To.md @@ -1,3 +1,5 @@ +cycoe Translating + 5 Linux Music Players You Should Consider Switching To ============================================================ From 616bf91c540f63cea14194e5aab025e65492cf4a Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 8 Mar 2017 11:34:25 +0800 Subject: [PATCH 094/190] translated --- ...2.0 Debugging and contributing to LXD .md | 403 ------------------ ...2.0 Debugging and contributing to LXD .md | 394 +++++++++++++++++ 2 files changed, 394 insertions(+), 403 deletions(-) delete mode 100644 sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md create mode 100644 translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md diff --git a/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md b/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md deleted file mode 100644 index 67d9ded1c0..0000000000 --- a/sources/tech/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md +++ /dev/null @@ -1,403 +0,0 @@ -translating---geekpi - -# LXD 2.0: Debugging and contributing to LXD [12/12] - - - ![LXD logo](https://linuxcontainers.org/static/img/containers.png) - -### Introduction - - -This is finally it! The last blog post in this [series of 12][3] that started almost a year ago. - -If you followed the series from the beginning, you should have been using LXD for quite a bit of time now and be pretty familiar with its day to day operation and capabilities. - -But what if something goes wrong? What can you do to track down the problem yourself? And if you can’t, what information should you record so that upstream can track down the problem? - -And what if you want to fix issues yourself or help improve LXD by implementing the features you need? How do you build, test and contribute to the LXD code base? - -## Debugging LXD & filing bug reports - -### LXD log files - -#### /var/log/lxd/lxd.log - -This is the main LXD log file. To avoid filling up your disk very quickly, only log messages marked as INFO, WARNING or ERROR are recorded there by default. You can change that behavior by passing “–debug” to the LXD daemon. - -#### /var/log/lxd/CONTAINER/lxc.conf - -Whenever you start a container, this file is updated with the configuration that’s passed to LXC. -This shows exactly how the container will be configured, including all its devices, bind-mounts, … - -#### /var/log/lxd/CONTAINER/forkexec.log - -This file will contain errors coming from LXC when failing to execute a command. -It’s extremely rare for anything to end up in there as LXD usually handles errors much before that. - -#### /var/log/lxd/CONTAINER/forkstart.log - -This file will contain errors coming from LXC when starting the container. -It’s extremely rare for anything to end up in there as LXD usually handles errors much before that. - -### CRIU logs (for live migration) - -If you are using CRIU for container live migration or live snapshotting there are additional log files recorded every time a CRIU dump is generated or a dump is restored. - -Those logs can also be found in /var/log/lxd/CONTAINER/ and are timestamped so that you can find whichever matches your most recent attempt. They will contain a detailed record of everything that’s dumped and restored by CRIU and are far better for understanding a failure than the typical migration/snapshot error message. - -### LXD debug messages - -As mentioned above, you can switch the daemon to doing debug logging with the –debug option. -An alternative to that is to connect to the daemon’s event interface which will show you all log entries, regardless of the configured log level (even works remotely). - -An example for “lxc init ubuntu:16.04 xen” would be: -**lxd.log:** - -``` -INFO[02-24|18:14:09] Starting container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 -INFO[02-24|18:14:10] Started container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 -``` - -**lxc monitor –type=logging:** - -``` -metadata: - context: {} - level: dbug - message: 'New events listener: 9b725741-ffe7-4bfc-8d3e-fe620fc6e00a' -timestamp: 2017-02-24T18:14:01.025989062-05:00 -type: logging - -metadata: - context: - ip: '@' - method: GET - url: /1.0 - level: dbug - message: handling -timestamp: 2017-02-24T18:14:09.341283344-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - level: dbug - message: StorageCoreInit -timestamp: 2017-02-24T18:14:09.341536477-05:00 -type: logging - -metadata: - context: - ip: '@' - method: GET - url: /1.0/containers/xen - level: dbug - message: handling -timestamp: 2017-02-24T18:14:09.347709394-05:00 -type: logging - -metadata: - context: - ip: '@' - method: PUT - url: /1.0/containers/xen/state - level: dbug - message: handling -timestamp: 2017-02-24T18:14:09.357046302-05:00 -type: logging - -metadata: - context: {} - level: dbug - message: 'New task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' -timestamp: 2017-02-24T18:14:09.358387853-05:00 -type: logging - -metadata: - context: {} - level: dbug - message: 'Started task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' -timestamp: 2017-02-24T18:14:09.358578599-05:00 -type: logging - -metadata: - context: - ip: '@' - method: GET - url: /1.0/operations/2e2cf904-c4c4-4693-881f-57897d602ad3/wait - level: dbug - message: handling -timestamp: 2017-02-24T18:14:09.366213106-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - level: dbug - message: StoragePoolInit -timestamp: 2017-02-24T18:14:09.369636451-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - level: dbug - message: StoragePoolCheck -timestamp: 2017-02-24T18:14:09.369771164-05:00 -type: logging - -metadata: - context: - container: xen - driver: storage/zfs - level: dbug - message: ContainerMount -timestamp: 2017-02-24T18:14:09.424696767-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - name: xen - level: dbug - message: ContainerUmount -timestamp: 2017-02-24T18:14:09.432723719-05:00 -type: logging - -metadata: - context: - container: xen - driver: storage/zfs - level: dbug - message: ContainerMount -timestamp: 2017-02-24T18:14:09.721067917-05:00 -type: logging - -metadata: - context: - action: start - created: 2017-02-24 23:11:45 +0000 UTC - ephemeral: "false" - name: xen - stateful: "false" - used: 1970-01-01 00:00:00 +0000 UTC - level: info - message: Starting container -timestamp: 2017-02-24T18:14:09.749808518-05:00 -type: logging - -metadata: - context: - ip: '@' - method: GET - url: /1.0 - level: dbug - message: handling -timestamp: 2017-02-24T18:14:09.792551375-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - level: dbug - message: StorageCoreInit -timestamp: 2017-02-24T18:14:09.792961032-05:00 -type: logging - -metadata: - context: - ip: '@' - method: GET - url: /internal/containers/23/onstart - level: dbug - message: handling -timestamp: 2017-02-24T18:14:09.800803501-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - level: dbug - message: StoragePoolInit -timestamp: 2017-02-24T18:14:09.803190248-05:00 -type: logging - -metadata: - context: - driver: storage/zfs - level: dbug - message: StoragePoolCheck -timestamp: 2017-02-24T18:14:09.803251188-05:00 -type: logging - -metadata: - context: - container: xen - driver: storage/zfs - level: dbug - message: ContainerMount -timestamp: 2017-02-24T18:14:09.803306055-05:00 -type: logging - -metadata: - context: {} - level: dbug - message: 'Scheduler: container xen started: re-balancing' -timestamp: 2017-02-24T18:14:09.965080432-05:00 -type: logging - -metadata: - context: - action: start - created: 2017-02-24 23:11:45 +0000 UTC - ephemeral: "false" - name: xen - stateful: "false" - used: 1970-01-01 00:00:00 +0000 UTC - level: info - message: Started container -timestamp: 2017-02-24T18:14:10.162965059-05:00 -type: logging - -metadata: - context: {} - level: dbug - message: 'Success for task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' -timestamp: 2017-02-24T18:14:10.163072893-05:00 -type: logging -``` - -The format from “lxc monitor” is a bit different from what you’d get in a log file where each entry is condense into a single line, but more importantly you see all those “level: dbug” entries - -## Where to report bugs - -### LXD bugs - -The best place to report LXD bugs is upstream at [https://github.com/lxc/lxd/issues][4]. -Make sure to fill in everything in the bug reporting template as that information saves us a lot of back and forth to reproduce your environment. - -### Ubuntu bugs - -If you find a problem with the Ubuntu package itself, failing to install, upgrade or remove. Or run into issues with the LXD init scripts. The best place to report such bugs is on Launchpad. - -On an Ubuntu system, you can do so with: ubuntu-bug lxd -This will automatically include a number of log files and package information for us to look at. - -### CRIU bugs - -Bugs that are related to CRIU which you can spot by the usually pretty visible CRIU error output should be reported on Launchpad with: ubuntu-bug criu - -Do note that the use of CRIU through LXD is considered to be a beta feature and unless you are willing to pay for support through a support contract with Canonical, it may take a while before we get to look at your bug report. - -## Contributing to LXD - -LXD is written in [Go][5] and [hosted on Github][6]. -We welcome external contributions of any size. There is no CLA or similar legal agreement to sign to contribute to LXD, just the usual Developer Certificate of Ownership (Signed-off-by: line). - -We have a number of potential features listed on our issue tracker that can make good starting points for new contributors. It’s usually best to first file an issue before starting to work on code, just so everyone knows that you’re doing that work and so we can give some early feedback. - -### Building LXD from source - -Upstream maintains up to date instructions here: [https://github.com/lxc/lxd#building-from-source][7] - -You’ll want to fork the upstream repository on Github and then push your changes to your branch. We recommend rebasing on upstream LXD daily as we do tend to merge changes pretty regularly. - -### Running the testsuite - -LXD maintains two sets of tests. Unit tests and integration tests. You can run all of them with: - -``` -sudo -E make check -``` - -To run the unit tests only, use: - -``` -sudo -E go test ./... -``` - -To run the integration tests, use: - -``` -cd test -sudo -E ./main.sh -``` - -That latter one supports quite a number of environment variables to test various storage backends, disable network tests, use a ramdisk or just tweak log output. Some of those are: - -* LXD_BACKEND: One of “btrfs”, “dir”, “lvm” or “zfs” (defaults to “dir”) - Lets your run the whole testsuite with any of the LXD storage drivers. -* LXD_CONCURRENT: “true” or “false” (defaults to “false”) - This enables a few extra concurrency tests. -* LXD_DEBUG: “true” or “false” (defaults to “false”) - This will log all shell commands and run all LXD commands in debug mode. -* LXD_INSPECT: “true” or “false” (defaults to “false”) - This will cause the testsuite to hang on failure so you can inspect the environment. -* LXD_LOGS: A directory to dump all LXD log files into (defaults to “”) - The “logs” directory of all spawned LXD daemons will be copied over to this path. -* LXD_OFFLINE: “true” or “false” (defaults to “false”) - Disables any test which relies on outside network connectivity. -* LXD_TEST_IMAGE: path to a LXD image in the unified format (defaults to “”) - Lets you use a custom test image rather than the default minimal busybox image. -* LXD_TMPFS: “true” or “false” (defaults to “false”) - Runs the whole testsuite within a “tmpfs” mount, this can use quite a bit of memory but makes the testsuite significantly faster. -* LXD_VERBOSE: “true” or “false” (defaults to “false”) - A less extreme version of LXD_DEBUG. Shell commands are still logged but –debug isn’t passed to the LXC commands and the LXD daemon only runs with –verbose. - -The testsuite will alert you to any missing dependency before it actually runs. A test run on a reasonably fast machine can be done under 10 minutes. - -### Sending your branch - -Before sending a pull request, you’ll want to confirm that: - -* Your branch has been rebased on the upstream branch -* All your commits messages include the “Signed-off-by: First Last ” line -* You’ve removed any temporary debugging code you may have used -* You’ve squashed related commits together to keep your branch easily reviewable -* The unit and integration tests all pass - -Once that’s all done, open a pull request on Github. Our [Jenkins][8] will validate that the commits are all signed-off, a test build on MacOS and Windows will automatically be performed and if things look good, we’ll trigger a full Jenkins test run that will test your branch on all storage backends, 32bit and 64bit and all the Go versions we care about. - -This typically takes less than an hour to happen, assuming one of us is around to trigger Jenkins. - -Once all the tests are done and we’re happy with the code itself, your branch will be merged into master and your code will be in the next LXD feature release. If the changes are suitable for the LXD stable-2.0 branch, we’ll backport them for you. - -# Conclusion - -I hope this series of blog post has been helpful in understanding what LXD is and what it can do! - -This series’ scope was limited to the LTS version of LXD (2.0.x) but we also do monthly feature releases for those who want the latest features. You can find a few other blog posts covering such features listed in the original [LXD 2.0 series post][9]. - -# Extra information - -The main LXD website is at: [https://linuxcontainers.org/lxd -][10]Development happens on Github at: [https://github.com/lxc/lxd][11] -Mailing-list support happens on: [https://lists.linuxcontainers.org][12] -IRC support happens in: #lxcontainers on irc.freenode.net -Try LXD online: [https://linuxcontainers.org/lxd/try-it][13] - --------------------------------------------------------------------------------- - -via: https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ - -作者:[Stéphane Graber ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://stgraber.org/author/stgraber/ -[1]:https://stgraber.org/author/stgraber/ -[2]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ -[3]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ -[4]:https://github.com/lxc/lxd/issues -[5]:https://golang.org/ -[6]:https://github.com/lxc/lxd -[7]:https://github.com/lxc/lxd#building-from-source -[8]:https://jenkins.linuxcontainers.org/ -[9]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ -[10]:https://linuxcontainers.org/lxd -[11]:https://github.com/lxc/lxd -[12]:https://lists.linuxcontainers.org/ -[13]:https://linuxcontainers.org/lxd/try-it -[14]:https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ diff --git a/translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md b/translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md new file mode 100644 index 0000000000..bcbb5fe9a4 --- /dev/null +++ b/translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md @@ -0,0 +1,394 @@ +LXD 2.0 系列(十二):调试并给 LXD 做贡献 [12/12] + + + ![LXD logo](https://linuxcontainers.org/static/img/containers.png) + +### 介绍 + + +终于要结束了!这个大约一年前开始的[这系列文章][3]的最后一篇博文。 + +如果你从一开始就关注了这个系列,你应该已经使用了 LXD 相当长的时间了,并且非常熟悉它的日常操作和功能。 + +但如果出现问题怎么办?你可以做什么来自己跟踪问题?如果你不能,你应该记录什么信息,以便上游可以跟踪问题? + +如果你想自己解决问题或通过实现你需要的功能来帮助改善LXD怎么办?如何构建,测试和贡献 LXD 代码库? + +## 调试 LXD 并填写 bug 报告 + +### LXD 日志文件 + +#### /var/log/lxd/lxd.log + +这是 LXD 日志的主文件。为了避免快速充满你的磁盘,默认只会记录 INFO、WARNING 或者 ERROR 级别的日志。你可以在 LXD 守护进程中使用 “–debug” 改变行为。 + +#### /var/log/lxd/CONTAINER/lxc.conf + +每当你启动容器时,此文件将使用传递给 LXC 的配置进行更新。下面会展示容器将如何配置,包括其所有的设备,绑定安装等。 + +#### /var/log/lxd/CONTAINER/forkexec.log + +这个文件包含 LXC 命令执行失败时产生的错误。这个情况是非常罕见的,因为 LXD 通常会在发生之前处理错误。 + +#### /var/log/lxd/CONTAINER/forkstart.log + +这个文件包含 LXC 在启动容器时的错误信息。这个情况是非常罕见的,因为 LXD 通常会在发生之前处理错误。 + +### CRIU 日志 (对于实时迁移) + +如果使用 CRIU 进行容器实时迁移或实时快照,则每次生成 CRIU 转储或恢复转储时都会记录额外的日志文件。 + +这些日志也可以在 /var/log/lxd/CONTAINER/ 中找到,并且有时间戳,以便你可以找到与你最近的尝试匹配的那些日志。它们包含 CRIU 转储和恢复的所有内容的详细记录,并且比典型的迁移/快照错误消息更容器理解。 + +### LXD debug messages + +如上所述,你可以使用 -debug 选项将守护进程切换为执行调试日志记录。另一种方法是连接到守护进程的事件接口,它将显示所有日志条目,而不管配置的日志级别(即使是远程工作)。 + +一个例子 “lxc init ubuntu:16.04 xen” 会是: +**lxd.log:** + +``` +INFO[02-24|18:14:09] Starting container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 +INFO[02-24|18:14:10] Started container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 +``` + +**lxc monitor –type=logging:** + +``` +metadata: + context: {} + level: dbug + message: 'New events listener: 9b725741-ffe7-4bfc-8d3e-fe620fc6e00a' +timestamp: 2017-02-24T18:14:01.025989062-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0 + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.341283344-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StorageCoreInit +timestamp: 2017-02-24T18:14:09.341536477-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0/containers/xen + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.347709394-05:00 +type: logging + +metadata: + context: + ip: '@' + method: PUT + url: /1.0/containers/xen/state + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.357046302-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'New task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:09.358387853-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Started task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:09.358578599-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0/operations/2e2cf904-c4c4-4693-881f-57897d602ad3/wait + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.366213106-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolInit +timestamp: 2017-02-24T18:14:09.369636451-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolCheck +timestamp: 2017-02-24T18:14:09.369771164-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.424696767-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + name: xen + level: dbug + message: ContainerUmount +timestamp: 2017-02-24T18:14:09.432723719-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.721067917-05:00 +type: logging + +metadata: + context: + action: start + created: 2017-02-24 23:11:45 +0000 UTC + ephemeral: "false" + name: xen + stateful: "false" + used: 1970-01-01 00:00:00 +0000 UTC + level: info + message: Starting container +timestamp: 2017-02-24T18:14:09.749808518-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /1.0 + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.792551375-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StorageCoreInit +timestamp: 2017-02-24T18:14:09.792961032-05:00 +type: logging + +metadata: + context: + ip: '@' + method: GET + url: /internal/containers/23/onstart + level: dbug + message: handling +timestamp: 2017-02-24T18:14:09.800803501-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolInit +timestamp: 2017-02-24T18:14:09.803190248-05:00 +type: logging + +metadata: + context: + driver: storage/zfs + level: dbug + message: StoragePoolCheck +timestamp: 2017-02-24T18:14:09.803251188-05:00 +type: logging + +metadata: + context: + container: xen + driver: storage/zfs + level: dbug + message: ContainerMount +timestamp: 2017-02-24T18:14:09.803306055-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Scheduler: container xen started: re-balancing' +timestamp: 2017-02-24T18:14:09.965080432-05:00 +type: logging + +metadata: + context: + action: start + created: 2017-02-24 23:11:45 +0000 UTC + ephemeral: "false" + name: xen + stateful: "false" + used: 1970-01-01 00:00:00 +0000 UTC + level: info + message: Started container +timestamp: 2017-02-24T18:14:10.162965059-05:00 +type: logging + +metadata: + context: {} + level: dbug + message: 'Success for task operation: 2e2cf904-c4c4-4693-881f-57897d602ad3' +timestamp: 2017-02-24T18:14:10.163072893-05:00 +type: logging +``` + +“lxc monitor” 的格式有点不同于日志文件中的内容,每个条目都缩合成一行,但更重要的是,你可以看到所有 “level:dbug” 条目。 + +## 如何报告 bug + +### LXD bugs + +最好报告 bug 的地方是 [https://github.com/lxc/lxd/issues][4]。确保完整填写了 bug 报告模板中的内容,这些信息可以节省我们我们时间来复现环境。 + +### Ubuntu bug + +如果你发现 Ubuntu 包本身有问题,无法安装、升级或删除。或者遇到 LXD init 脚本的问题。报告此类错误的最好是在 Launchpad 上。 + +在Ubuntu系统上,你可以使用:ubuntu-bug lxd ,它将自动包括一些日志文件和包信息供我们查看。 + +### CRIU bug + +与 CRIU 相关的Bug,你可以通过 CRIU 的错误输出发现,你应该在 Launchpad 上报告这些:ubuntu-bug criu + +请注意,通过 LXD 使用 CRIU 被认为是测试版功能,除非你愿意通过与 Canonical 的支持合同付费支持,可能需要一段时间才能查看你的错误报告。 + +## 贡献给 LXD + +LXD 用[Go][5] 写成并[托管在 Github][6]。我们欢迎任外部的贡献。为 LXD 贡献不需要 CLA 或类似的法律协议签署,只是通常的开发者所有权证书(Signed-off-by: line)。 + +在我们的问题追踪器工具中,我们有许多潜在的功能,可以为新的贡献者做出良好的起点。通常最好在开始处理代码先提出问题,这样每个人都知道你正在做这项工作,所以我们可以提供一些早期反馈。 + +### 从源码源码构建 LXD + +这里有上流的维护说明:[https://github.com/lxc/lxd#building-from-source][7] + +你需要在 Github 上 fork 上游仓库,然后将你的更改推送到你的分支。我们建议在每天 rebase 上有的 LXD,因为我们倾向于定期合并更改。 + +### 运行测试套件 + +LXD 维护了两套测试。单元测试和集成测试。你可以用下面的命令测试所有: + +``` +sudo -E make check +``` + +要只运行单元测试,使用: + +``` +sudo -E go test ./... +``` + +要运行集成测试,使用: + +``` +cd test +sudo -E ./main.sh +``` + +后者支持相当多的环境变量来测试各种存储后端,禁用网络测试,使用 ramdisk 或只是调整日志输出。其中一些是: + +* LXD_BACKEND:“btrfs”、“dir”、“lvm” 或 “zfs” 之一(默认为“dir”) +  运行 LXD 存储驱动程序相关的所有测试。 +* LXD_CONCURRENT:“true” 或 “false”(默认为 “false”) +  这允许一些额外的并发测试。 +* LXD_DEBUG:“true” 或 “false”(默认为 “false”) +  记录所有 shell 命令,并在调试模式下运行所有​​ LXD 命令。 +* LXD_INSPECT:“true” 或 “false”(默认为 “false”) +  测试程序会在故障时挂起,以便你可以检查环境。 +* LXD_LOGS:将所有 LXD 日志文件转储到的目录(默认为“”) +  所有生成的 LXD 守护进程的 “logs” 目录将被复制到此路径。 +* LXD_OFFLINE:“true” 或 “false”(默认为 “false”) +  禁用任何依赖于外部网络连接的测试。 +* LXD_TEST_IMAGE:以统一格式(默认为“”)的 LXD 镜像的路径 +  可以使用自定义测试镜像,而不是默认的最小 busybox 镜像。 +* LXD_TMPFS:“true” 或 “false”(默认为“false”) +  在 “tmpfs” 安装中运行整个测试套件,这会使用相当多的内存,但会使测试速度明显更快。 +* LXD_VERBOSE:“true” 或 “false”(默认为“false”) +  LXD_DEBUG 不太极端的版本。shell 命令仍然会记录,但 -debug 不会传递给 LXC 命令,LXD 守护进程只能使用 -verbose 运行。 + +测试程序将在实际运行之前提醒你任何丢失的依赖。在相当快的机器上运行测试可在 10 分钟内完成。 + +### 发送你的分支 + +发送 pull 请求之前,你需要确认: + +* 你已经 rebase 了上游分支 +* 你的所有提交信息都包括 “Signed-off-by: First Last ” 这行 +* 已删除任何你的临时调试代码 +* 你已经将相关的提交 squash 在一起,以保持你的分支容易审查 +* 单元和集成测试全部通过 + +一切完成后,在 Github 上发起一个 pull 请求。我们的 [Jenkins][8] 将验证提交是否全部签署,在 MacOS 和 Windows 上的测试将自动执行,如果看起来不错,我们将触发一个完整的 Jenkins 测试,它将测试你的分支所有存储后端、32 位和 64 位以及我们关心的所有 Go 版本。 + +假设我们有一个人要触发 Jenkins,这通常需要不到一个小时的时间。 + +一旦所有测试完成,我们对代码本身感到满意,你的分支将会被合并,你的代码会在下一个 LXD 发布中。如果更改适用于 LXD stable-2.0 分支,我们将为你向后移植。 + +# 总结 + +我希望这个系列的博客文章有助于你了解什么是LXD,以及它可以做什么! + +本系列的范围仅限于 LXD(2.0.x),但我们也为那些想要最新功能的用户提供每月功能版本。你可以找到一些其他涵盖原始[LXD 2.0系列文章][9]中列出的功能的博客文章。 + +# 额外的信息 + +LXD 的主站在: [https://linuxcontainers.org/lxd][10] +LXD 的 GitHub 开发仓库: [https://github.com/lxc/lxd][11] +LXD 的邮件列表: [https://lists.linuxcontainers.org][12] +LXD 的 IRC 频道:#lxcontainers on irc.freenode.net +在线尝试 LXD: [https://linuxcontainers.org/lxd/try-it][13] + +-------------------------------------------------------------------------------- + +via: https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ + +作者:[Stéphane Graber ][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://stgraber.org/author/stgraber/ +[1]:https://stgraber.org/author/stgraber/ +[2]:https://www.stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[3]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[4]:https://github.com/lxc/lxd/issues +[5]:https://golang.org/ +[6]:https://github.com/lxc/lxd +[7]:https://github.com/lxc/lxd#building-from-source +[8]:https://jenkins.linuxcontainers.org/ +[9]:https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/ +[10]:https://linuxcontainers.org/lxd +[11]:https://github.com/lxc/lxd +[12]:https://lists.linuxcontainers.org/ +[13]:https://linuxcontainers.org/lxd/try-it +[14]:https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ From 130cd4f07ee10da5fdeaf5ceb58aaaa7b5db897c Mon Sep 17 00:00:00 2001 From: chenxinlong <237448382@qq.com> Date: Wed, 8 Mar 2017 11:43:54 +0800 Subject: [PATCH 095/190] translating by chenxinlong --- .../tech/20161128 15 JavaScript frameworks and libraries.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20161128 15 JavaScript frameworks and libraries.md b/sources/tech/20161128 15 JavaScript frameworks and libraries.md index 1dcfab3643..aaba6794b4 100644 --- a/sources/tech/20161128 15 JavaScript frameworks and libraries.md +++ b/sources/tech/20161128 15 JavaScript frameworks and libraries.md @@ -1,4 +1,4 @@ -(翻译中 by runningwater) +(翻译中 by chenxinlong) 15 JavaScript frameworks and libraries ============================================================ ![15 JavaScript frameworks and libraries](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/code_javascript.jpg?itok=a4uULCF0 "15 JavaScript frameworks and libraries") @@ -112,7 +112,7 @@ If you have something to add, please comment below and let us know. We are eager via: https://opensource.com/article/16/11/15-javascript-frameworks-libraries 作者:[Dr. Michael J. Garbade ][a] -译者:[runningwater](https://github.com/runningwater) +译者:[chenxinlong](https://github.com/chenxinlong) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cc67445912da183a183024ff9838c3868f0a3190 Mon Sep 17 00:00:00 2001 From: xiaojin Date: Wed, 8 Mar 2017 11:43:57 +0800 Subject: [PATCH 096/190] Update 20170223 How to install Arch Linux on VirtualBox.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 --- sources/tech/20170223 How to install Arch Linux on VirtualBox.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20170223 How to install Arch Linux on VirtualBox.md b/sources/tech/20170223 How to install Arch Linux on VirtualBox.md index dd7b5f2999..c607d1c3d5 100644 --- a/sources/tech/20170223 How to install Arch Linux on VirtualBox.md +++ b/sources/tech/20170223 How to install Arch Linux on VirtualBox.md @@ -1,3 +1,4 @@ +# rusking translating How to install Arch Linux on VirtualBox ============================================================ From a8fd838e9a07188e8d1034c95659ed3e5097d7de Mon Sep 17 00:00:00 2001 From: woniu <18810913096@163.com> Date: Wed, 8 Mar 2017 20:32:18 +0800 Subject: [PATCH 097/190] Delete 20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md --- ...cure FTP Server using SSL-TLS on Ubuntu.md | 243 ------------------ 1 file changed, 243 deletions(-) delete mode 100644 sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md diff --git a/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md b/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md deleted file mode 100644 index 70fef0c365..0000000000 --- a/sources/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md +++ /dev/null @@ -1,243 +0,0 @@ -translating by DockerChen - -Setting Up a Secure FTP Server using SSL/TLS on Ubuntu -============================================================ - - Download Your Free eBooks NOW - [10 Free Linux eBooks for Administrators][13] | [4 Free Shell Scripting eBooks][14] - -In this tutorial, we will describe how to secure a FTP server (VSFTPD stands for “Very Secure FTP Daemon”) using SSL/TLS in Ubuntu 16.04/16.10. - -If you’re looking to setup a secure FTP server for CentOS based distributions, you can read – [Secure an FTP Server Using SSL/TLS on CentOS][2] - -After following the various steps in this guide, we will have learned the fundamentals of enabling encryption services in a FTP server for secure data transfers is crucial. - -#### Requirements - -1. You must [Install and Configure a FTP Server in Ubuntu][1] - -Before we move further, make sure that all commands in this article will be run as root or [sudo privileged account][3]. - -### Step 1: Generating SSL/TLS Certificate for FTP on Ubuntu - -1. We will begin by creating a subdirectory under: /etc/ssl/ to store the SSL/TLS certificate and key files if it doesn’t exist: - -``` -$ sudo mkdir /etc/ssl/private -``` - -2. Now let’s generate the certificate and key in a single file, by running the command below. - -``` -$ sudo openssl req -x509 -nodes -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -days 365 -newkey rsa:2048 -``` - -The above command will prompt you to answer the questions below, don’t forget to enter values that applicable to your scenario. - -``` -Country Name (2 letter code) [XX]:IN -State or Province Name (full name) []:Lower Parel -Locality Name (eg, city) [Default City]:Mumbai -Organization Name (eg, company) [Default Company Ltd]:TecMint.com -Organizational Unit Name (eg, section) []:Linux and Open Source -Common Name (eg, your name or your server's hostname) []:tecmint -Email Address []:admin@tecmint.com -``` - -### Step 2: Configuring VSFTPD to Use SSL/TLS on Ubuntu - -3. Before we perform any VSFTPD configurations, for those who have [UFW firewall enabled][4], you have to open the ports 990 and 40000-50000 to allow TLS connections and the port range of passive ports to set in the VSFTPD configuration file respectively: - -``` -$ sudo ufw allow 990/tcp -$ sudo ufw allow 40000:50000/tcp -$ sudo ufw status -``` - -4. Now, open the VSFTPD config file and define the SSL details in it: - -``` -$ sudo vi /etc/vsftpd/vsftpd.conf -OR -$ sudo nano /etc/vsftpd/vsftpd.conf -``` - -Then, add or locate the option `ssl_enable` and set its value to YES to activate the use of SSL, again, because TLS is more secure than SSL, we will restrict VSFTPD to use TLS instead, by enabling the `ssl_tlsv1` option: - -``` -ssl_enable=YES -ssl_tlsv1=YES -ssl_sslv2=NO -ssl_sslv3=NO -``` - -5. Next, comment out the lines below using the `#` character as follows: - -``` -#rsa_cert_file=/etc/ssl/private/ssl-cert-snakeoil.pem -#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key -``` - -Afterwards, add the lines below to define the location of the SSL certificate and key file: - -``` -rsa_cert_file=/etc/ssl/private/vsftpd.pem -rsa_private_key_file=/etc/ssl/private/vsftpd.pem -``` - -6. Now, we also have to prevent anonymous users from using SSL, then force all non-anonymous logins to use a secure SSL connection for data transfer and to send the password during login: - -``` -allow_anon_ssl=NO -force_local_data_ssl=YES -force_local_logins_ssl=YES -``` - -7. Furthermore, we can use the options below to add more security features in the FTP server. With option `require_ssl_reuse=YES`, all SSL data connections are required to exhibit SSL session reuse; proving that they know the same master secret as the control channel. So, we should disable it. - -``` -require_ssl_reuse=NO -``` - -In addition, we can set which SSL ciphers VSFTPD will permit for encrypted SSL connections with the `ssl_ciphers` option. This will help frustrate any efforts by attackers who try to force a specific cipher which they possibly discovered vulnerabilities in: - -``` -ssl_ciphers=HIGH -``` - -8. Then, let’s define the port range (min and max port) of passive ports. - -``` -pasv_min_port=40000 -pasv_max_port=50000 -``` - -9. To enable SSL debugging, meaning openSSL connection diagnostics are recorded to the VSFTPD log file, we can use the `debug_ssl` option: - -``` -debug_ssl=YES -``` - -Finally save the file and close it. Then restart VSFTPD service: - -``` -$ systemctl restart vsftpd -``` - -### Step 3: Verify FTP with SSL/TLS Connections on Ubuntu - -10. After performing all the above configurations, test if VSFTPD is now using SSL/TLS connections by trying to [use FTP from the command line][5] as below. - -From the output below, there is an error message telling us VSFTPD can only permit users (non-anonymous) to login from secure clients which support encryption services. - -``` -$ ftp 192.168.56.10 -Connected to 192.168.56.10 (192.168.56.10). -220 Welcome to TecMint.com FTP service. -Name (192.168.56.10:root) : ravi -530 Non-anonymous sessions must use encryption. -Login failed. -421 Service not available, remote server has closed connection -ftp> -``` - -The command line doesn’t support encryption services thus resulting to the error above. Therefore, to securely connect to a FTP server with encryption services enabled, we need a FTP client that supports SSL/TLS connections by default, such as FileZilla. - -### Step 4:Install FileZilla On Clients to Connect FTP Securely - -FileZilla is a powerful, widely used cross-platform FTP client which supports FTP over SSL/TLS and more. To install FileZilla on a Linux client machine, use the following command. - -``` ---------- On Debian/Ubuntu --------- -$ sudo apt-get install filezilla ---------- On CentOS/RHEL/Fedora --------- -# yum install epel-release filezilla ---------- On Fedora 22+ --------- -$ sudo dnf install filezilla -``` - -12. Once the installation completes, open it and go to File=>Sites Manager or (press Ctrl+S) to get the Site Manager interface below. - -[ - ![Filezilla Site Manager](http://www.tecmint.com/wp-content/uploads/2017/02/Filezilla-Site-Manager.png) -][6] - -Filezilla Site Manager - -13. Now, define the host/site name, add the IP address, define the protocol to use, encryption and logon type as in the screen shot below (use values that apply to your scenario): - -Click on New Site button to configure a new site/host connection. - -``` -Host: 192.168.56.10 -Protocol: FTP – File Transfer Protocol -Encryption: Require explicit FTP over #recommended -Logon Type: Ask for password #recommended -User: username -``` -[ - ![Configure New FTP Site on Filezilla](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-New-FTP-Site-on-Filezilla.png) -][7] - -Configure New FTP Site on Filezilla - -14. Then click on Connect from the interface above to enter the password, and then verify the certificate being used for the SSL/TLS connection, and click OK once more to connect to the FTP server: - -[ - ![Verify FTP SSL Certificate](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-SSL-Certificate-1.png) -][8] - -Verify FTP SSL Certificate - -15. Now, you should have logged successfully into the FTP server over a TLS connection, check the connection status section for more information from the interface below. - -[ - ![Connected to Ubuntu FTP Server](http://www.tecmint.com/wp-content/uploads/2017/02/Connected-Ubuntu-FTP-Server.png) -][9] - -Connected to Ubuntu FTP Server - -16. Lastly, let’s [transfer files from the local machine to the FTP sever][10] in the files folder, take a look at the lower end of the FileZilla interface to view reports concerning file transfers. - -[ - ![Secure FTP File Transfer using Filezilla](http://www.tecmint.com/wp-content/uploads/2017/02/Transfer-Files-Securely-using-FTP.png) -][11] - -Secure FTP File Transfer using Filezilla - -That’s all! Always remember that installing a FTP server without enabling encryption services has certain security implications. As we explained in this tutorial, you can configure a FTP server to use SSL/TLS connections to implement security in Ubuntu 16.04/16.10. - -If you face any issues in setting up SSL/TLS on FTP server, do use the comment form below to share your problems or thoughts concerning this tutorial/topic. - --------------------------------------------------------------------------------- - - -作者简介: - -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: http://www.tecmint.com/secure-ftp-server-using-ssl-tls-on-ubuntu/ - -作者:[Aaron Kili][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/aaronkili/ - -[1]:http://www.tecmint.com/install-ftp-server-in-ubuntu/ -[2]:http://www.tecmint.com/axel-commandline-download-accelerator-for-linux/ -[3]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ -[4]:http://www.tecmint.com/how-to-install-and-configure-ufw-firewall/ -[5]:http://www.tecmint.com/sftp-command-examples/ -[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Filezilla-Site-Manager.png -[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-New-FTP-Site-on-Filezilla.png -[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-SSL-Certificate-1.png -[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Connected-Ubuntu-FTP-Server.png -[10]:http://www.tecmint.com/sftp-command-examples/ -[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Transfer-Files-Securely-using-FTP.png -[12]:http://www.tecmint.com/author/aaronkili/ -[13]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ -[14]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 97a4add4179c0ab688a48519fcdc04b93c147e66 Mon Sep 17 00:00:00 2001 From: woniu <18810913096@163.com> Date: Wed, 8 Mar 2017 20:33:43 +0800 Subject: [PATCH 098/190] 20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md translated by DockerChen --- ...cure FTP Server using SSL-TLS on Ubuntu.md | 244 ++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 translated/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md diff --git a/translated/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md b/translated/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md new file mode 100644 index 0000000000..294c51997d --- /dev/null +++ b/translated/tech/20170224 Setting Up a Secure FTP Server using SSL-TLS on Ubuntu.md @@ -0,0 +1,244 @@ + + +UbuntuʹSSL/TLSһȫFTP +============================================================ + + ѵ - [10ѵLinuxԱ][13] | [4ѵshellű][14] + +ڱ̳УǽʹUbuntu 16.04 / 16.10еSSL / TLSFTPVSFTPDdzȫFTPػ̡ + +ΪCentOSķа氲װһȫFTPĶ C [CentOSʹSSL / TLSFTP][2] + +ѭָеĸ֮ǽ˽FTPüܷĻԭȷȫݴҪ + + +####Ҫ + +1. [UbuntuϰװһFTP][1] + +ǽһ֮ǰȷеrootл +Before we move further, make sure that all commands in this article will be run as root or [sudoȨ˺][3]. + +### һUbuntuΪFTPSSL/TLS֤ +1.ǽ/etc/ssl/´һĿ¼洢SSL/TLS֤Կļڣ + +``` +$ sudo mkdir /etc/ssl/private +``` + +2. һļ֤Կͨ + +``` +$ sudo openssl req -x509 -nodes -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem -days 365 -newkey rsa:2048 +``` + +ʾش⣬Ҫڽűֵ +``` +Country Name (2 letter code) [XX]:IN +State or Province Name (full name) []:Lower Parel +Locality Name (eg, city) [Default City]:Mumbai +Organization Name (eg, company) [Default Company Ltd]:TecMint.com +Organizational Unit Name (eg, section) []:Linux and Open Source +Common Name (eg, your name or your server's hostname) []:tecmint +Email Address []:admin@tecmint.com +``` + +### ڶUbuntuVSFTPDʹSSL/TLS + +3.ǽVSFTPD֮ǰ[UFWǽ][4]ûDZ򿪶˿99040000-50000VSFTDļзֱTLSӺͱ˿ڵĶ˿ڷΧ +``` +$ sudo ufw allow 990/tcp +$ sudo ufw allow 40000:50000/tcp +$ sudo ufw status +``` + +4. ڣVSFTPDļSSLϸϢ + +``` +$ sudo vi /etc/vsftpd/vsftpd.conf +OR +$ sudo nano /etc/vsftpd/vsftpd.conf +``` + +Ȼӻλѡ`ssl_enable`ֵΪYESSSLʹãͬΪTLSSSLȫǽͨ`ssl_tlsv1`ѡVSFTPDʹTLS + + +``` +ssl_enable=YES +ssl_tlsv1=YES +ssl_sslv2=NO +ssl_sslv3=NO +``` + +5. ʹ``ַע͵Уʾ + +``` +#rsa_cert_file=/etc/ssl/private/ssl-cert-snakeoil.pem +#rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key +``` + +ȻԶSSL֤Կļλã + +``` +rsa_cert_file=/etc/ssl/private/vsftpd.pem +rsa_private_key_file=/etc/ssl/private/vsftpd.pem +``` + +6.ڣҲֹûʹSSL½ʹеķ½ʹһȫSSLݣڵ½ڼ䷢룺 + +``` +allow_anon_ssl=NO +force_local_data_ssl=YES +force_local_logins_ssl=YES +``` + +7.⣬ǿʹѡFTPӸİȫ ʹѡ`require_ssl_reuse=YES`õSSLӶҪչʾSSLỰã֤֪ͿŵͬܡԣӦý + + +``` +require_ssl_reuse=NO +``` + +⣬ǿVSFTPDʹ`ssl_ciphers`ѡмSSLӵSSL롣 ⽫ڴܹߵκŬǿƵõһض룬ֵ© + +``` +ssl_ciphers=HIGH +``` + + +8. ȻǶ屻˿ڵĶ˿ڷΧС˿ڣ + +``` +pasv_min_port=40000 +pasv_max_port=50000 +``` + +9. ҪSSLԣζopenSSLϼ¼VSFTPD־ļǿʹ`debug_ssl`ѡ +``` +debug_ssl=YES +``` + +󣬱ļҹرȻVSFTPD + +``` +$ systemctl restart vsftpd +``` + +### UbuntuʹSSL / TLS֤FTP + +10. ִúͨ[ʹеFTP] [5]VSFTPDǷʹSSL / TLSӣʾ + +һϢVSFTPDûûּ֧ܷİȫͻ˵½ + + +``` +$ ftp 192.168.56.10 +Connected to 192.168.56.10 (192.168.56.10). +220 Welcome to TecMint.com FTP service. +Name (192.168.56.10:root) : ravi +530 Non-anonymous sessions must use encryption. +Login failed. +421 Service not available, remote server has closed connection +ftp> +``` + +вּ֧ܷӶˣҪȫӵ˼ܷFTPҪһĬ֧SSL/TLSӵFTPͻˣFileZilla + +### IJڿͻϰװFileZillaStepȫFTP + +FileZillaһǿģ㷺ʹõĿƽ̨FTPͻˣ֧SSL/TLSϵFTPΪLinuxͻ˻ϰװFileZillaʹ + +``` +--------- On Debian/Ubuntu --------- +$ sudo apt-get install filezilla +--------- On CentOS/RHEL/Fedora --------- +# yum install epel-release filezilla +--------- On Fedora 22+ --------- +$ sudo dnf install filezilla +``` + +12. һװɣȻFile=>Sites ManagerߣCtrl+SȡSite Manager + +[ + ![Filezilla Site Manager](http://www.tecmint.com/wp-content/uploads/2017/02/Filezilla-Site-Manager.png) +][6] + +Filezilla Site Manager + +13. ڣ/վ֣IPַʹõЭ飬ܺ͵½ͣĻʹ㷽ֵ + +New Siteťһµվ/ӡ + +``` +Host: 192.168.56.10 +Protocol: FTP C File Transfer Protocol +Encryption: Require explicit FTP over #recommended +Logon Type: Ask for password #recommended +User: username +``` +[ + ![FilezillaµFTPվ](http://www.tecmint.com/wp-content/uploads/2017/02/Configure-New-FTP-Site-on-Filezilla.png) +][7] + +FilezillaµFTPվ + +14. ȻĽ浥룬Ȼ֤SSL / TLSӵ֤飬ٴεȷӵFTP +[ + ![֤FTPSSL֤](http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-SSL-Certificate-1.png) +][8] + +֤FTPSSL֤ + +15.ڣӦͨTLSӳɹص½FTP״̬֣ȡйӿڵĸϢ + +[ + ![UbuntuFTP](http://www.tecmint.com/wp-content/uploads/2017/02/Connected-Ubuntu-FTP-Server.png) +][9] + +UbuntuFTP + +16. [ӱصĻļFTP][10]ļ, 鿴FileZillaӿڵ¶鿴йļı档 + +[ + ![ʹFilezillaȫĴFTPļ](http://www.tecmint.com/wp-content/uploads/2017/02/Transfer-Files-Securely-using-FTP.png) +][11] + +ʹFilezillaȫĴFTPļ + + ʼռסװFTPüܷijЩȫ ڱ̳н͵ģFTPʹSSL / TLSʵUbuntu 16.04 / 16.10еİȫԡ + +FTPSSL/TLSκ⣬ʹעͱԱ̳/뷨 + +-------------------------------------------------------------------------------- + + +߼飺 + +Aaron KiliLinuxF.O.S.SߣƳLinux SysAdmin翪ԱĿǰTecMintݴߣϲԺŷ֪ʶ + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/secure-ftp-server-using-ssl-tls-on-ubuntu/ + +ߣ[Aaron Kili][a] +ߣ[ID](https://github.com/DockerChen) +Уԣ[УID](https://github.com/УID) + + [LCTT](https://github.com/LCTT/TranslateProject) ԭ룬[Linuxй](https://linux.cn/) Ƴ + +[a]:http://www.tecmint.com/author/aaronkili/ + +[1]:http://www.tecmint.com/install-ftp-server-in-ubuntu/ +[2]:http://www.tecmint.com/axel-commandline-download-accelerator-for-linux/ +[3]:http://www.tecmint.com/sudoers-configurations-for-setting-sudo-in-linux/ +[4]:http://www.tecmint.com/how-to-install-and-configure-ufw-firewall/ +[5]:http://www.tecmint.com/sftp-command-examples/ +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Filezilla-Site-Manager.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-New-FTP-Site-on-Filezilla.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Verify-FTP-SSL-Certificate-1.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Connected-Ubuntu-FTP-Server.png +[10]:http://www.tecmint.com/sftp-command-examples/ +[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Transfer-Files-Securely-using-FTP.png +[12]:http://www.tecmint.com/author/aaronkili/ +[13]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[14]:http://www.tecmint.com/free-linux-shell-scripting-books/ \ No newline at end of file From 43c894c39d21ec3f473e46847f7363fecd18b4fe Mon Sep 17 00:00:00 2001 From: Stdio A Date: Wed, 8 Mar 2017 21:00:47 +0800 Subject: [PATCH 099/190] Translated 20170307 How to make release notes count --- ...0170307 How to make release notes count.md | 60 ------------------ ...0170307 How to make release notes count.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20170307 How to make release notes count.md create mode 100644 translated/tech/20170307 How to make release notes count.md diff --git a/sources/tech/20170307 How to make release notes count.md b/sources/tech/20170307 How to make release notes count.md deleted file mode 100644 index 88f9127350..0000000000 --- a/sources/tech/20170307 How to make release notes count.md +++ /dev/null @@ -1,60 +0,0 @@ -StdioA translating - -How to make release notes count -============================================================ - - ![How to make release notes count](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/rh_003784_02_os.comcareers_resume_rh1x.png?itok=CK6VJq5w "How to make release notes count") ->Image by : opensource.com - -Congratulations! You're ready to ship the latest release of your software package. Now you need to make sure your release notes are in order. Sure, you could just slap "bug fixes and performance improvements" on the box and call it a day, but that doesn't really tell your users anything. - -Release notes are for both support and marketing. They tell your current users why this new release is important to them and showcase your software to potential users. Thus, you want to make the content clear, understandable, and most importantly, relevant. There's no one way to write release notes, so this is general advice, not an edict. - -One popular trend is to make the release notes a narrative that includes a lot of silliness. If that's your thing, go for it—just remember that jokes are often context-sensitive, and what you think is hilarious might be totally lost on your readers. And, of course, you can't forget to include the important information. - -### Getting started - -Perhaps the single most important takeaway from this article is to write your release notes for the people who will read them. For user-facing software, focus on the user-facing behavior instead of the internal implementation. For example, say, "Clicking the 'Cancel' button will light your computer on fire," instead of "thermalEventTrigger defaulted to True in the cancelThatThing function." - -Try to limit each note to a sentence or two. The point is to highlight the important part, not give a detailed explanation. If you have a public issue tracker, include a link (or at least an issue number) where readers can go find details if they're so inclined. - -You don't have to lay out your release notes this way, but I like the following format. Start with the version number and release date. For major releases, you might also include a few sentences to highlight the major theme. For example, "This release focuses on adding an email client, because that's the eventual end state of all software." - -### Compatibility changes - -If the new release introduces changes in compatibility or default behavior, highlight those explicitly. Your users will thank you, as will anyone who provides user support. Describe the cases where the behavior change will be encountered, how to address the change, and what happens if the user doesn't act on the change. For minor releases, you probably don't have any incompatible changes, so you can leave out this section. - -### Features and enhancements - -Now is the time to brag about all of the cool, new stuff your software does, but remember to focus on the user's perspective. For example, "The software now supports the automatic detection of pictures of lunch and posts them to Instagram." - -### Issues resolved - -No software is perfect, and this is the section where you tell readers about all of the hard work your team did to make the project a little better. Write these notes in the past tense, because the bad behavior is dead and gone. If it's clear where the bug was introduced, include that information. Some projects include bugs in the documentation in this section as well. - -### Known issues - -Because no software is perfect, there are always bugs left unsquashed. This section is the place to list those. You don't have to confess everything; focus on the bugs that impact functionality, especially if they were discovered since the last release. Write these in the future tense, and when you've addressed it, you just have to change the verb tense and it's ready to move up a section. - --------------------------------------------------------------------------------- - -作者简介: - -Ben Cotton - Ben Cotton is a meteorologist by training and a high-performance computing engineer by trade. Ben works as a technical evangelist at Cycle Computing. He is a Fedora user and contributor, co-founded a local open source meetup group, and is a member of the Open Source Initiative and a supporter of Software Freedom Conservancy. Find him on Twitter (@FunnelFiasco) - - --------------- - -via: https://opensource.com/article/17/3/how-to-improve-release-notes - -作者:[Ben Cotton][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/bcotton -[1]:https://opensource.com/article/17/3/how-to-improve-release-notes?rate=81ry_1MGfmsPXV6_y_4St2DQI4XyJAqIzs4yTNtUrpA -[2]:https://opensource.com/user/30131/feed -[3]:https://opensource.com/article/17/3/how-to-improve-release-notes#comments -[4]:https://opensource.com/users/bcotton diff --git a/translated/tech/20170307 How to make release notes count.md b/translated/tech/20170307 How to make release notes count.md new file mode 100644 index 0000000000..0a29f416c7 --- /dev/null +++ b/translated/tech/20170307 How to make release notes count.md @@ -0,0 +1,63 @@ +如何写出绝佳的发行说明 +============================================================ + + ![如何写出绝佳的发行说明](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/rh_003784_02_os.comcareers_resume_rh1x.png?itok=CK6VJq5w "How to make release notes count") +>图像来源: opensource.com + +恭喜!你已经准备发布你的软件包的最新版本了。现在,你需要保证你的发行说明整洁有序。当然,你可以写上“bug 修复以及性能改进”然后就算完成,但这并不能给你的用户传达任何信息。 + +发行说明同时用于支持和营销。它可以告诉你的的用户为什么这个发布版本对他们很重要,并可以向潜在用户展示你的软件。所以,你会希望它的内容简洁、易懂,最重要的是:确切。写发行说明的方式不止一种,所以本文只是一般提议,并不是一个命令。 + +人们在发行说明中写上一大段饱含愚蠢的叙事内容。如果你想这么写,那请自便——不过要记住,笑话通常是上下文相关的,你觉得很滑稽的内容,可能在你的读者眼里会变得索然无味。而且,你不能忘了写那些重要信息。 + +### 入门 + +你能从本文里学到的最简单的经验,可能是这一条:你的发行说明要写给读它的人看。对于面向用户的软件,发行说明中要注重面向用户的行为,而不是软件的内部实现。举个例子:写“点击‘取消’按钮会把你的电脑点着”,而不要写“在 cancelThatThing 函数中,thermalEventTrigger 的默认值被设为 True”。 + +尝试将每一条说明限制在一到两句话。发行说明的重点在于突出强调重要部分,而不是给出详尽的解释。如果你有一个公开的问题追踪页面,你可以在说明中包含问题链接(或者问题编号),这样关注此问题的读者可以通过链接来查看问题的详细内容。 + +你并不需要严格按照这种方法来写发行说明,但我比较喜欢下面的格式。开头写上版本号,以及发布日期。对于主要版本,你可能要再写几句话,来突出本次发布的主题。比如,“本次发布的重点在于添加了邮件客户端,因为这是所有软件的最终结束状态。” + +### 兼容性更改 + +如果新版本中包含兼容性更改或默认行为,你最好将它们着重写出。你的用户、以及提供用户支持的人会感谢你的。在发行说明中描述出现更改的地方,如何实施更改,以及用户不执行更改会导致的后果。对于某些次要版本,你可能没有做出任何会导致不兼容的更改,那你可以省略此部分。 + +### 功能及改进 +" +现在,你该炫耀你的软件包含的那些酷的、新奇的东西了,但是要记得站在用户的角度来写。比如,“该软件现在支持自动检测午餐照片,并将其发布到 Instagram 上。” + +### 已解决的问题 + +没有软件是完美的,所以在这部分中你需要告诉读者们你的团队为了使这个项目更好一点而做的所有努力工作。因为那些不好的行为已经被解决了,所以应该用过去式来写这一部分。如果某个 bug 的定位很明确,那应该在这部分中写上相关信息。其它的一些项目可能也会包含这一节中所述的 bug. + +### 已知问题 + +因为没有软件是完美的,所以永远会存在未解决的 bug. 在这一节中,你需要列出这些已知的问题。你不需要解决所有的问题;专注于影响功能的错误,如果这些是在上个版本发布后发现的,你可能需要优先解决。这一部分的文字用将来时完成。当你把这些问题解决,你只需要改变动词的时态,然后把它们移到上个部分即可。 + +-------------------------------------------------------------------------------- + +作者简介: + +Ben Cotten - Ben Cotten 是一个受过专业训练的气象学家,但他现在是一位高性能计算工程师。Ben 是一位循环计算领域的布道者。它是一个 Fedora 用户及贡献者,与他人一同创办了一个本地开源会议组,是开源计划的成员,还是软件自由保护的支持者。你可以在 Twitter 上找到他(@FunnelFiasco)。 + +-------------- + +译者简介: + +[StdioA](https://www.stdioa.com/) —— Pythoner, Player. + +-------------- + +via: https://opensource.com/article/17/3/how-to-improve-release-notes + +作者:[Ben Cotton][a] +译者:[StdioA](https://github.com/StdioA) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/bcotton +[1]:https://opensource.com/article/17/3/how-to-improve-release-notes?rate=81ry_1MGfmsPXV6_y_4St2DQI4XyJAqIzs4yTNtUrpA +[2]:https://opensource.com/user/30131/feed +[3]:https://opensource.com/article/17/3/how-to-improve-release-notes#comments +[4]:https://opensource.com/users/bcotton From efd2e4b01b0438ba2147026c5c4b2474874ebc9e Mon Sep 17 00:00:00 2001 From: xiaojin Date: Wed, 8 Mar 2017 22:50:38 +0800 Subject: [PATCH 100/190] =?UTF-8?q?Delete=2020170222=20Create=20a=20Shared?= =?UTF-8?q?=20Directory=20on=20Samba=20AD=20DC=20and=20Map=20to=20WindowsL?= =?UTF-8?q?inux=20Clients=20=E2=80=93=20Part=207.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成,删除原文。 --- ...nd Map to WindowsLinux Clients – Part 7.md | 267 ------------------ 1 file changed, 267 deletions(-) delete mode 100644 sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md diff --git a/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md b/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md deleted file mode 100644 index a3efebdfc6..0000000000 --- a/sources/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md +++ /dev/null @@ -1,267 +0,0 @@ -#rusking translating -Create a Shared Directory on Samba AD DC and Map to Windows/Linux Clients – Part 7 -============================================================ - - -This tutorial will guide you on how to create a shared directory on Samba AD DC system, map this Shared Volume to Windows clients integrated into the domain via GPO and manage share permissions from Windows domain controller perspective. - -It will also cover how to access and mount the file share from a Linux machine enrolled into domain using a Samba4 domain account. - -#### Requirements: - -1. [Create an Active Directory Infrastructure with Samba4 on Ubuntu][1] - -### Step 1: Create Samba File Share - -1. The process of creating a share on Samba AD DC is a very simple task. First create a directory you want to share via SMB protocol and add the below permissions on the filesystem in order to allow a Windows AD DC admin acount to modify the share permissions accordingly to what permissions Windows clients should see. - -Assuming that the new file share on the AD DC would be the `/nas` directory, run the below commands to assign the correct permissions. - -``` -# mkdir /nas -# chmod -R 775 /nas -# chown -R root:"domain users" /nas -# ls -alh | grep nas -``` -[ - ![Create Samba Shared Directory](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][2] - -Create Samba Shared Directory - -2. After you’ve created the directory that will be exported as a share from Samba4 AD DC, you need to add the following statements to samba configuration file in order to make the share available via SMB protocol. - -``` -# nano /etc/samba/smb.conf -``` - -Go to the bottom of the file and add the following lines: - -``` -[nas] -path = /nas -read only = no -``` -[ - ![Configure Samba Shared Directory](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][3] - -Configure Samba Shared Directory - -3. The last thing you need to do is to restart Samba AD DC daemon in order to apply the changes by issuing the below command: - -``` -# systemctl restart samba-ad-dc.service -``` - -### Step 2: Manage Samba Share Permissions - -4. Since we’re accessing this shared volume from Windows, using domain accounts (users and groups) that are created on Samba AD DC (the share is not meant to be accessed by Linux system users). - -The process of managing permissions can be done directly from Windows Explorer, in the same way permissions are managed for any folder in Windows Explorer. - -First, log on to Windows machine with a Samba4 AD account with administrative privileges on the domain. In order to access the share from Windows and set the permissions, type the IP address or host name or FQDN of the Samba AD DC machine in Windows Explorer path field, preceded by two back slashes, and the share should be visible. - -``` -\\adc1 -Or -\\192.168.1.254 -Or -\\adc1.tecmint.lan -``` -[ - ![Access Samba Share Directory from Windows](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][4] - -Access Samba Share Directory from Windows - -5. To modify permissions just right click on the share and choose Properties. Navigate to Security tab and proceed with altering domain users and group permissions accordingly. Use Advanced button in order to fine tune permissions. - -[ - ![Configure Samba Share Directory Permissions](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][5] - -Configure Samba Share Directory Permissions - -Use the below screenshot as an excerpt on how to tune permissions for specific Samba AD DC authenticated accounts. - -[ - ![Manage Samba Share Directory User Permissions](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][6] - -Manage Samba Share Directory User Permissions - -6. Other method you can use to manage the share permissions is from Computer Management -> Connect to another computer. - -Navigate to Shares, right click on the share you want to modify permissions, choose Properties and move to Security tab. From here you can alter permissions in any way you want just as presented in the previous method using file share permissions. - -[ - ![Connect to Samba Share Directory Machine](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][7] - -Connect to Samba Share Directory Machine - -[ - ![Manage Samba Share Directory Properties](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][8] - -Manage Samba Share Directory Properties - -[ - ![Assign Samba Share Directory Permissions to Users](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][9] - -Assign Samba Share Directory Permissions to Users - -### Step 3: Map the Samba File Share via GPO - -7. To automatically mount the exported samba file share via domain Group Policy, first on a machine with [RSAT tools installed][10], open AD UC utility, right click on your domain name and, then, choose New -> Shared Folder. - -[ - ![Map Samba Share Folder](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][11] - -Map Samba Share Folder - -8. Add a name for the shared volume and enter the network path where your share is located as illustrated on the below image. Hit OK when you’ve finished and the share should now be visible on the right plane. - -[ - ![Set Samba Shared Folder Name Location](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][12] - -Set Samba Shared Folder Name Location - -9. Next, open Group Policy Management console, expand to your domain Default Domain Policy script and open the file for editing. - -On the GPM Editor navigate to User Configuration -> Preferences -> Windows Settings and right click on Drive Maps and choose New -> Mapped Drive. - -[ - ![Map Samba Share Folder in Windows](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][13] - -Map Samba Share Folder in Windows - -10. On the new window search and add the network location for the share by pressing the right button with three dots, check Reconnect checkbox, add a label for this share, choose the letter for this drive and hit OK button to save and apply configuration. - -[ - ![Configure Network Location for Samba Share Directory](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][14] - -Configure Network Location for Samba Share Directory - -11. Finally, in order to force and apply GPO changes on your local machine without a system restart, open a Command Prompt and run the following command. - -``` -gpupdate /force -``` -[ - ![Apply GPO Changes](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][15] - -Apply GPO Changes - -12. After the policy has been successfully applied on your machine, open Windows Explorer and the shared network volume should be visible and accessible, depending on what permissions you’ve granted for the share on previous steps. - -The share will be visible for other clients on your network after they reboot or re-login onto their systems if the group policy will not forced from command line. - -[ - ![Samba Shared Network Volume on Windows](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][16] - -Samba Shared Network Volume on Windows - -### Step 4: Access the Samba Shared Volume from Linux Clients - -13. Linux users from machines that are enrolled into Samba AD DC can also access or mount the share locally by authenticating into the system with a Samba account. - -First, they need to assure that the following samba clients and utilities are installed on their systems by issuing the below command. - -``` -$ sudo apt-get install smbclient cifs-utils -``` - -14. In order to list the exported shares your domain provides for a specific domain controller machine use the below command: - -``` -$ smbclient –L your_domain_controller –U% -or -$ smbclient –L \\adc1 –U% -``` -[ - ![List Samba Share Directory in Linux](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][17] - -List Samba Share Directory in Linux - -15. To interactively connect to a samba share from command line with a domain account use the following command: - -``` -$ sudo smbclient //adc/share_name -U domain_user -``` - -On command line you can list the content of the share, download or upload files to the share or perform other tasks. Use ? to list all available smbclient commands. - -[ - ![Connect Samba Share Directory in Linux](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][18] - -Connect Samba Share Directory in Linux - -16. To mount a samba share on a Linux machine use the below command. - -``` -$ sudo mount //adc/share_name /mnt -o username=domain_user -``` -[ - ![Mount Samba Share Directory in Linux](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) -][19] - -Mount Samba Share Directory in Linux - -Replace the host, share name, mount point and domain user accordingly. Use mount command piped with grep to filter only by cifs expression. - -As some final conclusions, shares configured on a Samba4 AD DC will work only with Windows access control lists (ACL), not POSIX ACLs. - -Configure Samba as a Domain member with file shares in order to achieve other capabilities for a network share. Also, on an Additional Domain Controller [configure Windbindd daemon][20] – Step Two – before you start exporting network shares. - --------------------------------------------------------------------------------- - -作者简介: - -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]:http://www.tecmint.com/author/cezarmatei/ - -[1]:http://www.tecmint.com/install-samba4-active-directory-ubuntu/ -[2]:http://www.tecmint.com/wp-content/uploads/2017/02/Create-Samba-Shared-Directory.png -[3]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Samba-Shared-Directory.png -[4]:http://www.tecmint.com/wp-content/uploads/2017/02/Access-Samba-Share-Directory-from-Windows.png -[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Samba-Share-Directory-Permissions.png -[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Manage-Samba-Share-Directory-User-Permissions.png -[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Connect-to-Samba-Share-Directory-Machine.png -[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Manage-Samba-Share-Directory-Properties.png -[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Assign-Samba-Share-Directory-Permissions-to-Users.png -[10]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/ -[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Map-Samba-Share-Folder.png -[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-Samba-Shared-Folder-Name-Location.png -[13]:http://www.tecmint.com/wp-content/uploads/2017/02/Map-Samba-Share-Folder-in-Windows.png -[14]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Network-Location-for-Samba-Share-Directory.png -[15]:http://www.tecmint.com/wp-content/uploads/2017/02/Apply-GPO-Changes.png -[16]:http://www.tecmint.com/wp-content/uploads/2017/02/Samba-Shared-Network-Volume-on-Windows.png -[17]:http://www.tecmint.com/wp-content/uploads/2017/02/List-Samba-Share-Directory-in-Linux.png -[18]:http://www.tecmint.com/wp-content/uploads/2017/02/Connect-Samba-Share-Directory-in-Linux.png -[19]:http://www.tecmint.com/wp-content/uploads/2017/02/Mount-Samba-Share-Directory-in-Linux.png -[20]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/ -[21]:http://www.tecmint.com/author/cezarmatei/ -[22]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ -[23]:http://www.tecmint.com/free-linux-shell-scripting-books/ From c58581e1e1e3c4a19f576da59943724073d803af Mon Sep 17 00:00:00 2001 From: xiaojin Date: Wed, 8 Mar 2017 22:51:25 +0800 Subject: [PATCH 101/190] =?UTF-8?q?translated:=20Create=20a=20Shared=20Dir?= =?UTF-8?q?ectory=20on=20Samba=20AD=20DC=20and=20Map=20to=20WindowsLinux?= =?UTF-8?q?=20Clients=20=E2=80=93=20Part=207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nd Map to WindowsLinux Clients – Part 7.md | 270 ++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 translated/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md diff --git a/translated/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md b/translated/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md new file mode 100644 index 0000000000..c66900dccf --- /dev/null +++ b/translated/tech/20170222 Create a Shared Directory on Samba AD DC and Map to WindowsLinux Clients – Part 7.md @@ -0,0 +1,270 @@ +Create a Shared Directory on Samba AD DC and Map to Windows/Linux Clients – Part 7 +============================================================ +在 Samba AD DC 服务器上创建共享目录并映射到 Windows/Linux 客户机 ——(七) + +这篇文章将指导你如何在 Samba AD DC 服务器上创建共享目录,然后通过 GPO 把共享目录挂载到域中的其它 Windows 成员机,并且从 Windows 域控的角度来管理共享权限。 + +这篇文章也包括在加入域的 Linux 机器上如何使用 Samba4 域帐号来访问及挂载共享文件。 + +#### 需求: + +1. [在 Ubuntu 系统上使用 Samba4 创建活动目录架构][1] + +### 第一步:创建 Samba 文件共享 + +1、在 Samba AD DC 服务器上创建共享非常简单。首先创建一个你想通过 SMB 协议来分享文件的目录,然后添加下面的文件系统权限,这是为了让 Windows AD DC 管理员给 Windows 客户端分配相应的共享权限。 + +假设在 AD DC 服务器上有一个新的共享目录 '/nas' ,执行下面的命令来授予必要的权限。 + +``` +# mkdir /nas +# chmod -R 775 /nas +# chown -R root:"domain users" /nas +# ls -alh | grep nas +``` +[ + ![Create Samba Shared Directory](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][2] + +创建 Samba 共享目录 + +2、当你在 Samba4 AD DC 服务器上创建完成共享目录之后,你还得修改 samba 配置文件,添加下面的参数以允许通过 SMB 协议来共享文件。 + +``` +# nano /etc/samba/smb.conf +``` + +在配置文件末尾添加以下内容: + +``` +[nas] +path = /nas +read only = no +``` +[ + ![Configure Samba Shared Directory](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][3] + +配置 Samba 共享目录 + +3、最后,你需要通过下面的命令重启 Samba AD DC 服务,以让修改的配置生效: + +``` +# systemctl restart samba-ad-dc.service +``` + +### 第二步:管理 Samba 共享权限 + +4、我们准备使用在 Samba AD DC 服务器上创建的域帐号(包括用户和组)来访问这个共享目录(禁止 Linux 系统用户访问共享目录)。 + +可以直接通过 Windows 资源管理器来完成 Samba 共享权限的管理,就跟你在 Windows 资源管理器中设置其它文件夹权限的方法一样。 + +首先,使用具有管理员权限的 Samba4 AD 域帐号登录到 Windows 机器。然而在 Windows 机器上的资源管理器中输入双斜杠和 Samba AD DC 服务器的 IP 地址或主机名或者是 FQDN 来访问共享文件和设置权限。 + +``` +\\adc1 +Or +\\192.168.1.254 +Or +\\adc1.tecmint.lan +``` +[ + ![Access Samba Share Directory from Windows](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][4] + +从 Windows 机器访问 Samba 共享目录 + +5、右键单击共享文件,选择属性来设置权限。打开安全选项卡,依次修改域账号和组权限。使用高级选项来调整权限。 + +[ + ![Configure Samba Share Directory Permissions](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][5] + +配置 Samba 共享目录权限 + +可参考下面的截图来为指定 Samba AD DC 认证用户设置权限。 + +[ + ![Manage Samba Share Directory User Permissions](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][6] + +设置 Samba 共享目录用户权限 + +6、你也可以使用其它方法来设置共享权限,打开计算机管理-->连接到另外一台计算机。 + +找到共享目录,右键单击你想修改权限的目录,选择属性,打开安全选项卡。你可以在这里修改任何权限,就跟上图的修改共享文件夹权限的方法一样。 + +[ + ![Connect to Samba Share Directory Machine](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][7] + +连接到 Samba 共享目录服务器 + +[ + ![Manage Samba Share Directory Properties](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][8] + +管理 Samba 共享目录属性 + +[ + ![Assign Samba Share Directory Permissions to Users](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][9] + +为域用户授予共享目录权限 + +### 第三步:通过 GPO 来映射 Samba 文件共享 + +7、要想通过域组策略来挂载 Samba 共享的目录,你得先到一台[已安装了 RSAT 工具][10] 的服务器上,打开 AD DC 工具,右键单击域名,选择新建-->共享文件平。 + +[ + ![Map Samba Share Folder](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][11] + +映射 Samba 共享文件夹 + +8、为共享文件夹添加一个名字,然后输入共享文件夹的网络路径,如下图所示。完成后单击 OK 按钮,你就可以在右侧看到文件夹了。 + +[ + ![Set Samba Shared Folder Name Location](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][12] + +设置 Samba 共享文件夹名称及路径 + +9、下一步,打开组策略管理控制台,找到当前域的默认域策略脚本,然后打开并编辑该文件。 + +在 GPM 编辑器界面,打开 GPM 编辑器,找到用户配置 --> 首选项 --> Windows 设置,然而右键单击驱动器映射,选择新建 --> 映射驱动。 + +[ + ![Map Samba Share Folder in Windows](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][13] + +在 Windows 机器上映射 Samba 共享文件夹 + +10、通过单击右边的三个小点,在新窗口中查询并添加共享目录的网络位置,勾选重新连接复选框,为该目录添加一个标签,选择驱动盘符,然后单击 OK 按钮来保存和应用配置。 + +[ + ![Configure Network Location for Samba Share Directory](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][14] + +配置 Samba 共享目录的网络位置 + +11、最后,为了在本地机器上强制应用 GPO 更改而不重启系统,打开命令行提示符,然而执行下面的命令。 + +``` +gpupdate /force +``` +[ + ![Apply GPO Changes](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][15] + +应用 GPO 更改 + +12、当你在本地机器上成功应用策略后,打开 Windows 资源管理器,你就可以看到并访问共享的网络文件夹了,能否正常访问共享目录取决于你在前一步的授权操作。 + +如果没有在命令行下强制应用组策略,你网络中的其它客户机需要重启或重新登录系统才可以看到共享目录。 + +[ + ![Samba Shared Network Volume on Windows](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][16] + +Windows 机器上挂载的 Samba 网络磁盘 + +### 第四步:从 Linux 客户端访问 Samba 共享目录 + +13、已加入 Samba AD DC 中的 Linux 成员机上的系统用户也可以可以使用 Samba 帐号访问或在本地挂载共享目录。 + +首先,你得通过下面的命令来确保 Samba 客户端和工具已经安装完成。 + +``` +$ sudo apt-get install smbclient cifs-utils +``` + +14、为了列出域环境中的共享目录,你可以通过下面的命令加入指定的域控服务器主机名来查询: + +``` +$ smbclient –L your_domain_controller –U% +or +$ smbclient –L \\adc1 –U% +``` +[ + ![List Samba Share Directory in Linux](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][17] + +在 Linux 机器上列出 Samba 共享目录 + +15、在命令行下使用域帐号以交互试方式连接到 Samba 共享目录: + +``` +$ sudo smbclient //adc/share_name -U domain_user +``` + +在命令行下,你可以列出共享目录内容,下载或上传文件到共享目录,或者执行其它操作。使用 ? 来查询所有可用的 smbclient 命令。 + +[ + ![Connect Samba Share Directory in Linux](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][18] + +在 Linux 机器上连接 Samba 共享目录 + +16、在 Linux 机器上使用下面的命令来挂载 samba 共享目录。 + +``` +$ sudo mount //adc/share_name /mnt -o username=domain_user +``` +[ + ![Mount Samba Share Directory in Linux](http://www.tecmint.com/wp-content/plugins/lazy-load/images/1x1.trans.gif) +][19] + +在 Linux 机器上挂载 samba 共享目录 + +根据实际情况,依次替换主机名、共享目录名、挂载点和域帐号。使用 mount 命令加上管道符和 grep 参数来过滤出 cifs 类型的文件系统。 + +通过上面的测试,我们可以看出,在 Samba4 AD DC 服务器上配置共享目录仅使用 Windows 访问控制列表( ACL ),而不是 POSIX ACL 。 + +通过文件共享把 Samba 配置为域成员以使用其它网络共享功能。同时,在另一个域控制器上[配置 Windbindd 服务][20] ——第二步——在你开始发起网络共享文件之前。 + +-------------------------------------------------------------------------------- + +作者简介: + +我是一个电脑迷,开源 Linux 系统和软件爱好者,有 4 年多的 Linux 桌面、服务器系统使用和 Base 编程经验。 + +译者简介: +春城初春/春水初生/春林初盛/春風十裏不如妳 +[rusking](https://github.com/rusking) + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-shared-directory-on-samba-ad-dc-and-map-to-windows-linux/ + +作者:[Matei Cezar][a] +译者:[rusking](https://github.com/rusking) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/cezarmatei/ + +[1]:http://www.tecmint.com/install-samba4-active-directory-ubuntu/ +[2]:http://www.tecmint.com/wp-content/uploads/2017/02/Create-Samba-Shared-Directory.png +[3]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Samba-Shared-Directory.png +[4]:http://www.tecmint.com/wp-content/uploads/2017/02/Access-Samba-Share-Directory-from-Windows.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Samba-Share-Directory-Permissions.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/02/Manage-Samba-Share-Directory-User-Permissions.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/02/Connect-to-Samba-Share-Directory-Machine.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/02/Manage-Samba-Share-Directory-Properties.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/02/Assign-Samba-Share-Directory-Permissions-to-Users.png +[10]:http://www.tecmint.com/manage-samba4-ad-from-windows-via-rsat/ +[11]:http://www.tecmint.com/wp-content/uploads/2017/02/Map-Samba-Share-Folder.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/02/Set-Samba-Shared-Folder-Name-Location.png +[13]:http://www.tecmint.com/wp-content/uploads/2017/02/Map-Samba-Share-Folder-in-Windows.png +[14]:http://www.tecmint.com/wp-content/uploads/2017/02/Configure-Network-Location-for-Samba-Share-Directory.png +[15]:http://www.tecmint.com/wp-content/uploads/2017/02/Apply-GPO-Changes.png +[16]:http://www.tecmint.com/wp-content/uploads/2017/02/Samba-Shared-Network-Volume-on-Windows.png +[17]:http://www.tecmint.com/wp-content/uploads/2017/02/List-Samba-Share-Directory-in-Linux.png +[18]:http://www.tecmint.com/wp-content/uploads/2017/02/Connect-Samba-Share-Directory-in-Linux.png +[19]:http://www.tecmint.com/wp-content/uploads/2017/02/Mount-Samba-Share-Directory-in-Linux.png +[20]:http://www.tecmint.com/manage-samba4-active-directory-linux-command-line/ +[21]:http://www.tecmint.com/author/cezarmatei/ +[22]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[23]:http://www.tecmint.com/free-linux-shell-scripting-books/ From d2cda5df0a44085d9e76bcf71a60e5404aac567f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B2?= <913502531@qq.com> Date: Thu, 9 Mar 2017 02:13:38 +0800 Subject: [PATCH 102/190] Create 20140513 What is Debian A brief introduction.md --- ...513 What is Debian A brief introduction.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 translated/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md diff --git a/translated/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md b/translated/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md new file mode 100644 index 0000000000..1f34087df0 --- /dev/null +++ b/translated/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md @@ -0,0 +1,36 @@ +###Debian 是什么?一个关于 Debian 的简介 + +大家好!! + +今天给大家带来点有意思的东西。我们准备给大家仔细讲讲 Linux 世界里的东西。 + +想必你们对[Linux 是什么?一个关于 Linux 的简介][2]和[怎么在 Linux 下用 screenlets 工具来安装一些桌面小程序][1]这两篇文章也感趣。这篇文章就当是这一系列的文章的第一部分。来给大家讲讲 Debian 这个 Linux 发行版。作为 Linux 的第一个发行版,Debian 是在1993年才初步发行的。Debian 这个名字是由 Debian 发行版的创作者给起的,这俩人是夫妻,男的叫 Ian Murdock 女的叫 Debra。 + +Debian 是个庞大的开源软件包的集合体。说 Debian 是开源软件包的集合,其实它也支持一些非自由软件包,不过相对来说 Debian 软件包集合里大部分是开源的。根据 Debian 的官方数据统计,Debian 库里总共囊括了37500个自由软件包。这些软件都是由 Debian 官方免费提供的。目前全世界大概有一千多人在为打造一个更好的 Debian 发行版努力。 + +目前为止 Debian 最新的稳定发行版是 7.5 命名为 Wheezy 。给开发测试用的最新的测试发行版 8.0 也出来了,命令为 Jesse 。Debian 发行版默认使用 Gnome 做为桌面环境。当然也不是只有 Gnome ,KDE 、Xfce 和 LXDE 这些桌面环境都是可选的。因为 Debian 的安装工具是可视化的图形界面,所以安装 Debian 这事很易容完成。 + +Debian 是一个稳健而且安全性高的操作系统。Debian 支持决大部分的架构的硬件平台,所以你们不用担心它能不能在你的PC上运行。另外你是不是要问驱动怎么办?想知道从哪里可以找到能跟你的 Debian 想匹配的驱动。这些问题都不需要太担心,Debian 社区已经把决大部分的现有新老设备的驱动准备好了。这样一来你也不用再等设备生产商给你制作相应的设备驱动了。还有更牛逼的一点就是,这些驱动都是开源的,都是可以免费获取的。 + +Debian 是由一个社区来维护的,就管它叫 Debian社区吧。因为有了这个社区,你可以相信你在使用 Debian 过程种遇到的问题肯定是可以在社区里找到其它用户来给你提供解决办法的。Debian 软件库里有大把的软件供你选择,而且都是免费的。Debian 是一个功能强大的操作系统。它具备稳定、高效、安全的特性,另外它的用户界面是一个友好的图形界面,所以它易用性也很强。 + +我们一般所说的稳定,是指这个系统极少出现崩溃或者挂死现象,还能兼顾高效率。Debian 正是这种系统的代表。Debian 的升级也相当容易实现。Debian 团队已经把软件库里的众多软件件源码包编译好,所以我们可以轻松的找到我们想要的软件,并且安装到咱们的系统里。 + +不管怎么说,Debian 诞生到现在已经有20个年头了。能持续到现在,说明了 Debian 团队一直在为给用户提供一最好的发行版而不懈努力着。Debian 可以通过购买DVD的方式进行安装,也可以直接在网上下载ISO镜像来进行安装。所以我们推荐你试一下 Debian。它可以给你提供非常多的东西。 + +Debian 是我们“介绍 Linux 世界”系列里的第一个内容。我们会接下来会给你们介绍另外一个 Linux 发行版。保持关注哦,后面还有更多内容在我们“Linux 世界”栏目。到时候再见咯。 + + +-------------------------------------------------------------------------------- + +via: http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html + +作者:[sumit rohankar ][a] +译者:[zschong](https://github.com/zschong) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/112160169713374382262 +[1]:http://www.techphylum.com/2014/05/desktop-gadgets-in-linux-ubuntu.html +[2]:http://www.techphylum.com/2014/05/what-is-linux-brief-description.html?m=1 From 778828830baf73d301735684f01e5a1baea7a475 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 9 Mar 2017 08:11:59 +0800 Subject: [PATCH 103/190] =?UTF-8?q?=E8=A1=A5=E5=AE=8C=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zschong --- ...513 What is Debian A brief introduction.md | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md diff --git a/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md b/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md deleted file mode 100644 index b661c1a8ff..0000000000 --- a/sources/tech/linux-distro -explain/20140513 What is Debian A brief introduction.md +++ /dev/null @@ -1,38 +0,0 @@ -zschong 翻译中 -### What is Debian? A brief introduction - -Hello buddies.!!  - -Today we have something interesting for you. We are gonna introduce the Linux world to you slowly and steadily.  - -YOU MAY ALSO LIKE- [What is Linux? A brief description.][2] -and  [How to install Desktop Gadgets in Linux using screenlets? ][1] - So here's the first piece of our intro series. Today we are going to know about Debian. It is one of the first Linux distribution. Debian was initially launched at 1993 August. The name Debian was given by the creator of Debian, Ian Murdock and his wife Debra. - -Debian is a huge set of open-source packages. Debian also supports installation of non-free packages, but the number is big in free packages. According to official source Debian contains about 37500 free packages in its repository. And Debian provides all this for free of cost. A team of around thousand or more people work on Debian to make it better. - -The latest stable release of Debian is 7.5 Wheezy. Debian has also released the alpha 8.0 Jesse for further development. By default, Debian uses Gnome desktop environment. But it also gives an option to choose between Gnome, KDE, Xfce and LXDE environments too. Debian is very easy to install due to its graphical installer. - -Debian is robust and secure Operating system. Debian supports most of hardware and architectures, so you usually don't have to worry about whether it will run on your PC or not. Now the thing is drivers? you must be wondering how to get drivers for Debian. Do not worry, for most of new and old hardware the community of Debian has made drivers. So you don't have to wait for your vendor to make drivers for your hardware. And once again as it's open-source, so it's all for free. - -Debian is supported by the community. So you can be assured that your problem will definitely get solved as there are actual users of Debian supporting you. Debian has wide range of software to choose from, which is of course free of cost. Debian is also very stable and powerful OS, which will give you amazing performance, security, a good Graphical user Interface (GUI) and also ease of use. - -When it comes to stability, we mean less crash and hangs but more performance. Debian fulfill this role very well. Debian is also very easy to upgrade. The Debian team has worked hard to compile all the packages in there repository so that we can easily find them and install in our system. - -So overall, it's been 20 years for Debian. So we can see the hard work and dedication of Debian team to keep it in the best condition for users. Debian can be installed either via buying a DVD or by downloading ISO files. So we would like to suggest you to give Debian a try. It has lots of things on grand scale to provide you. - -Debian is the first one in our Introduction of Linux world section. We will be back with another Linux distribution next time. Stay tuned, there is lot more in Linux world. Till then, ciao. - --------------------------------------------------------------------------------- - -via: http://www.techphylum.com/2014/05/what-is-debian-brief-introduction.html - -作者:[sumit rohankar ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/112160169713374382262 -[1]:http://www.techphylum.com/2014/05/desktop-gadgets-in-linux-ubuntu.html -[2]:http://www.techphylum.com/2014/05/what-is-linux-brief-description.html?m=1 From 3a958dced0d2f5233a0801246c662fb1b955f557 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 9 Mar 2017 08:58:22 +0800 Subject: [PATCH 104/190] translating --- ...0170306 How to Upgrade Kernel to Latest Version in Ubuntu.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md index 8aaff488bf..5e22a4e3dc 100644 --- a/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md +++ b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md @@ -1,3 +1,5 @@ +translating---geekpi + How to Upgrade Kernel to Latest Version in Ubuntu ============================================================ From 7306637b9326d29b4d180f3a883ba66d2ec944bf Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 9 Mar 2017 09:08:45 +0800 Subject: [PATCH 105/190] PRF&PUB:20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @geekpi 哈哈哈哈,终于完成这个系列啦! --- ...2.0 Debugging and contributing to LXD .md | 130 +++++++++--------- 1 file changed, 66 insertions(+), 64 deletions(-) rename translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md => published/LXD/Part 12 - LXD 2.0 Debugging and contributing to LXD .md (59%) diff --git a/translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md b/published/LXD/Part 12 - LXD 2.0 Debugging and contributing to LXD .md similarity index 59% rename from translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md rename to published/LXD/Part 12 - LXD 2.0 Debugging and contributing to LXD .md index bcbb5fe9a4..f31ba510e5 100644 --- a/translated/tech/LXD/20170227 Part 12 - LXD 2.0 Debugging and contributing to LXD .md +++ b/published/LXD/Part 12 - LXD 2.0 Debugging and contributing to LXD .md @@ -1,11 +1,10 @@ -LXD 2.0 系列(十二):调试并给 LXD 做贡献 [12/12] +LXD 2.0 系列(十二):调试,及给 LXD 做贡献 +================ - - ![LXD logo](https://linuxcontainers.org/static/img/containers.png) +![LXD logo](https://linuxcontainers.org/static/img/containers.png) ### 介绍 - 终于要结束了!这个大约一年前开始的[这系列文章][3]的最后一篇博文。 如果你从一开始就关注了这个系列,你应该已经使用了 LXD 相当长的时间了,并且非常熟悉它的日常操作和功能。 @@ -14,45 +13,48 @@ LXD 2.0 系列(十二):调试并给 LXD 做贡献 [12/12] 如果你想自己解决问题或通过实现你需要的功能来帮助改善LXD怎么办?如何构建,测试和贡献 LXD 代码库? -## 调试 LXD 并填写 bug 报告 +### 调试 LXD 并填写 bug 报告 -### LXD 日志文件 +#### LXD 日志文件 -#### /var/log/lxd/lxd.log +`/var/log/lxd/lxd.log`: -这是 LXD 日志的主文件。为了避免快速充满你的磁盘,默认只会记录 INFO、WARNING 或者 ERROR 级别的日志。你可以在 LXD 守护进程中使用 “–debug” 改变行为。 +这是 LXD 日志的主文件。为了避免它快速充满你的磁盘,默认只会记录 `INFO`、`WARNING` 或者 `ERROR` 级别的日志。你可以在 LXD 守护进程中使用 `–debug` 改变其行为。 -#### /var/log/lxd/CONTAINER/lxc.conf +`/var/log/lxd/CONTAINER/lxc.conf`: -每当你启动容器时,此文件将使用传递给 LXC 的配置进行更新。下面会展示容器将如何配置,包括其所有的设备,绑定安装等。 +每当你启动容器时,此文件将更新为传递给 LXC 的配置。 -#### /var/log/lxd/CONTAINER/forkexec.log +这里会展示容器将如何配置,包括其所有的设备、绑定挂载等等。 -这个文件包含 LXC 命令执行失败时产生的错误。这个情况是非常罕见的,因为 LXD 通常会在发生之前处理错误。 +`/var/log/lxd/CONTAINER/forkexec.log`: -#### /var/log/lxd/CONTAINER/forkstart.log +这个文件包含 LXC 命令执行失败时产生的错误。这个情况是非常罕见的,因为 LXD 通常会在发生之前处理大多数错误。 -这个文件包含 LXC 在启动容器时的错误信息。这个情况是非常罕见的,因为 LXD 通常会在发生之前处理错误。 +`/var/log/lxd/CONTAINER/forkstart.log`: -### CRIU 日志 (对于实时迁移) +这个文件包含 LXC 在启动容器时的错误信息。含 LXC 命令执行失败时产生的错误。 + +#### CRIU 日志 (对于实时迁移) 如果使用 CRIU 进行容器实时迁移或实时快照,则每次生成 CRIU 转储或恢复转储时都会记录额外的日志文件。 -这些日志也可以在 /var/log/lxd/CONTAINER/ 中找到,并且有时间戳,以便你可以找到与你最近的尝试匹配的那些日志。它们包含 CRIU 转储和恢复的所有内容的详细记录,并且比典型的迁移/快照错误消息更容器理解。 +这些日志也可以在 `/var/log/lxd/CONTAINER/` 中找到,并且有时间戳,以便你可以找到与你最近的操作所匹配的那些日志。它们包含 CRIU 转储和恢复的所有内容的详细记录,并且比典型的迁移/快照错误消息更容器理解。 -### LXD debug messages +#### LXD 调试消息 -如上所述,你可以使用 -debug 选项将守护进程切换为执行调试日志记录。另一种方法是连接到守护进程的事件接口,它将显示所有日志条目,而不管配置的日志级别(即使是远程工作)。 +如上所述,你可以使用 `-debug` 选项将守护进程切换为执行调试日志记录。另一种方法是连接到守护进程的事件接口,它将显示所有日志条目,而不管配置的日志级别(即使是远程工作)。 -一个例子 “lxc init ubuntu:16.04 xen” 会是: -**lxd.log:** +举例说,对于 `lxc init ubuntu:16.04 xen` 来说, + +`lxd.log` 会是这样: ``` INFO[02-24|18:14:09] Starting container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 INFO[02-24|18:14:10] Started container action=start created=2017-02-24T23:11:45+0000 ephemeral=false name=xen stateful=false used=1970-01-01T00:00:00+0000 ``` -**lxc monitor –type=logging:** +而 `lxc monitor –type=logging` 会是: ``` metadata: @@ -261,41 +263,41 @@ timestamp: 2017-02-24T18:14:10.163072893-05:00 type: logging ``` -“lxc monitor” 的格式有点不同于日志文件中的内容,每个条目都缩合成一行,但更重要的是,你可以看到所有 “level:dbug” 条目。 +`lxc monitor` 的格式有点不同于每个条目都缩合成一行的日志文件,但更重要的是,你可以看到所有 `level:dbug` 条目。 -## 如何报告 bug +### 如何报告 bug -### LXD bugs +#### LXD 的 bug 最好报告 bug 的地方是 [https://github.com/lxc/lxd/issues][4]。确保完整填写了 bug 报告模板中的内容,这些信息可以节省我们我们时间来复现环境。 -### Ubuntu bug +#### Ubuntu 的 bug 如果你发现 Ubuntu 包本身有问题,无法安装、升级或删除。或者遇到 LXD init 脚本的问题。报告此类错误的最好是在 Launchpad 上。 -在Ubuntu系统上,你可以使用:ubuntu-bug lxd ,它将自动包括一些日志文件和包信息供我们查看。 +在 Ubuntu 系统上,你可以使用:`ubuntu-bug lxd` ,它将自动包括一些日志文件和包信息供我们查看。 -### CRIU bug +#### CRIU 的 bug -与 CRIU 相关的Bug,你可以通过 CRIU 的错误输出发现,你应该在 Launchpad 上报告这些:ubuntu-bug criu +与 CRIU 相关的 Bug,你可以通过 CRIU 的错误输出发现,你应该在 Launchpad 上报告这些:`ubuntu-bug criu` -请注意,通过 LXD 使用 CRIU 被认为是测试版功能,除非你愿意通过与 Canonical 的支持合同付费支持,可能需要一段时间才能查看你的错误报告。 +请注意,通过 LXD 使用 CRIU 属于测试版功能,除非你愿意通过 Canonical 的支持合同付费支持,要么可能需要一段时间才能查看你的错误报告。 -## 贡献给 LXD +### 贡献给 LXD -LXD 用[Go][5] 写成并[托管在 Github][6]。我们欢迎任外部的贡献。为 LXD 贡献不需要 CLA 或类似的法律协议签署,只是通常的开发者所有权证书(Signed-off-by: line)。 +LXD 用 [Go][5] 写成并[托管在 Github][6]。我们欢迎任外部的贡献。为 LXD 贡献不需要 CLA 或类似的法律协议签署,只是通常的开发者所有权证书(`Signed-off-by:` 行)。 -在我们的问题追踪器工具中,我们有许多潜在的功能,可以为新的贡献者做出良好的起点。通常最好在开始处理代码先提出问题,这样每个人都知道你正在做这项工作,所以我们可以提供一些早期反馈。 +在我们的问题追踪器工具中,我们列有许多潜在的功能需求,新的贡献者可以以此作为良好的起点。通常最好在开始处理代码先发出 issue,这样每个人都知道你正在做这项工作,以便我们可以提供一些早期反馈。 -### 从源码源码构建 LXD +#### 从源码源码构建 LXD -这里有上流的维护说明:[https://github.com/lxc/lxd#building-from-source][7] +这里有上游的维护说明:[https://github.com/lxc/lxd#building-from-source][7] -你需要在 Github 上 fork 上游仓库,然后将你的更改推送到你的分支。我们建议在每天 rebase 上有的 LXD,因为我们倾向于定期合并更改。 +你需要在 Github 上 fork 上游仓库,然后将你的更改推送到你的分支。我们建议每天 rebase 上游的 LXD,因为我们倾向于定期合并更改。 -### 运行测试套件 +#### 运行测试套件 -LXD 维护了两套测试。单元测试和集成测试。你可以用下面的命令测试所有: +LXD 维护了两套测试集,单元测试和集成测试。你可以用下面的命令测试所有: ``` sudo -E make check @@ -314,52 +316,52 @@ cd test sudo -E ./main.sh ``` -后者支持相当多的环境变量来测试各种存储后端,禁用网络测试,使用 ramdisk 或只是调整日志输出。其中一些是: +后者支持相当多的环境变量来测试各种存储后端、禁用网络测试、使用 ramdisk 或只是调整日志输出。其中一些是: -* LXD_BACKEND:“btrfs”、“dir”、“lvm” 或 “zfs” 之一(默认为“dir”) +* `LXD_BACKEND`:`btrfs`、`dir`、`lvm` 或 `zfs`” 之一(默认为 `dir`)   运行 LXD 存储驱动程序相关的所有测试。 -* LXD_CONCURRENT:“true” 或 “false”(默认为 “false”) -  这允许一些额外的并发测试。 -* LXD_DEBUG:“true” 或 “false”(默认为 “false”) +* `LXD_CONCURRENT`:`true` 或 `false`(默认为 `false`) +  这启用一些额外的并发测试。 +* `LXD_DEBUG`:`true` 或 `false`(默认为 `false`)   记录所有 shell 命令,并在调试模式下运行所有​​ LXD 命令。 -* LXD_INSPECT:“true” 或 “false”(默认为 “false”) +* `LXD_INSPECT`:`true` 或 `false`(默认为 `false`)   测试程序会在故障时挂起,以便你可以检查环境。 -* LXD_LOGS:将所有 LXD 日志文件转储到的目录(默认为“”) -  所有生成的 LXD 守护进程的 “logs” 目录将被复制到此路径。 -* LXD_OFFLINE:“true” 或 “false”(默认为 “false”) +* `LXD_LOGS`:将所有 `LXD` 日志文件转储到的目录(默认为 “”) +  所有生成的 LXD 守护进程的 `logs` 目录将被复制到此路径。 +* `LXD_OFFLINE`:`true` 或 `false`(默认为 `false`)   禁用任何依赖于外部网络连接的测试。 -* LXD_TEST_IMAGE:以统一格式(默认为“”)的 LXD 镜像的路径 +* `LXD_TEST_IMAGE`: unified 格式的 LXD 镜像的路径(默认为 “”)   可以使用自定义测试镜像,而不是默认的最小 busybox 镜像。 -* LXD_TMPFS:“true” 或 “false”(默认为“false”) -  在 “tmpfs” 安装中运行整个测试套件,这会使用相当多的内存,但会使测试速度明显更快。 -* LXD_VERBOSE:“true” 或 “false”(默认为“false”) -  LXD_DEBUG 不太极端的版本。shell 命令仍然会记录,但 -debug 不会传递给 LXC 命令,LXD 守护进程只能使用 -verbose 运行。 +* `LXD_TMPFS`:`true` 或 `false`(默认为 `false`) +  在 `tmpfs` 安装中运行整个测试套件,这会使用相当多的内存,但会使测试速度明显更快。 +* `LXD_VERBOSE`:`true` 或 `false`(默认为 `false`) +  不太极端的 `LXD_DEBUG` 版本。shell 命令仍然会记录,但 `-debug` 不会传递给 LXC 命令,LXD 守护进程只能使用 `-verbose` 运行。 -测试程序将在实际运行之前提醒你任何丢失的依赖。在相当快的机器上运行测试可在 10 分钟内完成。 +测试程序将在实际运行之前提醒你任何缺失的依赖项。在相当快的机器上运行该测试可在 10 分钟内完成。 -### 发送你的分支 +#### 发送你的分支 -发送 pull 请求之前,你需要确认: +发送拉取请求(PR)之前,你需要确认: * 你已经 rebase 了上游分支 -* 你的所有提交信息都包括 “Signed-off-by: First Last ” 这行 +* 你的所有提交信息都包括 `Signed-off-by: First Last ` 这行 * 已删除任何你的临时调试代码 * 你已经将相关的提交 squash 在一起,以保持你的分支容易审查 * 单元和集成测试全部通过 -一切完成后,在 Github 上发起一个 pull 请求。我们的 [Jenkins][8] 将验证提交是否全部签署,在 MacOS 和 Windows 上的测试将自动执行,如果看起来不错,我们将触发一个完整的 Jenkins 测试,它将测试你的分支所有存储后端、32 位和 64 位以及我们关心的所有 Go 版本。 +一切完成后,在 Github 上发起一个拉取请求。我们的 [Jenkins][8] 将验证提交是否全部有 `signed-off`,在 MacOS 和 Windows 上的测试将自动执行,如果看起来不错,我们将触发一个完整的 Jenkins 测试,它将在所有存储后端、32 位和 64 位以及我们关心的所有 Go 版本上测试你的分支。 -假设我们有一个人要触发 Jenkins,这通常需要不到一个小时的时间。 +假设我们有人触发了 Jenkins,这通常需要不到一个小时的时间。 -一旦所有测试完成,我们对代码本身感到满意,你的分支将会被合并,你的代码会在下一个 LXD 发布中。如果更改适用于 LXD stable-2.0 分支,我们将为你向后移植。 +一旦所有测试完成,我们对代码本身感到满意,你的分支将会被合并,你的代码会出现在下一个 LXD 发布中。如果更改适用于 LXD stable-2.0 分支,我们将为你向后移植。 -# 总结 +### 总结 -我希望这个系列的博客文章有助于你了解什么是LXD,以及它可以做什么! +我希望这个系列的博客文章有助于你了解什么是 LXD,以及它可以做什么! -本系列的范围仅限于 LXD(2.0.x),但我们也为那些想要最新功能的用户提供每月功能版本。你可以找到一些其他涵盖原始[LXD 2.0系列文章][9]中列出的功能的博客文章。 +本系列的范围仅限于 LXD(2.0.x),但我们也为那些想要最新功能的用户提供每月功能版本。你可以找到一些其他涵盖了原来的 [LXD 2.0系列文章][9]中列出的功能的博客文章。 -# 额外的信息 +### 额外的信息 LXD 的主站在: [https://linuxcontainers.org/lxd][10] LXD 的 GitHub 开发仓库: [https://github.com/lxc/lxd][11] @@ -371,9 +373,9 @@ LXD 的 IRC 频道:#lxcontainers on irc.freenode.net via: https://stgraber.org/2017/02/27/lxd-2-0-debugging-and-contributing-to-lxd-1212/ -作者:[Stéphane Graber ][a] +作者:[Stéphane Graber][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 03b90d098d22d4295a87f3676d1e874863d56189 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 9 Mar 2017 09:13:53 +0800 Subject: [PATCH 106/190] translated --- ...rade Kernel to Latest Version in Ubuntu.md | 93 ------------------- ...rade Kernel to Latest Version in Ubuntu.md | 91 ++++++++++++++++++ 2 files changed, 91 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md create mode 100644 translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md diff --git a/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md b/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md deleted file mode 100644 index 5e22a4e3dc..0000000000 --- a/sources/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md +++ /dev/null @@ -1,93 +0,0 @@ -translating---geekpi - -How to Upgrade Kernel to Latest Version in Ubuntu -============================================================ - - -Periodically new devices and technology coming out and it’s important to keep our Linux system kernel up-to-date if we want to get the most of out it. Moreover, updating system kernel will ease us to take advantage of new kernel fuctions and also it helps us to protect ourselves from vulnerabilities that have been found in earlier versions. - -**Suggested Read:** [How to Upgrade Kernel in CentOS 7][1] - -Ready to update your kernel on Ubuntu 16.04 or one of their derivatives such as Debian and Linux Mint? If so, keep reading! - -### Step 1: Check Installed Kernel Version - -To find the current version of installed kernel on our system we can do: - -``` -$ uname -sr -``` - -The following image shows the output of the above command in a Ubuntu 16.04 server: - -[ - ![Check Kernel Version in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png) -][2] - -Check Kernel Version in Ubuntu - -### Step 2: Upgrading Kernel in Ubuntu 16.04 - -To upgrade the kernel in Ubuntu 16.04, go to [http://kernel.ubuntu.com/~kernel-ppa/mainline/][3] and choose the desired version from the list by clicking on it. - -Next, download the `.deb` files for your system architecture (see highlighted in yellow below for a 32-bit system): - -``` -$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913_4.9.13-040913.201702260631_all.deb -$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb -$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-image-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb -``` - -Once you’ve downloaded all the above kernel files, now install them as follows: - -``` -$ sudo dpkg -i *.deb -``` - -Once the installation is complete, reboot your machine and verify that the new kernel version is being used: - -``` -$ uname -sr -``` - -And that’s it. You are now using a much more recent kernel version than the one installed by default with Ubuntu 16.04. - -##### Summary - -In this article we’ve shown how to easily upgrade the Linux kernel on Ubuntu system. There is yet another procedure which we haven’t showed here as it requires compiling the kernel from source, which is not recommended on production Linux systems. - -If you’re still interested in compiling the kernel as a learning experience, you will get the instructions on how to do it at the [Kernel Newbies][4] page. - -As always, feel free to use the form below if you have any questions or comments about this article. - --------------------------------------------------------------------------------- - - -作者简介: - -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. - --------------------------------------------------------------------------------- -作者简介: - -Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/upgrade-kernel-in-ubuntu/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ - -[1]:http://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ -[2]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png -[3]:http://kernel.ubuntu.com/~kernel-ppa/mainline/ -[4]:https://kernelnewbies.org/KernelBuild -[5]:http://www.tecmint.com/author/gacanepa/ -[6]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ -[7]:http://www.tecmint.com/free-linux-shell-scripting-books/ diff --git a/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md b/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md new file mode 100644 index 0000000000..f91a853bf0 --- /dev/null +++ b/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md @@ -0,0 +1,91 @@ +如何在 Ubuntu 中升级到最新内核 +============================================================ + + +定期都会有新的设备和技术出来,因此如果我们想要充分利用它,保持最新的 Linux 内核就显得很重要。此外,更新系统内核将使我们能够利用新的内核优化,并且它还可以帮助我们避免在早期版本中发现的漏洞。 + +**建议阅读:** [如何升级 CentOS 7内核][1] + +准备好了在 Ubuntu 16.04 或其衍生版本(如 Debian 和 Linux Mint)中更新你的内核了么?如果准备好了,请你继续阅读! + +### 第一步:检查安装的内核版本 + +要发现当前系统安装的版本,我们可以: + +``` +$ uname -sr +``` + +下面的截图显示了在 Ubuntu 16.04 server 中上面命令的输出: + +[ + ![Check Kernel Version in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png) +][2] + +在 Ubuntu 中检查内核版本 + +### 第二步:在 Ubuntu 16.04 中升级内核 + +要升级 Ubuntu 16.04 的内核,打开 [http://kernel.ubuntu.com/~kernel-ppa/mainline/][3] 并选择列表中需要的版本。 + +接下来,根据你的系统架构下载 `.deb` 文件(黄色高亮的部分是给 32 位系统的): + +``` +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913_4.9.13-040913.201702260631_all.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-image-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +``` + +下载完成这些所有内核文件后,如下安装: + +``` +$ sudo dpkg -i *.deb +``` + +安装完成后,重启并验证新的内核已经被使用了: + +``` +$ uname -sr +``` + +就是这样。你下载就可以使用比 Ubuntu 16.04 默认安装的内核的更新版本了。 + +##### 总结 + +本文我们展示了如何在 Ubuntu 系统上轻松升级Linux内核。这里还有另一个流程,但我们在这里没有展示,因为它需要从源代码编译内核,这不推荐在生产 Linux 系统上使用。 + +如果你仍然有兴趣编译内核作为一个学习经验,你可以在 [Kernel Newbies][4] 网站中得到指导该如何做。 + +一如既往,如果你对本文有任何问题或意见,请随时使用下面的评论栏。 + +-------------------------------------------------------------------------------- + + +作者简介: + +Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin 和 web 开发人员,目前是 TecMint 的内容创建者,他喜欢用电脑工作,并坚信分享知识。 + +-------------------------------------------------------------------------------- +作者简介: + +Gabriel Cánepa - 一位来自阿根廷圣路易斯梅塞德斯镇 (Villa Mercedes, San Luis, Argentina) 的 GNU/Linux 系统管理员,Web 开发者。就职于一家世界领先级的消费品公司,乐于在每天的工作中能使用 FOSS 工具来提高生产力。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/upgrade-kernel-in-ubuntu/ + +作者:[Gabriel Cánepa][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ + +[1]:http://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/ +[2]:http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png +[3]:http://kernel.ubuntu.com/~kernel-ppa/mainline/ +[4]:https://kernelnewbies.org/KernelBuild +[5]:http://www.tecmint.com/author/gacanepa/ +[6]:http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ +[7]:http://www.tecmint.com/free-linux-shell-scripting-books/ From 19387b1ff8e9ba030d991e830a30af3ad4dfddb6 Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 9 Mar 2017 09:17:48 +0800 Subject: [PATCH 107/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对中 --- translated/tech/20170213 Orange Pi as Time Machine Server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170213 Orange Pi as Time Machine Server.md b/translated/tech/20170213 Orange Pi as Time Machine Server.md index 893b476bd4..38d370d3ef 100644 --- a/translated/tech/20170213 Orange Pi as Time Machine Server.md +++ b/translated/tech/20170213 Orange Pi as Time Machine Server.md @@ -129,7 +129,7 @@ via: http://piboards.com/2017/02/13/orange-pi-as-time-machine-server/ 作者:[MIKE WILMOTH][a] 译者:[beyondworld](https://github.com/beyondworld) -校对:[校对者ID](https://github.com/校对者ID) +校对:[jasminepeng](https://github.com/jasminepeng) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8eae4d8c04c8ede784b53a47dcb7c7d640c23476 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 9 Mar 2017 09:32:50 +0800 Subject: [PATCH 108/190] PRF:20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @ucasFL --- ...Install MariaDB 10 on Debian and Ubuntu.md | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md index 5ce7670d61..bbfde05894 100644 --- a/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md +++ b/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @@ -1,7 +1,7 @@ 如何在 Debian 和 Ubuntu 上安装 MariaDB 10 ============================================================ -MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个免费并且开源的分支。它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源。 +MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个自由开源的分支。它由 MySQL 的原开发者在 GPLv2(通用公共许可证 2 版)下开发,并保持开源。 它被设计来实现 MySQL 的高兼容性。对于初学者,可以阅读 [MariaDB vs MySQL][5] 来了解关于它们的特性的更多信息。更重要的是,它被一些大公司/组织使用,比如 Wikipedia、WordPress.com 和 Google plus ,除此之外还有更多的。 @@ -9,9 +9,9 @@ MariaDB 是深受欢迎的数据库管理服务器软件 MySQL 的一个免费 ### 在 Debian 和 Ubuntu 上安装 MariaDB -1. 在安装之前 MariaDB 之前,你需要通过下面的命令导入仓库密匙并获取 MariaDB 仓库 +1、在安装之前 MariaDB 之前,你需要通过下面的命令导入仓库密匙并获取 MariaDB 仓库 -#### 在 Debian 10(Sid) 上 +**在 Debian 10 (Sid) 上** ``` $ sudo apt-get install software-properties-common @@ -19,7 +19,7 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1 $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian sid main' ``` -#### 在 Debian 9(Stretch) 上 +**在 Debian 9 (Stretch) 上** ``` $ sudo apt-get install software-properties-common @@ -27,7 +27,7 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1 $ sudo add-apt-repository 'deb [arch=amd64] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian stretch main' ``` -#### 在 Debian 8(Jessie) 上 +**在 Debian 8 (Jessie) 上** ``` $ sudo apt-get install software-properties-common @@ -35,7 +35,7 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943 $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian jessie main' ``` -#### 在 Debian 7(Wheezy) 上 +**在 Debian 7 (Wheezy) 上** ``` $ sudo apt-get install python-software-properties @@ -43,7 +43,7 @@ $ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943 $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/debian wheezy main' ``` -#### 在 Ubuntu 16.10(Yakkety Yak) 上 +**在 Ubuntu 16.10 (Yakkety Yak) 上** ``` $ sudo apt-get install software-properties-common @@ -51,7 +51,7 @@ $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656 $ sudo add-apt-repository 'deb [arch=amd64,i386] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu yakkety main' ``` -#### 在 Ubuntu 16.04 (Xenial Xerus) 上 +**在 Ubuntu 16.04 (Xenial Xerus) 上** ``` $ sudo apt-get install software-properties-common @@ -59,7 +59,7 @@ $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656 $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu xenial main' ``` -#### 在 Ubuntu 14.04 (Trusty) 上 +**在 Ubuntu 14.04 (Trusty) 上** ``` $ sudo apt-get install software-properties-common @@ -67,7 +67,7 @@ $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb0 $ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://www.ftp.saix.net/DB/mariadb/repo/10.1/ubuntu trusty main' ``` -2. 然后,更新系统安装包列表,并像下面这样安装 MariaDB 服务器: +2、 然后,更新系统安装包列表,并像下面这样安装 MariaDB 服务器: ``` $ sudo apt-get update @@ -80,18 +80,18 @@ $ sudo apt-get install mariadb-server ![Set New Root Password for MariaDB](http://www.tecmint.com/wp-content/uploads/2017/02/Set-New-Root-Password-for-MariaDB.png) ][6] -为 MariaDB 设置新的 Root 密码 +*为 MariaDB 设置新的 Root 密码* -重新输入密码并按下 [ENTER] 键来继续安装。 +再次输入密码并按下回车键来继续安装。 [ ![Repeat MariaDB Password](http://www.tecmint.com/wp-content/uploads/2017/02/Repeat-MariaDB-Password.png) ][7] -再次输入 MariaDB 密码 +*再次输入 MariaDB 密码* -当 MariaDB 安装包安装完成以后,启动数据库服务器 daemon,同时启用它,使得在下次开机时它能够像下面这样自动启动: +当 MariaDB 安装包安装完成以后,启动数据库服务器守护进程,同时启用它,使得在下次开机时它能够像下面这样自动启动: ``` ------------- On SystemD Systems ------------- @@ -109,15 +109,15 @@ $ sudo service mysql status ![Start MariaDB Service](http://www.tecmint.com/wp-content/uploads/2017/02/Start-MariaDB-Service.png) ][8] -开启 MariaDB 服务 +*开启 MariaDB 服务* -4. 然后,运行 `mysql_secure_installation` 脚本来保护数据库,在这儿你可以: +4、 然后,运行 `mysql_secure_installation` 脚本来保护数据库,在这儿你可以: 1. 设置 root 密码(如果在上面的配置环节你没有进行设置的话)。 2. 禁止远程 root 登录 3. 移除测试数据库 4. 移除匿名用户 -5. 重装特权 +5. 重载权限配置 ``` $ sudo mysql_secure_installation @@ -126,9 +126,9 @@ $ sudo mysql_secure_installation ![Secure MariaDB Installation](http://www.tecmint.com/wp-content/uploads/2017/02/sudo-mysql-secure-installation.png) ][9] -保护 MariaDB 安装 +*保护 MariaDB 安装* -5. 一旦数据库服务器受保护以后,可以使用下面的 shell 命令查看已安装版本和登录 MariaDB: +5、 一旦数据库服务器受保护以后,可以使用下面的 shell 命令查看已安装版本和登录 MariaDB: ``` $ mysql -V @@ -138,7 +138,7 @@ $ mysql -u root -p ![Check MariaDB Version](http://www.tecmint.com/wp-content/uploads/2017/02/Check-MariaDB-Version.png) ][10] -查看 MariaDB 版本 +*查看 MariaDB 版本* 开始学习 MySQL/MariaDB, 请阅读: @@ -153,20 +153,17 @@ $ mysql -u root -p -------------------------------------------------------------------------------- - 作者简介: Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux 系统管理员和网络开发人员,目前是 TecMint 的内容创作者,他喜欢用电脑工作,并坚信分享知识。 - - -------------------------------------------------------------------------------- via: http://www.tecmint.com/install-mariadb-in-ubuntu-and-debian/ 作者:[Aaron Kili][a] 译者:[ucasFL](https://github.com/ucasFL) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 73ff7b7ba778d0a1bb39123536427910268c542d Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 9 Mar 2017 09:39:10 +0800 Subject: [PATCH 109/190] PUB:20170227 How to Install MariaDB 10 on Debian and Ubuntu.md @ucasFL --- .../20170227 How to Install MariaDB 10 on Debian and Ubuntu.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md (100%) diff --git a/translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md b/published/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md similarity index 100% rename from translated/tech/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md rename to published/20170227 How to Install MariaDB 10 on Debian and Ubuntu.md From e038797e35762b48324d14284a8879ca442e2a2a Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 9 Mar 2017 09:52:26 +0800 Subject: [PATCH 110/190] PRF:20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md @geekpi --- ...rade Kernel to Latest Version in Ubuntu.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md b/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md index f91a853bf0..125d403b67 100644 --- a/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md +++ b/translated/tech/20170306 How to Upgrade Kernel to Latest Version in Ubuntu.md @@ -1,8 +1,7 @@ 如何在 Ubuntu 中升级到最新内核 ============================================================ - -定期都会有新的设备和技术出来,因此如果我们想要充分利用它,保持最新的 Linux 内核就显得很重要。此外,更新系统内核将使我们能够利用新的内核优化,并且它还可以帮助我们避免在早期版本中发现的漏洞。 +每过段时间,就有新的设备和技术出来,因此如果我们想要充分利用它,保持最新的 Linux 内核就显得很重要。此外,更新系统内核将使我们能够利用新的内核优化,并且它还可以帮助我们避免在早期版本中发现的漏洞。 **建议阅读:** [如何升级 CentOS 7内核][1] @@ -22,18 +21,27 @@ $ uname -sr ![Check Kernel Version in Ubuntu](http://www.tecmint.com/wp-content/uploads/2017/03/Check-Kernel-Version-in-Ubuntu.png) ][2] -在 Ubuntu 中检查内核版本 +*在 Ubuntu 中检查内核版本* ### 第二步:在 Ubuntu 16.04 中升级内核 -要升级 Ubuntu 16.04 的内核,打开 [http://kernel.ubuntu.com/~kernel-ppa/mainline/][3] 并选择列表中需要的版本。 +要升级 Ubuntu 16.04 的内核,打开 [http://kernel.ubuntu.com/~kernel-ppa/mainline/][3] 并选择列表中需要的版本(发布此文时最新内核是 4.10.1)。 -接下来,根据你的系统架构下载 `.deb` 文件(黄色高亮的部分是给 32 位系统的): +接下来,根据你的系统架构下载 `.deb` 文件: +对于 64 位系统: ``` -$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913_4.9.13-040913.201702260631_all.deb -$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-headers-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb -$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.13/linux-image-4.9.13-040913-generic_4.9.13-040913.201702260631_i386.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-headers-4.10.1-041001_4.10.1-041001.201702260735_all.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-headers-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_amd64.deb + +``` + +这是 32 位系统的: +``` +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-headers-4.10.1-041001_4.10.1-041001.201702260735_all.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-headers-4.10.1-041001-generic_4.10.1-041001.201702260735_i386.deb +$ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.1/linux-image-4.10.1-041001-generic_4.10.1-041001.201702260735_i386.deb ``` 下载完成这些所有内核文件后,如下安装: @@ -50,7 +58,7 @@ $ uname -sr 就是这样。你下载就可以使用比 Ubuntu 16.04 默认安装的内核的更新版本了。 -##### 总结 +### 总结 本文我们展示了如何在 Ubuntu 系统上轻松升级Linux内核。这里还有另一个流程,但我们在这里没有展示,因为它需要从源代码编译内核,这不推荐在生产 Linux 系统上使用。 @@ -58,13 +66,6 @@ $ uname -sr 一如既往,如果你对本文有任何问题或意见,请随时使用下面的评论栏。 --------------------------------------------------------------------------------- - - -作者简介: - -Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin 和 web 开发人员,目前是 TecMint 的内容创建者,他喜欢用电脑工作,并坚信分享知识。 - -------------------------------------------------------------------------------- 作者简介: @@ -76,7 +77,7 @@ via: http://www.tecmint.com/upgrade-kernel-in-ubuntu/ 作者:[Gabriel Cánepa][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 025ffc9d97794314b16cad132ef07c42029b7a3d Mon Sep 17 00:00:00 2001 From: jasminepeng Date: Thu, 9 Mar 2017 10:17:49 +0800 Subject: [PATCH 111/190] =?UTF-8?q?=E6=A0=A1=E5=AF=B9=E5=AE=8C=E6=AF=95=20?= =?UTF-8?q?@beyondworld?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 校对完毕 谢谢 --- ...170213 Orange Pi as Time Machine Server.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/translated/tech/20170213 Orange Pi as Time Machine Server.md b/translated/tech/20170213 Orange Pi as Time Machine Server.md index 38d370d3ef..094e70967a 100644 --- a/translated/tech/20170213 Orange Pi as Time Machine Server.md +++ b/translated/tech/20170213 Orange Pi as Time Machine Server.md @@ -1,18 +1,18 @@ -使用Orange Pi搭建Time Machine服务 +使用 Orange Pi 搭建 Time Machine 服务器 ================================= ![Orange Pi as Time Machine Server](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=960%2C450) -我有一个项目是安排各类家用计算机进行自动备份。该项目将重要数据存放在一组Macs中。但是我决定将那些运行[Armbian][4] Linux的[Orange Pi][3]用来做实验,目的是希望能够将[Time Machine][5]运行在安装了USB网络驱动的Orange Pi主板上。在这种情况下,我找到成功安装Netatalk的方法。 +我的一个项目是为各类家用计算机安排进行自动备份,包括存放重要数据的一组 Mac 主机。所以,我决定使用运行 [Armbian][4] Linux 的便宜的 [Orange Pi][3] 做实验,目的是希望能够将 [Time Machine][5] 通过网络工作在 Orange Pi 主板上的 USB 驱动器工作。在这种情况下,我找到方法并成功安装了 Netatalk。 -[Netatalk][6]是一个开源软件,用于苹果文件服务器。通过[Avahi][7]和Netatalk配合运行,你的Mac设备能够识别网络上的Orange Pi设备,并会将Orange pi设备当作Mac类型的设备。这使得你能够自动连接作为网络设备,更重要的是使得Time Machine能够发现并使用远程驱动。下面的指南能够帮助你在Macs上设置类似的备份机制。 +[Netatalk][6] 是一个开源软件,用于苹果文件服务器。通过 [Avahi][7] 和 Netatalk 配合运行,你的 Mac 设备能够识别网络上的 Orange Pi 设备,甚至会将 Orange pi 设备当作 “Mac” 类型的设备。这使得你能够手动连接到网络设备,更重要的是使得 Time Machine 能够发现并使用远程驱动器。如果你想在 Mac 上设置类似的备份机制,下面的指南也许能够帮到你。 ### 准备工作 -为了安装USB驱动,我首先尝试了HFS+格式文件系统,不幸的是我没能成功写入。所以我选择创建一个EXT4文件系统,并确保pi用户有读写权限。Linux有很多格式化磁盘的方法,但是我最喜欢(推荐)的仍然是[gparted][8]。由于gparted已经集成在Armbian桌面了,所以我直接使用了该工具。 +为了安装 USB 驱动器,我首先尝试了 HFS+ 格式文件系统,不幸的是我没能成功写入。所以我选择创建一个 EXT4 文件系统,并确保用户 “pi” 有读写权限。Linux 有很多格式化磁盘的方法,但是我最喜欢(而且推荐)的仍然是 [gparted][8]。由于 gparted 已经集成在 Armbian 桌面了,所以我直接使用了该工具。 -我预期的是当Pi主板启动或者USB驱动连接的时候这个设备能够自动挂载到相同的位置。于是我创建了一个目录用于挂载:新建一个tm目录用于真正的备份地址,并将tm的所有者更改为pi。 +我预期的是当 Pi 主板启动或者 USB 驱动连接的时候,这个设备能够自动挂载到相同的位置。于是我创建了一个目录用于挂载:新建一个 tm 目录用于真正的备份地址,并将 “tm” 的所有者更改为用户 pi。 ``` cd /mnt @@ -22,7 +22,7 @@ sudo mkdir tm sudo chown pi:pi tm ``` -下一步,我打开一个终端并编辑/etc/fstab文件 +下一步,我打开一个终端并编辑 /etc/fstab 文件。 ``` sudo nano /etc/fstab @@ -40,9 +40,9 @@ sudo nano /etc/fstab sudo apt-get install build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev libmysqlclient-dev avahi-daemon libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libio-socket-inet6-perl tracker libtracker-sparql-1.0-dev libtracker-miner-1.0-dev hfsprogs hfsutils avahi-daemon ``` -### 安装并配置Netatalk +### 安装并配置 Netatalk -下一步是下载Netatalk,解压下载的archive文件,然后切换到Netatalk目录: +下一步是下载 Netatalk,解压下载的 archive 文件,然后切换到 Netatalk 目录: ``` wget https://sourceforge.net/projects/netatalk/files/netatalk/3.1.10/netatalk-3.1.10.tar.bz2 @@ -50,38 +50,38 @@ tar xvf netatalk-3.1.10.tar.bz2 cd netatalk-3.1.10 ``` -然后需要顺序执行configure,make,make install命令安装软件。在netatalk-3.1.10目录中执行configure命令,这个命令需要花点时间才能执行完。 +然后需要顺序执行 configure,make,make install 命令安装软件。在 netatalk-3.1.10 目录中执行 configure 命令,这个命令需要花点时间才能执行完。 ``` ./configure --with-init-style=debian-systemd --without-libevent --without-tdb --with-cracklib --enable-krbV-uam --with-pam-confdir=/etc/pam.d --with-dbus-daemon=/usr/bin/dbus-daemon --with-dbus-sysconf-dir=/etc/dbus-1/system.d --with-tracker-pkgconfig-version=1.0 ``` -configure运行完成后执行make: +configure 运行完成后执行 make: ``` make ``` -执行完make命令需要花较长时间,可以考虑喝杯咖啡或者做点其他什么。当执行完后执行以下命令: +执行完 make 命令需要花较长时间,可以考虑喝杯咖啡或者做点其他什么。之后,执行以下命令: ``` sudo make install ``` -这个命令能够快速执行完成。现在你可以通过下面两个命令验证安装是否成功以及查找配置文件位置。 +这个命令能够快速执行完成。现在你可以通过下面两个命令验证安装是否成功,同时找到配置文件位置。 ``` sudo netatalk -V sudo afpd -V ``` -然后你需要编辑afp.conf配置文件并在其中指定Time Machine备份路径,可以访问的帐号名并指定是否使用[Spotlight][9]用于搜索备份。 +然后你需要编辑 afp.conf 配置文件并在其中指定 Time Machine 备份路径,可以访问的帐号名并指定是否使用 [Spotlight][9] 为备份建立索引。 ``` sudo nano /usr/local/etc/afp.conf ``` -下面是afp.conf的配置示例: +下面是 afp.conf 的配置示例: ``` [My Time Machine Volume] @@ -90,7 +90,7 @@ valid users = pi time machine = yes spotlight = no ``` -最后,设置Avahi和Netatalk并启动。 +最后,启用 Avahi 和 Netatalk 并启动。 ``` sudo systemctl enable avahi-daemon @@ -99,29 +99,29 @@ sudo systemctl start avahi-daemon sudo systemctl start netatalk ``` -### 连接到网络驱动 +### 连接到网络驱动器 -此时,你的Mac可能已经发现并识别了你的Pi设备。打开Mac中的Finder访问下面地址看看以下内容: +此时,你的 Mac 可能已经发现并识别了你的 Pi 设备和网络驱动器。打开 Mac 中的 Finder,看看是否有像下面的内容: ![](https://i2.wp.com/piboards.com/wp-content/uploads/2017/02/TM_drive.png?resize=241%2C89) -当然你也可以通过host或者ip地址访问,比如: +当然你也可以通过主机名或者 ip 地址访问,比如: ``` afp://192.168.1.25 ``` -### Time Machine备份 -### Time Machine Backup -最后打开Mac上的Time Machine,然后选中硬盘,选择Orange pi。 +### Time Machine 备份 + +最后,打开 Mac 上的 Time Machine,然后选中硬盘,选择 Orange pi。 ![](https://i1.wp.com/piboards.com/wp-content/uploads/2017/02/OPiTM.png?resize=579%2C381) -通过这样设置后Orange Pi肯定能够正常工作并能够像champ一样处理,不过这并不是最快速的备份方式。但是这个方法比较简单且便宜,并且正如其展示的一样能够正常工作。如果你已经成功或者改进了这些设置,请在下面留言或者发送消息给我。 +这样设置肯定有效,Orange Pi 能够很好的处理进程,不过这可能并不是最快速的备份方式。但是,这个方法比较简单且便宜,并且正如其展示的一样能够正常工作。如果对这些设置你已经成功或者进行了改进,请在下面留言或者发送消息给我。 ![](https://i0.wp.com/piboards.com/wp-content/uploads/2017/02/backup_complete.png?resize=300%2C71) -Amazon上有售卖Orange Pi主板: +Amazon 上有售卖 Orange Pi 主板。 -------------------------------------------------------------------------------- From 1bc2b64e8a3619fd85dcde2b2fc799ed58b3410e Mon Sep 17 00:00:00 2001 From: chenxinlong <237448382@qq.com> Date: Thu, 9 Mar 2017 12:19:59 +0800 Subject: [PATCH 112/190] translated by chenxinlong --- ... 15 JavaScript frameworks and libraries.md | 97 +++++++++---------- 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/sources/tech/20161128 15 JavaScript frameworks and libraries.md b/sources/tech/20161128 15 JavaScript frameworks and libraries.md index aaba6794b4..a24d158754 100644 --- a/sources/tech/20161128 15 JavaScript frameworks and libraries.md +++ b/sources/tech/20161128 15 JavaScript frameworks and libraries.md @@ -1,111 +1,108 @@ (翻译中 by chenxinlong) -15 JavaScript frameworks and libraries +15 JavaScript 的框架和库 ============================================================ ![15 JavaScript frameworks and libraries](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/code_javascript.jpg?itok=a4uULCF0 "15 JavaScript frameworks and libraries") ->Image credits : Photo by Jen Wike Huger +>来源 : 图片来自 Jen Wike Huger -JavaScript is the future. +JavaScript 即未来趋势所在。 -The language is supported by a number of technololgy leaders, one of whom is WordPress's founder Matt Mullenweg, who hinted that [WordPress developers][18]should learn it, clearly sending a message to the WordPress community as to it future importance. The mention was well received. The transition to better technology will enable WordPress to keep up with future challenges. +Javascript 拥有众多的技术领导者的拥护和支持,其中一位就是 WordPress 的作者 Matt Mullenweg , 他表示 [WordPress 开发者][18] 应该学习 JavaScript , 这也清晰地向 WordPress 社区传达了 JavaScript 在未来的重要性。 同时,这一观点也被普遍接受。向着更先进的技术靠拢与过渡也同时保证了 WordPress 在未来的挑战中不会落于人后。 -JavaScript’s open source stance is also one of the best. Contrary to popular belief, JavaScript is not a project, but a specification with an open standard where the language is evolved and maintained by its core team. [ECMAScript][19], another fancy name of JavaScript, is not open source, but it too has an open standard. +JavaScript 同时也是众多站在开源立场的技术中的佼佼者。与现在所流行的观点相反,JavaScript 不是一个工程,而是一个由其核心团队共同制定和维护的开放标准。[ECMAScript][19] , 另一个和 JavaScript 相关的名字, 它虽然不是开源的,但它也有一个开放的标准。 -You can easily see evidence of JavaScript's popularity when you look at both at GitHub. JavaScript is the top programming language when it comes to the[number of repositories][20]. Its prominance is also evident on Livecoding.tv, where members are diligently creating more videos on JavaScript than any other topic. At the time of this writing, the self-dubbed edutainment site hosts [45,919 JavaScript videos][21]. +当你在浏览 GitHub 的时候你就可以发现 JavaScript 在当今有多么流行了。而且就 [repository 的数量][20] 而言,JavaScript 绝对位于所有的编程语言当中最顶尖的那一层次。 同时,在 Livecoding.tv 上你也能看出 JavaScript 有多么突出,这里的用户发布的关于 JavaScript 的视频的数量比其他的话题多得多。在写这篇文章的时候(原作者写下这篇文章的日期,非译者翻译日期),Livecoding.tv 上已经有 [45,919 个 用户原创的 JavaScript 视频教程][21] 。 -### Top open source JavaScript frameworks and libraries +### 热门的开源 JavaScript 框架和库 -Getting back to the topic, JavaScript is blessed with a large community that thrives on improving the technology. Hundreds of JavaScript frameworks and libraries are available to developers, and the good news is that the best ones are open source. For a JavaScript developer, using the best framework or libraries for rapid development is now a necessity. The current market demands rapid development. Also, reinventing the wheel is not a good idea in the current market. Regardless of whether you are new to JavaScript or an experienced JavaScript developer, using libraries and frameworks improves your work significantly. +回归到主题, 庞大的社区是 JavaScript 的一个得天独厚的优势,同时这也驱动了 JavaScript 的蓬勃发展。这里有数以百千计的成熟的 JavaScript 框架和库供开发者使用,同时这些最优秀的框架和库都是开源的。对当前的 JavaScript 开发者来说,能够使用这些优秀的框架和库来进行快速开发已经是必须技能了。当今的市场需要快速开发,但是,重复造轮子是没有必要的。不论你是一个 JavaScript 新手还是一个资深的 JavaScript 开发者,使用框架和库都能极大提高你的工作效率。 -Let’s get started. +好了,让我们开始吧! ### 1\. Angular.js -[Angular.js][1] is one of the most popular JavaScript frameworks. It is used by developers to create complex web apps. The idea behind Angular.js is its one-page app model. It also supports MVC architecture. With Angular.js, the developer can use JavaScript code in the front end, literally extending the HTML vocabulary. +[Angular.js][1] 是目前最热门的 JavaScript 框架之一。它用于开发者构建复杂的 web 应用。Angular.js 背后的思想是它的单页应用 model。同时它 也支持 MVC 架构。在 Angular.js 中 ,开发者可以在前端中使用 JavaScript 代码,并从字面上扩展 HTML词汇。 -Angular.js has improved a great deal since its inception in 2009\. The current stable version of Angular 1 is 1.5.8/1.2.30\. You can also try out Angular 2, a significant improvement over Angular 1, but this framework is still not yet adopted by developers across the world. +Angular.js 自 2009 年出现以来已经有了很大的改进。Angular 1 当前的稳定版本是 1.5.8/1.2.30 。你也可以试一试 Angular 2 ,相对于 Angular 1 来说它有了重大的改进,但这个新版本仍未在全球范围内被普遍使用。 -Angular.js uses data binding as one of the main concepts to get work done. The user interacts with the interface. When the interaction is done, the view is then updated with the new values, which in turn interact with the model and ensure everything is synchronized. The DOM gets updated after the underlying logic is executed in the model. +在 Angular.js 中,数据绑定是完成作业的一个重要概念。在用户与接口的交互中,当交互完成 view 就会自动更新新值,随即新值与 model 交互以确保一切都是同步的。在底层的逻辑在 model 中执行完成后,DOM 也会随即更新。 ### 2\. Backbone.js -Not everyone intends to build a complex web application. Simpler web application frameworks such as [Backbone.js][2] are a great fit for those learning web app development. Backbone.js is a straightforward framework that makes building simple web apps fun and speedy. Just like Angular.js, Backbone.js also comes with MVC support. Other key features of Backbone.js are routing, RESTful API’s support, proper state management, and much more. You can also use Backbone.js to build single page apps. +复杂 web 应用并不适用于所有场景。一些较简单的 web 应用框架例如 [Backbone.js][2] 就非常适合学习 web app 开发。Backbone.js 是一个简单的框架,可以快速方便地构建简单的 web 应用。和 Angular.js 一样,Backbone.js 也支持 MVC 。Backbone.js 还有一些其它关键特性如路由,RESTful API 支持,适当的状态管理等等。你甚至还可以用 Backbone.js 来构建单页应用。 -The current stable version is 1.3.3 and is available from [GitHub][22]. +当前的稳定版本是 1.3.3,可以在 [GitHub][22] 中找到。 ### 3\. D3.js -[D3.js][3] is an excellent JavaScript library that enables developers to create rich web pages with data manipulation features. D3.js uses SVG, HTML, and CSS to make the magic happen. With D3.js, you can bind data to DOM easily and enable data-driven events. With D3.js, you also can create high-quality data-driven web pages that offer a better understanding of data coupled with great visuals. Check[Hamiltonian Graphs from LCF notation][23], powered by D3.js. +[D3.js][3] 是一个优秀的 JavaScript 库,它允许开发者创建具有数据处理功能的富 web 页面。D3.js 使用 SVG, HTML 和 CSS 来实现这一切功能。使用 D3.js ,你可以更轻松地将数据绑定到 DOM 及启用数据驱动事件。使用 D3.js ,你还可以创建高质量的数据驱动的 web 页面来提供一个更易于理解的视觉效果来呈现数据。查看示例 : [LCF 符号哈密顿图][23] ,由 D3.js 强力驱动。 ### 4\. React.js -[React.js][4] is an interesting JavaScript framework to work with. Unlike other JavaScript frameworks, React.js is ideal for building highly scalable front-end user interfaces. React.js came into existence in 2013 under a BSD license and is growing rapidly thanks to the advantages that it brings to developing complex yet beautiful user interfaces. +[React.js][4] 是一个使用起来很有趣的 JavaScript 框架。和其它的 JavaScript 框架不同,React.js 志在构建一个高可扩展的前端用户界面。React.js 出现于 2013 年,它采用了 BSD 开源协议。它以其能够开发复杂且漂亮的用户界面所带来的优势而迅速发展壮大。 -The core idea behind React.js is the virtual DOM. Virtual DOM acts as a mediator between the client-side and the server-side, bringing improved performance. The changes made in the virtual DOM are matched with the server DOM, and only the needed elements are updated, making the process much faster than a traditional UI update. +React.js 背后的核心思想是虚拟 DOM 。虚拟 DOM 在客户端和服务端之间扮演着一个中间人的角色并带来了显著的性能提升。虚拟 DOM 的改变和 server DOM 一样,只需要更新所需的元素,相对于传统的 UI 渲染来说极大提升了渲染速度。 -You can also use material design with React, enabling you to develop modern web apps with unparalleled performance. +你还可以使用 Recat 来实现 meterial 风格的设计,使你能够开发具有无与伦比的性能的 web 应用。 -Check out mittax from Munich, Germany working on React Material-UI in the video below. +### 5\. jQuery -### 6\. jQuery +[jQuery][5] 是一个非常流行的 JavaScript 库,它拥有众多特性例如事件处理,动画等。当你在做一个 web 项目的时候,你不会想要把时间浪费在为一些简单的功能写代码上。jQuery 为减少你的工作量提供了一些易于使用的 API 。这些 API 在所有的常见的浏览器中都能够使用。使用 jQuery, 你可以无缝地控制 DOM 以及 Ajax 这样在近几年来拥有高需求的作业。使用 jQuery, 开发者不必担心一些低级的交互,同时可以使他们的 web 应用的开发更加容易与迅速。 -[jQuery][5] is a very popular JavaScript library with features such as event handling, animation, and much more. When working on a web project, you don’t want to waste time writing code for simple tasks. jQuery frees you from this with its easy-to-use API. It also works with all the popular web browsers. With jQuery, you can seamlessly control the DOM and also develop an Ajax application, which is in high demand for the last few years. With jQuery, developers don’t have to worry about low-level interactions and can easily develop their web applications faster and easier. +jQuery 同时便于分离 HTML 和 JavaScript 代码,使开发者能够编写简洁同时跨浏览器兼容的代码。并且使用 jQuery 创建的 web 应用在将来也易于改善和扩展。 -jQuery also facilitates the separation of HTML and JavaScript code, enabling developers to write clean code with cross-browser compatibility. Moreover, web apps created using jQuery are easily improved and extended in the future. +### 6\. Ember.js -### 7\. Ember.js +[Ember.js][6] 是一个 Angular.js 和 React.js 的功能的混合体。当你在浏览社区的时候你能明显地感受到 Ember.js 的热门程度。Ember.js 的新特性也不断地在添加。它在数据同步方面与 Angular.js 很像。 双向的数据交换可以确保应用的快速性和可扩展性。同时,它还能够帮助开发者创建一些前端元素。 -[Ember.js][6] is a mix of Angular.js and React.js when it comes to functionality. You can easily see the popularity of Ember.js when observing the support community. New features are added constantly. It works similar to Angular.js when it comes to syncing data. The two-way data exchange ensures that the app is fast and scalable. It also helps developers to create front-end elements. +和 React.js 的相似之处在于,Ember.js 提供了同样的服务端虚拟 DOM 以确保高性能和高可扩展。同时, Ember.js 提倡简化代码,提供了丰富的 API。Ember.js 还有非常优秀的社区。 -When it comes to React.js for similarities, Ember.js provides similar server-side Virtual DOM for better performance and scalability. Ember.js also encourages minimal code writing, offers excellent APIs to work with, and has an excellent community. +### 7\. Polymer.js -### 8\. Polymer.js +如果你曾想过创建你自己的 HTML5 元素,那么你可以使用[Polymer.js][7] 来做这些事。 Polymer 主要集中于通过给 web 开发者提供创建自己的标签的功能来提供扩展功能。例如,你可以创建一个和 HTML5 中的 \