diff --git a/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md new file mode 100644 index 0000000000..c3c7d5d3bf --- /dev/null +++ b/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11631-1.html) +[#]: subject: (How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server) +[#]: via: (https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Fedora 30 Server 上安装 LEMP(Linux、Nginx、MariaDB、PHP) +====== + +在这篇文章中,我们将看看如何在 Fedora 30 Server 上安装 **LEMP** 。LEMP 代表: + + * L -> Linux + * E -> Nginx + * M -> Maria DB + * P -> PHP + +我假设 [Fedora 30][1] 已经安装在你的电脑系统上。 + +![](https://img.linux.net.cn/data/attachment/album/201912/01/103537wil7hd36dhcxdh03.jpg) + +LEMP 是一组强大的软件设置集合,它安装在一个 Linux 服务器上以帮助使用流行的开发平台来构建网站,LEMP 是 LAMP 的一个变种,在其中不是 Apache ,而是使用 EngineX(Nginx),此外,使用 MariaDB 代替 MySQL。这篇入门指南是一个安装 Nginx、Maria DB 和 PHP 的独立指南的作品集合。 + +### 在 Fedora 30 Server 上安装 Nginx、PHP 7.3 和 PHP-FPM + +让我们看看如何在 Fedora 30 Server 上安装 Nginx 和 PHP 以及 PHP FPM。 + +#### 步骤 1) 切换到 root 用户 + +在系统上安装 Nginx 的第一步是切换到 root 用户。使用下面的命令: + +``` +root@linuxtechi ~]$ sudo -i +[sudo] password for pkumar: +[root@linuxtechi ~]# +``` + +#### 步骤 2) 使用 dnf 命令安装 Nginx、PHP 7.3 和 PHP FPM + +使用下面的 `dnf` 命令安装 Nginx: + +``` +[root@linuxtechi ~]# dnf install nginx php php-fpm php-common -y +``` + +#### 步骤 3) 安装额外的 PHP 模块 + +PHP 的默认安装仅自带基本模块和最需要的模块,如果你需要额外的模块,像 PHP 支持的 GD、XML、命令行接口、Zend OPCache 功能等等,你总是能够选择你的软件包,并一次性安装所有的东西。查看下面的示例命令: + +``` +[root@linuxtechi ~]# sudo dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y +``` + +#### 步骤 4) 开始 & 启用 Nginx 和 PHP-fpm 服务 + +使用下面的命令来开始并启用 Nginx 服务: + +``` +[root@linuxtechi ~]# systemctl start nginx && systemctl enable nginx +Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service. +[root@linuxtechi ~]# +``` + +使用下面的命令来开始并启用 PHP-FPM 服务: + +``` +[root@linuxtechi ~]# systemctl start php-fpm && systemctl enable php-fpm +Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service. +[root@linuxtechi ~]# +``` + +#### 步骤 5) 核实 Nginx (Web 服务) 和 PHP 安装 + +注意:假使操作系统防火墙是启用的,并运行在你的 Fedora 30 系统上,那么使用下面的命令来准许 80 和 443 端口: + +``` +[root@linuxtechi ~]# firewall-cmd --permanent --add-service=http +success +[root@linuxtechi ~]# +[root@linuxtechi ~]# firewall-cmd --permanent --add-service=https +success +[root@linuxtechi ~]# firewall-cmd --reload +success +[root@linuxtechi ~]# +``` + +打开网页浏览器,输入下面的 URL: http:// 。 + +![Test-Page-HTTP-Server-Fedora-30][4] + +上面的屏幕证实 Nginx 已经成功地安装。 + +现在,让我们核实 PHP 安装,使用下面的命令创建一个测试 php 页(`info.php`): + +``` +[root@linuxtechi ~]# echo "" > /usr/share/nginx/html/info.php +[root@linuxtechi ~]# +``` + +在网页浏览器中输入下面的 URL, http:///info.php + +![Php-info-page-fedora30][6] + +上面的页面验证 PHP 7.3.5 已经被成功地安装。现在,让我们安装 MariaDB 数据库服务器。 + +### 在 Fedora 30 上安装 MariaDB + +MariaDB 是 MySQL 数据库的一个极好的替代品,因为它的工作方式与 MySQL 非常类似,并且兼容性也与 MySQL 一致。让我们看看在 Fedora 30 Server 上安装 MariaDB 的步骤。 + +#### 步骤 1) 切换到 root 用户 + +在系统上安装 MariaDB 的第一步是切换到 root 用户,或者你可以使用有 root 权限的本地用户。使用下面的命令: + +``` +[root@linuxtechi ~]# sudo -i +[root@linuxtechi ~]# +``` + +#### 步骤 2) 使用 dnf 命令安装 MariaDB(10.3)的最新版本 + +在 Fedora 30 Server 上使用下面的命令来安装 MariaDB: + +``` +[root@linuxtechi ~]# dnf install mariadb-server -y +``` + +#### 步骤 3) 开启并启用 MariaDB 服务 + +在步骤 2 中成功地安装 MariaDB 后,接下来的步骤是开启 MariaDB 服务。使用下面的命令: + +``` +[root@linuxtechi ~]# systemctl start mariadb.service ; systemctl enable mariadb.service +``` + +#### 步骤 4) 保护安装好的 MariaDB + +当我们安装 MariaDB 服务器时,因为默认情况下没有 root 密码,在数据库中也会创建匿名用户。因此,要保护安装好的 MariaDB,运行下面的 `mysql_secure_installation` 命令: + +``` +[root@linuxtechi ~]# mysql_secure_installation +``` + +接下来你将被提示一些问题,仅回答下面展示的问题: + +![Secure-MariaDB-Installation-Part1][7] + +![Secure-MariaDB-Installation-Part2][8] + +#### 步骤 5) 测试 MariaDB 安装 + +在你安装后,你总是能够测试是否 MariaDB 被成功地安装在 Fedora 30 Server 上。使用下面的命令: + +``` +[root@linuxtechi ~]# mysql -u root -p +Enter password: +``` + +接下来,你将被提示一个密码。输入在保护安装好的 MariaDB 期间你设置的密码,接下来你可以看到 MariaDB 欢迎屏幕。 + +``` +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MariaDB connection id is 17 +Server version: 10.3.12-MariaDB MariaDB Server + +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +MariaDB [(none)]> +``` + +最后,我们已经在你的 Fedora 30 Server 上成功地完成安装 LEMP(Linux、Nginx、MariaDB 和 PHP)的所有工作。请在下面的反馈部分发布你的评论和建议,我们将尽快在后面回应。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/fedora-30-workstation-installation-guide/ +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/06/LEMP-Stack-Fedora30.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30-1024x732.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30-1024x732.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part1.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part2.jpg diff --git a/published/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md b/published/201911/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md similarity index 100% rename from published/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md rename to published/201911/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md diff --git a/published/201911/20181109 Must-Have Tools for Writers on the Linux Platform.md b/published/201911/20181109 Must-Have Tools for Writers on the Linux Platform.md new file mode 100644 index 0000000000..c82c4f1fe2 --- /dev/null +++ b/published/201911/20181109 Must-Have Tools for Writers on the Linux Platform.md @@ -0,0 +1,101 @@ +Linux 平台上的写作者必备工具 +====== + +![](https://img.linux.net.cn/data/attachment/album/201911/25/000129eee2zydelz22vj9h.jpg) + +我从事作家已有 20 多年了。我撰写了数千篇有关各种技术主题的文章和指南,并撰写了 40 多本小说。因此,书面文字不仅对我很重要,还很熟悉,成为了我的第二种自然交流的方式。在过去的二十年中(而且还在继续),我几乎都是在 Linux 平台上完成的所有工作。我必须承认,在早期,这并不总是那么容易。格式并不总是与编辑器所需要的相吻合,在某些情况下,开源平台根本没有完成工作所需的必要工具。 + +那时已经过去,现在已经不同了。 + +Linux 演进和基于 Web 的工具的相得益彰使得它可以让任何写作者都能在 Linux 上完成工作(并且做得很好)。但是你需要什么工具?你可能会惊讶地发现,在某些情况下,使用 100% 开源的工具无法有效完成这项工作。不过即使如此,工作总是可以完成的。让我们来看看我作为技术作家和小说作者一直使用的工具。我将通过小说和非小说类的写作过程来概述这一点(因为过程不同,需要特定的工具)。 + +对认真的 Linux 硬核用户预先做个预警。很久以前,我就放弃了使用 LaTeX 和 DocBook 之类的工具进行写作。为什么?因为对我而言,重点必须放在内容上,而不是过程上。当你面临最后期限时,必须以效率为先。 + +### 非小说类 + +我们将从非虚构写作入手,因为这是两者中较简单的过程。为了编写技术指南,我与不同的编辑人员合作,并且在某些情况下,必须将内容复制/粘贴到 CMS 中。但是就像我的小说一样,整个过程总是从 Google 云端硬盘开始。在这一点上,许多开源纯粹主义者会转身走开。不用担心,你始终可以选择将所有文件保存在本地,也可以使用更开放友好的云服务(例如 [Zoho][1] 或 [nextCloud][2])。 + +为什么要从云端开始?多年来,我发现我需要能够随时随地访问那些内容。最简单的解决方案是迁移到云上。我对丢失工作成果这件事也很偏执。为此,我使用了 [Insync][3] 之类的工具来使我的 Google 云端硬盘与桌面保持同步。有了桌面同步功能,我知道我的工作成果总是有备份,以防万一 Google 云端硬盘出了问题。 + +对于那些我必须与之一起将内容输入到内容管理系统(CMS)的客户,该过程到此结束。我可以直接从 Google 文档复制/粘贴到 CMS 中,并完成此操作。当然,对于技术内容,总是涉及到屏幕截图。为此,我使用 [Gimp][4],它使得截取屏幕截图变得简单: + +![screenshot with Gimp][6] + +*图 1:使用 Gimp 截屏。* + +1. 打开 Gimp。 +2. 单击“文件>创建>屏幕快照”。 +3. 选择单个窗口、整个屏幕或要抓取的区域(图 1)。 +4. 单击“抓取”。 + +我的大多数客户倾向于使用 Google 文档,因为我可以共享文件夹,以便他们可以可靠地访问该内容。我有一些无法使用 Google 文档的客户,因此我必须将文件下载为可以使用的格式。为此,我要做的是下载 .odt 格式,以 [LibreOffice][8] 打开文档(图 2),根据需要设置格式,保存为客户所需的格式,然后发送文档。 + +![Google Doc][10] + +*图 2:在 LibreOffice 中打开我下载的 Google 文档。* + +非小说类作品这样就行了。 + +### 小说类 + +这里会稍微变得有点复杂。开始的步骤是相同的​​,因为我总是在 Google 文档中写小说的每个初稿。完成后,我将文件下载到 Linux 桌面,在 LibreOffice 中打开文件,根据需要设置格式,然后另存为编辑器支持的文件类型(不幸的是,这意味着是 .docx)。 + +该过程的下一步变得有些琐碎。我的编辑更喜欢使用注释来跟踪更改(因为这使我们俩阅读文档和做出更改一样容易)。因此,一个 60k 的 word 文档可以包含成百上千的注释,这会使 LibreOffice 慢的像爬一样。从前,你可以增加用于文档的内存,但是从 LibreOffice 6 开始,这不再可行。这意味着任何较大的、像小说一样长的、带有大量注释的文档都将无法使用。因此,我不得不采取一些极端的措施,使用 [WPS Office][11](图 3)。尽管这不是开源解决方案,但 WPS Office 在文档中包含大量注释的情况下做得很好,因此无需处理 LibreOffice 所带来的麻烦(当处理带有数百个注释的大型文件时)。 + +![comments][13] + +*图 3:WPS 可以轻松处理大量注释。* + +一旦我和我的编辑完成了对书的编辑(所有评论都已删除),我就可以在 LibreOffice 中打开文件进行最终格式化。格式化完成后,我将文件保存为 .html 格式,然后以 [Calibre][14] 打开文件以将文件导出为 .mobi 和 .epub 格式。 + +对于希望在 Amazon、Barnes&Noble、Smashwords 或其他平台上出版的任何人,Calibre 都是必备工具。Caliber 比其他类似解决方案更好地方是,它使你可以直接编辑 .epub 文件(图 4)。对于 Smashword 来说,这是绝对必要的(因为导出过程将添加 Smashwords 转换工具上不接受的元素)。 + +![Calibre][16] + +*图 4:直接在 Calibre 中编辑 epub 文件。* + +写作过程结束后(或有时在等待编辑完成一校时),我将开始为书制作封面。该任务完全在 Gimp 中处理(图 5)。 + +![Using Gimp][19] + +*图 5:在 Gimp 中创建 POTUS 的封面。* + +这样就完成了在 Linux 平台上创建小说的过程。由于文档的篇幅以及某些编辑人员的工作方式,与创建非小说类的过程相比,它可能会变得有些复杂,但这远没有挑战性。实际上,在 Linux 上创建小说与其他平台一样简单(并且更可靠)。 + +### 希望这可以帮助你 + +我希望这可以帮助有抱负的作家有信心在 Linux 平台上进行写作。还有许多其他工具可供使用,但是多年来我在这里列出的工具很好地服务了我。而且,尽管我确实使用了几个专有的工具,但只要它们在 Linux 上都能正常运行,我觉得是可以的。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/learn/2018/11/must-have-tools-writers-linux-platform + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.zoho.com/ +[2]: https://nextcloud.com/ +[3]: https://www.insynchq.com +[4]: https://www.gimp.org/ +[5]: /files/images/writingtools1jpg +[6]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_1.jpg (screenshot with Gimp) +[7]: /licenses/category/used-permission +[8]: https://www.libreoffice.org/ +[9]: /files/images/writingtools2jpg +[10]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_2.jpg (Google Doc) +[11]: https://www.wps.com/en-US/ +[12]: /files/images/writingtools3jpg +[13]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_3.jpg (comments) +[14]: https://calibre-ebook.com/ +[15]: /files/images/writingtools4jpg +[16]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_4.jpg (Calibre) +[17]: /licenses/category/creative-commons-zero +[18]: /files/images/writingtools5jpg +[19]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_5.jpg (Using Gimp) +[20]: https://training.linuxfoundation.org/training/introduction-to-open-source-development-git-and-linux/?utm_source=linux.com&utm_medium=article&utm_campaign=lfd201 diff --git a/published/201911/20190328 Can Better Task Stealing Make Linux Faster.md b/published/201911/20190328 Can Better Task Stealing Make Linux Faster.md new file mode 100644 index 0000000000..338343daee --- /dev/null +++ b/published/201911/20190328 Can Better Task Stealing Make Linux Faster.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11607-1.html) +[#]: subject: (Can Better Task Stealing Make Linux Faster?) +[#]: via: (https://www.linux.com/blog/can-better-task-stealing-make-linux-faster) +[#]: author: (Oracle ) + +更好的任务窃取可以使 Linux 更快吗? +====== + +![](https://img.linux.net.cn/data/attachment/album/201911/23/235729l71755he6e4mpvkq.jpg) + +> Oracle Linux 内核开发人员 Steve Sistare 参与了这场有关内核调度程序改进的讨论。 + +### 通过可扩展的任务窃取进行负载平衡 + +Linux 任务调度程序通过将唤醒的任务推送到空闲的 CPU,以及在 CPU 空闲时从繁忙的 CPU 中拉取任务来平衡整个系统的负载。在大型系统上的推送侧和拉取侧,有效的伸缩都是挑战。对于拉取,调度程序搜索连续的更大范围中的所有 CPU,直到找到过载的 CPU,然后从最繁忙的组中拉取任务。这代价非常昂贵,在大型系统上要花费 10 到 100 微秒,因此搜索时间受到平均空闲时间的限制,并且某些范围不会被搜索。并非总能达到平衡,而且闲置的 CPU 依旧闲置。 + +我实现了一种备用机制,该机制在 `idle_balance()` 中的现有搜索中自身受限并且没有找到之后被调用。我维护了一个过载的 CPU 的位图,当可运行的 CFS 任务计数超过 1 时,CPU 会设置该位。这个位图是稀疏的,每个高速缓存线的有效位数量有限。当许多线程同时设置、清除和访问元素时,这可以减少缓存争用。每个末级缓存都有一个位图。当 CPU 空闲时,它将搜索该位图以查找第一个具有可迁移任务的过载 CPU,然后将其窃取。这种简单的窃取会比单独的 `idle_balance()` 产生更高的 CPU 利用率,因为该搜索的成本很便宜,花费 1 到 2 微秒,因此每次 CPU 即将空闲时都可以调用它。窃取不会减轻全局最繁忙的队列的负担,但是它比根本不执行任何操作要好得多。 + +### 结果 + +偷窃仅在调度程序代码中占用少量 CPU 开销即可提高利用率。在以下实验中,以不同数量的组(每个组 40 个任务)运行 hackbench,并对每次运行结果显示 `/proc/schedstat` 中的增量(按 CPU 平均),并增加了这些非标准的统计信息: + +* `%find`:在旧函数和新函数中花费的时间百分比,这些函数用于搜索空闲的 CPU 和任务以窃取并设置过载的 CPU 位图。 +* `steal`:任务从另一个 CPU 窃取的次数。经过的时间增加了 8% 到 36%,最多增加了 0.4% 的发现时间。 + +![load balancing][1] + +​​如下图的绿色曲线所示,新内核的 CPU 繁忙利用率接近 100%,作为比较的基线内核是橙色曲线: +​​ +![][3] + +根据负载的不同,窃取可将 Oracle 数据库 OLTP 性能提高多达 9%,并且我们已经看到 MySQL、Pgsql、gcc、Java 和网络方面有了一些不错的改进。通常,窃取对上下文切换率高的工作负载最有帮助。 + +### 代码 + +截至撰写本文时,这项工作尚未完成,但最新的修补程序系列位于 [https://lkml.org/lkml/2018/12/6/1253][4]。如果你的内核是使用 `CONFIG_SCHED_DEBUG=y` 构建的,则可以使用以下命令验证其是否包含窃取优化: + +``` +# grep -q STEAL /sys/kernel/debug/sched_features && echo Yes +Yes +``` + +如果要尝试使用,请注意,对于具有 2 个以上 NUMA 节点的系统,禁用了窃取功能,因为 hackbench 在此类系统上发生了回归,正如我在 [https://lkml.org/lkml/2018/12/6/1250][5] 中解释的那样。但是,我怀疑这种影响是特定于 hackbench 的,并且窃取将有助于多节点系统上的其他工作负载。要尝试使用它,请用内核参数 `sched_steal_node_limit=8`(或更大)重新启动。 + +### 进一步工作 + +在将基本盗用算法推向上游之后,我正在考虑以下增强功能: + +* 如果在末级缓存中进行窃取找不到候选者,在 LLC 和 NUMA 节点之间进行窃取。 +* 维护稀疏位图以标识 RT 调度类中的偷窃候选者。当前 `pull_rt_task()` 搜索所有运行队列。 +* 从 `idle_balance()` 中删除核心和套接字级别,因为窃取会处理这些级别。当支持跨 LLC 窃取时,完全删除 `idle_balance()`。 +* 维护位图以标识空闲核心和空闲 CPU,以实现推平衡。 + +这篇文章最初发布于 [Oracle Developers Blog][6]。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/can-better-task-stealing-make-linux-faster + +作者:[Oracle][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/oracle/ +[b]: https://github.com/lujun9972 +[1]: https://lcom.static.linuxfound.org/sites/lcom/files/linux-load-balancing.png (load balancing) +[3]: https://cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/b7a700fe-edc3-4ea0-876a-c91e1850b59b/Image/00c074f4282bcbaf0c10dd153c5dfa76/steal_graph.png +[4]: https://lkml.org/lkml/2018/12/6/1253 +[5]: https://lkml.org/lkml/2018/12/6/1250 +[6]: https://blogs.oracle.com/linux/can-better-task-stealing-make-linux-faster diff --git a/published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md b/published/201911/20190404 Why blockchain (might be) coming to an IoT implementation near you.md similarity index 100% rename from published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md rename to published/201911/20190404 Why blockchain (might be) coming to an IoT implementation near you.md diff --git a/published/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/published/201911/20190610 Why containers and Kubernetes have the potential to run almost anything.md similarity index 100% rename from published/20190610 Why containers and Kubernetes have the potential to run almost anything.md rename to published/201911/20190610 Why containers and Kubernetes have the potential to run almost anything.md diff --git a/published/201911/20190718 What you need to know to be a sysadmin.md b/published/201911/20190718 What you need to know to be a sysadmin.md new file mode 100644 index 0000000000..02361c4766 --- /dev/null +++ b/published/201911/20190718 What you need to know to be a sysadmin.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11608-1.html) +[#]: subject: (What you need to know to be a sysadmin) +[#]: via: (https://opensource.com/article/19/7/be-a-sysadmin) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +你需要知道什么才能成为系统管理员? +====== + +> 通过获得这些起码的能力,开始你的系统管理员职业。 + +![](https://img.linux.net.cn/data/attachment/album/201911/24/103900w5m09jyyyeyrnovu.jpg) + +昔日的系统管理员整天都在调教用户和摆弄服务器,一天的时间都奔波在几百米长的电缆之间。随着云计算、容器和虚拟机的复杂性的增加,而今依然如此。 + +以外行人来看,很难准确确定系统管理员的确切职能,因为他们在许多地方都扮演着一个不起眼的角色。没人能在培训中知道自己工作中所需要的一切知识,但是每个人其实都需要一个坚实的基础。如果你想走上系统管理的道路,那么这是你个人自学或在正式培训中应重点关注的内容。 + +### Bash + +当你学习 Bash Shell 时,你学习的不仅是 Bash Shell,你学习的也是 Linux、BSD、MacOS 甚至Windows(在适当条件下)的通用界面。你将了解语法的重要性,因此可以快速适应思科路由器的命令行或微软 PowerShell 等系统,最终你甚至可以学习更强大的语言,如 Python 或 Go。而且,你还会开始进行程序性思考,以便可以分析复杂的问题并将其分解为单个组件,这很关键,因为这就是系统(例如互联网、组织的内部网、Web 服务器、备份解决方案)是如何设计的。 + +不止于此,还有更多。 + +由于最近 DevOps 和[容器][2]的发展趋势,了解 Bash shell 变得尤为重要。你的系统管理员职业可能会将你带入一个视基础设施为代码的世界,这通常意味着你必须了解脚本编写的基础知识、[基于 YAML][3]配置的结构,以及如何与[容器][5](运行在[沙盒文件][6]内部的微型 Linux 系统)[交互][4]。你会知道 Bash 是高效管理激动人心的开源技术的门户,因此请进入 [Bash][7] 世界吧。 + +#### 资源 + +有很多方法可以在 Bash shell 中进行练习。 + +尝试一下[便携式 Linux 发行版][8]。你无需安装 Linux 即可使用 Linux,因此,请拿一块闲置的 U 盘,花个晚上或周末的空闲时光,来适应基于文本的界面。 + +这里有[几篇很棒的][10] [Bash 文章][9]。 + +要注意的是 Bash 练习的关键在于要练习,你必须有要做的练习才行。而且,在你知道如何使用 Bash 之前,你可能不知道该练习什么。如果是这样,请去 Over The Wire 玩一下 [Bandit][11] 游戏。这是一款针对绝对初学者的游戏,具有 34 个级别的交互式基本技巧,可让你熟悉 Linux shell。 + +### Web 服务器设置 + +一旦你习惯了 Bash,你应该尝试设置一个 Web 服务器。并不是所有的系统管理员都会四处设置 Web 服务器甚至维护 Web 服务器,但是你在安装和启动 HTTP 守护程序、配置 Apache 或 Nginx,设置[正确权限][12]和[配置防火墙][13]时所掌握的技能是你每天都需要使用的技能。经过一些努力,你可能会开始注意到自己的某些工作模式。在尝试管理可用于生产环境的软件和硬件之前,你可能认为某些概念是理所当然的,而你在成为新手的管理员角色时,将不再受到它们的影响。起初这可能会令人沮丧,因为每个人都喜欢在自己做好所做的事情,但这实际上是一件好事。让自己接触新技能,那就是你学习的方式。 + +此外,你在第一步中付出的努力越多,最终当你在默认的 index.html 上看到胜利的“it works!”就越甜蜜! + +#### 资源 + +David Both 撰写了有关 [Apache Web 服务器][14]配置的出色文章。值得一提的是,请逐步阅读他的后续文章,其中介绍了如何在一台计算机上[托管多个站点][15]。 + +### DHCP + +动态主机配置协议(DHCP)是为网络上的设备分配 IP 地址的系统。在家里,ISP(互联网服务提供商)支持的调制解调器或路由器可能内置了 DHCP 服务器,因此可能不在你的权限范围内。如果你曾经登录家用路由器来调整 IP 地址范围或为某些网络设备设置了静态地址,那么你至少对该概念有所了解。你可能会将其理解为对网络上的设备分配了一种 IP 地址形式的电话号码,并且你可能会意识到计算机之间通过广播发送到特定 IP 地址的消息彼此进行通信。消息标头由路径上的路由器读取,每个消息标头都将消息定向到路径上的第二个逻辑路由器,以达到其最终目标。 + +即使你了解了这些概念,要从对 DHCP 的基本了解再进一步是架设 DHCP 服务器。安装和配置自己的 DHCP 服务器可能会导致家庭网络中的 DHCP 冲突(如果可以的话,请尽量避免这样做,因为它肯定会干掉你的网络,直到解决为止),要控制地址的分配、创建子网,并监控连接和租赁时间。 + +更重要的是,设置 DHCP 并尝试不同的配置有助于你了解网络之间的关系。你会了解网络如何在数据传输中表示“分区”,以及必须采取哪些步骤才能将信息从一个网络传递到另一个。这对于系统管理员来说至关重要,因为网络肯定是工作中最重要的方面之一。 + +#### 资源 + +在运行自己的 DHCP 服务器之前,请确保家庭路由器(如果有)中的 DHCP 服务器处于非活动状态。一旦启动并运行了 DHCP 服务器,请阅读 Archit Modi 的[网络命令指南][16],以获取有关如何探索网络的提示。 + +### 网络电缆 + +这听起来很普通,但是熟悉网络电缆的工作方式不仅使你的周末变得非常有趣,而且还使你对数据是如何通过缆线的得到了全新的了解。最好的学习方法是去当地的业余爱好商店并购买五类线剥线钳和压线钳以及一些五类线水晶头。然后回家,拿一根备用的以太网电缆,切断水晶头,花一些时间重新制作网线接头,将电缆重新投入使用。 + +解决了这个难题后,请再做一次,这次创建一条有效的[交叉电缆][17]。 + +你现在应该还在沉迷于有关电缆管理。如果你有些强迫症,喜欢沿着地板线或桌子的边缘整齐地排列电缆,或者将电缆绑在一起以保持它们的整齐有序,那么就可以使自己免受永久混乱的电缆困扰。你一开始可能不会理解这样做的必要性,但是当你第一次走进服务器机房时,你会马上知道原因。 + +### Ansible + +[Ansible][18] 是配置管理软件,它在系统管理员和 DevOps 之间架起了一座桥梁。系统管理员使用 Ansible 来配置全新安装的操作系统并在计算机上维护特定的状态。DevOps 使用 Ansible 减少了在工具上花费的时间和精力,从而在开发上可以花费更多的时间和精力。作为系统管理员培训的一部分,你应该学习 Ansible,并着眼于 DevOps 实践,因为 DevOps 现在开创的大多数功能将最终成为将来系统管理中工作流的一部分。 + +Ansible 的好处是你可以立即开始使用它。它是跨平台的,并且可以向上和向下缩放。对于单用户计算机, Ansible 可能是小题大做,但是话又说回来,Ansible 可能会改变你启动虚拟机的方式,或者可以帮助你同步家庭或[家庭实验室][19]中所有计算机的状态。 + + +#### 资源 + +阅读 Jay LaCroix 的[如何使用 Ansible 管理工作站配置][20]中的典型介绍,以轻松地在日常之中开始使用 Ansible。 + +### 破坏 + +由于用户的错误、软件的错误、管理员(就是你!)的错误以及许多其他因素,计算机上会出现问题。无法预测将要失败的原因,因此你的个人系统管理员培训制度的一部分应该是破坏你设置的系统,直到它们失败为止。你自己的实验室基础设施越是脆弱,发现弱点的可能性就越大。而且,你越是经常修复这些弱点,你对解决问题的能力就越有信心。 + +除了严格设置所有常见的软件和硬件之外,作为系统管理员的主要工作是查找解决方案。有时候,你可能会遇到职位描述之外的问题,甚至可能无法解决,但这完全取决于你的解决方法。 + +现在,你越多地折腾并努力加以解决,则以系统管理员的身份进行的准备就越充分。 + +你是系统管理员吗?你是否希望自己为更好的任务做好准备?在下面的评论中写下它们! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/be-a-sysadmin + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) +[2]: https://opensource.com/article/19/6/kubernetes-dump-truck +[3]: https://www.redhat.com/sysadmin/yaml-tips +[4]: https://opensource.com/article/19/6/how-ssh-running-container +[5]: https://opensource.com/resources/what-are-linux-containers +[6]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[7]: https://opensource.com/article/18/7/admin-guide-bash +[8]: https://opensource.com/article/19/6/linux-distros-to-try +[9]: https://opensource.com/tags/bash +[10]: https://www.redhat.com/sysadmin/managing-files-linux-terminal +[11]: http://overthewire.org/wargames/bandit +[12]: https://opensource.com/article/19/6/understanding-linux-permissions +[13]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd +[14]: https://opensource.com/article/18/2/how-configure-apache-web-server +[15]: https://opensource.com/article/18/3/configuring-multiple-web-sites-apache +[16]: https://opensource.com/article/18/7/sysadmin-guide-networking-commands +[17]: https://en.wikipedia.org/wiki/Ethernet_crossover_cable +[18]: https://opensource.com/sitewide-search?search_api_views_fulltext=ansible +[19]: https://opensource.com/article/19/6/create-centos-homelab-hour +[20]: https://opensource.com/article/18/3/manage-workstation-ansible diff --git a/published/20190801 Linux permissions 101.md b/published/201911/20190801 Linux permissions 101.md similarity index 100% rename from published/20190801 Linux permissions 101.md rename to published/201911/20190801 Linux permissions 101.md diff --git a/published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/published/201911/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md similarity index 100% rename from published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md rename to published/201911/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md diff --git a/published/20190826 How RPM packages are made- the source RPM.md b/published/201911/20190826 How RPM packages are made- the source RPM.md similarity index 100% rename from published/20190826 How RPM packages are made- the source RPM.md rename to published/201911/20190826 How RPM packages are made- the source RPM.md diff --git a/published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/published/201911/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md similarity index 100% rename from published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md rename to published/201911/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md diff --git a/published/20190902 How RPM packages are made- the spec file.md b/published/201911/20190902 How RPM packages are made- the spec file.md similarity index 100% rename from published/20190902 How RPM packages are made- the spec file.md rename to published/201911/20190902 How RPM packages are made- the spec file.md diff --git a/published/20190905 Building CI-CD pipelines with Jenkins.md b/published/201911/20190905 Building CI-CD pipelines with Jenkins.md similarity index 100% rename from published/20190905 Building CI-CD pipelines with Jenkins.md rename to published/201911/20190905 Building CI-CD pipelines with Jenkins.md diff --git a/published/20190906 6 Open Source Paint Applications for Linux Users.md b/published/201911/20190906 6 Open Source Paint Applications for Linux Users.md similarity index 100% rename from published/20190906 6 Open Source Paint Applications for Linux Users.md rename to published/201911/20190906 6 Open Source Paint Applications for Linux Users.md diff --git a/published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/published/201911/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md similarity index 100% rename from published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md rename to published/201911/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md diff --git a/published/201911/20191007 7 Java tips for new developers.md b/published/201911/20191007 7 Java tips for new developers.md new file mode 100644 index 0000000000..c2c90f8679 --- /dev/null +++ b/published/201911/20191007 7 Java tips for new developers.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11620-1.html) +[#]: subject: (7 Java tips for new developers) +[#]: via: (https://opensource.com/article/19/10/java-basics) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +给新手 Java 开发者的 7 点提示 +====== + +> 如果你才刚开始学习 Java 编程,这里有七个你需要知道的基础知识。 + +![](https://img.linux.net.cn/data/attachment/album/201911/28/120421di3744urqnyyr6xi.jpg) + +Java 是一个多功能的编程语言,在某种程度上,它用在几乎所有可能涉及计算机的行业了里。Java 的最大优势是,它运行在一个 Java 虚拟机(JVM)中,这是一个翻译 Java 代码为与操作系统兼容的字节码的层。只要有 JVM 存在于你的操作系统上 —— 不管这个操作系统是在一个服务器(或“[无服务器][2]”,也是同样的)、桌面电脑、笔记本电脑、移动设备,或嵌入式设备 —— 那么,Java 应用程序就可以运行在它上面。 + +这使得 Java 成为程序员和用户的一种流行语言。程序员知道,他们只需要写一个软件版本就能最终得到一个可以运行在任何平台上的应用程序;用户知道,应用程序可以运行在他们的计算机上,而不用管他们使用的是什么样的操作系统。 + +很多语言和框架是跨平台的,但是没有实现同样的抽象层。使用 Java,你针对的是 JVM,而不是操作系统。对于程序员,当面对一些编程难题时,这是阻力最小的线路,但是它仅在当你知道如何编程 Java 时有用。如果你刚开始学习 Java 编程,这里有你需要知道的七个基础的提示。 + +但是,首先,如果你不确定是否你安装了 Java ,你可以在一个终端(例如 [Bash][3] 或 [PowerShell][4])中找出来,通过运行: + +``` +$ java --version +openjdk 12.0.2 2019-07-16 +OpenJDK Runtime Environment 19.3 (build 12.0.2+9) +OpenJDK 64-Bit Server VM 19.3 (build 12.0.2+9, mixed mode, sharing) +``` + +如果你得到一个错误,或未返回任何东西,那么你应该安装 [Java 开发套件][5](JDK)来开始 Java 开发。或者,安装一个 Java 运行时环境(JRE),如果你只是需要来运行 Java 应用程序。 + +### 1、Java 软件包 + +在 Java 语言中,相关的类被分组到一个*软件包*中。当你下载 JDK 时所获得的 Java 基础库将被分组到以 `java` 或 `javax` 开头的软件包中。软件包提供一种类似于计算机上的文件夹的功能:它们为相关的元素提供结构和定义(以编程术语说,*命名空间*)。额外的软件包可以从独立开发者、开源项目和商业供应商获得,就像可以为任何编程语言获得库一样。 + +当你写一个 Java 程序时,你应该在你的代码是顶部声明一个软件包名称。如果你只是编写一个简单的应用程序来入门 Java,你的软件包名称可以简单地用你的项目名称。如果你正在使用一个 Java 集成开发环境,如 [Eclipse][6],当你启动一个新的项目时,它为你生成一个合乎情理的软件包名称。 + +``` +package helloworld; + +/** + * @author seth + * An application written in Java. + */ +``` + +除此之外,你可以通过查找它相对于你的项目整体的路径来确定你的软件包名称。例如,如果你正在写一组类来帮助游戏开发,并且该集合被称为 `jgamer`,那么你可能在其中有一些唯一的类。 + +``` +package jgamer.avatar; + +/** + * @author seth + * An imaginary game library. + */ +``` + +你的软件包的顶层是 `jgamer`,并且在其内部中每个软件包都是一个独立的派生物,例如 `jgamer.avatar` 和 `jgamer.score` 等等。在你的文件系统里,其目录结构反映了这一点,`jgamer` 是包含文件 `avatar.java` 和 `score.java` 的顶级目录。 + +### 2、Java 导入 + +作为一名通晓多种语言的程序员,最大的乐趣是找出是否用 `include`、`import`、`use`、`require`,或一些其它术语来引入你不管使用何种编程语言编写的库。在 Java 中,顺便说一句,当导入你的代码的需要的库时,使用 `import` 关键字。 + +``` +package helloworld; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * @author seth + * A GUI hello world. + */ +``` + +导入是基于该环境的 Java 路径。如果 Java 不知道 Java 库存储在系统上的何处,那么,就不能成功导入。只要一个库被存储在系统的 Java 路径中,那么导入能够成功,并且库能够被用于构建和运行一个 Java 应用程序。 + +如果一个库并不在 Java 路径中(因为,例如,你正在写你自己的库),那么该库可以与你的应用程序绑定在一起(协议许可),以便导入可以按预期地工作。 + +### 3、Java 类 + +Java 类使用关键字 `public class` 声明,以及一个唯一的对应于它的文件名的类名。例如,在项目 `helloworld` 中的一个文件 `Hello.java` 中: + +``` +package helloworld; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * @author seth + * A GUI hello world. + */ + +public class Hello { +        // this is an empty class +} +``` + +你可以在一个类内部声明变量和函数。在 Java 中,在一个类中的变量被称为*字段*。 + +### 4、Java 方法 + +Java 的方法本质上是对象中的函数。基于预期返回的数据类型(例如 `void`、`int`、`float` 等等),它们被定义为 `public`(意味着它们可以被任何其它类访问)或 `private`(限制它们的使用)。 + + +``` + public void helloPrompt(ActionEvent event) { + String salutation = "Hello %s"; + + string helloMessage = "World"; + message = String.format(salutation, helloMessage); + JOptionPane.showMessageDialog(this, message); + } + + private int someNumber (x) { + return x*2; + } +``` + +当直接调用一个方法时,以其类和方法名称来引用。例如,`Hello.someNumber` 指向在 `Hello` 类中的 `someNumber` 方法。 + +### 5、static + +Java 中的 `static` 关键字使代码中的成员可以独立于包含其的对象而被访问。 + +在面向对象编程中,你编写的代码用作“对象”的模板,这些对象在应用程序运行时产生。例如,你不需要编写一个具体的窗口,而是编写基于 Java 中的窗口类的窗口实例(并由你的代码修改)。由于在应用程序生成它的实例之前,你编写的所有代码都不会“存在”,因此在创建它们所依赖的对象之前,大多数方法和变量(甚至是嵌套类)都无法使用。 + +然而,有时,在对象被通过应用程序创建前,你需要访问或使用其中的数据。(例如,除非事先知道球是红色时,应用程序无法生成一个红色的球)。对于这些情况,请使用 `static` 关键字。 + +### 6、try 和 catch + +Java 擅长捕捉错误,但是,只有你告诉它遇到错误时该做什么,它才能优雅地恢复。在 Java 中,尝试执行一个动作的级联层次结构以 `try` 开头,出现错误时回落到 `catch`,并以 `finally` 结束。如果 `try` 子句失败,则将调用 `catch`,最后,不管结果如何,总是由 `finally` 来执行一些合理的动作。这里是一个示例: + +``` +try { + cmd = parser.parse(opt, args); + + if(cmd.hasOption("help")) { + HelpFormatter helper = new HelpFormatter(); + helper.printHelp("Hello ", opt); + System.exit(0); + } + else { + if(cmd.hasOption("shell") || cmd.hasOption("s")) { + String target = cmd.getOptionValue("tgt"); + } // else + } // fi +} catch (ParseException err) { + System.out.println(err); + System.exit(1); + } //catch + finally { + new Hello().helloWorld(opt); + } //finally +} //try +``` + +这是一个健壮的系统,它试图避免无法挽回的错误,或者,至少,为你提供让用户提交有用的反馈的选项。经常使用它,你的用户将会感谢你! + +### 7、运行 Java 应用程序 + +Java 文件,通常以 `.java` 结尾,理论上说,可以使用 `java` 命令运行。然而,如果一个应用程序很复杂,运行一个单个文件是否会产生有意义的结果是另外一个问题。 + +来直接运行一个 `.java` 文件: + +``` +$ java ./Hello.java +``` + +通常,Java 应用程序以 Java 存档(JAR)文件的形式分发,以 `.jar` 结尾。一个 JAR 文件包含一个清单文件(可以指定主类、项目结构的一些元数据),以及运行应用程序所需的所有代码部分。 + +要运行一个 JAR 文件,你可以双击它的图标(取决于你的操作系统设置),你也可以从终端中启动它: + +``` +$ java -jar ./Hello.jar +``` + +### 适合所有人的 Java + +Java 是一种强大的语言,由于有了 [OpenJDK][12] 项目及其它的努力,它是一种开放式规范,允许像 [IcedTea][13]、[Dalvik][14] 和 [Kotlin][15] 项目的茁壮成长。学习 Java 是一种准备在各种行业中工作的好方法,而且,[使用 Java 的理由很多][16]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/java-basics + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://www.redhat.com/en/resources/building-microservices-eap-7-reference-architecture +[3]: https://www.gnu.org/software/bash/ +[4]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 +[5]: http://openjdk.java.net/ +[6]: http://www.eclipse.org/ +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+joptionpane +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+parseexception +[12]: https://openjdk.java.net/ +[13]: https://icedtea.classpath.org/wiki/Main_Page +[14]: https://source.android.com/devices/tech/dalvik/ +[15]: https://kotlinlang.org/ +[16]: https://opensource.com/article/19/9/why-i-use-java diff --git a/published/20191008 5 Best Password Managers For Linux Desktop.md b/published/201911/20191008 5 Best Password Managers For Linux Desktop.md similarity index 100% rename from published/20191008 5 Best Password Managers For Linux Desktop.md rename to published/201911/20191008 5 Best Password Managers For Linux Desktop.md diff --git a/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/published/201911/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md similarity index 100% rename from published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md rename to published/201911/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md diff --git a/published/20191018 How to use Protobuf for data interchange.md b/published/201911/20191018 How to use Protobuf for data interchange.md similarity index 100% rename from published/20191018 How to use Protobuf for data interchange.md rename to published/201911/20191018 How to use Protobuf for data interchange.md diff --git a/published/20191021 How to program with Bash- Syntax and tools.md b/published/201911/20191021 How to program with Bash- Syntax and tools.md similarity index 100% rename from published/20191021 How to program with Bash- Syntax and tools.md rename to published/201911/20191021 How to program with Bash- Syntax and tools.md diff --git a/published/20191022 Initializing arrays in Java.md b/published/201911/20191022 Initializing arrays in Java.md similarity index 100% rename from published/20191022 Initializing arrays in Java.md rename to published/201911/20191022 Initializing arrays in Java.md diff --git a/published/20191023 How to dual boot Windows 10 and Debian 10.md b/published/201911/20191023 How to dual boot Windows 10 and Debian 10.md similarity index 100% rename from published/20191023 How to dual boot Windows 10 and Debian 10.md rename to published/201911/20191023 How to dual boot Windows 10 and Debian 10.md diff --git a/published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/published/201911/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md similarity index 100% rename from published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md rename to published/201911/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md diff --git a/published/20191025 4 cool new projects to try in COPR for October 2019.md b/published/201911/20191025 4 cool new projects to try in COPR for October 2019.md similarity index 100% rename from published/20191025 4 cool new projects to try in COPR for October 2019.md rename to published/201911/20191025 4 cool new projects to try in COPR for October 2019.md diff --git a/published/20191025 How I used the wget Linux command to recover lost images.md b/published/201911/20191025 How I used the wget Linux command to recover lost images.md similarity index 100% rename from published/20191025 How I used the wget Linux command to recover lost images.md rename to published/201911/20191025 How I used the wget Linux command to recover lost images.md diff --git a/published/20191025 Understanding system calls on Linux with strace.md b/published/201911/20191025 Understanding system calls on Linux with strace.md similarity index 100% rename from published/20191025 Understanding system calls on Linux with strace.md rename to published/201911/20191025 Understanding system calls on Linux with strace.md diff --git a/published/20191025 Why I made the switch from Mac to Linux.md b/published/201911/20191025 Why I made the switch from Mac to Linux.md similarity index 100% rename from published/20191025 Why I made the switch from Mac to Linux.md rename to published/201911/20191025 Why I made the switch from Mac to Linux.md diff --git a/published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/published/201911/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md similarity index 100% rename from published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md rename to published/201911/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md diff --git a/published/20191028 SQLite is really easy to compile.md b/published/201911/20191028 SQLite is really easy to compile.md similarity index 100% rename from published/20191028 SQLite is really easy to compile.md rename to published/201911/20191028 SQLite is really easy to compile.md diff --git a/published/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/published/201911/20191029 Collapse OS - An OS Created to Run After the World Ends.md similarity index 100% rename from published/20191029 Collapse OS - An OS Created to Run After the World Ends.md rename to published/201911/20191029 Collapse OS - An OS Created to Run After the World Ends.md diff --git a/published/20191029 Upgrading Fedora 30 to Fedora 31.md b/published/201911/20191029 Upgrading Fedora 30 to Fedora 31.md similarity index 100% rename from published/20191029 Upgrading Fedora 30 to Fedora 31.md rename to published/201911/20191029 Upgrading Fedora 30 to Fedora 31.md diff --git a/published/20191029 What you probably didn-t know about sudo.md b/published/201911/20191029 What you probably didn-t know about sudo.md similarity index 100% rename from published/20191029 What you probably didn-t know about sudo.md rename to published/201911/20191029 What you probably didn-t know about sudo.md diff --git a/published/20191030 Getting started with awk, a powerful text-parsing tool.md b/published/201911/20191030 Getting started with awk, a powerful text-parsing tool.md similarity index 100% rename from published/20191030 Getting started with awk, a powerful text-parsing tool.md rename to published/201911/20191030 Getting started with awk, a powerful text-parsing tool.md diff --git a/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/published/201911/20191030 How to Find Out Top Memory Consuming Processes in Linux.md similarity index 100% rename from published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md rename to published/201911/20191030 How to Find Out Top Memory Consuming Processes in Linux.md diff --git a/published/20191030 Viewing network bandwidth usage with bmon.md b/published/201911/20191030 Viewing network bandwidth usage with bmon.md similarity index 100% rename from published/20191030 Viewing network bandwidth usage with bmon.md rename to published/201911/20191030 Viewing network bandwidth usage with bmon.md diff --git a/published/20191031 Why you don-t have to be afraid of Kubernetes.md b/published/201911/20191031 Why you don-t have to be afraid of Kubernetes.md similarity index 100% rename from published/20191031 Why you don-t have to be afraid of Kubernetes.md rename to published/201911/20191031 Why you don-t have to be afraid of Kubernetes.md diff --git a/published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/published/201911/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md similarity index 100% rename from published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md rename to published/201911/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md diff --git a/published/20191104 Cloning a MAC address to bypass a captive portal.md b/published/201911/20191104 Cloning a MAC address to bypass a captive portal.md similarity index 100% rename from published/20191104 Cloning a MAC address to bypass a captive portal.md rename to published/201911/20191104 Cloning a MAC address to bypass a captive portal.md diff --git a/published/201911/20191104 Fields, records, and variables in awk.md b/published/201911/20191104 Fields, records, and variables in awk.md new file mode 100644 index 0000000000..259bde6f89 --- /dev/null +++ b/published/201911/20191104 Fields, records, and variables in awk.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: (wenwensnow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11611-1.html) +[#]: subject: (Fields, records, and variables in awk) +[#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +awk 中的字段、记录和变量 +====== + +> 这个系列的第二篇,我们会学习字段,记录和一些非常有用的 Awk 变量。 + +![](https://img.linux.net.cn/data/attachment/album/201911/25/090333m34qx395vwtxx5vx.jpg) + +Awk 有好几个变种:最早的 `awk`,是 1977 年 AT&T 贝尔实验室所创。它还有一些重构版本,例如 `mawk`、`nawk`。在大多数 Linux 发行版中能见到的,是 GNU awk,也叫 `gawk`。在大多数 Linux 发行版中,`awk` 和 `gawk` 都是指向 GNU awk 的软链接。输入 `awk`,调用的是同一个命令。[GNU awk 用户手册][2]中,能看到 `awk` 和 `gawk` 的全部历史。 + +这一系列的[第一篇文章][3] 介绍了 `awk` 命令的基本格式: + +``` +$ awk [选项] '模式 {动作}' 输入文件 +``` + +`awk` 是一个命令,后面要接选项 (比如用 `-F` 来定义字段分隔符)。想让 `awk` 执行的部分需要写在两个单引号之间,至少在终端中需要这么做。在 `awk` 命令中,为了进一步强调你想要执行的部分,可以用 `-e` 选项来突出显示(但这不是必须的): + +``` +$ awk -F, -e '{print $2;}' colours.txt +yellow +blue +green +[...] +``` + +### 记录和字段 + +`awk` 将输入数据视为一系列*记录*,通常是按行分割的。换句话说,`awk` 将文本中的每一行视作一个记录。每一记录包含多个*字段*。一个字段由*字段分隔符*分隔开来,字段是记录的一部分。 + +默认情况下,`awk` 将各种空白符,如空格、制表符、换行符等视为分隔符。值得注意的是,在 `awk` 中,多个*空格*将被视为一个分隔符。所以下面这行文本有两个字段: + +``` +raspberry red +``` + +这行也是: + + +``` +tuxedo                  black +``` + +其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录,就有三个字段。其中一个字段可能会是 0 个字节(假设这一字段中不包含隐藏字符) + +``` +a,,b +``` + +### awk 程序 + +`awk` 命令的*程序部分*是由一系列规则组成的。通常来说,程序中每个规则占一行(尽管这不是必须的)。每个规则由一个模式,或一个或多个动作组成: + +``` +模式 { 动作 } +``` + +在一个规则中,你可以通过定义模式,来确定动作是否会在记录中执行。模式可以是简单的比较条件、正则表达式,甚至两者结合等等。 + +这个例子中,程序*只会*显示包含单词 “raspberry” 的记录: + +``` +$ awk '/raspberry/ { print $0 }' colours.txt +raspberry red 99 +``` + +如果没有文本符合模式,该动作将会应用到所有记录上。 + +并且,在一条规则只包含模式时,相当于对整个记录执行 `{ print }`,全部打印出来。 + +Awk 程序本质上是*数据驱动*的,命令执行结果取决于数据。所以,与其他编程语言中的程序相比,它还是有些区别的。 + +### NF 变量 + +每个字段都有指定变量,但针对字段和记录,也存在一些特殊变量。`NF` 变量,能存储 `awk` 在当前记录中找到的字段数量。其内容可在屏幕上显示,也可用于测试。下面例子中的数据,来自上篇文章[文本][3]: + +``` +$ awk '{ print $0 " (" NF ")" }' colours.txt +name       color  amount (3) +apple      red    4 (3) +banana     yellow 6 (3) +[...] +``` + +`awk` 的 `print` 函数会接受一系列参数(可以是变量或者字符串),并将它们拼接起来。这就是为什么在这个例子里,每行结尾处,`awk` 会以一个被括号括起来的整数表示字段数量。 + +### NR 变量 + +另外,除了统计每个记录中的字段数,`awk` 也统计输入记录数。记录数被存储在变量 `NR` 中,它的使用方法和其他变量没有任何区别。例如,为了在每一行开头显示行号: + +``` +$ awk '{ print NR ": " $0 }' colours.txt +1: name       color  amount +2: apple      red    4 +3: banana     yellow 6 +4: raspberry  red    3 +5: grape      purple 10 +[...] +``` + +注意,写这个命令时可以不在 `print` 后的多个参数间添加空格,尽管这样会降低可读性: + +``` +$ awk '{print NR": "$0}' colours.txt +``` + +### printf() 函数 + +为了让输出结果时格式更灵活,你可以使用 `awk` 的 `printf()` 函数。 它与 C、Lua、Bash 和其他语言中的 `printf` 相类似。它也接受以逗号分隔的*格式*参数。参数列表需要写在括号里。 + +``` +$ printf 格式, 项目1, 项目2, ... +``` + +格式这一参数(也叫*格式符*)定义了其他参数如何显示。这一功能是用*格式修饰符*实现的。`%s` 输出字符,`%d` 输出十进制数字。下面的 `printf` 语句,会在括号内显示字段数量: + +``` +$ awk 'printf "%s (%d)\n",$0,NF}' colours.txt +name       color  amount (3) +raspberry  red    4 (3) +banana     yellow 6 (3) +[...] +``` + +在这个例子里,`%s (%d)` 确定了每一行的输出格式,`$0,NF` 定义了插入 `%s` 和 `%d` 位置的数据。注意,和 `print` 函数不同,在没有明确指令时,输出不会转到下一行。出现转义字符 `\n` 时才会换行。 + +### Awk 脚本编程 + +这篇文章中出现的所有 `awk` 代码,都在 Bash 终端中执行过。面对更复杂的程序,将命令放在文件(*脚本*)中会更容易。`-f FILE` 选项(不要和 `-F` 弄混了,那个选项用于字段分隔符),可用于指明包含可执行程序的文件。 + +举个例子,下面是一个简单的 awk 脚本。创建一个名为 `example1.awk` 的文件,包含以下内容: + +``` +/^a/ {print "A: " $0} +/^b/ {print "B: " $0} +``` + +如果一个文件包含 `awk` 程序,那么在给文件命名时,最好写上 `.awk` 的扩展名。 这样命名不是强制的,但这么做,会给文件管理器、编辑器(和你)一个关于文件内容的很有用的提示。 + +执行这一脚本: + +``` +$ awk -f example1.awk colours.txt +A: raspberry  red    4 +B: banana     yellow 6 +A: apple      green  8 +``` + +一个包含 `awk` 命令的文件,在最开头一行加上释伴 `#!`,就能变成可执行脚本。创建一个名为 `example2.awk` 的文件,包含以下内容: + +``` +#!/usr/bin/awk -f +# +# 除了第一行,在其他行前显示行号 +# + +NR > 1 { + printf "%d: %s\n",NR,$0 +} +``` + +可以说,脚本中只有一行,大多数情况下没什么用。但在某些情况下,执行一个脚本,比记住,然后打一条命令要容易的多。一个脚本文件,也提供了一个记录命令具体作用的好机会。以 `#` 号开头的行是注释,`awk` 会忽略它们。 + +给文件可执行权限: + +``` +$ chmod u+x example2.awk +``` + +执行脚本: + +``` +$ ./example2.awk colours.txt +2: apple      red    4 +2: banana     yellow 6 +4: raspberry red    3 +5: grape      purple 10 +[...] +``` + +将 `awk` 命令放在脚本文件中,有一个好处就是,修改和格式化输出会更容易。在终端中,如果能用一行执行多条 `awk` 命令,那么输入多行,才能达到同样效果,就显得有些多余了。 + +### 试一试 + +你现在已经足够了解,`awk` 是如何执行指令的了。现在你应该能编写复杂的 `awk` 程序了。试着编写一个 awk 脚本,它需要: 至少包括一个条件模式,以及多个规则。如果你想使用除 `print` 和 `printf` 以外的函数,可以参考在线 [gawk 手册][4]。 + +下面这个例子是个很好的切入点: + +``` +#!/usr/bin/awk -f +# +# 显示所有记录 除了出现以下情况 +# 如果第一个记录 包含 “raspberry” +# 将 “red” 替换成 “pi” + +$1 == "raspberry" { +        gsub(/red/,"pi") +} + +{ print } +``` + +试着执行这个脚本,看看输出是什么。接下来就看你自己的了。 + +这一系列的下一篇文章,将会介绍更多,能在更复杂(更有用!) 脚本中使用的函数。 + +这篇文章改编自 [Hacker Public Radio][5] 系列,一个技术社区博客。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/fields-records-variables-awk + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_laptop_code_programming_mountain_view.jpg?itok=yx5buqkr (Man at laptop on a mountain) +[2]: https://www.gnu.org/software/gawk/manual/html_node/History.html#History +[3]: https://linux.cn/article-11543-1.html +[4]: https://www.gnu.org/software/gawk/manual/ +[5]: http://hackerpublicradio.org/eps.php?id=2129 diff --git a/published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/published/201911/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md similarity index 100% rename from published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md rename to published/201911/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md diff --git a/published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/published/201911/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md similarity index 100% rename from published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md rename to published/201911/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md diff --git a/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/published/201911/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md similarity index 100% rename from published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md rename to published/201911/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md diff --git a/published/201911/20191107 Demystifying Kubernetes.md b/published/201911/20191107 Demystifying Kubernetes.md new file mode 100644 index 0000000000..f98c0d4387 --- /dev/null +++ b/published/201911/20191107 Demystifying Kubernetes.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11628-1.html) +[#]: subject: (Demystifying Kubernetes) +[#]: via: (https://opensourceforu.com/2019/11/demystifying-kubernetes/) +[#]: author: (Abhinav Nath Gupta https://opensourceforu.com/author/abhinav-gupta/) + +揭开 Kubernetes 的神秘面纱 +====== + +![][2] + +> Kubernetes 是一款生产级的开源系统,用于容器化应用程序的自动部署、扩展和管理。本文关于使用 Kubernetes 来管理容器。 + + “容器”已成为最新的流行语之一。但是,这个词到底意味着什么呢?说起“容器”,人们通常会把它和 Docker 联系起来,Docker 是一个被定义为软件的标准化单元容器。该容器将软件和运行软件所需的环境封装到一个易于交付的单元中。 + +容器是一个软件的标准单元,用它来打包代码及其所有依赖项,这样应用程序就可以从一个计算环境到另一个计算环境快速可靠地运行。容器通过创建类似于 ISO 镜像的方式来实现此目的。容器镜像是一个轻量级的、独立的、可执行的软件包,其中包含运行应用程序所需的所有信息,包括代码、运行时、系统工具、系统库和设置。 + +容器镜像在运行时变成容器,对于 Docker 容器,镜像在 Docker 引擎上运行时变成容器。容器将软件与环境隔离开来,确保不同环境下的实例,都可以正常运行。 + +###什么是容器管理? + +容器管理是组织、添加或替换大量软件容器的过程。容器管理使用软件来自动化创建、部署和扩展容器。这一过程就需要容器编排,容器编排是一个自动对基于容器的应用程序进行部署、管理、扩展、联网和提供可用性的工具。 + +### Kubernetes + +Kubernetes 是一个可移植的、可扩展的开源平台,用于管理容器化的工作负载和服务,它有助于配置和自动化。它最初由 Google 开发,拥有一个庞大且快速增长的生态系统。Kubernetes 的服务、技术支持和工具得到广泛应用。 + +Google 在 2014 年开源了 Kubernetes 项目。Kubernetes 建立在 Google 十五年大规模运行生产工作负载的经验基础上,并结合了社区中最好的想法和实践以及声明式句法的使用。 + +下面列出了与Kubernetes生态系统相关的一些常用术语。 + +**Pod**:Pod 是 Kubernetes 应用程序的基本执行单元,是你创建或部署的 Kubernetes 对象模型中的最小和最简单的单元。Pod 代表在 Kubernetes 集群上运行的进程。 + +Pod 将运行中的容器、存储、网络 IP(唯一)和控制容器应如何运行的命令封装起来。它代表 Kubernetes 生态系统内的单个部署单元,代表一个应用程序的单个实例,该程序可能包含一个或多个紧密耦合并共享资源的容器。 + +Kubernetes 集群中的 Pod 有两种主要的使用方式。第一种是运行单个容器。即“一个容器一个 Pod”,这种方式是最常见的。第二种是运行多个需要一起工作的容器。 + +Pod 可能封装一个由紧密关联且需要共享资源的多个同位容器组成的应用程序。 + +副本集ReplicaSet:副本集的目的是维护在任何给定时间运行的一组稳定的副本容器集。 副本集包含有关一个特定 Pod 应该运行多少个副本的信息。为了创建多个 Pod 以匹配副本集条件,Kubernetes 使用 Pod 模板。副本集与其 Pod 的链接是通过后者的 `metas.ownerReferences` 字段实现,该字段指定哪个资源拥有当前对象。 + +服务Services:服务是一种抽象,用来公开一组 Pod 功能。使用 Kubernetes,你无需修改应用程序即可使用陌生服务发现机制。Kubernetes 给 Pod 提供了其自己的 IP 地址和一组 Pod 的单个 DNS 名称,并且可以在它们之间负载平衡。 + +服务解决的一个主要问题是 Web 应用程序前端和后端的集成。由于 Kubernetes 将幕后的 IP 地址提供给 Pod,因此当 Pod 被杀死并复活时,IP 地址会更改。这给给定的后端 IP 地址连接到相应的前端 IP 地址带来一个大问题。服务通过在 Pod 上提供抽象来解决此问题,类似于负载均衡器。 + +Volumes: Kubernetes 卷具有明确的生命周期,与围绕它的 Pod 相同。 因此,卷超过了 Pod 中运行的任何容器的寿命,并且在容器重新启动后保留了数据。当然,当 Pod 不存在时,该卷也将不再存在。也许比这更重要的是 Kubernetes 支持多种类型的卷,并且 Pod 可以同时使用任意数量的卷。 + +卷的核心只是一个目录,其中可能包含一些数据,Pod 中的容器可以访问该目录。该目录是如何产生的,它后端基于什么存储介质,其中的数据内容是什么,这些都由使用的特定卷类型来决定的。 + +### 为什么选择 Kubernetes? + +容器是捆绑和运行应用程序的好方法。在生产环境中,你需要管理运行应用程序的容器,并确保没有停机时间。例如,如果一个容器发生故障,则需要启动另一个容器。如果由系统自动实现这一操作,岂不是更好? Kubernetes 就是来解决这个问题的!Kubernetes 提供了一个框架来弹性运行分布式系统。该框架负责扩展需求、故障转移、部署模式等。例如,Kubernetes 可以轻松管理系统的金丝雀部署。 + +Kubernetes 为用户提供了: + +1. 服务发现和负载平衡 +2. 存储编排 +3. 自动退出和回退 +4. 自动打包 +5. 自我修复 +6. 秘密配置管理 + +### Kubernetes 可以做什么? + +在本文中,我们将会看到一些从头构建 Web 应用程序时如何使用 Kubernetes 的代码示例。我们将在 Python 中使用 Flask 创建一个简单的后端服务器。 + +对于那些想从头开始构建 Web 应用程序的人,有一些前提条件,即: + +1. 对 Docker、Docker 容器和 Docker 镜像的基本了解。可以访问[这里][8]快速了解。 +2. 系统中应该安装 Docker。 +3. 系统中应该安装 Kubernetes,有关如何在本地计算机上安装的说明,请访问[这里][9]。 + +现在,创建一个目录,如下代码片段所示: + +``` +mkdir flask-kubernetes/app && cd flask-kubernetes/app +``` + +接下来,在 `flask-kubernetes/app` 目录中,创建一个名为 `main.py` 的文件,如下面的代码片段所示: + +``` +touch main.py +``` + +在新创建的 `main.py` 文件中,粘贴下面代码: + +``` +from flask import Flask +app = Flask(__name__) + +@app.route("/") +def hello(): + return "Hello from Kubernetes!" + +if __name__ == "__main__": + app.run(host='0.0.0.0') +``` + +使用下面命令在本地安装 Flask: + +``` +pip install Flask==0.10.1 +``` + +Flask 安装后,执行下面的命令: + +``` +python app.py +``` + +应该在本地 5000 端口运行 Flask 服务器,这是 Flask 应用程序的默认端口,并且你可以在 http://localhost:5000 上看到输出 “Hello from Kubernetes!”。服务器在本地运行之后,我们创建一个供 Kubernetes 使用的 Docker 镜像。创建一个名为 `Dockerfile` 的文件,并将以下代码片段粘贴到其中: + +``` +FROM python:3.7 + +RUN mkdir /app +WORKDIR /app +ADD . /app/ +RUN pip install -r requirements.txt + +EXPOSE 5000 +CMD ["python", "/app/main.py"] +``` + +`Dockerfile` 文件的说明如下: + +1. Docker 将从 DockerHub 获取 Python 3.7 镜像。 +2. 将在镜像中创建一个应用程序目录。 +3. 它将一个 `/app` 目录设置为工作目录。 +4. 将内容从主机中的应用程序目录复制到镜像应用程序目录。 +5. 发布端口 5000。 +6. 最后,它运行命令,启动 Flask 服务器。 + +接下来,我们将使用以下命令创建 Docker 镜像: + +``` +docker build -f Dockerfile -t flask-kubernetes:latest . +``` + +创建 Docker 镜像后,我们可以使用以下命令在本地运行该镜像进行测试: + +``` +docker run -p 5001:5000 flask-kubernetes +``` + +通过运行容器在本地完成测试之后,我们需要在 Kubernetes 中部署它。我们将首先使用 `kubectl` 命令验证 Kubernetes 是否正在运行。如果没有报错,则说明它正在工作。如果有报错,请参考[该信息][9]。 + +接下来,我们创建一个部署文件。这是一个 Yaml 文件,其中包含有关 Kubernetes 的说明,该说明涉及如何以声明性的方式创建 Pod 和服务。因为我们有 Flask Web 应用程序,我们将创建一个 `deployment.yaml` 文件,并在其中包含 Pod 和服务声明。 + +创建一个名为 `deployment.yaml` 的文件并向其中添加以下内容,然后保存: + +``` +apiVersion: v1 +kind: Service +metadata: + name: flask-kubernetes -service +spec: + selector: + app: flask-kubernetes + ports: + - protocol: "TCP" + port: 6000 + targetPort: 5000 + type: LoadBalancer + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: flask-kubernetes +spec: + replicas: 4 + template: + metadata: + labels: + app: flask-kubernetes + spec: + containers: + - name: flask-kubernetes + image: flask-kubernetes:latest + imagePullPolicy: Never + ports: + - containerPort: 5000 +``` + +使用以下命令将 yaml 文件发送到 Kubernetes: + +``` +kubectl apply -f deployment.yaml +``` + +如果执行以下命令,你会看到 Pod 正在运行: + +``` +kubectl get pods +``` + +现在,导航至 http://localhost:6000,你应该会看到 “Hello from Kubernetes!”消息。成功了! 该应用程序现在正在 Kubernetes 中运行! + +### Kubernetes 做不了什么? + +Kubernetes 不是一个传统的,包罗万象的 PaaS(平台即服务)系统。 由于 Kubernetes 运行在容器级别而非硬件级别,因此它提供了 PaaS 产品共有的一些普遍适用功能,如部署、扩展、负载平衡、日志记录和监控。Kubernetes 为开发人员平台提供了构建块,但在重要的地方保留了用户的选择和灵活性。 + +* Kubernetes 不限制所支持的应用程序的类型。如果应用程序可以在容器中运行,那么它应该可以在 Kubernetes 上更好地运行。 +* 它不部署和构建源代码。 +* 它不决定日志记录、监视或警报解决方案。 +* 它不提供或不要求配置语言/系统。它提供了一个声明式的 API 供所有人使用。 +* 它不提供或不采用任何全面的机器配置、维护、管理或自我修复系统。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ + +作者:[Abhinav Nath Gupta][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/abhinav-gupta/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?resize=696%2C457&ssl=1 (Gear kubernetes) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?fit=800%2C525&ssl=1 +[3]: https://secure.gravatar.com/avatar/f65917facf5f28936663731fedf545c4?s=100&r=g +[4]: https://opensourceforu.com/author/abhinav-gupta/ +[5]: mailto:abhi.aec89@gmail.com +[6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png +[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US +[8]: https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf +[9]: https://kubernetes.io/docs/setup/learning-environment/minikube/ diff --git a/published/20191107 How to add a user to your Linux desktop.md b/published/201911/20191107 How to add a user to your Linux desktop.md similarity index 100% rename from published/20191107 How to add a user to your Linux desktop.md rename to published/201911/20191107 How to add a user to your Linux desktop.md diff --git a/published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/published/201911/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md similarity index 100% rename from published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md rename to published/201911/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md diff --git a/published/20191108 7 Best Open Source Tools that will help in AI Technology.md b/published/201911/20191108 7 Best Open Source Tools that will help in AI Technology.md similarity index 100% rename from published/20191108 7 Best Open Source Tools that will help in AI Technology.md rename to published/201911/20191108 7 Best Open Source Tools that will help in AI Technology.md diff --git a/published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/published/201911/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md similarity index 100% rename from published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md rename to published/201911/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md diff --git a/published/20191108 How to manage music tags using metaflac.md b/published/201911/20191108 How to manage music tags using metaflac.md similarity index 100% rename from published/20191108 How to manage music tags using metaflac.md rename to published/201911/20191108 How to manage music tags using metaflac.md diff --git a/published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/published/201911/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md similarity index 100% rename from published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md rename to published/201911/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md diff --git a/published/20191112 Getting started with PostgreSQL.md b/published/201911/20191112 Getting started with PostgreSQL.md similarity index 100% rename from published/20191112 Getting started with PostgreSQL.md rename to published/201911/20191112 Getting started with PostgreSQL.md diff --git a/published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/published/201911/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md similarity index 100% rename from published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md rename to published/201911/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md diff --git a/published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/published/201911/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md similarity index 100% rename from published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md rename to published/201911/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md diff --git a/published/20191114 Cleaning up with apt-get.md b/published/201911/20191114 Cleaning up with apt-get.md similarity index 100% rename from published/20191114 Cleaning up with apt-get.md rename to published/201911/20191114 Cleaning up with apt-get.md diff --git a/published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/published/201911/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md similarity index 100% rename from published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md rename to published/201911/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md diff --git a/published/20191114 Red Hat Responds to Zombieload v2.md b/published/201911/20191114 Red Hat Responds to Zombieload v2.md similarity index 100% rename from published/20191114 Red Hat Responds to Zombieload v2.md rename to published/201911/20191114 Red Hat Responds to Zombieload v2.md diff --git a/published/20191115 Developing a Simple Web Application Using Flutter.md b/published/201911/20191115 Developing a Simple Web Application Using Flutter.md similarity index 100% rename from published/20191115 Developing a Simple Web Application Using Flutter.md rename to published/201911/20191115 Developing a Simple Web Application Using Flutter.md diff --git a/published/201911/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/published/201911/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..be7b3f9d4f --- /dev/null +++ b/published/201911/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11627-1.html) +[#]: subject: (How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 +====== + +![](https://img.linux.net.cn/data/attachment/album/201911/30/095031gbnm59ux0dw979wb.jpg) + +VirtualBox 是一款自由开源的虚拟化工具,它允许技术人员同时运行多个不同风格的虚拟机(VM)。它通常用于运行桌面(Linux 和 Windows),当人们尝试探索新的 Linux 发行版的功能或希望在 VM 中安装 OpenStack、Ansible 和 Puppet 等软件时,它会非常方便,在这种情况下,我们可以使用 VirtualBox 启动 VM。 + +VirtualBox 被分类为 2 类虚拟机管理程序,这意味着它需要一个现有的操作系统,在上面安装 VirtualBox 软件。VirtualBox 提供功能来创建本机网络或 NAT 网络。在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 系统上安装最新版本的 VirtualBox 6.0,并演示如何安装 VirtualBox 扩展。 + +### 在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 的安装步骤 + +#### 步骤 1: 启用 VirtualBox 和 EPEL 仓库 + +登录到你的 CentOS 8 或 RHEL 8 系统并打开终端,执行以下命令并启用 VirtualBox 和 EPEL 包仓库: + +``` +[root@linuxtechi ~]# dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo +``` + +使用以下 `rpm` 命令导入 Oracle VirtualBox 公钥: + +``` +[root@linuxtechi ~]# rpm --import https://www.virtualbox.org/download/oracle_vbox.asc +``` + +使用以下 `dnf` 命令启用 EPEL 仓库: + +``` +[root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y +``` + +#### 步骤 2: 安装 VirtualBox 构建工具和依赖项 + +运行以下命令来安装所有 VirtualBox 构建工具和依赖项: + +``` +[root@linuxtechi ~]# dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y +``` + +成功安装上面的依赖项和构建工具后,使用 `dnf` 命令继续安装 VirtualBox。 + +#### 步骤 3: 在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 + +如果希望在安装之前列出 VirtualBox 的可用版本,请执行以下 dnf 命令: + +``` +[root@linuxtechi ~]# dnf search virtualbox +Last metadata expiration check: 0:14:36 ago on Sun 17 Nov 2019 04:13:16 AM GMT. +=============== Summary & Name Matched: virtualbox ===================== +VirtualBox-5.2.x86_64 : Oracle VM VirtualBox +VirtualBox-6.0.x86_64 : Oracle VM VirtualBox +[root@linuxtechi ~]# +``` + +让我们使用以下 `dnf` 命令安装最新版本的 VirtualBox 6.0: + +``` +[root@linuxtechi ~]# dnf install VirtualBox-6.0 -y +``` + +如果有本地用户希望将 usb 设备连接到 VirtualBox VM,那么他/她应该是 `vboxusers` 组的一员,请使用下面的 `usermod` 命令将本地用户添加到 `vboxusers` 组。 + + +``` +[root@linuxtechi ~]# usermod -aG vboxusers pkumar +``` + +#### 步骤 4: 访问 CentOS 8 / RHEL 8 上的 VirtualBox + +有两种方法可以访问 VirtualBox,在命令行输入 `virtualbox` 然后回车: + +``` +[root@linuxtechi ~]# virtualbox +``` + +在桌面环境中,在搜索框中搜索 “VirtualBox”。 + +![Access-VirtualBox-CentOS8][3] + +单击 VirtualBox 图标: + +![VirtualBox-CentOS8][4] + +这确认 VirtualBox 6.0 已成功安装,让我们安装它的扩展包。 + +#### 步骤 5: 安装 VirtualBox 6.0 扩展包 + +顾名思义,VirtualBox 扩展包用于扩展 VirtualBox 的功能。它添加了以下功能: + + * USB 2.0 和 USB 3.0 支持 + * 虚拟 RDP(VRDP) + * 磁盘镜像加密 + * Intel PXE 启动 + * 主机网络摄像头 + +使用下面的 `wget` 命令下载 Virtualbox 扩展包到下载文件夹中: + +``` +[root@linuxtechi ~]$ cd Downloads/ +[root@linuxtechi Downloads]$ wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack +``` + +下载后,打开 VirtualBox 并依次点击 “File -> Preferences -> Extension”,然后点击 “+” 号图标添加下载的扩展包: + +![Install-VirtualBox-Extension-Pack-CentOS8][5] + +单击 “Install” 开始安装扩展包: + +![Accept-VirtualBox-Extension-Pack-License-CentOS8][6] + +单击 “I Agree” 接受 VirtualBox 扩展包许可证。 + +成功安装 VirtualBox 扩展包后,我们将看到下面的页面,单击 “OK” 并开始使用 VirtualBox。 + +![VirtualBox-Extension-Pack-Install-Message-CentOS8][7] + +本文就是这些了,我希望这些步骤可以帮助你在 CentOS 8 和 RHEL 8 系统上安装 VirtualBox 6.0。请分享你的宝贵的反馈和意见。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/dnf-command-examples-rpm-management-fedora-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Access-VirtualBox-CentOS8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-CentOS8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-VirtualBox-Extension-Pack-CentOS8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Accept-VirtualBox-Extension-Pack-License-CentOS8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-Extension-Pack-Install-Message-CentOS8.jpg +[9]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&t=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 +[10]: http://twitter.com/share?text=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&via=Linuxtechi +[11]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 +[12]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 diff --git a/published/20191118 How containers work- overlayfs.md b/published/201911/20191118 How containers work- overlayfs.md similarity index 100% rename from published/20191118 How containers work- overlayfs.md rename to published/201911/20191118 How containers work- overlayfs.md diff --git a/published/201911/20191119 How to use pkgsrc on Linux.md b/published/201911/20191119 How to use pkgsrc on Linux.md new file mode 100644 index 0000000000..8ca44c9dcc --- /dev/null +++ b/published/201911/20191119 How to use pkgsrc on Linux.md @@ -0,0 +1,204 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11613-1.html) +[#]: subject: (How to use pkgsrc on Linux) +[#]: via: (https://opensource.com/article/19/11/pkgsrc-netbsd-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux 上使用 pkgsrc +====== + +> NetBSD 的软件包管理器通用、灵活又容易。下面是如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/201911/26/064538fbktfzxba18wykde.jpg) + +NetBSD 以能在几乎所有平台上运行而闻名,但你知道它*第二*有名的 [pkgsrc][2] 包管理器吗?像 NetBSD 一样,pkgsrc 基本上可以在任何系统上运行,或者至少在任意 Unix 和类 Unix 的系统上上运行。你可以在 BSD、Linux、Illumos、Solaris 和 Mac 上安装 pkgsrc。它总共支持 20 多种操作系统。 + +### 为什么使用 pkgsrc? + +除了 MacOS 之外,所有 Unix 操作系统均自带包管理器。你不一定*需要* pkgsrc,但这可能是你想尝试的三个重要原因: + +* **打包**。如果你对打包感到好奇,但尚未尝试自己创建一个软件包,那么 pkgsrc 是一个相对简单的系统,尤其是如果你已经熟悉 Makefile 和类似 [GNU Autotools][3] 之类的构建系统时。 +* **通用**。如果你使用多个操作系统或发行版,那么可能会遇到每个系统的包管理器。你可以在不同的系统上使用 pkgsrc,以便你为一个系统打包了程序,就为所有系统打包了。 +* **灵活**。在许多打包系统中,如何选择二进制包或源码包并不总是很明显。使用 pkgsrc,区别很明显,两种安装方法都一样容易,并且都可以为你解决依赖关系。 + +### 如何安装 pkgsrc + +无论你使用的是 BSD、Linux、Illumos、Solaris 还是 MacOS,安装过程都基本相同: + +1. 使用 CVS 检出 pkgsrc 树 +2. 引导 pkgsrc 系统 +3. 安装软件包 + +#### 使用 CVS 检出 pkgsrc 树 + +在 Git 和 Subversion 之前,就有了 [CVS][4]。要检出代码你无需了解 CVS 太多,如果你习惯 Git,那么可以将检出checkout称为克隆clone。当你用 CVS 检出 pkgsrc 时,你就下载了详细说明如何构建每个软件包的“配方recipes”。它有很多文件,但是它们都很小,因为你实际上并没有拉取每个包的源码,而只有按需构建时需要的构建基础架构和 Makefile。使用 CVS,你可以轻松地在新版本发布时更新 pkgsrc 检出。 + +pkgsrc 文档建议将其源码树放在 `/usr` 目录下,因此你必须使用 `sudo`(或成为 root)运行此命令: + +``` +$ cd /usr +$ sudo cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2019Q3 -P pkgsrc +``` + +在我撰写本文时,最新版本是 2019Q3。请检查 [pkgsrc.org][6] 主页的新闻部分或 [NetBSD文档][7],以确定最新版本。 + +#### 引导 pkgsrc + +pkgsrc 树复制到你的计算机后,你会看到一个充满构建脚本的 `/usr/pkgsrc` 目录。在使用之前,你必须引导 pkgsrc,以便你可以轻松地访问构建和安装软件所需的相关命令。 + +引导 pkgsrc 的方式取决于你所使用操作系统。 + +对于 NetBSD,你只需使用捆绑的引导器: + +``` +# cd pkgsrc/bootstrap +# ./bootstrap +``` + +在其他系统上,还有更好的方法,包括一些自定义功能,它是由 Joyent 提供的。要了解运行的确切命令,请访问 [pkgsrc.joyent.com][8]。比如,在 Linux(Fedora、Debian、Slackware 等)上: + +``` +$ curl -O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/bootstrap-trunk-x86_64-20170127.tar.gz +$ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" +``` + +尽管路径暗示文件适用于 RHEL 7,但二进制文件往往与所有(最前沿的 Linux 发行版)兼容。如果你发现二进制文件与你的发行版不兼容,你可以选择从源码构建。 + +验证 SHA1 校验和: + +``` +$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum +sha1sum -c check-shasum +``` + +你还可以验证 PGP 签名: + +``` +$ curl -O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/bootstrap-trunk-x86_64-20170127.tar.gz.asc +$ curl -sS https://pkgsrc.joyent.com/pgp/56AAACAF.asc | gpg --import +$ gpg --verify ${BOOTSTRAP_TAR}{.asc,} +``` + +当你确认你已有正确的引导套件,将其安装到 `/usr/pkg`: + +``` +sudo tar -zxpf ${BOOTSTRAP_TAR} -C / +``` + +它为你提供了通常的 pkgsrc 命令。将这些位置添加到[你的 PATH 环境变量中][9]: + +``` +$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc +$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc +``` + +如果你宁愿使用 pkgsrc 而不依赖于 Joyent 的构建,那么只需运行 pkgsrc 源码树的引导脚本即可。在运行特定于系统的脚本之前,请先阅读 `bootstrap` 目录中相关 `README` 文件。 + +![Bootstrapping pkgsrc on NetBSD][10] + +### 如何使用 pkgsrc 安装软件 + +使用 pkgsrc 安装预编译的二进制文件(就像使用 DNF 或 Apt 一样)是很容易的。二进制安装的命令是 `pgkin`,它有自己的专门网站 [pkgin.net][11]。对于任何用过 Linux 的人来说,这个过程应该感觉相当熟悉。 + +要搜索 `tmux` 包: + +``` +$ pkgin search tmux +``` + +要安装 tmux 包: + +``` +$ sudo pkgin install tmux +``` + +`pkgin` 命令的目的是模仿典型的 Linux 包管理器的行为,因此有选项可以列出可用的包、查找包提供的特定可执行文件,等等。 + +### 如何使用 pkgsrc 从源码构建 + +然而,pkgsrc 真正强大的地方是方便地从源码构建包。你在第一步中检出了所有 20000 多个构建脚本,你可以直接进入 pkgsrc 源码树来访问这些脚本。 + +例如,要从源码构建 `tcsh`,首先找到构建脚本: + +``` +$ find /usr/pkgsrc -type d -name "tcsh" +/usr/pkgsrc/shells/tcsh +``` + +接下来,进入源码目录: + +``` +$ cd /usr/pgksrc/shells/tcsh +``` + +构建脚本目录包含许多文件来帮助在你的系统上构建应用,但值得注意的是,这里面有包含了软件说明的 `DESCR` 文件,以及触发构建的 `Makefile`。 + +``` +$ ls +CVS    DESCR     Makefile +PLIST  distinfo  patches +$ cat DESCR +TCSH is an extended C-shell with many useful features like +filename completion, history editing, etc. +$ +``` + +准备就绪后,构建并安装: + +``` +$ sudo bmake install +``` + +pkgsrc 系统使用 `bmake` 命令(在第一步检出 pkgsrc 后提供),因此请务必使用 `bmake`(而不是出于习惯使用 `make`)。 + +如果要为多个系统构建,那么你可以创建一个包,而不是立即安装: + +``` +$ cd /usr/pgksrc/shells/tcsh +$ sudo bmake package +[...] +=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +``` + +pkgsrc 创建的包是标准的 tarball,但它可以方便地通过 `pkg_add` 安装: + +``` +$ sudo pkg_add /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +tcsh-X.Y.Z: adding /usr/pkg/bin/tcsh to /etc/shells +$ tcsh +localhost% +``` + +pkgsrc 的 pkgtools 集合提供 `pkg_add`、`pkg_info`、`pkg_admin`、`pkg_create` 和 `pkg_delete` 命令,来帮助管理你在系统上构建和维护软件包。 + +### pkgsrc,易于管理 + +pkgsrc 系统提供了直接,容易上手的软件包管理方法。如果你正在寻找一个不妨碍你并且可以定制的包管理器,请在任何运行 Unix 或类 Unix 的系统上试试 pkgsrc。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/pkgsrc-netbsd-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: http://pkgsrc.org +[3]: https://opensource.com/article/19/7/introduction-gnu-autotools +[4]: http://www.netbsd.org/developers/cvs-repos/cvs_intro.html#intro +[5]: mailto:anoncvs@anoncvs.NetBSD.org +[6]: http://pkgsrc.org/ +[7]: http://www.netbsd.org/docs/pkgsrc/getting.html +[8]: http://pkgsrc.joyent.com/ +[9]: https://opensource.com/article/17/6/set-path-linux +[10]: https://opensource.com/sites/default/files/uploads/pkgsrc-bootstrap.jpg (Bootstrapping pkgsrc on NetBSD) +[11]: http://pkgin.net diff --git a/published/201911/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/published/201911/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md new file mode 100644 index 0000000000..e40aebfa8d --- /dev/null +++ b/published/201911/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11619-1.html) +[#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) +[#]: via: (https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +如何使用 TimeShift 备份和还原 Ubuntu Linux +====== + +你是否曾经想过如何备份和还原 Ubuntu 或 Debian 系统?Timeshift 是一款自由开源工具,可让你创建文件系统的增量快照。你可以使用 RSYNC 或 BTRFS 两种方式创建快照。 + +![](https://img.linux.net.cn/data/attachment/album/201911/27/235959fejmb080e7z0jnu0.jpg) + +让我们深入研究并安装 Timeshift。在本教程,我们将安装在 Ubuntu 18.04 LTS 系统上。 + +### 在 Ubuntu / Debian Linux 上安装 TimeShift + +TimeShift 尚未正式托管在 Ubuntu 和 Debian 仓库中。考虑到这一点,我们将运行以下命令来添加 PPA: + +``` +# add-apt-repository -y ppa:teejee2008/ppa +``` + +![Add timeshift repository][3] + +接下来,使用以下命令更新系统软件包: + +``` +# apt update +``` + +成功更新系统后,使用以下 `apt` 命令安装 Timeshift: + +``` +# apt install timeshift +``` + +![apt install timeshift][4] + +### 准备备份存储设备 + +最佳实践要求我们将系统快照保存在系统硬盘之外的单独的存储卷上。对于本指南,我们将使用 16GB 闪存作为第二个驱动器,并在该驱动器上保存快照。 + +``` +# lsblk | grep sdb +``` + +![lsblk sdb ubuntu][5] + +为了将闪存用作快照的备份位置,我们需要在设备上创建一个分区表。运行以下命令: + +``` +# parted /dev/sdb mklabel gpt +# parted /dev/sdb mkpart primary 0% 100% +# mkfs.ext4 /dev/sdb1 +``` + +![create partition table on drive ubuntu][6] + +在 USB 闪存上创建分区表后,我们可以开始创建文件系统的快照! + +### 使用 Timeshift 创建快照 + +要启动 Timeshift,使用应用程序菜单搜索 “Timeshift”。 + +![Access timeshift][7] + +单击 Timeshift 图标,系统将提示你输入管理员密码。提供密码,然后单击验证。 + +![Authentication required][8] + +接下来,选择你喜欢的快照类型。 + +![Select rsync option][9] + +点击 “Next”。选择快照的目标驱动器。在这里,我的位置是标记为 `/dev/sdb` 的外部 USB 驱动器。 + +![Select snapshot location][10] + +接下来,定义快照级别。级别是指创建快照的时间间隔。你可以选择每月、每周、每天或每小时的快照级别。 + +![Select snapshot levels][11] + +点击 “Finish”。 + +在下一个窗口中,单击 “Create” 按钮开始创建快照。此后,系统将开始创建快照。 + +![Create snapshot][12] + +最后,你的快照将显示如下: + +![Snapshot created][13] + +### 从快照还原 Ubuntu / Debian + +创建系统快照后,现在让我们看看如何从同一快照还原系统。在同一个 Timeshift 中,单击快照,然后单击 “Restore” 按钮,如图所示。 + +![Restore snapshot][14] + +接下来,将提示你选择目标设备。保留默认选择,然后点击 “Next”。 + +![Select target device][15] + +恢复过程开始之前,Timeshift 将会试运行。 + +![Comparing files dry run][16] + +在下一个窗口中,点击 “Next” 按钮确认显示的操作。 + +![Confirm actions][17] + +如图所示,你会看到警告和免责声明。点击 “Next” 初始化恢复过程。 + +此后,将开始还原过程,最后,系统之后将重新启动到快照定义的早期版本。 + +![Restoring snapshot][18] + +### 总结 + +如你所见,使用 TimeShift 从快照还原系统非常容易。在备份系统文件时,它非常方便,并允许你在系统故障时进行恢复。因此,不要害怕修改系统或弄乱系统。TimeShift 使你能够返回到一切运行平稳的时间点。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ + +作者:[James Kiarie][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/TimeShift-Backup-Restore-Tool-Ubuntu.png +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Add-timeshift-repository.png +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/apt-install-timeshift.png +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/lsblk-sdb-ubuntu.png +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/create-partition-table-on-drive-ubuntu.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Access-Timeshift-Ubuntu.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Authentication-required-ubuntu.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-Rsync-option-timeshift.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-snapshot-location.png +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-snapshot-levels-Timeshift.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Create-snapshot-timeshift.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Snapshot-created-TimeShift.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Restore-snapshot-timeshift.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-target-device-timeshift.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Comparing-files-Dry-Run-timeshift.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Confirm-actions-timeshift.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Restoring-snapshot-timeshift.png diff --git a/published/201911/20191120 How to install Java on Linux.md b/published/201911/20191120 How to install Java on Linux.md new file mode 100644 index 0000000000..db94ace738 --- /dev/null +++ b/published/201911/20191120 How to install Java on Linux.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11614-1.html) +[#]: subject: (How to install Java on Linux) +[#]: via: (https://opensource.com/article/19/11/install-java-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux 上安装 Java +====== + +> 在桌面上拥抱 Java 应用程序,然后在所有桌面上运行它们。 + +![](https://img.linux.net.cn/data/attachment/album/201911/26/065307hk22caubakkos0u0.jpg) + +无论你运行的是哪种操作系统,通常都有几种安装应用程序的方法。有时你可能会在应用程序商店中找到一个应用程序,或者使用 Fedora 上的 DNF 或 Mac 上的 Brew 这样的软件包管理器进行安装,而有时你可能会从网站上下载可执行文件或安装程序。因为 Java 是这么多流行的应用程序的后端,所以最好了解安装它的不同方法。好消息是你有很多选择,本文涵盖了所有这些内容。 + +坏消息是 Java *太大*,我说的不仅仅是文件大小。Java 是一种开放源代码语言和规范,这意味着从理论上讲,任何人都可以创建它的实现版本。这意味着,在安装任何东西之前,必须确定要安装的 Java 发行版。 + +### 我需要 JVM 还是 JRE 或者 JDK? + +Java 大致分为两个下载类别。Java 虚拟机Java Virtual Machine(JVM)是运行时组件;它是使 Java 应用程序能够在计算机上启动和运行的“引擎”。它包含在 Java 运行时环境Java Runtime Environment(JRE)中。 + +Java 开发工具包Java Development Kit(JDK)是一个开发工具包:你可以将其视为一个车库,修理工可以坐在那里进行调整、修理和改进。JDK 包含 Java 运行时环境(JRE)。 + +以下载来说,这意味着: + +* 如果你是希望运行 Java 应用程序的用户,则只需 JRE(包括了 JVM)。 +* 如果你是希望使用 Java 进行编程的开发人员,则需要 JDK(包括 JRE 库,而 JRE 库又包括 JVM)。 +   +### OpenJDK、IcedTea 和 OracleJDK 有什么不同? + +当太阳微系统Sun Microsystems被 Oracle 收购时,Java 是该交易的主要部分。幸运的是,Java 是一种开源技术,因此,如果你对 Oracle 维护该项目的方式不满意,则可以选择其他方法。Oracle 将专有组件与 Java 下载捆绑在一起,而 OpenJDK 项目是完全开源的。 + +IcedTea 项目本质上是 OpenJDK,但其目标是使用户在使用完全自由开源的工具时更容易构建和部署 OpenJDK。 + +(LCTT 译注:阿里巴巴也有一个它自己维护的 Open JDK 发行版“龙井Dragonwell”。以下引自其官网:“Alibaba Dragonwell 是一款免费的,生产就绪型 Open JDK 发行版,提供长期支持,包括性能增强和安全修复。……Alibaba Dragonwell 作为 Java 应用的基石,支撑了阿里经济体内所有的 Java 业务。Alibaba Dragonwell 完全兼容 Java SE 标准,……”) + +### 我应该安装哪个 Java? + +如果你对这些选择感到不知所措,那么简单的答案就是你应该安装的 Java 实现应该是最容易安装的那个。当应用程序告诉你需要 Java 12,但你的存储库中只有 Java 8 时,可以安装可以从可靠来源中找到的 Java 12 的任何实现。在 Linux 上,你可以一次安装几个不同版本的 Java,它们不会互相干扰。 + +如果你是需要选择使用哪个版本的开发人员,则应考虑所需的组件。如果选择 Oracle 的版本,请注意,软件包中包含专有的插件和字体,可能会[影响你分发你的应用程序][2]。在 IcedTea 或 OpenJDK 上进行开发是最安全的。 + +### 从存储库安装 OpenJDK? + +现在,你已经知道要选择什么了,你可以使用软件包管理器搜索 OpenJDK 或 IcedTea,然后安装所需的版本。有些发行版使用关键字 `latest` 来指示最新版本,这通常是你要运行的应用程序所需要的。根据你使用的软件包管理器,你甚至可以考虑使用 `grep` 过滤搜索结果以仅包括最新版本。例如,在 Fedora 上: + +``` +$ sudo dnf search openjdk | grep latest | cut -f1 -d':' + +java-latest-openjdk-demo.x86_64 +java-openjdk.i686 +java-openjdk.x86_64 +java-latest-openjdk-jmods.x86_64 +java-latest-openjdk-src.x86_64 +java-latest-openjdk.x86_64 +[...] +``` + +只有当你尝试运行的应用程序坚持要求你使用 Java 的旧版本时,你才应该看看 `latest` 之前的版本。 + +在 Fedora 或类似系统上安装 Java: + +``` +$ sudo dnf install java-latest-openjdk +``` + +如果你的发行版不使用 `latest` 标签,则可以使用其他关键字,例如 `default`。以下是在 Debian 上搜索 OpenJDK 的信息: + +``` +$ sudo apt search openjdk | less +default-jdk +  Standard Java development kit + +default-jre +  Standard Java runtime + +openjdk-11-jdk +  OpenJDK development kit (JDK) + +[...] +``` + +在这种情况下,`default-jre` 软件包适合用户,而 `default-jdk` 则适合开发人员。 + +例如,要在 Debian 上安装 JRE: + +``` +$ sudo apt install default-jre +``` + +现在已安装好 Java。 + +你的存储库中可能有*许多*与 Java 相关的软件包。要搜索 OpenJDK,如果你是用户,则查找最新的 JRE 或 JVM,如果你是开发人员,则查找最新的 JDK。 + +### 从互联网上安装 Java + +如果在存储库中找不到 JRE 或 JDK,或者找不到满足你需求的 JRE 或 JDK,则可以从互联网上下载开源的 Java 软件包。你可以在 [openjdk.java.net][3] 中找到需要手动安装的 tar 形式的 OpenJDK 下载文件,或者可以从 Azul 下载 tar 形式的 [Zulu 社区版][4]或其可安装的 RPM 或 DEB 软件包。 + +#### 从 TAR 文件安装 Java + +如果从 Java.net 或 Azul 下载 TAR 文件,则必须手动安装。这通常称为“本地”安装,因为你没有将 Java 安装到“全局”位置。你可以在 `PATH` 中选择一个合适的位置。 + +如果你不知道 `PATH` 中包含什么,请查看一下以找出: + +``` +$ echo $PATH +/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/seth/bin +``` + +在此示例 `PATH` 中,位置 `/usr/local/bin` 和 `/home/seth/bin` 是不错的选择。如果你是计算机上的唯一用户,那么你自己的家目录就很有意义。如果你的计算机上有很多用户,则最好选择一个通用位置,例如 `/usr/local` 或 `/opt`。 + +如果你无权访问需要 `sudo` 权限的 `/usr/local` 之类的系统级目录,则可以在你自己的家目录中创建一个本地 `bin`(意思是 “二进制binary”,而不是“垃圾箱waste bin”)或 `Applications` 文件夹: + +``` +$ mkdir ~/bin +``` + +如果它不在你的 `PATH` 中,请将其添加到其中: + +``` +$ echo PATH=$PATH:$HOME/bin >> ~/.bashrc +$ source ~/.bashrc +``` + +最后,将压缩包解压缩到你选择的目录中。 + +``` +$ tar --extract --file openjdk*linux-x64_bin.tar.gz --directory=$HOME/bin +``` + +Java 现在安装好了。 + +#### 从 RPM 或 DEB 安装 Java + +如果从 Azul.com 下载 RPM 或 DEB 文件,则可以使用软件包管理器进行安装。 + +对于 Fedora、CentOS、RHEL 等,请下载 RPM 并使用 DNF 进行安装: + +``` +$ sudo dnf install zulu*linux.x86_64.rpm +``` + +对于 Debian、Ubuntu、Pop_OS 和类似发行版,请下载 DEB 软件包并使用 Apt 安装它: + +``` +$ sudo dpkg -i zulu*linux_amd64.deb +``` + +Java 现在安装好了。 + +#### 用 alternatives 安装你的 Java 版本 + +一些应用程序是为特定版本的 Java 开发的,不能与其他任何版本一起使用。这种情况很少见,但确实会发生,在 Linux 上,你可以使用本地安装方法(请参阅上面“从 TAR 文件安装 Java”一节)或使用 `alternatives` 应用程序来解决此冲突。 + +`alternatives` 命令会查找 Linux 系统上安装的应用程序,并让你选择要使用的版本。有些发行版,例如 Slackware,不提供 `alternatives` 命令,因此你必须使用本地安装方法。在 Fedora、CentOS 和类似的发行版上,该命令是 `alternatives`。在 Debian、Ubuntu 和类似的系统上,该命令是 `update-alternatives`。 + +要获取当前已安装在 Fedora 系统上的应用程序的可用版本列表: + +``` +$ alternatives --list +``` + +在 Debian 上,你必须指定可供替代的应用程序: + +``` +$ update-alternatives --list java +``` + +在 Fedora 上选择要使系统将哪个版本作为默认版本: + +``` +$ sudo alternatives --config java +``` + +在 Debian 上: + +``` +$ sudo updates-alternatives --config java +``` + +你可以根据需要运行的应用程序,根据需要更改默认的 Java 版本。 + +### 运行 Java 应用 + +Java 应用程序通常以 JAR 文件的形式分发。根据你安装 Java 的方式,你的系统可能已经为运行 Java 应用程序配置好了,这使你只需双击应用程序图标(或从应用程序菜单中选择它)即可运行。如果必须执行未与系统其余部分集成的本地 Java 安装,则可以直接从终端启动 Java 应用程序: + +``` +$ java -jar ~/bin/example.jar & +``` + +### Java 是个好东西 + +Java 是少数将跨平台开发放在首位的编程环境之一。没有什么比问一个应用程序是否能在你的平台上运行然后发现该应用程序是用 Java 编写要让人感到松一口气的了。它是如此简单,无论你是开发人员还是用户,你都可以摆脱任何平台上的焦虑。在桌面上拥抱 Java 应用程序,然后在*所有*桌面上运行它们吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/install-java-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html +[3]: http://openjdk.java.net +[4]: https://www.azul.com/downloads/zulu-community +[5]: tmp.wuzOCnXHry#installing-java-from-a-tar-file diff --git a/published/201911/20191121 How to document Python code with Sphinx.md b/published/201911/20191121 How to document Python code with Sphinx.md new file mode 100644 index 0000000000..3b14624f5d --- /dev/null +++ b/published/201911/20191121 How to document Python code with Sphinx.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11624-1.html) +[#]: subject: (How to document Python code with Sphinx) +[#]: via: (https://opensource.com/article/19/11/document-python-sphinx) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何使用 Sphinx 给 Python 代码写文档 +====== + +> 最好将文档作为开发过程的一部分。Sphinx 加上 Tox,让文档可以轻松书写,并且外观漂亮。 + +![Python in a coffee cup.][1] + +Python 代码可以在源码中包含文档。这种方式默认依靠 **docstring**,它以三引号格式定义。虽然文档的价值是很大的,但是没有充足的文档的代码还是很常见。让我们演练一个场景,了解出色的文档的强大功能。 + +经历了太多在白板技术面试上要求你实现斐波那契数列,你已经受够了。你回家用 Python 写了一个可重用的斐波那契计算器,使用浮点技巧来实现 `O(1)` 复杂度。 + +代码很简单: + +``` +# fib.py +import math + +_SQRT_5 = math.sqrt(5) +_PHI = (1 + _SQRT_5) / 2 + +def approx_fib(n): + return round(_PHI**(n+1) / _SQRT_5) +``` + +(该斐波那契数列是四舍五入到最接近的整数的几何序列,这是我最喜欢的鲜为人知的数学事实之一。) + +作为一个好人,你可以将代码开源,并将它放在 [PyPI][2] 上。`setup.py` 文件很简单: + +``` +import setuptools + +setuptools.setup( + name='fib', + version='2019.1.0', + description='Fibonacci', + py_modules=["fib"], +) +``` + +但是,没有文档的代码是没有用的。因此,你可以向函数添加 docstring。我最喜欢的 docstring 样式之一是 [“Google” 样式][3]。标记很轻量,当它放在源代码中时很好。 + + +``` +def approx_fib(n): + """ + Approximate Fibonacci sequence + + Args: + n (int): The place in Fibonacci sequence to approximate + + Returns: + float: The approximate value in Fibonacci sequence + """ + # ... +``` + +但是函数的文档只是成功的一半。普通文档对于情境化代码用法很重要。在这种情况下,情景是恼人的技术面试。 + +有一种添加更多文档的方式,专业 Python 人的方式通常是在 `docs/` 添加 rst 文件( [reStructuredText][4] 的缩写)。因此 `docs/index.rst` 文件最终看起来像这样: + +``` +Fibonacci +========= + +Are you annoyed at tech interviewers asking you to implement +the Fibonacci sequence? +Do you want to have some fun with them? +A simple +:code:`pip install fib` +is all it takes to tell them to, +um, +fib off. + +.. automodule:: fib + :members: +``` + +我们完成了,对吧?我们已经将文本放在了文件中。人们应该会看的。 + +### 使 Python 文档更漂亮 + +为了使你的文档看起来更漂亮,你可以利用 [Sphinx][5],它旨在制作漂亮的 Python 文档。这三个 Sphinx 扩展特别有用: + +* `sphinx.ext.autodoc`:从模块内部获取文档 +* `sphinx.ext.napoleon`:支持 Google 样式的 docstring +* `sphinx.ext.viewcode`:将 ReStructured Text 源码与生成的文档打包在一起 + +为了告诉 Sphinx 该生成什么以及如何生成,我们在 `docs/conf.py` 中配置一个辅助文件: + +``` +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', +] +# 该入口点的名称,没有 .rst 扩展名。 +# 惯例该名称是 index +master_doc = "index" +# 这些值全部用在生成的文档当中。 +# 通常,发布(release)与版本(version)是一样的, +# 但是有时候我们会有带有 rc 标签的发布。 +project = "Fib" +copyright = "2019, Moshe Zadka" +author = "Moshe Zadka" +version = release = "2019.1.0" +``` + +此文件使我们可以使用所需的所有元数据来发布代码,并注意扩展名(上面的注释说明了方式)。最后,要确保生成我们想要的文档,请使用 [Tox][6] 管理虚拟环境以确保我们顺利生成文档: + +``` +[tox] +# 默认情况下,`.tox` 是该目录。 +# 将其放在非点文件中可以从 +# 文件管理器或浏览器的 +# 打开对话框中打开生成的文档, +# 这些对话框有时会隐藏点文件。 +toxworkdir = {toxinidir}/build/tox + +[testenv:docs] +# 从 `docs` 目录内运行 `sphinx`, +# 以确保它不会拾取任何可能进入顶层目录下的 +# 虚拟环境或 `build/` 目录下的其他工件的杂散文件。 +changedir = docs +# 唯一的依赖关系是 `sphinx`。 +# 如果我们使用的是单独打包的扩展程序, +# 我们将在此处指定它们。 +# 更好的做法是指定特定版本的 sphinx。 +deps = + sphinx +# 这是用于生成 HTML 的 `sphinx` 命令。 +# 在其他情况下,我们可能想生成 PDF 或电子书。 +commands = + sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html +# 我们使用 Python 3.7。 +# Tox 有时会根据 testenv 的名称尝试自动检测它, +# 但是 `docs` 没有给出有用的线索,因此我们必须明确它。 +basepython = python3.7 +``` + +现在,无论何时运行 Tox,它都会为你的 Python 代码生成漂亮的文档。 + +### 在 Python 中写文档很好 + +作为 Python 开发人员,我们可以使用的工具链很棒。我们可以从 **docstring** 开始,添加 .rst 文件,然后添加 Sphinx 和 Tox 来为用户美化结果。 + +你对好的文档有何评价?你还有其他喜欢的方式么?请在评论中分享它们! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/document-python-sphinx + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) +[2]: https://pypi.org/ +[3]: http://google.github.io/styleguide/pyguide.html#381-docstrings +[4]: http://docutils.sourceforge.net/rst.html +[5]: http://www.sphinx-doc.org/en/master/ +[6]: https://tox.readthedocs.io/en/latest/ diff --git a/published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/published/201911/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md similarity index 100% rename from published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md rename to published/201911/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md diff --git a/published/201911/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/published/201911/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md new file mode 100644 index 0000000000..cc418f1713 --- /dev/null +++ b/published/201911/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11617-1.html) +[#]: subject: (Bauh – Manage Snaps, Flatpaks and AppImages from One Interface) +[#]: via: (https://itsfoss.com/bauh-package-manager/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +bauh:在一个界面中管理 Snap、Flatpak 和 AppImage +====== + +![](https://img.linux.net.cn/data/attachment/album/201911/27/092926pzzdtytda80yaany.jpg) + +[Snap][1]、[Flatpak][2] 和 [AppImage][3] 等通用软件包的最大问题之一就是管理它们。大多数内置的软件包管理器都不能全部支持这些新格式。 + +幸运的是,我偶然发现了一个支持这几种通用包格式的应用程序。 + +### bauh:多包装需求的管理器 + +[bauh][4](LCTT:我给该软件建议一个中文名:“包豪”)最初名为 fpakman,旨在处理 Flatpak、Snap、[AppImage][5] 和 [AUR][6] 软件包。创建者 [vinifmor][7] 在 2019 年 6 月启动了该项目,[意图][8]“为 Manjaro 用户提供管理 Flatpak 的图形界面”。此后,他扩展了该应用程序,以添加对基于 Debian 的系统的支持。 + +![Bauh About][9] + +首次打开 bauh 时,它将扫描已安装的应用程序并检查更新。如果有任何需要更新的内容,它们将列在前面并居中。更新所有软件包后,你将看到已安装的软件包列表。你可以取消选择不需要更新的软件包,以防止其被更新。你也可以选择安装该应用程序的早期版本。 + +![With Bauh you can manage various types of packages from one application][10] + +你也可以搜索应用程序。bauh 提供了有关已安装和已搜索软件包的详细信息。如果你对一种(或多种)软件包类型不感兴趣,则可以在设置中取消选择它们。 + +![Bauh Search][22] + +![Bauh Package Info][13] + +![Bauh Updating][19] + +### 在你的 Linux 发行版上安装 bauh + +让我们看看如何安装 bauh。 + +#### 基于 Arch 的发行版 + +如果你安装的是最近的 [Manjaro][11],则应该一切已经就绪。bauh 默认情况下已安装。如果你安装的是较早版本的 Manjaro(如我一样)或其他基于 Arch 的发行版,则可以在终端中输入以下内容从 [AUR][12] 中进行安装: + +``` +sudo pacman -S bauh +``` + +#### 基于 Debian/Ubuntu 的发行版 + +如果你拥有基于 Debian 或 Ubuntu 的 Linux 发行版,则可以使用 `pip` 安装 bauh。首先,请确保[在 Ubuntu 上安装了 pip][14]。 + +``` +sudo apt install python3-pip +``` + +然后使用它来安装 bauh: + +``` +pip3 install bauh +``` + +但是,该软件的创建者建议[手动][15]安装它,以避免弄乱系统的库。 + +要手动安装 bauh,你必须先下载其[最新版本][16]。下载后,可以[使用图形工具][17]或 [unzip 命令][18]解压缩。接下来,在终端中打开该文件夹。你将需要使用以下步骤来完成安装。 + +首先,在名为 `env` 的文件夹中创建一个虚拟环境: + +``` +python3 -m venv env +``` + +现在在该环境中安装该应用程序的代码: + +``` +env/bin/pip install . +``` + +启动该应用程序: + +``` +env/bin/bauh +``` + +一旦完成了 bauh 的安装,就可以通过更改环境设置和参数来对其进行[微调][20]。 + +### bauh 的未来之路 + +bauh 在短短的几个月中增长了很多。它有计划继续增长。当前的[路线图][21]包括: + +* 支持其他打包技术 +* 每种打包技术一个单独模块 +* 内存和性能改进 +* 改善用户体验 + +### 结语 + +当我尝试 bauh 时,遇到了两个问题。当我第一次打开它时,它告诉我尚未安装 Snap,如果要使用 Snap 软件包,则必须安装它。我知道我已经安装了 Snap,因为我在终端中运行了 `snap list`,并且可以正常工作。我重新启动系统,Snap 才工作正常。 + +我遇到的另一个问题是我的一个 AUR 软件包无法更新。我可以用 `yay` 更新软件包,而没有任何问题。可能是我的 Manjaro 有问题,我已经使用了它 3 到 4 年。 + +总体而言,bauh 可以工作。它做到了宣称的功能。我不能要求更多。 + +你有没有用过 hauh?如果有的话,你最喜欢的用于管理不同打包格式的工具是什么?在下面的评论中让我们知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bauh-package-manager/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://snapcraft.io/ +[2]: https://flatpak.org/ +[3]: https://appimage.org/ +[4]: https://github.com/vinifmor/bauh +[5]: https://itsfoss.com/use-appimage-linux/ +[6]: https://itsfoss.com/best-aur-helpers/ +[7]: https://github.com/vinifmor +[8]: https://forum.manjaro.org/t/bauh-formerly-known-as-fpakman-a-gui-for-flatpak-and-snap-management/96180 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-about.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh.jpg?ssl=1 +[11]: https://manjaro.org/ +[12]: https://aur.archlinux.org/packages/bauh +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-package-info.jpg?ssl=1 +[14]: https://itsfoss.com/install-pip-ubuntu/ +[15]: https://github.com/vinifmor/bauh#manual-installation +[16]: https://github.com/vinifmor/bauh/releases +[17]: https://itsfoss.com/unzip-linux/ +[18]: https://linuxhandbook.com/unzip-command/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-updating.jpg?ssl=1 +[20]: https://github.com/vinifmor/bauh#general-settings +[21]: https://github.com/vinifmor/bauh#roadmap +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-search.png?resize=800%2C319&ssl=1 +[23]: https://reddit.com/r/linuxusersgroup diff --git a/published/201911/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/published/201911/20191126 Google to Add Mainline Linux Kernel Support to Android.md new file mode 100644 index 0000000000..479ef5cdde --- /dev/null +++ b/published/201911/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11616-1.html) +[#]: subject: (Google to Add Mainline Linux Kernel Support to Android) +[#]: via: (https://itsfoss.com/mainline-linux-kernel-android/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +谷歌为安卓添加主线 Linux 内核支持 +====== + +当前的安卓生态系统被数百种不同版本的安卓所污染,每种版本都运行着 Linux 内核的不同变体。每个版本均针对不同的手机和不同的配置而设计。谷歌试图通过将主线 Linux 内核添加到安卓来解决该问题。 + +### 当前在安卓中是如何处理 Linux 内核的 + +在到达你的手机之前,你手机上的 Linux 内核经历了[三个主要步骤][1]。 + +首先,谷歌采用了 Linux 内核的 LTS(长期支持)版本,并添加了所有的安卓专用代码。这将成为“安卓通用内核”。 + +然后,谷歌将此代码发送给创建可运行在手机的片上系统(SoC)的公司。这通常是高通公司。 + +SoC 制造商添加了支持 CPU 和其他芯片的代码后,便会将该内核传递给实际的设备制造商,例如三星和摩托罗拉。然后,设备制造商添加代码以支持手机的其余部分,例如显示屏和摄像头。 + +每个步骤都需要一段时间才能完成,并且会导致该内核无法与其他任何设备一起使用。这也意味着内核会非常旧,通常是大约两年前的内核。例如,上个月交付的谷歌 Pixel 4 带有来自 2017 年 11 月的内核,而且它将永远不会得到更新。 + +谷歌承诺会为较旧的设备创建安全补丁,这意味着他们会一直盯着大量的旧代码。 + +### 将来 + +![][2] + +去年,谷歌宣布[计划][3]解决此问题。今年,他们在 2019 Linux Plumbers Conference 上展示了他们取得的进展。 + +> “我们知道运行安卓需要什么,但不一定是在任何给定的硬件上。因此,我们的目标是从根本上找出所有这些,然后将其交给上游,并尝试尽可能接近主线。” +> +> Sandeep Patil,[安卓内核团队负责人][1] + +他们确实炫耀了运行带有合适的 Linux 内核的小米 Poco F1。但是,有些东西[似乎没有工作][4],例如电池电量百分比一直留在 0%。 + +那么,谷歌计划如何使其工作呢?从他们的 [Treble 项目][5]计划中摘录。在 Treble 项目之前,与设备和安卓本身交互的底层代码是一大堆代码。Treble 项目将两者分开,并使它们模块化,以便可以更快地交付安卓更新,并且在更新时,这些低级代码可以保持不变。 + +谷歌希望为内核带来同样的模块化。他们的[计划][1]“涉及稳定 Linux 的内核 ABI,并为 Linux 内核和硬件供应商提供稳定的接口来进行写入。谷歌希望将 Linux 内核与其硬件支持脱钩。” + +因此,这意味着谷歌将交付一个内核,而硬件驱动程序将作为内核模块加载。目前,这只是一个草案。仍然有很多技术问题有待解决。因此,这不会很快有结果。 + +### 来自开源的反对意见 + +开源社区不会对将专有代码放入内核的想法感到满意。[Linux 内核准则][6]指出,驱动程序必须具有 GPL 许可证才能包含在内核中。他们还指出,如果驱动程序的更改导致错误,应由导致该错误的人来解决。从长远来看,这意味着设备制造商的工作量将减少。 + +### 关于将主线内核包含到安卓中的最终想法 + +到目前为止,这只是一个草案。谷歌有很大的可能会开始进行该项目,除非他们意识到这将需要多少工作后才会放弃。看看谷歌[已经放弃][7]了多少个项目! + +[Android Police][4] 指出谷歌正在开发其 [Fuchsia 操作系统][8],这似乎是为了有一天取代安卓。 + +那么,问题是谷歌会尝试完成那些艰巨的任务,使安卓以主线 Linux 内核运行,还是完成他们统一的安卓替代产品的工作?只有时间可以回答。 + +你对此话题有何看法?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mainline-linux-kernel-android/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://arstechnica.com/gadgets/2019/11/google-outlines-plans-for-mainline-linux-kernel-support-in-android/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/mainline_linux_kernel_android.png?ssl=1 +[3]: https://lwn.net/Articles/771974/ +[4]: https://www.androidpolice.com/2019/11/19/google-wants-android-to-use-regular-linux-kernel-potentially-improving-updates-and-security/ +[5]: https://www.computerworld.com/article/3306443/what-is-project-treble-android-upgrade-fix-explained.html +[6]: https://www.kernel.org/doc/Documentation/process/stable-api-nonsense.rst +[7]: https://killedbygoogle.com/ +[8]: https://itsfoss.com/fuchsia-os-what-you-need-to-know/ +[9]: https://reddit.com/r/linuxusersgroup diff --git a/published/201911/20191127 Displaying dates and times your way.md b/published/201911/20191127 Displaying dates and times your way.md new file mode 100644 index 0000000000..4366136a80 --- /dev/null +++ b/published/201911/20191127 Displaying dates and times your way.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11623-1.html) +[#]: subject: (Displaying dates and times your way) +[#]: via: (https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在终端里按你的方式显示日期和时间 +====== + +> Linux 的 date 命令提供了很多显示日期和时间的选项,要比你想的还要多。这是一些有用的选择。 + +![](https://img.linux.net.cn/data/attachment/album/201911/29/144555a8mq82mcc9cfttt9.jpg) + +在 Linux 系统上,`date` 命令非常简单。你键入 `date`,日期和时间将以一种有用的方式显示。它包括星期几、日期、时间和时区: + +``` +$ date +Tue 26 Nov 2019 11:45:11 AM EST +``` + +只要你的系统配置正确,你就会看到日期和当前时间以及时区。 + +但是,该命令还提供了许多选项来以不同方式显示日期和时间信息。例如,如果要显示日期以便进行排序,则可能需要使用如下命令: + +``` +$ date "+%Y-%m-%d" +2019-11-26 +``` + +在这种情况下,年、月和日按该顺序排列。请注意,我们使用大写字母 `Y` 来获得四位数的年份。如果我们使用小写的 `y`,则只会看到两位数字的年份(例如 19)。不要让这种做法使你错误地联想到如果 `%m` 给你一个数字月份,`%M` 可能会给你月份的名称。不,`%M` 将给你分钟数。要以缩写名称格式获得月份,你要使用 `%b`,而对于完全拼写的月份,则要使用 `%B`。 + +``` +$ date "+%b %B" +Nov November +``` + +或者,你可能希望以这种常用格式显示日期: + +``` +$ date "+%D" +11/26/19 +``` + +如果你需要四位数的年份,则可以执行以下操作: + +``` +$ date "+%x" +11/26/2019 +``` + +下面是一个可能有用的示例。假设你需要创建一个每日报告并在文件名中包含日期,则可以使用以下命令来创建文件(可能用在脚本中): + +``` +$ touch Report-`date "+%Y-%m-%d"` +``` + +当你列出你的报告时,它们将按日期顺序或反向日期顺序(如果你添加 `-r`)列出。 + +``` +$ ls -r Report* +Report-2019-11-26 +Report-2019-11-25 +Report-2019-11-22 +Report-2019-11-21 +Report-2019-11-20 +``` + +你还可以在日期字符串中添加其他详细信息。可用的各种选项多得令人惊讶。你可以使用 `date "+%q"` 来显示你所在的一年中的哪个季度,或使用类似以下命令来显示两个月前的日期: + +``` +$ date --date="2 months ago" +Thu 26 Sep 2019 09:02:43 AM EDT +``` + +是否想知道下周四的日期?你可以使用类似 `date --date="next thu"` 的命令,但是要理解,对于Linux,下个周四意味着今天之后的周四。如果今天是星期三,那就是明天,而不是下周的星期四。但是,你可以像下面的第二个命令一样指定下周的星期四。 + +``` +$ date --date="next thu" +Thu 28 Nov 2019 12:00:00 AM EST +$ date --date="next week thu" +Thu 05 Dec 2019 12:00:00 AM EST +``` + +`date` 命令的手册页列出了其所有选项。该列表多得令人难以置信,但是你可能会发现一些日期/时间显示选项非常适合你。以下是一些你可能会发现有趣的东西。 + +世界标准时间(UTC): + +``` +$ date -u +Tue 26 Nov 2019 01:13:59 PM UTC +``` + +自 1970 年 1 月 1 日以来的秒数(与 Linux 系统上日期的存储方式有关): + +``` +$ date +%s +1574774137 +``` + +以下是 `date` 命令选项的完整列表。正如我所说,它比我们大多数人想象的要广泛得多。 + +- `%%` 显示字母 % +- `%a` 本地语言环境的缩写星期名称(例如,日 / Sun) +- `%A` 本地语言环境的完整星期名称(例如,星期日 / Sunday) +- `%b` 本地语言环境的缩写月份名称(例如 一 / Jan) +- `%B` 本地语言环境的完整月份名称(例如,一月 / January) +- `%c` 本地语言环境的日期和时间(例如 2005年3月3日 星期四 23:05:25 / Thu Mar 3 23:05:25 2005) +- `%C` 世纪;类似于 `%Y`,但省略了后两位数字(例如,20) +- `%d` 月份的天(例如,01) +- `%D` 日期;与 `%m/%d/%y` 相同 +- `%e` 月份的天,填充前缀空格;与 `%_d` 相同 +- `%F` 完整日期;与 `%Y-%m-%d` 相同 +- `%g` ISO 周号的年份的后两位数字(请参见 `%G`) +- `%G` ISO 周号的年份(请参阅 `%V`);通常仅配合 `%V` 使用 +- `%h` 与 `%b` 相同 +- `%H` 24 小时制的小时(00..23) +- `%I` 12 小时制的小时(01..12) +- `%j` 一年的天(001..366) +- `%k` 24 小时制的小时,填充前缀空格( 0..23);与 `%_H` 相同 +- `%l` 12 小时制的小时,填充前缀空格( 1..12);与 `%_I` 相同 +- `%m` 月份(01..12) +- `%M` 分钟(00..59) +- `%n` 换行符 +- `%N` 纳秒(000000000..999999999) +- `%p` 本地语言环境中等同于 AM 或 PM 的字符串;如果未知,则为空白 +- `%P` 像 `%p`,但使用小写 +- `%q` 季度(1..4) +- `%r` 本地语言环境的 12 小时制时间(例如,晚上 11:11:04 / 11:11:04 PM) +- `%R` 24 小时制的小时和分钟;与 `%H:%M` 相同 +- `%s` 自 1970-01-01 00:00:00 UTC 以来的秒数 +- `%S` 秒(00..60) +- `%t` 制表符 +- `%T` 时间;与 `%H:%M:%S` 相同 +- `%u` 星期(1..7);1 是星期一 +- `%U` 年的周号,以星期日为一周的第一天,从 00 开始(00..53) +- `%V` ISO 周号,以星期一为一周的第一天,从 01 开始(01..53) +- `%w` 星期(0..6);0 是星期日 +- `%W` 年的周号,星期一为一周的第一天,从 00 开始(00..53) +- `%x` 本地语言环境的日期表示形式(例如,1999年12月31日 / 12/31/99) +- `%X` 本地语言环境的时间表示形式(例如,23:13:48) +- `%y` 年的最后两位数字(00..99) +- `%Y` 年份 +- `%z` +hhmm 格式的数字时区(例如,-0400) +- `%:z` +hh:mm 格式的数字时区(例如,-04:00) +- `%::z` +hh:mm:ss 格式的数字时区(例如,-04:00:00) +- `%:::z` 数字时区,`:` 指明精度(例如,-04, +05:30) +- `%Z` 字母时区缩写(例如,EDT) + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/20191113 Edit images on Fedora easily with GIMP.md b/published/20191113 Edit images on Fedora easily with GIMP.md new file mode 100644 index 0000000000..c4fa6c8b67 --- /dev/null +++ b/published/20191113 Edit images on Fedora easily with GIMP.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11632-1.html) +[#]: subject: (Edit images on Fedora easily with GIMP) +[#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) +[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) + +在 Fedora 上使用 GIMP 轻松编辑图像 +====== + +![][1] + +GIMP(GNU Image Manipulation Program 的缩写)是自由开源的图像处理软件。它有很多的功能,从简单的图像编辑,到复杂的滤镜、脚本,甚至是动画,它是流行的商业同类软件的一款很好的替代品。 + +继续阅读来学习如何在 Fedora 上安装和使用 GIMP。这篇文章涉及基本的日常图像编辑工作。 + +### 安装 GIMP + +GIMP 在官方 Fedora 存储库中可获得。为安装它,运行: + +``` +sudo dnf install gimp +``` + +### 单窗口模式 + +在你打开应用程序后,它显示带有工具箱和主编辑区的暗色主题窗口。注意,它有两种窗口模式,你可以通过选择“窗口Windows -> 单窗口模式Single Window Mode”在其中切换。通过选中这个选项,用户界面的所有组件将显示在单个窗口中。否则,它们将是分离的。 + +### 加载图像 + +![][2] + +为加载图像,转到“文件File -> 打开Open”,然后选择你的文件并选择你的图像文件。 + +### 重新调整一个图像的大小 + +为重新调整图像大小,你可以基于一对参数重新调整大小,包括像素和百分比 —— 在编辑图像时,这两个参数很方便。 + +让我们假使我们需要缩小 Fedora 30 背景图像到它当前大小的 75%。为此,选择“图像 Image -> 比例Scale”,然后在比例对话框上,在单位下拉列表中选择“百分比percentage”。接下来,输入 “75” 作为宽度或高度,然后按 Tab 键。默认情况下,其它尺寸将自动地调整大小,以相应地与更改的尺寸保持纵横比。现在,保存其它选项不变,并按比例。 + +![][3] + +该图像缩小到其原始尺寸的 75%。 + +### 旋转图像 + +旋转是一种变换操作,因此,你可以从主菜单下的“图像Image -> 变换Transform”下找到它,其中有图像旋转 90° 或 180° 的选项。在上述选项下也有垂直或水平翻转图像的选项。 + +让我们假使我们需要旋转图像 90°。在应用一次 90° 顺时针旋转和水平翻转后,我们的图像将看起来像这样: + +![Transforming an image with GIMP][4] + +### 添加文本 + +添加文本非常简单。只需要从工具箱中选择 “A” 图标,然后,在你的图像上,单击你想要添加文本的位置。如果工具箱不可见,从“窗口Windows -> 新建工具箱New Toolbox”打开它。 + +当你编辑文本时,你可能注意到,文本对话框有字体自定义选项,包括字体系列、字体大小等等。 + +![Adding text to image in GIMP][5] + +### 保存和导出 + +你可以从“文件File -> 保存Save”或通过按 `Ctrl+S` 来将你的编辑保存为一个带有 `.xcf` 扩展名的 GIMP 工程。或者,你可以导出你的图像,例如,以 PNG 或 JPEG 格式。为导出图像,转到“文件File -> 导出为Export As”或按 `Ctrl+Shift+E`,接下来,在你面前将产生一个你可以选择输出图像和名称的对话框。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/ + +作者:[Mehdi Haghgoo][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/powergame/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/gimp-magazine-816x346.jpg +[2]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-00-44-300x165.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-17-33-300x262.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-41-28-300x243.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-47-54-300x237.png + diff --git a/published/20191120 Switching from Python 2 to Python 3- What you need to know.md b/published/20191120 Switching from Python 2 to Python 3- What you need to know.md new file mode 100644 index 0000000000..f89984a90c --- /dev/null +++ b/published/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11629-1.html) +[#]: subject: (Switching from Python 2 to Python 3: What you need to know) +[#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +从 Python 2 切换到 Python 3 你所需要了解的 +====== + +> Python 2 将在几周内走到生命终点,这篇文章是你迁移到 Python 3 之前应该知道的。 + +![](https://img.linux.net.cn/data/attachment/album/201912/01/095336lbppn8qp1nnnwqqp.jpg) + +从 2020 年 1 月 1 日开始,Python 2.7 将不再得到正式支持。在此日期之后,将会发布一个[最终错误修复][2]计划,但是仅此而已。 + +Python 2 的生命终点(EOL)对你意味着什么?如果正在运行着 Python 2,你需要迁移。 + +### 是谁决定 Python 2 的生命终点? + +在 [2012][3] 年,维护 Python 编程语言的团队审查了其选项。有两个越来越不同的代码库,Python 2 和 Python 3。这两者都很流行,但是较新的版本并未得到广泛采用。 + +除了 Python 3 中完全重写的 Unicode 支持改变了处理数据的底层方式造成的断层,这个主要版本的变化还一次性出现了一些非向后兼容的更改。这种断层的决定成文于 [2006 年][4]。为了减轻该断层的影响,Python 2 继续保持了维护,并向后移植了一些 Python 3 的功能。为了进一步帮助社区过渡,EOL 日期[从 2015 年延长至 2020 年][5],又延长了五年。 + +该团队知道,维护不同的代码库是必须解决的麻烦。最终,他们[宣布了][6]一项决定: + +>“我们是制作和照料 Python 编程语言的志愿者。我们已决定 2020 年 1 月 1 日将是我们停止使用 Python 2 的日子。这意味着在这一天之后,即使有人发现其中存在安全问题,我们也将不再对其进行改进。你应尽快升级到 Python 3。” + +[Nick Coghlan][7] 是 CPython 的核心开发人员,也是 Python 指导委员会的现任成员,[在他的博客中添加了更多信息][8]。由 [Barry Warsaw][10](也是 Python 指导委员会的成员)撰写的 [PEP 404][9] 详细说明了 Python 2.8 永远不会面世的原因。 + +### 有人还在支持 Python 2 吗? + +提供者和供应商对 Python 2 的支持会有所不同。[Google Cloud 宣布了][11]它计划未来如何支持 Python 2。红帽还[宣布了红帽企业 Linux(RHEL)的计划][12],而 AWS 宣布了 AWS 命令行界面和 [SDK][14] 的[次要版本更新要求][13]。 + +你还可以阅读 [Vicki Boykis][16] 在 Stack Overflow 撰写的博客文章“[为什么迁移到 Python 3 需要这么长时间?][15]”,其中她指出了采用 Python 3 缓慢的三个原因。 + +### 使用 Python 3 的原因 + +不管是否有持续的支持,尽快迁移到 Python 3 是一个好主意。Python 3 将继续受到支持,它具有 Python 2 所没有的一些非常优雅的东西。 + +最近发布的 [Python 3.8][17] 包含 [海象运算符][19]、[位置参数][20]和[自描述的格式化字符串][21]等[功能][18]。Python 3 的早期版本引入的[功能][22],例如 [异步 IO][23]、[格式化字符串][24]、[类型提示][25] 和 [pathlib][26],这里只提及了一点点。 + +下载最多的前 360 个软件包[已迁移到 Python 3][27]。你可以使用 [caniusepython3][28] 软件包检查你的 `requirements.txt` 文件,以查看你依赖的任何软件包是否尚未迁移。 + +### 将 Python 2 移植到 Python 3 的参考资源 + +有许多参考资源可简化你向 Python 3 的迁移。例如,“[将 Python 2 移植到 Python 3 指南][29]”列出了许多工具和技巧,可帮助你实现与 Python 2/3 单一源代码的兼容性。在 [Python3statement.org][30] 上也有一些有用的技巧。 + +[Dustin Ingram][31] 和 [Chris Wilcox][32] 在 [Cloud Next '19][33]上作了一个演讲,详细介绍了向 Python 3 过渡的一些动机和迁移模式。[Trey Hunner][34] 在 [PyCon 2018 演讲][35]上介绍了 Python 3 最有用的功能,鼓励你进行迁移,以便你可以利用它们。 + +### 加入我们! + +距 2020 年 1 月 1 日仅有几周了。如果你需要每天提醒一下它即将到来的时间(并且你使用 Twitter 的话),请关注 [Python 2 日落倒计时][36] Twitter 机器人。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/end-of-life-python-2 + +作者:[Katie McLaughlin][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_a%20new%20dawn.png?itok=b4zU-VAY (A sunrise) +[2]: https://www.python.org/dev/peps/pep-0373/#maintenance-releases +[3]: https://github.com/python/peps/commit/a733bc927acbca16bfa3de486fb2c7d3f767a748 +[4]: https://www.python.org/dev/peps/pep-3000/#compatibility-and-transition +[5]: https://github.com/python/peps/commit/f82462002b86feff36215b4230be28967039b0cc +[6]: https://www.python.org/doc/sunset-python-2/ +[7]: https://twitter.com/ncoghlan_dev +[8]: http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html +[9]: https://www.python.org/dev/peps/pep-0404/ +[10]: https://twitter.com/pumpichank +[11]: https://cloud.google.com/python/docs/python2-sunset/?utm_source=osdc&utm_medium=blog&utm_campaign=pysunset +[12]: https://access.redhat.com/solutions/4455511 +[13]: https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/ +[14]: https://aws.amazon.com/sdk-for-python/ +[15]: https://stackoverflow.blog/2019/11/14/why-is-the-migration-to-python-3-taking-so-long/ +[16]: https://twitter.com/vboykis +[17]: https://www.python.org/downloads/ +[18]: https://docs.python.org/3.8/whatsnew/3.8.html +[19]: https://docs.python.org/3.8/whatsnew/3.8.html#assignment-expressions +[20]: https://docs.python.org/3.8/whatsnew/3.8.html#positional-only-parameters +[21]: https://docs.python.org/3.8/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging +[22]: https://docs.python.org/3.8/whatsnew/index.html +[23]: https://docs.python.org/3.8/library/asyncio.html#module-asyncio +[24]: https://docs.python.org/3.7/whatsnew/3.6.html#pep-498-formatted-string-literals +[25]: https://docs.python.org/3.7/whatsnew/3.5.html#pep-484-type-hints +[26]: https://docs.python.org/3.8/library/pathlib.html#module-pathlib +[27]: http://py3readiness.org/ +[28]: https://pypi.org/project/caniusepython3/ +[29]: https://docs.python.org/3/howto/pyporting.html +[30]: https://python3statement.org/practicalities/ +[31]: https://twitter.com/di_codes +[32]: https://twitter.com/chriswilcox47 +[33]: https://www.youtube.com/watch?v=Bye7Rms0Vgw&utm_source=osdc&utm_medium=blog&utm_campaign=pysunset +[34]: https://twitter.com/treyhunner +[35]: https://www.youtube.com/watch?v=klaGx9Q_SOA +[36]: https://twitter.com/python2sunset diff --git a/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md new file mode 100644 index 0000000000..9128c142b5 --- /dev/null +++ b/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11633-1.html) +[#]: subject: (How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 CentOS 8/RHEL 8 上安装 Ansible(自动化工具) +====== + +Ansible 是给 Linux 系统管理员使用的出色自动化工具。它是一种开源配置工具,能让系统管理员可以从一个中心节点(即 Ansible 服务器)管理数百台服务器。将 Ansible 与 Puppet、Chef 和 Salt 等类似工具进行比较时,它是首选的配置工具,因为它不需要任何代理,并且可以工作在 SSH 和 python 上。 + +![](https://img.linux.net.cn/data/attachment/album/201912/01/223012czkxt6dhku6snhxn.jpg) + +在本教程中,我们将学习如何在 CentOS 8 和 RHEL 8 系统上安装和使用 Ansble。 + +Ansible 实验环境信息: + +* 最小化安装的 CentOS 8 / RHEL 8 服务器(192.168.1.10),且有互联网连接 +* 两个 Ansible 节点 - Ubuntu 18.04 LTS (192.168.1.20) 和 CentOS 7 (192.168.1.30) + +### CentOS 8 上的 Ansible 安装步骤 + +Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要执行以下命令启用 [EPEL 仓库][3]: + +``` +[root@linuxtechi ~]$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y +``` + +启用 epel 仓库后,执行以下 `dnf` 命令安装 Ansible: + +``` +[root@linuxtechi ~]$ sudo dnf install ansible +``` + +上面命令的输出: + +![dnf-install-ansible-centos8][4] + +成功安装 Ansible 后,运行以下命令验证它的版本: + +``` +[root@linuxtechi ~]$ sudo ansible --version +``` + +![Ansible-version-CentOS8][5] + +上面的输出确认在 CentOS 8 上安装完成。 + +让我们看下 RHEL 8 系统。 + +### RHEL 8 上的 Ansible 安装步骤 + +如果你有有效的 RHEL 8 订阅,请使用以下订阅管理器命令启用 Ansble 仓库: + +``` +[root@linuxtechi ~]$ sudo subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms +``` + +启用仓库后,执行以下 `dnf` 命令安装 Ansible: + +``` +[root@linuxtechi ~]$ sudo dnf install ansible -y +``` + +安装 Ansible 及其依赖包后,执行以下命令来验证它的版本: + +``` +[root@linuxtechi ~]$ sudo ansible --version +``` + +### 在 CentOS 8 / RHEL 8 上通过 pip3 安装 Ansible 的可选方法 + +如果你希望使用 `pip`(Python 的包管理器)安装 Ansible,请首先使用以下命令安装 pyhton3 和 python3-pip 包: + +``` +[root@linuxtechi ~]$ sudo dnf install python3 python3-pip -y +``` + +安装 python3 后,运行以下命令来验证它的版本: + +``` +[root@linuxtechi ~]$ python3 -V +Python 3.6.8 +[root@linuxtechi ~]$ +``` + +用下面的 `pip3` 命令安装 Ansible: + +``` +[root@linuxtechi ~]$ pip3 install ansible --user +``` + +输出: + +![Ansible-Install-pip3-centos8][6] + +上面的输出确认 Ansible 已成功使用 `pip3` 安装。让我们看下如何使用 Ansible。 + +### 如何使用 Ansible 自动化工具? + +当我们使用 `yum` 或 `dnf` 命令安装 Ansible 时,它的配置文件、清单文件和角色目录会自动在 `/etc/ansible` 文件夹下创建。 + +让我们添加一个名称为 `labservers` 的组,并在 `/etc/ansible/hosts` 文件中给该组添加上述的 Ubuntu 18.04 和 CentOS 7 系统的 IP 地址: + +``` +[root@linuxtechi ~]$ sudo vi /etc/ansible/hosts +… +[labservers] +192.168.1.20 +192.168.1.30 +… +``` + +保存并退出文件。 + +更新清单文件(`/etc/ansible/hosts`)后,将用户的 ssh 公钥放到属于 `labservers` 组的远程系统。 + +让我们首先使用 `ssh-keygen` 命令生成本地用户的公钥和私钥: + +``` +[root@linuxtechi ~]$ ssh-keygen +``` + +现在使用以下命令在 Ansible 服务器及其客户端之间交换公钥: + +``` +[root@linuxtechi ~]$ ssh-copy-id root@linuxtechi +[root@linuxtechi ~]$ ssh-copy-id root@linuxtechi +``` + +现在,让我们尝试几个 Ansible 命令,首先使用 `ping` 模块验证 Ansible 服务器与客户端的连接: + +``` +[root@linuxtechi ~]$ ansible -m ping "labservers" +``` + +注意: 如果我们没有在上面的命令中指定清单文件,那么它将引用默认主机文件(即 `/etc/ansible/hosts`)。 + +输出: + +![ansible-ping-module-centos8][7] + +让我们使用 Ansible shell 命令检查每个客户端的内核版本: + +``` +[root@linuxtechi ~]$ ansible -m command -a "uname -r" "labservers" +192.168.1.30 | CHANGED | rc=0 >> +4.15.0-20-generic +192.168.1.20 | CHANGED | rc=0 >> +3.10.0-327.el7.x86_64 +[root@linuxtechi ~]$ +``` + +使用以下命令列出清单文件中的所有主机: + +``` +[root@linuxtechi ~]$ ansible all -i /etc/ansible/hosts --list-hosts + hosts (4): + 192.168.100.1 + 192.168.100.10 + 192.168.1.20 + 192.168.1.30 +[root@linuxtechi ~]$ +``` + +使用以下 Ansible 命令仅列出 `labservers` 组中的主机: + +``` +root@linuxtechi ~]$ ansible labservers -i /etc/ansible/hosts --list-hosts + hosts (2): + 192.168.1.20 + 192.168.1.30 +[root@linuxtechi ~]$ +``` + +本文就是这些了,我们成功演示了如何在 CentOS 8 和 RHEL 8 系统中安装和使用 Ansible。请分享你的反馈和意见。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.linuxtechi.com/wp-content/uploads/2019/11/Install-Ansible-CentOS8-RHEL8.png +[3]: http://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/dnf-install-ansible-centos8-1536x652.png +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Ansible-version-CentOS8.png +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Ansible-Install-pip3-centos8-1536x545.png +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/ansible-ping-module-centos8.png diff --git a/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md b/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md deleted file mode 100644 index a3ba0a6a52..0000000000 --- a/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Kubernetes communication, SRE struggles, and more industry trends) -[#]: via: (https://opensource.com/article/19/10/kubernetes-sre-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Kubernetes communication, SRE struggles, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Review of pod-to-pod communications in Kubernetes][2] - -> In this article, we dive into pod-to-pod communications by showing you ways in which pods within a Kubernetes network can communicate with one another. -> -> While Kubernetes is opinionated in how containers are deployed and operated, it is very non-prescriptive of how the network should be designed in which pods are to be run. Kubernetes imposes the following fundamental requirements on any networking implementation (barring any intentional network segmentation policies) - -**The impact**: Networking is one of the most complicated parts of making computers work together to solve our problems. Kubernetes turns that complexity up to 11, and this article dials it back down to 10.75. - -## [One SRE's struggle and success to improve Infrastructure as Code][3] - -> Convergence is our goal because we expect our infrastructure to reach a desired state over time expressed in the code. Software idempotence means software can run as many times as it wants and unintended changes don’t happen. As a result, we built an in-house service that runs as specified to apply configurations in source control. Traditionally, we’ve aimed for a masterless configuration design so our configuration agent looks for information on the host. - -**The impact**: I've heard it said that the [human element][4] is the most important element of any digital transformation. While I don't know that the author would use that term to describe the outcome he was after, he does a great job of showing that it is not automation for automation's sake we want but rather automation that makes a meaningful impact on the lives of the people it supports. - -## [Why GitHub is the gold standard for developer-focused companies][5] - -> Now, with last year’s purchase by Microsoft supporting them, it is clear that GitHub has a real opportunity to continue building out a robust ecosystem, with billion dollar companies built upon what could turn into a powerful platform. Is GitHub the next ecosystem success story? In a word, yes. At my company, we bet on GitHub as a successful platform to build upon from the very start. We felt it was the place to build our solution if we wanted to streamline project management and keep software teams close to the code. - -**The impact**: It is one of the great ironies of open source that the most popular tool for open source development is not itself open source. The only way this works is if that tool is so good that open source developers are willing to overlook that inconsistency. - -## [KubeVirt joins Cloud Native Computing Foundation][6] - -> This month the Cloud Native Computing Foundation (CNCF) formally adopted [KubeVirt][7] into the CNCF Sandbox. KubeVirt allows you to provision, manage and run virtual machines from and within Kubernetes. In joining the CNCF Sandbox, KubeVirt now has a more substantial platform to grow as well as educate the CNCF community on the use cases for placing virtual machines within Kubernetes. The CNCF onboards projects into the CNCF Sandbox when they warrant experimentation on neutral ground to promote and foster collaborative development. - -**The impact**: The convergence of containers and virtual machines is clearly a direction vendors think is valuable. Moving this project to the CNCF gives a way to see whether this idea is going to be as popular with users and customers as vendors hope it will be. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/kubernetes-sre-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://superuser.openstack.org/articles/review-of-pod-to-pod-communications-in-kubernetes/ -[3]: https://thenewstack.io/one-sres-struggle-and-success-to-improve-infrastructure-as-code/ -[4]: https://devops.com/the-secret-to-digital-transformation-is-human-connection/ -[5]: https://thenextweb.com/podium/2019/10/02/why-github-is-the-gold-standard-for-developer-focused-companies/ -[6]: https://blog.openshift.com/kubevirt-joins-cloud-native-computing-foundation/ -[7]: https://kubevirt.io/ diff --git a/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md b/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md deleted file mode 100644 index eab1e9bd0e..0000000000 --- a/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news) -[#]: via: (https://opensource.com/article/19/10/news-october-13) -[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) - -System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we cover System76 shipping Coreboot-powered firmware, a new OS for the apocalypse, and more open source news! - -### System76 will ship 2 Linux laptops with Coreboot-powered open source firmware - -The Denver-based Linux PC manufacturer announced plans to start shipping two laptop models with its Coreboot-powered open source firmware later this month. Jason Evangelho, Senior Contributor at _Forbes_, cited this move as a march towards offering open source software and hardware from the ground up.  - -System76, which also develops [Pop OS][2], is now taking pre-orders for its Galago Pro and Darter Pro laptops. It claims that Coreboot will let users boot from power off to the desktop 29% faster. - -Coreboot is a lightweight firmware designed to simplify the boot cycle of systems using it. It requires the minimum number of tasks needed to load and run a modern 32-bit or 64-bit operating system. Coreboot can offer a replacement for proprietary firmware, though it omits features like execution environments. Our own [Don Watkins][3] asked if Coreboot will ship on other System76 machines. Their response, [as reported by _Forbes_][4]: - -> _"Yes. Long term, System76 is working to open source all aspects of the computer. Thelio Io, the controller board in the Thelio desktop, is both open hardware and open firmware. This is a long journey but we're picking up speed. It's been less than a year since the our open hardware Thelio desktop was released and we're now producing two laptops with System76 Open Firmware."_ - -### Collapse OS is an operating system for the post-apocalypse - -Virgil Dupras, a software developer based in Quebec, is convinced the world's global supply chain will collapse before 2030. And he's worried that most [electronics will get caught in the crosshairs][5] due to "a very complex supply chain that we won't be able to achieve again for decades (ever?)."  - -To prepare for the worst, Dupras built Collapse OS. It's [designed to run][6] on "minimal or improvised machines" and perform simple tasks that are helpful in a post-apocalyptic society. These include editing text files, collecting sources files for MCUs and CPUs, and reading/writing from several storage devices. - -Dupras says it's intended for worst-case scenarios, and that a "weak collapse" might not be enough to justify its use. If you err on the side of caution, the Collapse OS project is accepting new contributors [on GitHub][7].  - -Per the project website, Dupras says his goal is for Collapse OS to be as self-contained as possible with the ability for users to install the OS without Internet access or other resources. Ideally, the goal is for Collapse OS to not be used at all. - -### ExpressionEngine will stay open source post-acquisition - -The team behind open source CMS ExpressEngine was acquired by Packet Tide - EEHarbor's parent company - in early October. [This announcement ][8]comes one year after Digital Locations acquired EllisLab, which develops EE core.  - -[In an announcement][9] on ExpressionEngine's website, EllisLab founder Rick Ellis said Digital Locations wasn't a good fit for ExpressionEngine. Citing Digital Location's goals to build an AI business, Ellis realized several months ago that ExpressionEngine needed a new home: - -> _"We decided that what was best for ExpressionEngine was to seek a new owner, one that could devote all the resources necessary for ExpressionEngine to flourish. Our top candidate was Packet Tide due to their development capability, extensive catalog of add-ons, and deep roots in the ExpressionEngine community._ -> -> _We are thrilled that they immediately expressed enthusiastic interest in becoming the caretakers of ExpressionEngine."_ - -Ellis says Packet Tide's first goal is to finish building ExpressionEngine 6.0, which will have a new control panel with a dark theme (who doesn't love dark mode?). ExpressionEngine adopted the Apache License Version 2.0 in November 2018, after 16 years as a proprietary tool. - -The tool is still marketed as an open source CMS, and EE Harbor developer Tom Jaeger said [in the EE Slack][10] that their plan is to keep ExpressionEngine open source now. But he also left the door open to possible changes.  - -### McAfee and IBM Security to lead the Open Source Cybersecurity Alliance - -The two tech giants will contribute the initiative's first open source code and content, under guidance from the OASIS consortium. The Alliance aims to share best practices, tech stacks, and security solutions in an open source platform.  - -Carol Geyer, chief development officer of OASIS, said the lack of standard language makes it hard for businesses to share data between tools and products. Despite efforts to collaborate, the lack of a standardized format yields more integration costs that are expensive and time-consuming. - -In lieu of building connections and integrations, [the Alliance wants members][11] to "develop protocols and standards which enable tools to work together and share information across vendors."  - -According to _Tech Republic_, IBM Security will contribute [STIX-Shifter][12], an open source library that offer a universal security system. Meanwhile, McAfee added its [OpenDXL Standard Ontology][13], a cybersecurity messaging format. Other members of the Alliance include CrowdStrike, CyberArk, and SafeBreach. - -#### In other news - - * [Paris uses open source to get closer to the citizen][14] - * [SD Times open source project of the week: ABAP SDK for IBM Watson][15] - * [Google's keeping Knative development under its thumb 'for the foreseeable future'][16] - * [Devs engage in soul-searching on future of open source][17] - * [Why leading Formula 1 teams back 'copycat' open source design idea][18] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/news-october-13 - -作者:[Lauren Maffeo][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lmaffeo -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://system76.com/pop -[3]: https://opensource.com/users/don-watkins -[4]: https://www.forbes.com/sites/jasonevangelho/2019/10/10/system76-will-begin-shipping-2-linux-laptops-with-coreboot-based-open-source-firmware/#15a4da174e64 -[5]: https://collapseos.org/why.html -[6]: https://www.digitaltrends.com/cool-tech/collapse-os-after-societys-collapse/ -[7]: https://github.com/hsoft/collapseos -[8]: https://wptavern.com/expressionengine-under-new-ownership-will-remain-open-source-for-now -[9]: https://expressionengine.com/blog/expressionengine-has-a-new-owner -[10]: https://eecms.slack.com/?redir=%2Farchives%2FC04CUNNR9%2Fp1570576465005500 -[11]: https://www.techrepublic.com/article/mcafee-ibm-join-forces-for-global-open-source-cybersecurity-initiative/ -[12]: https://github.com/opencybersecurityalliance/stix-shifter -[13]: https://www.opendxl.com/ -[14]: https://www.smartcitiesworld.net/special-reports/special-reports/paris-uses-open-source-to-get-closer-to-the-citizen -[15]: https://sdtimes.com/os/sd-times-open-source-project-of-the-week-abap-sdk-for-ibm-watson/ -[16]: https://www.datacenterknowledge.com/google-alphabet/googles-keeping-knative-development-under-its-thumb-foreseeable-future -[17]: https://www.linuxinsider.com/story/86282.html -[18]: https://www.autosport.com/f1/news/146407/why-leading-f1-teams-back-copycat-design-proposal diff --git a/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md b/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md deleted file mode 100644 index 13bc238c2c..0000000000 --- a/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco issues critical security warning for IOS XE REST API container) -[#]: via: (https://www.networkworld.com/article/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco issues critical security warning for IOS XE REST API container -====== -This Cisco IOS XE REST API vulnerability could lead to attackers obtaining the token-id of an authenticated user. -D3Damon / Getty Images - -Cisco this week said it issued a software update to address a vulnerability in its [Cisco REST API virtual service container for Cisco IOS XE][1] software that scored a critical 10 out of 10 on the Common Vulnerability Scoring System (CVSS) system. - -With the vulnerability an attacker could submit malicious HTTP requests to the targeted device and if successful, obtain the _token-id_ of an authenticated user. This _token-id_ could be used to bypass authentication and execute privileged actions through the interface of the REST API virtual service container on the affected Cisco IOS XE device, the company said. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] - -According to Cisco the REST API is an application that runs in a virtual services container. A virtual services container is a virtualized environment on a device and is delivered as an open virtual application (OVA).  The OVA package has to be installed and enabled on a device through the device virtualization manager (VMAN) CLI. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][3] ]** - -The Cisco REST API provides a set of RESTful APIs as an alternative method to the Cisco IOS XE CLI to provision selected functions on Cisco devices. - -Cisco said the vulnerability can be exploited under the  following conditions: - - * The device runs an affected Cisco IOS XE Software release. - * The device has installed and enabled an affected version of the Cisco REST API virtual service container. - * An authorized user with administrator credentials (level 15) is authenticated to the REST API interface. - - - -The REST API interface is not enabled by default. To be vulnerable, the virtual services container must be installed and activated. Deleting the OVA package from the device storage memory removes the attack vector. If the Cisco REST API virtual service container is not enabled, this operation will not impact the device's normal operating conditions, Cisco stated.    - -This vulnerability affects Cisco devices that are configured to use a vulnerable version of Cisco REST API virtual service container. This vulnerability affected the following products: - - * Cisco 4000 Series Integrated Services Routers - * Cisco ASR 1000 Series Aggregation Services Routers - * Cisco Cloud Services Router 1000V Series - * Cisco Integrated Services Virtual Router - - - -Cisco said it has [released a fixed version of the REST API][4] virtual service container and   a hardened IOS XE release that prevents installation or activation of a vulnerable container on a device. If the device was already configured with an active vulnerable container, the IOS XE software upgrade will deactivate the container, making the device not vulnerable. In that case, to restore the REST API functionality, customers should upgrade the Cisco REST API virtual service container to a fixed software release, the company said. - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.html - -作者:[Michael Cooney][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Michael-Cooney/ -[b]: https://github.com/lujun9972 -[1]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190828-iosxe-rest-auth-bypass -[2]: https://www.networkworld.com/newsletters/signup.html -[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[4]: https://www.cisco.com/c/en/us/about/legal/cloud-and-software/end_user_license_agreement.html -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md b/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md deleted file mode 100644 index b50a93d8c1..0000000000 --- a/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news) -[#]: via: (https://opensource.com/article/19/10/news-october-26) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look at a machine learning tool from Netflix, Microsoft's election software bug bounty, a cost-effective microscope built with Raspberry Pi, and more! - -### Netflix release Polynote machine learning tool - -While there have been numerous advances in machine learning over the last decade, it's still a difficult, laborious, and sometimes frustrating task. To help make that task easier, Netflix has [released a machine learning notebook environment][2] called Polynote as open source. - -Polynote enables "data scientists and AI researchers to integrate Netflix’s JVM-based machine learning framework with Python machine learning and visualization libraries". What make Polynote unique is its reproducibility feature, which "takes cells’ positions in the notebook into account before executing them, helping prevent bad practices that make notebooks difficult to rerun from the top." It's also quite flexible—Polynote works with Apache Spark and supports languages like Python, Scala, and SQL. - -You can grab Polynote [off GitHub][3] or learn more about it at the Polynote website. - -### Microsoft announces bug bounty program for its election software - -Hoping that more eyeballs on its code will make bugs shallow, Microsoft announced a [a bug bounty][4] for its open source ElectionGuard software development kit for voting machines. The goal of the program is to "uncover vulnerabilities and help bolster election security." - -The bounty is open to "security professionals, part-time hobbyists, and students." Successful submissions, which must include proofs of concept demonstrating how bugs could compromise the security of voters, are worth up to $15,000 (USD). - -If you're interested in participating, you can find ElectionGuard's code on [GitHub][5], and read more about the [bug bounty][6]. - -### microscoPI: a microscope built on Raspberry Pi - -It's not a stretch to say that the Raspberry Pi is one of the most flexible platforms for hardware and software hackers. Micropalaeontologist Martin Tetard saw the potential of the tiny computers in his field of study and [create the microscoPI][7]. - -The microscoPI is a Raspberry Pi-assisted microscope that can "capture, process, and store images and image analysis results." Using an old adjustable microscope with a movable stage as a base, Tetard added a Raspberry Pi B, a Raspberry Pi camera module, and a small touchscreen to the device. The result is a compact rig that's "completely portable and measuring less than 30 cm (12 inches) in height." The entire setup cost him €159 (about $177 USD). - -Tetard has set up [a website][8] for the microscoPI, where you can learn more about it. - -#### In other news - - * [Happy 15th birthday, Ubuntu][9] - * [Open-Source Arm Puts Robotics Within Reach][10] - * [Apache Rya matures open source triple store database][11] - * [UNICEF Launches Cryptocurrency Fund to Back Open Source Technology][12] - * [Open-source Delta Lake project moves to the Linux Foundation][13] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/news-october-26 - -作者:[Scott Nesbitt][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://venturebeat.com/2019/10/23/netflix-open-sources-polynote-to-simplify-data-science-and-machine-learning-workflows/ -[3]: https://github.com/polynote/polynote -[4]: https://thenextweb.com/security/2019/10/21/microsofts-open-source-election-software-now-has-a-bug-bounty-program/ -[5]: https://github.com/microsoft/ElectionGuard-SDK -[6]: https://www.microsoft.com/en-us/msrc/bounty -[7]: https://www.geeky-gadgets.com/raspberry-pi-microscope-07-10-2019/ -[8]: https://microscopiproject.wordpress.com/ -[9]: https://www.omgubuntu.co.uk/2019/10/happy-birthday-ubuntu-2019 -[10]: https://hackaday.com/2019/10/17/open-source-arm-puts-robotics-within-reach/ -[11]: https://searchdatamanagement.techtarget.com/news/252472464/Apache-Rya-matures-open-source-triple-store-database -[12]: https://www.coindesk.com/unicef-launches-cryptocurrency-fund-to-back-open-source-technology -[13]: https://siliconangle.com/2019/10/16/open-source-delta-lake-project-moves-linux-foundation/ diff --git a/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md b/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md deleted file mode 100644 index b8a6aafc80..0000000000 --- a/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Hypervisor comeback, Linus says no and reads email, and more industry trends) -[#]: via: (https://opensource.com/article/19/11/hypervisor-stable-kernel-and-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Hypervisor comeback, Linus says no and reads email, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Containers in 2019: They're calling it a [hypervisor] comeback][2] - -> So what does all this mean as we continue with rapid adoption and hyper-ecosystem growth around Kubernetes and containers? Let’s try and break that down into a few key areas and see what all the excitement is about. - -**The impact**: I'm pretty sure that the title of the article is an LL Cool J reference, which I wholeheartedly approve of. Even more important though is a robust unpacking of developments in the hypervisor space over the last year and how they square up against the trend towards cloud-native and container-based development. - -## [Linux kernel is getting more reliable, says Linus Torvalds. Plus: What do you need to do to be him?][3] - -> "In the end my job is to say no. Somebody has to be able to say no, because other developers know that if they do something bad I will say no. They hopefully in turn are more careful. But in order to be able to say no, I have to know the background, because otherwise I can't do my job. I spend all my time basically reading email about what people are working on. - -**The impact**: The rehabilitation of Linus as a much chiller guy continues; this one has some good advice for people leading distributed teams. - -## [Automated infrastructure in the on-premise datacenter—OpenShift 4.2 on OpenStack 15 (Stein)][4] - -> Up until now IPI (Installer Provision Infrastructure) has only supported public clouds: AWS, Azure, and Google. Now with OpenShift 4.2 it is supporting OpenStack. For the first time we can bring IPI into the on-premise datacenter where it is IMHO most needed. This single feature has the potential to revolutionize on-premise environments and bring them into the cloud-age with a single click and that promise is truly something to get excited about! - -**The impact**: So much tech press has started with the assumption that every company should run their infrastructure like a hyperscaler. The technology is catching up to make the user experience of that feasible. - -## [Kubernetes autoscaling 101: Cluster autoscaler, horizontal autoscaler, and vertical pod autoscaler][5] - -> I’m providing in this post a high-level overview of different scalability mechanisms inside Kubernetes and best ways to make them serve your needs. Remember, to truly master Kubernetes, you need to master different ways to manage the scale of cluster resources, that’s [the core of promise of Kubernetes][6]. -> -> _Configuring Kubernetes clusters to balance resources and performance can be challenging, and requires expert knowledge of the inner workings of Kubernetes. Just because your app or services’ workload isn’t constant, it rather fluctuates throughout the day if not the hour. Think of it as a journey and ongoing process._ - -**The impact**: You can tell whether someone knows what they're talking about if they can represent it in a simple diagram. Thanks to the excellent diagrams in this post, I know more day 2 concerns of Kubernetes operators than I ever wanted to. - -## [GitHub: All open source developers anywhere are welcome][7] - -> Eighty percent of all open-source contributions today, come from outside of the US. The top two markets for open source development outside of the US are China and India. These markets, although we have millions of developers in them, are continuing to grow faster than any others at about 30% year-over-year average. - -**The impact**: One of my open source friends likes to muse on the changing culture within the open source community. He posits that the old guard gatekeepers are already becoming irrelevant. I don't know if I completely agree, but I think you can look at the exponentially increasing contributions from places that haven't been on the open source map before and safely speculate that the open source culture of tomorrow will be radically different than that of today. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/hypervisor-stable-kernel-and-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.infoq.com/articles/containers-hypervisors-2019/ -[3]: https://www.theregister.co.uk/2019/10/30/linux_kernel_is_getting_more_reliable_says_linus_torvalds/ -[4]: https://keithtenzer.com/2019/10/29/automated-infrastructure-in-the-on-premise-datacenter-openshift-4-2-on-openstack-15-stein/ -[5]: https://www.cncf.io/blog/2019/10/29/kubernetes-autoscaling-101-cluster-autoscaler-horizontal-autoscaler-and-vertical-pod-autoscaler/ -[6]: https://speakerdeck.com/thockin/everything-you-ever-wanted-to-know-about-resource-scheduling-dot-dot-dot-almost -[7]: https://www.zdnet.com/article/github-all-open-source-developers-anywhere-are-welcome/#ftag=RSSbaffb68 diff --git a/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md b/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md deleted file mode 100644 index 9addd4102c..0000000000 --- a/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Red Hat announces RHEL 8.1 with predictable release cadence) -[#]: via: (https://www.networkworld.com/article/3451367/red-hat-announces-rhel-8-1-with-predictable-release-cadence.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Red Hat announces RHEL 8.1 with predictable release cadence -====== - -[Clkr / Pixabay][1] [(CC0)][2] - -[Red Hat][3] has just today announced the availability of Red Hat Enterprise Linux (RHEL) 8.1, promising improvements in manageability, security and performance. - -RHEL 8.1 will enhance the company’s open [hybrid-cloud][4] portfolio and continue to provide a consistent user experience between on-premises and public-cloud deployments. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] - -RHEL 8.1 is also the first release that will follow what Red Hat is calling its "predictable release cadence". Announced at Red Hat Summit 2019, this means that minor releases will be available every six months. The expectation is that this rhythmic release cycle will make it easier both for customer organizations and other software providers to plan their upgrades. - -[][6] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][6] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -Red Hat Enterprise Linux 8.1 provides product enhancements in many areas. - -### Enhanced automation - -All supported RHEL subscriptions now include access to Red Hat's proactive analytics, **Red Hat Insights**. With more than 1,000 rules for operating RHEL systems whether on-premises or cloud deployments, Red Hat Insights help IT administrators flag potential configuration, security, performance, availability and stability issues before they impact production. - -### New system roles - -RHEL 8.1 streamlines the process for setting up subsystems to handle specific functions such as storage, networking, time synchronization, kdump and SELinux. This expands on the variety of Ansible system roles. - -### Live kernel patching - -RHEL 8.1 adds full support for live kernel patching. This critically important feature allows IT operations teams to deal with ongoing threats without incurring excessive system downtime. Kernel updates can be applied to remediate common vulnerabilities and exposures (CVE) while reducing the need for a system reboot. Additional security enhancements include enhanced CVE remediation, kernel-level memory protection and application whitelisting. - -### Container-centric SELinux profiles - -These profiles allow the creation of more tailored security policies to control how containerized services access host-system resources, making it easier to harden systems against security threats. - -### Enhanced hybrid-cloud application development - -A reliably consistent set of supported development tools is included, among them the latest stable versions of popular open-source tools and languages like golang and .NET Core as well as the ability to power modern data-processing workloads such as Microsoft SQL Server and SAP solutions. - -Red Hat Linux 8.1 is available now for RHEL subscribers via the [Red Hat Customer Portal][7]. Red Hat Developer program members may obtain the latest releases at no cost at the [Red Hat Developer][8] site. - -#### Additional resources - -Here are some links to  additional information: - - * More about [Red Hat Enterprise Linux][9] - * Get a [RHEL developer subscription][10] - * More about the latest features at [Red Hat Insights][11] - - - -Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3451367/red-hat-announces-rhel-8-1-with-predictable-release-cadence.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://pixabay.com/vectors/red-hat-fedora-fashion-style-26734/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/article/3316960/ibm-closes-34b-red-hat-deal-vaults-into-multi-cloud.html -[4]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html -[5]: https://www.networkworld.com/newsletters/signup.html -[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[7]: https://access.redhat.com/ -[8]: https://developer.redhat.com -[9]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[10]: https://developers.redhat.com/ -[11]: https://www.redhat.com/en/blog/whats-new-red-hat-insights-november-2019 -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md b/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md deleted file mode 100644 index 4d9c336304..0000000000 --- a/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md +++ /dev/null @@ -1,57 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (System76 introduces laptops with open source BIOS coreboot) -[#]: via: (https://opensource.com/article/19/11/coreboot-system76-laptops) -[#]: author: (Don Watkins https://opensource.com/users/don-watkins) - -System76 introduces laptops with open source BIOS coreboot -====== -The company answers open hardware fans by revealing two laptops powered -with open source firmware coreboot. -![Guy on a laptop on a building][1] - -In mid-October, [System76][2] made an exciting announcement for open source hardware fans: It would soon begin shipping two of its laptop models, [Galago Pro][3] and [Darter Pro][4], with the open source BIOS [coreboot][5]. - -The coreboot project [says][6] its open source firmware "is a replacement for your BIOS / UEFI with a strong focus on boot speed, security, and flexibility. It is designed to boot your operating system as fast as possible without any compromise to security, with no back doors, and without any cruft from the '80s." Coreboot was previously known as LinuxBIOS, and the engineers who work on coreboot have also contributed to the Linux kernel. - -Most firmware on computers sold today is proprietary, which means even if you are running an open source operating system, you have no access to your machine's BIOS. This is not so with coreboot. Its developers share the improvements they make, rather than keeping them secret from other vendors. Coreboot's source code can be inspected, learned from, and modified, just like any other open source code. - -[Joshua Woolery][7], marketing director at System76, says coreboot differs from a proprietary BIOS in several important ways. "Traditional firmware is closed source and impossible to review and inspect. It's bloated with unnecessary features and unnecessarily complex [ACPI][8] implementations that lead to PCs operating in unpredictable ways. System76 Open Firmware, on the other hand, is lightweight, fast, and cleanly written." This means your computer boots faster and is more secure, he says. - -I asked Joshua about the impact of coreboot on open hardware overall. "The combination of open hardware and open firmware empowers users beyond what's possible when one or the other is proprietary," he says. "Imagine an open hardware controller like [System76's] [Thelio Io][9] without open source firmware. One could read the schematic and write software to control it, but why? With open firmware, the user starts from functioning hardware and software and can expand from there. Open hardware and firmware enable the community to learn from, adapt, and expand on our work, thus moving technology forward as a whole rather than requiring individuals to constantly re-implement what's already been accomplished." - -Joshua says System76 is working to open source all aspects of the computer, and we will see coreboot on other System76 machines. The hardware and firmware in Thelio Io, the controller board in the company's Thelio desktops, are both open. Less than a year after System76 introduced Thelio, the company is now marketing two laptops with open firmware. - -If you would like to see System76's firmware contributions to the coreboot project, visit the code repository on [GitHub][10]. You can also see the schematics for any supported System76 model by sending an [email][11] with the subject line: _Schematics for <MODEL>_. (Bear in mind that the only currently supported models are darp6 and galp4.) Using the coreboot firmware on other devices is not supported and may render them inoperable, - -Coreboot is licensed under the GNU Public License. You can view the [documentation][12] on the project's website and find out how to [contribute][13] to the project on GitHub. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/coreboot-system76-laptops - -作者:[Don Watkins][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/don-watkins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) -[2]: https://opensource.com/article/19/5/system76-secret-sauce -[3]: https://system76.com/laptops/galago -[4]: https://system76.com/laptops/darter -[5]: https://www.coreboot.org/ -[6]: https://www.coreboot.org/users.html -[7]: https://www.linkedin.com/in/joshuawoolery -[8]: https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface -[9]: https://opensource.com/article/18/11/system76-thelio-desktop-computer -[10]: https://github.com/system76/firmware-open -[11]: mailto:productdev@system76.com -[12]: https://doc.coreboot.org/index.html -[13]: https://github.com/coreboot/coreboot diff --git a/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md b/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md deleted file mode 100644 index df2db0d6f8..0000000000 --- a/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (GitHub report surprises, serverless hotness, and more industry trends) -[#]: via: (https://opensource.com/article/19/11/github-report-serverless-hotness-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -GitHub report surprises, serverless hotness, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [GitHub tops 40 million developers as Python, data science, machine learning popularity surges][2] - -> In its annual Octoverse report, GitHub, owned by Microsoft, said it had more than 10 million new users, 44 million repositories created and 87 million pull requests in the last 12 months. The report is a good view of open source software and where the community is headed. - -**The impact:** The finding that hit home hardest for me is that "nearly 80% of GitHub users are outside of the US." While an important part of open source history comes from the east and west coasts of America, there is a good chance that the future of the movement will happen elsewhere. - -## [Serverless: Is it the Kubernetes killer?][3] - -> Serverless isn't here to destroy Kubernetes. The cloud infrastructure space race isn't a zero-sum game. Kubernetes is an obvious evolution following OpenStack and can be run successfully inside of it. There will be OpenStack users for a long time to come, and there are also reasons many companies have moved on from there. Serverless is another tool in the belt of forward-thinking development teams. And increasingly, it can be [run on top of Kubernetes][4] (see Knative), enabling you to get the benefits of the simplicity of serverless and the complexity of Kubernetes where it makes sense for both in your stack. - -**The impact:** The moral of the story is that legacy doesn't really go away, it just gets built in and around. - -## [When Quarkus meets Knative serverless workloads][5] - -> Now, let's discuss how developers can use Quarkus to bring Java into serverless, a place where previously, it was unable to go. Quarkus introduces a comprehensive and seamless approach to generating an operating system specific (aka native) executable from your Java code, as you do with languages like Go and C/C++. Environments such as event-driven and serverless, where you need to start a service to react to an event, require a low time-to-first-response, and traditional Java stacks simply cannot provide this. Knative enables developers to run cloud-native applications as serverless containers in seconds and the containers will go down to zero on demand. -> -> In addition to compiling Java to Knative, Quarkus aims to improve developer productivity. Quarkus works out of the box with popular Java standards, frameworks and libraries like Eclipse MicroProfile, Apache Kafka, RESTEasy, Hibernate, Spring, and many more. Developers familiar with these will feel at home with Quarkus, which should streamline code for the majority of common use cases while providing the flexibility to cover others that come up. - -**The impact:** It's good to start getting specific with how and where the new hotness can be used. The answer, in this case, is "with the other new hotness." - -## [Why you should join the CNCF Meetup Program][6] - -> With the recent changes to Meetup’s [policies][7], we wanted to share a reminder of the benefits of joining the [CNCF Meetup Program][8] and encourage Meetups in the CNCF ecosystem to apply.  -> -> As part of our Meetup Pro membership, CNCF is able to organize a network with an unlimited number of groups on a single account. - -**The impact:** The long term response to this unfortunate fallout from the WeWork debacle is to build a distributed open source Meetup alternative. Thankfully in the meantime, the CNCF has a more pragmatic response. - -## [Introducing your friends to automation (and overcoming their fear)][9] - -> My team and I were in a meeting a little while back with a third party vendor when they asked us what our stance was on automation. My reply was, "We want to automate everything." On top of my reply, my teammates added, "Well, we don’t want to automate ourselves out of a job." - -**The impact:** I've always thought it was a bit cavalier when someone would say, "I think it's my job to automate myself out of a job." There is plenty of circumstances where that is the last measure of success someone would want to be measured by. I'm happy to see this addressed head-on. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/github-report-serverless-hotness-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.zdnet.com/article/github-tops-40-million-developers-as-python-data-science-machine-learning-popularity-surges/#ftag=RSSbaffb68 -[3]: https://www.forbes.com/sites/forbestechcouncil/2019/11/04/serverless-is-it-the-kubernetes-killer/#7e6740711f77 -[4]: https://github.com/knative -[5]: https://vmblog.com/archive/2019/10/29/when-quarkus-meets-knative-serverless-workloads.aspx#.XbiN1JNKiuN -[6]: https://www.cncf.io/blog/2019/11/01/why-you-should-join-the-cncf-meetup-program/ -[7]: https://www.meetup.com/lp/paymentchanges?mpId=9038 -[8]: https://www.meetup.com/pro/cncf -[9]: https://www.redhat.com/sysadmin/introducing-automation diff --git a/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md b/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md deleted file mode 100644 index c4f25f1419..0000000000 --- a/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Cross-Platform Source Explorer Sourcetrail is Now Open Source) -[#]: via: (https://itsfoss.com/sourcetrail/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -The Cross-Platform Source Explorer Sourcetrail is Now Open Source -====== - -[Sourcetrail][1] is a cross-platform source explorer that lets you visualize the unfamiliar source code by using graph visualization. - -![][2] - -In other words, it makes it easy to understand the structure of source code and how it works (technically) by visually representing them using a graph. - -This is particularly helpful when you join a project and you have to work on existing code written in the past by several developers. - -You can use it with your favorite IDE like Eclipse, IntelliJ IDEA, PyCharm or code editors like Atom, Visual Studio Code, Sublime Text etc. It supports C, C++, Java and Python. - -This old video gives you the introduction to Sourcetrail: - -Even though it was free for non-commercial use, they charged for a commercial license. However, they recently decided to make the whole thing free and open source. - -So, yes, you can find their source code listed on [GitHub][3] now. - -### What Has Changed for Sourcetrail? - -The reason they switched as an open-source solution is that they wanted their tool to be accessible to more developers. - -Their commercial licensing plan was supposed to help them make money – however, it limited the reach of their project. - -In their [announcement post][4], they mentioned their idea of this decision as follows: - -> We have been going back and forth, discussing and testing potential solutions to many of those issues for a long time now. Many of our thoughts revolved around how to make more money and use it to solve those issues. Looking at other companies in the field, it seemed that to make more money, our only option was making our licenses more and more expensive, which in turn would limit our audience to fewer developers. We always dismissed the idea because **we started to make Sourcetrail to benefit as many developers as possible** and not to be a premium product for a few people in a handful of companies. - -Also, they found it tough to provide cross-platform support while trying to reproduce the issues and apply a fix to them, especially for Linux distros. So, making their project open source was an ideal choice. - -To further clarify the situation they also explained why their commercial licensing plan wasn’t working out: - -> Initially we received a couple of public grants that allowed us to launch Sourcetrail publicly. We decided to go down the traditional road of selling software licenses to sustain further development. Of course that meant to keep the code private if we wanted to protect our business…In retrospect, this decision really narrowed down our user base, making it hard for developers to start using Sourcetrail for multiple reasons - -You can find all the details for what they plan for the future in their [announcement post][4]. - -### How to get Sourcetrail on Linux? - -You can find and download the latest release of Sourcetrail on its release page on GitHub: - -[Download Sourcetrail][5] - -Extract the downloaded file and you’ll see a Sourcetrail.sh shell script. Run this script with sudo to install Sourcerail. - -You should [read the documentation][6] for the project setup. They also have some [useful tutorial videos on their YouTube channel][7]. - -Sourcetrail was free before but now it’s free in the true sense. It’s good to see that the developers have made it open source and now more programmers can use this tool to understand large, shared code base. You may also checkout a slightly similar open source tool [Sourcegraph][8]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/sourcetrail/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.sourcetrail.com/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/sourcetrail-ui.png?ssl=1 -[3]: https://github.com/CoatiSoftware/Sourcetrail -[4]: https://www.sourcetrail.com/blog/open_source/ -[5]: https://github.com/CoatiSoftware/Sourcetrail/releases -[6]: https://www.sourcetrail.com/documentation/#PROJECTSETUP -[7]: https://www.youtube.com/channel/UCuKthdG-V4n2RZ1HDJhGVpQ/videos -[8]: https://itsfoss.com/sourcegraph/ diff --git a/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md new file mode 100644 index 0000000000..cc2a666e32 --- /dev/null +++ b/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Nvidia quietly unveils faster, lower power Tesla GPU accelerator) +[#]: via: (https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Nvidia quietly unveils faster, lower power Tesla GPU accelerator +====== +Nvidia has upgraded its Volta line of Tesla GPU-accelerator cards to work faster using the same power as its old model. +client + +Nvidia was all over Supercomputing 19 last week, not surprisingly, and made a lot of news which we will get into later. But overlooked was perhaps the most interesting news of all: a new generation graphics-acceleration card that is faster and way more power efficient. + +Multiple attendees and news sites spotted it at the show, and Nvidia confirmed to me that this is indeed a new card. Nvidia’s “Volta” generation of Tesla GPU-accelerator cards has been out since 2017, so an upgrade was well overdue. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +The V100S comes only in PCI Express 3 form factor for now but is expected to eventually support Nvidia’s SXM2 interface. SXM is a dual-slot card design by Nvidia that requires no connection to the power supply, unlike the PCIe cards. SXM2 allows the GPU to communicate either with each other or to the CPU through Nvidia’s NVLink, a high-bandwidth, energy-efficient interconnect that can transfer data up to ten times faster than PCIe. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +With this card, Nvidia is claiming 16.4 single-precision TFLOPS, 8.2 double-precision TFLOPS, and Tensor Core performance of up to 130 TFLOPS. That is only a 4-to-5 percent improvement over the V100 SXM2 design, but 16-to-17 percent faster than the PCIe V100 variant. + +Memory capacity remains at 32GB but Nvidia added High Bandwidth Memory 2 (HBM2) to increase memory performance to 1,134GB/s, a 26 percent improvement over both PCIe and SXM2. + +Now normally a performance boost would see a concurrent increase in power demand, but in this case, the power envelope for the PCIe card is 250 watts, same as the prior generation PCIe card. So this card delivers 16-to-17 percent more compute performance and 26 percent more memory bandwidth at the same power draw. + +**Other News** + +Nvidia made some other news at the conference: + + * A new reference design and ecosystem support for its GPU-accelerated Arm-based reference servers for high-performance computing. The company says it has support from HPE/Cray, Marvell, Fujitsu, and Ampere, the startup led by former Intel executive Renee James looking to build Arm-based server processors. + * These companies will use Nvidia's reference design, which consists of hardware and software components, to build their own GPU-accelerated servers for everything from hyperscale cloud providers to high-performance storage and exascale supercomputing. The design also comes with CUDA-X, a special version of Nvidia’s CUDA GPU development language for Arm processors. + * Launch of Nvidia Magnum IO suite of software designed to help data scientists and AI and high-performance-computing researchers process massive amounts of data in minutes rather than hours. It is optimized to eliminate storage and I/O bottlenecks to deliver up to 20x faster data processing for multi-server, multi-GPU computing nodes. + * Nvidia and DDN, developer of AI and multicloud data management, announced a bundling of DDN’s A3ITM data management system with Nvidia’s DGX SuperPOD systems with so customers can deploy HPC infrastructure with minimal complexity and reduced timelines. The SuperPODs would also come with the new NVIDIA Magnum IO software stack. + * DDN said that SuperPOD was able to be deployed within hours and a single appliance could scale all to 80 nodes.  Benchmarks over a variety of different deep-learning models showed that the DDN system could keep a DGXSuperPOD system fully saturated with data. + + + +**Now see** [**10 of the world's fastest supercomputers**][3] + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md b/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md new file mode 100644 index 0000000000..51151d2e87 --- /dev/null +++ b/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zorin OS Responds to the Privacy Concerns) +[#]: via: (https://itsfoss.com/zorin-os-privacy-concerns/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zorin OS Responds to the Privacy Concerns +====== + +_**There were some privacy concerns around ‘data collection’ in Zorin OS. It’s FOSS spoke to Zorin OS CEO and here is his response to the controversy.**_ + +After a few days of [Zorin OS 15 Lite][1] release, a Reddit thread surfaced which flagged a privacy concern regarding the Linux distribution. + +The [Reddit thread][2] focuses on the [privacy policy][3] of Zorin OS and warns users that Zorin OS is sending anonymous pings every 60 minutes without users’ consent, which is potentially a privacy issue. + +![][4] + +The policy in question can be quoted here as: + +> _**Anonymous pings**: When using Zorin OS, your computer may occasionally send us a ping which includes an anonymous unique identifier for your computer. We use this information to count the number of active users of Zorin OS. The unique identifier does not identify you unless you (or someone acting on your behalf) discloses it separately. You may choose to disable these pings by uninstalling the “Zorin-os-census” package from your computer_ + +Now, there’s a lot of [discussions][5] surrounding the concern. There’s also a [YouTube video][6] talking about it. + +In a nutshell, it’s a mess. Some insist that they collect our IP addresses and some users complain that they should ask about it while installing Zorin OS. + +While I agree that they could add an opt-out option in the installation process – so I reached out to **Artyom Zorin** (_CEO, Zorin Group_) to clarify the situation. + +### Zorin’s Clarification On What They Collect With Every Anonymous Ping + +When I asked for an elaborate explanation of what the “**anonymous unique identifier**” includes, Artyom mentioned – “_It appears that there are some inaccuracies and misconceptions about the census in the comments sections_“. + +To continue the explanation about the unique identifier, he assured that **their servers do not log IP addresses** when a ping arrives. + +The zorin-os-census script **simply counts the number of unique computers using Zorin OS** and no personal data is being collected along with it. + +Artyom explained in detail: + +> The anonymous identifier is a series of letters and numbers which is randomly generated (not based on any external data) and only used for the Zorin OS Census. Its single purpose is to make sure that the computer isn’t double-counted when a ping is sent from a computer to the server. On a fully-installed Zorin OS system, the anonymous identifier can be found in /var/lib/zorin-os-census/uuid and should look like this:_68f2d95b-f51f-4a5d-9b48-a99c28691b89_ +> * +> *We would like to clarify that no personal or personally-identifiable data is being collected by us and the server does not log IP addresses when pings arrive. The zorin-os-census script is only used to count the number of computers and users running Zorin OS after installation. Even I wouldn’t be able to tell which computer is my own from looking at the server-side database. I have attached a screenshot of a snippet of the database table displaying the information we store. + +He also stressed his ‘commitment on privacy’: + +> Privacy is an essential human right. It’s a core tenet of our mission to give you back control of your technology, and not the other way around. We make privacy a priority with every decision we make, and we’re committed to protecting it in every level of the software we build. + +As you can observe in the response above, he shared a screenshot of how their database of unique identifiers looks like: + +![][7] + +If you’re still curious, you can also check out the [source code][8] for the zorin-os-census script. + +### Can We Opt-Out Of It? + +While the data collected may be ‘harmless’, it is important to give the option to the user whether or not they want Zorin OS to collect the data, right? + +So, when I inquired about the same, he mentioned that i**t was already something planned for Zorin OS 15 Lite release**. + +However, they did not want to rush to add it before properly testing it. Hence, they decided to keep it for the upcoming release (**Zorin OS 15.1**) which is planned to arrive in **early-to-mid December this year.** + +> We have in fact been working on implementing an opt-out option for this into the Zorin OS installer (Ubiquity). To ensure the stability and accessibility of this new functionality we’re adding to Ubiquity, we have scheduled a period of time to translate the text strings and rigorously test the software (in order to avoid regressions), as the installer is a critical component of the operating system. Unfortunately, the testing period for the opt-out option didn’t complete before our planned release of Zorin OS 15 Lite, and we, therefore, decided not to risk adding it before we could guarantee its stability. However, we are on track to include the opt-out option in the upcoming Zorin OS 15.1 release, which we plan to release in early-to-mid December. + +### Will It Be Something Similar To What Ubuntu Does? + +Ubuntu does let you opt-out from collecting information about your computer. + +So, when I asked if Zorin OS will add something similar to that, he responded with some details about how Ubuntu collects data and how Zorin OS is different from that. + +He mentioned the fact that Ubuntu comes pre-installed with a **popularity-contest** package that **occasionally sends data of what packages the user has installed** to the Ubuntu Developers. + +And, further clarified that **Zorin OS does not include that**. + +> While Ubuntu’s telemetry tool gives users the option to not send extensive information about the computers to the Ubuntu developers, selecting the “No” option still sends a ping to Ubuntu’s servers . +> +> From our research, it is not clear whether Ubuntu’s servers store logs of users’ IP addresses when they receive telemetry data. In addition, Zorin OS does not include the “popularity-contest” package that is pre-installed in Ubuntu. This package is designed to occasionally send a list of all packages a user has installed on their computer to the Ubuntu developers. + +**In the end…** + +While the concern regarding the anonymous pings may not seem to a privacy threat, an opt-out option should be presented to the user while installing Zorin OS. Let’s wait and watch if it should arrive in the upcoming Zorin OS 15.1 release. + +What do you think about the privacy concern mentioned above? Let us know your thoughts in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zorin-os-privacy-concerns/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/zorin-os-lite/ +[2]: https://www.reddit.com/r/FreeAsInFreedom/comments/e0yhw4/beware_zorin_os_sends_anonymous_pings_every_60/ +[3]: https://zorinos.com/legal/privacy/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-privacy-reddit.jpg?ssl=1 +[5]: https://www.reddit.com/r/linux/comments/e0zd5n/beware_zorin_os_sends_anonymous_pings_every_60/ +[6]: https://www.youtube.com/watch?v=bcgk9LvC36Y&feature=youtu.be&t=860 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-census-database.png?ssl=1 +[8]: https://launchpad.net/~zorinos/+archive/ubuntu/stable/+sourcepub/10183568/+listing-archive-extra diff --git a/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md b/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md new file mode 100644 index 0000000000..2835a5d06a --- /dev/null +++ b/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Music Notations Software MuseScore 3.3 Released!) +[#]: via: (https://itsfoss.com/musescore/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Open Source Music Notations Software MuseScore 3.3 Released! +====== + +_**Brief: MuseScore is an open-source software to help you create, play, and print sheet music. They released a major update recently. So, we take a look at what MuseScore has to offer**_ _**overall.**_ + +### MuseScore: A Music Composition and Notation Software + +![][1] + +[MuseScore][2] is open-source software that lets you create, play, and print [sheet music][3]. + +You can even use a MIDI keyboard as input and simply play the tune you want to create the notation of. + +In order to make use of it, you need to know how sheet music notations work. In either case, you can just play something using your MIDI keyboard or any other instrument and learn how the music notations work while using it. + +So, it should come in handy for beginners and experts as well. + +You can download and use MuseScore for free. However, if you want to share your music/composition and reach out to a wider community on the MuseScore platform, you can opt to create a free or premium account on [MuseScore.com][4]. + +### Features of MuseScore + +![Musescore 3 Screenshot][5] + +MuseScore includes a lot of things that can be highlighted. If you are someone who is not involved in making music notations for your compositions – you might have to dig deeper just like me. + +Usually, I just head over to any [DAW available on Linux][6] and start playing something to record/loop it without needing to create the music notations. So, for me, MuseScore definitely presents a learning curve with all the features offered. + +I’ll just list out the features with some brief descriptions – so you can explore them if it sounds interesting to you. + + * Supports Input via MIDI keyboard + * You can transfer to/from other programs via [MusicXML][7], MIDI, and other options. + * A Huge collection of palettes (music symbols) to choose from. + * You also get the ability to re-arrange the palettes and create your own list of most-used palettes or edit them. + * Some plugins supported to extend the functionality + * Import PDFs to read and play notations + * Several instruments supported + * Basic or Advanced layout of palettes to get started + + + +Some of the recent key changes include the palettes redesign, accessibility, and the not input workflow. For reference, you can check out how the new palettes work: + +### Installing MuseScore 3.3.3 on Ubuntu/Linux + +The latest version of MuseScore is 3.3.3 with all the bug fixes and improvements to its recent [MuseScore 3.3 release][8]. + +You may find an older release in your Software Center (or your official repo). So, you can either opt for a Flatpak package, Snap, or maybe an AppImage from its [download page][9] with links for different Linux distributions. + +[Download MuseScore][9] + +**Wrapping Up** + +I was quite fascinated to learn about MuseScore being an open-source and free solution to create, play, and print sheet music. + +It may not be the most easy-to-use software there is – but when considering the work with music notations, it will help you learn more about it and help you with your work as well. + +What do you think about MuseScore? Do share your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/musescore/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/musescore-3.jpg?ssl=1 +[2]: https://musescore.org/en +[3]: https://en.wikipedia.org/wiki/Sheet_music +[4]: https://musescore.com/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/musescore-3-screenshot.jpg?ssl=1 +[6]: https://itsfoss.com/best-audio-editors-linux/ +[7]: https://en.wikipedia.org/wiki/MusicXML +[8]: https://musescore.org/en/3.3 +[9]: https://musescore.org/en/download diff --git a/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md b/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md index 1d36d5e88d..1244f13079 100644 --- a/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md +++ b/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md @@ -1,3 +1,5 @@ +translating + Think global: How to overcome cultural communication challenges ====== Use these tips to ensure that every member of your global development team feels involved and understood. diff --git a/sources/talk/20191028 6 signs you might be a Linux user.md b/sources/talk/20191028 6 signs you might be a Linux user.md deleted file mode 100644 index d66d08cf35..0000000000 --- a/sources/talk/20191028 6 signs you might be a Linux user.md +++ /dev/null @@ -1,161 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 signs you might be a Linux user) -[#]: via: (https://opensource.com/article/19/10/signs-linux-user) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -6 signs you might be a Linux user -====== -If you're a heavy Linux user, you'll probably recognize these common -tendencies. -![Tux with binary code background][1] - -Linux users are a diverse bunch, but many of us share a few habits. You might not have any of the telltale signs listed in this article, and if you're a new Linux user, you may not recognize many of them... yet. - -Here are six signs you might be a Linux user. - -### 1\. As far as you know, the world began on January 1, 1970. - -There are many rumors about why a Unix computer clock always sets itself back to 1970-01-01 when it resets. But the mundane truth is that the Unix "epoch" serves as a common and simple reference point for synchronization. For example, Halloween is the 304th day of this year in the Julian calendar, but we commonly refer to the holiday as being "on the 31st". We know which 31st we mean because we have common reference points: We know that Halloween is celebrated in October and that October is the 10th month of the year, and we know how many days each preceding month contains. Without these values, we could use traditional methods of timekeeping, such as phases of the moon, to keep track of special seasonal events, but of course, a computer doesn't have that ability. - -A computer requires firm and clearly defined values, so the value 1970-01-01T00:00:00Z was chosen as the beginning of the Unix epoch. Any time a [POSIX][2] computer loses track of time, a service like the Network Time Protocol (NTP) can provide it the number of seconds since 1970-01-01T00:00:00Z, which the computer can convert to a human-friendly date. - -Date and time are a famously complex thing to track in computing, largely because there are exceptions to nearly standard. A month doesn't always have 30 days, a year doesn't always have 365 days, and even seconds tend to drift a little each year. If you're looking for a fun and frustrating programming exercise, try to program a reliable calendaring application! - -### 2\. You think it's a chore to type anything over two letters to get something done. - -The most common Unix commands are famously short. In addition to commands like **cd** and **ls** and **mv**, there's one command that literally can't get any shorter: **w** (which shows who is currently logged in according to the **/var/run/utmp** file). - -On the one hand, extremely short commands seem unintuitive. A new user probably isn't going to guess that typing **ls** would _list_ directories. Once you learn the commands, though, the shorter they are, the better. If you spend all day in a terminal, the fewer keystrokes you have to type means you can spend more time getting your work done. - -Luckily, single-letter commands are far and few between, which means you can use most letters for aliases. For example, I use Emacs often enough that I consider **emacs** too long to type, so I alias it to **e** by adding this line to my **.bashrc** file: - - -``` -`alias e='emacs'` -``` - -You can also alias commands temporarily. For instance, if you find yourself running [firewall-cmd][3] repeatedly while you troubleshoot a network issue, then you can create an alias just for your current session: - - -``` -$ alias f='firewall-cmd' -$ f -usage: see firewall-cmd man page -No option specified. -``` - -As long as the terminal is open, your alias persists. Once the terminal is closed, it's forgotten. - -### 3\. You think it's a chore to click more than two times to get something done. - -Linux users are fond of efficiency. While not every Linux user is always in a hurry to get things done, there are conventions in Linux desktops that seek to reduce the number of actions required to accomplish any given task. Here are some examples. - - * In the KDE file manager Dolphin, a single click opens a file or directory. It's assumed that if you want to select a file, you can either click and drag or else Ctrl+Click instead. This may confuse users who are used to double-clicking everything, but once you've tried single-click actions, you usually can't go back to laborious double-clicks. - * On most Linux desktops, a middle-click pastes the most recent contents of the clipboard. - * On many Linux desktops, drag actions can be modified by pressing the Alt, Ctrl, or Shift keys. For instance, Alt+Drag moves a window in KDE, and Ctrl+Drag in GNOME causes a file to be copied instead of moved. - - - -### 4\. You've never performed any action on a computer more than three times because you've already automated it by the third time. - -Pardon the hyperbole, but many Linux users expect their computer to work harder than they do. While it takes time to learn how to automate common tasks, it tends to be easier on Linux than on other platforms because the Linux terminal and the Linux operating system are so tightly integrated. The easy things to automate are the actions you already do in a terminal because commands are just strings that you type into an interpreter, and that interpreter (the terminal) doesn't care whether you typed the strings out manually or whether you're just pointing it to a script. - -For instance, if you find yourself frequently moving a set of files from one place to another, then you can probably use the same sequence of instructions as a script, which you can trigger with a single command. Imagine you are doing this manually each morning: - - -``` -$ cd Documents -$ trash reports-latest.txt -$ wget myserver.local/reports/daily/report-latest.txt -$ cp report-latest.txt reports_daily/2019-31-10.log -``` - -It's a simple sequence, but repeating it daily isn't the most efficient way of spending your time. With a little bit of abstraction, you could automate it with a simple script: - - -``` -#!/bin/sh - -trash $HOME/Documents/reports-latest.txt - -wget myserver.local/reports/daily/report-latest.txt \ --P $HOME/Documents/udpates_daily/`date --iso-8601`.log - -cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ -$HOME/Documents/reports-latest.txt -``` - -You could call your script **get-reports.sh** and launch it manually each morning, or you could even enter it into your crontab so that your computer performs the task without requiring any intervention from you. - -This can be confusing for a new user because it's not always obvious what's integrated with what. For instance, if you regularly find yourself opening images and scaling them down by 50%, then you're probably used to doing something like this: - - 1. Opening up your photo viewer or editor - 2. Scaling the image - 3. Exporting the image as a modified file - 4. Closing the application - - - -If you did this several times a day, you would probably get tired of the repetition. However, because you perform those actions in the graphical user interface (GUI), you would need to know how to script the GUI to automate it. Some applications, like [GIMP][4], have a rich scripting interface, but the process is obviously different than just adapting a bunch of commands and dumping those into a file. - -Then again, sometimes there are command-line equivalents to things you do in a GUI. Converting documents from one text format to another can be done with [Pandoc][5], images can be manipulated with [Image Magick][6], music and video can be edited and converted, and so on. It's a matter of knowing what to look for, and usually learning a new (and sometimes complex) command. Scaling images down, however, is notably simpler in the terminal than in a GUI: - - -``` -#!/bin/sh - -convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg -``` - -It's worth investigating those bothersome, repetitious tasks. You never know how simple and fast your work is for a computer to do! - -### 5\. You distro hop - -I'm an ardent Slackware user at home and a RHEL user at work. Actually, that's not true; I'm a Fedora user at work now. Except when I use CentOS. And there was that time I ran [Mageia][7] for a while. - -![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] - -Debian on a PowerPC64 box - -It doesn't matter how great a distribution is; part of the guilty pleasure of being a Linux user is the freedom to be indecisive about which distro you run. At a glance, they're all basically the same, and that's refreshing. But depending on your mood, you might prefer the stability of CentOS to the constant updates of Fedora, or you might truly enjoy the centralized control center of Mageia one day and then frolic in the modularity of raw [Debian][9] configuration files another. And sometimes you turn to an alternate OS altogether. - -![OpenBSD, image CC BY SA Claudio Miranda][10] - -OpenBSD, not a Linux distro - -The point is, Linux distributions are passion projects, and it's fun to be a part of other people's open source passions. - -### 6\. You have a passion for open source. - -Regardless of your experience, if you're a Linux user, you undoubtedly have a passion for open source. Whether you express that on a daily basis through [Creative Commons artwork][11] or code or you sublimate it and just get your work done in a liberating (and liberated) environment, you're living in and building upon open source. It's because of you that there's an open source community, and the community is richer for having you as a member. - -There are lots of things I haven't mentioned. What else betrays you as a Linux user? Let us know in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/signs-linux-user - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) -[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls -[4]: https://www.gimp.org/ -[5]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc -[6]: https://opensource.com/article/17/8/imagemagick -[7]: http://mageia.org -[8]: https://opensource.com/sites/default/files/uploads/debian.png (Debian on a PowerPC64 box) -[9]: http://debian.org -[10]: https://opensource.com/sites/default/files/uploads/openbsd.jpg (OpenBSD) -[11]: http://freesvg.org diff --git a/sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md b/sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md new file mode 100644 index 0000000000..2b05df201a --- /dev/null +++ b/sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 ways to prepare your data center for AI’s power draw) +[#]: via: (https://www.networkworld.com/article/3454626/8-ways-to-prepare-your-data-center-for-ai-s-power-draw.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +8 ways to prepare your data center for AI’s power draw +====== +Artificial intelligence requires greater processor density, which increases the demand for cooling and raises power requirements. +Thinkstock + +As artificial intelligence takes off in enterprise settings, so will data center power usage. AI is many things, but power efficient is not one of them. + +For data centers running typical enterprise applications, the average power consumption for a rack is around 7 kW. Yet it’s common for AI applications to use more than 30 kW per rack, according to data center organization [AFCOM][1]. That’s because AI requires much higher processor utilization, and the processors – especially GPUs – are power hungry. Nvidia GPUs, for example, may run several orders of magnitude faster than a CPU, but they also consume twice as much power per chip. Complicating the issue is that many data centers are already power constrained. + +**READ MORE:** [Do you really need high performance computing?][2] + +Cooling is also an issue: AI-oriented servers require greater processor density, which means more chips crammed into the box, and they all run very hot. Greater density, along with higher utilization, increases the demand for cooling as compared to a typical back-office server. Higher cooling requirements in turn raise power demands.  + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +So what can you do if you want to embrace AI for competitive reasons but the power capacity of your existing facility isn’t up to the high-density infrastructure requirements of AI? Here are some options. + +### Consider liquid cooling + +Fan cooling typically loses viability once a rack exceeds 15 kW. Water, however, has 3,000 times the heat capacity of air, according to [CoolIT Systems][4], a maker of enterprise liquid cooling products. As a result, server cabinet makers have been adding liquid pipes to their cabinets and connecting water piping to their heat sinks instead of fans. + +“Liquid cooling is definitely a very good option for higher density loads,” says John Sasser, senior vice president for data center operations at [Sabey][5], a developer and operator of data centers. “That removes the messy airflow issue. Water removes a lot more heat than air does, and you can direct it through pipes. A lot of HPC [high performance computing] is done with liquid cooling.” + +Most data centers are set up for air cooling, so liquid cooling will require a capital investment, “but that might be a much more sensible solution for these efforts, especially if a company decides to move in the direction [of AI],” Sasser says. + +### Run AI workloads at lower resolutions + +Existing data centers might be able to handle AI computational workloads but in a reduced fashion, says Steve Conway, senior research vice president for [Hyperion Research][6]. Many, if not most, workloads can be operated at half or quarter precision rather than 64-bit double precision. + +“For some problems, half precision is fine,” Conway says. “Run it at lower resolution, with less data. Or with less science in it.” + +Double-precision floating point calculations are primarily needed in scientific research, which is often done at the molecular level. Double precision is not typically used in AI training or inference on deep learning models because it is not needed. Even Nvidia [advocates][7] for use of single- and half-precision calculations in deep neural networks. + +### Build an AI containment segment + +AI will be a part of your business but not all, and that should be reflected in your data center. “The new facilities that are being built are contemplating allocating some portion of their facilities to higher power usage,” says Doug Hollidge, a partner with [Five 9s Digital][8], which builds and operates data centers. “You’re not going to put all of your facilities to higher density because there are other apps that have lower draw.” + +The first thing to do is assess the energy supply to the building, Hollidge says. “If you are going to increase energy use in the building, you’ve got to make sure the power provider can increase the power supply.” + +Bring in an engineer to assess which portion of the data center is best equipped for higher density capabilities. Workload requirements will determine the best solution, whether it be hot aisle containment or liquid cooling or some other technology. “It’s hard to give one-size-fits-all solution since all data centers are different,” Hollidge says. + +### Spread out your AI systems + +An alternative approach – rather than crowding all your AI systems into one spot hotter than Death Valley in August – is to spread them out among the racks. + +“Most of the apps are not high density. They run at eight to 10 kilowatts and up to 15 kilowatts. You can handle that with air,” says David McCall, chief innovation officer with [QTS][9], a builder of data centers. + +In an optimized heterogeneous environment, a collocation provider might have a rack or two in a cabinet to host an HPC or AI environment, and the rest of the racks in the cabinet are dedicated to hosting less power-hungry applications, such as databases and back-office apps. That won't yield a 5 kW rack, but it gets a rack closer to 12 kW or 15 kW, which is an environment that air cooling can handle, McCall says. + +### Control hot air flow in the data center + +Standard data center layout is hot aisle/cold aisle, where the cabinets are laid out in alternating rows so that cold air intakes face each other on one front-facing aisle, and hot air exhausts face each other on the alternating back-facing aisle. That works fine, but access can be tricky if an IT worker needs to get behind a cabinet to work on a server. + +The other problem is that air is “messy,” as Sasser put it. Power is often easier to model because it flows through conductors, and you can control (and thus plan and model) where power goes. Air goes where it wants and is hard to control. + +Sabey customers that want higher density environments use a hot aisle containment pod to control air flow. The company puts doors at the end of the hot aisle and plastic plates over the top, so heat is directed into a ceiling intake pipe and the barriers keep hot air and cold air from mixing. + +"In an air-cooled server world, the advice I give is go with a hot aisle containment environment,” Sasser says. "The other advice I would give is make sure the data center is tested for air flow, not just modeled for airflow. Modeling is dependent on a lot of variables, and they easily change." + +### Consider a chimney cabinet + +Another way to help manage temperatures in data centers is to use a chimney cabinet. Instead of venting the hot air out the back, a chimney cabinet uses good old physics convection to send hot air up into a chimney, which is then connected to an air conditioning vent. [Chatsworth Systems][10] is best known for this style of cabinets. + +“The air pathway is more constrained this way,” Sasser says. “Since that air pathway is more constrained, you can get greater density into a cabinet than with a hot aisle pod.” + +### Process data where it resides + +Moving data around has a very high energy cost: It can take up to 100 times more energy to move data than it takes to process data, Conway says. Any form of data movement requires electricity, and that power drain increases with the volume of data – a significant issue for data-intensive AI applications. “You want to move data as rarely and as little distance as you can,” Conway says. + +“The solution is not to have to move the data any more or further than is absolutely necessary. So people are striving to put data closer to where it is processed. One thing cloud services providers and people who use cloud services agree on is it doesn’t make sense to move a massive amount of data to a third-party cloud,” he says. + +### Consider leasing data center space + +Most of the companies looking to implement AI are corporations that lease data center space from a data center operator, Hollidge says. There are some data center operators that are not capable of handling high density AI computation, but some have transitioned to offering a portion of high density environments for AI. + +“You might have to go through a few providers before finding it, but there is more attention being paid to that on the data center operations side,” Hollidge says. And a third-party data center provider gives you more growth options. “Most of the time you are better off entering into a flexible lease that allows you to expand and grow your AI business as opposed to building ground up.” + +### Wait for next-generation servers + +Supercomputers to date haven’t been very data friendly, Conway says. As supercomputers have gotten bigger, the designs have gotten less data-centric. The result is that more data has to be moved around and shuttled between processors, memory, and storage systems. And as discussed above, it costs more power to move data than to process it. + +The first exascale systems will come with more accelerators and more powerful interconnections for moving around data. And many innovations that start in supercomputing, including GPUs and storage-class memory (SCM), eventually work their way down to more mainstream servers. + +Future servers also will come with a more heterogeneous chip layout; instead of all x86 CPUs, they will include GPUs, FPGAs, and AI accelerators. And for high speed storage, NVMe-over-Fabric and SCM will become more affordable. Servers are set to change in the coming years, and many of the advances will benefit enterprise AI application environments. + +**Learn more about HPC and supercomputers** + + * [HPE to buy Cray, offer HPC as a service][11] + * [Decommissioning the Titan supercomputer][12] + * [10 of the world's fastest supercomputers][13] + * [What’s quantum computing and why should enterprises care?][14] + * [Who’s developing quantum computers?][15] + + + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3454626/8-ways-to-prepare-your-data-center-for-ai-s-power-draw.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.afcom.com/ +[2]: https://www.networkworld.com/article/3444399/high-performance-computing-do-you-need-it.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.coolitsystems.com/ +[5]: https://sabeydatacenters.com/ +[6]: https://hyperionresearch.com/ +[7]: https://devblogs.nvidia.com/mixed-precision-training-deep-neural-networks/ +[8]: https://five9sdigital.com/ +[9]: https://www.qtsdatacenters.com/ +[10]: https://www.chatsworth.com/en-us/products/families/teraframe +[11]: https://www.networkworld.com/article/3396220/hpe-to-buy-cray-offer-hpc-as-a-service.html +[12]: https://www.networkworld.com/article/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.html +[13]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html#slide1 +[14]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html#nww-fsb +[15]: https://www.networkworld.com/article/3275385/who-s-developing-quantum-computers.html +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191125 My journey to becoming an open source maintainer.md b/sources/talk/20191125 My journey to becoming an open source maintainer.md new file mode 100644 index 0000000000..aee390002d --- /dev/null +++ b/sources/talk/20191125 My journey to becoming an open source maintainer.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My journey to becoming an open source maintainer) +[#]: via: (https://opensource.com/article/19/11/journey-open-source-maintainer) +[#]: author: (Juliano Alves https://opensource.com/users/juliano) + +My journey to becoming an open source maintainer +====== +Hacktoberfest got me thinking. My first contribution to open source was +challenging, but everything I've learned since then has made me a better +developer. +![Guy on a laptop on a building][1] + +[Hacktoberfest][2] is an initiative that invites developers from around the world to participate and contribute to open source. This is the second year in a row that I participated to completion of the challenge, and I was so inspired by it that I want to share my slightly longer journey to open source software. + +### A long time ago, in a galaxy far, far away… + +The year was 2010. The universe made its move to make me cross paths with my good friend, [Jonas Abreu][3]. Jonas is the creator of [Mirror][4], a simple domain-specific language (DSL) layer over the Java Reflection API, which makes [meta-programming][5] easier. There was a feature request open for a proxy creation capability, and Jonas asked me if I was interested in implementing it. I accepted the challenge. + +I suffered for three days, dealing with code that I didn’t understand… until I did. I still remember the feeling that my triumph brought me that day. That pain was knowledge invading my brain! + +This code was my first contribution to open source. I took quite a lot away from my experience contributing to Mirror: + + * A lot about Java meta-programming + * The concept of proxy classes + * [Javassist][6] and [cglib][7] frameworks + * How to receive and provide useful and respectful feedback + * How to design a tool that will be used by others + * Some interesting [dark magic][8] + + + +Most importantly, I took away a sense of purpose. I love the idea of contributing to the greater good while challenging myself and working with brilliant engineers who were way smarter than me. + +### Exploring ways to contribute to open source + +I started taking part in community initiatives, like running coding dojos. While doing this, I met more great devs, and we started a small group. At some point, that group decided to learn Scala. We studied and coded together, and eventually started [Scaladores][9], the Scala user group of São Paulo. + +Eventually, Jonas started talking about a different approach for learning, called [deliberate practice][10]. + +> _What if we could put all this recently acquired knowledge altogether?_ + +The resulting project from studying this practice is [Aprenda][11], a learning platform that mixes gamification and deliberate practice to make it easier to learn HTML, regular expressions, or Git. Building something this significant felt like leveling up in my pursuit of open source contribution. I also found that I picked up more knowledge about programming and practices to motivate both others and myself.  + +As much as I enjoyed this pursuit, I couldn’t dedicate a lot of time to this project. At the same time as I was making progress on Aprenda, I had to shift focus to a new job. + +### Contributing through my own Ruby gem + +My new work had me in a common pattern: Every problem was solved by writing code that creates, reads, updates, or deletes data (CRUD). It gave me an idea, so I started a new project. I wanted to generate code the same way Ruby on Rails, a powerful web framework, allowed me to set up an environment with a simple command: **rails g scaffold**. Using [Thor][12], the same gem that powers Rails generators, I created [Spring MVC Scaffold][13]. Now, any time I needed to create a CRUD I typed: + + +``` +$ springmvc scaffold product name:string value:double active:boolean +``` + +The code I wrote reducing the work my team had to do to get their job done, and I shared it further by posting it publicly. Here are some of the highlights of what I learned: + + * Generating code and files with Thor + * Defining commands for a CLI + * Organizing Ruby lib code + * Creating a Ruby gem + * Building projects with [Travis CI][14] + * Publishing to RubyGems + + + +> _After solving a common problem, think about making that solution available. Most likely, other people have similar problems._ + +Even though it’s not being maintained anymore, Spring MVC Scaffold is still available on [RubyGems][15]. And I tell you what, after that project, I went to work in a tech environment full of problems. + +### Shifting technology + +My new work required a shift in languages. I started working with Microsoft .NET, and I found issues that other communities had already solved. That recognition excited me because I knew it was my opportunity. My new opportunity to contribute came in the form of porting those solutions. + +#### Selenia + +[Selenium][16] is the dominate way to programmatically interact with websites as if the code is a "real" user (accessing it via a web browser). The API has always been too complex in my opinion. So I built a tool, we called Selenia, that could be used to write concise UI tests in C#, so instead of using: + + +``` +IWebDriver driver; +ChromeOptions options = [new][17] ChromeOptions(); +options.addExtensions([new][17] File("/path/to/extension.crx")); +ChromeDriver driver = [new][17] ChromeDriver(options); +driver = [new][17] ChromeDriver(); +driver.Navigate().GoToUrl(""); + +IWebElement query = driver.FindElement(By.Name("q")); +query.SendKeys("Selenium"); +query.Submit(); + +driver.Quit(); +``` + +We can write as: + + +``` +Open(""); +S(By.Name("q").Value("Selenia").Enter(); +``` + +Selenium users may have a question at this point. If you are wondering, the answer is "no." It’s not necessary to close the driver yourself. + +#### Designing for immutability with Ioget + +Immutability, which means never changing an object that already exists, makes a developer’s life easy. This opinion is a newer one, however. Back in the day, ASP.NET MVCs would recommend updating information in place. The only way to instantiate objects was via **setters**. + +I built [Ioget][18] to help with unmarshalling request parameters in web applications. HTTP request parameters are strings, so Ioget looks for the best way to parse those params according to the given class, instantiating objects via their constructors and therefore making them immutable. + +I published this project publicly to NuGet, but I never managed to integrate Ioget with ASP.NET like I intended to. I stopped working with Microsoft technology, and thus this project fell behind from its once lofty goals. + +Continuing with my deliberate practice, I kept track of the lessons learned along the way. + + * [Reification][19] + * ASP.NET MVC internals + * Monad implementation + * .NET framework internals + + + +I also took note of a pattern I used with Selenia. I really like this snippet, which I used to close the driver: + + +``` +private void MarkForAutoClose(IWebDriver driver) => +  AppDomain.CurrentDomain.DomainUnload += (s, e) => driver.Quit(); +``` + +### Contributing to Quill + +I moved to London in 2016, which paused my contributions for a while. Eventually, I watched a talk by [Gustavo Amigo][20] about his project, [quill-pgsql][21], which is an extension to support PostgreSQL data types with [Quill][22]. He mentioned that this project was in its early moments, which meant it was ideal for someone to join, and I was interested in writing in Scala. After a few pull requests, I decided to contribute to the main project. + +Quill transforms regular collection-like code into SQL queries in compile-time. I consider it the most challenging (and interesting) project I have ever contributed to. It’s been a few years since I started, and today I am [one of the maintainers][23]. + +Here’s what I learned by working on Quill: + + * Abstract syntax trees (AST) + * The Dark Arts (also known as [Scala macros][24]) + * How to make code extensible via [implicits][25] + * Exclusive and weird [SQL rules][26] + + + +Quill has a module called quill-async, which uses [an asynchronous database driver][27] that is no longer maintained. Quill’s creator, [Flavio Brasil][28], suggested that we could write a new async driver. That’s how [Non-Blocking Database Connectivity (NDBC)][29] got started. + +NDBC is a fully async alternative to Java Database Connectivity (JDBC). Its architecture was designed to provide high-performance, non-blocking connectivity to the database on top of [Trane.io Futures][30] and [Netty 4][31]: + + +``` +// Create a Config with an Embedded Postgres +Config config = Config.create("io.trane.ndbc.postgres.netty4.DataSourceSupplier", "localhost", 0, "user") +                      .database("test_schema") +                      .password("test") +                      .embedded("io.trane.ndbc.postgres.embedded.EmbeddedSupplier"); + +// Create a DataSource +DataSource<[PreparedStatement][32], Row> ds = DataSource.fromConfig(config); + +// Define a timeout +Duration timeout = Duration.ofSeconds(10); + +// Send a query to the db defining a timeout and receiving back a List +List<Row> rows = ds.query("SELECT 1 AS value").get(timeout); + +// iterate over awesome strongly typed rows +rows.forEach(row -> [System][33].out.println(row.getLong("value"))); +``` + +More knowledge was acquired along the way: + + * Understanding binary protocols + * Using Netty 4 + * Weaknesses of the Java type system + * Fully implementing functional structures + + + +That’s where I am at the moment. I divide my attention between Quill and NDBC, trying to make them work together. + +### Plans for the future + +The contributions I have in mind for the near future are implementing: + + * Array support in [Finagle Postgres][34] + * A Clojure wrapper for NDBC + * A ndbc-spring module + * A CLI in [Rust][35] + + + +I now have almost 10 years of open source in my journey, and it taught me something extremely valuable: Open source is about sharing knowledge. When I am solving an issue, I am acquiring knowledge. When I send a pull request, I am spreading that knowledge. Knowledge brings more knowledge! + +I strongly recommend that you become part of the open source community. It can be difficult, especially in the beginning, but everything you will learn will make you a better developer. I promise. + +> _Open source is about sharing knowledge. When I am solving an issue, I am acquiring knowledge. When I send a pull request, I am spreading that knowledge. Knowledge brings more knowledge!_ + +_This article was originally posted on [Juliano Alves' Programming Blog][36]. It has been edited for style and clarity._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/journey-open-source-maintainer + +作者:[Juliano Alves][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/juliano +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) +[2]: https://hacktoberfest.digitalocean.com/ +[3]: https://twitter.com/jonasabreu +[4]: http://projetos.vidageek.net/mirror/mirror/ +[5]: https://www.ibm.com/developerworks/library/l-metaprog1/index.html +[6]: https://www.javassist.org/ +[7]: https://github.com/cglib/cglib +[8]: https://github.com/vidageek/mirror/blob/master/src/main/java/net/vidageek/mirror/provider/java/ObjenesisConstructorBypassingReflectionProvider.java +[9]: https://www.meetup.com/scaladores/ +[10]: https://jamesclear.com/deliberate-practice-theory +[11]: https://aprenda.vidageek.net/ +[12]: http://whatisthor.com/ +[13]: https://github.com/juliano/springmvc-scaffold +[14]: https://travis-ci.com/ +[15]: https://rubygems.org/gems/springmvc-scaffold +[16]: https://www.seleniumhq.org/ +[17]: http://www.google.com/search?q=new+msdn.microsoft.com +[18]: https://www.nuget.org/packages/Ioget/ +[19]: https://en.wikipedia.org/wiki/Reification_(computer_science) +[20]: https://github.com/gustavoamigo +[21]: https://github.com/gustavoamigo/quill-pgsql +[22]: https://getquill.io/ +[23]: https://github.com/getquill/quill +[24]: http://scalamacros.org/ +[25]: https://docs.scala-lang.org/tour/implicit-parameters.html +[26]: https://teamsql.io/blog/?p=923 +[27]: https://github.com/mauricio/postgresql-async +[28]: https://twitter.com/flaviowbrasil +[29]: https://ndbc.io/ +[30]: http://trane.io/ +[31]: https://netty.io/ +[32]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+preparedstatement +[33]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[34]: https://github.com/finagle/finagle-postgres/issues/55 +[35]: https://opensource.com/tags/rust +[36]: https://juliano-alves.com/2019/11/02/the-journey-of-an-open-source-developer/ diff --git a/sources/talk/20191126 A framework for building products from open source projects.md b/sources/talk/20191126 A framework for building products from open source projects.md new file mode 100644 index 0000000000..2a8a109e07 --- /dev/null +++ b/sources/talk/20191126 A framework for building products from open source projects.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A framework for building products from open source projects) +[#]: via: (https://opensource.com/article/19/11/products-open-source-projects) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +A framework for building products from open source projects +====== +Here is a roadmap for turning a project into a commercial open source +product. +![An airplane.][1] + +My first memory of playing with a computer was through an [MS-DOS][2] terminal on the x86 PC in my grandfather's pharmaceutical research lab in the early '90s—playing games stored on 3.5" floppy disks and doing touch-typing exercises. As technology improved, I spent an obscene amount of time taking my computer apart to add more RAM, a new graphics card, or a new fan, mostly so I could play cooler games. It was a fun, ongoing project, and I bonded with my father over it. It was also way cheaper than buying a new computer. + +What's the point of this in the context of open source? + +Well, even though I had no idea what "open source" was at the time, I was behaving like a typical developer does with open source projects today—spending my free time to piece together and build things I wanted, sometimes for a specific goal, sometimes to learn new things, sometimes as a way to connect with others. + +But, over time, I stopped tinkering. For whatever reason, I decided that my time was becoming too "valuable" to retrofit my older computers. I started using a MacBook, and when my older MacBook wasn't functioning well, I paid a pretty penny for a new one with a better configuration instead of unscrewing the bottom to see if I could jam in a new RAM card. + +My behavior became more like that of an enterprise buyer—saving time and trouble by spending money. + +### An open source software project is not a product you sell + +If your experience with technology resembles mine in any way, you know intuitively that the _projects_ we [DIY][3] are not the same as the _products_ we spend money buying. + +This isn't a new observation in the open source community. + +[Stephen Walli][4], an IT industry veteran and part of the [Open Container Initiative][5], has written [numerous detailed blog posts][6] on this topic. [Sarah Novotny][7], who led the Kubernetes community and was heavily involved in the Nginx and MySQL communities, [emphatically articulated][8] at the inaugural [Open Core Summit][9] that the open source project a company shepherds and the product that a company sells are two completely _different_ things. + +Yet, project and product continue to be conflated by maintainers-turned-founders of commercial open source software (COSS) companies, especially (and ironically) when the open source project gets traction. + +This mistake gets repeated, I believe, because it's hard to mentally conceptualize how and why a commercial product should be different when the open source project is already being used widely. + +### What makes a COSS product different? + +Two core elements differentiate a commercial product from its open source root: packaged experience and buyer-specific features. + +#### Packaged experience + +Packaging your project so that it has that out-of-the-box user experience isn't just about a polished user interface (UI) or hosting it on your server as SaaS (although that could be part of it). It's an expressed opinion of how you, the creator or maintainer of the project turned founder of the company, believe the technology should be used to solve your customer's business problem. That "opinion" is essentially the product experience the customer is paying for. + +When you are running an open source community project, it's usually good to be _not_ opinionated and let your community organically flourish. When you are developing a product for customers, it's usually good to _be_ opinionated. + +It's the retrofitted x86 PC versus the MacBook dynamic. + +[Dave McJannet][10], CEO of Hashicorp, and [Peter Reinhardt][11], CEO of Segment, both cited packaging as a crucial step to get right in order to turn an open source project into a scalable commercial product. + +#### Buyer-specific features + +A well-packaged product must also have the features that are necessary for your targeted buyer to justify a purchase. What these features are depends on the profile of your buyer, but the possibilities are finite and manageable. + +An enterprise buyer, say a Global 2000, will have a relatively consistent set of features that it must have to purchase a product. ([EnterpriseReady.io][12] is a great resource about what those features tend to be.) + +A small- or medium-sized business buyer, say your local mom-and-pop bakery, that has less financial resources and people power and is more price-sensitive, will need different things to be convinced to buy. + +A consumer service monetized via ads, where your buyers are the advertisers while your users are everyday people, will be different still. + +One thing is for sure: your buyer is almost _never_ your open source community. + +Know what your buyer requires for a purchase, and package that with your expert opinion on how to solve the buyer's problem; **that's what differentiates a product from a project.** + +Sid Sijbrandij's articulation of GitLab's [buyer-based open core][13] model is a good example for enterprises. + +Certainly, other elements can be added to further the differentiation. But a packaged experience with buyer-specific features is essential. Without one or the other, your prospective customers might as well just tinker on their own for free. + +### One metric that matters: Time-to-value + +A perennially difficult thing in product development is measuring progress and establishing a data-driven framework to determine whether you are on the right path or not. I'm a fan of the One Metric That Matters (OMTM) mentality, elaborated in [_Lean Analytics_][14], where you focus on one single number (above everything else) for your current stage. This approach enforces focus and discipline among a sea of data you can gather and distract yourself with (oftentimes vanity metrics like download numbers or GitHub stars). The single metric can effectively rally your entire company around one tangible goal or mission—especially critical for an early-stage company. And the metric you focus on will be different at different stages. + +So what's the right OMTM in the early days of product development? + +I propose **time-to-value** + +"Time" here is straightforward—the lower, the better. + +"Value" needs a precise, rigorous definition that is technology- and problem-specific. Your distributed database is valuable because it can serve data with no downtime when servers fail. Your continuous integration tool is valuable because it enables application developers to push improvements faster without breaking the application. You get the idea. + +How quickly can a customer see or feel the _one core piece of value_ that you measure and optimize for? Whatever is "a sufficiently short time" depends on the use case, but given the increasing consumerization of enterprise technology, any product's time-to-value that's more than 30 minutes is probably too long. + +Finding and tightly defining that "value" is hard and iterative, but also table stakes if you are looking to build a product company around an open source project. Without a deep understanding of what that value is for your customer, there's probably not much of a company to build. + +At the end of the day, as much fun as it was to "beef up" my x86 PC, I'm pretty satisfied with my MacBook and happy to pay the premium. So don't get too enamored with the joy of tinkering if your goal is actually to sell MacBook. + +(P.S. The mental framework outlined here may not apply if you are building a consultancy or support-oriented company that services open source project users. For more expansive reading on different COSS business models, see _[_COSS business model progressions_][15]_ by Joseph Jacks.) + +_Special thanks to Sarah Novotny for her feedback on this post's draft._ + +* * * + +_This article was [previously published on COSS Media][16] and is edited and republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/products-open-source-projects + +作者:[Kevin Xu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/206308main_image_976_946-710.jpg?itok=U6hh3EIO (An airplane.) +[2]: https://en.wikipedia.org/wiki/MS-DOS +[3]: https://en.wikipedia.org/wiki/Do_it_yourself +[4]: https://stephesblog.blogs.com/about.html +[5]: https://www.opencontainers.org/ +[6]: https://medium.com/@stephenrwalli +[7]: https://sarahnovotny.com/about/ +[8]: https://www.linkedin.com/pulse/personal-reflection-open-core-summit-kevin-xu/ +[9]: https://opencoresummit.com/#speakers +[10]: https://founderrealtalk.ggvc.com/2019/04/25/episode-23-hashicorp-ceo-dave-mcjannet-reveals-the-secrets-of-commercializing-open-source-selling-to-enterprises-and-building-successful-relationships-with-founders/ +[11]: https://www.youtube.com/watch?v=Q75V35unztw&feature=youtu.be +[12]: https://www.enterpriseready.io/# +[13]: https://www.youtube.com/watch?v=G6ZupYzr_Zg +[14]: http://leananalyticsbook.com/ +[15]: https://coss.media/coss-business-model-progressions/ +[16]: https://coss.media/deriving-product-from-open-source/ diff --git a/sources/talk/20191126 How cloud providers- performance differs.md b/sources/talk/20191126 How cloud providers- performance differs.md new file mode 100644 index 0000000000..0abb0f11b7 --- /dev/null +++ b/sources/talk/20191126 How cloud providers- performance differs.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How cloud providers' performance differs) +[#]: via: (https://www.networkworld.com/article/3455197/how-cloud-providers-performance-differs.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +How cloud providers' performance differs +====== +The 2019 ThousandEyes Benchmark report shows that not all cloud providers are created equal across all regions +Denis Isakov / Getty Images + +Not all public cloud service providers are the same when it comes to network performance. + +Each one’s connectivity approach varies, which causes geographical discrepancies in network performance and predictability. As businesses consider moving to the cloud, especially software-defined wide-area networks ([SD-WAN][1]) and [multi-cloud][2], it’s important to understand what each public cloud service provider brings to the table and how they compare. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +In 2018, ThousandEyes first conducted [a benchmark study assessing three major public cloud providers][4]: Amazon Web Services (AWS), Microsoft Azure (Azure), and Google Cloud Platform (GCP). The study gathered data on network performance and connectivity architecture to guide businesses in the planning stage. + +[][5] + +BrandPost Sponsored by HPE + +[HPE Synergy For Dummies][5] + +Here’s how IT can provide an anytime, anywhere, any workload infrastructure. + +[This year’s study][6] offers a more comprehensive view of the competition, with two more providers added to the list: Alibaba Cloud and IBM Cloud. It compares 2018 and 2019 data to show changes that took place year-over-year and what triggered them. + +ThousandEyes periodically collected bi-directional network performance metrics—such as latency, packet loss and jitter—from 98 user vantage points in global [data centers][7] across all five public cloud providers over a four-week period. Additionally, it looked at network performance from leading U.S. broadband internet service providers (ISPs), including AT&T, Verizon, Comcast, CenturyLink, Cox, and Charter. + +The network management company then analyzed more than 320 million data points to create the benchmark. Here are the results. + +### Inconsistencies among providers + +In its initial study, ThousandEyes revealed that some cloud providers rely heavily on the public internet to carry user traffic while others don’t. In this year’s study, the cloud providers generally showed similar performance in bi-directional network latency. + +However, ThousandEyes found architectural and connectivity differences have a big impact on how traffic travels between users and certain cloud hosting regions. AWS and Alibaba mostly rely on the internet to transport user traffic. Azure and GCP use their private backbone networks. IBM is different from the rest and takes a hybrid approach. + +ThousandEyes tested the theory of whether AWS Global Accelerator out-performs the internet. AWS Global Accelerator launched in November 2018, offering users the option to utilize the AWS private backbone network for a fee instead of the default public internet. Although performance did improve in some regions around the world, there where other instances where the internet was faster and more reliable than AWS Global Accelerator. + +Broadband ISPs that businesses use to connect to each cloud also showed inconsistencies, even in the mature U.S. market. After evaluating network performance from the six U.S. ISPs, sub-optimal routing results were recorded, with up to 10 times the expected network latency in some cases. + +**Location, location, location** + +Cloud providers commonly experience packet loss when crossing through China’s content-filtering firewall, even those from the region like Alibaba. The 2019 study closely examined the performance toll cloud providers pay in China, which has a notoriously challenging geography for online businesses. For those with customers in China, ThousandEyes recommends Hong Kong as a hosting region since Alibaba Cloud traffic experienced the least packet loss there, followed by Azure and IBM. + +In other parts of the world, Latin America and Asia showed the highest performance variations for all cloud providers. For example, network latency was six times higher from Rio de Janeiro to GCP’s São Paulo hosting region because of a suboptimal reverse path, compared to other providers. But across North America and Western Europe, all five cloud providers demonstrated comparable, robust network performance. + +The study’s results confirm that location is a major factor, therefore, user-to-hosting-region performance data should be considered when selecting a public cloud provider. + +**Multi-cloud connectivity** + +In 2018, ThousandEyes discovered extensive connectivity between the backbone networks of AWS, GCP, and Azure. An interesting finding in this year’s study shows multi-cloud connectivity was erratic when IBM and Alibaba Cloud were added to the list. + +ThousandEyes found IBM and Alibaba Cloud don’t have fully established, direct connectivity with other providers. That’s because they typically use ISPs to connect their clouds to other providers. AWS, Azure, and GCP, on the other hand, peer directly with each other and don’t require third-party ISPs for multi-cloud communication. + +With multi-cloud initiatives on the rise, network performance should be included as a metric in evaluating multi-cloud connectivity since it appears to be inconsistent across providers and geographical boundaries. + +ThousandEyes’ comprehensive performance benchmark can serve as a guide for businesses deciding which public cloud provider best meets their needs. But to err on the side of caution, businesses selecting public cloud connectivity should consider the unpredictable nature of the internet, how it affects performance, creates risk, and increases operational complexity. Businesses should address those challenges by gathering their own network intelligence on a case-by-case basis. Only then they will benefit fully from what cloud providers have to offer. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3455197/how-cloud-providers-performance-differs.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3319776/the-network-matters-for-public-cloud-performance.html +[5]: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE19718&utm_content=sidebar (HPE Synergy For Dummies) +[6]: https://www.thousandeyes.com/press-releases/second-annual-cloud-performance-benchmark-research +[7]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191126 SASE- Redefining the network and security architecture.md b/sources/talk/20191126 SASE- Redefining the network and security architecture.md new file mode 100644 index 0000000000..c92cb9eeda --- /dev/null +++ b/sources/talk/20191126 SASE- Redefining the network and security architecture.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SASE: Redefining the network and security architecture) +[#]: via: (https://www.networkworld.com/article/3481519/sase-redefining-the-network-and-security-architecture.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +SASE: Redefining the network and security architecture +====== +Adoption of SASE reduces complexity and overhead, improves security and boosts application performance. +Getty Images + +In a cloud-centric world, users and devices require access to services everywhere. The focal point has changed. Now it is the identity of the user and device as opposed to the traditional model that focused solely on the data center. As a result, these environmental changes have created a new landscape that we need to protect and connect. + +This new landscape is challenged by many common problems. The enterprises are loaded with complexity and overhead due to deployed appliances for different technology stacks. The legacy network and security designs increase latency. In addition, the world is encrypted; this dimension needs to be inspected carefully, without degrading the application performance. + +These are some of the reasons that surface the need for a cloud-delivered secure access service edge (SASE). SASE consists of a tailored network fabric optimization where it makes the most sense for the user, device and application - at geographically dispersed PoPs. To deliver optimum network experience everywhere you should avoid the unpredictability of the Internet core. In the requirements for SASE, Gartner recommends that this backbone should not be based on AWS or Azure. Their PoP density is insufficient. It is not sufficient to offer a SASE service built solely on a hyper-scale. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +There are clear benefits that can be achieved by redefining the network and security architecture. Yes, the adoption of SASE reduces complexity and overhead, improves security. It increases the application performance, but practically, what does that mean? + +[Linda Musthaler had a great example in her conversation with Andrew Thomson, Director of IT at BioIVT,][2] a provider of biological materials and scientific services to research and development organizations, who adopted Cato Networks’ SASE platform nearly two years ago: + +_“We positioned it as a platform for everything that we wanted to be able to do over the next three years with the business,” he told Linda, “The big goal, the business strategy, is growth and acquisition. We presented this as a platform, as a base service that we just had to have in place in order to leverage things like voice over IP, Office 365, Azure, cloud-based computing services, hosting servers in the cloud. Without a common core solid foundation, we wouldn't have been able to do any of those things reliably without adding staff to do monitoring or maintenance or administrative overhead.”_ + +It’s that last line – “without adding staff to do monitoring or maintenance or administrative overhead” – that I found particularly striking. So, let’s understand why SASE can be so impactful from an architectural perspective. + +**[ Now read [20 hot jobs ambitious IT pros should shoot for][3]. ]** + +### Complexity and overhead + +Traditional mechanisms are limited by the hardware capacity of the physical appliances located at the customer's site. Such mechanisms create a lag in the hardware refresh rates that are needed to add new functionality. + +Hardware-based network and security solutions build into the hardware the differentiator of the offering. Primarily, with different hardware, you can accelerate the services and add new features. There are some features that are available only on the specific hardware, not the hardware you already have onsite. In this case, heavy lifting by the customer will be required. + +As the environment evolves, we should not depend on the new network and security features coming from the new generation of an appliance. Typically, this model is inefficient and complex. It creates high operational overhead and management complexity. + +Device upgrades for new features require a lot of management. From past experience, to change out a line card would involve multiple teams. The line card might run out of ports or you may simply need additional features from a new generation. Largely, this would involve project planning, on-site engineers, design guides, hopefully, line card testing and hours of work. For critical sites to ensure a successful refresh, team members may need to be backed up. Therefore, there are many touches that need to be managed. + +### SASE – Easing management + +The cloud-based SASE enables the updates for new features and functionality without the need for new deployments of appliances (physical or virtual) and software versions on the customer side. This has an immediate effect on the ease of management. + +Now the network and security deployment can occur without ever touching the enterprise network. This allows enterprises to adopt new capabilities quickly. Once the tight coupling between the features and the customer appliance is removed, this increases the agility and simplicity for the deployment of network and security services. + +With a SASE platform, when we create an object, such as a policy in the networking domain, it is then available in other domains as well. So any policies assigned to users are tied to that user, regardless of the network location. This significantly removes the complexity of managing both; network and security policies across multiple locations, users and types of devices. Supremely, all of this can be done from one platform. + +Also, when we examine the security solution, many buy individual appliances that focus just on one job. To troubleshoot, you need to gather information, such as the logs from each device. This is what a SIEM is useful for but it can only be used in some organizations as it’s resource-heavy. For the ones who don’t have ample resources, the process is backbreaking and there will be false positives. + +In addition, SASE enables easier troubleshooting because all the data is in one common repository. You no longer have normalized data from different appliances/solution and then import the data into a database for a common view. + +### Consolidation of vendors and technology stacks + +I recall an experience from a previous consultancy, wherein we were planning the next year's security budget. The network was packed with numerous security solutions. All these point solutions are expensive and there is never a fixed price. So how do you actually plan for this? + +Some new solutions we were considering charge on the usage models which at that time we didn’t have the quantity. SASE removes these types of headaches. By consolidating services into a single provider, there will be a reduction in the number of vendors and agents/clients on the end-user device. + +Overall, there will be high complexity saving from the consolidation of vendors and technology stacks. The complexity is pushed to the cloud away from the on-premise enterprise network. The SASE fabric abstracts the complexity and reduces costs. + +From a hardware point of view: for scale and additional capacity, the cloud-based SASE can add more PoPs of the same instance. This is known as vertical scaling. This scaling can also be carried in new locations, known as horizontal scaling. + +Additionally, the SASE-based cloud takes care of intensive processing. For example, since a large proportion of internet traffic is now encrypted, malware can use encryption to evade and hide from detection. Here, each of the PoPs can perform DPI on TLS-encrypted traffic. + +Traditional firewalls are not capable of inspecting encrypted traffic. Performing DPI on TLS-encrypted traffic would require extra modules or a new appliance. A SASE solution ensures that the decryption and inspection are done at the PoP. Consequently, there is no performance-hit or the need for new appliances on the customer sites. + +### Ways to improve performance + +Network congestion resulting in dropped and out of order packets is bad for applications. Latency-sensitive applications, such as collaboration, video, VoIP and web conferencing are hit hardest because of packet drops. Luckily, there are options to minimize latency and the effects of packet loss. + +SD-WAN solutions have WAN optimization features that can be applied on an application-by-application or site-by-site basis. Along with WAN optimization features, there are protocol and application acceleration techniques that can be employed. + +On top of the existing techniques to reduce the packet loss and latency, we can privatize the WAN as much as possible. You can control the adverse and varying effects that the last mile and middle mile have on the applications by privatizing with a global backbone consisting of a fabric of PoPs. + +Once privatized, we can have more control over traffic paths, packet loss and latency. A private network fabric is a key benefit gained from SASE as it drives the application performance. + +### SASE PoP optimizations + +Each PoP in the SASE cloud-based solution optimizes where it makes the most sense, not just at the WAN edge. Within the backbone, we have global route optimizations to determine which path is the best at the current time and it can also be changed for all traffic or certain applications. + +These routing algorithms factor in the performance metrics, such as latency, packet loss and jitter. These algorithms can help in selecting the optimal route for every network packet. The WAN backbone constantly analyzes and tries to improve the performance. This is unlike internet routing that favors cost over performance. + +As everything is privatized, we have all the information to create the largest packet size and use rate-based algorithms over traditional loss-based algorithms. As a result, you don't need to learn anything, and the end-to-end throughput can be maintained. + +As each PoP acts as a TCP proxy server, certain techniques are employed so that the TCP client and server think that they are closer. Therefore, a larger TCP window is set, allowing more data to be passed before waiting for an acknowledgment. + +### Preferred egress points + +We can also define preferred egress points to exit the cloud application traffic. These could be the points closest to the customer's application instance. The optimal global routing algorithms determine the best path to the customer's cloud application instance from anywhere in the world. + +The PoPs can be collocated in the data centers directly connected to the IXP that connects to all major Infrastructures as service providers. This provides a good on-ramp to access the services from Amazon AWS, Microsoft Azure and Google cloud. + +Therefore, you can keep the traffic on the private cloud for the majority of the time. Within a SASE design, the internet is used only to provide a short hop to the SASE fabric. + +### Security – Identity-centric perimeter + +SASE converges the networking and security pillars into a single platform. This allows multiple security solutions into a cloud service that enforces a unified policy across all the corporate locations, users and data. + +SASE recommends you employ the zero-trust principles. The initial path to zero trust starts with identifying that network access is based on the identity of user, device and application. It is not based on the IP address or physical location of the device. And this is for a good reason as there is no contextual information. + +The identity of the user/device must reflect the business context as opposed to being associated with binary constructs that are completely disjointed from the upper layers. This binds the identity to the world of networking and is the best way forward for policy enforcement. This way, the dependency on IP or applications as identifiers is removed. Now, the policy can be applied consistently, regardless of where the user/device is located. At the same time, the identity of the user/device/service can be factored into the applied policy. + +The SASE stack is dynamically applied based on the identity and context while serving zero trust at strategic points in the cloud. This is what enforces an identity-centric perimeter. + +_You can learn more about SASE and how it relates to [SD-WAN architectures][4] in a recent course I’ve rolled out. The course shines the torch on various SD-WAN solutions from Silver Peak, VMware, Cisco and Cato._ + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3481519/sase-redefining-the-network-and-security-architecture.html + +作者:[Matt Conran][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/3453030/sase-is-more-than-a-buzzword-for-bioivt.html +[3]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html +[4]: https://www.pluralsight.com/courses/sd-wan-architectures-big-picture +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191127 Is your code inclusive.md b/sources/talk/20191127 Is your code inclusive.md new file mode 100644 index 0000000000..5cb264032b --- /dev/null +++ b/sources/talk/20191127 Is your code inclusive.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is your code inclusive?) +[#]: via: (https://opensource.com/article/19/11/inclusive-design-code) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +Is your code inclusive? +====== +Learn how developers can support assistive technology projects and +inclusivity. +![plastic game pieces on a board][1] + +I have been involved with assistive technology for about ten years now, beginning with a stint as an assistive technology tutor with the [Kenya Society for the Blind][2]. + +Assistive technology helps improve the lives of people with cognitive, physical or sensory challenges. It comprises a wide range of hardware, specialist software such as screen readers, as well as accessibility features in general software. + +Over the ten years that I have worked with assistive technology, it has vastly improved. This is due in part to the advent of more powerful technologies, as well as better education and stronger disability rights legislation across much of the world. However, progress has been uneven and much of the legislation, well-meaning as it is, is poorly enforced, so there is still work to be done. + +[The Association for the Advancement of Assistive Technology in Europe (AAATE)][3] is an interdisciplinary pan-European association devoted to all aspects of assistive technology, such as use, research, development, manufacture, supply, provision, and policy. Following the AAATE 2019 Conference in Bologna, the association published ["The Bologna Declaration."][4] + +The declaration is a call to action "to improve access to quality assistive technology for realizing fundamental human rights and achieving the sustainable development goals in a fully inclusive manner." + +It includes a list of ten important steps in an agenda for action. These points are not specifically aimed at the open source community; they are intended for policymakers and the whole assistive technology sector. This agenda for action is well thought out and deserves to be widely read across the technology sector. + +### Examples of open source assistive technology + +A look at the projects listed at [Open Assistive][5] offers an idea of the range of open source assistive technology projects that are already out there. A good example of mainstream open source software embracing accessibility is the Mozilla Firefox web browser "reader view" feature, which removes ads, background images, and other clutter for distraction-free viewing. The spoken text option in "reader view" also aids accessibility. This feature has certainly improved my user experience and has the great advantage of being a standard option rather than an add-on. + +Some of the open source assistive tools that I have used with my clients include: + + * [Vinux][6] — a Linux distro that is optimized for users with visual impairments + * [NVDA][7] — a capable screen reader for MS Windows + * [Autohotkey][8] — automates almost anything in MS Windows by sending keystrokes and mouse clicks + * [Mulberry symbol set][9] — Mulberry symbols, or pictograms, are a set of scalable SVG graphic images designed for communications use. They are ideal for software, devices, or any online accessibility use. + + + +There is a huge range of open source assistive technology projects; one large subset that I am interested to explore is the growing list of open source assistive technology hardware projects. If you have a favorite project that you use or contribute to, share it with us in the comments! + +You can support assistive technology by encouraging users to try it, by contributing coding work to assistive technology projects, or by working on documentation and user guides. Even if they’re not working specifically on assistive technology, all developers should keep in mind the need for inclusive design in their projects. If you would like to endorse the Bologna Declaration "to raise awareness so people take action and do everything in their power to actively implementing the points on the agenda," please visit .  + +Assistive technology such as Augmented/Assisted Communication (AAC), Text-to-Speech and Speech-to-... + +Assistive technology software is any program or operating system feature designed to let a user... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/inclusive-design-code + +作者:[Peter Cheer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1 (plastic game pieces on a board) +[2]: http://www.ksblind.org/ +[3]: https://opensource.com/article/19/11/www.aaate.net +[4]: https://aaate.net/the-bologna-declaration/ +[5]: https://openassistive.org +[6]: https://wiki.vinuxproject.org/ +[7]: https://www.nvaccess.org/ +[8]: https://www.autohotkey.com/ +[9]: https://mulberrysymbols.org/ diff --git a/sources/talk/20191127 Why do we contribute to open source software.md b/sources/talk/20191127 Why do we contribute to open source software.md new file mode 100644 index 0000000000..3277dcf6f8 --- /dev/null +++ b/sources/talk/20191127 Why do we contribute to open source software.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why do we contribute to open source software?) +[#]: via: (https://opensource.com/article/19/11/why-contribute-open-source-software) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +Why do we contribute to open source software? +====== +Dive into the research supporting the open source ecosystem and +developers’ motivations for participating. +![question mark in chalk][1] + +Organizations as a whole contribute to open source software projects for a variety of reasons. + +One of the most important is that the open source development model is such an effective way to collaborate with other companies on projects of mutual interest. But they also want to better understand the technologies they use. They also want to influence direction. + +The specific rationale will vary by organization but it usually boils down to the simple fact that working in open source benefits their business. + +But why do individuals contribute to open source? They mostly see some kind of personal benefit too, but what specifically motivates them? + +### The types of motivation + +When we talk about motivations, one common way to do so is in terms of incentive theory. This theory began to emerge during the 1940s and 1950s, building on the earlier drive-reduction theories established by psychologists such as Clark Hull and Kenneth Spence. Incentive theory was originally based on the idea that motivation is largely fueled by the prospect of an external reward or incentive. + +Money is a classic extrinsic motivator. So is winning an award, getting a grade, or obtaining a certification that is likely to lead to a better job. + +However, in the 1970s, researchers began to also consider intrinsic motivations, which do not require an apparent reward other than the activity itself. Self-determination theory, developed by Edward Deci and Richard Ryan, would later evolve from studies comparing intrinsic and extrinsic motives, and from a growing understanding of the dominant role intrinsic motivations can play in behavior. + +While intrinsic motivations can come from a number of different sources, the most straightforward one is the simple enjoyment of a particular activity. You play in a softball league after work because you like playing softball. You enjoy the exercise, the camaraderie, the game itself. + +Researchers have also proposed a further distinction between this enjoyment-based intrinsic motivation and obligation/community-based intrinsic motivation, which is more about adherence to social or community norms. Maybe you don’t really like having the relatives over for Thanksgiving but you do it anyway because you know you should. + +Today’s psychology literature also includes the idea of internalized extrinsic motivations. These are extrinsic motivations such as gaining skills to enhance career opportunities—but they’ve been internalized so that the motivation comes from within rather than the desire for whatever carrot is being dangled by someone else. + +### What motivates open source developers? + +In 2012, four researchers at [ETH Zurich][2] surveyed the prior ten years of study into open source software contribution. Among their results, they were able to group study findings into the following three categories: extrinsic motivation, intrinsic motivation, and internalized extrinsic motivation—as well as some common sub-groupings within those broader categories. + +No surprise that money showed up as an extrinsic motivator. During the period studied, there were fewer large projects associated with successful commercially-supported products than is the case today. Even so, most of the open source projects the researchers examined had a significant number of contributors whose companies had paid them to work on open source. + +Career obviously goes hand in hand with pay, but is open source software any different from proprietary software development in this regard? There’s some evidence that it is. + +Lerner and Tirole [first suggested in 2002][3] that "individual developers would be motivated by career concerns when developing open source software. By publishing software that was free for all to inspect, they could signal their talent to potential employers and thus increase their value in the labor market." + +More recently, there’s been significant empirical evidence that there are career advantages to developing code and making it available for others to see and work with. It has become almost an expectation in some industry segments for job applicants to have public GitHub code repositories, which are effectively part of their resume. + +It’s reasonable to ask whether this trend has gone too far. After all, many highly qualified developers work on proprietary code. But it’s clear that, fair or not, at least some career prospects can come specifically from being an open source developer. + +Among intrinsic motivators, ideology and altruism often seem closely related. + +Free software was primarily an ideological statement at first, even if user control also had an important practical side; several researchers have found support for ideological motives in developer surveys. + +Altruism can also be a developer motive, though research on this is mixed. One paper identified the “desire to give a present to the programmer community” as a crucial pattern in open source software. But other studies have qualified the importance of altruism as a motive, especially among programmers getting a paycheck. Other work found that altruism could be a motivator but only among developers who were otherwise satisfied. + +There’s also the motivational power of fun and enjoyment, a classic intrinsic motivator. This should come as no surprise to anyone who hangs around open source developers. Almost all of them like working on open source projects. One large 2007 study determined that fun accounted for 28 percent of the effort (in terms of number of hours) dedicated to projects. One implication of this research is that activities developers typically enjoy less–tech support often tops this list–may require alternative forms of motivation. + +Much of the research into reputation as an internalized extrinsic motivator has focused specifically on peer recognition. Your reputation among your peers can be a source of your own pride, but it also signals your talent to community insiders and potential employers. The suggestion that reputation could be an important motivator in contributing to open source goes back at least as far as 1998, in Eric Raymond’s essay ["Homesteading the Noosphere."][4] However, since then, a variety of surveys have supported the idea that peer reputation is a driver for participation. + +Another motivator in this category is what researchers call "own-use value" but is more recognizably described as something like "scratch your own itch"–develop something that you want for yourself and in the process, create something valuable to others. The initial motivation essentially comes from a selfish need but that can evolve into more of an internalized desire to contribute. + +Its unsurprising research would identify own-use value as a good motivator. Certainly, the folk wisdom is that many developers get into open source by developing something they themselves need—such as when Linus Torvalds wrote Git because Linux needed an appropriate distributed version control system. + +As we’ve seen, contributors to open source software have a variety of different motivations but there are a few general threads worth highlighting in closing. + +Motivators can actually be counterproductive when a single motivator is relied upon too heavily. One study reported that developers scratching their own itch worked "eclectically," fixing bugs that annoyed them and then quitting until the next time. + +In particular, don’t expect non-extrinsic motivators to carry too much of the load. Fun isn’t a good motivator if the task is not actually fun. Altruism motivates some but it also doesn’t pay their bills. + +That said, developers do contribute for reasons that aren’t purely about money or other extrinsic reasons. Learning, peer reputation, and recognition are important to many (and not just in open source development.) Organizations should not neglect the role these can play in motivating developers and should implement incentive programs around them, such as peer reward systems. + +* * * + +This post is based on material from _[How Open Source Ate Software][5]_ (Apress, 2018) by the author. + +There are lots of non-code ways to contribute to open source: Here are three alternatives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/why-contribute-open-source-software + +作者:[Gordon Haff][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ghaff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/question-mark_chalkboard.jpg?itok=DaG4tje9 (question mark in chalk) +[2]: https://pdfs.semanticscholar.org/7712/3726f65f8fd88126357c12cad230cc832f41.pdf +[3]: https://onlinelibrary.wiley.com/doi/abs/10.1111/1467-6451.00174 +[4]: https://pdfs.semanticscholar.org/98a6/c566a7e28a48facb664c8689607a52c57a5d.pdf +[5]: https://www.apress.com/gp/book/9781484238936 diff --git a/sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md b/sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md new file mode 100644 index 0000000000..23353b3a40 --- /dev/null +++ b/sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (“We follow a holistic approach to drive open source adoption across the client base at Infosys”) +[#]: via: (https://opensourceforu.com/2019/11/we-follow-a-holistic-approach-to-drive-open-source-adoption-across-the-client-base-at-infosys/) +[#]: author: (Rahul Chopra https://opensourceforu.com/author/rahul-chopra/) + +“We follow a holistic approach to drive open source adoption across the client base at Infosys” +====== + +[![][1]][2] + +_As a global services company operating in fiercely competitive environments, Infosys has set up a well-established open source practice. **Gautam Khanna, VP & head – modernization practice, Infosys**, shares with **Rahul Chopra, editorial director, EFY Group**, how the company keeps its employees up-to-date with open source, motivates and helps them to contribute to the open source ecosystem, and more._ + +**Q. What are your thoughts about the pace at which open source software (OSS) is being adopted amongst global enterprises (Top 2000 or 5000)? Is it accelerating?** +**A.** Open source adoption in enterprises is growing more rapidly than ever. A recent global survey of IT leaders revealed that nearly 90 per cent see open source as necessary to their enterprises. Open source usage is increasingly seen in categories like cloud management, security, analytics and storage, which have historically been more associated with proprietary products. Over two-thirds of the participants in the survey have increased their open source adoption in the last 12 months, and nearly 60 per cent expect to improve adoption levels over the next year as well. + +These numbers reinforce what we have observed among our clients across industry verticals – they are using open source more than ever in their modernization journeys. This is driven by the trifecta of unmatched innovation, quality, and value that open source delivers. However, what we have also observed is that there are differing levels of adoption across verticals. The retail and communication verticals are strategically and consistently adopting open source while financial institutions are a bit more cautious in doing so. + +**Q. Are there any specific countries or geographic regions that are leading this trend?** +**A.** We see the growth as pervasive across geographies. India, for example, has some amazing stories of open source adoption in government, in initiatives like Aadhaar. + +**Q. Are you seeing an increase in the number of deals that require systems integrators (SIs) like Infosys to have expertise on various open source stacks?** +**A.** As clients look to reduce their dependence on proprietary software, manage costs, and introduce increased agility and innovation, most application modernization deals today have open source as an integral component. We see this trend only getting stronger, so building open source competencies at scale is a must for every global SI. + +**Q. In the earlier days, there were a lot of myths about open source. Some proprietary brands were deliberately spreading FUD (fear, uncertainty and doubt) too. Today, what are the common myths or other inhibiting factors that prevent firms from adopting open source?** +**A.** While the awareness and acceptability of open source has certainly increased a lot over the years, we still notice the prevalence of some myths. Most of them are related to open source support, security, enterprise scalability and reliability. + +Clients also face challenges in adopting open source at the enterprise scale – including identifying the best-fit solutions from a plethora of technologies, navigating a complex vendor ecosystem and making their open source journeys cost-neutral. In all our client conversations, we focus on debunking any myths and helping our clients make informed and optimal decisions in their open source journeys. + +**Q. How is Infosys gearing up to become a leading SI in the open source space? What new initiatives has the company taken in the last few years?** +**A.** Open source is a strong focus area for Infosys. We have established an open source practice that works with all our services lines to execute client engagements, drive internal innovation, open source contribution and talent enablement. We have a comprehensive set of service offerings – spanning open source advisory services, architecture consulting, implementation, migration and support – to help our clients accelerate open source adoption. + +Our architects bring both depth and breadth across the stack to deliver end-to-end solutions. We have built a suite of in-house tools and accelerators to further speed up open source based modernization and migration initiatives. + +We have a strong ecosystem of more than 25 partners, which helps us offer end-to-end services and a single commercial interface to our clients by bundling product subscription and support along with our application services. + +We have a razor-sharp focus on talent enablement at scale – we have over 330 open source courses, which our employees can access via our ‘learn anywhere’ platforms, and to date, over 65,000 people have been trained on open source. + +**Q. Are there any major open source case studies that you’d like to share with our audience, particularly a case study from India?** +**A.** There are several exciting case studies, none more impressive than from our own backyard – the GSTN project and the platform behind the most extensive indirect tax reforms in Indian history. This is also one of the largest and most complex in the world. + +Infosys had the privilege of designing and building this ‘population-scale’ platform using an entirely open source stack, based on fundamental principles like openness, no vendor lock-in, security, reliability, availability and scalability. The system is capable of handling some astonishing volumes – around 50,000 invoices per second and 1.2 billion invoices on the last day of filing, with extremely high availability and performance. The system has been tested to handle up to 135,000 concurrent user filings and 2,000,000 tax returns on a single day. It also collects US$ 3.7 billion of tax revenues on the peak day across 800,000 transactions. + +Case studies like GSTN showcase the power of open source in every aspect and should convince any sceptics about its suitability at the enterprise scale. + +**Q. How does your team empower or enable other teams at Infosys, when it comes to open source?** +**A.** Enablement of architects and developers across the company is one of the key responsibilities of our open source practice. There are three pillars of enablement – internal learning systems, partners and hackathons. We have dedicated open source technology trainers within the education, training and assessment team to enable employees at scale. Our partner and open source practice SMEs offer webinars on the latest topics related to their products, every week. Partner training courses and certifications are integrated with our anytime, anywhere, learning system LEX. We have a well-structured refactoring program for employees who may have adjacent skills to follow a defined learning path by getting themselves trained in at least one open source technology followed by certification. It is only after this that we deploy employees on an open source project, and post gaining hands-on experience, we tag them as open source professionals. We also run open source hackathons at the organization level. In these hackathons, that we run for multiple weeks, we do a mass enablement of our employees, post which they work on solving various industry problems using open source technologies. + +**Q. How do you ensure that your team keeps pace with the rapid changes in the open source space, and is ready to offer solutions based on the latest technology stacks?** +**A.** We have a strong team of SMEs and full-stack architects in our open source practice. A portion of our architects’ time is dedicated to learning and certifying themselves on new technologies. They are also encouraged to contribute to open source community projects. Open source SMEs participate in various forums and partner summits to share our experiences as well as learn from others experiences. They also monitor the latest trends in the industry. + +We have a strong ecosystem of partners that we work closely with in order to understand the latest enhancements in their products and how to take these forward with clients. In the hackathons that we conduct, we encourage hackers to unleash their imagination, innovate and build new solutions leveraging latest features. + +We believe in building joint solutions with our partners and in solving our clients’ business problems. We have a dedicated engineering team to explore and develop new tools and accelerators to solve client problems by embracing the latest open source technologies. For example, we have built a solution using the offline capability of Couchbase in collaboration with the Couchbase team. + +**Q. Do members of your team contribute back to the open source ecosystem too? Can you share some details?** +**A.** Yes, we do. Infosys has a structured contribution process and has created an OS Contribution Portal internally. A contributor builds a contribution and submits it for review and IP checking. Post the IP check, the contribution can be published. Infosys has contributed homegrown products like the Infosys DevOps Platform and tools like Infosys Data Rapid, NIADataRConnector, High Availability Hadoop, HBase to Hive, etc. to the open source ecosystem. + +Infosys has executed a Corporate Contributor License Agreement (CCLA) with the Cloud Native Computing Foundation (CNCF) and is actively participating in the Kubernetes project. We have made over 50 contributions in Kubernetes in the form of bug fixes, blogs and query responses. Apart from Kubernetes, Infosys has also contributed to PostgreSQL, Elastic, Couchbase, Apache Beam and Neo4J communities. Infosys has also collaborated with the Microsoft product engineering team to enable PostgreSQL and MariaDB in Azure Data Services. This is one focus area of our open source practice. There are many more contributions in the pipeline. + +**Q. Does Infosys motivate its employees to contribute back to the open source ecosystem or is it their individual decision?** +**A.** It’s both. Infosys motivates employees to contribute to the open source ecosystem. We conduct internal and external events. Kubernetes Day was organized at Infosys Bengaluru this March, where thousands of people participated. We invited some industry-level open source contributors to share their open source journey and experiences. These talks were webcast to all Infoscions across locations. We have a reward and recognition process to acknowledge and appreciate open source contributors. + +**Q. Is there a shortage of skilled professionals? Are there any specific skillsets that are badly needed, even in countries like India?** +**A.** The average age of an S&P 500 company is under 20 years, down from 60 years in the 1950s, according to Credit Suisse. This trend is accelerating and the leading reason for this is the disruptive nature of new technologies. + +As per a 2018 Gartner survey, talent shortage ranks third among the Top 5 business risks. Digital transformation initiatives have increased this pressure and companies are finding that retaining and hiring talent with niche skills is a key challenge. + +Today, just 20 per cent of the current workforce has the skills required for 60 per cent of the future jobs – those that will be available in the next five to ten years. The unprecedented scale at which new technologies are getting adopted into the mainstream due to the competitive edge they provide makes it almost impossible to find talent at scale on these technologies. + +Catering to the skills diversity needed in an organization and hiring/retaining people are key challenges. In this new harsh reality, hiring talent that is passionate about learning becomes more important than finding talent with the right skills. +At Infosys, we are trying to address this challenge through a combination of hiring and reskilling. + +**Q. What would be your advice to tech professionals who want to benefit from these opportunities but don’t know where to start?** +**A.** My advice to tech professionals is straightforward; we are living in exciting times with limitless opportunities. Never before in the history of humanity have we seen such democratization of knowledge and technology, as today. There is no defined starting line, but what is most important is to learn and apply the knowledge in real business problems continuously. Knowledge begets knowledge, if shared with a broader community. So we should also look at sharing knowledge through contributions, participation at various forums and collaboration. At Infosys, we have always believed and invested heavily in learning, and we have enabled our employees to learn anytime, anywhere, through our mobile learning platform, LEX, which has over 40K resources and 600+ courses. Employees are also encouraged to and recognised for sharing their knowledge, both externally and internally. We are collaborating with our strategic partners to contribute to open source communities jointly. As we speak, we are working with one of our partners to launch an open source academy. + +**Q. Has there been an increase in the number of open source related professionals being hired at Infosys?** +**A.** We are seeing a huge demand for open source technologies and most of our Top 200 clients are increasingly moving their legacy systems to open source technologies. We use a combination of refactoring our existing talent pool and hiring to meet the demand. + +![Avatar][3] + +[Rahul Chopra][4] + +The author is the Editor-in-Chief of Open Source For You magazine. + +[![][5]][6] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/we-follow-a-holistic-approach-to-drive-open-source-adoption-across-the-client-base-at-infosys/ + +作者:[Rahul Chopra][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/rahul-chopra/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gautam-Khanna-VP-head-modernization-practice-Infosys.jpg?resize=500%2C627&ssl=1 (Gautam Khanna, VP & head - modernization practice, Infosys) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gautam-Khanna-VP-head-modernization-practice-Infosys.jpg?fit=500%2C627&ssl=1 +[3]: https://secure.gravatar.com/avatar/372bbe65753ca17bcceb2b0e9692af8f?s=100&r=g +[4]: https://opensourceforu.com/author/rahul-chopra/ +[5]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[6]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US diff --git a/sources/talk/20191129 My Linux story- Covering open source in Spanish.md b/sources/talk/20191129 My Linux story- Covering open source in Spanish.md new file mode 100644 index 0000000000..df6edf8ecd --- /dev/null +++ b/sources/talk/20191129 My Linux story- Covering open source in Spanish.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux story: Covering open source in Spanish) +[#]: via: (https://opensource.com/article/19/11/linux-open-source-spanish) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +My Linux story: Covering open source in Spanish +====== +Meet Lorenzo Carbonell, who brings GNU/Linux and open source to the +Spanish-speaking community through his blog site, El Atareao, and +applications. +![Guy on a laptop on a building][1] + +From time to time, when I'm looking for some help on how to do something on my GNU/Linux desktop or server, I'll come across an article or conversation in a language other than English. If that language happens to be French or Spanish, that's fine for me. If it's in Portuguese or Italian, I can stumble through it. And, for other languages, occasionally, I'll give one of those online AI translators a go in the hopes of gleaning something useful. + +But for folks who are comfortable only in English, I suspect that many potentially useful (and sometimes very entertaining) sources are unknown and ignored. And what are the options for people who aren't comfortable in English, when so much that is written about open source (and many other topics) is in English? + +Last year, while researching [open source music players][2], I had the good fortune to stumble on [El Atareao – Linux para legos][3], a well-written, gorgeously illustrated Castilian Spanish blog that focuses on GNU/Linux and open source topics. El Atareao contains tutorials, discussions about applications, and podcasts. Its author, Lorenzo Carbonell, writes beautifully clear and entertaining text and generously shares his accumulating wisdom in a very practical form. He also develops open source applications, including LPlayer, which is how I found his blog. + +I had a discussion with Lorenzo about what it takes to create a great non-English, open source-oriented blog. Here is our conversation, translated from Spanish and edited for clarity. + +**Q: Lorenzo, I've been a fan of your blog since May 2018. I like everything about it—very interesting articles, solid content, beautiful images, great design overall. What motivated you to start this fine project? And what motivates you today?** + +**A:** I got to know GNU/Linux at university about 25 years ago; it attracted my attention, and I used it for several months. For whatever reason—maybe I wasn't sufficiently prepared, maybe the distribution, Slackware, was too much for me—I decided to abandon it when I started working. However, it stuck in my memory. + +About 10 years ago, I was tired of bringing office work home, and I decided to come up with a solution. At that moment, some recollection of that GNU/Linux operating system came back to me, and I thought using a different operating system might be the solution. The incompatibility between the two would make it hard to bring work home, I thought. + +I chose Ubuntu as my platform, and this distribution has stayed with me until today, a distribution that showed me my mistake: With Ubuntu, or really any other distro, I can still do office work at home! + +Yes, in the beginning, I had some difficulties. And these difficulties were what led to the birth of Atareao.es, because that was where I posted the lessons I learned from this incredible operating system. + +Using an open source operating system, which provides the opportunity to get into the guts of the system and adapt its functions to my needs, stole my heart. Implementing applications like [LPlayer][4], [Touchpad-Indicator][5], or [My Weather Indicator][6] and seeing other people finding them useful filled me with satisfaction. Not only the satisfaction of implementing applications and bringing them to the attention of other users through Atareao.es, but also the satisfaction of being able (or at least trying) to show the potential of this operating system. The potential of this operating system is that it allows you to do almost anything you can imagine, for the simple reason that the code is there and available so that you can study it and adapt it to your needs. + +What motivates me? To have an operating system with so much potential; that is the great unknown. This is what motivates me: having successes to shout to the four winds to let everyone know. And once everyone knows, each one can decide. This is one of the reasons for free applications that can make life simpler or at least help the newly arrived. + +**Q: Please explain the name "El Atareao"… is it local slang? I understand "el atareado" (the busy person).** + +**A:** "El Atareao" was something that arose from work 10 years ago. At that time, I was always busy with work. A close friend mentioned that phrase to me, and it branded itself in my mind. Now it's "el atareao" that will support the company. And to honor and respect this, I used the name for this site. + +So with respect to "atareao" in place of "atareado," effectively it's local slang. + +**Q: So when you aren't "atareao," what do you do? Are you a software developer? Do you work in open source by day?** + +**A:** Currently, I'm working as a developer and in part as a system administrator. And I must say that this came about thanks to Atareao.es. Before, I was working in something completely and totally different, but software development has been my passion. And so, relatively recently, a visionary (or a crazy person) rescued me from my old job and brought me to this incredible world of development, where you can convert anything you can imagine to reality. I say "visionary" because he knew how to see what I could not, and "crazy" because he has to be really bold to make that bet. Today I'm like a kid in a candy store. + +**Q: Your articles provide a solid amount of useful detail. For example, this [article about Rsync][7]. How do you decide on a topic? How do you determine your readers' level of ability so you can write in a way they can understand?** + +**A:** Normally, the articles arise from my need to solve a problem or a situation that I'm facing or that someone has contacted me to ask for help. Though the latter is less common because interactivity in the world 2.0 is not always what I, and I suppose others, would like. + +The objective of any article is to be sufficiently detailed so that any person reading it can reproduce it and can succeed at putting the material to work. It's very frustrating to read an article about some technology that is apparently really simple and not be able to make it work—because the person who wrote the article did not try it out, or because it's vaguely documented, or because it's explained in a technically excessive manner. + +My objective is to try to acquaint as many people as possible to the greatest extent possible with this operating system. How can I tell you about something if you can't make it work because I didn't explain it sufficiently or with enough detail? When someone writes to me and tells me they were unable to follow something or that it wasn't well explained or that there is some error, it makes me very uneasy and motivates me to write better, to strengthen myself, to study more, to learn. + +With respect to the readers' level of ability, this is probably my biggest worry. I know that the majority who read Atareao.es are beginners or "legos" (in the sense of not being professionals), and I try to orient myself to these people. Nevertheless, some of the readers are professionals and are quite challenging to satisfy. In whatever way, I always try for the most straightforward and simple result. Or, at least to be sufficiently clear, so that I can understand it without problems. + +**Q: Do you have other hobbies apart from this blog?** + +**A:** Currently, the blog, the podcast, and developing applications absorb nearly all of my free time. An article or a podcast takes a couple of hours. Creating an application never ends and sucks up all my available time. + +But one hobby that I am dedicated to is running; this is something I do every day or nearly so. And so, as I mention in the "[Who am I?][8]" section of the blog, if one day you visit Silla, the town in Valencia where I live, early in the morning, you can find me on my running circuits. When we travel, which is the other hobby that I have and share with my wife, my running shoes and my laptop always come with me. You can always find me traveling or running or sitting in a coffee shop writing an article. + +**Q: As someone who is not a native speaker of (Castilian) Spanish, I nevertheless enjoy your use of the language; I feel that how one expresses oneself is as important as what is written. Can you elaborate on this?** + +**A:** It seems to me very important that an article, whether it's technical or not, should have the best possible wording. And not only to be correct, syntactically and semantically, but to be able to tell a story, a story that engages. + +For this reason, whenever I can, I try to write the technical article within an experience, a situation, or a circumstance that has happened to me. From my perspective, writing about real, daily successes that frame a technical article works better for readers and makes them feel much more involved. + +**Q: There are a lot of people who prefer information in their mother tongue. As someone who writes in Spanish, what do you think about this issue? Do you have any idea of the level of demand for information about open source software in Spanish?** + +**A:** I think that Spanish speakers, and especially those born in Spain, prefer (Castilian) Spanish as their working language. In Spain, they don't teach us English; rather, they teach us how to pass the English course, which is a real shame. I would enjoy speaking, writing, and expressing myself in English as well as you, but there isn't a means, despite the fact that every day, I consume more video and audio in English, and every day I push myself more with it. I need English more and more; I need to develop myself better in this language. + +With respect to the demand for open source software in Spanish, as far as I understand, it's very low, too low for my liking. In general, open source software is the unknown. Few know Linux, and few understand that it's what is behind open source software. A significant number come at first for the simple fact that it's free. This is a great advantage because it's a way to first approach open source. Nevertheless, it's necessary to go deeper, to take a radical turn, because to the Spanish speaker, or at least to the Spaniard, when something is free or very cheap, it seems that it is of low quality. And "free" software is not synonymous with "no cost"; it must be defined based on its high quality. + +**Q: Where is** **El Atareao** **going in the future? More podcasts? YouTube channels? Adding other authors? Syndicated content?** + +**A:** Where is Atareao.es going? I know where I'd like it to go. I'd like to dedicate myself to it full time. I'd like to live on [income from] the site, although I know that's really difficult. One approach that I'm exploring is to convert it to a membership site, although providing the content for free. This is something that I need to keep working on. + +As a part of this, I'm trying to participate in related events and give talks at conferences. I started down this road last year at [Ubucon][9] Europe 2018, I continued this year, and next year I'd like to deepen this involvement. "De-virtualization" is important, putting faces to names, seeing that open source software isn't something far away, distant, or cold; quite the contrary. + +In the short term, I'd like to work on my [YouTube channel][10] while working on talks and attending conferences. I'm planning to start a series on YouTube, although I don't have it completed, and only my wife and now you (all) know about it. + +### Conclusion + +Thanks very much, Lorenzo, for taking the time to share your thoughts with us, and best wishes for the continued success of El Atareao. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/linux-open-source-spanish + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) +[2]: https://opensource.com/article/18/6/open-source-music-players +[3]: https://www.atareao.es/ +[4]: https://github.com/atareao/lplayer +[5]: https://github.com/atareao/Touchpad-Indicator +[6]: https://github.com/atareao/my-weather-indicator +[7]: https://www.atareao.es/podcast/sincronizacion-en-red-y-vpn/ +[8]: https://www.atareao.es/quien-soy/ +[9]: https://wiki.ubuntu.com/Ubucon +[10]: https://www.youtube.com/c/atareao diff --git a/sources/tech/20180207 23 open source audio-visual production tools.md b/sources/tech/20180207 23 open source audio-visual production tools.md deleted file mode 100644 index b6b748ec39..0000000000 --- a/sources/tech/20180207 23 open source audio-visual production tools.md +++ /dev/null @@ -1,262 +0,0 @@ -luming translating -23 open source audio-visual production tools -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga) - -Open source is well established in cloud infrastructure, web hosting, embedded devices, and many other areas. Fewer people know that open source is a great option for producing professional-level audio-visual materials. - -As a product owner and sometimes marketing support person, I produce a lot of content for end users: documentation, web articles, video tutorials, event booth materials, white papers, interviews, and more. I have found plenty of great open source software that helps me do my job producing audio, video, print, and screen graphics. There are a lot of [reasons][1] that people choose open source over proprietary options, and I've compiled this list of open source audio and video tools for people who: - - * want to switch to GNU/Linux, but need to start slowly with cross-platform software on their regular operating system; - * are already open source enthusiasts, but are new to open source A/V software and want to know which options to trust; - * want to discover new tools to fuel their creativity and don't want to use the same approaches or software everyone else uses; or - * have some other reason to use open source A/V solutions (if this is you, share your reason in the comments). - - - -Fortunately, there is a lot of open source software available for A/V creators, as well as hardware that supports those applications. All of the software on this list meets the following criteria: - - * cross-platform - * open source (for software and drivers) - * stable - * actively maintained - * well documented and supported - - - -I've divided this list into graphics, audio, video, and animation solutions. Note that the software applications in this article are not exact equivalents of well-known proprietary software, they'll require you to learn new applications, and you may need to modify your workflow, but learning new tools enables you to create differently. - -### Graphics - -I create a lot of graphics for print and web, including logos, banners, video titles, and mockups. Here are some of the open source applications I use, as well as the hardware I use with them. - -#### Software - -**1.[Inkscape][2]** (vector graphics) -Inkscape is a good vector graphics editor for creating SVG and PDF files in the RGB color space. (It can create CMYK images, but that's not the main aim.) It's a lifesaver for manipulating SVG maps and charts for web applications; not only can you open files with the integrated XML editor, you can also see all of an object's parameters. One drawback: it is not well optimized on Mac. For examples, see [Inkscape's gallery][3]. - -**2.[GIMP][4]** (picture editor) -GIMP is my favorite application to edit images, including manipulating color, cropping and resizing, and (especially) optimizing file size for the web (many of my Photoshop-using colleagues ask me to do that last step for them). You can also create and draw images from scratch, but GIMP is not my favorite tool for that. See [GIMP Artists on DeviantArt][5] for examples. - -**3.[Krita][6]** (digital painting) -So you have this beautiful Wacom drawing tablet on your desk, and you want to try a true digital painting application? Krita is what you need to create beautiful drawings and paintings. See [Krita's Gallery][7] to see what I mean. - -**4.[Scribus][8]** (desktop publishing) -You can use Scribus to create a complete document, or just to convert a PDF from Inkscape or Libre Office from RGB to CMYK. One feature I really like: You can simulate and check what people with visual disabilities will experience with a Scribus document. I count on Scribus when I send PDF files to a commercial printer. While printing companies may be used to files created with proprietary solutions like InDesign, if your Scribus file is done correctly, your printer won't have any issues. Free trick: The first time you send a file, don't tell the printer the name of the software you used to create it. See [Made with Scribus][9] for examples of documents created with this software. - -**5.[RawTherapee][10]** (RAW image photo development) -RawTherapee is the only completely cross-platform alternative to Lightroom I know of. You can use your camera in RAW mode, and then use RawTherapee to "develop" your picture. It provides a very powerful engine and a non-destructive editor. For examples, see [RawTherapee screenshots][11]. - -**6.[LibreOffice Draw][12]** (desktop publishing) -Although you may not think of LibreOffice Draw as a professional desktop publishing solution, it can save you in many situations; for example, if you are creating whitepapers, diagrams, or posters that other people (even those who don't know graphics software) can update later. Not only is it easy to use, it's also a great alternative to Impress or PowerPoint for creating interesting documents. - -#### Graphics hardware - -**Graphics tablets** -[Wacom][13] tablets (and compatibles) are usually well supported on all operating systems. - -**Color calibration** -Color calibration products are available on all operating systems, including GNU/Linux. The [Spyder][14] products by Datacolor are well supported with applications for all platforms. - -**Scanners and printers** -Graphic artists need the colors they output (whether print or electronic) to be accurate. But devices that are truly cross-platform, with easy-to-install drivers for all platform, are not as common as you'd think. Your best choices are scanners that are compatible with TWAIN and printers that are compatible with Postscript. In my experience, professional-range printers and scanners from Epson and Xerox are less likely to have driver issues, and they always work out of the box, with beautiful and accurate colors. - -### Audio - -There are plenty of open source audio software options for musicians, video makers, game makers, music publishers, and others. Here are the ones that I've used for content creation and audio recording. - -#### Software - -**7. [Ardour][15] **(digital audio recording) -For recording and editing audio, the best alternative to the professional Pro Tools music-creation software is, hands down, Ardour. It sounds great, the mixer section is complete and flexible, it supports your favorite plugins, and it makes it very easy to edit, listen, and compare your modifications. I use it a lot for audio recording or mixing sound on videos. It's not easy to find music recorded with Ardour, because musicians rarely credit the software they use. However, you can get an idea of its capabilities by looking at its [features and screenshots][16]. - -(If you are looking for an "analog feeling" in term of sound and workflow, you can try [Harrison Mixbus][17], which is not an open source project, but is heavily based on Ardour, with Harrison's analog console emulator. I really like to work with it and my customers like the sound. Mixbus is cross platform.) - -**8.[Audacity][18]** (audio editing) -Audacity is the "Swiss Army knife" of audio software. It's not perfect, but you can do almost everything with it. Plus it's very easy to use, and anyone can learn it in a few minutes. Like Ardour, it's hard to find work credited to Audacity, but you can find ways to use it on these [screenshots][19]. - -**9.[LMMS][20]** (music production) -LMMS, designed as an alternative to FL Studio, might not be as popular, but it is very complete and easy to use. You can use your favorite plugins, edit instruments using "piano roll" sequencing, play drum samples with a step sequencer, mix your tracks ... almost anything is possible. I use it to create audio loops for videos when I don't have the time to record musicians. See [The Best of LMMS][21] playlists for examples. - -**10.[Mixxx][22]** (DJ, music mixing) -If you need powerful software to mix music and play DJ, Mixx is the one to use. It's compatible with most MIDI controllers, timecoded discs, and dedicated sound cards. You can manage your music library, add effects, and have fun. Take a look at the [features][23] to see how it works. - -#### Audio interface hardware - -While you can record audio with any computer's sound card, to record well, you need an audio interface—a specialized type of external sound card that records high-quality audio input. For cross-platform compatibility, most "USB Class Compliant" or "compatible with iOS" audio interface devices should work for MIDI or other audio. Below is a list of cross-platform devices I use and know well. - -**[Behringer U-PHORIA UMC22][24]** -The UMC22 is the cheapest option you should consider. With less expensive options, the preamps are too noisy and the quality of the box is very low. - -**[Presonus AudioBox USB][25]** -The AudioBox USB is one of the first USB Class Compliant (and thereby cross-platform) recording systems out there. It is very robust and available on the second-hand market. - -**[Focusrite Scarlett][26]** -The Scarlett range is, in my opinion, the highest quality cross-platform sound card available. The various options range from devices with two to 18 input/outputs. You can find first-version models on the second-hand market, and the new second version offers better preamps and specs. I've worked a lot with the [2i2][27] model. - -**[Arturia AudioFuse][28]** -The AudioFuse allows you to plug in nearly anything, from a microphone to a vinyl disc player to various digital inputs. It provides both great sound and great design, and it's what I'm using the most now. It is cross-platform, but the configuration software is not yet available for GNU/Linux. It remembers my configuration even after I unplug it from my Windows PC, but really, Arturia, please be serious and make the software available for GNU/Linux. - -#### MIDI controllers - -A MIDI controller is a musical instrument—e.g., keyboards, drum pads, etc.—that allow you to control music software and hardware. Most of the recent USB MIDI controllers are cross-platform and compatible with the main software used to record and edit audio. Web-based tutorials will help you configure them for different software; although it may be harder to find info on GNU/Linux configurations, they will work. I've used many Akai and M-Audio devices without any issues. It's best to try a musical instrument before you buy, at least to listen to the sound quality or to touch the buttons. - -#### Audio codecs - -Audio codecs compress and decompress digital audio to deliver the best-quality audio at the smallest possible file size. Fortunately, the best codec for listening and streaming happens to be open source: [FLAC][29]. [Ogg Vorbis][30] is another open source audio codec worth checking out; it's far better than MP3 at the same bitrate. If you need to export audio in different file formats, I recommend always exporting and archiving audio at the best possible quality, then compressing a specific version if it's needed. - -### Video - -The impact of video in brand communications is significant. Even if you are not a video specialist, it's smart to learn the basics. - -#### Software - -**11.[VLC][31]** (video player and converter) -Originally developed for media streaming, VLC is now known for its ability to read all video formats on all devices. It's very useful; for example, you can also use it to convert a video into another codec or container or to recover a broken video. - -**12.[OpenShot][32]** (video editor) -OpenShot is simple software that produces great results, especially for short videos. (It is a bit limited in terms of editing or improving the sound of a video, but it will do the job.) I especially like the tool to move, resize, or crop a clip; it's perfect to create intros and outros that you can export, then use in a more complex editor. You can see [examples][33] (and get more information) on OpenShot's website. - -**13.[Shotcut][34]** (video editor) -I think Shotcut is a bit more complete than OpenShot—it's a very good competitor to the basic editors in your operating system, and it supports 4K and professional codecs. Give it a try, I think you will love it. You can see examples in these [video tutorials][35]. - -**14.[Blender Velvets][36]** (vdeo editing, compositing, effects) -While the learning curve is not the lightest on this list, Blender Velvets is one of the most powerful solutions you will find. It is a collection of extensions and scripts, created by movie makers, that transform the Blender 3D creation software into a 2D video editor. While it's complexity means it's not my top choice for video editing, you can find plenty of tutorials on YouTube and other sites, and once you learn it, you can do everything with this software. Watch this [tutorial video][37] to see its functions and how it works. - -**15.[Natron][38]** (compositing) -I don't use Natron, but I've gotten great feedback from people who do. It's an alternative to Adobe's After Effects, but works differently. To learn more, watch a few video tutorials, like these on [Natron's YouTube][39] channel. - -**16.[OBS][40]** (live editing, recording, and streaming) -Open Broadcaster Software (OBS) is the leading solution for recording or [livestreaming][41] e-sports and video games on YouTube or Twitch. I use it a lot to record users' screens, conferences, meetups, etc. For more information, see the tutorial I wrote for Opensource.com about recording live presentations, [Part 1: Choosing your equipment][42] and [Part 2: Software setup][43]. - -#### Video hardware - -First things first: You will need a powerful workstation with a fast hard drive and updated software and drivers. - -**Graphics processing unit (GPU)** -Some software on this list, including Blender and Shotcut, use OpenGL and hardware acceleration, which have high GPU demands. I recommend the most powerful GPU you can afford. I've had good experience with AMD and Nvidia, depending on the platform. Don't forget to install the latest drivers. - -**Hard drives** -In general, the faster and bigger the hard drive, the better it is for video. Don't forget to configure your software to use the right path. - -**Video capture hardware** - - * [Blackmagic Design][44]: Blackmagic provides very good, professional-grade video capture and playback hardware. Drivers are available for Mac, Windows, and GNU/Linux (but not all distributions). - * [Epiphan][45]: Among Epiphan's professional USB video capture devices is a new USB Class Compliant model for HDMI and high screen resolutions. However, you can find the older VGA devices on the secondhand market, for which they continue to provide dedicated drivers for GNU/Linux and Windows. - - - -#### Video codecs - -Unfortunately, it is still difficult to work with open source codecs. For example, many cameras use proprietary codecs to record videos in H.264 and sound in AC3, in a format called AVCHD. Therefore, we have to be pragmatic and use what is available. - -The good news is that the content industry is moving to open source codecs to avoid fees and to use open standards. For distribution and streaming, [Google'][46][s WebM][46] is a good open source codec, and most video editors can export in that format. Also, [GoPro's][47][Cineform][47] codec for very high resolution and 360° video is now open source. Hopefully more devices and vendors will use it soon. - -### 2D and 3D animation - -Animation is not my field of expertise, so I've asked my friends who are working on animated content, including movies and series for kids, for their recommendations to compile this list. - -#### Software - -**17. [Blender][48] **(3D modeling and rendering) -Blender is the top open source and cross-platform software for 3D modeling and rendering. You can do your entire project directly in Blender, or use it to create 3D effects for a movie or video. You will find a lot of video tutorials on the web, so even though it isn't simple software, it's very easy to get started. Blender is a very active project and regularly produces short movies to showcase the technology. You can see some of them on [Blender Open Movies][49]. - -**18.[Synfig Studio][50]** (2D animation) -The first time I used Synfig, it reminded me of the good, old Macromedia Flash editor. Since then, it has grown into a full-featured 2D animation studio. You can use it to produce promotional stories, commercials, presentations, or original intros, outros, and transitions for your videos, or even to work on full animated movies. See [Synfig's portfolio][51] for some examples. - -**19.[TupiTube][52]** (stop-motion, 2D animation) -TupiTube is an excellent way to learn the basics of 2D animation. You can transform a set of drawings or other pictures into a video or create an animated GIF or small loops. It's quite simple software, but very complete. Check out [TupiTube's YouTube][53] channel for some tutorials and examples. - -#### Hardware - -Animation uses the same hardware as graphic design, so look at the hardware list in the first section of this article for recommendations. - -One additional note: You will need a powerful GPU for 3D modeling and rendering. The choices can be limited, depending on your platform or PC maker, but don't forget to install the latest drivers. Carefully choose your graphics card: they are expensive and critical for big 3D projects, particularly in the rendering step. - -### Linux options - -If you are a GNU/Linux user, I have some more good options for you. They aren't fully cross-platform, but some of them have a Windows installer, and some can be installed on Mac with Macports. - -**20.[Kdenlive][54]** (video editor) -With its last release (a few months ago), Kdenlive became my favorite video editor, especially when I work on a long video on my Linux machine. If you are a regular user of popular non-linear video editors, Kdenlive (which stands for KDE Non-Linear Video Editor) will be easy for you to use. It has good video and audio effects, is great when you need to work on details, and works on BSD and MacOS (although it's aimed at GNU/Linux) and is being ported to Windows. - -**21.[Darktable][55]** (RAW development) -Darktable is a very complete alternative to DxO that is made by photographers for photographers. Some research projects are using it as a platform for development and testing of new image processing algorithms. It is a very active project, and I can't wait until it becomes truly cross-platform. - -**22.[MyPaint][56]** (digital painting) -MyPaint is like a light table for digital painting. It works well with Wacom devices, and its brush engine is particularly appreciated, so GIMP developers are looking closely at it. - -**23.[Shutter][57]** (desktop screenshots) -When I create tutorials, I use a lot of screenshots to illustrate them. My favorite screenshot tool for GNU/Linux is Shutter; actually, I can't find an equivalent in terms of features for Windows or Mac. One missing piece: I would like to see Shutter add a feature to create animated GIF screenshots over a few seconds. - -I hope this has convinced you that open source software is an excellent, viable solution for A/V content producers. If you are using other open source software—or have advice about using cross-platform software and hardware—for audio and video projects, please share your ideas in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/open-source-audio-visual-production-tools - -作者:[Antoine Thomas][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/ttoine -[1]:https://opensource.com/resources/what-open-source -[2]:https://inkscape.org/ -[3]:https://inkscape.org/en/gallery/ -[4]:https://www.gimp.org/ -[5]:https://gimp-artists.deviantart.com/gallery/ -[6]:https://krita.org/ -[7]:https://krita.org/en/features/gallery/ -[8]:https://www.scribus.net/ -[9]:https://www.scribus.net/category/made-with-scribus/ -[10]:http://rawtherapee.com/ -[11]:http://rawtherapee.com/blog/screenshots -[12]:https://www.libreoffice.org/discover/draw/ -[13]:http://www.wacom.com/en-us -[14]:http://www.datacolor.com/photography-design/product-overview/#workflow_2 -[15]:https://www.ardour.org/ -[16]:http://ardour.org/features.html -[17]:http://harrisonconsoles.com/site/mixbus.html -[18]:http://www.audacityteam.org/ -[19]:http://www.audacityteam.org/about/screenshots/ -[20]:https://lmms.io/ -[21]:https://lmms.io/showcase/ -[22]:https://www.mixxx.org/ -[23]:https://www.mixxx.org/features/ -[24]:http://www.musictri.be/Categories/Behringer/Computer-Audio/Interfaces/UMC22/p/P0AUX -[25]:https://www.presonus.com/products/audiobox-usb -[26]:https://us.focusrite.com/scarlett-range -[27]:https://us.focusrite.com/usb-audio-interfaces/scarlett-2i2 -[28]:https://www.arturia.com/products/audio/audiofuse/overview -[29]:https://en.wikipedia.org/wiki/FLAC -[30]:https://xiph.org/vorbis/ -[31]:https://www.videolan.org/ -[32]:https://www.openshot.org/ -[33]:https://www.openshot.org/videos/ -[34]:https://shotcut.com/ -[35]:https://shotcut.org/tutorials/ -[36]:http://blendervelvets.org/ -[37]:http://blendervelvets.org/video-tutorial-new-functions-for-the-blender-velvets/ -[38]:https://natron.fr/ -[39]:https://www.youtube.com/playlist?list=PL2n8LbT_b5IeMwi3AIzqG4Rbg8y7d6Amk -[40]:https://obsproject.com/ -[41]:https://opensource.com/article/17/7/obs-studio-pro-level-streaming -[42]:https://opensource.com/article/17/9/equipment-recording-presentations -[43]:https://opensource.com/article/17/9/equipment-setup-live-presentations -[44]:https://www.blackmagicdesign.com/ -[45]:https://www.epiphan.com/ -[46]:https://www.webmproject.org/ -[47]:https://fr.gopro.com/news/gopro-open-sources-the-cineform-codec -[48]:https://www.blender.org/ -[49]:https://www.blender.org/about/projects/ -[50]:https://www.synfig.org/ -[51]:https://www.synfig.org/#portfolio -[52]:https://maefloresta.com/ -[53]:https://www.youtube.com/channel/UCBavSfmoZDnqZalr52QZRDw -[54]:https://kdenlive.org/ -[55]:https://www.darktable.org/ -[56]:http://mypaint.org/ -[57]:http://shutter-project.org/ diff --git a/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md b/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md deleted file mode 100644 index 0ab375a008..0000000000 --- a/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md +++ /dev/null @@ -1,118 +0,0 @@ -Must-Have Tools for Writers on the Linux Platform -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writing-main.jpg?itok=qe96IkKm) -I’ve been a writer for more than 20 years. I’ve written thousands of articles and how-tos on various technical topics and have penned more than 40 works of fiction. So, the written word is not only important to me, it’s familiar to the point of being second nature. And through those two decades (and counting) I’ve done nearly all my work on the Linux platform. I must confess, during those early years it wasn’t always easy. Formats didn’t always mesh with what an editor required and, in some cases, the open source platform simply didn’t have the necessary tools required to get the job done. - -That was then, this is now. - -A perfect storm of Linux evolution and web-based tools have made it such that any writer can get the job done (and done well) on Linux. But what tools will you need? You might be surprised to find out that, in some instances, the job cannot be efficiently done with 100% open source tools. Even with that caveat, the job can be done. Let’s take a look at the tools I’ve been using as both a tech writer and author of fiction. I’m going to outline this by way of my writing process for both nonfiction and fiction (as the process is different and requires specific tools). - -A word of warning to seriously hard-core Linux users. A long time ago, I gave up on using tools like LaTeX and DocBook for my writing. Why? Because, for me, the focus must be on the content, not the process. When you’re facing deadlines, efficiency must take precedent. - -### Nonfiction - -We’ll start with nonfiction, as that process is the simpler of the two. For writing technical how-tos, I collaborate with different editors and, in some cases, have to copy/paste content into a CMS. But like with my fiction, the process always starts with Google Drive. This is the point at which many open source purists will check out. Fear not, you can always opt to either keep all of your files locally, or use a more open-friendly cloud service (such as [Zoho][1] or [nextCloud][2]). - -Why start on the cloud? Over the years, I’ve found I need to be able to access that content from anywhere at any time. The simplest solution was to migrate the cloud. I’ve also become paranoid about losing work. To that end, I make use of a tool like [Insync][3] to keep my Google Drive in sync with my desktop. With that desktop sync in place, I know there’s always a backup of my work, in case something should go awry with Google Drive. - -For those clients with whom I must enter content into a Content Management System (CMS), the process ends there. I can copy/paste directly from a Google Doc into the CMS and be done with it. Of course, with technical content, there are always screenshots involved. For that, I use [Gimp][4], which makes taking screenshots simple: - -![screenshot with Gimp][6] - -Figure 1: Taking a screenshot with Gimp. - -[Used with permission][7] - - 1. Open Gimp. - - 2. Click File > Create > Screenshot. - - 3. Select from a single window, the entire screen, or a region to grab (Figure 1). - - 4. Click Snap. - - - - -The majority of my clients tend to prefer I work with Google Docs, because I can share folders so that they have reliable access to the content. There are a few clients I have that do not work with Google Docs, and so I must download the files into a format that can be used. What I do for this is download in .odt format, open the document in [LibreOffice][8] (Figure 2), format as needed, save in a format required by the client, and send the document on. - -![Google Doc][10] - -Figure 2: My Google Doc download opened in LibreOffice. - -[Used with permission][7] - -And that, is the end of the line for nonfiction. - -### Fiction - -This is where it gets a bit more complicated. The beginning steps are the same, as I always write every first draft of a novel in Google Docs. Once that is complete, I then download the file to my Linux desktop, open the file in LibreOffice, format as necessary, and then save as a file type supported by my editor (unfortunately, that means .docx). - -The next step in the process gets a bit dicey. My editor prefers to use comments over track changes (as it makes it easier for both of us to read the document as we make changes). Because of this, a 60k word doc can include hundreds upon hundreds of comments, which slows LibreOffice to a useless crawl. Once upon a time, you could up the memory used for documents, but as of LibreOffice 6, that is no longer possible. This means any larger, novel-length, document with numerous comments will become unusable. Because of that, I’ve had to take drastic measures and use [WPS Office][11] (Figure 3). Although this isn’t an open source solution, WPS Office does a fine job with numerous comments in a document, so there’s no need to deal with the frustration that is LibreOffice (when working with these large files with hundreds of comments). - -![comments][13] - -Figure 3: WPS handles numerous comments with ease. - -[Used with permission][7] - -Once my editor and I finish up the edits for the book (and all comments have been removed), I can then open the file in LibreOffice for final formatting. When the formatting is complete, I save the file in .html format and then open the file in [Calibre][14] for exporting the file to .mobi and .epub formats. - -Calibre is a must-have for anyone looking to publish on Amazon, Barnes & Noble, Smashwords, or other platforms. One thing Calibre does better than other, similar, solutions is enable you to directly edit the .epub files (Figure 4). For the likes of Smashword, this is an absolute necessity (as the export process will add elements not accepted on the Smashwords conversion tool). - -![Calibre][16] - -Figure 4: Editing an epub file directly in Calibre. - -[Creative Commons Zero][17] - -After the writing process is over (or sometimes while waiting for an editor to complete a pass), I’ll start working on the cover for the book. That task is handled completely in Gimp (Figure 5). - -![Using Gimp][19] - -Figure 5: Creating the cover of POTUS in Gimp. - -[Used with permission][7] - -And that finishes up the process of creating a work of fiction on the Linux platform. Because of the length of the documents, and how some editors work, it can get a bit more complicated than the process of creating nonfiction, but it’s far from challenging. In fact, creating fiction on Linux is just as simple (and more reliable) than other platforms. - -### HTH - -I hope this helps aspiring writers to have the confidence to write on the Linux platform. There are plenty of other tools available to use, but the ones I have listed here have served me quite well over the years. And although I do make use of a couple of proprietary tools, as long as they keep working well on Linux, I’m okay with that. - -Learn more about Linux in the[ Introduction to Open Source Development, Git, and Linux (LFD201) ][20]training course from The Linux Foundation, and sign up now to start your open source journey. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/2018/11/must-have-tools-writers-linux-platform - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.zoho.com/ -[2]: https://nextcloud.com/ -[3]: https://www.insynchq.com -[4]: https://www.gimp.org/ -[5]: /files/images/writingtools1jpg -[6]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/writingtools_1.jpg?itok=Uko7DZ8U (screenshot with Gimp) -[7]: /licenses/category/used-permission -[8]: https://www.libreoffice.org/ -[9]: /files/images/writingtools2jpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_2.jpg?itok=vDgxd8hu (Google Doc) -[11]: https://www.wps.com/en-US/ -[12]: /files/images/writingtools3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_3.jpg?itok=AYrsfz01 (comments) -[14]: https://calibre-ebook.com/ -[15]: /files/images/writingtools4jpg -[16]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_4.jpg?itok=wFMEsL7b (Calibre) -[17]: /licenses/category/creative-commons-zero -[18]: /files/images/writingtools5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_5.jpg?itok=e7SZCgip (Using Gimp) -[20]: https://training.linuxfoundation.org/training/introduction-to-open-source-development-git-and-linux/?utm_source=linux.com&utm_medium=article&utm_campaign=lfd201 diff --git a/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md b/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md deleted file mode 100644 index bae14a2f5c..0000000000 --- a/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md +++ /dev/null @@ -1,133 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Can Better Task Stealing Make Linux Faster?) -[#]: via: (https://www.linux.com/blog/can-better-task-stealing-make-linux-faster) -[#]: author: (Oracle ) - -Can Better Task Stealing Make Linux Faster? -====== - -_Oracle Linux kernel developer Steve Sistare contributes this discussion on kernel scheduler improvements._ - -### Load balancing via scalable task stealing - -The Linux task scheduler balances load across a system by pushing waking tasks to idle CPUs, and by pulling tasks from busy CPUs when a CPU becomes idle. Efficient scaling is a challenge on both the push and pull sides on large systems. For pulls, the scheduler searches all CPUs in successively larger domains until an overloaded CPU is found, and pulls a task from the busiest group. This is very expensive, costing 10's to 100's of microseconds on large systems, so search time is limited by the average idle time, and some domains are not searched. Balance is not always achieved, and idle CPUs go unused. - -I have implemented an alternate mechanism that is invoked after the existing search in idle_balance() limits itself and finds nothing. I maintain a bitmap of overloaded CPUs, where a CPU sets its bit when its runnable CFS task count exceeds 1. The bitmap is sparse, with a limited number of significant bits per cacheline. This reduces cache contention when many threads concurrently set, clear, and visit elements. There is a bitmap per last-level cache. When a CPU becomes idle, it searches the bitmap to find the first overloaded CPU with a migratable task, and steals it. This simple stealing yields a higher CPU utilization than idle_balance() alone, because the search is cheap, costing 1 to 2 microseconds, so it may be called every time the CPU is about to go idle. Stealing does not offload the globally busiest queue, but it is much better than running nothing at all. - -### Results - -Stealing improves utilization with only a modest CPU overhead in scheduler code. In the following experiment, hackbench is run with varying numbers of groups (40 tasks per group), and the delta in /proc/schedstat is shown for each run, averaged per CPU, augmented with these non-standard stats: - - * %find - percent of time spent in old and new functions that search for idle CPUs and tasks to steal and set the overloaded CPUs bitmap. - * steal - number of times a task is stolen from another CPU. Elapsed time improves by 8 to 36%, costing at most 0.4% more find time. - - - -![load balancing][1] - -[Used with permission][2] - -​​CPU busy utilization is close to 100% for the new kernel, as shown by the green curve in the following graph, versus the orange curve for the baseline kernel: - -![][3] - -Stealing improves Oracle database OLTP performance by up to 9% depending on load, and we have seen some nice improvements for mysql, pgsql, gcc, java, and networking. In general, stealing is most helpful for workloads with a high context switch rate. - -### The code - -As of this writing, this work is not yet upstream, but the latest patch series is at [https://lkml.org/lkml/2018/12/6/1253. ][4]If your kernel is built with CONFIG_SCHED_DEBUG=y, you can verify that it contains the stealing optimization using - -``` -# grep -q STEAL /sys/kernel/debug/sched_features && echo Yes -Yes -``` - -If you try it, note that stealing is disabled for systems with more than 2 NUMA nodes, because hackbench regresses on such systems, as I explain in [https://lkml.org/lkml/2018/12/6/1250 .][5]However, I suspect this effect is specific to hackbench and that stealing will help other workloads on many-node systems. To try it, reboot with kernel parameter sched_steal_node_limit = 8 (or larger). - -### Future work - -After the basic stealing algorithm is pushed upstream, I am considering the following enhancements: - - * If stealing within the last-level cache does not find a candidate, steal across LLC's and NUMA nodes. - * Maintain a sparse bitmap to identify stealing candidates in the RT scheduling class. Currently pull_rt_task() searches all run queues. - * Remove the core and socket levels from idle_balance(), as stealing handles those levels. Remove idle_balance() entirely when stealing across LLC is supported. - * Maintain a bitmap to identify idle cores and idle CPUs, for push balancing. - - - -_This article originally appeared at[Oracle Developers Blog][6]._ - -_Oracle Linux kernel developer Steve Sistare contributes this discussion on kernel scheduler improvements._ - -### Load balancing via scalable task stealing - -The Linux task scheduler balances load across a system by pushing waking tasks to idle CPUs, and by pulling tasks from busy CPUs when a CPU becomes idle. Efficient scaling is a challenge on both the push and pull sides on large systems. For pulls, the scheduler searches all CPUs in successively larger domains until an overloaded CPU is found, and pulls a task from the busiest group. This is very expensive, costing 10's to 100's of microseconds on large systems, so search time is limited by the average idle time, and some domains are not searched. Balance is not always achieved, and idle CPUs go unused. - -I have implemented an alternate mechanism that is invoked after the existing search in idle_balance() limits itself and finds nothing. I maintain a bitmap of overloaded CPUs, where a CPU sets its bit when its runnable CFS task count exceeds 1. The bitmap is sparse, with a limited number of significant bits per cacheline. This reduces cache contention when many threads concurrently set, clear, and visit elements. There is a bitmap per last-level cache. When a CPU becomes idle, it searches the bitmap to find the first overloaded CPU with a migratable task, and steals it. This simple stealing yields a higher CPU utilization than idle_balance() alone, because the search is cheap, costing 1 to 2 microseconds, so it may be called every time the CPU is about to go idle. Stealing does not offload the globally busiest queue, but it is much better than running nothing at all. - -### Results - -Stealing improves utilization with only a modest CPU overhead in scheduler code. In the following experiment, hackbench is run with varying numbers of groups (40 tasks per group), and the delta in /proc/schedstat is shown for each run, averaged per CPU, augmented with these non-standard stats: - - * %find - percent of time spent in old and new functions that search for idle CPUs and tasks to steal and set the overloaded CPUs bitmap. - * steal - number of times a task is stolen from another CPU. Elapsed time improves by 8 to 36%, costing at most 0.4% more find time. - - - -![load balancing][1] - -[Used with permission][2] - -​​CPU busy utilization is close to 100% for the new kernel, as shown by the green curve in the following graph, versus the orange curve for the baseline kernel: - -![][3] - -Stealing improves Oracle database OLTP performance by up to 9% depending on load, and we have seen some nice improvements for mysql, pgsql, gcc, java, and networking. In general, stealing is most helpful for workloads with a high context switch rate. - -### The code - -As of this writing, this work is not yet upstream, but the latest patch series is at [https://lkml.org/lkml/2018/12/6/1253. ][4]If your kernel is built with CONFIG_SCHED_DEBUG=y, you can verify that it contains the stealing optimization using - -``` -# grep -q STEAL /sys/kernel/debug/sched_features && echo Yes -Yes -``` - -If you try it, note that stealing is disabled for systems with more than 2 NUMA nodes, because hackbench regresses on such systems, as I explain in [https://lkml.org/lkml/2018/12/6/1250 .][5]However, I suspect this effect is specific to hackbench and that stealing will help other workloads on many-node systems. To try it, reboot with kernel parameter sched_steal_node_limit = 8 (or larger). - -### Future work - -After the basic stealing algorithm is pushed upstream, I am considering the following enhancements: - - * If stealing within the last-level cache does not find a candidate, steal across LLC's and NUMA nodes. - * Maintain a sparse bitmap to identify stealing candidates in the RT scheduling class. Currently pull_rt_task() searches all run queues. - * Remove the core and socket levels from idle_balance(), as stealing handles those levels. Remove idle_balance() entirely when stealing across LLC is supported. - * Maintain a bitmap to identify idle cores and idle CPUs, for push balancing. - - - -_This article originally appeared at[Oracle Developers Blog][6]._ - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/can-better-task-stealing-make-linux-faster - -作者:[Oracle][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/linux-load-balancing.png?itok=2Uk1yALt (load balancing) -[2]: /LICENSES/CATEGORY/USED-PERMISSION -[3]: https://cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/b7a700fe-edc3-4ea0-876a-c91e1850b59b/Image/00c074f4282bcbaf0c10dd153c5dfa76/steal_graph.png -[4]: https://lkml.org/lkml/2018/12/6/1253 -[5]: https://lkml.org/lkml/2018/12/6/1250 -[6]: https://blogs.oracle.com/linux/can-better-task-stealing-make-linux-faster diff --git a/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md deleted file mode 100644 index e3a533b3b2..0000000000 --- a/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md +++ /dev/null @@ -1,200 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server) -[#]: via: (https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server -====== - -In this article, we’ll be looking at how to install **LEMP** stack on Fedora 30 Server. LEMP Stands for: - - * L -> Linux - * E -> Nginx - * M -> Maria DB - * P -> PHP - - - -I am assuming **[Fedora 30][1]** is already installed on your system. - -![LEMP-Stack-Fedora30][2] - -LEMP is a collection of powerful software setup that is installed on a Linux server to help in developing popular development platforms to build websites, LEMP is a variation of LAMP wherein instead of **Apache** , **EngineX (Nginx)** is used as well as **MariaDB** used in place of **MySQL**. This how-to guide is a collection of separate guides to install Nginx, Maria DB and PHP. - -### Install Nginx, PHP 7.3 and PHP-FPM on Fedora 30 Server - -Let’s take a look at how to install Nginx and PHP along with PHP FPM on Fedora 30 Server. - -### Step 1) Switch to root user - -First step in installing Nginx in your system is to switch to root user. Use the following command : - -``` -root@linuxtechi ~]$ sudo -i -[sudo] password for pkumar: -[root@linuxtechi ~]# -``` - -### Step 2) Install Nginx, PHP 7.3 and PHP FPM using dnf command - -Install Nginx using the following dnf command: - -``` -[root@linuxtechi ~]# dnf install nginx php php-fpm php-common -y -``` - -### Step 3) Install Additional PHP modules - -The default installation of PHP only comes with the basic and the most needed modules installed. If you need additional modules like GD, XML support for PHP, command line interface Zend OPCache features etc, you can always choose your packages and install everything in one go. See the sample command below: - -``` -[root@linuxtechi ~]# sudo dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y -``` - -### Step 4) Start & Enable Nginx and PHP-fpm Service - -Start and enable Nginx service using the following command - -``` -[root@linuxtechi ~]# systemctl start nginx && systemctl enable nginx -Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service. -[root@linuxtechi ~]# -``` - -Use the following command to start and enable PHP-FPM service - -``` -[root@linuxtechi ~]# systemctl start php-fpm && systemctl enable php-fpm -Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service. -[root@linuxtechi ~]# -``` - -**Verify Nginx (Web Server) and PHP installation,** - -**Note:** In case OS firewall is enabled and running on your Fedora 30 system, then allow 80 and 443 ports using beneath commands, - -``` -[root@linuxtechi ~]# firewall-cmd --permanent --add-service=http -success -[root@linuxtechi ~]# -[root@linuxtechi ~]# firewall-cmd --permanent --add-service=https -success -[root@linuxtechi ~]# firewall-cmd --reload -success -[root@linuxtechi ~]# -``` - -Open the web browser, type the following URL: http:// - -[![Test-Page-HTTP-Server-Fedora-30][3]][4] - -Above screen confirms that NGINX is installed successfully. - -Now let’s verify PHP installation, create a test php page(info.php) using the beneath command, - -``` -[root@linuxtechi ~]# echo "" > /usr/share/nginx/html/info.php -[root@linuxtechi ~]# -``` - -Type the following URL in the web browser, - -http:///info.php - -[![Php-info-page-fedora30][5]][6] - -Above page confirms that PHP 7.3.5 has been installed successfully. Now let’s install MariaDB database server. - -### Install MariaDB on Fedora 30 - -MariaDB is a great replacement for MySQL DB as it is works much similar to MySQL and also compatible with MySQL steps too. Let’s look at the steps to install MariaDB on Fedora 30 Server - -### Step 1) Switch to Root User - -First step in installing MariaDB in your system is to switch to root user or you can use a local user who has root privilege. Use the following command below: - -``` -[root@linuxtechi ~]# sudo -i -[root@linuxtechi ~]# -``` - -### Step 2) Install latest version of MariaDB (10.3) using dnf command - -Use the following command to install MariaDB on Fedora 30 Server - -``` -[root@linuxtechi ~]# dnf install mariadb-server -y -``` - -### Step 3) Start and enable MariaDB Service - -Once the mariadb is installed successfully in step 2), next step is to start the MariaDB service. Use the following command: - -``` -[root@linuxtechi ~]# systemctl start mariadb.service ; systemctl enable mariadb.service -``` - -### Step 4) Secure MariaDB Installation - -When we install MariaDB server, so by default there is no root password, also anonymous users are created in database. So, to secure MariaDB installation, run the beneath “mysql_secure_installation” command - -``` -[root@linuxtechi ~]# mysql_secure_installation -``` - -Next you will be prompted with some question, just answer the questions as shown below: - -![Secure-MariaDB-Installation-Part1][7] - -![Secure-MariaDB-Installation-Part2][8] - -### Step 5) Test MariaDB Installation - -Once you have installed, you can always test if MariaDB is successfully installed on the server. Use the following command: - -``` -[root@linuxtechi ~]# mysql -u root -p -Enter password: -``` - -Next you will be prompted for a password. Enter the password same password that you have set during MariaDB secure installation, then you can see the MariaDB welcome screen. - -``` -Welcome to the MariaDB monitor. Commands end with ; or \g. -Your MariaDB connection id is 17 -Server version: 10.3.12-MariaDB MariaDB Server - -Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. - -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. - -MariaDB [(none)]> -``` - -And finally, we’ve completed everything to install LEMP (Linux, Nginx, MariaDB and PHP) on your server successfully. Please post all your comments and suggestions in the feedback section below and we’ll respond back at the earliest. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/ - -作者:[Pradeep Kumar][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linuxtechi.com/author/pradeep/ -[b]: https://github.com/lujun9972 -[1]: https://www.linuxtechi.com/fedora-30-workstation-installation-guide/ -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/06/LEMP-Stack-Fedora30.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30-1024x732.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30-1024x732.jpg -[6]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30.jpg -[7]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part1.jpg -[8]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part2.jpg diff --git a/sources/tech/20190718 What you need to know to be a sysadmin.md b/sources/tech/20190718 What you need to know to be a sysadmin.md deleted file mode 100644 index 55947b8456..0000000000 --- a/sources/tech/20190718 What you need to know to be a sysadmin.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What you need to know to be a sysadmin) -[#]: via: (https://opensource.com/article/19/7/be-a-sysadmin) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/kimvila) - -What you need to know to be a sysadmin -====== -Kickstart your sysadmin career by gaining these minimum competencies. -![People work on a computer server with devices][1] - -The system administrator of yesteryear jockeyed users and wrangled servers all day, in between mornings and evenings spent running hundreds of meters of hundreds of cables. This is still true today, with the added complexity of cloud computing, containers, and virtual machines. - -Looking in from the outside, it can be difficult to pinpoint what exactly a sysadmin does, because they play at least a small role in so many places. Nobody goes into a career already knowing everything they need for a job, but everyone needs a strong foundation. If you're looking to start down the path of system administration, here's what you should be concentrating on in your personal or formal training. - -### Bash - -When you learn the Bash shell, you don't just learn the Bash shell. You learn a common interface to Linux systems, BSD, MacOS, and even Windows (under the right conditions). You learn the importance of syntax, so you can quickly adapt to systems like Cisco routers' command line or Microsoft's PowerShell, and eventually, you can even learn more powerful languages like Python or Go. And you also begin to think procedurally so you can analyze complex problems and break them down into individual components, which is key because _that's_ how systems, like the internet, or an organization's intranet, or a web server, or a backup solution, are designed. - -But wait. There's more. - -Knowing the Bash shell has become particularly important because of the recent trend toward DevOps and [containers][2]. Your career as a sysadmin may lead you into a world where infrastructure is treated like code, which usually means you'll have to know the basics of scripting, the structure of [YAML-based][3] configuration, and how to [interact][4] with [containers][5] (tiny Linux systems running inside a [sandboxed file][6]). Knowing Bash is the gateway to efficient management of the most exciting open source technology, so go get [Bourne Again][7]. - -#### Resources - -There are many ways to get practice in the Bash shell. - -Try a [portable Linux distribution][8]. You don't have to install Linux to use Linux, so grab a spare thumb drive and spend your evenings or weekends getting comfortable with a text-based interface. - -There are several excellent [Bash articles][9] available here on opensource.com as well as [on Enable SysAdmin][10]. - -The problem with telling someone to practice with Bash is that to practice, you must have something to do. And until you know how to use Bash, you probably won't be able to think of anything to do. If that's your situation, go to Over The Wire and play [Bandit][11]. It's a game aimed at absolute beginners, with 34 levels of interactive basic hacking to get you comfortable with the Linux shell. - -### Web server setup - -Once you're comfortable with Bash, you should try setting up a web server. Not all sysadmins go around setting up web servers or even maintain web servers, but the skills you acquire while installing and starting the HTTP daemon, configuring Apache or Nginx, setting up the [correct permissions][12], and [configuring a firewall][13], are the same skills you need on a daily basis. After a little bit of effort, you may start to notice certain patterns in your labor. There are concepts you probably took for granted before trying to administer production-ready software and hardware, and you're no longer shielded from them in your fledgling role as an administrator. It might be frustrating at first because everyone likes to be good at everything they do, but that's actually a good thing. Let yourself be bad at new skills. That's how you learn. - -And besides, the more you struggle through your first steps, the sweeter it is when you finally see that triumphant "it works!" default index.html. - -#### Resources - -David Both wrote an excellent article on [Apache web server][14] configuration. For extra credit, step through his follow-up article on how to [host multiple sites][15] on one machine. - -### DHCP - -The Dynamic Host Configuration Protocol (DHCP) is the system that assigns IP addresses to devices on a network. At home, the modem or router your ISP (internet service provider) supports probably has an embedded DHCP server in it, so it's likely out of your purview. If you've ever logged into your home router to adjust the IP address range or set up a static address for some of your network devices, then you're at least somewhat familiar with the concept. You may understand that devices on a network are assigned the equivalent of phone numbers in the form of IP addresses, and you may realize that computers communicate with one another by broadcasting messages addressed to a specific IP address. Message headers are read by routers along the path, each of which works to direct the message to the next most logical router along the path toward its ultimate goal. - -Even if you understand these concepts, the inevitable escalation of basic familiarity with DHCP is to set up a DHCP server. Installing and configuring your own DHCP server provides you the opportunity to introduce DHCP collisions on your home network (try to avoid that, if you can, as it will definitely kill your network until it's resolved), control the distribution of addresses, create subnets, and monitor connections and lease times. - -More importantly, setting up DHCP and experimenting with different configurations helps you understand inter-networking. You understand how networks represent "partitions" in data transference and what steps you have to take to pass information from one to the other. That's vital for a sysadmin to know because the network is easily one of the most important aspects of the job. - -#### Resources - -Before running your own DHCP server, ensure that the DHCP server in your home router (if you have one) is inactive. Once you have it up and running, read Archit Modi's [guide to network commands][16] for tips on how to explore your network. - -### Network cables - -It might sound mundane, but getting familiar with how network cables work not only makes for a really fun weekend but also gives you a whole new understanding of how data gets across the wires. The best way to learn is to go to your local hobby shop and purchase a Cat 5 cutter and crimper and a few Cat 5 terminators. Then head home, grab a spare Ethernet cable, and cut the terminators off. Spend whatever amount of time it takes to get that cable back in commission. - -Once you have solved that puzzle, do it again, this time creating a working [crossover cable][17]. - -You should also start obsessing _now_ about cable management. If you're not naturally inclined to run cables neatly along the floor molding or the edges of a desk or to bind cables together to keep them orderly, then make it a goal to permanently condition yourself with a phobia of messy cables. You won't understand why this is necessary at first, but the first time you walk into a server room, you will immediately know. - -### Ansible - -[Ansible][18] is configuration management software, and it's a bit of a bridge between sysadmin and DevOps. Sysadmins use Ansible to configure fresh installs of an operating system and to maintain specific states on machines. DevOps uses Ansible to reduce time and effort spent on tooling so that more time and effort gets spent on developing. You should learn Ansible as part of your sysadmin training, with an eye toward the practices of DevOps, because most of what DevOps is pioneering now will end up as part of your workflow in the system administration of the future. - -The good thing about Ansible is that you can start using it now. It's cross-platform, and it scales both up and down. Ansible may be overkill for a single-user computer, but then again, Ansible could change the way you spin up virtual machines, or it could help you synchronize the states of all the computers in your home or [home lab][19]. - -#### Resources - -Read "[How to manage your workstation configuration with Ansible][20]" by Jay LaCroix for the quintessential introduction to get started with Ansible on a casual basis. - -### Break stuff - -Problems arise on computers because of user error, buggy software, administrator (that's you!) error, and any number of other factors. There's no way to predict what's going to fail or why, so part of your personal sysadmin training regime should be to poke at the systems you set up until they fail. The worse you are to your own lab infrastructure, the more likely you are to find weak points. And the more often you repair those weak spots, the more confident you become in your problem-solving skills. - -Aside from the rigors of setting up all the usual software and hardware, your primary job as a sysadmin is to find solutions. There will be times when you encounter a problem outside your job description, and it may not even be possible for you to fix it, but it'll be up to you to find a workaround. - -The more you break stuff now and work to fix it, the better prepared you will be to work as a sysadmin. - -* * * - -Are you a working sysadmin? Are there tasks you wish you'd prepared better for? Add them in the comments below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/be-a-sysadmin - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/kimvila -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) -[2]: https://opensource.com/article/19/6/kubernetes-dump-truck -[3]: https://www.redhat.com/sysadmin/yaml-tips -[4]: https://opensource.com/article/19/6/how-ssh-running-container -[5]: https://opensource.com/resources/what-are-linux-containers -[6]: https://opensource.com/article/18/11/behind-scenes-linux-containers -[7]: https://opensource.com/article/18/7/admin-guide-bash -[8]: https://opensource.com/article/19/6/linux-distros-to-try -[9]: https://opensource.com/tags/bash -[10]: https://www.redhat.com/sysadmin/managing-files-linux-terminal -[11]: http://overthewire.org/wargames/bandit -[12]: https://opensource.com/article/19/6/understanding-linux-permissions -[13]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd -[14]: https://opensource.com/article/18/2/how-configure-apache-web-server -[15]: https://opensource.com/article/18/3/configuring-multiple-web-sites-apache -[16]: https://opensource.com/article/18/7/sysadmin-guide-networking-commands -[17]: https://en.wikipedia.org/wiki/Ethernet_crossover_cable -[18]: https://opensource.com/sitewide-search?search_api_views_fulltext=ansible -[19]: https://opensource.com/article/19/6/create-centos-homelab-hour -[20]: https://opensource.com/article/18/3/manage-workstation-ansible diff --git a/sources/tech/20191007 7 Java tips for new developers.md b/sources/tech/20191007 7 Java tips for new developers.md deleted file mode 100644 index 8ad9a70f8a..0000000000 --- a/sources/tech/20191007 7 Java tips for new developers.md +++ /dev/null @@ -1,222 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 Java tips for new developers) -[#]: via: (https://opensource.com/article/19/10/java-basics) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -7 Java tips for new developers -====== -If you're just getting started with Java programming, here are seven -basics you need to know. -![Coffee and laptop][1] - -Java is a versatile programming language used, in some way, in nearly every industry that touches a computer. Java's greatest power is that it runs in a Java Virtual Machine (JVM), a layer that translates Java code into bytecode compatible with your operating system. As long as a JVM exists for your operating system, whether that OS is on a server (or [serverless][2], for that matter), desktop, laptop, mobile device, or embedded device, then a Java application can run on it. - -This makes Java a popular language for both programmers and users. Programmers know that they only have to write one version of their software to end up with an application that runs on any platform, and users know that an application will run on their computer regardless of what operating system they use. - -Many languages and frameworks are cross-platform, but none deliver the same level of abstraction. With Java, you target the JVM, not the OS. For programmers, that's the path of least resistance when faced with several programming challenges, but it's only useful if you know how to program Java. If you're just getting started with Java programming, here are seven basic tips you need to know. - -But first, if you're not sure whether you have Java installed, you can find out in a terminal (such as [Bash][3] or [PowerShell][4]) by running: - - -``` -$ java --version -openjdk 12.0.2 2019-07-16 -OpenJDK Runtime Environment 19.3 (build 12.0.2+9) -OpenJDK 64-Bit Server VM 19.3 (build 12.0.2+9, mixed mode, sharing) -``` - -If you get an error or nothing in return, then you should install the [Java Development Kit][5] (JDK) to get started with Java development. Or install a Java Runtime Environment ****(JRE) if you just need to run Java applications. - -### 1\. Java packages - -In Java, related classes are grouped into a _package_. The basic Java libraries you get when you download the JDK are grouped into packages starting with **java** or **javax**. Packages serve a similar function as folders on your computer: they provide structure and definition for related elements (in programming terminology, a _namespace_). Additional packages can be obtained from independent coders, open source projects, and commercial vendors, just as libraries can be obtained for any programming language. - -When you write a Java program, you should declare a package name at the top of your code. If you're just writing a simple application to get started with Java, your package name can be as simple as the name of your project. If you're using a Java integrated development environment (IDE), like [Eclipse][6], it generates a sane package name for you when you start a new project. - - -``` -package helloworld; - -/** - * @author seth - * An application written in Java. - */ -``` - -Otherwise, you can determine the name of your package by looking at its path in relation to the broad definition of your project. For instance, if you're writing a set of classes to assist in game development and the collection is called **jgamer**, then you might have several unique classes within it. - - -``` -package jgamer.avatar; - -/** - * @author seth - * An imaginary game library. - */ -``` - -The top level of your package is **jgamer**, and each package inside it is a descendant, such as **jgamer.avatar** and **jgamer.score** and so on. In your filesystem, the structure reflects this, with **jgamer** being the top directory containing the files **avatar.java** and **score.java**. - -### 2\. Java imports - -The most fun you'll ever have as a polyglot programmer is trying to keep track of whether you **include**, **import**, **use**, **require**, or **some other term** a library in whatever programming language you're writing in. Java, for the record, uses the **import** keyword when importing libraries needed for your code. - - -``` -package helloworld; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -/** - * @author seth - * A GUI hello world. - */ -``` - -Imports work based on an environment's Java path. If Java doesn't know where Java libraries are stored on a system, then an import cannot be successful. As long as a library is stored in a system's Java path, then an import can succeed, and a library can be used to build and run a Java application. - -If a library is not expected to be in the Java path (because, for instance, you are writing the library yourself), then the library can be bundled with your application (license permitting) so that the import works as expected. - -### 3\. Java classes - -A Java class is declared with the keywords **public class** along with a unique class name mirroring its file name. For example, in a file **Hello.java** in project **helloworld**: - - -``` -package helloworld; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -/** - * @author seth - * A GUI hello world. - */ - -public class Hello { -        // this is an empty class -} -``` - -You can declare variables and functions inside a class. In Java, variables within a class are called _fields_. - -### 4\. Java methods - -Java methods are, essentially, functions within an object. They are defined as being **public** (meaning they can be accessed by any other class) or **private** (limiting their use) based on the expected type of returned data, such as **void**, **int**, **float**, and so on. - - -``` -    public void helloPrompt([ActionEvent][7] event) { -        [String][8] salutation = "Hello %s"; -  -        string helloMessage = "World"; -        message = [String][8].format(salutation, helloMessage); -        [JOptionPane][9].showMessageDialog(this, message); -    } -  -    private int someNumber (x) { -        return x*2; -    } -``` - -When calling a method directly, it is referenced by its class and method name. For instance, **Hello.someNumber** refers to the **someNumber** method in the **Hello** class. - -### 5\. Static - -The **static** keyword in Java makes a member in your code accessible independently of the object that contains it. - -In object-oriented programming, you write code that serves as a template for "objects" that get spawned as the application runs. You don't code a specific window, for instance, but an _instance_ of a window based upon a window class in Java (and modified by your code). Since nothing you are coding "exists" until the application generates an instance of it, most methods and variables (and even nested classes) cannot be used until the object they depend upon has been created. - -However, sometimes you need to access or use data in an object before it is created by the application (for example, an application can't generate a red ball without first knowing that the ball is meant to be red). For those cases, there's the **static** keyword. - -### 6\. Try and catch - -Java is excellent at catching errors, but it can only recover gracefully if you tell it what to do. The cascading hierarchy of attempting to perform an action in Java starts with **try**, falls back to **catch**, and ends with **finally**. Should the **try** clause fail, then **catch** is invoked, and in the end, there's always **finally** to perform some sensible action regardless of the results. Here's an example: - - -``` -try { -        cmd = parser.parse(opt, args);  -        -        if(cmd.hasOption("help")) { -                HelpFormatter helper = new HelpFormatter(); -                helper.printHelp("Hello <options>", opt); -                [System][10].exit(0); -                } -        else { -                if(cmd.hasOption("shell") || cmd.hasOption("s")) { -                [String][8] target = cmd.getOptionValue("tgt"); -                } // else -        } // fi -} catch ([ParseException][11] err) { -        [System][10].out.println(err); -        [System][10].exit(1); -        } //catch -        finally { -                new Hello().helloWorld(opt); -        } //finally -} //try -``` - -It's a robust system that attempts to avoid irrecoverable errors or, at least, to provide you with the option to give useful feedback to the user. Use it often, and your users will thank you! - -### 7\. Running a Java application - -Java files, usually ending in **.java**, theoretically can be run with the **java** command. If an application is complex, however, whether running a single file results in anything meaningful is another question. - -To run a **.java** file directly: - - -``` -`$ java ./Hello.java` -``` - -Usually, Java applications are distributed as Java Archives (JAR) files, ending in **.jar**. A JAR file contains a manifest file specifying the main class, some metadata about the project structure, and all the parts of your code required to run the application. - -To run a JAR file, you may be able to double-click its icon (depending on how you have your OS set up), or you can launch it from a terminal: - - -``` -`$ java -jar ./Hello.jar` -``` - -### Java for everyone - -Java is a powerful language, and thanks to the [OpenJDK][12] project and other initiatives, it's an open specification that allows projects like [IcedTea][13], [Dalvik][14], and [Kotlin][15] to thrive. Learning Java is a great way to prepare to work in a wide variety of industries, and what's more, there are plenty of [great reasons to use it][16]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/java-basics - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) -[2]: https://www.redhat.com/en/resources/building-microservices-eap-7-reference-architecture -[3]: https://www.gnu.org/software/bash/ -[4]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 -[5]: http://openjdk.java.net/ -[6]: http://www.eclipse.org/ -[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent -[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+joptionpane -[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+parseexception -[12]: https://openjdk.java.net/ -[13]: https://icedtea.classpath.org/wiki/Main_Page -[14]: https://source.android.com/devices/tech/dalvik/ -[15]: https://kotlinlang.org/ -[16]: https://opensource.com/article/19/9/why-i-use-java diff --git a/sources/tech/20191007 Understanding Joins in Hadoop.md b/sources/tech/20191007 Understanding Joins in Hadoop.md index ea0025a9d2..4c34ed896c 100644 --- a/sources/tech/20191007 Understanding Joins in Hadoop.md +++ b/sources/tech/20191007 Understanding Joins in Hadoop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (heguangzhi) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md index 3b6fc7ca78..b89ef375d2 100644 --- a/sources/tech/20191017 Using multitail on Linux.md +++ b/sources/tech/20191017 Using multitail on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (wenwensnow) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md index f1d2b48d0d..e915fe74d9 100644 --- a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md +++ b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (warmfrog) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191107 Demystifying Kubernetes.md b/sources/tech/20191107 Demystifying Kubernetes.md deleted file mode 100644 index ad3260b0b3..0000000000 --- a/sources/tech/20191107 Demystifying Kubernetes.md +++ /dev/null @@ -1,236 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Demystifying Kubernetes) -[#]: via: (https://opensourceforu.com/2019/11/demystifying-kubernetes/) -[#]: author: (Abhinav Nath Gupta https://opensourceforu.com/author/abhinav-gupta/) - -Demystifying Kubernetes -====== - -[![][1]][2] - -_Kubernetes is a production grade open source system for automating deployment, scaling, and the management of containerised applications. This article is about managing containers with Kubernetes._ - -‘Containers’ has become one of the latest buzz words. But what does the term imply? Often associated with Docker, a container is defined as a standardised unit of software. Containers encapsulate the software and the environment required to run the software into a single unit that is easily shippable. -A container is a standard unit of software that packages the code and all its dependencies so that the application runs quickly and reliably from one computing environment to another. The container does this by creating something called an image, which is akin to an ISO image. A container image is a lightweight, standalone, executable package of software that includes everything needed to run an application — code, runtime, system tools, system libraries and settings. - -Container images become containers at runtime and, in the case of Docker containers, images become containers when they run on a Docker engine. Containers isolate software from the environment and ensure that it works uniformly despite differences in instances across environments. - -**What is container management?** -Container management is the process of organising, adding or replacing large numbers of software containers. Container management uses software to automate the process of creating, deploying and scaling containers. This gives rise to the need for container orchestration—a tool that automates the deployment, management, scaling, networking and availability of container based applications. - -**Kubernetes** -Kubernetes is a portable, extensible, open source platform for managing containerised workloads and services, and it facilitates both configuration and automation. It was originally developed by Google. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available. - -Google open sourced the Kubernetes project in 2014. Kubernetes builds upon a decade and a half of experience that Google had with running production workloads at scale, combined with best-of-breed ideas and practices from the community, as well as the usage of declarative syntax. - -Some of the common terminologies associated with the Kubernetes ecosystem are listed below. -_**Pods:**_ A pod is the basic execution unit of a Kubernetes application – the smallest and simplest unit in the Kubernetes object model that you create or deploy. A pod represents processes running on a Kubernetes cluster. - -A pod encapsulates the running container, storage, network IP (unique) and commands that govern how the container should run. It represents the single unit of deployment within the Kubernetes ecosystem, a single instance of an application which might consist of one or many containers running with tight coupling and shared resources. - -Pods in a Kubernetes cluster can be used in two main ways. The first is pods that run a single container. The ‘one-container-per-pod’ model is the most common Kubernetes use case. The second method involves pods that run multiple containers that need to work together. - -A pod might encapsulate an application composed of multiple co-located containers that are tightly coupled and need to share resources. - -_**ReplicaSet:**_ The purpose of a ReplicaSet is to maintain a stable set of replica pods running at any given time. A ReplicaSet contains information about how many copies of a particular pod should be running. To create multiple pods to match the ReplicaSet criteria, Kubernetes uses the pod template. The link a ReplicaSet has to its pods is via the latter’s metadata.ownerReferences field, which specifies which resource owns the current object. - -_**Services:**_ Services are an abstraction to expose the functionality of a set of pods. With Kubernetes, you don’t need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives pods their own IP addresses and a single DNS name for a set of pods, and can load-balance across them. - -One major problem that services solve is the integration of the front-end and back-end of a Web application. Since Kubernetes provides IP addresses behind the scenes to pods, when the latter are killed and resurrected, the IP addresses are changed. This creates a big problem on the front-end side to connect a given back-end IP address to the corresponding front-end IP address. Services solve this problem by providing an abstraction over the pods — something akin to a load balancer. - -_**Volumes:**_ A Kubernetes volume has an explicit lifetime — the same as the pod that encloses it. Consequently, a volume outlives any container that runs within the pod and the data is preserved across container restarts. Of course, when a pod ceases to exist, the volume will cease to exist, too. Perhaps more important than this is that Kubernetes supports many types of volumes, and a pod can use any number of them simultaneously. - -At its core, a volume is just a directory, possibly with some data in it, which is accessible to the containers in a pod. How that directory comes to be, the medium that backs it and its contents are determined by the particular volume type used. - -**Why Kubernetes?** -Containers are a good way to bundle and run applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if one container goes down, another needs to start. Wouldn’t it be nice if this could be automated by a system? -That’s where Kubernetes comes to the rescue! It provides a framework to run distributed systems resiliently. It takes care of scaling requirements, failover, deployment patterns, and more. For example, Kubernetes can easily manage a canary deployment for your system. - -Kubernetes provides users with: -1\. Service discovery and load balancing -2\. Storage orchestration -3\. Automated roll-outs and roll-backs -4\. Automatic bin packing -5\. Self-healing -6\. Secret and configuration management - -**What can Kubernetes do?** -In this section we will look at some code examples of how to use Kubernetes when building a Web application from scratch. We will create a simple back-end server using Flask in Python. -There are a few prerequisites for those who want to build a Web app from scratch. These are: -1\. Basic understanding of Docker, Docker containers and Docker images. A quick refresher can be found at __. -2\. Docker should be installed in the system. -3\. Kubernetes should be installed in the system. Instructions on how to do so on a local machine can be found at __. -Now, create a simple directory, as shown in the code snippet below: - -``` -mkdir flask-kubernetes/app && cd flask-kubernetes/app -``` - -Next, inside the _flask-kubernetes/app_ directory, create a file called main.py, as shown in the code snippet below: - -``` -touch main.py -``` - -In the newly created _main.py,_ paste the following code: - -``` -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): -return "Hello from Kubernetes!" - -if __name__ == "__main__": -app.run(host='0.0.0.0') -``` - -Install Flask in your local using the command below: - -``` -pip install Flask==0.10.1 -``` - -After installing Flask, run the following command: - -``` -python app.py -``` - -This should run the Flask server locally on port 5000, which is the default port for the Flask app, and you can see the output ‘Hello from Kubernetes!’ on *. -Once the server is running locally, we will create a Docker image to be used by Kubernetes. -Create a file with the name Dockerfile and paste the following code snippet in it: - -``` -FROM python:3.7 - -RUN mkdir /app -WORKDIR /app -ADD . /app/ -RUN pip install -r requirements.txt - -EXPOSE 5000 -CMD ["python", "/app/main.py"] -``` - -The instructions in _Dockerfile_ are explained below: - -1\. Docker will fetch the Python 3.7 image from the Docker hub. -2\. It will create an app directory in the image. -3\. It will set an app as the working directory. -4\. Copy the contents from the app directory in the host to the image app directory. -5\. Expose Port 5000. -6\. Finally, it will run the command to start the Flask server. -In the next step, we will create the Docker image, using the command given below: - -``` -docker build -f Dockerfile -t flask-kubernetes:latest . -``` - -After creating the Docker image, we can test it by running it locally using the following command: - -``` -docker run -p 5001:5000 flask-kubernetes -``` - -Once we are done testing it locally by running a container, we need to deploy this in Kubernetes. -We will first verify that Kubernetes is running using the _kubectl_ command. If there are no errors, then it is working. If there are errors, do refer to __. - -Next, let’s create a deployment file. This is a yaml file containing the instruction for Kubernetes about how to create pods and services in a very declarative fashion. Since we have a Flask Web application, we will create a _deployment.yaml_ file with both the pods and services declarations inside it. - -Create a file named deployment.yaml and add the following contents to it, before saving it: - -``` -apiVersion: v1 -kind: Service -metadata: -name: flask-kubernetes -service -spec: -selector: -app: flask-kubernetes -ports: -- protocol: "TCP" -port: 6000 -targetPort: 5000 -type: LoadBalancer - - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: -name: flask-kubernetes -spec: -replicas: 4 -template: -metadata: -labels: -app: flask-kubernetes -spec: -containers: -- name: flask-kubernetes -image: flask-kubernetes:latest -imagePullPolicy: Never -ports: -- containerPort: 5000 -``` - -Use _kubectl_ to send the _yaml_ file to Kubernetes by running the following command: - -``` -kubectl apply -f deployment.yaml -``` - -You can see the pods are running if you execute the following command: - -``` -kubectl get pods -``` - -Now navigate to __, and you should see the ‘Hello from Kubernetes!’ message. -That’s it! The application is now running in Kubernetes! - -**What Kubernetes cannot do** -Kubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally applicable features common to PaaS offerings, such as deployment, scaling, load balancing, logging, and monitoring. Kubernetes provides the building blocks for developer platforms, but preserves user choice and flexibility where it is important. - - * Kubernetes does not limit the types of applications supported. If an application can run in a container, it should run great on Kubernetes. - * It does not deploy and build source code. - * It does not dictate logging, monitoring, or alerting solutions. - * It does not provide or mandate a configuration language/system. It provides a declarative API for everyone’s use. - * It does not provide or adopt any comprehensive machine configuration, maintenance, management, or self-healing systems. - - - -![Avatar][3] - -[Abhinav Nath Gupta][4] - -The author is a software development engineer at Cleo Software India Pvt Ltd, Bengaluru. He is interested in cryptography, data security, cryptocurrency and cloud computing. He can be reached at [abhi.aec89@gmail.com][5]. - -[![][6]][7] - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ - -作者:[Abhinav Nath Gupta][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/abhinav-gupta/ -[b]: https://github.com/lujun9972 -[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?resize=696%2C457&ssl=1 (Gear kubernetes) -[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?fit=800%2C525&ssl=1 -[3]: https://secure.gravatar.com/avatar/f65917facf5f28936663731fedf545c4?s=100&r=g -[4]: https://opensourceforu.com/author/abhinav-gupta/ -[5]: mailto:abhi.aec89@gmail.com -[6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png -[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US diff --git a/sources/tech/20191111 A guide to intermediate awk scripting.md b/sources/tech/20191111 A guide to intermediate awk scripting.md index 7c1000736c..7e788b2adc 100644 --- a/sources/tech/20191111 A guide to intermediate awk scripting.md +++ b/sources/tech/20191111 A guide to intermediate awk scripting.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -129,7 +129,7 @@ via: https://opensource.com/article/19/11/intermediate-awk-scripting 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md b/sources/tech/20191113 Edit images on Fedora easily with GIMP.md deleted file mode 100644 index c45813d7cb..0000000000 --- a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Edit images on Fedora easily with GIMP) -[#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) -[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) - -Edit images on Fedora easily with GIMP -====== - -![][1] - -GIMP (short for GNU Image Manipulation Program) is free and open-source image manipulation software. With many capabilities ranging from simple image editing to complex filters, scripting and even animation, it is a good alternative to popular commercial options. - -Read on to learn how to install and use GIMP on Fedora. This article covers basic daily image editing. - -### Installing GIMP - -GIMP is available in the official Fedora repository. To install it run: - -``` -sudo dnf install gimp -``` - -### Single window mode - -Once you open the application, it shows you the dark theme window with toolbox and the main editing area. Note that it has two window modes that you can switch between by selecting _Windows_ -> _Single Window Mode_. By checking this option all components of the UI are displayed in a single window. Otherwise, they will be separate. - -### Loading an image - -![][2] - -To load an image, go to _File_ -> _Open_ and choose your file and choose your image file. - -### Resizing an image - -To resize the image, you have the option to resize based on a couple of parameters, including pixel and percentage — the two parameters which are often handy in editing images. - -Let’s say we need to scale down the Fedora 30 background image to 75% of its current size. To do that, select _Image_ -> _Scale_ and then on the scale dialog, select percentage in the unit drop down. Next, enter _75_ as width or height and press the **Tab** key. By default, the other dimension will automatically resize in correspondence with the changed dimension to preserve aspect ratio. For now, leave other options unchanged and press Scale. - -![][3] - -The image scales to 0.75 percent of its original size. - -### Rotating images - -Rotating is a transform operation, so you find it under _Image_ -> _Transform_ from the main menu, where there are options to rotate the image by 90 or 180 degrees. There are also options for flipping the image vertically or horizontally under the mentioned option. - -Let’s say we need to rotate the image 90 degrees. After applying a 90-degree clockwise rotation and horizontal flip, our image will look like this: - -![Transforming an image with GIMP][4] - -### Adding text - -Adding text is very easy. Just select the A icon from the toolbox, and click on a point on your image where you want to add the text. If the toolbox is not visible, open it from Windows->New Toolbox. - -As you edit the text, you might notice that the text dialog has font customization options including font family, font size, etc. - -![Adding text to image in GIMP][5] - -### Saving and exporting - -You can save your edit as as a GIMP project with the _xcf_ extension from _File_ -> _Save_ or by pressing **Ctrl+S**. Or you can export your image in formats such as PNG or JPEG. To export, go to _File_ -> _Export As_ or hit **Ctrl+Shift+E** and you will be presented with a dialog where you can select the output image and name. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/ - -作者:[Mehdi Haghgoo][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/powergame/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/gimp-magazine-816x346.jpg -[2]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-00-44-300x165.png -[3]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-17-33-300x262.png -[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-41-28-300x243.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-47-54-300x237.png diff --git a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md deleted file mode 100644 index 094218c6c4..0000000000 --- a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md +++ /dev/null @@ -1,160 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8) -[#]: via: (https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8 -====== - -**VirtualBox** is a free and open source **virtualization tool** which allows techies to run multiple virtual machines of different flavor at the same time. It is generally used at desktop level (Linux and Windows), it becomes very handy when someone try to explore the features of new Linux distribution or want to install software like **OpenStack**, **Ansible** and **Puppet** in one VM, so in such scenarios one can launch a VM using VirtualBox. - -VirtualBox is categorized as **type 2 hypervisor** which means it requires an existing operating system, on top of which VirtualBox software will be installed. VirtualBox provides features to create our own custom host only network and NAT network. In this article we will demonstrate how to install latest version of VirtualBox 6.0 on CentOS 8 and RHEL 8 System and will also demonstrate on how to install VirtualBox Extensions. - -### Installation steps of VirtualBox 6.0 on CentOS 8 / RHEL 8 - -#### Step:1) Enable VirtualBox and EPEL Repository - -Login to your CentOS 8 or RHEL 8 system and open terminal and execute the following commands to enable VirtualBox and EPEL package repository. - -``` -[root@linuxtechi ~]# dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -``` - -Use below rpm command to import Oracle VirtualBox Public Key - -``` -[root@linuxtechi ~]# rpm --import https://www.virtualbox.org/download/oracle_vbox.asc -``` - -Enable EPEL repo using following dnf command, - -``` -[root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y -``` - -#### Step:2) Install VirtualBox Build tools and dependencies - -Run the following command to install all VirtualBox build tools and dependencies, - -``` -[root@linuxtechi ~]# dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y -``` - -Once above dependencies and build tools are installed successfully then proceed with VirtualBox installation using dnf command, - -#### Step:3) Install VirtualBox 6.0 on CentOS 8 / RHEL 8 - -If wish to list available versions of VirtualBox before installing it , then execute the following [dnf command][1], - -``` -[root@linuxtechi ~]# dnf search virtualbox -Last metadata expiration check: 0:14:36 ago on Sun 17 Nov 2019 04:13:16 AM GMT. -=============== Summary & Name Matched: virtualbox ===================== -VirtualBox-5.2.x86_64 : Oracle VM VirtualBox -VirtualBox-6.0.x86_64 : Oracle VM VirtualBox -[root@linuxtechi ~]# -``` - -Let’s install latest version of VirtualBox 6.0 using following dnf command, - -``` -[root@linuxtechi ~]# dnf install VirtualBox-6.0 -y -``` - -If any local user want to attach usb device to VirtualBox VMs then he/she should be part “**vboxuser**s ” group, use the beneath usermod command to add local user to “vboxusers” group. - -``` -[root@linuxtechi ~]# usermod -aG vboxusers pkumar -``` - -#### Step:4) Access VirtualBox on CentOS 8 / RHEL 8 - -There are two ways to access VirtualBox, from the command line type “**virtualbox**” then hit enter - -``` -[root@linuxtechi ~]# virtualbox -``` - -From Desktop environment, Search “VirtualBox” from Search Dash. - -[![Access-VirtualBox-CentOS8][2]][3] - -Click on VirtualBox icon, - -[![VirtualBox-CentOS8][2]][4] - -This confirms that VirtualBox 6.0 has been installed successfully, let’s install its extension pack. - -#### Step:5) Install VirtualBox 6.0 Extension Pack - -As the name suggests, VirtualBox extension pack is used to extend the functionality of VirtualBox. It adds the following features: - - * USB 2.0 & USB 3.0 support - * Virtual RDP (VRDP) - * Disk Image Encryption - * Intel PXE Boot - * Host WebCam - - - -Use below wget command to download virtualbox extension pack under download folder, - -``` -[root@linuxtechi ~]$ cd Downloads/ -[root@linuxtechi Downloads]$ wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack -``` - -Once it is downloaded, access VirtualBox and navigate **File** –>**Preferences** –> **Extension** then click on + icon to add downloaded extension pack, - -[![Install-VirtualBox-Extension-Pack-CentOS8][2]][5] - -Click on “Install” to start the installation of extension pack. - -[![Accept-VirtualBox-Extension-Pack-License-CentOS8][2]][6] - -Click on “I Agree” to accept VirtualBox Extension Pack License. - -After successful installation of VirtualBox extension pack, we will get following screen, Click on Ok and start using VirtualBox. - -[![VirtualBox-Extension-Pack-Install-Message-CentOS8][2]][7] - -That’s all from this article, I hope these steps help you install VirtualBox 6.0 on your CentOS 8 and RHEL 8 system. Please do share your valuable feedback and comments. - -**Also Read**: **[How to Manage Oracle VirtualBox Virtual Machines from Command Line][8]** - - * [Facebook][9] - * [Twitter][10] - * [LinkedIn][11] - * [Reddit][12] - - - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/ - -作者:[Pradeep Kumar][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linuxtechi.com/author/pradeep/ -[b]: https://github.com/lujun9972 -[1]: https://www.linuxtechi.com/dnf-command-examples-rpm-management-fedora-linux/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Access-VirtualBox-CentOS8.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-CentOS8.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-VirtualBox-Extension-Pack-CentOS8.jpg -[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Accept-VirtualBox-Extension-Pack-License-CentOS8.jpg -[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-Extension-Pack-Install-Message-CentOS8.jpg -[8]: https://www.linuxtechi.com/manage-virtualbox-virtual-machines-command-line/ -[9]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&t=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 -[10]: http://twitter.com/share?text=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&via=Linuxtechi -[11]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 -[12]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 diff --git a/sources/tech/20191119 How to use pkgsrc on Linux.md b/sources/tech/20191119 How to use pkgsrc on Linux.md deleted file mode 100644 index 86476df073..0000000000 --- a/sources/tech/20191119 How to use pkgsrc on Linux.md +++ /dev/null @@ -1,226 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use pkgsrc on Linux) -[#]: via: (https://opensource.com/article/19/11/pkgsrc-netbsd-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to use pkgsrc on Linux -====== -NetBSD's package manager is generic, flexible, and easy. Here's how to -use it. -![A person programming][1] - -NetBSD is famous for running on basically anything, but did you know its _second_ claim to fame is the **[pkgsrc][2]** package manager? Like NetBSD, pkgsrc runs on basically anything, or at least anything Unix and Unix-like. You can install pkgsrc on BSD, Linux, Illumos, Solaris, and Mac. All told, over 20 operating systems are supported. - -### Why use pkgsrc? - -With the exception of MacOS, all Unix operating systems ship with a package manager included. You don't necessarily _need_ pkgsrc, but here are three great reasons you may want to try it: - - * **Packaging.** If you're curious about packaging but have yet to try creating a package yourself, pkgsrc is a relatively simple system to use, especially if you're already familiar with Makefiles and build systems like [GNU Autotools][3]. - * **Generic.** If you use multiple operating systems or distributions, then you probably encounter a package manager for each system. You can use pkgsrc across disparate systems so that when you package an application for one, you've packaged it for all of them. - * **Flexible.** In many packaging systems, it's not always obvious how to choose a binary package or a source package. With pkgsrc, the distinction is clear, both methods of installing are equally as easy, and both resolve dependencies for you. - - - -### How to install pkgsrc - -Whether you're on BSD, Linux, Illumos, Solaris, or MacOS, the installation process is basically the same: - - 1. Use CVS to check out the pkgsrc tree - 2. Bootstrap the pkgsrc system - 3. Install packages - - - -#### Use CVS to check out the pkgsrc tree - -Before Git, before Subversion, there was **[CVS][4]**. You don't have to know much about CVS to do a checkout of its code—if you're used to Git, then think of _checkout_ as _clone_. When you perform a CVS checkout of pkgsrc, you're downloading "recipes" detailing how each package is to be built. It's a lot of files, but they're small because you're not actually pulling the source code for each package, just the build infrastructure and Makefiles required to build on it demand. Using CVS makes it easy for you to update your pkgsrc checkout when a new one is released. - -The pkgsrc docs recommend keeping your tree in the **/usr** directory, so you must use **sudo** (or become root) to use this command: - - -``` -$ cd /usr -$ sudo cvs -q -z2 \ -  -d [anoncvs@anoncvs.NetBSD.org][5]:/cvsroot \ -  checkout -r pkgsrc-2019Q3 -P pkgsrc -``` - -As I'm writing, the latest release is 2019Q3. Check the news section of [pkgsrc.org][6]'s homepage or the [NetBSD documentation][7] to determine the latest release version. - -#### Bootstrap pkgsrc - -After the pkgsrc tree has copied to your computer, you have a **/usr/pkgsrc** directory filled with build scripts. Before you can use them, you must bootstrap pkgsrc so that you have easy access to the relevant commands you need to build and install the software. - -The way you bootstrap **pkgsrc** depends on the OS you're on. - -For NetBSD, you can just use the bundled bootstrapper: - - -``` -# cd pkgsrc/bootstrap -# ./bootstrap -``` - -On other systems, there are better ways with some customized features included, provided by Joyent. To find out the exact command to run, visit [pkgsrc.joyent.com][8]. For example, on Linux (Fedora, Debian, Slackware, and so on): - - -``` -$ curl -O \ -  -$ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" -``` - -Even though the path suggests that the included files are for RHEL 7, the binaries tend to be compatible with all but the most cutting-edge Linux distributions. And should you find a binary incompatible with the distribution you're on, you have the option to build from source. - -Verify the SHA1 checksum: - - -``` -$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum -sha1sum -c check-shasum -``` - -You can also verify the PGP signature: - - -``` -$ curl -O \ - -curl -sS | gpg --import -gpg --verify ${BOOTSTRAP_TAR}{.asc,} -``` - -Once you're confident that you have the right bootstrap kit, install it to **/usr/pkg**: - - -``` -`sudo tar -zxpf ${BOOTSTRAP_TAR} -C /` -``` - -This provides you with the usual pkgsrc commands. Add these locations to [your PATH][9]: - - -``` -$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc -$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc -``` - -If you'd rather use pkgsrc without relying on Joyent's builds, you can just run the **bootstrap** script you got with the pkgsrc tree. Read the relevant README file in the **bootstrap** directory before running it for important system-specific notes. - -![Bootstrapping pkgsrc on NetBSD][10] - -### How to install software with pkgsrc - -Installing a precompiled binary (as you would with DNF or Apt) with pkgsrc is easy. The command for binary installs is **pgkin**, which has its own dedicated site at [pkgin.net][11]. The process ought to feel pretty familiar to anyone who's used Linux. - -To search for the **tmux** package: - - -``` -`$ pkgin search tmux` -``` - -To install the tmux package: - - -``` -`$ sudo pkgin install tmux` -``` - -The **pkgin** command's aim is to mimic the behavior of typical Linux package managers, so there are options to list available packages, to query available packages to find what provides a specific executable, and so on. - -### How to build from source code with pkgsrc - -The real power of pkgsrc, though, is the ease of building a package from source. You downloaded all 20,000+ build scripts in the first setup step, and you can access those by navigating into your pkgsrc tree directly. - -For example, to build **tcsh** from source, first, locate the build script: - - -``` -$ find /usr/pkgsrc -type d -name "tcsh" -/usr/pkgsrc/shells/tcsh -``` - -Next, change into the source directory: - - -``` -`$ cd /usr/pgksrc/shells/tcsh` -``` - -The build script directory contains a number of files to help the application build on your system, but notably, it contains the **DESCR** file, which contains a description of the software, as well as the **Makefile** that triggers the build. - - -``` -$ ls -CVS    DESCR     Makefile -PLIST  distinfo  patches -$ cat DESCR -TCSH is an extended C-shell with many useful features like -filename completion, history editing, etc. -$ -``` - -When you're ready, build, and install: - - -``` -`$ sudo bmake install` -``` - -The pkgsrc system uses the **bmake** command (provided by the pkgsrc checkout in the first step), so be sure to use **bmake** (and not **make** out of habit). - -If you're building for several systems, you can create a package instead of installing right away: - - -``` -$ cd /usr/pgksrc/shells/tcsh -$ sudo bmake package -[...] -=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz -``` - -The packages that pkgsrc creates are standard tarballs, but they can be installed conveniently with **pkg_add**: - - -``` -$ sudo pkg_add /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz -tcsh-X.Y.Z: adding /usr/pkg/bin/tcsh to /etc/shells -$ tcsh -localhost% -``` - -The **pkgtools** collection from pkgsrc provides the **pkg_add**, **pkg_info**, **pkg_admin**, **pkg_create**, and **pkg_delete** commands to help manage packages you build and maintain on your system. - -### Pkgsrc for easy management - -The pkgsrc system offers a direct, hands-on approach to package management. If you're looking for a package manager that stays out of your way and invites customization, give pkgsrc a try on whatever Unix or Unix-like OS you're running. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/pkgsrc-netbsd-linux - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) -[2]: http://pkgsrc.org -[3]: https://opensource.com/article/19/7/introduction-gnu-autotools -[4]: http://www.netbsd.org/developers/cvs-repos/cvs_intro.html#intro -[5]: mailto:anoncvs@anoncvs.NetBSD.org -[6]: http://pkgsrc.org/ -[7]: http://www.netbsd.org/docs/pkgsrc/getting.html -[8]: http://pkgsrc.joyent.com/ -[9]: https://opensource.com/article/17/6/set-path-linux -[10]: https://opensource.com/sites/default/files/uploads/pkgsrc-bootstrap.jpg (Bootstrapping pkgsrc on NetBSD) -[11]: http://pkgin.net diff --git a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md deleted file mode 100644 index d074cd4dd9..0000000000 --- a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md +++ /dev/null @@ -1,150 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) -[#]: via: (https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/) -[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) - -How to Use TimeShift to Backup and Restore Ubuntu Linux -====== - -Have you ever wondered how you can backup and restore your **Ubuntu** or **Debian system** ? **Timeshift** is a free and opensource tool that allows you to create incremental snapshots of your filesystem. You can create a snapshot using either **RSYNC** or **BTRFS**. - -[![TimeShift-Backup-Restore-Tool-Ubuntu][1]][2] - -With that. let’s delve in and install Timeshift. For this tutorial, we shall install on Ubuntu 18.04 LTS system. - -### Installing TimeShift on Ubuntu / Debian Linux - -TimeShift is not hosted officially on Ubuntu and Debian repositories. With that in mind, we are going to run the command below to add the PPA: - -``` -# add-apt-repository -y ppa:teejee2008/ppa -``` - -![Add-timeshift-repository][1] - -Next, update the system packages with the command: - -``` -# apt update -``` - -After a successful system update, install timeshift by running following apt command : - -``` -# apt install timeshift -``` - -![apt-install-timeshift][1] - -### Preparing a backup storage device - -Best practice demands that we save the system snapshot on a separate storage volume, aside from the system’s hard drive. For this guide, we are using a 16 GB flash drive as the secondary drive on which we are going to save the snapshot. - -``` -# lsblk | grep sdb -``` - -![lsblk-sdb-ubuntu][1] - -For the flash drive to be used as a backup location for the snapshot, we need to create a partition table on the device. Run the following commands: - -``` -# parted /dev/sdb mklabel gpt -# parted /dev/sdb mkpart primary 0% 100% -# mkfs.ext4 /dev/sdb1 -``` - -![create-partition-table-on-drive-ubuntu][1] - -After creating a partition table on the USB flash drive, we are all set to begin creating filesystem’s snapshots! - -### Using Timeshift to create snapshots - -To launch Timeshift, use the application menu to search for the  Timeshift application. - -![Access-Timeshift-Ubuntu][1] - -Click on the Timeshift icon and the system will prompt you for the Administrator’s password. Provide the password and click on Authenticate - -![Authentication-required-ubuntu][1] - -Next, select your preferred snapshot type. - -![Select-Rsync-option-timeshift][1] - -Click ‘**Next**’.  Select the destination drive for the snapshot. In this case, my location is the external USB drive labeled as **/dev/sdb** - -![Select-snapshot location][1] - -Next, define the snapshot levels. Levels refer to the intervals during which the snapshots are created.  You can choose to have either monthly, weekly, daily, or hourly snapshot levels. - -![Select-snapshot-levels-Timeshift][1] - -Click ‘Finish’ - -On the next Window, click on the ‘**Create**’ button to begin creating the snapshot. Thereafter, the system will begin creating the snapshot. - -![Create-snapshot-timeshift][1] - -Finally, your snapshot will be displayed as shown - -![Snapshot-created-TimeShift][1] - -### Restoring Ubuntu / Debian from a snapshot - -Having created a system snapshot, let’s now see how you can restore your system from the same snapshot. On the same Timeshift window, click on the snapshot and click on the ‘**Restore**’ button as shown. - -![Restore-snapshot-timeshift][1] - -Next, you will be prompted to select the target device.  leave the default selection and hit ‘**Next**’. - -![Select-target-device-timeshift][1] - -A dry run will be performed by Timeshift before the restore process commences. - -![Comparing-files-Dry-Run-timeshift][1] - -In the next window, hit the ‘**Next**’  button to confirm actions displayed. - -![Confirm-actions-timeshift][1] - -You’ll get a warning and a disclaimer as shown. Click ‘**Next**’ to initialize the restoration process. - -Thereafter, the restore process will commence and finally, the system will thereafter reboot into an earlier version as defined by the snapshot. - -![Restoring-snapshot-timeshift][1] - -**Conclusion** - -As you have seen it quite easy to use TimeShift to restore your system from a snapshot. It comes in handy when backing up system files and allows you to recover in the event of a system fault. So don’t get scared to tinker with your system or mess up. TimeShift will give you the ability to go back to a point in time when everything was running smoothly. - - * [Facebook][3] - * [Twitter][4] - * [LinkedIn][5] - * [Reddit][6] - - - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ - -作者:[James Kiarie][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linuxtechi.com/author/james/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/TimeShift-Backup-Restore-Tool-Ubuntu.png -[3]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&t=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux -[4]: http://twitter.com/share?text=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&via=Linuxtechi -[5]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux -[6]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux diff --git a/sources/tech/20191120 How to install Java on Linux.md b/sources/tech/20191120 How to install Java on Linux.md deleted file mode 100644 index 6cebd574e4..0000000000 --- a/sources/tech/20191120 How to install Java on Linux.md +++ /dev/null @@ -1,231 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install Java on Linux) -[#]: via: (https://opensource.com/article/19/11/install-java-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to install Java on Linux -====== -Embrace Java applications on your desktop, and run them on all of your -desktops. -![Coffee beans][1] - -No matter what operating system you're running, there are usually several ways to install an application. Sometimes you might find an application in an app store, or you might install it with a package manager like DNF on Fedora or Brew on Mac, and other times, you might download an executable or an installer from a website. Because Java is such a popular backend for so many applications, it's good to understand the different ways you can install it. The good news is that you have many options, and this article covers them all. - -The bad news is that Java is _big_, not so much in size as in scope. Java is an open source language and specification, meaning that anyone can, in theory, create an implementation of it. That means, before you can install anything, you have to decide which Java you want to install. - -### Do I need a JVM or a JRE or a JDK? - -Java is broadly split into two downloadable categories. The **Java Virtual Machine** (JVM) is a runtime component; it's the "engine" that enables Java applications to launch and run on your computer. It's included in the Java Runtime Environment (JRE). - -The **Java Development Kit** (JDK) is a development toolkit: you can think of it as a garage where tinkerers sit around making adjustments, repairs, and improvements. The JDK includes the Java Runtime Environment (JRE). - -In terms of downloads, this translates to: - - * If you're a user looking to run a Java application, you only need the JRE (which includes a JVM). - * If you're a developer looking to program in Java, you need the JDK (which includes JRE libraries, which in turn includes a JVM). - - - -### What's the difference between OpenJDK, IcedTea, and OracleJDK? - -When Sun Microsystems was bought by Oracle, Java was a major part of the sale. Luckily, Java is an open source technology, so if you're not happy with the way Oracle maintains the project, you have other options. Oracle bundles proprietary components with its Java downloads, while the OpenJDK project is fully open source. - -The IcedTea project is essentially OpenJDK, but its goal is to make it easier for users to build and deploy OpenJDK when using fully free and open source tools. - -### Which Java should I install? - -If you feel overwhelmed by the choices, then the easy answer of which Java implementation you should install is whichever is easiest for you to install. When an application tells you that you need Java 12, but your repository only has Java 8, it's fine to install whatever implementation of Java 12 you can find from a reliable source. On Linux, you can have several different versions of Java installed all at once, and they won't interfere with one another. - -If you're a developer who needs to make the choice, then you should consider what components you need. If you opt for Oracle's version, be aware that there are proprietary plugins and fonts in the package, which could [interfere with distributing your application][2]. It's safest to develop on IcedTea or OpenJDK. - -### Install OpenJDK from a repository - -Now that you know your choices, you can search for OpenJDK or IcedTea with your package manager and install the version you need. Some distributions use the keyword **latest** to indicate the most recent version, which is usually what you need to run whatever application you're trying to run. Depending on what package manager you use, you might even consider using **grep** to filter the search results to include only the latest versions. For example, on Fedora: - - -``` -$ sudo dnf search openjdk | \ -grep latest | cut -f1 -d':' - -java-latest-openjdk-demo.x86_64 -java-openjdk.i686 -java-openjdk.x86_64 -java-latest-openjdk-jmods.x86_64 -java-latest-openjdk-src.x86_64 -java-latest-openjdk.x86_64 -[...] -``` - -Only if the application you're trying to run insists that you need a legacy version of Java should you look past the **latest** release. - -Install Java on Fedora or similar with: - - -``` -`$ sudo dnf install java-latest-openjdk` -``` - -If your distribution doesn't use the **latest** tag, it may use another keyword, such as **default**. Here's a search for OpenJDK on Debian: - - -``` -$ sudo apt search openjdk | less -default-jdk -  Standard Java development kit - -default-jre -  Standard Java runtime - -openjdk-11-jdk -  OpenJDK development kit (JDK) - -[...] -``` - -In this case, the **default-jre** package is appropriate for users, and the **default-jdk** is suitable for developers. - -For example, to install the JRE on Debian: - - -``` -`$ sudo apt install default-jre` -``` - -Java is now installed. - -There are probably many _many_ Java-related packages in your repository. Search on OpenJDK and look for either the most recent JRE or JVM if you're a user and for the most recent JDK if you're a developer. - -### Install Java from the internet - -If you can't find a JRE or JDK in your repository, or the ones you find don't fit your needs, you can download open source Java packages from the internet. You can find downloads of OpenJDK at [openjdk.java.net][3] in the form of a tarball requiring manual installation, or you can download the [Zulu Community][4] edition from Azul in the form of a tarball or installable RPM or DEB packages. - -#### Installing Java from a TAR file - -If you download a TAR file from either Java.net or Azul, you must install it manually. This is often called a "local" install because you're not installing Java to a "global" location. Instead, you choose a convenient place in your PATH. - -If you don't know what's in your PATH, take a look to find out: - - -``` -$ echo $PATH -/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/seth/bin -``` - -In this example PATH, the locations **/usr/local/bin** and **/home/seth/bin** are good options. If you're the only user on your computer, then your own home directory makes sense. If there are many users on your computer, then a common location, such as **/usr/local** or **/opt**, is the best choice. - -If you don't have access to system-level directories like **/usr/local**, which require **sudo** permissions, then create a local **bin** (for "binary," not a waste bin) or **Applications** folder in your own home folder: - - -``` -`$ mkdir ~/bin` -``` - -Add this to your PATH, if it's not already there: - - -``` -$ echo PATH=$PATH:$HOME/bin >> ~/.bashrc -$ source ~/.bashrc -``` - -Finally, unarchive the tarball into the directory you've chosen. - - -``` -$ tar --extract --file openjdk*linux-x64_bin.tar.gz \ -\--directory=$HOME/bin -``` - -Java is now installed. - -#### Installing Java from an RPM or DEB - -If you download an RPM or DEB file from Azul.com, then you can use your package manager to install it. - -For Fedora, CentOS, RHEL, and similar, download the RPM and install it using DNF: - - -``` -`$ sudo dnf install zulu*linux.x86_64.rpm` -``` - -For Debian, Ubuntu, Pop_OS, and similar distributions, download the DEB package and install it using Apt: - - -``` -`$ sudo dpkg -i zulu*linux_amd64.deb` -``` - -Java is now installed. - -#### Setting your Java version with alternatives - -Some applications are developed for a specific version of Java and don't work with any other version. This is rare, but it does happen, and on Linux, you can use either the local install method (see [Installing Java from a TAR file][5]) or the **alternatives** application to deal with this conflict. - -The **alternatives** command looks at applications installed on your Linux system and lets you choose which version to use. Some distributions, such as Slackware, don't provide an **alternatives** command, so you must use the local install method instead. On Fedora, CentOS, and similar distributions, the command is **alternatives**. On Debian, Ubuntu, and similar, the command is **update-alternatives**. - -To get a list of available versions of an application currently installed on your Fedora system: - - -``` -`$ alternatives --list` -``` - -On Debian, you must specify the application you want alternatives for: - - -``` -`$ update-alternatives --list java` -``` - -To choose which version you want to make the system default on Fedora: - - -``` -`$ sudo alternatives --config java` -``` - -On Debian: - - -``` -`$ sudo updates-alternatives --config java` -``` - -You can change the default Java version as needed based on the application you want to run. - -### Running a Java application - -Java applications are typically distributed as JAR files. Depending on how you installed Java, your system may already be configured to run a Java application, which allows you to just double-click the application icon (or select it from an application menu) to run it. If you had to do a local Java install that isn't integrated with the rest of your system, you can launch Java applications directly from a terminal: - - -``` -`$ java -jar ~/bin/example.jar &` -``` - -### Java is a good thing - -Java is one of the few programming environments that places cross-platform development first. There's nothing quite as liberating as asking whether an application runs on your platform, and then discovering that the application was written in Java. As simply as that, you're freed from any platform anxiety you may have had, whether you're a developer or a user. Embrace Java applications on your desktop, and run them on _all_ of your desktops. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/install-java-linux - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) -[2]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html -[3]: http://openjdk.java.net -[4]: https://www.azul.com/downloads/zulu-community -[5]: tmp.wuzOCnXHry#installing-java-from-a-tar-file diff --git a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md deleted file mode 100644 index fe5115256e..0000000000 --- a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Switching from Python 2 to Python 3: What you need to know) -[#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) -[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) - -Switching from Python 2 to Python 3: What you need to know -====== -Python 2 will reach its end of life in mere weeks. Here's what to know -before you migrate to Python 3. -![A sunrise][1] - -Python 2.7 will officially become unsupported beginning January 1, 2020. There is one [final bugfix][2] planned after this date, but then that's it. - -What does this end of life (EOL) mean for you? If you run Python 2, you need to migrate. - -### Who decided to EOL Python 2? - -In [2012][3], the team maintaining the Python programming language reviewed its options. There were two increasingly different codebases, Python 2 and Python 3. Both were popular, but the newer version was not as widely adopted. - -In addition to Python 3's disruption of changing the underlying way data is handled by completely reworking Unicode support, a major version change allowed non-backward-compatible changes to happen all at once. This decision was documented [in 2006][4]. To ease the disruption, Python 2 continued to be maintained, with some features backported. To further help the community transition, the EOL date was extended [from 2015 to 2020][5], another five years. - -Maintaining divergent codebases was a hassle the team knew it had to resolve. Ultimately, a decision was [announced][6]: - -> "We are volunteers who make and take care of the Python programming language. We have decided that January 1, 2020, will be the day that we sunset Python 2. That means that we will not improve it anymore after that day, even if someone finds a security problem in it. You should upgrade to Python 3 as soon as you can." - -[Nick Coghlan][7], a core CPython developer and current member of the Python steering council, [adds more information in his blog][8]. And [PEP 404][9], written by [Barry Warsaw][10] (also a member of the Python steering council), details why Python 2.8 will never be a thing. - -### Is anyone still supporting Python 2? - -Support for Python 2 from providers and vendors will vary. [Google Cloud has announced][11] how it plans to support Python 2 going forward. Red Hat has also [announced plans for Red Hat Enterprise Linux (RHEL)][12], and AWS has announced [minor version update requirements][13] for the AWS command-line interface and [SDK][14]. - -You can also read the Stack Overflow blog post "[Why is the Migration to Python 3 Taking So Long?][15]" by [Vicki Boykis][16], in which she identifies three reasons why Python 3 adoption is slow.  - -### Reasons to use Python 3 - -Regardless of ongoing support, it's a really good idea to migrate to Python 3 as soon as you can. Python 3 will continue to be supported, and it has some really neat things that Python 2 just doesn't have. - -The recently released [Python 3.8][17] includes such [features][18] as the [walrus operator][19], [positional-only parameters][20], and [self-documenting f-strings][21]. Earlier releases of Python 3 introduced [features][22] such as [asyncio][23], [f-strings][24], [type hints][25], and [pathlib][26], just to name a few. - -The top 360 most-downloaded packages [have already migrated to Python 3][27]. You can check your requirements.txt file using the [caniusepython3][28] package to see if any packages you depend on haven't yet been migrated. - -### Resources for porting Python 2 to Python 3 - -There are many resources available to ease your migration to Python 3. For example, the [Porting Python 2 to Python 3 guide][29] lists a bunch of tools and tricks to help you achieve single-source Python 2/3 compatibility. There are also some useful tips on [Python3statement.org][30]. - -[Dustin Ingram][31] and [Chris Wilcox][32] gave a [presentation at Cloud Next '19][33] detailing some of the motivations and migration patterns for the transition into Python 3. [Trey Hunner][34] gave a [presentation at PyCon 2018][35] about Python 3's most useful features to encourage you to migrate so you can take advantage of them. - -### Join us! - -January 1, 2020, is now just weeks away. If you need daily reminders of just how soon that is (and you use Twitter), follow the [Countdown to Python 2 sunset][36] Twitter bot. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/end-of-life-python-2 - -作者:[Katie McLaughlin][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/glasnt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_a%20new%20dawn.png?itok=b4zU-VAY (A sunrise) -[2]: https://www.python.org/dev/peps/pep-0373/#maintenance-releases -[3]: https://github.com/python/peps/commit/a733bc927acbca16bfa3de486fb2c7d3f767a748 -[4]: https://www.python.org/dev/peps/pep-3000/#compatibility-and-transition -[5]: https://github.com/python/peps/commit/f82462002b86feff36215b4230be28967039b0cc -[6]: https://www.python.org/doc/sunset-python-2/ -[7]: https://twitter.com/ncoghlan_dev -[8]: http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html -[9]: https://www.python.org/dev/peps/pep-0404/ -[10]: https://twitter.com/pumpichank -[11]: https://cloud.google.com/python/docs/python2-sunset/?utm_source=osdc&utm_medium=blog&utm_campaign=pysunset -[12]: https://access.redhat.com/solutions/4455511 -[13]: https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/ -[14]: https://aws.amazon.com/sdk-for-python/ -[15]: https://stackoverflow.blog/2019/11/14/why-is-the-migration-to-python-3-taking-so-long/ -[16]: https://twitter.com/vboykis -[17]: https://www.python.org/downloads/ -[18]: https://docs.python.org/3.8/whatsnew/3.8.html -[19]: https://docs.python.org/3.8/whatsnew/3.8.html#assignment-expressions -[20]: https://docs.python.org/3.8/whatsnew/3.8.html#positional-only-parameters -[21]: https://docs.python.org/3.8/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging -[22]: https://docs.python.org/3.8/whatsnew/index.html -[23]: https://docs.python.org/3.8/library/asyncio.html#module-asyncio -[24]: https://docs.python.org/3.7/whatsnew/3.6.html#pep-498-formatted-string-literals -[25]: https://docs.python.org/3.7/whatsnew/3.5.html#pep-484-type-hints -[26]: https://docs.python.org/3.8/library/pathlib.html#module-pathlib -[27]: http://py3readiness.org/ -[28]: https://pypi.org/project/caniusepython3/ -[29]: https://docs.python.org/3/howto/pyporting.html -[30]: https://python3statement.org/practicalities/ -[31]: https://twitter.com/di_codes -[32]: https://twitter.com/chriswilcox47 -[33]: https://www.youtube.com/watch?v=Bye7Rms0Vgw&utm_source=osdc&utm_medium=blog&utm_campaign=pysunset -[34]: https://twitter.com/treyhunner -[35]: https://www.youtube.com/watch?v=klaGx9Q_SOA -[36]: https://twitter.com/python2sunset diff --git a/sources/tech/20191121 How to document Python code with Sphinx.md b/sources/tech/20191121 How to document Python code with Sphinx.md deleted file mode 100644 index dc6f2c8cbb..0000000000 --- a/sources/tech/20191121 How to document Python code with Sphinx.md +++ /dev/null @@ -1,180 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to document Python code with Sphinx) -[#]: via: (https://opensource.com/article/19/11/document-python-sphinx) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -How to document Python code with Sphinx -====== -Documentation is best as part of the development process. Sphinx, along -with Tox, makes it easy to write and beautiful to look at. -![Python in a coffee cup.][1] - -Python code can include documentation right inside its source code. The default way of doing so relies on **docstrings**, which are defined in a triple quote format. While the value of documentation is well... documented, it seems all too common to not document code sufficiently. Let's walk through a scenario on the power of great documentation. - -After one too many whiteboard tech interviews that ask you to implement the Fibonacci sequence, you have had enough. You go home and write a reusable Fibonacci calculator in Python that uses floating-point tricks to get to O(1). - -The code is pretty simple: - - -``` -# fib.py -import math - -_SQRT_5 = math.sqrt(5) -_PHI = (1 + _SQRT_5) / 2 - -def approx_fib(n): -    return round(_PHI**(n+1) / _SQRT_5) -``` - -(That the Fibonacci sequence is a geometric sequence rounded to the nearest whole number is one of my favorite little-known math facts.) - -Being a decent person, you make the code open source and put it on [PyPI][2]. The **setup.py** file is simple enough: - - -``` -import setuptools - -setuptools.setup( -    name='fib', -    version='2019.1.0', -    description='Fibonacci', -    py_modules=["fib"], -) -``` - -However, code without documentation is useless. So you add a docstring to the function. One of my favorite docstring styles is the ["Google" style][3]. It is light on markup, which is nice when it is inside the source code. - - -``` -def approx_fib(n): -    """ -    Approximate Fibonacci sequence - -    Args: -        n (int): The place in Fibonacci sequence to approximate - -    Returns: -        float: The approximate value in Fibonacci sequence -    """ -    # ... -``` - -But the function's documentation is only half the battle. Prose documentation is important for contextualizing code usage. In this case, the context is annoying tech interviews.  - -There is an option to add more documentation, and the Pythonic pattern is to use an **rst** file (short for [reStructuredText][4]) commonly added under a **docs/** directory. So the **docs/index.rst** file ends up looking like this: - - -``` -Fibonacci -========= - -Are you annoyed at tech interviewers asking you to implement -the Fibonacci sequence? -Do you want to have some fun with them? -A simple -:code:`pip install fib` -is all it takes to tell them to, -um, -fib off. - -.. automodule:: fib -   :members: -``` - -And we're done, right? We have the text in a file. Someone should look at it. - -### Making Python documentation beautiful - -To make your documentation look beautiful, you can take advantage of [Sphinx][5], which is designed to make pretty Python documents. In particular, these three Sphinx extensions are helpful: - - * **sphinx.ext.autodoc**: Grabs documentation from inside modules - * **sphinx.ext.napoleon**: Supports Google-style docstrings - * **sphinx.ext.viewcode**: Packages the ReStructured Text sources with the generated docs - - - -In order to tell Sphinx what and how to generate, we configure a helper file at **docs/conf.py**: - - -``` -extensions = [ -    'sphinx.ext.autodoc', -    'sphinx.ext.napoleon', -    'sphinx.ext.viewcode', -] -# The name of the entry point, without the ".rst" extension. -# By convention this will be "index" -master_doc = "index" -# This values are all used in the generated documentation. -# Usually, the release and version are the same, -# but sometimes we want to have the release have an "rc" tag. -project = "Fib" -copyright = "2019, Moshe Zadka" -author = "Moshe Zadka" -version = release = "2019.1.0" -``` - -This file allows us to release our code with all the metadata we want and note our extensions (the comments above explain how). Finally, to document exactly how we want the documentation generated, use [Tox][6] to manage the virtual environment to make sure we generate the documentation smoothly: - - -``` -[tox] -# By default, .tox is the directory. -# Putting it in a non-dot file allows opening the generated -# documentation from file managers or browser open dialogs -# that will sometimes hide dot files. -toxworkdir = {toxinidir}/build/tox - -[testenv:docs] -# Running sphinx from inside the "docs" directory -# ensures it will not pick up any stray files that might -# get into a virtual environment under the top-level directory -# or other artifacts under build/ -changedir = docs -# The only dependency is sphinx -# If we were using extensions packaged separately, -# we would specify them here. -# A better practice is to specify a specific version of sphinx. -deps = -    sphinx -# This is the sphinx command to generate HTML. -# In other circumstances, we might want to generate a PDF or an ebook -commands = -    sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html -# We use Python 3.7. Tox sometimes tries to autodetect it based on the name of -# the testenv, but "docs" does not give useful clues so we have to be explicit. -basepython = python3.7 -``` - -Now, whenever you run Tox, it will generate beautiful documentation for your Python code. - -### Documentation in Python is excellent - -As a Python developer, the toolchain available to us is fantastic. We can start with **docstrings**, add **.rst** files, then add Sphinx and Tox to beautify the results for users.  - -What do you appreciate about good documentation? Do you have other favorite tactics? Share them in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/document-python-sphinx - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) -[2]: https://pypi.org/ -[3]: http://google.github.io/styleguide/pyguide.html#381-docstrings -[4]: http://docutils.sourceforge.net/rst.html -[5]: http://www.sphinx-doc.org/en/master/ -[6]: https://tox.readthedocs.io/en/latest/ diff --git a/sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md b/sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md new file mode 100644 index 0000000000..67b79f1c64 --- /dev/null +++ b/sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md @@ -0,0 +1,219 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Bitwarden for password protection on Active Directory) +[#]: via: (https://opensource.com/article/19/11/bitwarden-password-protection-active-directory) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +How to use Bitwarden for password protection on Active Directory +====== +Integrate your Linux self-hosted Bitwarden instance with AD using +Bitwarden Directory Connector. +![A lock on the side of a building][1] + +[Bitwarden][2] is a fantastic tool for managing passwords. It has applications for every platform, a browser plugin, and a self-hosted version, and it offers some great password management tricks like folders and collections. One of my favorite features is that it will keep a history of your old passwords, which is a great feature for enterprise users. + +If you are an enterprise user, you are probably self-hosting Bitwarden and want to sync your users with a staff directory. My organization uses Active Directory (AD), which is the standard for user directories and integrates seamlessly with Windows desktops. I also need it to work with our open source tools, and herein lies the secret sauce shared in this article. + +The tool that allows you to do this is [Bitwarden Directory Connector][3] (BWDC). If you do a Google search, you will not find much information on using BWDC with AD on Linux. [Bitwarden's blog][4] is a great starting point if you're using the Windows version but it won't help you integrate it into your Linux environment. You can find instructions to do that on Bitwarden's GitHub page, but they aren't very clear. So, here I'll explain how to get your Linux self-hosted version of Bitwarden to integrate with your enterprise Active Directory (and, hopefully, provide more fruitful results for future Google searchers looking for this information). + +In my setup, both Bitwarden and Active Directory are hosted on AWS, the former in an EC2 instance and the latter in AWS Simple Directory. The Bitwarden Docker container is installed in the home directory of a user called **bitwarden**. [Bitwarden's instructions][5] make this easy to set up. But setting up BWDC is not as clear, so I will try to fix that here. + +### Install BWDC + +Start by setting up a directory for BWDC, then download the ZIP file and unzip it: + + +``` +cd /home/bitwarden +mkdir directory-connector +cd directory-connector +wget +unzip bwdc-linux-2.6.2.zip +chmod +x bwdc +``` + +(At the time of this writing, BWDC 2.6.2 was the current version; that may change, so make sure to download the latest release.) + +You will now have a binary file called **bwdc** and a file called **keytar.node**; leave both files right where they are. + +Next, edit the profile of the **bitwarden** user: + + +``` +`vi /home/bitwarden/.profile` +``` + +and add the lines: + + +``` +export BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS=true +export PATH=$PATH:/home/bitwarden/directory-connector +``` + +Log out and back in to pick up the new settings, or you can source the profile with: + + +``` +`  . ~/.profile` +``` + +The line **BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS=true** tells BWDC not to use any desktop-based keystore. Since this is a server and it's unlikely to have a desktop installed, you will have to keep the password in plain text (but you will take precautions to protect it later). The second line sets up a path to the **bwdc** binary so it can run from any directory you are in. + +### Configure BWDC + +Once BWDC is installed, configure it to connect to your Bitwarden instance: + + +``` +bwdc login +? Email address: <your email for your master account> +? Master password: [hidden] +``` + +After you are logged in, you're ready to work on the **data.json** file. + +If you set up BWDC using the steps above, its configuration information will be stored in **/home/bitwarden/.config/Bitwarden Directory Connector/data.json**. This file contains the **appId** and **access token**; these are the login credentials for your Bitwarden instance. But what about Active Directory, you say? You can add that manually by editing your **data.json** file (I assume you are on a server and are using Vi): + + +``` +`vi '/home/bitwarden/.config/Bitwarden Directory Connector/data.json'` +``` + +Add the following just underneath the **appId** line: + + +``` +"rememberEmail": true, +  "rememberedEmail": "<the email address you logged in with>", +  "organizationId": "<your organization id>", +  "directoryType": 0, +  "directoryConfig_0": { +    "ssl": false, +    "sslAllowUnauthorized": false, +    "port": 389, +    "currentUser": false, +    "ad": true, +    "hostname": "<hostname of your active directory>", +    "rootPath": "<root path of AD, something like; dc=com,dc=au>", +    "username": "<username with privilege to read the AD; DOMAIN\\\Username>", +    "password": "<password for the above account>" +  }, +  "directoryConfig_2": {}, +  "directoryConfig_1": {}, +  "directoryConfig_3": {}, +  "syncConfig": { +    "users": true, +    "groups": true, +    "interval": 5, +    "removeDisabled": true, +    "overwriteExisting": true, +    "useEmailPrefixSuffix": false, +    "creationDateAttribute": "whenCreated", +    "revisionDateAttribute": "whenChanged", +    "emailPrefixAttribute": "sAMAccountName", +    "memberAttribute": "member", +    "userObjectClass": "person", +    "groupObjectClass": "group", +    "userEmailAttribute": "mail", +    "groupNameAttribute": "name", +    "userFilter": "(&(memberOf=CN=bitwarden,OU=groups,DC=work,DC=corp))", +    "groupPath": "OU=Groups", +    "userPath": "CN=Users" +  }, +  "environmentUrls": { +    "base": "<base url of your bitwarden instance; [https://bitwarden.yourdomain\>][6]", +    "api": null, +    "identity": null, +    "webVault": null, +    "icons": null, +    "notifications": null, +    "events": null +  }, +``` + +If you look through this, you'll see that you need to change several values in this entry, including the **userFilter**, **groupPath**, and **userPath**. (I will assume you are familiar with LDAP and AD and know what those values should be for your instance.) Keep the **CN=bitwarden** part for the Bitwarden AD group you will create later. The other value you need to change is **organizationID**, which you can find in your **bwdata** directory as the name of one of the JSON files. List the files: + + +``` +`ls /home/bitwarden/bwdata/core/licenses/organization` +``` + +This should return a directory listing, containing a single filename in the form **<organization id>.json**. The filename itself is your organization's ID. Insert it into the **organizationID** line in the code above. + +Once you get your **data.json** file right, _I **highly** recommend you back up this file_. There seems to be an issue that sets this file back to default settings if BWDC finds a problem with it. This means if you innocently make a change to the file and there is a mistake, you will lose the entire configuration. + +Next, test connectivity to your AD as the **bitwarden** user: + + +``` +`bwdc test` +``` + +This should return a dump of the groups in your AD. To protect your password, set the permissions on that file so that only the **bitwarden** user can read it: + + +``` +`chmod 700 '/home/bitwarden/.config/Bitwarden Directory Connector/data.json'` +``` + +### Set up your group + +Now add a group to your AD (my group is called **bitwarden**), where you will add and remove users as they need access to Bitwarden. This group is necessary because, if you don't filter the users based on this group, BWDC will try to use ALL users in your AD. If the number of users is greater than your Bitwarden license allows, BWDC will fail silently, and you will hate yourself for a long time…. much like I did! + +Once the group is set up and has at least one user, run the test again. You should see your user's email address in the output. + +Now it is time to sync. Once you sync, any users that appear in the **bitwarden** group will be added to Bitwarden, and an email will be sent to them to invite them to sign up. Working as the **bitwarden** user, sync the directories with: + + +``` +`bwdc sync` +``` + +Given that **removeDisabled** is set to **true** in the **data.json** file, you can set up a cron job to keep the members of the **bitwarden** group and the Bitwarden users in constant sync so that any changes you make in your AD are immediately reflected in your Bitwarden instance. Add the following to your **/etc/crontab**: + + +``` +# Sync for Active Directory to Bitwarden +* *     * * *   bitwarden export BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS=true ; /home/bitwarden/directory-connector/bwdc sync >/dev/null 2>&1 +``` + +Once you have auto-sync going, you will have a complete list of all your AD groups in Bitwarden. From there, it's just a simple matter of assigning a group to a collection and then adding members to groups in your AD. The users will be automatically assigned to the correct password collections and see the passwords they need. + +### Potential traps + +Finally, I will tell you about a few little traps that I fell into when setting this up. First, be aware of the **AD Primary Group**. You may have set this for a user if any of your Linux or other POSIX systems get login credentials from AD. It seems that AD will not include a user in group search results if that group is set as the primary group; this could remove a user from a group and therefore lose access to a collection. + +Second, when you need to delete a user, you might think that removing an account from the group in AD would remove the user… wrong! It seems that Bitwarden keeps some user information hanging around in its database. This became painfully obvious when I removed my own account and then discovered that I was no longer able to log in after recreating it because the multi-factor authentication (MFA) was still active and the token had expired, effectively locking me out. You must explicitly tell Bitwarden to remove that stuff in the database. To do so, go to the URL: + + +``` +`https:///#/recover-delete` +``` + +Enter the email address the user signed up with. They will get an email instructing them to click a link to confirm to remove the account. Once that is done, the user can be put back in the Bitwarden AD group and go through the sign-on process again. + +Now you know how to get your self-hosted Bitwarden working with your AD. I think you will still experience a few issues, but with a little bit of patience and tinkering with the configuration, it will work. Just don't muck around with it too much once it is working! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/bitwarden-password-protection-active-directory + +作者:[Stephen Bancroft][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stevereaver +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://bitwarden.com/ +[3]: https://github.com/bitwarden/directory-connector +[4]: https://blog.bitwarden.com/organization-user-groups-directory-sync-ba674cb78a5c +[5]: https://help.bitwarden.com/article/install-on-premise/ +[6]: https://bitwarden.yourdomain\> diff --git a/sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md b/sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md new file mode 100644 index 0000000000..37912e7e20 --- /dev/null +++ b/sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md @@ -0,0 +1,303 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use) +[#]: via: (https://itsfoss.com/raspberry-pi-projects/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use +====== + +It won’t be an exaggeration if I call Raspberry Pi a revolutionary gadget. When it was first launched in the year 2011-12, people just couldn’t believe that a computer can be available in just $25. + +If you bought a Pi and wondering what should do with my Raspberry Pi, I have got your back. I am going to list some cool Raspberry Pi projects that you can start following in your free time. + +These Raspberry Pi project ideas are not limited to Pi. You can use them with other [Raspberry Pi like devices such as Orange Pi, Khadas][1] etc. + +### 25 Cool Raspberry Pi Projects + +I have listed several these project ideas by categorizing them in terms of the level of complexity (beginner, intermediate, and advanced). Some projects need additional equipment and sensors as well. + +Of course, it is worth noting that it will be subjective to what expertise you have. So, let us take a look at the project ideas. + +**Beginner Level Raspberry Pi Projects** + +#### 1\. Media Server + +Building a media server using Rasberry Pi is the most common and probably the easiest project there is. + +You can take a look at some of the [best media server software][2] available for Linux and get started. + +To know more about it, you can refer to the official documentation of [using Kodi with Raspberry Pi][3] (which is one of the media server software available). + +[Using Kodi On Raspberry Pi][3] + +#### 2\. Weather Station + +![][4] + +If you’re good at building projects with electronic components, building a weather station using Raspberry Pi should be fun for you. + +This may not be the easiest one to start with – but it’s quite simple if you carefully look into the project requirements. + +You will be able to collect weather data using a variety of sensors as per your requirements. The project has been listed on the official website to help you build it as easily as possible. + +[Weather Station Project][5] + +#### 3\. The Parent Detector + +![][6] + +Yet another project from Raspberry Pi’s official website, this project uses minimal hardware to set up a motion detector which then triggers a video recording using the Raspberry Pi camera module. + +The use-case for this can be a lot of things. If you are a parent, you can keep an eye on your child when they enter their room. In either case, this can also come in handy to keep an eye on your door as a security measure to check when someone arrives. + +You can find all the necessary details on Raspberry Pi’s official site. + +[The Parent Detector][7] + +#### 4\. FM Radio Station + +Raspberry Pi is an inexpensive device for making an FM radio station. The pre-requisites may not be much but is worth exploring for fun. + +Do note that you may not want to interfere with the local FM frequencies. You can find all the details to set it up by clicking the button below. + +[FM Radio Transmitter][8] + +#### 5\. Minecraft Game Sever + +![][9] + +Minecraft is a quite popular game. However, if you want a personal server, you might have to pay a premium. + +Fret not, you can use your Raspberry Pi to build a local server, create your own world and have fun with your family/friends. + +[Minecraft Game Server][10] + +#### 6\. Temperature Log + +It was something interesting I found on the official website to help you learn a few things like – how to write data to a file etc. + +Here, you will be recording the temperature using the sensor present. + +For this, you will be utilizing the command-line to monitor the temperature of Raspberry Pi. + +[Temperature Log][11] + +#### 7\. Retro Gaming Console + +You can turn your Raspberry Pi into a gaming console by simply installing an OS on an SD card and transfer a few files to it. + +We also have an article on how you can [turn your old PC into a Retrogaming console][12] if you are curious. + +I have linked a resource to help you make this project in the button below: + +[Retro Gaming Console][13] + +#### 8\. Full-Fledged Desktop + +![][14] + +If you do not want to invest a lot to build a PC, you can easily utilize your Raspberry Pi to build one. + +Technically, your Raspberry Pi will be the heart of your PC and you will need to add accessories (monitor, keyboard, mouse, etc) to turn it into a PC. You can also choose to build a custom case for the board if you want – which is totally optional. + +Obviously, the PC won’t be powerful enough for all kinds of tasks – but it will be usable. You can also check out the experience of having [Raspberry Pi 4 as a desktop replacement][15] on their official website as a reference to this project. + +[Full-Fledged Desktop][16] + +**Intermediate Level Raspberry Pi Project Ideas** + +#### 9\. Build a LAMP Web Server with WordPress + +If you are into web development, you can try setting up a LAMP (Linux + Apache + MySQL + PHP) server and install WordPress to create a website. You can also choose to make something else from scratch without installing WordPress. + +You will be able to access the site on any device on the same network as your Raspberry Pi. + +[Build a LAMP Web Server][17] + +#### 10\. Laser Tripwire + +It is a similar concept to the parent detector that uses a motion sensor. In this case, a laser beam is used to detect activity whenever someone breaks the beam. + +You just need a few things to set up the alarm and complete the tripwire. Of course, this is a simple project to start with that has potentially different applications. + +[Laser Tripwire][18] + +#### 11\. Print Server + +What if you can turn your old printer to work on a network of devices even without requiring a built-in WiFi feature? + +Well, that’s what this project is about. You will be able to access your printer from multiple devices using a print server. Check out all the details to help build one by clicking the button below. + +[Raspberry Pi Print Server][19] + +#### 12\. Time Lapse Camera + +Looking for a cheap dedicated time-lapse camera? Well, you can do it yourself with a Raspberry Pi. + +You can use the Pi camera module or explore other options as well. + +[Time-Lapse Camera][20] + +#### 13\. Music Box + +You can build a button-controlled music box using Raspberry Pi to have a great time with your kids or anyone who loves music. + +When you press a button, it will play a sound. You can find the short description of the project in the video above, for more details click on the button below. + +[Music Box][21] + +#### 14\. Google Home On Raspberry Pi + +If you could configure and set up Google Assistant on your Raspberry Pi, you can turn it into an inexpensive Google Home DIY alternative, right? + +Fortunately, you can achieve that with your Raspberry Pi. Find out more about it in the video above. + +#### 15\. Build Smart TV Box + +If you know how to set up a media server on Raspberry Pi (as mentioned in the first project idea of this article), you can make this happen too. + +With the help of the Kodi box (or similar), you can build your own personal smart TV box powered by the media server of your choice. + +[Smart TV Box][22] + +#### 16\. Add Gesture Controls To Raspberry Pi + +You can add the ability to have gesture controls for any of your projects on Raspberry Pi using a [Flick board][23]. + +It may not be the cheapest project but it is an impressive touch for your Raspberry Pi project. + +[Gesture Controls][23] + +**Advanced Level Raspberry Pi Project Ideas** + +#### 17\. Tor Router + +If you are someone who wants to explore ways to enhance your personal digital privacy, you can start by building your own local Tor onion router. + +With this, you can scramble your Internet connection and remain anonymous with your browsing activities. It is just something like a VPN but technically different. + +[Tor Router][24] + +#### 18\. Control LEDs with your voice + +![][25] + +This is quite interesting. I have already mentioned a project where you can set up Google Assistant on your Raspberry Pi. However, in this case, you will be able to control the LEDs with your voice. + +You will not need the assistant this time, all you need is the [Google AIY voice kit][26]. This has been featured on the list of official DIY projects using Raspberry Pi, you can get more information there. + +[Control LEDs With Voice][27] + +#### 19\. WiFi Extender + +If you want to increase the range of your WiFi network, you might have to opt for a premium gadget that can help you do that or you can utilize Raspberry Pi to get the job done. + +Yes, that’s right, you can build a WiFi extender by just using your Raspberry Pi. + +[WiFi Extender][28] + +#### 20\. VPN Server + +You do not need to trust the VPN providers if you can build your own local VPN server. It can be quite challenging to make it happen. + +So, if you are up for some action, you can use your Raspberry Pi to make a private VPN server for your connection. Explore more about it here: + +[VPN Server][29] + +#### 21\. Home Automation Using Raspberry Pi + +A lot of powerful projects can be done using the Raspberry Pi, one of which is – ‘Home Automation’. + +If I want to implement home automation, it will be expensive. But, if I end up using Raspberry Pi to create something similar, it will require less investment. Of course, you will have to explore and improve to make it a reliable system but you can get started with the basics. + +[Home Automation][30] + +#### 22\. Local Cloud Server + +You can also build your own cloud using Raspberry Pi. You can also install Nextcloud on it to protect and store your data. + +A lot of exciting things to explore once you have your own cloud, right? + +[Local Cloud Server][31] + +#### 23\. Portable Hacking Device + +Let me make one thing clear, I am not encouraging you to do something illegal (just like the movies) by building a portable hacking device. + +So, just for educational/testing purposes, feel free to try making your own portable device for hacking using Raspberry Pi. + +[Portable Hacking Device][32] + +#### 24\. Smart Gloves + +Making a pair of smart gloves is really a cool project with Raspberry Pi. In my college days, I witnessed a senior make this thing, it was interesting. + +You can refer to the official resource for this project and get started. + +[Smart Gloves][33] + +#### 25\. Ad Blocker + +With Raspberry Pi, you can easily implement a network-wide Adblocker so that you won’t have to install adblockers separately on devices or browsers. + +You need to utilize Pi-Hole (the ad blocker) to set it up. Check out the video above and the official resource through the button below. + +[Ad Blocker][34] + +**Wrapping Up** + +Here, I listed some of the most interesting projects that I could find that might come in handy for you. + +If you know some other cool ideas, let me know in the comments down below. I might update this list of Raspberry Pi projects with your idea. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-projects/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/raspberry-pi-alternatives/ +[2]: https://itsfoss.com/best-linux-media-server/ +[3]: https://www.raspberrypi.org/documentation/usage/kodi/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/diy-weather-station.jpg?ssl=1 +[5]: https://projects.raspberrypi.org/en/projects/build-your-own-weather-station +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/parents-detector-pi.png?ssl=1 +[7]: https://projects.raspberrypi.org/en/projects/parent-detector +[8]: https://circuitdigest.com/microcontroller-projects/raspberry-pi-fm-transmitter +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/minecraft-game-server.jpg?ssl=1 +[10]: https://www.makeuseof.com/tag/setup-minecraft-server-raspberry-pi/ +[11]: https://projects.raspberrypi.org/en/projects/temperature-log +[12]: https://itsfoss.com/lakka-retrogaming-linux/ +[13]: https://lifehacker.com/how-to-turn-your-raspberry-pi-into-a-retro-game-console-498561192 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/raspberry-pi-desktop.jpg?ssl=1 +[15]: https://www.raspberrypi.org/blog/raspberry-pi-4-a-full-desktop-replacement/ +[16]: https://www.makeuseof.com/tag/use-your-raspberry-pi-like-a-desktop-pc/ +[17]: https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress +[18]: https://projects.raspberrypi.org/en/projects/laser-tripwire +[19]: https://circuitdigest.com/microcontroller-projects/raspberry-pi-print-server +[20]: https://projects.raspberrypi.org/en/projects/raspberry-pi-zero-time-lapse-cam +[21]: https://projects.raspberrypi.org/en/projects/gpio-music-box +[22]: https://www.modmy.com/kodi-box-guide +[23]: https://magpi.raspberrypi.org/articles/flick-hat-swipe-gestures-raspberry-pi +[24]: https://magpi.raspberrypi.org/articles/tor-router +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/control-led-voice-raspberry-pi.jpg?fit=800%2C450&ssl=1 +[26]: https://aiyprojects.withgoogle.com/voice +[27]: https://projects.raspberrypi.org/en/projects/google-voice-aiy/ +[28]: https://pimylifeup.com/raspberry-pi-wifi-extender/ +[29]: https://www.comparitech.com/blog/vpn-privacy/raspberry-pi-vpn/ +[30]: https://circuitdigest.com/microcontroller-projects/iot-raspberry-pi-home-automation +[31]: https://opensource.com/article/18/9/host-cloud-nas-raspberry-pi +[32]: https://www.hackster.io/mehedishakeel/portable-hacking-machine-kali-linux-raspberry-pi-touch-18b7c3 +[33]: https://www.raspberrypi.org/blog/raspberry-pi-glove/ +[34]: https://www.raspberrypi.org/blog/pi-hole-raspberry-pi/ diff --git a/sources/tech/20191125 Challenge- Write a bouncy window manager.md b/sources/tech/20191125 Challenge- Write a bouncy window manager.md new file mode 100644 index 0000000000..601e231f53 --- /dev/null +++ b/sources/tech/20191125 Challenge- Write a bouncy window manager.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Challenge: Write a bouncy window manager) +[#]: via: (https://jvns.ca/blog/2019/11/25/challenge--make-a-bouncy-window-manager/) +[#]: author: (Julia Evans https://jvns.ca/) + +Challenge: Write a bouncy window manager +====== + +Hello! I’m writing a short series of programming challenges with [Julian][1], and this is the first one! + +### the challenge + +![][2] + +**requirements** + +The goal here is to make a very silly Linux window manager that bounces its windows around the screen, like in the gif above. + +**anti-requirements** + +The window manager doesn’t need to do anything else! It doesn’t need to support: + + * moving or resizing windows + * switching between windows + * minimizing windows + * literally any of the other things you might normally expect a window manager to do + + + +It turns out implementing this kind of toy window manager is surprisingly approachable! + +### the setup: start with tinywm + +All the instructions here only work on Linux (since this is about writing a Linux window manager). + +**starter kit: tinywm** + +Writing a window manager from scratch seems intimidating (at first I didn’t even know how to start!). But then I found **[tinywm][3]**, which is a tiny window manager written in only **50 lines of C**. This is a GREAT starting point and there’s an annotated version of the source code which explains a lot of the details. There’s a Python version of tinywm too, but I wasn’t able to get it to work. + +I did this challenge by modifying [tinywm][3] and it worked really well. + +**tools** + + * **Xephyr** lets you embed an X session in a window in your regular desktop, so that you can develop your toy window manager without breaking your usual desktop. I ran it like this: `Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :1 &` + * You can start an xterm in the Xephyr desktop with `xterm -display :1` + * I compiled my window manager with `gcc bouncewm.c -g -o bouncewm -lX11` and ran it with `env DISPLAY=:1 ./bouncewm` + * **xtrace** lets you trace all requests to the X windows system that your window manager is making. I found it really helpful when debugging. (run it like `xtrace ./bouncewm`) + + + +**documentation** + +Some useful references: + + * the [dwm source code][4] (dwm is a 2000-line-of-C window manager) + * the [Xlib programming manual][5] + + + +If you’re not comfortable writing C, there are also libraries that let you work with X in other languages. I personally found C easier to use because a lot of the window manager documentation and examples I found were for the Xlib C library. + +### my experience: 5 hours, 50 lines of code + +To give you a very rough idea of the difficulty of this exercise: I did this in 4 or 5 hours this morning and last night, producing the window manager you see in the gif at the top of the blog post (which is 50 lines of code). I’d never looked at the source code for a window manager before yesterday. + +As usual when working with a new library I spent most of that time being confused about various basic things about how X works. (and as a result I learned several new things about X!) + +For me this challenge was a fun way to: + + * learn some basics about the X window system protocol (I’ve been using window managers for 15 years, today I got to write one!) + * research an unfamiliar library (“ooh, what does this function do?”) + * use a C library, since I don’t usually write C + + + +### send me your solution if you do this! + +I’ll post the solution I came up in a week. If you think this window manager challenge sounds fun and end up doing it, I’d love it if you sent me your solution (to [[email protected]][6])! + +I’d be delighted to post any solutions you send me in the solutions blog post. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/11/25/challenge--make-a-bouncy-window-manager/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: http://www.cipht.net/2017/10/03/are-jump-tables-always-fastest.html +[2]: https://jvns.ca/images/bouncewm.gif +[3]: http://incise.org/tinywm.html +[4]: https://git.suckless.org/dwm/file/dwm.c.html +[5]: https://tronche.com/gui/x/xlib/ +[6]: https://jvns.ca/cdn-cgi/l/email-protection diff --git a/sources/tech/20191125 My top 5 Ansible modules.md b/sources/tech/20191125 My top 5 Ansible modules.md new file mode 100644 index 0000000000..9a76342854 --- /dev/null +++ b/sources/tech/20191125 My top 5 Ansible modules.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My top 5 Ansible modules) +[#]: via: (https://opensource.com/article/19/11/ansible-modules) +[#]: author: (Mark Phillips https://opensource.com/users/markp) + +My top 5 Ansible modules +====== +Learn how to achieve almost anything with these Ansible modules. +![][1] + +When I was growing up, my grandfather had a shed in his garden. He would spend hours in there, making and fixing things. This was way before we had the internet, so I spent a lot of time studying him creating things in that shed. Although the shed was full of many tools, from drills to lathes to electrical gubbins and lots of things I doubt I could identify even today, he made use of only a tiny subset of what he had at hand. Yet there never seemed to be limits to what he could achieve. + +I tell you that story because I feel like my career has been spent in a metaphorical shed. Computers are so many tools, all in a small (virtual?) space. And there are tool sheds within tool sheds—my favourite being Ansible. The recent 2.9 release ships with 3,681 modules! **3,681!** When I first started using Ansible in the summer of 2013, version 1.2.1 had just 113 modules, yet, as [I wrote at the time][2], I could still achieve anything I imagined. + +Modules are the backbone of Ansible, the gears to make light of heavy lifting. They're designed to do one job well, thus realising [the Unix philosophy][3]. This is how we've come to bundle so many of them; Ansible as the conductor of the orchestra now has a lot of instruments at its command. + +Reviewing a Git repository of my Ansible plays and roles over the years reveals that I have used just 35 modules. This small subset was used to build large infrastructures. I wonder what could be achieved with an even smaller subset, though? As I reviewed those 35, I pondered if I could achieve the same results with only five modules at my disposal. So here are my five favourite modules, in a rather tenuous order of precedence. + +### 5. [authorized_key][4] + +Secure shell (SSH) is at the heart of Ansible, at least for almost everything besides Windows. Key (no pun intended) to using SSH efficiently with Ansible is… [keys][5]! Slight aside—there are a lot of very cool things you can do for security with SSH keys. It's worth perusing the **authorized_keys** section of the [sshd manual page][6]. Managing SSH keys can become laborious if you're getting into the realms of granular user access, and although we could do it with either of my next two favourites, I prefer to use the module because it [enables easy management through variables][7]. + +### 4. [file][8] + +Besides the obvious function of placing a file somewhere, the **file** module also sets ownership and permissions. I'd say that's a lot of _bang for your buck_ with one module. I'd proffer a substantial portion of security relates to setting permissions too, so the **file** module plays nicely with **authorized_keys**. + +### 3. [template][9] + +There are so many ways to manipulate the contents of files, and I see lots of folk use **[lineinfile][10]**. I've used it myself for small tasks. However, the **template** module is so much clearer because you maintain the entire file for context. My preference is to write Ansible content in such a way that anyone can understand it _easily_—which to me means not making it hard to understand what is happening. Use of **template** means being able to see the entire file you're putting into place, complete with the variables you are using to change pieces. + +### 2. [uri][11] + +Many modules in the current distribution leverage Ansible as an orchestrator. They talk to another service, rather than doing something specific like putting a file into place. Usually, that talking is over HTTP too. In the days before many of these modules existed, you _could_ program an API directly using the **uri** module. It's a powerful access tool, enabling you to do a lot. I wouldn't be without it in my fictitious Ansible shed. + +### 1. [shell][12] + +The joker card in our pack. The Swiss Army Knife. If you're absolutely stuck for how to control something else, use **shell**. Some will argue we're now talking about making Ansible a Bash script—but, I would say it's still better because with the use of the **name** parameter in your plays and roles, you document every step. To me, that's as big a bonus as anything. Back in the days when I was still consulting, I once helped a database administrator (DBA) migrate to Ansible. The DBA wasn't one for change and pushed back at changing working methods. So, to ease into the Ansible way, we called some existing DB management scripts from Ansible using the **shell** module. With an informative **name** statement to accompany the task. + +You can achieve a lot with these five modules. Yes, modules designed to do a specific task will make your life even easier. But with a smidgen of engineering simplicity, you can achieve a lot with very little. Ansible developer Brian Coca is a master at it, and [his tips and tricks talk][13] is always worth a watch. + +* * * + +What do you think about my top five? What five modules would you pick and why, if you were so limited? Let me know in the comments below! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/ansible-modules + +作者:[Mark Phillips][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/markp +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mandelbrot_set.png?itok=bmPc0np5 +[2]: http://probably.co.uk/post/puppet-vs-chef-vs-ansible/ +[3]: https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well +[4]: https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html +[5]: https://linux.die.net/man/1/ssh-keygen +[6]: https://linux.die.net/man/8/sshd +[7]: https://github.com/phips/ansible-demos/blob/3bf59df1eb2390b31b5c42333197e2fbb7fec93f/roles/ansible-users/tasks/main.yml#L35 +[8]: https://docs.ansible.com/ansible/latest/modules/file_module.html +[9]: https://docs.ansible.com/ansible/latest/modules/template_module.html +[10]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html +[11]: https://docs.ansible.com/ansible/latest/modules/uri_module.html +[12]: https://docs.ansible.com/ansible/latest/modules/shell_module.html +[13]: https://www.ansible.com/ansible-tips-and-tricks diff --git a/sources/tech/20191125 The many faces of awk.md b/sources/tech/20191125 The many faces of awk.md new file mode 100644 index 0000000000..0d498605f8 --- /dev/null +++ b/sources/tech/20191125 The many faces of awk.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The many faces of awk) +[#]: via: (https://www.networkworld.com/article/3454979/the-many-faces-of-awk.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +The many faces of awk +====== +The awk command provides a lot more than simply selecting fields from input strings, including pulling out columns of data, printing simple text, evaluating content – even doing math. +Thinkstock + +If you only use **awk** when you need to select a specific field from lines of text, you might be missing out on a lot of other services that the command can provide. In this post, we'll look at this simple use along with some of the other things that **awk** can do for you and provide some examples. + +### Plucking out columns of data + +The easiest and most commonly used service that **awk** provides is selecting specific fields from files or from data that is piped to it. With the default of using white space as a field separator, this is very simple. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +``` +$ echo one two three four five | awk ‘{print $4}’ +four +$ who | awk ‘{print $1}’ +jdoe +fhenry +``` + +White space is any sequence of blanks and tabs. In the commands shown above, **awk** is extracting just the fourth and first fields from the data provided. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Awk can also pull text from files by just adding the name of the file after the **awk** command. + +``` +$ awk '{print $1,$5,$NF}' HelenKellerQuote +The beautiful heart. +``` + +In this case, **awk** has picked out the first, fifth and last words in the single line of test. + +The **$NF** specification in the command picks the last piece of text on each line. That is because **NF** represents the number of fields in a line (23) while **$NF** then represents the _value_ of that field ("heart."). The period is included because it's part of the final text string. + +Fields can be printed in any order that you might find useful. In this example, we are rearranging the fields in **date** command output. + +``` +$ date | awk '{print $4,$3,$2}' +2019 Nov 22 +``` + +If you omit the commas between the field designators in an **awk** command, the output will be pushed into a single string. + +``` +$ date | awk '{print $4 $3 $2}' +2019Nov21 +``` + +If you replace the usual commas with hyphens, **awk** will attempt to subtract one field from another – probably not what you intended. It doesn't take the hyphens as characters to be inserted into the print output. Instead, it puts some of its mathematical prowess into play. + +``` +$ date | awk '{print $4-$3-$2}' +1997 +``` + +In this case, it's subtracting 22 (the day of the month) from the year (2019) and simply ignoring "Nov". + +If you want your output to be separated by something other than white space, you can specify your output separator with **OFS** (output field separator) like this: + +``` +$ date | awk '{OFS="-"; print $4,$3,$2}' +2019-Nov-22 +``` + +### Printing simple text + +You can also use **awk** to simply display some text. Of course, if all you want to do is print a line of text, you'd be better off using an **echo** command. On the other hand, as part of an **awk** script, printing some relevant text can be very useful. Here's a practically useless example: + +``` +$ awk 'BEGIN {print "Hello, World" }' +Hello, World +``` + +Here's a more sensible example in which adding a line of text to label your data can help identify what you're looking at: + +``` +$ who | awk 'BEGIN {print "Current logins:"} {print $1}' +Current logins: +shs +nemo +``` + +### Specifying a field separator + +Not all input is going to be separated by white space. If your text is separated by some other character (e.g., commas, colons or semicolons), you can inform **awk** by using the **-F** (input separator) option as shown here: + +``` +$ cat testfile +a:b:c,d:e +$ awk -F : '{print $2,$3}' testfile +b c,d +``` + +Here's a more useful example – pulling a field from the colon-separated **/etc/passwd** file: + +``` +$ awk -F: '{print $1}' /etc/passwd | head -11 +root +daemon +bin +sys +sync +games +man +lp +mail +news +uucp +``` + +### Evaluating content + +You can also evaluate fields using **awk**. If you, for example, want to list only _user accounts_ in **/etc/passwd**, you can include a test for the 3rd field. Here we're only going after UIDs that are 1000 and above: + +``` +$ awk -F":" ' $3 >= 1000 ' /etc/passwd +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +shs:x:1000:1000:Sandra Henry-Stocker,,,:/home/shs:/bin/bash +nemo:x:1001:1001:Nemo,,,:/home/nemo:/usr/bin/zsh +dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash +... +``` + +If you want to add a title for your listing, you can add a BEGIN clause: + +``` +$ awk -F":" 'BEGIN {print "user accounts:"} $3 >= 1000 ' /etc/passwd +user accounts: +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +shs:x:1000:1000:Sandra Henry-Stocker,,,:/home/shs:/bin/bash +nemo:x:1001:1001:Nemo,,,:/home/nemo:/usr/bin/zsh +dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash +``` + +If you want more than one line in your title, you can separate your intended output lines with "\n" (newline characters). + +``` +$ awk -F":" 'BEGIN {print "user accounts\n============="} $3 >= 1000 ' /etc/passwd +user accounts +============= +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +shs:x:1000:1000:Sandra Henry-Stocker,,,:/home/shs:/bin/bash +nemo:x:1001:1001:Nemo,,,:/home/nemo:/usr/bin/zsh +dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash +``` + +### Doing math with awk + +**awk** provides a surprising mathematical ability and can calculate square roots, logs, tangents, etc. + +Here are a couple examples: + +``` +$ awk 'BEGIN {print sqrt(2019)}' +44.9333 +$ awk 'BEGIN {print log(2019)}' +7.61036 +``` + +For more details on **awk**'s mathematical skills, check out [Doing math with awk][3]. + +### awk scripts + +You can also write standalone scripts with **awk**. Here's an example that mimics one of the examples provided earlier, but also counts the number of users with accounts on the system. + +``` +#!/usr/bin/awk -f + +# This line is a comment + +BEGIN { + printf "%s\n","User accounts:" + print "==============" + FS=":" + n=0 +} + +# Now we'll run through the data +{ + if ($3 >= 1000) { + print $1 + n ++ + } +} + +END { + print "==============" + print n " accounts" +} +``` + +Notice how the BEGIN section, which is run only when the script starts, provides a heading, dictates the field separator and sets up a counter to start with 0. The script also includes an END section which only runs after all the lines in the text provided to the script have been processed. It displays the final count of lines that meet the specification in the middle section (third field is 1,000 or larger) + +A long-standing Unix command, **awk** still provides very useful services and remains one of the reasons that I fell in love with Unix many decades ago. + +To see **awk** in action, click below. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3454979/the-many-faces-of-awk.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/2974753/doing-math-with-awk.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md new file mode 100644 index 0000000000..866d5df482 --- /dev/null +++ b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md @@ -0,0 +1,275 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Commands to Find the IP Address of a Domain in the Linux Terminal) +[#]: via: (https://www.2daygeek.com/linux-command-find-check-domain-ip-address/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +5 Commands to Find the IP Address of a Domain in the Linux Terminal +====== + +This tutorial shows you how to verify a domain name’s or computer name IP address from a Linux terminal. + +This tutorial will allow you to check multiple domains at once. + +You may have already used these commands to verify information. + +However, we will teach you how to use these commands effectively to identify multiple domain IP address information from the Linux terminal. + +This can be done using the following 5 commands. + + * **dig Command:** dig is a flexible cli tool for interrogating DNS name servers. + * **host Command:** host is a simple utility for performing DNS lookups. + * **nslookup Command:** Nslookup command is used to query Internet domain name servers. + * **fping Command:** fping command is used to send ICMP ECHO_REQUEST packets to network hosts. + * **ping Command:** ping command is used to send ICMP ECHO_REQUEST packets to network hosts. + + + +To test this, we created a file called “domains-list.txt” and added the below domains. + +``` +# vi /opt/scripts/domains-list.txt + +2daygeek.com +magesh.co.in +linuxtechnews.com +``` + +### Method-1: How to Find a IP Address of the Domain Using the dig Command + +**[dig command][1]** stands for “domain information groper”‘ is a powerful and flexible command-line tool for querying DNS name servers. + +It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. + +Most DNS administrators use dig command to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. + +It also has a batch mode functionality to read search requests from a file. + +``` +# dig 2daygeek.com | awk '{print $1,$5}' + +2daygeek.com. 104.27.157.177 +2daygeek.com. 104.27.156.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/dig-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +dig $server +short +done | paste -d " " - - - +``` + +Once the above script is added to a file. Set the executable permission for the “dig-command.sh” file. + +``` +# chmod +x /opt/scripts/dig-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/dig-command.sh + +2daygeek.com - 104.27.156.177 104.27.157.177 +magesh.co.in - 104.18.35.52 104.18.34.52 +linuxtechnews.com - 104.27.144.3 104.27.145.3 +``` + +If you want to run the above script in one line, use the following script. + +``` +# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do echo $server "-"; dig $server +short; done | paste -d " " - - - +``` + +Alternatively, you can use the following shell script to find the IP address of the multiple domain. + +``` +# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do dig $server | awk '{print $1,$5}'; done + +2daygeek.com. 104.27.157.177 +2daygeek.com. 104.27.156.177 +magesh.co.in. 104.18.34.52 +magesh.co.in. 104.18.35.52 +linuxtechnews.com. 104.27.144.3 +linuxtechnews.com. 104.27.145.3 +``` + +### Method-2: How to Find a Domain’s IP Address Using the host Command + +**[Host Command][2]** is a simple CLI application to perform **[DNS lookup][3]**. + +It is commonly used to convert names to IP addresses and vice versa. + +When no arguments or options are given, host prints a short summary of its command line arguments and options. + +You can view all types of records in the domain by adding a specific option or type of record in the host command. + +``` +# host 2daygeek.com | grep "has address" | sed 's/has address/-/g' + +2daygeek.com - 104.27.157.177 +2daygeek.com - 104.27.156.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/host-command.sh + +for server in `cat /opt/scripts/domains-list.txt` +do host $server | grep "has address" | sed 's/has address/-/g' +done +``` + +Once the above script is added to a file. Set the executable permission for the “host-command.sh” file. + +``` +# chmod +x /opt/scripts/host-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/host-command.sh + +2daygeek.com - 104.27.156.177 +2daygeek.com - 104.27.157.177 +magesh.co.in - 104.18.35.52 +magesh.co.in - 104.18.34.52 +linuxtechnews.com - 104.27.144.3 +linuxtechnews.com - 104.27.145.3 +``` + +### Method-3: How to Find the IP Address of a Domain Using the nslookup Command + +**[nslookup command][4]** is a program for querying Internet **[domain name servers (DNS)][5]**. + +nslookup has two modes, which are interactive and interactive. + +Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. + +Non-interactive mode is used to print just the name and requested information for a host or domain. + +It is a network administration tool that helps diagnose and resolve DNS related issues. + +``` +# nslookup -q=A 2daygeek.com | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 + +104.27.157.177 +104.27.156.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/nslookup-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +nslookup -q=A $server | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 done | paste -d " " - - - +``` + +Once the above script is added to a file. Set the executable permission for the “nslookup-command.sh” file. + +``` +# chmod +x /opt/scripts/nslookup-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/nslookup-command.sh + +2daygeek.com - 104.27.156.177 104.27.157.177 +magesh.co.in - 104.18.35.52 104.18.34.52 +linuxtechnews.com - 104.27.144.3 104.27.145.3 +``` + +### Method-4: How to Find a Domain’s IP Address Using the fping Command + +**[fping command][6]** is a program such as ping, which uses the Internet Control Message Protocol (ICMP) echo request to determine whether a target host is responding. + +fping differs from ping because it allows users to ping any number of host in parallel. Also, hosts can be entered from a text file. + +fping sends an ICMP echo request, moves the next target in a round-robin fashion, and does not wait until the target host responds. + +If a target host replies, it is noted as active and removed from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. + +``` +# fping -A -d 2daygeek.com magesh.co.in linuxtechnews.com + +104.27.157.177 (104.27.157.177) is alive +104.18.35.52 (104.18.35.52) is alive +104.27.144.3 (104.27.144.3) is alive +``` + +### Method-5: How to Find the IP Address of the Domain Using the ping Command + +**[ping command][6]** stands for (Packet Internet Groper) command is a networking utility that used to test the target of a host availability/connectivity on an Internet Protocol (IP) network. + +It’s verify a host availability by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. + +It summarize statistical results based on the packets transmitted, packets received, packet loss, typically including the min/avg/max times. + +``` +# ping -c 2 2daygeek.com | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' + +104.27.157.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/ping-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +ping -c 2 $server | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' +done | paste -d " " - - +``` + +Once the above script is added to a file. Set the executable permission for the “dig-command.sh” file. + +``` +# chmod +x /opt/scripts/ping-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/ping-command.sh + +2daygeek.com - 104.27.156.177 +magesh.co.in - 104.18.35.52 +linuxtechnews.com - 104.27.144.3 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-find-check-domain-ip-address/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/dig-command-check-find-dns-records-lookup-linux/ +[2]: https://www.2daygeek.com/linux-host-command-check-find-dns-records-lookup/ +[3]: https://www.2daygeek.com/category/dns-lookup/ +[4]: https://www.2daygeek.com/nslookup-command-check-find-dns-records-lookup-linux/ +[5]: https://www.2daygeek.com/check-find-dns-records-of-domain-in-linux-terminal/ +[6]: https://www.2daygeek.com/how-to-use-ping-fping-gping-in-linux/ diff --git a/sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md b/sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md new file mode 100644 index 0000000000..9907322467 --- /dev/null +++ b/sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Penguin Subtitle Player for Adding Subtitles to Online Videos) +[#]: via: (https://itsfoss.com/penguin-subtitle-player/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +App Highlight: Penguin Subtitle Player for Adding Subtitles to Online Videos +====== + +I must confess. I am addicted to subtitles. It helps me understand the dialogues completely, specially if some dialogues are in a different accent or in a different language. + +This has led to a habit of watching online videos with subtitles. + +While streaming services like Netflix and Amazon Prime provide subtitles for their content, the same is not true for all the websites. + +I often discover interesting content that are on YouTube, Dailymotion or other websites. And that becomes a problem because most of the time, these videos don’t have subtitles. + +The good news is that you have the possibility to watch any online video content with subtitles and I’ll share that neat little trick with you in this article. + +### Watch any online video with subtitles using Penguin subtitle player + +![][1] + +What the heck is a Subtitle player? + +The [open source video players][2] you use allow you to add subtitles. Players like [VLC allow you to download subtitles automatically][3]. + +But they are video player and their main task is to play video. + +A subtitle player on the other hand has only one task and that is to play subtitles. Confused? Let me explain. + +A subtitle player basically provides an interface where you can add subtitle file and play the subtitles with a semi transparent background. The trick here is that this player will be visible all the time on top of any other application. + +So if you are running the subtitle player even while using a website, it will still be visible. That actually is the trick to watch any online video with subtitles. + +![An external subtitle playing on top of YouTube video][4] + +All you have to do is to find appropriate subtitles from an online website like OpenSubtitles and add it to the subtitle player. Now open the website where you want to watch the video. Play it full screen (if that option is available) and it will feel like that the subtitles are part of the video itself. + +![][5] + +#### Install Penguin subtitle player + +[Penguin][6] is a free and open source subtitle player. It is available for Linux, macOS and Windows. + +If you are using Ubuntu-based distribution, you can [use this PPA][7] to easily install Penguin subtitle player. + +``` +sudo add-apt-repository ppa:nilarimogard/webupd8 +sudo apt update +sudo apt install penguin-subtitle-player +``` + +For other Linux distributions, Windows and macOS, you can download the installer files from SourceForge: + +[Download Penguin Subtitle Player][8] + +#### Using Penguin subtitle player + +Once you have installed the application, look for it in the menu and start it. You’ll see an interface like this: + +![Penguin Subtitle Player Interface][9] + +If you have already downloaded the .srt subtitle file, you can add it to the player by clicking the folder icon. + +![Add Subtitle In Penguin Subtitle Player][10] + +You can play/pause the subtitles, skip it to a new time. This helps in adjusting the subtitles with the video. + +![Adjust Subtitle In Penguin Subtitle Player][11] + +You can also tweak the appearance of the subtitles and subtitle player. + +![Configure Penguin Subtitle Player][12] + +You also have the option to change the fonts, font size and color of the subtitle text. You may also increase or decrease the transparency and color of the background. + +![Config Options In Penguin Subtitle Player][13] + +You can also resize the subtitle player interface and move it around anywhere on the screen. + +#### Keep in mind + +There are a few things to keep in mind while using Penguin subtitle player. + +Not all video files and subtitle files are made for each other. Subtitle synchronization is a common problem so you’ll have to make sure that the subtitle you downloaded is best suited for the video you want to play. + +Most video players, even the one embedded on the websites, allow to pause and play the video with the space key. Unfortunately, there is no keyboard shortcut to pause the Penguin subtitle player. In other words, you cannot pause the video and the subtitle player in one keystroke. + +With this much configuration, you should be set for watching online videos with subtitles. + +I hope you enjoy this nifty little open source application. Do let me know whether you find it useful or not. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/penguin-subtitle-player/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Add_subtitle_online_videos.png?ssl=1 +[2]: https://itsfoss.com/video-players-linux/ +[3]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/penguin_subtitle_player.jpg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2015/05/Penguin_Subtitle_Player.jpg?ssl=1 +[6]: https://github.com/carsonip/Penguin-Subtitle-Player +[7]: https://itsfoss.com/ppa-guide/ +[8]: https://sourceforge.net/projects/penguinsubtitleplayer/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/penguin-subtitle-player-interface.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/add_subtitle_in_penguin_subtitle_player.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/adjust_subtitle_in_penguin_subtitle_player.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/configure_penguin_subtitle_player.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/config_options_in_penguin_subtitle_player.jpg?ssl=1 diff --git a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md new file mode 100644 index 0000000000..32d467465a --- /dev/null +++ b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Calculator N+ is an open source scientific calculator for your smartphone) +[#]: via: (https://opensource.com/article/19/11/calculator-n-mobile) +[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) + +Calculator N+ is an open source scientific calculator for your smartphone +====== +The Android app does a wide range of advanced mathematical functions in +the palm of your hand. +![scientific calculator][1] + +Mobile phones are becoming more powerful every day, so it is no surprise that they can beat most computers from the not-so-distant past. This also means the tools available on them are getting more powerful every day. + +Previously, I wrote about [scientific calculators for the Linux desktop][2], and I'm following that up here with information about [Calculator N+][3], an awesome GPL v3.0-licensed computer algebra system (CAS) app for Android devices. + +Calculator N+ is presented as a "powerful calculator for Android," but that's a humble statement; the app not only works with arbitrary precision, displaying results with roots and fractions in all their glory, it does a _lot_ more. + +Finding polynomial roots? Check. Factorization? Check. Symbolic derivatives, integrals, and limits? Check. Number theory (modular arithmetic, combinatorics, prime factorization)? Check. + +You can also solve systems of equations, simplify expressions (including trigonometric ones), convert units… you name it! + +![Calculator N+ graphical interface][4] + +Results are output in LaTeX. The menu in the top-left provides many powerful functions ready to use with a simple touch. Also in that menu, you'll find Help files for all of the app's functions. At the top-right of the screen, you can toggle between exact and decimal representation. Finally, tapping the blue bar at the bottom of the screen gives you access to the whole library of functions available in the app. But be careful! If you are not a mathematician, physicist, or engineer, such a long list may seem overwhelming. + +All of this power comes from the [Symja library][5], another great GPL 3 project. + +Both projects are under active development, and they are getting better with each version. In particular, version 3.4.6 of Calculator N+ gets a major leap in user interface (UI) quality. And yes, there are still some rough corners here and there, but taming this much power in the tiny UI of a smartphone is a difficult task, and I think the app developers are solving its remaining issues quite well. Kudos to them! + +If you are a teacher, a student, or work on a STEM field, check out Calculator N+. It's free, no ads, open source, and covers all your math needs. (Except, of course, during math exams, where smartphones should never be allowed to prevent cheating.) + +Calculator N+ is available in the [Google Play Store][6], or you can [build it from source code][7] using the instructions on the GitHub page. + +If you know any other useful open source apps for science or engineering, let us know in the comments. + +The app makes use of the sensors on your phone and offers a digital science notebook to record your... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/calculator-n-mobile + +作者:[Ricardo Berlasso][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rgb-es +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://opensource.com/article/18/1/scientific-calculators-linux +[3]: https://github.com/tranleduy2000/ncalc +[4]: https://opensource.com/sites/default/files/uploads/calculatornplus_sqrt-frac.png (Calculator N+ graphical interface) +[5]: https://github.com/axkr/symja_android_library +[6]: https://play.google.com/store/apps/details?id=com.duy.calculator.free +[7]: https://github.com/tranleduy2000/ncalc/blob/master/README.md diff --git a/sources/tech/20191126 Make Lua development easy with Luarocks.md b/sources/tech/20191126 Make Lua development easy with Luarocks.md new file mode 100644 index 0000000000..23a636b826 --- /dev/null +++ b/sources/tech/20191126 Make Lua development easy with Luarocks.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make Lua development easy with Luarocks) +[#]: via: (https://opensource.com/article/19/11/getting-started-luarocks) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Make Lua development easy with Luarocks +====== +Luarocks makes it easy to get started with Lua, a lightweight, +efficient, and embeddable scripting language. +![Coding on a computer][1] + +Bash too basic? Too much whitespace in Python? Go too corporate? + +You should try Lua, a lightweight, efficient, and embeddable scripting language supporting procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. And best of all, it uses explicit syntax for scoping! + +Lua is also small. Lua's source code is just 24,000 lines of C, the Lua interpreter (on 64-bit Linux) built with all standard Lua libraries is 247K, and the Lua library is 421K. + +You might think that such a small language must be too simplistic to do any real work, but in fact Lua has a vast collection of third-party libraries (including GUI toolkits), it's used extensively in video game and film production for 3D shaders, and is a common scripting language for video game engines. To make it easy to get started with Lua, there's even a package manager called [Luarocks][2]. + +### What is Luarocks? + +Python has PIP, Ruby has Gems, Java has Maven, Node has npm, and Lua has Luarocks. Luarocks is a website and a command. The website is home to open source libraries available for programmers to add to their Lua projects. The command searches the site and installs libraries (defined as "rocks") upon demand. + +### What is a programming library? + +If you're new to programming, you might think of a "library" as just a place where books are stored. Programming libraries ("lib" or "libs" for short) are a little like a book library in the sense that both of these things contain information that someone else has already worked to discover, and which you can borrow so you have to do less work. + +For example, if you were writing code that measures how much stress a special polymer can withstand before breaking, you might think you'd have to be pretty clever with math. But if there was already an open source library specifically designed for exactly that sort of calculation, then you could include that library in your code and let it solve that problem for you (provided you give the library's internal functions the numbers it needs in order to perform an accurate calculation). + +In open source programming, you can install libraries freely and use other people's work at will. Luarocks is the mechanism for Lua that makes it quick and easy to find and use a Lua library. + +### Installing Luarocks + +The **luarocks** command isn't actually _required_ to use packages from the Luarocks website, but it does keep you from having to leave your text editor and venture onto the worldwide web [of potential distractions]. To install Luarocks, you first need to install Lua. + +Lua is available from [lua.org][3] or, on Linux, from your distribution's software repository. For example, on Fedora, CentOS, or RHEL: + + +``` +`$ sudo dnf install lua` +``` + +On Debian and Ubuntu: + + +``` +`$ sudo apt install lua` +``` + +On Windows and Mac, you can download and install Lua from the website. + +Once Lua is installed, install Luarocks. If you're on Linux, the **luarocks** command is available in your distribution's repository. + +On Mac, you can install it with [Brew][4] or compile from source: + + +``` +$ wget +$ tar zxpf luarocks-X.Y.Z.tar.gz +$ cd luarocks-X.Y.Z +$ ./configure; sudo make bootstrap +``` + +On Windows, follow the [install instructions][5] on the Luarocks wiki. + +### Search for a library with Luarocks + +The typical usage of the **luarocks** command, from the perspective of a user rather than a developer, involves searching for a library required by some Lua application you want to run and installing that library. + +To search for the Lua package **luasec** (a library providing HTTPS support for **luarocks**), try this command: + + +``` +$ luarocks search luasec +Warning: falling back to curl - +install luasec to get native HTTPS support + +Search results: +=============== + +Rockspecs and source rocks: +\--------------------------- + +luasec +   0.9-1 (rockspec) - +   0.9-1 (src) - +   0.8.2-1 (rockspec) - +[...] +``` + +### Install a library with Luarocks + +To install the **luasec** library: + + +``` +$ luarocks install --local luasec +[...] +gcc -shared -o ssl.so -L/usr/lib64 +src/config.o src/ec.o src/x509.o [...] +-L/usr/lib -Wl,-rpath,/usr/lib: -lssl -lcrypto + +luasec 0.9-1 is now installed in +/home/seth/.luarocks (license: MIT) +``` + +You can install Lua libraries locally or on a systemwide basis. A _local_ install indicates that the Lua library you install is available to you, but no other user of the computer. If you share your computer with someone else, and you each have your own [login account][6], then you probably want to install a library systemwide. However, if you're the only user of your computer, it's a good habit to install libraries locally, if only because that's the appropriate method when you develop with Lua. + +If you're _developing_ a Lua application, then you probably want to install a library to a project directory instead. In Luarocks terminology, this is a _tree_. Your default tree when installing libraries locally is **$HOME/.luarocks**, but you can redefine it arbitrarily. + + +``` +$ mkdir local +$ luarocks --tree=./local install cmark +Installing +gcc -O2 -fPIC -I/usr/include -c cmark_wrap.c [..] +gcc -O2 -fPIC -I/usr/include -c ext/blocks.c -o ext/blocks.o [..] +[...] +No existing manifest. Attempting to rebuild... +cmark 0.29.0-1 is now installed in +/home/seth/downloads/osdc/example-lua/./local +(license: BSD2) +``` + +The library (in this example, the **cmark** library) is installed to the path specified by the **\--tree** option. You can verify it by listing the contents of the destination: + + +``` +$ find ./local/ -type d -name "cmark" +./local/share/lua/5.1/cmark +./local/lib/luarocks/rocks/cmark +``` + +You can use the library in your Lua code by defining the **package.path** variable to point to your local rocks directory: + + +``` +package.path = package.path .. ';local/share/lua/5.3/?.lua' + +require("cmark") +``` + +### Getting information about an installed rock + +You can see information about an installed rock with the **show** option: + + +``` +$ luarocks show luasec +LuaSec 0.9-1 - A binding for OpenSSL library +to provide TLS/SSL communication over LuaSocket. + +This version delegates to LuaSocket the TCP +connection establishment between +the client and server. Then LuaSec uses this +connection to start a secure TLS/SSL session. + +License:        MIT +Homepage:       +Installed in:   /home/seth/.luarocks +[...] +``` + +This provides you with a summary of what a library provides from a user's perspective, displays the project homepage in case you want to investigate further, and shows you where the library is installed. In this example, it's installed in my home directory in a **.luarocks** folder. This assures me that it's installed locally, which means that if I migrate my home directory to a different computer, I'll retain my Luarocks configuration and installs. + +### Get a list of installed rocks + +You can list all installed rocks on your system with the **list** option: + + +``` +$ luarocks list + +Installed rocks: +\---------------- + +luasec +   0.9-1 (installed) - /home/seth/.luarocks/lib/luarocks/rocks + +luasocket +   3.0rc1-2 (installed) - /home/seth/.luarocks/lib/luarocks/rocks + +luce +   scm-0 (installed) - /home/seth/.luarocks/lib/luarocks/rocks + +tekui +   1.07-1 (installed) - /home/seth/.luarocks/lib/luarocks/rocks +``` + +This displays the rocks you have installed in the default install location. Developers can override this by using the **\--tree** option to redefine the active tree. + +### Remove a rock + +If you want to remove a rock, you can do that with Luarocks using the **remove** option: + + +``` +`$ luarocks remove --local cmark` +``` + +This removes a library (in this example, the **cmark** library) from your local tree. Developers can override this by using the **\--tree** option to redefine the active tree. + +If you want to remove _all_ the rocks you have installed, use the **purge** option instead. + +### Luarocks rocks + +Whether you're a user exploring exciting new Lua applications and need to install some dependencies or you're a developer using Lua to create exciting new applications, Luarocks makes your job easy. Lua is a beautiful and simple language, and Luarocks is perfectly suited to be its package manager. Give both a try today! + +Discussing Tarantool this year at the Percona Live Data Performance Conference. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/getting-started-luarocks + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://luarocks.org +[3]: http://lua.org +[4]: http://brew.sh +[5]: https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Windows +[6]: https://opensource.com/article/19/11/add-user-gui-linux diff --git a/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md new file mode 100644 index 0000000000..853ad5c501 --- /dev/null +++ b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create virtual machines with Cockpit in Fedora) +[#]: via: (https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/) +[#]: author: (Karlis KavacisPaul W. Frields https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/) + +Create virtual machines with Cockpit in Fedora +====== + +![][1] + +This article shows you how to install the software you need to use Cockpit to create and manage virtual machines on Fedora 31. Cockpit is [an interactive admin interface][2] that lets you access and manage systems from any supported web browser. With [virt-manager being deprecated][3] users are encouraged to use Cockpit instead, which is meant to replace it. + +Cockpit is an actively developed project, with many plugins available that extend how it works. For example, one such plugin is “Machines,” which interacts with libvirtd and lets users create and manage virtual machines. + +### Installing software + +The required software prerequisites are _libvirt_, _cockpit_ and _cockpit-machines_. To install them on Fedora 31, run the following command from a terminal [using sudo][4]: + +``` +$ sudo dnf install libvirt cockpit cockpit-machines +``` + +Cockpit is also included as part of the “Headless Management” package group. This group is useful for a Fedora based server that you only access through a network. In that case, to install it, use this command: + +``` +$ sudo dnf groupinstall "Headless Management" +``` + +### Setting up Cockpit services + +After installing the necessary packages it’s time to enable the services. The _libvirtd_ service runs the virtual machines, while Cockpit has a socket activated service to let you access the Web GUI: + +``` +$ sudo systemctl enable libvirtd --now +$ sudo systemctl enable cockpit.socket --now +``` + +This should be enough to run virtual machines and manage them through Cockpit. Optionally, if you want to access and manage your machine from another device on your network, you need to expose the service to the network. To do this, add a new rule in your firewall configuration: + +``` +$ sudo firewall-cmd --zone=public --add-service=cockpit --permanent +$ sudo firewall-cmd --reload +``` + +To confirm the services are running and no issues occurred, check the status of the services: + +``` +$ sudo systemctl status libvirtd +$ sudo systemctl status cockpit.socket +``` + +At this point everything should be working. The Cockpit web GUI should be available at or . Or, enter the local network IP in a web browser on any other device connected to the same network. (Without SSL certificates setup, you may need to allow a connection from your browser.) + +### Creating and installing a machine + +Log into the interface using the user name and password for that system. You can also choose whether to allow your password to be used for administrative tasks in this session. + +Select _Virtual Machines_ and then select _Create VM_ to build a new box. The console gives you several options: + + * Download an OS using Cockpit’s built in library + * Use install media already downloaded on the system you’re managing + * Point to a URL for an OS installation tree + * Boot media over the network via the [PXE][5] protocol + + + +Enter all the necessary parameters. Then select _Create_ to power up the new virtual machine. + +At this point, a graphical console appears. Most modern web browsers let you use your keyboard and mouse to interact with the VM console. Now you can complete your installation and use your new VM, just as you would [via virt-manager in the past][6]. + +* * * + +_Photo by [Miguel Teixeira][7] on [Flickr][8] (CC BY-SA 2.0)._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/ + +作者:[Karlis KavacisPaul W. Frields][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/create-vm-cockpit-816x345.jpg +[2]: https://cockpit-project.org/ +[3]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/rhel-8_0_0_release#virtualization_4 +[4]: https://fedoramagazine.org/howto-use-sudo/ +[5]: https://en.wikipedia.org/wiki/Preboot_Execution_Environment +[6]: https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/ +[7]: https://flickr.com/photos/miguelteixeira/ +[8]: https://flickr.com/photos/miguelteixeira/2964851828/ diff --git a/sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md b/sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md new file mode 100644 index 0000000000..fa82225b79 --- /dev/null +++ b/sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Manage Remote Windows Host using Ansible) +[#]: via: (https://www.linuxtechi.com/manage-windows-host-using-ansible/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Manage Remote Windows Host using Ansible +====== + +**Ansible** is increasingly becoming the go-to platform for application deployment, and software provisioning among developers owing to its ease of use and flexibility. Furthermore, it is easy to set up and no agent is required to be installed on remote nodes, instead, Ansible uses password less SSH authentication to manage remote Unix/Linux hosts. In this topic, however, we are going to see how you can manage Windows Host using Ansible. + +[![Manage-Windows-Hosts-using-Ansible][1]][2] + +**Lab setup** + +We shall use the setup below to accomplish our objective + + * Ansible Control node   –    CentOS 8          –     IP: 192.168.43.13 + * Windows 10 node         –    Windows 10     –     IP: 192.168.43.147 + + + +### Part 1: Installing Ansible on the Control node (CentOS 8) + +Before anything else, we need to get Ansible installed on the Control node which is the CentOS 8 system. + +#### Step 1: Verify that Python3 is installed on Ansible control node + +Firstly, we need to confirm if Python3 is installed. CentOS 8 ships with Python3 but if it’s missing for any reason, install using the command: + +``` +# sudo dnf install python3 +``` + +Next, make Python3 the default Python version by running: + +``` +# sudo alternatives --set python /usr/bin/python3 +``` + +To verify if python3 is installed, run the command: + +``` +# python --version +``` + +**![check-python-version][1] ** + +**Read Also :** **[How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8][3]** + +#### Step 2: Install a virtual environment for running Ansible + +For this exercise, an isolated environment for running and testing Ansible is preferred. This will keep at bay issues such as dependency problems and package conflicts. The isolated environment we are going to create is called a virtual environment. + +Firstly, let’s begin with the installation of the virtual environment on CentOS 8. + +``` +# sudo dnf install python3-virtualenv +``` + +![install-python3-virtualenv][1] + +After the installation of the virtual environment, create a virtual workspace by running: + +``` +# virtualenv env +``` + +![virtualenv-env-ansible][1] + +``` +# source env/bin/activate +``` + +![source-env-bin-activate-ansible][1] + +Great! Observer that the prompt has now changed to (env). + +#### Step 3: Install Ansible + +After the creation of the virtual environment, proceed and install Ansible automation tool using pip as shown: + +``` +# pip install ansible +``` + +![pip-install-Ansible][1] + +You can later confirm the installation of Ansible using the command: + +``` +# ansible --version +``` + +![check-ansible-version][1] + +To test Ansible and see if it’s working on our Ansible Control server run: + +``` +# ansible localhost -m ping +``` + +![Test-ansible-for-connectivity][1] + +Great! Next, we need to define the Windows host or system on a host file on the Ansible control node. Therefore, open the default hosts file + +``` +# vim /etc/ansible/hosts +``` + +Define the Windows hosts as shown below. + +![Ansible-hosts-file][1] + +**Note:** The username and password point to the user on the Windows host system. + +Next, save and exit the configuration file. + +#### Step 4: Install Pywinrm + +Unlike in Unix systems where Ansible uses SSH to communicate with remote hosts, with Windows it’s a different story altogether. To communicate with Windows hosts, you need to install Winrm. + +To install winrm, once again, use pip tool as shown: + +``` +# pip install pywinrm +``` + +![install-pywinrm][1] + +### Part 2: Configuring Windows Host + +In this section, we are going to configure our Windows 10 remote host system to connect with the Ansible Control node. We are going to install the **WinRM listener-** short for **Windows Remote** – which will allow the connection between the Windows host system and the Ansible server. + +But before we do so, your Windows host system needs to fulfill a few requirements for the installation to succeed: + + * Your Windows host system should be **Windows 7 or later**. For Servers, ensure that you are using **Windows Server 2008** and later versions. + * Ensure your system is running **.NET Framework 4.0** and later. + * Windows **PowerShell** should be Version 3.0 & later + + + +With all the requirements met, now follow the steps stipulated below: + +#### Step 1: Download the WinRM script on Windows 10 host + +WinRM can be installed using a script that you can download from this [link][4]. Copy the entire script and paste it onto the notepad editor. Thereafter, ensure you save the WinRM script at the most convenient location. In our case, we have saved the file on the Desktop under the name  ConfigureRemotingForAnsible.ps1 + +#### Step 2: Run the WinRM script on Windows 10 host + +Next, run PowerShell as the Administrator + +![Run-PowerShell-as-Administrator][1] + +Navigate to the script location and run it. In this case, we have navigated to the Desktop location where we saved the script. Next, proceed and execute the WinRM script on the WIndows host: + +``` +.\ConfigureRemotingForAnsible.ps1 +``` + +This takes about a minute and you should get the output shown below. The output shows that WinRM has successfully been installed. + +![set-up-WinRM-on-Windows10][1] + +### Part 3: Connecting to Windows Host from Ansible Control Node + +To test connectivity to the Windows 10 host, run the command: + +``` +# ansible winhost -m win_ping +``` + +![Ansible-ping-windows-host-machine][1] + +The output shows that we have indeed established a connection to the remote Windows 10 host from the Ansible Control node. This implies that we can now manage the remote Windows host using Ansible Playbooks. Let’s create a sample playbook for the Windows host system. + +### Part 4: Creating and running a playbook for Windows 10 host + +In this final section, we shall create a playbook and create a task that will install Chocolatey on the remote host. Chocolatey is a package manager for Windows system. The play is defined as shown: + +``` +# vim chocolatey.yml +--- +- host: winhost + gather_facts: no + tasks: + - name: Install Chocolatey on Windows10 + win_chocolatey: name=procexp status=present +``` + +![Ansible-Playbook-install-chocolatey][1] + +Save and close the yml file. Next, execute the playbook as shown + +``` +# ansible-playbook chocolatey.yml +``` + +![Ansible-playBook-succeeded][1] + +The output is a pointer that all went well. And this concludes this topic on how you can manage Windows host using Ansible. + + * [Facebook][5] + * [Twitter][6] + * [LinkedIn][7] + * [Reddit][8] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/manage-windows-host-using-ansible/ + +作者:[James Kiarie][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.linuxtechi.com/wp-content/uploads/2019/11/Manage-Windows-Hosts-using-Ansible.jpg +[3]: http://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ +[4]: https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 +[5]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&t=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible +[6]: http://twitter.com/share?text=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible&url=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&via=Linuxtechi +[7]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&title=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible +[8]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&title=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible diff --git a/sources/tech/20191127 How to write a Python web API with Flask.md b/sources/tech/20191127 How to write a Python web API with Flask.md new file mode 100644 index 0000000000..e3d7a7790e --- /dev/null +++ b/sources/tech/20191127 How to write a Python web API with Flask.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Flask) +[#]: via: (https://opensource.com/article/19/11/python-web-api-flask) +[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) + +How to write a Python web API with Flask +====== +Use Flask, one of the fastest-growing Python frameworks, to fetch data +from a server, in this quick tutorial. +![spiderweb diagram][1] + +[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. + +[Flask][3] is a customizable Python framework that gives developers complete control over how users access data. Flask is a "micro-framework" based on Werkzeug's [WSGI][4] toolkit and Jinja 2's templating engine. It is designed as a web framework for RESTful API development. + +Flask is one of the fastest-growing Python frameworks, and popular websites, including Netflix, Pinterest, and LinkedIn, have incorporated Flask into their development stacks. Here's an example of how Flask can permit users to fetch data from a server using the HTTP GET method. + +### Set up a Flask application + +First, create a structure for your Flask application. You can do this at any location on your system. + + +``` +$ mkdir tutorial +$ cd tutorial +$ touch main.py +$ python3 -m venv env +$ source env/bin/activate +(env) $ pip3 install flask-restful +Collecting flask-restful +Downloading +Collecting Flask>=0.8 (from flask-restful) +[...] +``` + +### Import the Flask modules + +Next, import the **flask** module and its **flask_restful** library into your **main.py** code: + + +``` +from flask import Flask +from flask_restful import Resource, Api + +app = Flask(__name__) +api = Api(app) + +class Quotes(Resource): +    def get(self): +        return { +            'William Shakespeare': { +                'quote': ['Love all,trust a few,do wrong to none', +                'Some are born great, some achieve greatness, and some greatness thrust upon them.'] +        }, +        'Linus': { +            'quote': ['Talk is cheap. Show me the code.'] +            } +        } + +api.add_resource(Quotes, '/') + +if __name__ == '__main__': +    app.run(debug=True) +``` + +### Run the app + +Flask includes a built-in HTTP server for testing. Test the simple API you built: + + +``` +(env) $ python main.py + * Serving Flask app "main" (lazy loading) + * Environment: production +   WARNING: This is a development server. Do not use it in a production deployment. +   Use a production WSGI server instead. + * Debug mode: on + * Running on (Press CTRL+C to quit) +``` + +Starting the development server starts your Flask application, which contains a method named **get** to respond to a simple HTTP GET request. You can test it using **wget** or **curl** or any web browser. The URL to use is provided in Flask's output after you start the server. + + +``` +$ curl +{ +    "William Shakespeare": { +        "quote": [ +            "Love all,trust a few,do wrong to none", +            "Some are born great, some achieve greatness, and some greatness thrust upon them." +        ] +    }, +    "Linus": { +        "quote": [ +            "Talk is cheap. Show me the code." +        ] +    } +} +``` + +To see a more complex version of a similar web API using Python and Flask, navigate to the Library of Congress' [Chronicling America][5] website, which provides access to information about historic newspapers and digitized newspaper pages. + +### Why use Flask? + +Flask has several major benefits: + + 1. Python is popular and widely used, so anyone who knows Python can develop for Flask. + 2. It's lightweight and minimalistic. + 3. Built with security in mind. + 4. Great documentation with plenty of clear, working example code. + + + +There are also some potential drawbacks: + + 1. It's lightweight and minimalistic. If you're looking for a framework with lots of bundled libraries and prefabricated components, this may not be your best option. + 2. If you have to build your own framework around Flask, you might find that the cost of maintaining your customization negates the benefit of using Flask. + + + +If you're looking to build a web app or API, Flask is a good option to consider. It's powerful and robust, and the project documentation makes it easy to get started. Try it out, evaluate it, and see if it's right for your project. + +Learn more in this lesson in Python exception handling and how to do it in a secure manner. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/python-web-api-flask + +作者:[Rachel Waston][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rachelwaston +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-cms-build-howto-tutorial.png?itok=bRbCJt1U (spiderweb diagram) +[2]: https://www.python.org/ +[3]: https://palletsprojects.com/p/flask/ +[4]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface +[5]: https://chroniclingamerica.loc.gov/about/api diff --git a/sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md b/sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md new file mode 100644 index 0000000000..0c480bc6ea --- /dev/null +++ b/sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Monitoring Linux and Windows hosts with Glances) +[#]: via: (https://opensource.com/article/19/11/monitoring-linux-glances) +[#]: author: (David Both https://opensource.com/users/dboth) + +Monitoring Linux and Windows hosts with Glances +====== +The Glances tool offers more information about system performance than +other sysadmin monitoring tools. +![Code going into a computer.][1] + +Sysadmins have many tools to view and manage running processes. For me, these primarily used to be **top**, **atop**, and **htop**. A few years ago, I found [Glances][2], a tool that displays information that none of my other favorites do. All of these tools monitor CPU and memory usage, and most of them list information about running processes (at the very least). However, Glances also monitors filesystem I/O, network I/O, and sensor readouts that can display CPU and other hardware temperatures as well as fan speeds and disk usage by hardware device and logical volume. + +### Glances + +I mentioned Glances in my article [_4 open source tools for Linux system monitoring_][3], but I will delve into it more deeply in this article. If you read my previous article, some of this information may be familiar, but you should also find some new things here. + +Glances is cross-platform because it is written in Python. It can be installed on Windows and other hosts with current versions of Python installed. Most Linux distributions (Fedora in my case) have Glances in their repositories. If not, or if you are using a different operating system (such as Windows), or you just want to get it right from the source, you can find instructions for downloading and installing it in [Glances' GitHub repo][4]. + +I suggest running Glances on a test machine while you try the commands in this article. If you don't have a physical host available for testing, you can explore Glances on a virtual machine (VM), but you won't see the hardware sensors section; after all, a VM has no real hardware. + +To start Glances on a Linux host, open a terminal session and enter the command **glances**. + +Glances has three main sections—Summary, Process, and Alerts—as well as a sidebar. I'll explore them and other details for using Glances now. + +### Summary section + +In its top few lines, Glances' Summary section contains much of the same information as you'll find in other monitors' summary sections. If you have enough horizontal space in your terminal, Glances can show CPU usage with both a bar graph and a numeric indicator; otherwise it will show only the number. + +I like Glances' Summary section better than the ones in other monitors (like **top**); I think it provides the right information in an easily understandable format. + +![Glances display][5] + +The Glances display on a busy Linux host. In the interest of clarity, not all possible displays are shown in the left sidebar. + +The Summary section above provides an overview of the system's status. The first line shows the hostname, the Linux distribution, the kernel version, and the system uptime. + +The next four lines display CPU, memory usage, swap, and load statistics. The left column displays the percentages of CPU, memory, and swap space that are in use. It also shows the combined statistics for all CPUs present in the system. + +Press the **1** key to toggle between the consolidated CPU usage display and the display of the individual CPUs. The following image shows the Glances display with individual CPU statistics. + +![Glances display][6] + +Glances showing the individual CPU statistics. + +This view includes some additional CPU statistics. In either display mode, the descriptions of the CPU usage fields can help you interpret the data displayed in the CPU section. Notice that CPUs are numbered starting at 0 (Zero). + +**CPU** | This is the current CPU usage as a percentage of the total available. +---|--- +**user** | These are the applications and other programs running in user space, i.e., not in the kernel. +**system** | These are kernel-level functions. It does not include CPU time taken by the kernel itself, just the kernel system calls. +**idle** | This is the idle time, i.e., time not used by any running process. +**nice** | This is the time used by processes that are running at a positive, nice level. +**irq** | These are the interrupt requests that take CPU time. +**iowait** | These are CPU cycles that are spent waiting for I/O to occur—this is wasted CPU time. +**steal** | The percentage of CPU cycles that a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor. +**ctx-sw** | These are the number of context switches per second; it represents the number of times per second that the CPU switches from running one process to another. +**inter** | This is the number of hardware interrupts per second. A hardware interrupt occurs when a hardware device, such as a hard drive, tells a CPU that it has completed a data transfer or that a network interface card is ready to accept more data. +**sw_int** | Software interrupts tell the CPU that some requested task has completed or that the software is ready for something. These tend to be more common in kernel-level software. + +#### About nice numbers + +Nice numbers are the mechanism used by administrators to affect the priority of a process. It is not possible to change the priority of a process directly, but changing the nice number can modify the results of the kernel scheduler’s priority setting algorithm. Nice numbers run from -20 to +19 where higher numbers are nicer. The default nice number is 0 and the default priority is 20. Setting the nice number higher than zero increases the priority number somewhat, thus making the process nicer and therefore less greedy of CPU cycles. Setting the nice number to a more negative number results in a lower priority number making the process less nice. Nice numbers can be changed using the renice command or from within top, atop, and htop. + +#### Memory + +The Memory portion of the Summary section contains statistics about memory usage. + +**MEM** | This shows the memory usage as a percent of the total amount available. +---|--- +**total** | This is the total amount of RAM memory installed in the host, less any amount assigned to the display adapter. +**used** | This is the total amount of memory in use by the system and application programs but not including cache or buffers. +**free** | This is the amount of free memory. +**active** | This is the amount of actively used memory—inactive memory is subject to swapping to disk should the need arise. +**inactive** | This is memory that is in use but that has not been accessed for some time. +**buffers** | This is memory that is used for buffer space; it is usually used by communications and I/O such as networking. The data is received and stored until the software can retrieve it for use or it can be sent to a storage device or transmitted out to the network. +**cached** | This is the memory used to store data for disk transfer until it can be used by a program or stored to disk. + +The Swap section is self-explanatory if you understand a bit about swap space and how it works. This shows how much total swap space is available, how much is used, and how much is left. + +The Load part of the Summary section displays the one-, five-, and 15-minute load averages. + +You can use the numeric keys **1**, **3**, **4**, and **5** to alter your view of the data in this section. The **2** key toggles the left sidebar on and off. + +#### More about load averages + +Load averages are commonly misunderstood, even though they are a key criterion for measuring CPU usage. But what does it really mean when I say that the one- (or five- or 10-) minute load average is 4.04, for example? Load average can be considered a measure of demand for the CPU; it is a number that represents the average number of instructions waiting for CPU time, so it is a true measure of CPU performance. + +For example, a fully utilized single-processor system CPU would have a load average of 1. This means that the CPU is keeping up exactly with demand; in other words, it has perfect utilization. A load average of less than 1 means the CPU is underutilized, and a load average greater than 1 means the CPU is overutilized and that there is pent-up, unsatisfied demand. For example, a load average of 1.5 in a single-CPU system indicates that one-third of the CPU instructions must wait to be executed until the preceding one has completed. + +This is also true for multiple processors. If a four-CPU system has a load average of 4, then it has perfect utilization. If it has a load average of 3.24, for example, then three of its processors are fully utilized, and one is utilized at about 24%. In the example above, a four-CPU system has a one-minute load average of 4.04, meaning there is no remaining capacity among the four CPUs, and a few instructions are forced to wait. A perfectly utilized four-CPU system would show a load average of 4.00, meaning that the system is fully loaded but not overloaded. + +The optimum load average condition is for the load average to equal the total number of CPUs in a system. That would mean that every CPU is fully utilized, and no instruction must be forced to wait. But reality is messy, and optimum conditions are seldom met. If a host were running at 100% utilization, this would not allow for spikes in CPU load requirements. + +The longer-term load averages indicate overall utilization trends. + +_Linux Journal_ published an excellent article [about load averages][7], the theory, the math behind them, and how to interpret them, in its December 1, 2006, issue. Unfortunately, _Linux Journal_ has ceased publication, and its archives are no longer available directly, so the link is to a third-party archive. + +#### Finding CPU hogs + +One of the reasons for using a tool like Glances is to find processes that are taking up too much CPU time. Open a new terminal session (different from the one running Glances), and enter and start the following CPU-hogging Bash program. + + +``` +`X=0;while [ 1 ];do echo $X;X=$((X+1));done` +``` + +This program is a CPU hog and will use up every available CPU cycle. Allow it to run while you finish this article and experiment with Glances. It will provide you with an idea of what a program that hogs CPU cycles looks like. Be sure to observe the effects on the load averages over time, as well as the cumulative time in the **TIME+** column for this process. + +### Process section + +The Process section displays standard information about each process that is running. Depending upon the viewing mode and the size of the terminal screen, different columns of information will be displayed for the running processes. The default mode with a wide-enough terminal displays the columns listed below. The columns that are displayed change automatically if the terminal screen is resized. The following columns are typically displayed for each process from left to right. + +**CPU%** | This is the amount of CPU time as a percentage of a single core. For example, 98% represents 98% of the available CPU cycles for a single core. Multiple processes can show up to 100% CPU usage. +---|--- +**MEM%** | This is the amount of RAM memory used by the process as a percentage of the total virtual memory in the host. +**VIRT** | This is the amount of virtual memory used by the process in human-readable format, such as 12M for 12 megabytes. +**RES** | This refers to the amount of physical (resident) memory used by the process. Again, this is in human-readable format, with an indicator of **K**, **M**, or **G**, to specify kilobytes, megabytes, or gigabytes. +**PID** | Every process has an identification number, called the PID. This number can be used in commands, such as **renice** and **kill**, to manage the process. Remember that the **kill** utility can send signals to another process besides the “kill” signal. +**USER** | This is the name of the user that owns the process. +**TIME+** | This indicates the cumulative amount of CPU time accrued by the process since it started. +**THR** | This is the total number of threads currently running for this process. +**NI** | This is the nice number of the process. +**S** | This is the current status; it can be (**R**)unning, (**S**)leeping, (**I**)dle, **T** or **t** when the process is stopped during a debugging trace, or (**Z**)ombie. A zombie is a process that has been killed but has not completely died, so it continues to consume some system resources, such as RAM. +**R/s and W/s** | These are the disk reads and writes per second. +**Command** | This is the command used to start the process. + +Glances usually determines the default sort column automatically. Processes can be sorted automatically (**a**), or by CPU (**c**), memory (**m**), name (**p**), user (**u**), I/O rate (**i**), or time (**t**). Processes are automatically sorted by the most-used resource. In the images above, the **TIME+** column is highlighted. + +### Alerts section + +Glances also shows warnings and critical alerts, including the time and duration of the event, at the bottom of the screen. This can be helpful when you're attempting to diagnose problems and cannot stare at the screen for hours at a time. These alert logs can be toggled on or off with the **l** (lower-case L) key, warnings can be cleared with the **w** key, while alerts and warnings can all be cleared with **x**. + +### Sidebar + +Glances has a very nice sidebar on the left that displays information that is not available in **top** or **htop**. While **atop** displays some of this data, Glances is the only monitor that displays data about sensors. After all, sometimes it is nice to see the temperatures inside your computer. + +The individual modules, disk, filesystem, network, and sensors can be toggled on and off using the **d**, **f**, **n**, and **s** keys, respectively. The entire sidebar can be toggled using **2**. Docker stats can be displayed in the sidebar with **D**. + +Note that hardware sensors are not displayed when Glances is running on a virtual machine. + +### Getting help + +You can get help by pressing the **h** key; dismiss the help page by pressing **h** again. The Help page is rather terse, but it does show the available interactive options and how to turn them on and off. The [man page][8] has terse explanations of the options that can be used when launching Glances. + +You can press **q** or **Esc** to exit Glances. + +### Configuration + +Glances does not require a configuration file to work properly. If you choose to have one, the system-wide instance of the configuration file will be located in **/etc/glances/glances.conf**. Individual users can have a local instance at **~/.config/glances/glances.conf**, which will override the global configuration. The primary purpose of these configuration files is to set thresholds for warnings and critical alerts. You can also specify whether certain modules are displayed by default or not. + +The file **/usr/local/share/doc/glances/README.rst** contains additional useful information, including optional Python modules you can install to support some optional Glances features. + +### Command-line options + +Glances provides command-line options that allow it to start up in specific viewing modes. For example, the command **glances -2** starts the program with the left sidebar disabled. + +### Remote and more + +By starting it in server mode, you can use Glances to monitor remote hosts: + + +``` +`[root@testvm1 ~]# glances -s` +``` + +You can then connect to the server from the client with: + + +``` +`[root@testvm2 ~]# glances -c @testvm1` +``` + +Glances can show a list of Glances servers along with a summary of their activity. It also has a web interface so you can monitor remote Glances servers from a browser. Recent versions of Glances can also display Docker statistics. + +There are also pluggable modules for Glances that provide measurement data not available in the base program. + +### Limitations + +Although Glances can monitor many aspects of a host, it cannot manage processes. It cannot change the nice number of a process nor kill one, as **top** and **htop** can. Glances is not an interactive tool. It is used strictly for monitoring. External tools like **kill** and **renice** can be used to manage processes. + +Glances can only show the processes that are taking the majority of the resource specified, such as CPU time, in the available space. If there is room to list just 10 processes, that is all you will be able to see. Glances does not provide scrolling or reverse-sort options that would enable you to see any other than the top X processes. + +### The impact of measurement + +The [observer effect][9] is a physics theory that states, "simply observing a situation or phenomenon necessarily changes that phenomenon." This is also true when measuring Linux system performance. + +Merely using a monitoring tool alters the system's use of resources, including memory and CPU time. The **top** utility and most other monitors use perhaps 2% tor 3% of a system's CPU time. The Glances utility has much more impact than the others; it usually uses between 10% and 20% of CPU time, and I have seen it use as much as 40% of one CPU in a very large and active system with 32 CPUs. That is a lot, so consider its impact when you think about using Glances as your monitor. + +My personal opinion is that this is a small price to pay when you need the capabilities of Glances. + +### Summary + +Despite its lack of interactive capabilities, such as the ability to **renice** or **kill** processes, and its high CPU load, I find Glances to be a very useful tool. The complete [Glances documentation][10] is available on the internet, and the Glances man page has startup options and interactive command information. + +* * * + +_Parts of this article are based on David Both's new book, _[Using and Administering Linux: Volume 2 – Zero to SysAdmin: Advanced Topics][11].__ + +David Both shares his favorite system monitoring tools for understanding what is going on in any... + +David Both explains the importance of keeping hardware cool and shares some Linux tools that can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/monitoring-linux-glances + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.) +[2]: https://nicolargo.github.io/glances/ +[3]: https://opensource.com/life/16/2/open-source-tools-system-monitoring +[4]: https://github.com/nicolargo/glances/blob/master/README.rst#installation +[5]: https://opensource.com/sites/default/files/uploads/glances-figure-1.png (Glances display) +[6]: https://opensource.com/sites/default/files/uploads/glances-figure-2.png (Glances display) +[7]: https://archive.org/details/Linux-Journal-2006-12/page/n81 +[8]: https://linux.die.net/man/1/glances +[9]: https://en.m.wikipedia.org/wiki/Observer_effect_(physics) +[10]: https://glances.readthedocs.io/en/stable/ +[11]: https://www.apress.com/us/book/9781484250488 diff --git a/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md b/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md new file mode 100644 index 0000000000..788d7e646d --- /dev/null +++ b/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A quick introduction to Toolbox on Fedora) +[#]: via: (https://fedoramagazine.org/a-quick-introduction-to-toolbox-on-fedora/) +[#]: author: (Ryan Walter https://fedoramagazine.org/author/rwaltr/) + +A quick introduction to Toolbox on Fedora +====== + +![][1] + +Toolbox allows you to [sort and manage your development environments in containers][2] without requiring root privileges or manually attaching volumes. It creates a container where you can install your own CLI tools, without installing them on the base system itself. You can also utilize it when you do not have root access or cannot install programs directly. This article gives you an introduction to toolbox and what it does. + +### Installing Toolbox + +[Silverblue][3] includes Toolbox by default. For the Workstation and Server editions, you can grab it from the default repositories using _dnf install toolbox_. + +### Creating Toolboxes + +Open your terminal and run _toolbox enter_. The utility will automatically request permission to download the latest image, create your first container, and place your shell inside this container. + +``` +$ toolbox enter +No toolbox containers found. Create now? [y/N] y +Image required to create toolbox container. +Download registry.fedoraproject.org/f30/fedora-toolbox:30 (500MB)? [y/N]: y +``` + +Currently there is no difference between the toolbox and your base system. Your filesystems and packages appear unchanged. Here is an example using a repository that contains documentation source for a resume under a _~/src/resume_ folder. The resume is built using the _pandoc_ tool. + +``` +$ pwd +/home/rwaltr +$ cd src/resume/ +$ head -n 5 Makefile +all: pdf html rtf text docx + +pdf: init + pandoc -s -o BUILDS/resume.pdf markdown/* + +$ make pdf +bash: make: command not found +$ pandoc -v +bash: pandoc: command not found +``` + +This toolbox does not have the programs required to build the resume. You can remedy this by installing the tools with _dnf_. You will not be prompted for the root password, because you are running in a container. + +``` +$ sudo dnf groupinstall "Authoring and Publishing" -y && sudo dnf install pandoc make -y +... +$ make all #Successful builds +mkdir -p BUILDS +pandoc -s -o BUILDS/resume.pdf markdown/* +pandoc -s -o BUILDS/resume.html markdown/* +pandoc -s -o BUILDS/resume.rtf markdown/* +pandoc -s -o BUILDS/resume.txt markdown/* +pandoc -s -o BUILDS/resume.docx markdown/* +$ ls BUILDS/ +resume.docx resume.html resume.pdf resume.rtf resume.txt +``` + +Run _exit_ at any time to exit the toolbox. + +``` +$ cd BUILDS/ +$ pandoc --version || ls +pandoc 2.2.1 +Compiled with pandoc-types 1.17.5.4, texmath 0.11.1.2, skylighting 0.7.5 +... +for a particular purpose. +resume.docx resume.html resume.pdf resume.rtf resume.txt +$ exit +logout +$ pandoc --version || ls +bash: pandoc: command not found... +resume.docx resume.html resume.pdf resume.rtf resume.txt +``` + +You retain the files created by your toolbox in your home directory. None of the programs installed in your toolbox will be available outside of it. + +### Tips and tricks + +This introduction to toolbox only scratches the surface. Here are some additional tips, but you can also check out [the official documentation][2]. + + * _Toolbox –help_ will show you the man page for Toolbox + * You can have multiple toolboxes at once. Use _toolbox create -c Toolboxname_ and _toolbox enter -c Toolboxname_ + * Toolbox uses [Podman][4] to do the heavy lifting. Use _toolbox list_ to find the IDs of the containers Toolbox creates. Podman can use these IDs to perform actions such as _rm_ and _stop_. (You can also read more about Podman [in this Magazine article][5].) + + + +* * * + +_Photo courtesy of [Florian Richter][6] from [Flickr][7]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/a-quick-introduction-to-toolbox-on-fedora/ + +作者:[Ryan Walter][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rwaltr/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/toolbox-816x345.jpg +[2]: https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/ +[3]: https://fedoramagazine.org/what-is-silverblue/ +[4]: https://podman.io/ +[5]: https://fedoramagazine.org/running-containers-with-podman/ +[6]: https://flickr.com/photos/florianric/ +[7]: https://flickr.com/photos/florianric/7263382550/ diff --git a/sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md b/sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md new file mode 100644 index 0000000000..dd3c603bc4 --- /dev/null +++ b/sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Holiday gift guide: Books for the learner, explorer, or tinkerer on your list) +[#]: via: (https://opensource.com/article/19/11/books-wishlist-2019) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Holiday gift guide: Books for the learner, explorer, or tinkerer on your list +====== +Get our list of books to give as gifts or add to your own wishlist this +holiday season. +![4 books that spell out open][1] + +It is my pleasure to introduce Opensource.com's selection of books that would make excellent holiday gift ideas. We hope you find them interesting items to give as gifts this holiday season or to add to your own holiday wishlist. Each book exhibits qualities that make them excellent gifts for open source enthusiasts, as they all encourage learning, exploring, and tinkering. + +### The Big Book of Maker Camp Projects + +![The Big Book of Maker Camp Projects][2] + +**by Sandy Roberts** + +[_The Big Book of Maker Camp Projects_][3] contains dozens of projects that are perfect for maker camps or individuals looking to tinker. Projects cover a wide range of topics ranging from making faux campfires using LEDs and Circuit Playground Express (CPX) boards to tie-dye t-shirts and other wearable crafts. There are plenty of projects to keep maker camp participants engaged and entertained. + +### How Open Source Ate Software + +* * * + +* * * + +* * * + +**![How Open Source Ate Software ][4]** + +**by Gordon Haff** + +Learn more about the history of open source with [_How Open Source Ate Software_][5]. This brief, 180-page book explores how open source became the phenomenon that it is today. This book is an excellent read for anyone interested in where open source came from and how it changed the way software is developed. + +### The Rust Programming Language + +* * * + +* * * + +* * * + +**![The Rust Programming Language ][6]** + +**by Steve Klabnik and Carol Nichols** + +Learn one of the hot, new programming languages with [_The Rust Programming Language_][7]. Yes, this is a print edition of the exact same book that is installed with Rust and can be read in your browser by running **rustup doc --book**, but a physical book offers some benefits by giving the material inside a little more structure than the free HTML version. It is easier to digest material covered over a two-page spread instead of having to scroll through a long web page. Just be sure to get the edition with "Covers Rust 2018" on the cover, so you get a print copy that covers the latest Rust edition. + +### Secret Coders: The Complete Box Set + +* * * + +* * * + +* * * + +**![Secret Coders][8]** + +**by Gene Luen Yang & Mike Holmes** + +[_Secret Coders: The Complete Box Set_][9] collects all six volumes in the Secret Coder series. This series of graphic novels introduces readers to the world of coding by following the exploits of the three protagonists, Hopper, Eni, and Josh, as they explore coding and fight against the schemes of Dr. One-Zero. Each book in the series builds upon the volumes that precede it, and by the time readers have finished the series, they should have an excellent understanding of basic programming concepts. + +### Thing Explainer + +* * * + +* * * + +* * * + +**![Thing Explainer][10]** + +**by Randall Munroe** + +[_Thing Explainer_][11], by the creator of the [xkcd webcomic][12], is a book in the same vein as David Macaulay's [_The Way Things Work_][13] and similar titles. This book, as one would expect from the title, explains things. Using only the 1,000 most common words in the English language and illustrations, Munroe explains airplanes, tectonic plates, and more. + +### Open role-playing games and dice tower + +![Pathfinder][14] | ![Starfinder][15] +---|--- +![Fate Core][16] | ![Fate Accelerated][17] + +If you would like to spend time with your friends and family having exciting adventures, consider one of several pen-and-paper role-playing games with rules books that are released under an open license. + +For example, Paizo's [_Pathfinder_][18] and [_Starfinder_][19] are released under the [Open Game License][20], and [_Fate Core_][21] and [_Fate Accelerated_][22] from Evil Hat are released under the Open Game License and a Creative Commons Attribution license. + +But these are just a few examples, there are plenty of role-playing games that are [released under an open license][23], so there are games out there for a variety of tastes. You can also pair the rule books with a homemade dice tower using these Creative Commons Attribution-NonCommercial licensed [dice tower plans][24]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/books-wishlist-2019 + +作者:[Joshua Allen Holm][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OSDC_BYU_520x292_FINAL.png?itok=NVY7vR8o (4 books that spell out open) +[2]: https://opensource.com/sites/default/files/uploads/the_big_book_of_maker_camp_projects.jpg (The Big Book of Maker Camp Projects) +[3]: http://www.kaleidoscopeenrichment.com/home/the-big-book-of-maker-camp-projects/ +[4]: https://opensource.com/sites/default/files/uploads/how_open_source_ate_software.jpg (How Open Source Ate Software ) +[5]: https://www.apress.com/us/book/9781484238936 +[6]: https://opensource.com/sites/default/files/uploads/the_rust_programming_language.jpg (The Rust Programming Language ) +[7]: https://nostarch.com/Rust2018 +[8]: https://opensource.com/sites/default/files/uploads/secret_coders_the_complete_boxed_set.jpeg (Secret Coders) +[9]: https://us.macmillan.com/secretcodersthecompleteboxedset/geneluenyang/9781250294685/ +[10]: https://opensource.com/sites/default/files/uploads/thing_explainer.png (Thing Explainer) +[11]: https://xkcd.com/thing-explainer/ +[12]: https://xkcd.com/ +[13]: https://en.wikipedia.org/wiki/The_Way_Things_Work +[14]: https://opensource.com/sites/default/files/uploads/pathfinder_100px.jpg (Pathfinder) +[15]: https://opensource.com/sites/default/files/uploads/starfinder_100px.jpg (Starfinder) +[16]: https://opensource.com/sites/default/files/uploads/fate_core_100px.jpg (Fate Core) +[17]: https://opensource.com/sites/default/files/uploads/fate_accelerated_100px.jpg (Fate Accelerated) +[18]: https://paizo.com/pathfinder +[19]: https://paizo.com/starfinder +[20]: https://en.wikipedia.org/wiki/Open_Game_License +[21]: https://www.evilhat.com/home/fate-core/ +[22]: https://www.evilhat.com/home/fae/ +[23]: https://opensource.com/article/19/5/free-rpg-day +[24]: https://msraynsford.blogspot.com/2016/05/working-dice-tower-with-plans.html diff --git a/sources/tech/20191129 How to write a Python web API with Django.md b/sources/tech/20191129 How to write a Python web API with Django.md new file mode 100644 index 0000000000..ed16fc40f8 --- /dev/null +++ b/sources/tech/20191129 How to write a Python web API with Django.md @@ -0,0 +1,247 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Django) +[#]: via: (https://opensource.com/article/19/11/python-web-api-django) +[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) + +How to write a Python web API with Django +====== +Django is one of the most popular frameworks for Python API development. +Learn how to use it in this quick tutorial. +![Hands on a keyboard with a Python book ][1] + +[Django][2] is the comprehensive web framework by which all other frameworks are measured. One of the most popular names in Python API development, Django has surged in popularity since its start in 2005. + +Django is maintained by the Django Software Foundation and has experienced great community support, with over 11,600 members worldwide. On Stack Overflow, Django has around 191,000 tagged questions. Websites like Spotify, YouTube, and Instagram rely on Django for application and data management. + +This article demonstrates a simple API to fetch data from a server using the GET method of the HTTP protocol. + +### Set up a project + +First, create a structure for your Django application; you can do this at any location on your system: + + +``` +$ mkdir myproject +$ cd myproject +``` + +Then, create a virtual environment to isolate package dependencies locally within the project directory: + + +``` +$ python3 -m venv env +$ source env/bin/activate +``` + +On Windows, use the command **env\Scripts\activate** to activate your Python virtual environment. + +### Install Django and the Django REST framework + +Next, install the Python modules for Django and Django REST: + + +``` +$ pip3 install django +$ pip3 install djangorestframework +``` + +### Instantiate a new Django project + +Now that you have a work environment for your app, you must instantiate a new Django project. Unlike a minimal framework like [Flask][3], Django includes dedicated commands for this process (note the trailing **.** character in the first command): + + +``` +$ django-admin startproject tutorial . +$ cd tutorial +$ django-admin startapp quickstart +``` + +Django uses a database as its backend, so you should sync your database before beginning development. The database can be managed with the **manage.py** script that was created when you ran the **django-admin** command. Because you're currently in the **tutorial** directory, use the **../** notation to run the script, located one directory up: + + +``` +$ python3 ../manage.py makemigrations +No changes detected +$ python4 ../manage.py migrate +Operations to perform: +  Apply all migrations: admin, auth, contenttypes, sessions +Running migrations: +  Applying contenttypes.0001_initial... OK +  Applying auth.0001_initial... OK +  Applying admin.0001_initial... OK +  Applying admin.0002_logentry_remove_auto_add... OK +  Applying admin.0003_logentry_add_action_flag_choices... OK +  Applying contenttypes.0002_remove_content_type_name... OK +  Applying auth.0002_alter_permission_name_max_length... OK +  Applying auth.0003_alter_user_email_max_length... OK +  Applying auth.0004_alter_user_username_opts... OK +  Applying auth.0005_alter_user_last_login_null... OK +  Applying auth.0006_require_contenttypes_0002... OK +  Applying auth.0007_alter_validators_add_error_messages... OK +  Applying auth.0008_alter_user_username_max_length... OK +  Applying auth.0009_alter_user_last_name_max_length... OK +  Applying auth.0010_alter_group_name_max_length... OK +  Applying auth.0011_update_proxy_permissions... OK +  Applying sessions.0001_initial... OK +``` + +### Create users in Django + +Create an initial user named **admin** with the example password of **password123**: + + +``` +$ python3 ../manage.py createsuperuser \ +  --email [admin@example.com][4] \ +  --username admin +``` + +Create a password when you're prompted. + +### Implement serializers and views in Django + +For Django to be able to pass information over to an HTTP GET request, the information object must be translated into valid response data. Django implements **serializers** for this. + +In your project, define some serializers by creating a new module named **quickstart/serializers.py**, which you'll use for data representations: + + +``` +from django.contrib.auth.models import User, Group +from rest_framework import serializers + +class UserSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = User +        fields = ['url', 'username', 'email', 'groups'] + +class GroupSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = Group +        fields = ['url', 'name'] +``` + +A [view][5] in Django is a function that takes a web request and returns a web response. The response can be HTML, or an HTTP redirect, or an HTTP error, a JSON or XML document, an image or TAR file, or anything else you can get over the internet. To create a view, open **quickstart/views.py** and enter the following code. This file already exists and has some boilerplate text in it, so keep that and append this text to the file: + + +``` +from django.contrib.auth.models import User, Group +from rest_framework import viewsets +from tutorial.quickstart.serializers import UserSerializer, GroupSerializer + +class UserViewSet(viewsets.ModelViewSet): +    """ +    API endpoint  allows users to be viewed or edited. +    """ +    queryset = User.objects.all().order_by('-date_joined') +    serializer_class = UserSerializer + +class GroupViewSet(viewsets.ModelViewSet): +    """ +    API endpoint  allows groups to be viewed or edited. +    """ +    queryset = Group.objects.all() +    serializer_class = GroupSerializer +``` + +### Generate URLs with Django + +Now you can generate URLs so people can access your fledgling API. Open **urls.py** in a text editor and replace the default sample code with this code: + + +``` +from django.urls import include, path +from rest_framework import routers +from tutorial.quickstart import views + +router = routers.DefaultRouter() +router.register(r'users', views.UserViewSet) +router.register(r'groups', views.GroupViewSet) + +# Use automatic URL routing +# Can also include login URLs for the browsable API +urlpatterns = [ +    path('', include(router.urls)), +    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) +] +``` + +### Adjust your Django project settings + +The settings module for this example project is stored in **tutorial/settings.py**, so open that in a text editor and add **rest_framework** to the end of the **INSTALLED_APPS** list: + + +``` +INSTALLED_APPS = [ +    ... +    'rest_framework', +] +``` + +### Test your Django API + +You're now ready to test the API you've built. First, start up the built-in server from the command line: + + +``` +`$ python3 manage.py runserver` +``` + +You can access your API by navigating to the URL **** using **curl**: + + +``` +$ curl --get +[{"url":" +``` + +Or use Firefox or the [open source web browser][6] of your choice: + +![A simple Django API][7] + +For more in-depth knowledge about RESTful APIs using Django and Python, see the excellent [Django documentation][8]. + +### Why should I use Django? + +The major benefits of Django: + + 1. The size of the Django community is ever-growing, so you have lots of resources for guidance, even on a complicated project. + 2. Features like templating, routing, forms, authentication, and management tools are included by default. You don't have to hunt for external tools or worry about third-party tools introducing compatibility issues. + 3. Simple constructs for users, loops, and conditions allow you to focus on writing code. + 4. It's a mature and optimized framework that is extremely fast and reliable. + + + +The major drawbacks of Django are: + + 1. Django is complex! From a developer's point of view, Django can be trickier to learn than a simpler framework. + 2. There's a big ecosystem around Django. This is great once you're comfortable with Django, but it can be overwhelming when you're still learning. + + + +Django is a great option for your application or API. Download it, get familiar with it, and start developing an amazing project! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/python-web-api-django + +作者:[Rachel Waston][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rachelwaston +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://www.djangoproject.com/ +[3]: https://opensource.com/article/19/11/python-web-api-flask +[4]: mailto:admin@example.com +[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/ +[6]: https://opensource.com/article/19/7/open-source-browsers +[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API) +[8]: https://docs.djangoproject.com/en/2.2 diff --git a/sources/tech/20191130 7 maker gifts for kids and teens.md b/sources/tech/20191130 7 maker gifts for kids and teens.md new file mode 100644 index 0000000000..a821b221e3 --- /dev/null +++ b/sources/tech/20191130 7 maker gifts for kids and teens.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 maker gifts for kids and teens) +[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +7 maker gifts for kids and teens +====== +Make your holiday gift shopping easy with this guide to gifts sure to +spark creativity and innovation in babies, kids, tweens, teens, and +beyond. +![Gift box opens with colors coming out][1] + +Struggling with what gifts to give the young person in your life this holiday season? Here are my top picks for open source presents that will spark creativity and inspire for years to come. + +### Hummingbird Robotics Kit + +![Hummingbird Robotics Kit][2] + +**Ages**: 8 to adult + +**What it is:** The [Hummingbird Robotics Kit][3] is a complete robotics kit with a microcontroller, motors, LEDs, and sensors. The robot brain has special ports that little hands can easily attach robot components to. The Hummingbird kits don't come with a body, empowering users to create their own. + +**Why I love it:** The Hummingbird works with multiple programming languages—from visual (BirdBlox, MakeCode, Snap) to text (Python and Java)— making it scalable as users' coding skills increase. All the components are exactly as you'd find them at an electronics store, not obscured by plastic like other robot kits. This demystifies the inner workings of robots and makes it easy to source more parts if needed. + +Because there is no set project, the Hummingbird is the perfect robot for creativity. + +The Hummingbird Bit has open source software and firmware. It works on Linux, Windows, Mac, Chromebook, Android, and iOS. + +**Cost:** Starts at US$ 99. + +### Makey Makey Classic + +![Makey Makey Classic][4] + +**Ages:** 6 to adult + +**What it is:** [Makey Makey Classic][5] turns any conductive object, from marshmallows to a friend, into a computer key. + +You use alligator clips to connect the Makey Makey to the conductive object of your choice. Then, you close the circuit between the ground connection and any trigger key by touching both conductive objects at the same time. The Makey Makey is a good way to safely explore electricity at home while creating interesting ways to interact with your computer. + +**Why I love it:** Makey Makey can be paired with video games made in Scratch to create unique controllers that further immerse users in the game. The possibilities are endless, from instruments made of toilet rolls and foil to interactive art and stories. It works on Linux, Windows, and Mac computers with a USB port. + +**Cost:** US$ 49.95 + +### Arduino Uno + +![Arduino Uno][6] + +**Ages**: 10 to adult + +**What it is:** Arduinos are microcontrollers that can be purchased with or without an electronics kit, and they come in many different flavors, though I like the [Arduino Uno][7] the best. Additional components, such as LEDs, motors, and sensors can be purchased as needed from any electronics shop. + +**Why I love it:** The Arduino Uno is well-documented, so it's easy for makers to find tutorials online. The Arduino can bring a wide variety of electronic projects to life, from simple to complex. The Arduino features open source firmware and hardware. It works on Linux, Mac, and Windows. + +**Cost:** Starts at US$ 22.00 for the board. The overall cost varies depending on projects and skill level. + +### DIY maker kit + +![A maker kit assembled in a quick trip to the hardware store][8] + +**Ages**: 8 to adult + +**What it is:** Many of today's makers, creators, and programmers started out tinkering with objects that happened to be lying around. You can create an awesome maker kit for the young person in your life with a quick trip to the nearest electronics store. Here's what's in my maker kit: + + * Eye goggles + * Hammer + * Nails and screws + * Scraps of wood + * Screwdrivers + * Wire + * LEDs + * Piezo buzzer + * Motors + * AA battery pack with leads + * Wire cutters + * Cardboard + * Masking tape + * Scrap fabric + * Buttons + * Thread + * Needles + * Zippers + * Hooks + * A cool tackle box to store everything in + + + +**Why I love it: **Remember when you were a kid and your parents brought home an empty cardboard box that you turned into a spaceship or a house or a supercomputer? That's what a DIY maker kit can be for older kids. + +Raw components empower kids to experiment and use their imaginations. A DIY maker kit can be completely customized for the recipient. Be sure to throw in some components the giftee may have never thought to create with, like giving an avid sewer some LEDs or a woodworker fabric. + +**Cost:** Variable + +### Heuristic play basket + +![Heuristic play kit][9] + +**Ages:** 8 months to 5 years + +**What it is:** Heuristic play baskets are filled with interesting objects made from natural, non-toxic materials for infants and toddlers to explore using their five senses. It's open-ended, self-directed play at its best. The idea is that an adult will supervise (but not direct) a child's use of the basket and its items for a half-hour, then put the basket away until the next time. + +It's easy to create a lovely play basket with common household objects. Try to include items with varying textures, sounds, smells, shapes, and weights. Here are some ideas to get you started. + + * Colander or ridged wicker basket to hold everything + * Wooden spoon + * Metal whisks and spoons + * Scrubbing brush + * Sponge + * Small egg carton + * Cardboard tubes + * Small rolling pin + * Textured washcloth + * Rocks + * Handbells + * Crochet doily + * Small tin with a lid + + + +Play baskets should not include anything easily breakable or small enough to fit inside a paper towel roll, as these are choking hazards, and all objects should be cleaned thoroughly before being given to a child. + +**Why I love it:** Play baskets are fantastic for sensory development and helping young children ask questions and explore the world around them. This is an important part of developing a maker mindset! + +It's easy to obtain suitable items for a play basket; you probably already have many interesting objects in your home or at your nearest second-hand store. Toddlers will use their play baskets differently than infants. These objects will grow with children as they begin to mimic adult life and tell stories through their play. + +**Cost:** Variable + +### Hello Ruby + +![Hello Ruby book cover][10] + +**Ages**: 5–8 + +**What it is:** _[Hello Ruby][11]: Adventures in Coding_ is an illustrated book by Linda Liukas that introduces children to programming concepts through a fun narrative about a girl who encounters problems and friends, each of which represents code. Liukas' other _Hello Ruby_ books are subtitled _Expedition to the Internet_ and _Journey Inside the Computer_, and _Adventures in Coding_ has been published in more than 20 languages. + +**Why I love it:** The author accompanies the book with a number of free, fun, and unplugged activities that can be downloaded and printed out from the Hello Ruby website. These activities teach coding concepts and also touch on artistic expression, communication, and even time management. + +**Cost:** List price for the hardcover book is US$ 17.99, but you may find it at a lower price through local or online booksellers. + +### Girls Who Code: Learn to Code and Change the World + +![Girls Who Code book cover][12] + +**Ages**: 10 to adult + +**What it is:** Written by Reshma Saujani, the founder of Girls Who Code, _[Girls Who Code: Learn to Code and Change the World][13]_ gives practical information about the tech world for young girls (and boys). It covers a wide variety of topics, including coding languages, use-cases, terminology and vocabulary, career options, and profiles and interviews with people in the tech industry. + +**Why I love it:** This book tells the story of tech in ways even most websites meant for adults miss out on. Technology encompasses so many disciplines, and it's important for young people to understand they can use it to solve real-world problems and make a difference. + +**Cost:** List price for the hardcover book is US$ 17.99 and US$ 10.99 for the paperback, but you may find it at a lower price through local or online booksellers. + +I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... + +Scratch is a free educational programming language for kids, available in 50 different languages... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/maker-gifts-kids + +作者:[Jess Weichler][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit) +[3]: https://www.birdbraintechnologies.com/hummingbirdbit/ +[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic) +[5]: https://makeymakey.com/ +[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno) +[7]: https://www.arduino.cc/ +[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store) +[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit) +[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover) +[11]: https://www.helloruby.com/ +[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover) +[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/ diff --git a/translated/talk/20191028 6 signs you might be a Linux user.md b/translated/talk/20191028 6 signs you might be a Linux user.md new file mode 100644 index 0000000000..ef6b782ce1 --- /dev/null +++ b/translated/talk/20191028 6 signs you might be a Linux user.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 signs you might be a Linux user) +[#]: via: (https://opensource.com/article/19/10/signs-linux-user) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 资深用户的 6 大特征 +====== + +> 如果你是 Linux 资深用户,则可能会有这些共同倾向。 + +![Tux with binary code background][1] + +Linux 用户千差万别,但是我们许多人都有一些相同的习惯。你可能没有本文列出的任何特征,而且如果你是个 Linux 新用户,你可能还不能理解这些特征…… + +下面是你可能是 Linux 用户的六个特征。 + +### 1、理所当然,纪元始于 1970 年 1 月 1 日 + +关于 Unix 计算机时钟为何在重置时总是将其设置回 1970-01-01 的传闻有很多。但有点令人感到乏味的事实是,Unix “纪元”是用于同步的通用且简单的参考点。例如,万圣节在儒略历中是今年的 304 日,但我们通常将该节日称为 “31 日”。我们知道指的是哪个月 31 日,因为我们有个共同的参考点:我们知道万圣节在 10 月庆祝,而 10 月是一年中的第十个月,并且我们知道前面每一个月包含多少天。没有这些值,虽然我们可以使用传统的计时方法(如月相)来跟踪特殊的季节性事件,但是计算机显然不具备这种能力。 + +计算机需要确定且明确定义的值,因此将值 `1970-01-01T00:00:00Z` 选择为 Unix 纪元的开始。每当 [POSIX][2] 计算机的时间不准确时,诸如网络时间协议(NTP)之类的服务就可以向其提供自 `1970-01-01T00:00:00Z` 以来的秒数,计算机可以将其转换为人类易于识别的日期。 + +日期和时间是在计算中要追踪的著名的复杂事物,主要是因为几乎所有标准都有例外。一个月并不总是有 30 天,一年也不总是有 365 天,甚至每年有多少秒钟也往往会有所不同。如果你正在寻找一个有趣而令人沮丧的编程练习,请尝试编程一个可靠的日历应用程序! + +### 2、输入超过两个字母你就会觉得麻烦 + +众所周知,最常见的 Unix 命令都超简短。除了 `cd`、`ls` 和 `mv` 之类的命令外,还有一个命令简直不能再短了:`w`(它根据 `/var/run/utmp` 文件显示谁当前登录了)。 + +一方面,极短的命令似乎很不直观。新用户可能不会猜测到键入 `ls` 会列出list目录。但是,一旦学习命令,它们肯定是越短越好。如果你整天都在终端上度过,那么你键入的击键次数越少就意味着你可以花更多的时间来完成工作。 + +幸运的是,单字母命令并不太多,因此你可以使用大多数字母作为别名。例如,我经常使用 Emacs,以至于我觉得 `emacs` 的输入时间太长,因此通过将下面这行添加到 `.bashrc` 文件中,将其别名为 `e`: + +``` +alias e='emacs' +``` + +你也可以临时为命令添加别名。例如,如果你在解决网络问题时发现自己反复运行 [firewall-cmd][3],则可以为当前会话创建别名: + +``` +$ alias f='firewall-cmd' +$ f +usage: see firewall-cmd man page +No option specified. +``` + +只要你打开着终端,你的别名就会一直存在。当终端一旦关闭,它便会被遗忘。 + +### 3、做任何事都不应该单击两次以上 + +Linux 用户喜欢效率。尽管并非每个 Linux 用户都总是急于完成工作,但 Linux 桌面中有一些旨在减少完成任务所需的操作数量的惯例。这里有些例子。 + +* 在 KDE 文件管理器 Dolphin 中,单击即可打开文件或目录。假定如果要选择一个文件,则可以单击并拖动,也可以 `Ctrl + 点击`。这可能会使习惯于双击所有内容的用户感到困惑,但是一旦你尝试了单击操作,通常就无法返回费力的双击操作。 +* 在大多数 Linux 桌面上,单击鼠标中键可粘贴剪贴板的最新内容。 +* 在许多 Linux 桌面上,可以通过按 `Alt`、`Ctrl` 或 `Shift` 键来修改拖动动作。例如,`Alt + 拖动` 在 KDE 中移动窗口,而 GNOME 中的 `Ctrl + 拖动` 会复制文件而不是移动。 + +### 4、任何操作你都不会执行三次以上,因为第三次时你已经将它自动化了 + +请原谅我有点夸张,但是许多 Linux 用户期望他们的计算机比他们更努力地工作。虽然学习如何自动执行常见任务需要花费时间,但在 Linux 上它往往比在其它平台上更容易,因为 Linux 终端和 Linux 操作系统是如此紧密地集成在一起。最容易自动化的是你在终端中已经执行的操作,因为命令只是你在解释器中键入的字符串,而该解释器(终端)不会在乎你是手动键入字符串还是将其指向一个脚本。 + +例如,如果你发现自己经常将一组文件从一个位置移动到另一个位置,则或许可以将相同的指令序列用作一个脚本,你可以使用单个命令来触发该脚本。假设你每天早上手动执行此操作: + +``` +$ cd Documents +$ trash reports-latest.txt +$ wget myserver.local/reports/daily/report-latest.txt +$ cp report-latest.txt reports_daily/2019-31-10.log +``` + +这是一个简单的序列,但是每天重复一次并不是消磨时间的最有效方法。做一点点抽象,你可以使用一个简单的脚本将其自动化: + +``` +#!/bin/sh + +trash $HOME/Documents/reports-latest.txt + +wget myserver.local/reports/daily/report-latest.txt \ +-P $HOME/Documents/udpates_daily/`date --iso-8601`.log + +cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ +$HOME/Documents/reports-latest.txt +``` + +你可以把你的脚本叫做 `get-reports.sh` 并在每天早晨手动启动它,或者甚至可以将其输入到 crontab 中,以便计算机可以执行此任务而无需你进行任何干预。 + +对于新用户来说,这可能会有点困扰,因为什么和什么是一体的并不总是很明显。例如,如果你经常发现自己打开图像并将其按比例缩小 50%,那么你可能习惯于执行以下操作: + +1. 打开你的照片查看器或编辑器 +2. 缩放图像 +3. 将图像导出为修改后的文件 +4. 关闭应用程序 + +如果你一天要做几次,你可能会对这种重复感到厌倦。但是,由于你是在图形用户界面(GUI)中执行这些操作的,因此你需要知道如何编写 GUI 脚本以使其自动化。某些应用程序,例如 [GIMP][4],具有丰富的脚本接口,但是其过程显然不同于仅修改一堆命令并将其存储到文件中那么简单。 + +再说一次,有时在命令行中有与你在 GUI 中所做的等效的操作。将文档从一种文本格式转换为另一种格式可以使用 [Pandoc][5],处理图像可以使用 [Image Magick][6],音乐和视频也可以通过命令行进行编辑和转换,等等。最大的问题是你需要知道要查找什么,通常是学习新的(有时是复杂的)命令。但是,在终端中按比例缩小图像比在 GUI 中显然更简单: + +``` +#!/bin/sh + +convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg +``` + +这些麻烦、重复的任务值得研究。你永远不知道你的工作让计算机做起来是有多么的简单和快捷! + +### 5、发行版之间跳来跳去 + +我在家里是一个热情的 Slackware 用户,而在工作时是一个 RHEL 用户。实际上,这不是事实,我现在在工作时是 Fedora 用户。除了有时候我使用 CentOS,有时候我还会运行 [Mageia][7]。 + +![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] + +*运行在 PowerPC64 机器上的 Debian* + +发行版好不好无关紧要,成为 Linux 用户的极致乐趣之一是可以自由决定运行哪个发行版。乍一看,它们基本相同,令人耳目一新。但是根据你的心情,你可能更喜欢 CentOS 的稳定性而不是 Fedora 的不断更新,或者你可能有一天会真正享受 Mageia 的集中控制中心,然后又对原始的 [Debian][9] 配置文件进行模块化乐在其中,而有时你又会完全转向其他操作系统。 + +![OpenBSD, image CC BY SA Claudio Miranda][10] + +*OpenBSD,不是 Linux 发行版* + +关键是,Linux 发行版是激情项目,成为其他人的开源激情的一部分很有趣。 + +### 6、你对开源充满热情 + +无论你的经验如何,如果你是 Linux 用户,那么你无疑会对开源充满热情。无论你是每天通过[共创艺术品] [11]还是代码来表达你的热情,还是将其升华到只在自由而自在环境中完成工作,你都生活并构筑于开源之上。因为有了千千万万个你,所以有了开源社区,社区因你而变得更加丰富。 + +有太多的东西我没有提到。作为 Linux 用户,还有什么可以出卖你的身份?让我们在评论中知道! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/signs-linux-user + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://www.gimp.org/ +[5]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[6]: https://opensource.com/article/17/8/imagemagick +[7]: http://mageia.org +[8]: https://opensource.com/sites/default/files/uploads/debian.png (Debian on a PowerPC64 box) +[9]: http://debian.org +[10]: https://opensource.com/sites/default/files/uploads/openbsd.jpg (OpenBSD) +[11]: http://freesvg.org diff --git a/translated/tech/20180207 23 open source audio-visual production tools.md b/translated/tech/20180207 23 open source audio-visual production tools.md new file mode 100644 index 0000000000..ac414cf5f1 --- /dev/null +++ b/translated/tech/20180207 23 open source audio-visual production tools.md @@ -0,0 +1,255 @@ +23 款开源的声音视觉生产工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga) + +“开源”在云基础设施、网站托管、嵌入式设备和其他领域已经建立的相当完善。很少数人知道开源在生产专业级的声音视觉素材上也是一个不错的选择。 + +作为一名产品经理(有时候也是市场支持),我为终端用户提供很多内容:文档,文章,视频教学,甚至是展台物料,白纸,采访等等。我找到了很多可以帮我制作音频、视频,排版,截屏的开源软件。人们选择开源软件而不是专有软件的[原因][1]有很多,而我也为以下人群编制了一份开源音视频工具清单: + + * 想要入坑 GNU/Linux,但需要在原来的操作系统上慢慢开始使用跨平台软件 + * 热爱开源,但对音视频开源软件所知甚少,不知道该如何选择 + * 想要为创造力充电而探索新的工具,并且不想使用其他人使用过的方法工具 + * 存在某些其他的原因使用开源音视频解决方案(如果是你,不妨在评论里分享一下) + +幸运的是,存在着很多开源音视频软件的创造者,也存在着很多硬件来支持这些应用。本文清单里的所有软件都符合以下标准: + + * 跨平台 + * 开源(软件和驱动) + * 稳定 + * 积极维护 + * 良好的文档与技术支持 + +我将清单中的解决方案划分为图形,音频,视频和动画。注意,本文中提到的应用程序并不完全等同于一些有名的私有软件,它们需要花时间来学习,并且可能需要改变你的工作流程,但是学习新的工具能够让体验全新的创造方式。 + +### 图形 + +我制作过很多出版和网站使用的图形,包括 logo,横幅,视频标题,模型。这里是一些我用过的开源应用,也包括一起使用的硬件。 + +#### 软件 + +**1.[Inkscape][2]** (矢量图) +Inkscape 是一款不错的矢量图编辑器,用来制作 RGB 颜色空间下的 SVG 和 PDF 文件。(它可以制作 CMYK 图像,但不是主要用途)它是为 web 应用制作 SVG 格式的地图和图表的人的救命稻草。你不仅可以使用集成的 XML 编辑器打开文件,也可以用它查看对象的所有参数。但有一个缺点:它在 Mac 上的优化不是很好。有很多样例,可以看[Inkscape 画廊][3]。 + +**2.[GIMP][4]** (图片编辑器) +GIMP 是我最喜欢的图片编辑程序,它包括了色彩调整,裁剪和拉伸,并且(尤其是)对于网页使用的文件大小进行了优化(很多使用 Photoshop 的同事让我帮他们做这最后一步)。你也可以从头制作并绘制一张图片,但 GIMP 并不是我最喜欢用来做这件事的工具。在 [GIMP Artists on DevianArt][5] 上查看众多的样例。 + +**3.[Krita][6]** (数字绘画) +当你桌子上摆着一个漂亮的 Wacom 数位板,你肯定想试试真正的数字绘画应用。Krita 就是你创作漂亮插画所需要的工具。在 [Krita 画廊][7] 里看看我说的东西吧。 + +**4.[Scribus][8]** (桌面印刷系统) +你可以使用 Scribus 来创建一个完整的文档,或者通过 Inkscape 或 Libre Office 将 PDF 从 RGB 转换到 CMYK 。有一个功能我非常喜欢:你可以试着模拟视觉障碍人士使用 Scribus 时的体验。当我发送 PDF 文件给商用打印机时全指望 Scribus。尽管出版社可能使用像 InDesign 这样的私有软件创建文档,但如果你用 Scribus 正确的完成一份文档,那么打印时就不会出现任何问题。免费建议:第一次发送文件给打印机时,不要告诉打印机创建该文档所使用的软件。你可以在 [Scribus 教程][9]中寻找创建文档的例子。 + +**5.[RawTherapee][10]** (RAW 图像开发工具) +RawTherapee 是我所知道唯一跨平台可替代 Lightroom 的软件。你可以将相机调整到 RAW 模式,然后使用 RawTherapee 来修图。它提供了非常强大的引擎和对图片没有破坏的编辑器。例如,可以见 [Raw Therapee 截图][11]。 + +**6.[LibreOffice Draw][12]** (桌面印刷系统) +尽管你可能认为 LibraOffice Draw 不是一款专业的桌面印刷解决方案,但它仍然能够在很多情况下帮助你。例如,制作白皮书,图表,或其他人(尽管是那些不懂图形软件的人)以后可以修改的海报。它不仅方便使用,而且当创建有趣的文档时也是 Impress 或 PowerPoint 的绝佳替代软件。 + +#### 图形硬件 + +**绘图板** +[Wacom][13] 数位板(和配件)通常支持所有的操作系统。 + +**颜色校正** +颜色校正产品通常可用于所有操作系统,也包括了 GNU/Linux。Datacolor 生产的 [Spyder][14] 在所有平台上都有应用程序的支持。 + +**扫描仪和打印机** +图形艺术家需要输出(无论是打印还是数字存储)精确的颜色。但是真正跨平台的设备,以及所有平台都易于安装的驱动,并不像你想的那样普遍。你的最佳选择是兼容 TWAIN 的扫描仪和兼容 Postscript 的打印机。以我的经验,Epson 和 Xerox 的专业级扫描仪和打印机更不容易出现驱动问题,并且它们通常也是开箱即用,拥有漂亮精确的颜色。 + +### 音频 + +有许多可供音乐家,视频制作者,游戏制作者,音乐出版商等等人群选择的开源音频软件。这里有一些我曾经用来进行内容创作与声音录制时所使用的软件。 + +#### 软件 + +**7. [Ardour][15] **(数字音频录制) +对录音与编辑来说,最专业级的工具选择当然是唾手可得的 Ardour。听起来很棒,它的混音部分非常的完整灵活,能够提供给你喜欢的插件,并且易于回放、编辑、对比修改。我经常用它进行声音录制和视频混音。要找出一些使用 Ardour 录制好的音乐并不容易,因为音乐家们很少相信它们使用的软件。然而,你可以查看它的[截图][16]和一些特性来了解它的功能。 + +(如果你在寻求一种声音制作方面的“模拟感觉”,你可以试试 [Harrison Mixbus][17],它并不是一个开源项目,但是高度基于 Ardour,拥有模拟显示的终端。我非常喜欢用它进行工作,我的客户也喜欢用它制作的声音。Mixbus 也是跨平台的) + +**8.[Audacity][18]** (声音编辑) +Audacity 属于“瑞士军刀”级的声音制作软件。它并不完美,但你几乎可以用它做所有的事情。加上非常易于使用,任何人都能在几分钟之内上手。像 Ardour 一样,很难找到一份归功于 Audacity 的作品,但你可以从这些[截图][19]中了解如何使用它。 + +**9.[LMMS][20]** (音乐制作) +LMMS,设计的就像 FL Studio 的替代品,也许并不那么广泛,但它非常完整并易于使用。你可以使用自己最喜欢的插件,使用“钢琴键”编辑乐器,使用步定序器step sequencer播放鼓点,混合音轨...几乎能做任何事情。在我没有时间给音乐家录音的时候我就使用它为视频创建声音片段。查看[最好的 LMMS][21] 榜单来看看一些例子。 + +**10.[Mixxx][22]** (DJ,音乐混音) +如果你需要强大的混音和播放 DJ 软件,Mixx 就可以满足你的需求。它与大多数 MIDI 控制器,唱片,专用声卡所兼容。你可以用它管理音乐库,添加音效,做一些有趣的事情。查看它的[功能][23]来了解它是如何工作的。 + +#### 音频接口硬件 + +尽管你可以使用任何一个计算机的声卡录制音频,但要录制的很好,就需要一个音频接口——一个录制高质量音频输入的专用的外部声卡。对于跨平台兼容性来说,大多数“兼容 USB”和“兼容 IOS”的音频接口设备应该都能录制 MIDI 或其他音频。下面是一些我用过的一些有名气的跨平台设备。 + +**[Behringer U-PHORIA UMC22][24]** +UMC22 是你可以考虑的最便宜的选择。但它的前置放大器噪音太大,音腔box质量也比较低。 + +**[Presonus AudioBox USB][25]** +AudioBox USB 是第一个兼容 USB(因此也跨平台) 的录音系统。它非常的耐用,经常在二手市场也能见到。 + +**[Focusrite Scarlett][26]** +Scarlett 在我看来是目前最高质量的跨平台声卡。不同种类的设备可以涵盖 2-18 个输入/输出端口。你可以在二手市场找到它的最初版本,而最新的第二代具有更好的前置放大器与规格。[2i2][27] 型号是我经常使用的那一款。 + +**[Arturia AudioFuse][28]** +AudioFuse 几乎可以让你接入任何设备,从麦克风到黑胶唱片机再到各种数字输入设备。它具有优质的声音与良好的设计,也是我目前用的最多的一款设备。它是跨平台的,但目前配置软件还不能在 GUN/Linux 上使用。即使我把它从 Windows 电脑上断开,它仍然保留着我的配置。但是讲真,Arturia,劳烦认真考虑做一个 Linux 的软件。 + +#### MIDI 控制器 + +MIDI 控制器是一种乐器——例如电子琴,鼓垫等等。可以让你控制音乐软件或者硬件。现有的大多数 USB MIDI 控制器都跨平台并兼容主流的录音编辑软件。基于网页的教程可以帮你对不同的软件进行配置。尽管找到有关 GNU/Linux 的配置信息可能比较困难,但它们仍然是可以使用的。我用过许多 Akai 和 M-Audio 设备,没有任何问题。在买乐器之前最好先试一下,至少去听一下它们的音质或体验一下按键触感。 + +#### 音频编解码器 + +音频编解码器压缩或解压数字音频,用尽可能小的文件大小获得最佳质量的声音。幸运的是,用于收听或流媒体播放的编解码器恰好是开源的:[FLAC][29]。[Ogg Vorbis][30] 是另一个值得了解的开源音频编解码器;在相同的比特率下比 MP3 好的多。如果你需要输出不同的音频格式,我建议通常存档最好质量的音频,然后再压缩成特定的版本。 + +### 视频 + +视频对于品牌的传播是影响巨大的。即使你不是一个视频专家,学习一些基础的东西也是非常明智的。 + +#### 软件 + +**11.[VLC][31]** (视频播放器与转换器) +最初是为流媒体而开发的,VLC 现在因能够在所有设备上读取所有的视频格式被人们熟知。它非常的实用,例如,你可以使用它将视频转换成其他编解码格式或容器,也可以用来恢复破损的视频。 + +**12.[OpenShot][32]** (视频编辑) +OpenShot 是一个简单的软件,但它却可以制作出很好的效果,尤其是在短视频上。(在编辑或改善音质方面有一定的限制,但它也能够完成)我非常喜欢它的移动,拉伸,裁剪工具;用它创建视频的开头或结尾,导出之后使用更复杂的编辑器进行编辑,非常的完美。你可以在 OpenShot 的网站上看这些[例子][33](并获取更多信息)。 + +**13.[Shotcut][34]** (视频编辑) +我认为 Shotcut 是比 OpenShot 更完整一些的工具——它在你的操作系统上比起其他较为基础的编辑器更具有竞争力,并且它支持 4K 分辨率,具有专业的解码器。尝试一下,我相信你会爱上它的。你可以在这些[视频教程][35]里看一些范例。 + +**14.[Blender Velvets][36]** (视频编辑,合成,特效) +尽管这一章节不是本文的学习重点,但 Blender Velvets 是你能找到的最强大的解决方案之一。它是由一些视频创作者所制作的一系列扩展工具和脚本的合集,是通过 Blender 3D 制作软件转换成的 2D 视频编辑器。 尽管它的复杂度意味着不是我的首选视频编辑器,但你仍可以在 YouTube 和其他网站上找到它的教程,并且一旦你学习了它,你就能通过它做任何事情。观看这个[视频教程][37]来了解它的功能与运作方式。 + +**15.[Natron][38]** (合成) +我不使用 Natron,但我听说它广受好评。它是 Adobe After Effects 的替代品,但运作方式并不同。想了解更多可以观看一些视频教程,比如这些 Natron 的 [YouTube 频道][39]。 + +**16.[OBS][40]** (实时编辑,录制,流媒体) +Open Broadcaster Software (OBS)是一个领先的在 YouTube 或 Twitch 上进行现场录制或现场直播电子竞技,电视游戏的解决方案。我经常使用它记录用户的屏幕,会议和聚会。获取更多信息,查看我曾经在 Opensource.com 上写的关于录制现场汇报的教程,[第一部分:选择你的设备][42]和[第二部分:软件安装][43]。 + +#### 视频硬件 + +结论先行:你需要一个强大的工作站以及快速的硬盘和更新后的软件和驱动。 + +**图形处理单元(GPU)** +一部分包含在清单里的软件比如 Blender 和 Shotcut 使用 OpenGL 和硬件加速,这些都高度依赖 GPU。我建议你使用可以负担起的最强大的 GPU。我所使用过的 AMD 和 Nvidia 都有着良好的体验,这取决于使用的平台。不要忘记安装最新的驱动。 + +**硬件驱动** +大体上来说,驱动做的越快越大,对视频越好。不要忘记在软件里配置好正确的路径。 + +**视频录制硬件** + + * [Blackmagic Design][44]: Blackmagic 提供了非常好,专业级的视频录制和回放硬件。驱动支持 Mac,Windows,和 GNU/Linux(但不是所有的发行版) + * [Epiphan][45]: 在 Epiphan 的专业级 USB 视频录制设备中有一款新型产品,它适用于 HDMI 和高分辨率的屏幕。然而,你也可以在二手市场找到旧的 VGA 设备,因为他们还在继续为 GNU/Linux 和 Windows 上提供专用的驱动程序。 + +#### 视频编解码 + +不幸的是,使用开源的编解码器仍然很困难。例如,许多相机使用专有的编解码器录制 H.264 的视频和 AC3 的音频,组成称为 AVCHD 的格式。因此,我们必须务实,尽可能利用现有资源。 + +好消息是内容产业正在步向开源的编解码器来避免一些费用,并使用开源标准。对于出版和流媒体,[谷歌][46]的 [WebM][46] 便是一款优秀的开源编解码器,并且大多数视频编辑器可以导入这种格式。同样地, [GoPro][47]的超高分辨率和 360° 视频编解码器 [Cineform][47] 现在也进行了开源。希望更多的设备和供应商将会在不久之后使用它。 + +### 2D 和 3D 动画 + +动画不是我的专业领域,因此我问了从事于动画内容生产的朋友一些建议并加入到清单中,他的工作包含儿童电影和连续剧。 + +#### 软件 + +**17. [Blender][48] ** (3D 模型和渲染) +Blender 是顶级的开源跨平台 3D 建模和渲染软件。你可以直接在 Blender 中完成整个项目的工作,或者使用它为电影或视频创建 3D 效果。你能够在网上找到许多视频教程,因此即使它不是一个简单的软件,但非常容易上手。Blender 是一个非常活跃的项目,经常还会制作一些微电影来展示他们的技术。你可以在 [Blender Open Movies][49] 上观看。 + +**18.[Synfig Studio][50]** (2D 动画) +第一次用 Synfig 时,它让我想起了那个不错的 Macromedia 老式 Flash 编辑器。在那之后,它已经发展成一个全功能的 2D 动画工作室。你可以使用它制作畅销故事,商业广告,演示,开场或结尾动画以及视频中的转场,或者甚至用它制作全动画的电影。见[ Synfig 作品集][51]。 + +**19.[TupiTube][52]** (定格 2D 动画) +使用 TupiTube 是一个学习基本 2D 动画的极好方法。你可以将一系列绘画或其他图片转换成一个视频或者创建一个 GIF 循环动画。它是一个相当简单的软件,但非常完整。查看 [TupiTude 的 YouTube][53] 频道获取一些教程和范例。 + +#### 硬件 + +动画制作使用与图形设计相同的硬件,因此查看第一小结中的硬件清单获取一些建议。 + +有一点需要注意:你要用一个强大的 GPU 来进行 3D 建模和渲染。选择可能有些限制,因为这取决于你使用的平台或电脑制造商,但是不要忘记安装最新的驱动。谨慎选择你的显卡:它们非常昂贵,并且在大型的 3D 项目中至关重要,尤其是在渲染步骤中。 + +### Linux 上的选择 + +如果你是 GUN/Linux 用户,那么我为您提供了更多不错的选择。它们并不是完全跨平台的,但部分拥有 Windows 版本,还有一些可以在 Mac 上使用 Macports 安装。 + +**20.[Kdenlive][54]** (视频编辑) +伴随着最新版本的发布(几个月之前),Kdenlive 成为了我最喜欢的视频编辑器,尤其是当我在 Linux 机器上处理一些长视频的时候。如果你经常使用流行的非线性视频编辑器,Kdenlive(全称是 KDE 非线性视频编辑器KDE Non-Linear Video Editor)对你来说将非常简单。他拥有很棒的视频和音频特效,强大的细节处理能力。并且在 BSD 和 MacOS(尽管它对准的是 GNU/Linux)都能使用,还有望移植到 Windows 上。 + +**21.[Darktable][55]** (RAW 图像开发) +Darktable 是一款由摄影师制作的非常完整的 DxO PhotoLab 替代品。一些研究型项目使用它当做开发平台并测试一些图像处理算法。它是一个非常活跃的项目,我已经等不及的见到它的跨平台版本了。 + +**22.[MyPaint][56]** (digital painting数字绘画) +MyPaint 就像数字绘画领域的 light table。(译注:集成开发环境)它在 Wacom 设备上表现良好,并且它的笔刷引擎尤其值得赞赏,因此 GIMP 开发人员正在密切的关注它。 + +**23.[Shutter][57]** (桌面截图) +当我写这篇教程的时候,我使用了许多截图来进行展示。我最喜欢的 GNU/Linux 截图工具就是 Shutter。事实上,我都找不到在 Windows 或 Mac 上能与之抗衡的一些功能。有一点小遗憾:我很期待 Shutter 在将来能够增加新的功能来创建几秒动态的 GIF 截图。 + +我希望这些足以说服你开源软件是一种非常卓越且可行的音视频内容生产解决方案。如果你正在使用其他开源软件,或者对于使用跨平台软件和硬件进行音视频项目有好的建议,请在评论中分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/2/open-source-audio-visual-production-tools + +作者:[Antoine Thomas][a] +译者:[LuuMing](https://github.com/LuuMing) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/ttoine +[1]:https://opensource.com/resources/what-open-source +[2]:https://inkscape.org/ +[3]:https://inkscape.org/en/gallery/ +[4]:https://www.gimp.org/ +[5]:https://gimp-artists.deviantart.com/gallery/ +[6]:https://krita.org/ +[7]:https://krita.org/en/features/gallery/ +[8]:https://www.scribus.net/ +[9]:https://www.scribus.net/category/made-with-scribus/ +[10]:http://rawtherapee.com/ +[11]:http://rawtherapee.com/blog/screenshots +[12]:https://www.libreoffice.org/discover/draw/ +[13]:http://www.wacom.com/en-us +[14]:http://www.datacolor.com/photography-design/product-overview/#workflow_2 +[15]:https://www.ardour.org/ +[16]:http://ardour.org/features.html +[17]:http://harrisonconsoles.com/site/mixbus.html +[18]:http://www.audacityteam.org/ +[19]:http://www.audacityteam.org/about/screenshots/ +[20]:https://lmms.io/ +[21]:https://lmms.io/showcase/ +[22]:https://www.mixxx.org/ +[23]:https://www.mixxx.org/features/ +[24]:http://www.musictri.be/Categories/Behringer/Computer-Audio/Interfaces/UMC22/p/P0AUX +[25]:https://www.presonus.com/products/audiobox-usb +[26]:https://us.focusrite.com/scarlett-range +[27]:https://us.focusrite.com/usb-audio-interfaces/scarlett-2i2 +[28]:https://www.arturia.com/products/audio/audiofuse/overview +[29]:https://en.wikipedia.org/wiki/FLAC +[30]:https://xiph.org/vorbis/ +[31]:https://www.videolan.org/ +[32]:https://www.openshot.org/ +[33]:https://www.openshot.org/videos/ +[34]:https://shotcut.com/ +[35]:https://shotcut.org/tutorials/ +[36]:http://blendervelvets.org/ +[37]:http://blendervelvets.org/video-tutorial-new-functions-for-the-blender-velvets/ +[38]:https://natron.fr/ +[39]:https://www.youtube.com/playlist?list=PL2n8LbT_b5IeMwi3AIzqG4Rbg8y7d6Amk +[40]:https://obsproject.com/ +[41]:https://opensource.com/article/17/7/obs-studio-pro-level-streaming +[42]:https://opensource.com/article/17/9/equipment-recording-presentations +[43]:https://opensource.com/article/17/9/equipment-setup-live-presentations +[44]:https://www.blackmagicdesign.com/ +[45]:https://www.epiphan.com/ +[46]:https://www.webmproject.org/ +[47]:https://fr.gopro.com/news/gopro-open-sources-the-cineform-codec +[48]:https://www.blender.org/ +[49]:https://www.blender.org/about/projects/ +[50]:https://www.synfig.org/ +[51]:https://www.synfig.org/#portfolio +[52]:https://maefloresta.com/ +[53]:https://www.youtube.com/channel/UCBavSfmoZDnqZalr52QZRDw +[54]:https://kdenlive.org/ +[55]:https://www.darktable.org/ +[56]:http://mypaint.org/ +[57]:http://shutter-project.org/ diff --git a/translated/tech/20191104 Fields, records, and variables in awk.md b/translated/tech/20191104 Fields, records, and variables in awk.md deleted file mode 100644 index 61acdae6a1..0000000000 --- a/translated/tech/20191104 Fields, records, and variables in awk.md +++ /dev/null @@ -1,249 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (liwenwensnow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fields, records, and variables in awk) -[#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -awk中的字段,记录和变量 -====== -这个系列的第二篇,我们会学习 字段,记录和一些非常有用的awk变量。 -![Man at laptop on a mountain][1] - -Awk 有好几个变种: 最早的 **awk**, 是1977 年 AT&T Bell 实验室所创。它还有一些重构版本,例如 **mawk**, **nawk**。在大多数Linux 发行版中能见到的,是 GNU awk,也叫**gawk**。 在大多数 Linux 发行版中,awk 和 gawk 都是指向 GNU awk 的链接。 输入awk命令,也是同样的效果。 [GNU awk 用户手册][2]中,能看到 awk 和 gawk 的全部历史。 - -这一系列的[第一篇文章][3] 介绍了awk 命令的基本格式: - -``` -`$ awk [options] 'pattern {action}' inputfile` -``` - -Awk 是一个命令,后面要接选项 (比如用 **-F** 来定义字段分隔符)。 想让awk 执行的部分需要写在 两个单引号之间,至少在终端中需要这么做。 在awk 命令中,为了进一步强调你想要执行的部分,可以用 **-e** 选项来突出显示 (但这不是必须的): - - -``` -$ awk -F, -e '{print $2;}' colours.txt -yellow -blue -green -[...] -``` - -### 记录和字段 - -Awk 将输入数据视为 一系列 _记录_ , 通常是按行分割的。 换句话说,awk 将文本中的每一行视作一个记录。每一记录包含多个 _字段_. 一个字段由 _字段分隔符_ 分隔开来,字段是记录的一部分. - -默认情况下,awk 将各种空白符,如空格,tab,换行符等视为分隔符。 值得注意的是,在awk 中,多个 _空格_ 将被视为一个分隔符。所以下面这行文本有两个字段: - - -``` -`raspberry red` -``` - -这行也是: - - -``` -`tuxedo                  black` -``` - -其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录,就有三个字段。其中一个字段可能会是0个字节(假设这一字段中不包含隐藏字符) - -``` -`a,,b` -``` - -### awk 程序 - -awk 命令的 _程序部分_ 是由一系列规则组成的。通常来说,程序中每个规则占一行(尽管这不是必须的)。 每个规则由一个模式,或一个/多个动作组成: - -``` -`pattern { action }` -``` - -在一个规则中,你可以通过定义模式,来确定行动是否会在记录中执行。 模式可以是简单的比较条件,正则表达式,甚至两者结合等等。 - -这个例子中,程序 _只会_ 显示包含 单词 “raspberry” 的记录: - - -``` -$ awk '/raspberry/ { print $0 }' colours.txt -raspberry red 99 -``` - -如果没有文本符合模式,最终结果会对应所有记录。 - -并且,在一条规则只包含一个模式时,相当于对整个记录执行 **{ print }** 。 - -Awk 程序本质上是 _数据驱动_ 的,命令执行结果取决于数据。所以,与其他编程语言中的程序相比,它还是有些区别的。 - -### NF 变量 - -每个字段都有指定变量,但针对字段和记录,也存在一些特殊变量。 **NF** 变量,能存储awk在当前记录中找到的数字字段。其内容可在屏幕上显示,也可用于测试。 下面例子中的数据,来自上篇文章[文本][3]: - - -``` -$ awk '{ print $0 " (" NF ")" }' colours.txt -name       color  amount (3) -apple      red    4 (3) -banana     yellow 6 (3) -[...] -``` - -Awk 的 **print** 函数会接受一系列参数(可以是变量或者字符),并将它们拼接起来。这就是为什么在这个例子里,每行结尾处,awk 会显示一个被括号括起来的整数。 - -### NR 变量 - -另外,为了计算每个记录中的字段数,awk 也计算输入记录。 记录数目被存储在变量 **NR** 中,它的使用方法和其他变量没有任何区别。例如,为了在每一行开头显示行号: - -``` -$ awk '{ print NR ": " $0 }' colours.txt -1: name       color  amount -2: apple      red    4 -3: banana     yellow 6 -4: raspberry  red    3 -5: grape      purple 10 -[...] -``` - -注意,在这个命令下输入数据时,可以不遵循在 **print** 后的规则,参数间可以不写空格,尽管这样会降低可读性: - - -``` -`$ awk '{print NR": "$0}' colours.txt` -``` - -### printf() 函数 - -为了输出结果时格式更灵活,你可以使用 awk 的 **printf()** 函数。 它与C,Lua,Bash和其他语言中的 **printf** 相类似。 它也接受 _格式_ ,加逗号分隔的参数。参数列表需要写在括号里。 - - -``` -`$ printf format, item1, item2, ...` -``` - -格式这一参数(也叫 _格式符_ ) 定义了其他参数如何显示。 这一功能是用 _格式修饰符_ 来实现的。 **%s** 显示字符, **%d** 显示数字。 下面的**printf** 语句,会在括号内显示字段数量: - -``` -$ awk 'printf "%s (%d)\n",$0,NF}' colours.txt -name       color  amount (3) -raspberry  red    4 (3) -banana     yellow 6 (3) -[...] -``` - - -在这个例子里, **%s (%d)** 确定了每一行的输出格式,**$0,NF** 定义了插入 **%s** 和 **%d** 位置的数据。注意,和**print** 函数不同,在没有明确指令时,输出不会转到下一行。出现 转义字符 **\n** 时才会换行。 - -### Awk 脚本编程 - -这篇文章中出现的所有awk代码,都在Bash终端中执行过。 面对更复杂的程序,将命令放在文件( _脚本_ )中会更容易。 **-f FILE** 选项(不要和 **-F** 弄混了,那个选项用于字段分隔符),可用于指明包含可执行程序的文件。 - -举个例子,下面是一个简单的awk 脚本。 创建一个名为 **example1.awk** 的文件,包含以下内容: - - -``` -/^a/ {print "A: " $0} -/^b/ {print "B: " $0} -``` - -如果一个文件包含 awk 程序,那么在给文件命名时,最好写上 **.awk** 的扩展名。 这样命名不是强制的,但这么做,会给文件管理器,编辑者(和你)一个关于文件内容的,很有用的提示。 - -执行这一脚本: - - -``` -$ awk -f example1.awk colours.txt -A: raspberry  red    4 -B: banana     yellow 6 -A: apple      green  8 -``` - -一个包含 awk 命令的文件,在最开头一行加上 **#!** ,就能变成可执行脚本。 创建一个名为 **example2.awk** 的文件,包含以下内容: - -``` -#!/usr/bin/awk -f -# -# 除了第一行,在其他行前显示行号 -# - -NR > 1 { -    printf "%d: %s\n",NR,$0 -} -``` - -可以说,脚本中只有一行,大多数情况下没什么用。 但在某些情况下,执行一个脚本,比记住,然后打一条命令要容易的多。 一个脚本文件,也提供了一个记录命令具体作用的好机会。 以 **#** 号开头的行是注释,awk 会忽略它们。 - -给文件可执行权限: - - -``` -`$ chmod u+x example2.awk` -``` - -执行脚本: - - -``` -$ ./example2.awk colours.txt -2: apple      red    4 -2: banana     yellow 6 -4: raspberry red    3 -5: grape      purple 10 -[...] -``` - - -将awk 命令放在脚本文件中,有一个好处就是,修改和格式化输出会更容易。在终端中,如果能用一行执行多条awk命令,那么输入多行,才能达到同样效果,就显得有些多余了。 - -### 试一试 - -你现在已经足够了解, awk 是如何执行指令的了。现在你应该能编写复杂的awk 程序了。 试着编写一个awk 脚本,它需要: 至少包括一个条件模式,以及多个规则。如果你想使用除 **print** 和 **printf** 以外的函数,可以参考在线[ gawk 手册][4] . - - -下面这个例子是个很好的切入点: - - -``` -#!/usr/bin/awk -f -# -# 显示所有记录 除了出现以下情况 -# 如果第一个记录 包含 “raspberry” -# 将 “red” 替换成 “pi” - -$1 == "raspberry" { -        gsub(/red/,"pi") -} - -{ print } -``` - -试着执行这个脚本,看看输出是什么。接下来就看你自己的了。 - - -这一系列的下一篇文章,将会介绍更多,能在更复杂(更有用!) 脚本中使用的函数。 - -* * * - -_这篇文章改编自 [Hacker Public Radio][5] 系列,一个技术社区博客_ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/fields-records-variables-awk - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_laptop_code_programming_mountain_view.jpg?itok=yx5buqkr (Man at laptop on a mountain) -[2]: https://www.gnu.org/software/gawk/manual/html_node/History.html#History -[3]: https://opensource.com/article/19/10/intro-awk -[4]: https://www.gnu.org/software/gawk/manual/ -[5]: http://hackerpublicradio.org/eps.php?id=2129 diff --git a/translated/tech/20191125 How to use loops in awk.md b/translated/tech/20191125 How to use loops in awk.md new file mode 100644 index 0000000000..a200611ba2 --- /dev/null +++ b/translated/tech/20191125 How to use loops in awk.md @@ -0,0 +1,163 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to use loops in awk" +[#]: via: "https://opensource.com/article/19/11/loops-awk" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +在 awk 中怎么使用循环 +====== +来学习一下多次执行同一条命令的不同类型的循环。 +![arrows cycle symbol for failing faster][1] + +awk 脚本有三个主要部分:BEGIN 和 END 函数(都可选),用户自己写的每次要执行的函数。某种程度上,awk 的主体部分就是一个循环,因为函数中的命令对每一条记录都会执行一次。然而,有时你希望对于一条记录执行多次命令,那么你就需要用到循环。 + +有多种类型的循环,分别适合不同的场景。 + +### while 循环 + +一个 while 循环检测一个表达式,如果表达式为 *true* 就执行命令。当表达式变为 *false* 时,循环中断。 + + +``` +#!/bin/awk -f + +BEGIN { +        # Print the squares from 1 to 10 + +    i=1; +    while (i <= 10) { +        print "The square of ", i, " is ", i*i; +        i = i+1; +    } +exit; +} +``` + +在这个简单实例中, awk 打印了变量 *i* 中的整数值的平方。**while (i <= 10)** 语句告诉 awk 仅在 *i* 的值小于或等于 10 时才执行循环。在循环最后一次执行时(*i* 的值是 10),循环终止。 + +### Do while 循环 + +do-while 循环在关键字 **do** 之后执行命令。在每次循环结束时检测一个表达式来决定是否终止循环。仅在表达式返回 true 时才会重复执行命令(即还没有到终止循环的条件)。如果表达式返回 false,因为到了终止循环的条件所以循环被终止。 + + +``` +#!/usr/bin/awk -f +BEGIN { + +        i=2; +        do { +                print "The square of ", i, " is ", i*i; +                i = i + 1 +        } +        while (i < 10) + +exit; +} +``` + +### for 循环 + +awk 中有两种 **for**循环。 + +一种 **for** 循环初始化一个变量,检测一个表达式,执行变量递增,当表达式的结果为 true 时循环就会一直执行。 + + +``` +#!/bin/awk -f + +BEGIN { +    for (i=1; i <= 10; i++) { +        print "The square of ", i, " is ", i*i; +    } +exit; +} +``` + +另一种 **for** 循环设置一个有连续 index 的数组变量,对每一个索引执行一个命令集。换句话说,它用一个数组「收集」每一条命令执行后的结果。 + +本例实现了一个简易版的 Unix 命令 **uniq** 。通过把一系列字符串作为 key 加到数组 a 中,当相同的 key 再次出现时就增加 value 的值,可以得到某个字符串出现的次数(就像 **uniq** 的 **--count** 选项)。如果你打印该数组的所有 key,将会得到出现过的所有字符串。 + +用 demo 文件 **colours.txt** (前一篇文章中的文件)来举例: + + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +raspberry  red    99 +strawberry red    3 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + + + +这是 awk 版的简易 **uniq -c**: + + +``` +#! /usr/bin/awk -f + +NR != 1 { +    a[$2]++ +} +END { +    for (key in a) { +                print a[key] " " key +    } +} +``` + +示例数据文件的第三列是第一列列出的条目的计数。你可以用一个数组和 **for** 循环来从 color 维度统计第三列的条目。 + + +``` +#! /usr/bin/awk -f + +BEGIN { +    FS=" "; +    OFS="\t"; +    print("color\tsum"); +} +NR != 1 { +    a[$2]+=$3; +} +END { +    for (b in a) { +        print b, a[b] +    } +} +``` + +你可以看到,在处理文件之前也需要在 **前置** 函数(仅仅执行一次)中打印一列表头。 + +### 循环 + +在任何编程语言中循环都是很重要的一部分,awk 也不例外。使用循环你可以控制 awk 脚本怎样去运行,它可以统计什么信息,还有它怎么去处理你的数据。我们下一篇文章会讨论 switch 语句,**continue** 和 **next**。 + +* * * + +你是否更想听这篇文章?本文已被收录进 [Hacker Public Radio](http://hackerpublicradio.org/eps.php?id=2330),一个来自黑客,面向黑客的社区技术博客。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/loops-awk + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh "arrows cycle symbol for failing faster" +[2]: http://hackerpublicradio.org/eps.php?id=2330