diff --git a/published/20180116 Command Line Heroes- Season 1- OS Wars_2.md b/published/20180116 Command Line Heroes- Season 1- OS Wars_2.md new file mode 100644 index 0000000000..68f6f81913 --- /dev/null +++ b/published/20180116 Command Line Heroes- Season 1- OS Wars_2.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11296-1.html) +[#]: subject: (Command Line Heroes: Season 1: OS Wars) +[#]: via: (https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux) +[#]: author: (redhat https://www.redhat.com) + +《代码英雄》第一季(2):操作系统战争(下)Linux 崛起 +====== + +> 代码英雄讲述了开发人员、程序员、黑客、极客和开源反叛者如何彻底改变技术前景的真实史诗故事。 + +![](https://www.redhat.com/files/webux/img/bandbg/bkgd-clh-ep2-2000x950.png) + +本文是《[代码英雄](https://www.redhat.com/en/command-line-heroes)》系列播客[第一季(2):操作系统战争(下)](https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux) 的[音频](https://dts.podtrac.com/redirect.mp3/audio.simplecast.com/2199861a.mp3)脚本。 + +> 微软帝国控制着 90% 的用户。操作系统的完全标准化似乎是板上钉钉的事了。但是一个不太可能的英雄出现在开源反叛组织中。戴着眼镜,温文尔雅的林纳斯·托瓦兹Linus Torvalds免费发布了他的 Linux® 程序。微软打了个趔趄,并且开始重整旗鼓而来,战场从个人电脑转向互联网。 + +**Saron Yitbarek:** 这玩意开着的吗?让我们进一段史诗般的星球大战的开幕吧,开始了。 + +配音:第二集:Linux® 的崛起。微软帝国控制着 90% 的桌面用户。操作系统的全面标准化似乎是板上钉钉的事了。然而,互联网的出现将战争的焦点从桌面转向了企业,在该领域,所有商业组织都争相构建自己的服务器。*[00:00:30]*与此同时,一个不太可能的英雄出现在开源反叛组织中。固执、戴着眼镜的 林纳斯·托瓦兹Linus Torvalds免费发布了他的 Linux 系统。微软打了个趔趄,并且开始重整旗鼓而来。 + +**Saron Yitbarek:** 哦,我们书呆子就是喜欢那样。上一次我们讲到哪了?苹果和微软互相攻伐,试图在一场争夺桌面用户的战争中占据主导地位。*[00:01:00]* 在第一集的结尾,我们看到微软获得了大部分的市场份额。很快,由于互联网的兴起以及随之而来的开发者大军,整个市场都经历了一场地震。互联网将战场从在家庭和办公室中的个人电脑用户转移到拥有数百台服务器的大型商业客户中。 + +这意味着巨量资源的迁移。突然间,所有相关企业不仅被迫为服务器空间和网站建设付费,而且还必须集成软件来进行资源跟踪和数据库监控等工作。*[00:01:30]* 你需要很多开发人员来帮助你。至少那时候大家都是这么做的。 + +在操作系统之战的第二部分,我们将看到优先级的巨大转变,以及像林纳斯·托瓦兹和理查德·斯托尔曼Richard Stallman这样的开源反逆者是如何成功地在微软和整个软件行业的核心地带引发恐惧的。 + +我是 Saron Yitbarek,你现在收听的是代码英雄,一款红帽公司原创的播客节目。*[00:02:00]* 每一集,我们都会给你带来“从码开始”改变技术的人的故事。 + +好。想象一下你是 1991 年时的微软。你自我感觉良好,对吧?满怀信心。确立了全球主导的地位感觉不错。你已经掌握了与其他企业合作的艺术,但是仍然将大部分开发人员、程序员和系统管理员排除在联盟之外,而他们才是真正的步兵。*[00:02:30]* 这时出现了个叫林纳斯·托瓦兹的芬兰极客。他和他的开源程序员团队正在开始发布 Linux,这个操作系统内核是由他们一起编写出来的。 + +坦白地说,如果你是微软公司,你并不会太在意 Linux,甚至不太关心开源运动,但是最终,Linux 的规模变得如此之大,以至于微软不可能不注意到。*[00:03:00]* Linux 第一个版本出现在 1991 年,当时大概有 1 万行代码。十年后,变成了 300 万行代码。如果你想知道,今天则是 2000 万行代码。 + +*[00:03:30]* 让我们停留在 90 年代初一会儿。那时 Linux 还没有成为我们现在所知道的庞然大物。这个奇怪的病毒式的操作系统只是正在这个星球上蔓延,全世界的极客和黑客都爱上了它。那时候我还太年轻,但有点希望我曾经经历过那个时候。在那个时候,发现 Linux 就如同进入了一个秘密社团一样。就像其他人分享地下音乐混音带一样,程序员与朋友们分享 Linux CD 集。 + +开发者 Tristram Oaten *[00:03:40]* 讲讲你 16 岁时第一次接触 Linux 的故事吧。 + +**Tristram Oaten:** 我和我的家人去了红海的 Hurghada 潜水度假。那是一个美丽的地方,强烈推荐。第一天,我喝了自来水。也许,我妈妈跟我说过不要这么做。我整个星期都病得很厉害,没有离开旅馆房间。*[00:04:00]* 当时我只带了一台新安装了 Slackware Linux 的笔记本电脑,我听说过这玩意并且正在尝试使用它。所有的东西都在 8 张 cd 里面。这种情况下,我只能整个星期都去了解这个外星一般的系统。我阅读手册,摆弄着终端。我记得当时我甚至不知道一个点(表示当前目录)和两个点(表示前一个目录)之间的区别。 + +*[00:04:30]* 我一点头绪都没有。犯过很多错误,但慢慢地,在这种强迫的孤独中,我突破了障碍,开始理解并明白命令行到底是怎么回事。假期结束时,我没有看过金字塔、尼罗河等任何埃及遗址,但我解锁了现代世界的一个奇迹。我解锁了 Linux,接下来的事大家都知道了。 + +**Saron Yitbarek:** 你会从很多人那里听到关于这个故事的不同说法。访问 Linux 命令行是一种革命性的体验。 + +**David Cantrell:** *[00:05:00]* 它给了我源代码。我当时的感觉是,“太神奇了。” + +**Saron Yitbarek:** 我们正在参加一个名为 Flock to Fedora 的 2017 年 Linux 开发者大会。 + +**David Cantrell:** ……非常有吸引力。我觉得我对这个系统有了更多的控制力,它越来越吸引我。我想,从 1995 年我第一次编译 Linux 内核那时起,我就迷上了它。 + +**Saron Yitbarek:** 开发者 David Cantrell 与 Joe Brockmire。 + +**Joe Brockmeier:** *[00:05:30]* 我在 Cheap Software 转的时候发现了一套四张 CD 的 Slackware Linux。它看起来来非常令人兴奋而且很有趣,所以我把它带回家,安装在第二台电脑上,开始摆弄它,有两件事情让我感到很兴奋:一个是,我运行的不是 Windows,另一个是 Linux 的开源特性。 + +**Saron Yitbarek:** *[00:06:00]* 某种程度上来说,对命令行的使用总是存在的。在开源真正开始流行还要早的几十年前,人们(至少在开发人员中是这样)总是希望能够做到完全控制。让我们回到操作系统大战之前的那个时代,在苹果和微软为他们的 GUI 而战之前。那时也有代码英雄。保罗·琼斯Paul Jones教授(在线图书馆 ibiblio.org 的负责人)在那个古老的时代,就是一名开发人员。 + +**Paul Jones:** *[00:06:30]* 从本质上讲,互联网在那个时候客户端-服务器架构还是比较少的,而更多的是点对点架构的。确实,我们会说,某种 VAX 到 VAX 的连接(LCTT 译注:DEC 的一种操作系统),某种科学工作站到科学工作站的连接。这并不意味着没有客户端-服务端的架构及应用程序,但这的确意味着,最初的设计是思考如何实现点对点,*[00:07:00]* 它与 IBM 一直在做的东西相对立。IBM 给你的只有哑终端,这种终端只能让你管理用户界面,却无法让你像真正的终端一样为所欲为。 + +**Saron Yitbarek:** 图形用户界面在普通用户中普及的同时,在工程师和开发人员中总是存在着一股相反的力量。早在 Linux 出现之前的二十世纪七八十年代,这股力量就存在于 Emacs 和 GNU 中。有了斯托尔曼的自由软件基金会后,总有某些人想要使用命令行,但上世纪 90 年代的 Linux 提供了前所未有的东西。 + +*[00:07:30]* Linux 和其他开源软件的早期爱好者是都是先驱。我正站在他们的肩膀上。我们都是。 + +你现在收听的是代码英雄,一款由红帽公司原创的播客。这是操作系统大战的第二部分:Linux 崛起。 + +**Steven Vaughan-Nichols:** 1998 年的时候,情况发生了变化。 + +**Saron Yitbarek:** *[00:08:00]* Steven Vaughan-Nichols 是 zdnet.com 的特约编辑,他已经写了几十年关于技术商业方面的文章了。他将向我们讲述 Linux 是如何慢慢变得越来越流行,直到自愿贡献者的数量远远超过了在 Windows 上工作的微软开发人员的数量的。不过,Linux 从未真正追上微软桌面客户的数量,这也许就是微软最开始时忽略了 Linux 及其开发者的原因。Linux 真正大放光彩的地方是在服务器机房。当企业开始线上业务时,每个企业都需要一个满足其需求的独特编程解决方案。 + +*[00:08:30]* WindowsNT 于 1993 年问世,当时它已经在与其他的服务器操作系统展开竞争了,但是许多开发人员都在想,“既然我可以通过 Apache 构建出基于 Linux 的廉价系统,那我为什么要购买 AIX 设备或大型 Windows 设备呢?”关键点在于,Linux 代码已经开始渗透到几乎所有网上的东西中。 + +**Steven Vaughan-Nichols:** *[00:09:00]* 令微软感到惊讶的是,它开始意识到,Linux 实际上已经开始有一些商业应用,不是在桌面环境,而是在商业服务器上。因此,他们发起了一场运动,我们称之为 FUD - 恐惧、不确定和怀疑fear, uncertainty and double。他们说,“哦,Linux 这玩意,真的没有那么好。它不太可靠。你一点都不能相信它”。 + +**Saron Yitbarek:** 这种软宣传式的攻击持续了一段时间。微软也不是唯一一个对 Linux 感到紧张的公司。这其实是整个行业在对抗这个奇怪新人的挑战。*[00:09:30]* 例如,任何与 UNIX 有利害关系的人都可能将 Linux 视为篡夺者。有一个案例很著名,那就是 SCO 组织(它发行过一种 UNIX 版本)在过去 10 多年里发起一系列的诉讼,试图阻止 Linux 的传播。SCO 最终失败而且破产了。与此同时,微软一直在寻找机会,他们必须要采取动作,只是不清楚具体该怎么做。 + +**Steven Vaughan-Nichols:** *[00:10:00]* 让微软真正担心的是,第二年,在 2000 年的时候,IBM 宣布,他们将于 2001 年投资 10 亿美元在 Linux 上。现在,IBM 已经不再涉足个人电脑业务。(那时)他们还没有走出去,但他们正朝着这个方向前进,他们将 Linux 视为服务器和大型计算机的未来,在这一点上,剧透警告,IBM 是正确的。*[00:10:30]* Linux 将主宰服务器世界。 + +**Saron Yitbarek:** 这已经不再仅仅是一群黑客喜欢他们对命令行的绝地武士式的控制了。金钱的投入对 Linux 助力极大。Linux 国际Linux International的执行董事 John “Mad Dog” Hall 有一个故事可以解释为什么会这样。我们通过电话与他取得了联系。 + +**John Hall:** *[00:11:00]* 我有一个名叫 Dirk Holden 的朋友,他是德国德意志银行的系统管理员,他也参与了个人电脑上早期 X Windows 系统图形项目的工作。有一天我去银行拜访他,我说:“Dirk,你银行里有 3000 台服务器,用的都是 Linux。为什么不用 Microsoft NT 呢?”*[00:11:30]* 他看着我说:“是的,我有 3000 台服务器,如果使用微软的 Windows NT 系统,我需要 2999 名系统管理员。”他继续说道:“而使用 Linux,我只需要四个。”这真是完美的答案。 + +**Saron Yitbarek:** 程序员们着迷的这些东西恰好对大公司也极具吸引力。但由于 FUD 的作用,一些企业对此持谨慎态度。*[00:12:00]* 他们听到开源,就想:“开源。这看起来不太可靠,很混乱,充满了 BUG”。但正如那位银行经理所指出的,金钱有一种有趣的方式,可以说服人们克服困境。甚至那些只需要网站的小公司也加入了 Linux 阵营。与一些昂贵的专有选择相比,使用一个廉价的 Linux 系统在成本上是无法比拟的。如果你是一家雇佣专业人员来构建网站的商店,那么你肯定想让他们使用 Linux。 + +让我们快进几年。Linux 运行每个人的网站上。Linux 已经征服了服务器世界,然后智能手机也随之诞生。*[00:12:30]* 当然,苹果和他们的 iPhone 占据了相当大的市场份额,而且微软也希望能进入这个市场,但令人惊讶的是,Linux 也在那,已经做好准备了,迫不及待要大展拳脚。 + +作家兼记者 James Allworth。 + +**James Allworth:** 肯定还有容纳第二个竞争者的空间,那本可以是微软,但是实际上却是 Android,而 Andrid 基本上是基于 Linux 的。众所周知,Android 被谷歌所收购,现在运行在世界上大部分的智能手机上,谷歌在 Linux 的基础上创建了 Android。*[00:13:00]* Linux 使他们能够以零成本从一个非常复杂的操作系统开始。他们成功地实现了这一目标,最终将微软挡在了下一代设备之外,至少从操作系统的角度来看是这样。 + +**Saron Yitbarek:** *[00:13:30]* 这可是个大地震,很大程度上,微软有被埋没的风险。John Gossman 是微软 Azure 团队的首席架构师。他还记得当时困扰公司的困惑。 + +**John Gossman:** 像许多公司一样,微软也非常担心知识产权污染。他们认为,如果允许开发人员使用开源代码,那么他们可能只是将一些代码复制并粘贴到某些产品中,就会让某种病毒式的许可证生效从而引发未知的风险……他们也很困惑,*[00:14:00]* 我认为,这跟公司文化有关,很多公司,包括微软,都对开源开发的意义和商业模式之间的分歧感到困惑。有一种观点认为,开源意味着你所有的软件都是免费的,人们永远不会付钱。 + +**Saron Yitbarek:** 任何投资于旧的、专有软件模型的人都会觉得这里发生的一切对他们构成了威胁。当你威胁到像微软这样的大公司时,是的,他们一定会做出反应。*[00:14:30]* 他们推动所有这些 FUD —— 恐惧、不确定性和怀疑是有道理的。当时,商业运作的方式基本上就是相互竞争。不过,如果是其他公司的话,他们可能还会一直怀恨在心,抱残守缺,但到了 2013 年的微软,一切都变了。 + +微软的云计算服务 Azure 上线了,令人震惊的是,它从第一天开始就提供了 Linux 虚拟机。*[00:15:00]* 史蒂夫·鲍尔默Steve Ballmer,这位把 Linux 称为癌症的首席执行官,已经离开了,代替他的是一位新的有远见的首席执行官萨提亚·纳德拉Satya Nadella。 + +**John Gossman:** 萨提亚有不同的看法。他属于另一个世代。比保罗、比尔和史蒂夫更年轻的世代,他对开源有不同的看法。 + +**Saron Yitbarek:** 还是来自微软 Azure 团队的 John Gossman。 + +**John Gossman:** *[00:15:30]* 大约四年前,处于实际需要,我们在 Azure 中添加了 Linux 支持。如果访问任何一家企业客户,你都会发现他们并不会才试着决定是使用 Windows 还是使用 Linux、 使用 .net 还是使用 Java ^TM 。他们在很久以前就做出了决定 —— 大约 15 年前才有这样的一些争论。*[00:16:00]* 现在,我见过的每一家公司都混合了 Linux 和 Java、Windows 和 .net、SQL Server、Oracle 和 MySQL —— 基于专有源代码的产品和开放源代码的产品。 + +如果你打算运维一个云服务,允许这些公司在云上运行他们的业务,那么你根本不能告诉他们,“你可以使用这个软件,但你不能使用那个软件。” + +**Saron Yitbarek:** *[00:16:30]* 这正是萨提亚·纳德拉采纳的哲学思想。2014 年秋季,他站在舞台上,希望传递一个重要信息。“微软爱 Linux”。他接着说,“20% 的 Azure 业务量已经是 Linux 了,微软将始终对 Linux 发行版提供一流的支持。”没有哪怕一丝对开源的宿怨。 + +为了说明这一点,在他们的背后有一个巨大的标志,上面写着:“Microsoft ❤️ Linux”。哇噢。对我们中的一些人来说,这种转变有点令人震惊,但实际上,无需如此震惊。下面是 Steven Levy,一名科技记者兼作家。 + +**Steven Levy:** *[00:17:00]* 当你在踢足球的时候,如果草坪变滑了,那么你也许会换一种不同的鞋子。他们当初就是这么做的。*[00:17:30]* 他们不能否认现实,而且他们里面也有聪明人,所以他们必须意识到,这就是这个世界的运行方式,不管他们早些时候说了什么,即使他们对之前的言论感到尴尬,但是让他们之前关于开源多么可怕的言论影响到现在明智的决策那才真的是疯了。 + +**Saron Yitbarek:** 微软低下了它高傲的头。你可能还记得苹果公司,经过多年的孤立无援,最终转向与微软构建合作伙伴关系。现在轮到微软进行 180 度转变了。*[00:18:00]* 经过多年的与开源方式的战斗后,他们正在重塑自己。要么改变,要么死亡。Steven Vaughan-Nichols。 + +**Steven Vaughan-Nichols:** 即使是像微软这样规模的公司也无法与数千个开发着包括 Linux 在内的其它大项目的开源开发者竞争。很长时间以来他们都不愿意这么做。前微软首席执行官史蒂夫·鲍尔默对 Linux 深恶痛绝。*[00:18:30]* 由于它的 GPL 许可证,他视 Linux 为一种癌症,但一旦鲍尔默被扫地出门,新的微软领导层说,“这就好像试图命令潮流不要过来,但潮水依然会不断涌进来。我们应该与 Linux 合作,而不是与之对抗。” + +**Saron Tiebreak:** 事实上,互联网技术史上最大的胜利之一就是微软最终决定做出这样的转变。*[00:19:00]* 当然,当微软出现在开源圈子时,老一代的铁杆 Linux 支持者是相当怀疑的。他们不确定自己是否能接受这些家伙,但正如 Vaughan-Nichols 所指出的,今天的微软已经不是以前的微软了。 + +**Steven Vaughan-Nichols:** 2017 年的微软既不是史蒂夫·鲍尔默的微软,也不是比尔·盖茨的微软。这是一家完全不同的公司,有着完全不同的方法,而且,一旦使用了开源,你就无法退回到之前。*[00:19:30]* 开源已经吞噬了整个技术世界。从未听说过 Linux 的人可能对它并不了解,但是每次他们访问 Facebook,他们都在运行 Linux。每次执行谷歌搜索时,你都在运行 Linux。 + +*[00:20:00]* 每次你用 Android 手机,你都在运行 Linux。它确实无处不在,微软无法阻止它,而且我认为以为微软能以某种方式接管它的想法,太天真了。 + +**Saron Yitbarek:** 开源支持者可能一直担心微软会像混入羊群中的狼一样,但事实是,开源软件的本质保护了它无法被完全控制。*[00:20:30]* 没有一家公司能够拥有 Linux 并以某种特定的方式控制它。Greg Kroah-Hartman 是 Linux 基金会的一名成员。 + +**Greg Kroah-Hartman:** 每个公司和个人都以自私的方式为 Linux 做出贡献。他们之所以这样做是因为他们想要解决他们所面临的问题,可能是硬件无法工作,或者是他们想要添加一个新功能来做其他事情,又或者想在他们的产品中使用它。这很棒,因为他们会把代码贡献回去,此后每个人都会从中受益,这样每个人都可以用到这份代码。正是因为这种自私,所有的公司,所有的人都能从中受益。 + +**Saron Yitbarek:** *[00:21:00]* 微软已经意识到,在即将到来的云战争中,与 Linux 作战就像与空气作战一样。Linux 和开源不是敌人,它们是空气。如今,微软以白金会员的身份加入了 Linux 基金会。他们成为 GitHub 开源项目的头号贡献者。*[00:21:30]* 2017 年 9 月,他们甚至加入了开源促进联盟Open Source Initiative。现在,微软在开源许可证下发布了很多代码。微软的 John Gossman 描述了他们开源 .net 时所发生的事情。起初,他们并不认为自己能得到什么回报。 + +**John Gossman:** 我们本没有指望来自社区的贡献,然而,三年后,超过 50% 的对 .net 框架库的贡献来自于微软之外。这包括大量的代码。*[00:22:00]* 三星为 .net 提供了 ARM 支持。Intel 和 ARM 以及其他一些芯片厂商已经为 .net 框架贡献了特定于他们处理器的代码生成,以及数量惊人的修复、性能改进等等 —— 既有单个贡献者也有社区。 + +**Saron Yitbarek:** 直到几年前,今天的这个微软,这个开放的微软,还是不可想象的。 + +*[00:22:30]* 我是 Saron Yitbarek,这里是代码英雄。好吧,我们已经看到了为了赢得数百万桌面用户的爱而战的激烈场面。我们已经看到开源软件在专有软件巨头的背后悄然崛起,并攫取了巨大的市场份额。*[00:23:00]* 我们已经看到了一批批的代码英雄将编程领域变成了我你今天看到的这个样子。如今,大企业正在吸收开源软件,通过这一切,每个人都从他人那里受益。 + +在技术的西部荒野,一贯如此。苹果受到施乐的启发,微软受到苹果的启发,Linux 受到 UNIX 的启发。进化、借鉴、不断成长。如果比喻成大卫和歌利亚(LCTT 译注:西方经典的以弱胜强战争中的两个主角)的话,开源软件不再是大卫,但是,你知道吗?它也不是歌利亚。*[00:23:30]* 开源已经超越了传统。它已经成为其他人战斗的战场。随着开源道路变得不可避免,新的战争,那些在云计算中进行的战争,那些在开源战场上进行的战争正在加剧。 + +这是 Steven Levy,他是一名作者。 + +**Steven Levy:** 基本上,到目前为止,包括微软在内,有四到五家公司,正以各种方式努力把自己打造成为全方位的平台,比如人工智能领域。你能看到智能助手之间的战争,你猜怎么着?*[00:24:00]* 苹果有一个智能助手,叫 Siri。微软有一个,叫 Cortana。谷歌有谷歌助手。三星也有一个智能助手。亚马逊也有一个,叫 Alexa。我们看到这些战斗遍布各地。也许,你可以说,最热门的人工智能平台将控制我们生活中所有的东西,而这五家公司就是在为此而争斗。 + +**Saron Yitbarek:** *[00:24:30]* 如果你正在寻找另一个反叛者,它们就像 Linux 奇袭微软那样,偷偷躲在 Facebook、谷歌或亚马逊身后,你也许要等很久,因为正如作家 James Allworth 所指出的,成为一个真正的反叛者只会变得越来越难。 + +**James Allworth:** 规模一直以来都是一种优势,但规模优势本质上……怎么说呢,我认为以前它们在本质上是线性的,现在它们在本质上是指数型的了,所以,一旦你开始以某种方法走在前面,另一个新玩家要想赶上来就变得越来越难了。*[00:25:00]* 我认为在互联网时代这大体来说来说是正确的,无论是因为规模,还是数据赋予组织的竞争力的重要性和优势。一旦你走在前面,你就会吸引更多的客户,这就给了你更多的数据,让你能做得更好,这之后,客户还有什么理由选择排名第二的公司呢,难道是因为因为他们落后了这么远么?*[00:25:30]* 我认为在云的时代这个逻辑也不会有什么不同。 + +**Saron Yitbarek:** 这个故事始于史蒂夫·乔布斯和比尔·盖茨这样的非凡的英雄,但科技的进步已经呈现出一种众包、有机的感觉。我认为据说我们的开源英雄林纳斯·托瓦兹在第一次发明 Linux 内核时甚至没有一个真正的计划。他无疑是一位才华横溢的年轻开发者,但他也像潮汐前的一滴水一样。*[00:26:00]* 变革是不可避免的。据估计,对于一家专有软件公司来说,用他们老式的、专有的方式创建一个 Linux 发行版将花费他们超过 100 亿美元。这说明了开源的力量。 + +最后,这并不是一个专有模型所能与之竞争的东西。成功的公司必须保持开放。这是最大、最终极的教训。*[00:26:30]* 还有一点要记住:当我们连接在一起的时候,我们在已有基础上成长和建设的能力是无限的。不管这些公司有多大,我们都不必坐等他们给我们更好的东西。想想那些为了纯粹的创造乐趣而学习编码的新开发者,那些自己动手丰衣足食的人。 + +未来的优秀程序员无管来自何方,只要能够访问代码,他们就能构建下一个大项目。 + +*[00:27:00]* 以上就是我们关于操作系统战争的两个故事。这场战争塑造了我们的数字生活。争夺主导地位的斗争从桌面转移到了服务器机房,最终进入了云计算领域。过去的敌人难以置信地变成了盟友,众包的未来让一切都变得开放。*[00:27:30]* 听着,我知道,在这段历史之旅中,还有很多英雄我们没有提到,所以给我们写信吧。分享你的故事。[Redhat.com/commandlineheroes](https://www.redhat.com/commandlineheroes) 。我恭候佳音。 + +在本季剩下的时间里,我们将学习今天的英雄们在创造什么,以及他们要经历什么样的战斗才能将他们的创造变为现实。让我们从壮丽的编程一线回来看看更多的传奇故事吧。我们每两周放一集新的博客。几周后,我们将为你带来第三集:敏捷革命。 + +*[00:28:00]* 代码英雄是一款红帽公司原创的播客。要想免费自动获得新一集的代码英雄,请订阅我们的节目。只要在苹果播客、Spotify、谷歌 Play,或其他应用中搜索“Command Line Heroes”。然后点击“订阅”。这样你就会第一个知道什么时候有新剧集了。 + +我是 Saron Yitbarek。感谢收听。继续编码。 + +-------------------------------------------------------------------------------- + +via: https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-2-rise-of-linux + +作者:[redhat][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.redhat.com +[b]: https://github.com/lujun9972 diff --git a/published/20180704 BASHing data- Truncated data items.md b/published/20180704 BASHing data- Truncated data items.md new file mode 100644 index 0000000000..dad03bf3da --- /dev/null +++ b/published/20180704 BASHing data- Truncated data items.md @@ -0,0 +1,115 @@ +如何发现截断的数据项 +====== + +**截断**(形容词):缩写、删节、缩减、剪切、剪裁、裁剪、修剪…… + +数据项被截断的一种情况是将其输入到数据库字段中,该字段的字符限制比数据项的长度要短。例如,字符串: + +``` +Yarrow Ravine Rattlesnake Habitat Area, 2 mi ENE of Yermo CA +``` + +是 60 个字符长。如果你将其输入到具有 50 个字符限制的“位置”字段,则可以获得: + +``` +Yarrow Ravine Rattlesnake Habitat Area, 2 mi ENE #末尾带有一个空格 +``` + +截断也可能导致数据错误,比如你打算输入: + +``` +Sally Ann Hunter (aka Sally Cleveland) +``` + +但是你忘记了闭合的括号: + +``` +Sally Ann Hunter (aka Sally Cleveland +``` + +这会让使用数据的用户觉得 Sally 是否有被修剪掉了数据项的其它的别名。 + +截断的数据项很难检测。在审核数据时,我使用三种不同的方法来查找可能的截断,但我仍然可能会错过一些。 + +**数据项的长度分布。**第一种方法是捕获我在各个字段中找到的大多数截断的数据。我将字段传递给 `awk` 命令,该命令按字段宽度计算数据项,然后我使用 `sort` 以宽度的逆序打印计数。例如,要检查以 `tab` 分隔的文件 `midges` 中的第 33 个字段: + +``` +awk -F"\t" 'NR>1 {a[length($33)]++} \ + END {for (i in a) print i FS a[i]}' midges | sort -nr +``` + +![distro1][1] + +最长的条目恰好有 50 个字符,这是可疑的,并且在该宽度处存在数据项的“凸起”,这更加可疑。检查这些 50 个字符的项目会发现截断: + +![distro2][2] + +我用这种方式检查的其他数据表有 100、200 和 255 个字符的“凸起”。在每种情况下,这种“凸起”都包含明显的截断。 + +**未匹配的括号。**第二种方法查找类似 `...(Sally Cleveland` 的数据项。一个很好的起点是数据表中所有标点符号的统计。这里我检查文件 `mag2`: + +``` +grep -o "[[:punct:]]" file | sort | uniqc +``` + +![punct][3] + +请注意,`mag2` 中的开括号和闭括号的数量不相等。要查看发生了什么,我使用 `unmatched` 函数,它接受三个参数并检查数据表中的所有字段。第一个参数是文件名,第二个和第三个是开括号和闭括号,用引号括起来。 + +``` +unmatched() +{ + awk -F"\t" -v start="$2" -v end="$3" \ + '{for (i=1;i<=NF;i++) \ + if (split($i,a,start) != split($i,b,end)) \ + print "line "NR", field "i":\n"$i}' "$1" +} +``` + +如果在字段中找到开括号和闭括号之间不匹配,则 `unmatched` 会报告行号和字段号。这依赖于 `awk` 的 `split` 函数,它返回由分隔符分隔的元素数(包括空格)。这个数字总是比分隔符的数量多一个: + +![split][4] + +这里 `ummatched` 检查 `mag2` 中的圆括号并找到一些可能的截断: + +![unmatched][5] + +我使用 `unmatched` 来找到不匹配的圆括号 `()`、方括号 `[]`、花括号 `{}` 和尖括号 `<>`,但该函数可用于任何配对的标点字符。 + +**意外的结尾。**第三种方法查找以尾随空格或非终止标点符号结尾的数据项,如逗号或连字符。这可以在单个字段上用 `cut` 用管道输入到 `grep` 完成,或者用 `awk` 一步完成。在这里,我正在检查以制表符分隔的表 `herp5` 的字段 47,并提取可疑数据项及其行号: + +``` +cut -f47 herp5 | grep -n "[ ,;:-]$" +或 +awk -F"\t" '$47 ~ /[ ,;:-]$/ {print NR": "$47}' herp5 +``` + +![herps5][6] + +用于制表符分隔文件的 awk 命令的全字段版本是: + +``` +awk -F"\t" '{for (i=1;i<=NF;i++) if ($i ~ /[ ,;:-]$/) \ + print "line "NR", field "i":\n"$i}' file +``` + +**谨慎的想法。**在我对字段进行的验证测试期间也会出现截断。例如,我可能会在“年”的字段中检查合理的 4 位数条目,并且有个 `198` 可能是 198n?还是 1898 年?带有丢失字符的截断数据项是个谜。 作为数据审计员,我只能报告(可能的)字符损失,并建议数据编制者或管理者恢复(可能)丢失的字符。 + +-------------------------------------------------------------------------------- + +via: https://www.polydesmida.info/BASHing/2018-07-04.html + +作者:[polydesmida][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.polydesmida.info/ +[1]:https://www.polydesmida.info/BASHing/img1/2018-07-04_1.png +[2]:https://www.polydesmida.info/BASHing/img1/2018-07-04_2.png +[3]:https://www.polydesmida.info/BASHing/img1/2018-07-04_3.png +[4]:https://www.polydesmida.info/BASHing/img1/2018-07-04_4.png +[5]:https://www.polydesmida.info/BASHing/img1/2018-07-04_5.png +[6]:https://www.polydesmida.info/BASHing/img1/2018-07-04_6.png diff --git a/published/20180802 Top 5 CAD Software Available for Linux in 2018.md b/published/20180802 Top 5 CAD Software Available for Linux in 2018.md new file mode 100644 index 0000000000..6607e44885 --- /dev/null +++ b/published/20180802 Top 5 CAD Software Available for Linux in 2018.md @@ -0,0 +1,141 @@ +Linux 上 5 个最好 CAD 软件 +====== + +[计算机辅助设计 (CAD)][1] 是很多工程流程的必不可少的部分。CAD 用于建筑、汽车零部件设计、航天飞机研究、航空、桥梁施工、室内设计,甚至服装和珠宝设计等专业领域。 + +在 Linux 上并不原生支持一些专业级 CAD 软件,如 SolidWorks 和 Autodesk AutoCAD。因此,今天,我们将看看排名靠前的 Linux 上可用的 CAD 软件。预知详情,请看下文。 + +### Linux 可用的最好的 CAD 软件 + +![CAD Software for Linux][2] + +在我们查看这份 Linux 的 CAD 软件列表前,你应该记住一件事,在这里不是所有的应用程序都是开源软件。我们也将包含一些非自由和开源软件的 CAD 软件来帮助普通的 Linux 用户。 + +我们为基于 Ubuntu 的 Linux 发行版提供了安装操作指南。对于其它发行版,你可以检查相应的网站来了解安装程序步骤。 + +该列表没有任何特殊顺序。在第一顺位的 CAD 应用程序不能认为比在第三顺位的好,以此类推。 + +#### 1、FreeCAD + +对于 3D 建模,FreeCAD 是一个极好的选择,它是自由 (免费和自由) 和开源软件。FreeCAD 坚持以构建机械工程和产品设计为目标。FreeCAD 是多平台的,可用于 Windows、Mac OS X+ 以及 Linux。 + +![freecad][3] + +尽管 FreeCAD 已经是很多 Linux 用户的选择,应该注意到,FreeCAD 仍然是 0.17 版本,因此,不适用于重要的部署。但是最近开发加速了。 + +- [FreeCAD][4] + +FreeCAD 并不专注于 direct-2D 绘图和真实形状的动画,但是它对机械工程相关的设计极好。FreeCAD 的 0.15 版本在 Ubuntu 存储库中可用。你可以通过运行下面的命令安装。 + +``` +sudo apt install freecad +``` + +为获取新的每日构建(目前 0.17),打开一个终端(`ctrl+alt+t`),并逐个运行下面的命令。 + +``` +sudo add-apt-repository ppa:freecad-maintainers/freecad-daily +sudo apt update +sudo apt install freecad-daily +``` + +#### 2、LibreCAD + +LibreCAD 是一个自由开源的、2D CAD 解决方案。一般来说,CAD 是一个资源密集型任务,如果你有一个相当普通的硬件,那么我建议你使用 LibreCAD ,因为它在资源使用方面真的轻量化。LibreCAD 是几何图形结构方面的一个极好的候选者。 + +![librecad][5] + +作为一个 2D 工具,LibreCAD 是好的,但是它不能在 3D 模型和渲染上工作。它有时可能不稳定,但是,它有一个可靠的自动保存,它不会让你的工作浪费。 + +- [LibreCAD][6] + +你可以通过运行下面的命令安装 LibreCAD。 + +``` +sudo apt install librecad +``` + +#### 3、OpenSCAD + +OpenSCAD 是一个自由的 3D CAD 软件。OpenSCAD 非常轻量和灵活。OpenSCAD 不是交互式的。你需要‘编程’模型,OpenSCAD 来解释这些代码来渲染一个可视化模型。在某种意义上说,它是一个编译器。你不能直接绘制模型,而是描述模型。 + +![openscad][7] + +OpenSCAD 是这个列表上最复杂的工具,但是,一旦你了解它,它将提供一个令人愉快的工作经历。 + +- [OpenSCAD][8] + +你可以使用下面的命令来安装 OpenSCAD。 + +``` +sudo apt-get install openscad +``` + +#### 4、BRL-CAD + +BRL-CAD 是最老的 CAD 工具之一。它也深受 Linux/UNIX 用户喜爱,因为它与模块化和自由的 *nix 哲学相一致。 + +![BRL-CAD rendering by Sean][9] + +BRL-CAD 始于 1979 年,并且,它仍然在积极开发。现在,BRL-CAD 不是 AutoCAD,但是对于像热穿透和弹道穿透等等的运输研究仍然是一个极好的选择。BRL-CAD 构成 CSG 的基础,而不是边界表示。在选择 BRL-CAD 时,你可能需要记住这一点。你可以从它的官方网站下载 BRL-CAD 。 + +- [BRL-CAD][10] + +#### 5、DraftSight (非开源) + +如果你习惯在 AutoCAD 上作业。那么,DraftSight 将是完美的替代。 + +DraftSight 是一个在 Linux 上可用的极好的 CAD 工具。它有相当类似于 AutoCAD 的工作流,这使得迁移更容易。它甚至提供一种类似的外观和感觉。DrafSight 也兼容 AutoCAD 的 .dwg 文件格式。 但是,DrafSight 是一个 2D CAD 软件。截至当前,它不支持 3D CAD 。 + +![draftsight][11] + +尽管 DrafSight 是一款起价 149 美元的商业软件。在 [DraftSight 网站][12]上可获得一个免费版本。你可以下载 .deb 软件包,并在基于 Ubuntu 的发行版上安装它。为了开始使用 DraftSight ,你需要使用你的电子邮件 ID 来注册你的免费版本。 + +- [DraftSight][12] + +#### 荣誉提名 + +* 随着云计算技术的巨大发展,像 [OnShape][13] 的云 CAD 解决方案已经变得日渐流行。 +* [SolveSpace][14] 是另一个值得一提的开源软件项目。它支持 3D 模型。 +* 西门子 NX 是一个在 Windows、Mac OS 及 Linux 上可用的工业级 CAD 解决方案,但是它贵得离谱,所以,在这个列表中被忽略。 +* 接下来,你有 [LeoCAD][15],它是一个 CAD 软件,在软件中你使用乐高积木来构建东西。你使用这些信息做些什么取决于你。 + +### 我对 Linux 上的 CAD 的看法 + +尽管在 Linux 上游戏变得流行,我总是告诉我的铁杆游戏朋友坚持使用 Windows。类似地,如果你是一名在你是课程中使用 CAD 的工科学生,我建议你使用学校规定的软件 (AutoCAD、SolidEdge、Catia),这些软件通常只在 Windows 上运行。 + +对于高级专业人士来说,当我们讨论行业标准时,这些工具根本达不到标准。 + +对于想在 WINE 中运行 AutoCAD 的那些人来说,尽管一些较旧版本的 AutoCAD 可以安装在 WINE 上,它们根本不执行工作,小故障和崩溃严重损害这些体验。 + +话虽如此,我高度尊重上述列表中软件的开发者的工作。他们丰富了 FOSS 世界。很高兴看到像 FreeCAD 一样的软件在近些年中加速开发速度。 + +好了,今天到此为止。使用下面的评论区与我们分享你的想法,不用忘记分享这篇文章。谢谢。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cad-software-linux/ + +作者:[Aquil Roshan][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/aquil/ +[1]:https://en.wikipedia.org/wiki/Computer-aided_design +[2]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/cad-software-linux.jpeg +[3]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freecad.jpg +[4]:https://www.freecadweb.org/ +[5]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/librecad.jpg +[6]:https://librecad.org/ +[7]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/openscad.jpg +[8]:http://www.openscad.org/ +[9]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/brlcad.jpg +[10]:https://brlcad.org/ +[11]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/draftsight.jpg +[12]:https://www.draftsight2018.com/ +[13]:https://www.onshape.com/ +[14]:http://solvespace.com/index.pl +[15]:https://www.leocad.org/ diff --git a/published/20180904 How blockchain can complement open source.md b/published/20180904 How blockchain can complement open source.md new file mode 100644 index 0000000000..a8f2d15a3c --- /dev/null +++ b/published/20180904 How blockchain can complement open source.md @@ -0,0 +1,89 @@ +区块链能如何补充开源 +====== + +> 了解区块链如何成为去中心化的开源补贴模型。 + +![](https://img.linux.net.cn/data/attachment/album/201909/16/111521od1yn9r1nr1eii9o.jpg) + +《[大教堂与集市][1]The Cathedral and The Bazaar》是 20 年前由埃里克·史蒂文·雷蒙德Eric Steven Raymond(ESR)撰写的经典开源故事。在这个故事中,ESR 描述了一种新的革命性的软件开发模型,其中复杂的软件项目是在没有(或者很少的)集中管理的情况下构建的。这个新模型就是开源open source。 + +ESR 的故事比较了两种模式: + +* 经典模型(由“大教堂”所代表),其中软件由一小群人在封闭和受控的环境中通过缓慢而稳定的发布制作而成。 +* 以及新模式(由“集市”所代表),其中软件是在开放的环境中制作的,个人可以自由参与,但仍然可以产生一个稳定和连贯的系统。 +   +开源如此成功的一些原因可以追溯到 ESR 所描述的创始原则。尽早发布、经常发布,并接受许多头脑必然比一个更好的事实,让开源项目进入全世界的人才库(很少有公司能够使用闭源模式与之匹敌)。 + +在 ESR 对黑客社区的反思分析 20 年后,我们看到开源成为占据主导地位的的模式。它不再仅仅是为了满足开发人员的个人喜好,而是创新发生的地方。甚至是全球[最大][2]软件公司也正在转向这种模式,以便继续占据主导地位。 + +### 易货系统 + +如果我们仔细研究开源模型在实践中的运作方式,我们就会意识到它是一个封闭系统,只对开源开发者和技术人员开放。影响项目方向的唯一方法是加入开源社区,了解成文和不成文的规则,学习如何贡献、编码标准等,并自己亲力完成。 + +这就是集市的运作方式,也是这个易货系统类比的来源。易货系统是一种交换服务和货物以换取其他服务和货物的方法。在市场中(即软件的构建地)这意味着为了获取某些东西,你必须自己也是一个生产者并回馈一些东西——那就是通过交换你的时间和知识来完成任务。集市是开源开发者与其他开源开发者交互并以开源方式生成开源软件的地方。 + +易货系统向前迈出了一大步,从自给自足的状态演变而来,而在自给自足的状态下,每个人都必须成为所有行业的杰出人选。使用易货系统的集市(开源模式)允许具有共同兴趣和不同技能的人们收集、协作和创造个人无法自行创造的东西。易货系统简单,没有现代货币系统那么复杂,但也有一些局限性,例如: + +* 缺乏可分性:在没有共同的交换媒介的情况下,不能将较大的不可分割的商品/价值兑换成较小的商品/价值。例如,如果你想在开源项目中进行一些哪怕是小的更改,有时你可能仍需要经历一个高进入门槛。 +* 存储价值:如果一个项目对贵公司很重要,你可能需要投入大量投资/承诺。但由于它是开源开发者之间的易货系统,因此拥有强大发言权的唯一方法是雇佣许多开源贡献者,但这并非总是可行的。 +* 转移价值:如果你投资了一个项目(受过培训的员工、雇用开源开发者)并希望将重点转移到另一个项目,却不可能快速转移(你在上一个项目中拥有的)专业知识、声誉和影响力。 +* 时间脱钩:易货系统没有为延期或提前承诺提供良好的机制。在开源世界中,这意味着用户无法提前或在未来期间以可衡量的方式表达对项目的承诺或兴趣。 +   +下面,我们将探讨如何使用集市的后门解决这些限制。 + +### 货币系统 + +人们因为不同的原因勾连于集市上:有些人在那里学习,有些是出于满足开发者个人的喜好,有些人为大型软件工厂工作。因为在集市中拥有发言权的唯一方法是成为开源社区的一份子并加入这个易货系统,为了在开源世界获得信誉,许多大型软件公司雇用这些开发者并以货币方式支付薪酬。这代表可以使用货币系统来影响集市,开源不再只是为了满足开发者个人的喜好,它也占据全球整体软件生产的重要部分,并且有许多人想要施加影响。 + +开源设定了开发人员交互的指导原则,并以分布式方式构建一致的系统。它决定了项目的治理方式、软件的构建方式以及其成果如何分发给用户。它是分散的实体共同构建高质量软件的开放共识模型。但是开源模型并没有包括如何补贴开源的部分,无论是直接还是间接地,通过内在或外在动机的赞助,都与集市无关。 + +![](https://opensource.com/sites/default/files/uploads/tokenomics_-_page_4.png) + +目前,没有相当于以补贴为目的的去中心化式开源开发模型。大多数开源补贴都是集中式的,通常一家公司通过雇用该项目的主要开源开发者来主导该项目。说实话,这是目前最好的状况,因为它保证了开发人员将长期获得报酬,项目也将继续蓬勃发展。 + +项目垄断情景也有例外情况:例如,一些云原生计算基金会(CNCF)项目是由大量的竞争公司开发的。此外,Apache 软件基金会(ASF)旨在通过鼓励不同的贡献者来使他们管理的项目不被单一供应商所主导,但实际上大多数受欢迎的项目仍然是单一供应商项目。 + +我们缺少的是一个开放的、去中心化的模式,就像一个没有集中协调和所有权的集市一样,消费者(开源用户)和生产者(开源开发者)在市场力量和开源价值的驱动下相互作用。为了补充开源,这样的模型也必须是开放和去中心化的,这就是为什么我认为区块链技术[最适合][3]的原因。 + +旨在补贴开源开发的大多数现有区块链(和非区块链)平台主要针对的是漏洞赏金、小型和零碎的任务。少数人还专注于资助新的开源项目。但并没有多少平台旨在提供维持开源项目持续开发的机制 —— 基本上,这个系统可以模仿开源服务提供商公司或开放核心、基于开源的 SaaS 产品公司的行为:确保开发人员可以获得持续和可预测的激励,并根据激励者(即用户)的优先事项指导项目开发。这种模型将解决上面列出的易货系统的局限性: + +* 允许可分性:如果你想要一些小的修复,你可以支付少量费用,而不是成为项目的开源开发者的全部费用。 +* 存储价值:你可以在项目中投入大量资金,并确保其持续发展和你的发言权。 +* 转移价值:在任何时候,你都可以停止投资项目并将资金转移到其他项目中。 +* 时间脱钩:允许定期定期付款和订阅。 + +还有其他好处,纯粹是因为这种基于区块链的系统是透明和去中心化的:根据用户的承诺、开放的路线图承诺、去中心化决策等来量化项目的价值/实用性。 + +### 总结 + +一方面,我们看到大公司雇用开源开发者并收购开源初创公司甚至基础平台(例如微软收购 GitHub)。许多(甚至大多数)能够长期成功运行的开源项目都集中在单个供应商周围。开源的重要性及其集中化是一个事实。 + +另一方面,[维持开源软件][4]的挑战正变得越来越明显,许多人正在更深入地研究这个领域及其基本问题。有一些项目具有很高的知名度和大量的贡献者,但还有许多其他也重要的项目缺乏足够的贡献者和维护者。 + +有[许多努力][3]试图通过区块链来解决开源的挑战。这些项目应提高透明度、去中心化和补贴,并在开源用户和开发人员之间建立直接联系。这个领域还很年轻,但是进展很快,随着时间的推移,集市将会有一个加密货币系统。 + +如果有足够的时间和足够的技术,去中心化就会发生在很多层面: + +* 互联网是一种去中心化的媒介,它释放了全球分享和获取知识的潜力。 +* 开源是一种去中心化的协作模式,它释放了全球的创新潜力。 +* 同样,区块链可以补充开源,成为去中心化的开源补贴模式。 + +请在[推特][5]上关注我在这个领域的其他帖子。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/barter-currency-system + +作者:[Bilgin lbryam][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[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/bibryam +[1]: http://catb.org/ +[2]: http://oss.cash/ +[3]: https://opensource.com/article/18/8/open-source-tokenomics +[4]: https://www.youtube.com/watch?v=VS6IpvTWwkQ +[5]: http://twitter.com/bibryam diff --git a/published/20181113 Eldoc Goes Global.md b/published/20181113 Eldoc Goes Global.md new file mode 100644 index 0000000000..4714f966a1 --- /dev/null +++ b/published/20181113 Eldoc Goes Global.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11306-1.html) +[#]: subject: (Eldoc Goes Global) +[#]: via: (https://emacsredux.com/blog/2018/11/13/eldoc-goes-global/) +[#]: author: (Bozhidar Batsov https://emacsredux.com) + +Emacs:Eldoc 全局化了 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/05/045702d99v9vv4xy0aybmm.jpg) + +最近我注意到 Emacs 25.1 增加了一个名为 `global-eldoc-mode` 的模式,它是流行的 `eldoc-mode` 的一个全局化的变体。而且与 `eldoc-mode` 不同的是,`global-eldoc-mode` 默认是开启的! + +这意味着你可以删除 Emacs 配置中为主模式开启 `eldoc-mode` 的代码了: + +``` +;; That code is now redundant +(add-hook 'emacs-lisp-mode-hook #'eldoc-mode) +(add-hook 'ielm-mode-hook #'eldoc-mode) +(add-hook 'cider-mode-hook #'eldoc-mode) +(add-hook 'cider-repl-mode-hook #'eldoc-mode) +``` + +[有人说][1] `global-eldoc-mode` 在某些不支持的模式中会有性能问题。我自己从未遇到过,但若你像禁用它则只需要这样: + +``` +(global-eldoc-mode -1) +``` + +现在是时候清理我的配置了!删除代码就是这么爽! + +-------------------------------------------------------------------------------- + +via: https://emacsredux.com/blog/2018/11/13/eldoc-goes-global/ + +作者:[Bozhidar Batsov][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://emacsredux.com +[b]: https://github.com/lujun9972 +[1]: https://emacs.stackexchange.com/questions/31414/how-to-globally-disable-eldoc diff --git a/published/20190129 Create an online store with this Java-based framework.md b/published/20190129 Create an online store with this Java-based framework.md new file mode 100644 index 0000000000..ad9c52ab6f --- /dev/null +++ b/published/20190129 Create an online store with this Java-based framework.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11373-1.html) +[#]: subject: (Create an online store with this Java-based framework) +[#]: via: (https://opensource.com/article/19/1/scipio-erp) +[#]: author: (Paul Piper https://opensource.com/users/madppiper) + +使用 Java 框架 Scipio ERP 创建一个在线商店 +====== + +> Scipio ERP 具有包罗万象的应用程序和功能。 + +![](https://img.linux.net.cn/data/attachment/album/201909/22/133258hqvwax5w1zvq5ffa.jpg) + +如果,你想在网上销售产品或服务,但要么找不到合适的软件,要么觉得定制成本太高?那么,[Scipio ERP][1] 也许正是你想要的。 + +Scipio ERP 是一个基于 Java 的开源的电子商务框架,具有包罗万象的应用程序和功能。这个项目于 2014 年从 [Apache OFBiz][2] 分叉而来,侧重于更好的定制和更现代的吸引力。这个电子商务组件非常丰富,可以在多商店环境中工作,同时支持国际化,具有琳琅满目的产品配置,而且它还兼容现代 HTML 框架。该软件还为许多其他业务场景提供标准应用程序,例如会计、仓库管理或销售团队自动化。它都是高度标准化的,因此易于定制,如果你想要的不仅仅是一个虚拟购物车,这是非常棒的。 + +该系统也使得跟上现代 Web 标准变得非常容易。所有界面都是使用系统的“[模板工具包][3]”构建的,这是一个易于学习的宏集,可以将 HTML 与所有应用程序分开。正因为如此,每个应用程序都已经标准化到核心。听起来令人困惑?它真的不是 HTML——它看起来很像 HTML,但你写的内容少了很多。 + +### 初始安装 + +在你开始之前,请确保你已经安装了 Java 1.8(或更高版本)的 SDK 以及一个 Git 客户端。完成了?太棒了!接下来,切换到 Github 上的主分支: + +``` +git clone https://github.com/ilscipio/scipio-erp.git +cd scipio-erp +git checkout master +``` + +要安装该系统,只需要运行 `./install.sh` 并从命令行中选择任一选项。在开发过程中,最好一直使用 “installation for development”(选项 1),它还将安装一系列演示数据。对于专业安装,你可以修改初始配置数据(“种子数据”),以便自动为你设置公司和目录数据。默认情况下,系统将使用内部数据库运行,但是它[也可以配置][4]使用各种关系数据库,比如 PostgreSQL 和 MariaDB 等。 + +![安装向导][6] + +*按照安装向导完成初始配置* + +通过命令 `./start.sh` 启动系统然后打开链接 完成配置。如果你安装了演示数据, 你可以使用用户名 `admin` 和密码 `scipio` 进行登录。在安装向导中,你可以设置公司简介、会计、仓库、产品目录、在线商店和额外的用户配置信息。暂时在产品商店配置界面上跳过网站实体的配置。系统允许你使用不同的底层代码运行多个在线商店;除非你想这样做,一直选择默认值是最简单的。 + +祝贺你,你刚刚安装了 Scipio ERP!在界面上操作一两分钟,感受一下它的功能。 + +### 捷径 + +在你进入自定义之前,这里有一些方便的命令可以帮助你: + + * 创建一个 shop-override:`./ant create-component-shop-override` + * 创建一个新组件:`./ant create-component` + * 创建一个新主题组件:`./ant create-theme` + * 创建管理员用户:`./ant create-admin-user-login` + * 各种其他实用功能:`./ant -p` + * 用于安装和更新插件的实用程序:`./git-addons help` + +另外,请记下以下位置: + + * 将 Scipio 作为服务运行的脚本:`/tools/scripts/` + * 日志输出目录:`/runtime/logs` + * 管理应用程序:`` + * 电子商务应用程序:`` + +最后,Scipio ERP 在以下五个主要目录中构建了所有代码: + + * `framework`: 框架相关的源,应用程序服务器,通用界面和配置 + * `applications`: 核心应用程序 + * `addons`: 第三方扩展 + * `themes`: 修改界面外观 + * `hot-deploy`: 你自己的组件 + +除了一些配置,你将在 `hot-deploy` 和 `themes` 目录中进行开发。 + +### 在线商店定制 + +要真正使系统成为你自己的系统,请开始考虑使用[组件][7]。组件是一种模块化方法,可以覆盖、扩展和添加到系统中。你可以将组件视为独立 Web 模块,可以捕获有关数据库([实体][8])、功能([服务][9])、界面([视图][10])、[事件和操作][11]和 Web 应用程序等的信息。由于组件功能,你可以添加自己的代码,同时保持与原始源兼容。 + +运行命令 `./ant create-component-shop-override` 并按照步骤创建你的在线商店组件。该操作将会在 `hot-deploy` 目录内创建一个新目录,该目录将扩展并覆盖原始的电子商务应用程序。 + +![组件目录结构][13] + +*一个典型的组件目录结构。* + +你的组件将具有以下目录结构: + + * `config`: 配置 + * `data`: 种子数据 + * `entitydef`: 数据库表定义 + * `script`: Groovy 脚本的位置 + * `servicedef`: 服务定义 + * `src`: Java 类 + * `webapp`: 你的 web 应用程序 + * `widget`: 界面定义 + +此外,`ivy.xml` 文件允许你将 Maven 库添加到构建过程中,`ofbiz-component.xml` 文件定义整个组件和 Web 应用程序结构。除了一些在当前目录所能够看到的,你还可以在 Web 应用程序的 `WEB-INF` 目录中找到 `controller.xml` 文件。这允许你定义请求实体并将它们连接到事件和界面。仅对于界面来说,你还可以使用内置的 CMS 功能,但优先要坚持使用核心机制。在引入更改之前,请熟悉 `/applications/shop/`。 + +#### 添加自定义界面 + +还记得[模板工具包][3]吗?你会发现它在每个界面都有使用到。你可以将其视为一组易于学习的宏,它用来构建所有内容。下面是一个例子: + +``` +<@section title="Title"> +    <@heading id="slider">Slider +    <@row> +        <@cell columns=6> +            <@slider id="" class="" controls=true indicator=true> +                <@slide link="#" image="https://placehold.it/800x300">Just some content… +                <@slide title="This is a title" link="#" image="https://placehold.it/800x300"> +            +        +        <@cell columns=6>Second column +    + +``` + +不是很难,对吧?同时,主题包含 HTML 定义和样式。这将权力交给你的前端开发人员,他们可以定义每个宏的输出,并坚持使用自己的构建工具进行开发。 + +我们快点试试吧。首先,在你自己的在线商店上定义一个请求。你将修改此代码。一个内置的 CMS 系统也可以通过 进行访问,它允许你以更有效的方式创建新模板和界面。它与模板工具包完全兼容,并附带可根据你的喜好采用的示例模板。但是既然我们试图在这里理解系统,那么首先让我们采用更复杂的方法。 + +打开你商店 `webapp` 目录中的 [controller.xml][14] 文件。控制器会跟踪请求事件并相应地执行操作。下面的操作将会在 `/shop/test` 下创建一个新的请求: + +``` + + +      +      + +``` + +你可以定义多个响应,如果需要,可以在请求中使用事件或服务调用来确定你可能要使用的响应。我选择了“视图”类型的响应。视图是渲染的响应;其他类型是请求重定向、转发等。系统附带各种渲染器,可让你稍后确定输出;为此,请添加以下内容: + +``` + + +``` + +用你自己的组件名称替换 `my-component`。然后,你可以通过在 `widget/CommonScreens.xml` 文件的标签内添加以下内容来定义你的第一个界面: + +``` + +       
+            +            +            +                +                    +                        +                    +                +            +       
+   
+``` + +商店界面实际上非常模块化,由多个元素组成([小部件、动作和装饰器][15])。为简单起见,请暂时保留原样,并通过添加第一个模板工具包文件来完成新网页。为此,创建一个新的 `webapp/mycomponent/test/test.ftl` 文件并添加以下内容: + +``` +<@alert type="info">Success! +``` + +![自定义的界面][17] + +*一个自定义的界面。* + +打开 并惊叹于你自己的成就。 + +#### 自定义主题 + +通过创建自己的主题来修改商店的界面外观。所有主题都可以作为组件在 `themes` 文件夹中找到。运行命令 `./ant create-theme` 来创建你自己的主题。 + +![主题组件布局][19] + +*一个典型的主题组件布局。* + +以下是最重要的目录和文件列表: + + * 主题配置:`data/*ThemeData.xml` + * 特定主题封装的 HTML:`includes/*.ftl` + * 模板工具包 HTML 定义:`includes/themeTemplate.ftl` + * CSS 类定义:`includes/themeStyles.ftl` + * CSS 框架: `webapp/theme-title/` + +快速浏览工具包中的 Metro 主题;它使用 Foundation CSS 框架并且充分利用了这个框架。然后,然后,在新构建的 `webapp/theme-title` 目录中设置自己的主题并开始开发。Foundation-shop 主题是一个非常简单的特定于商店的主题实现,你可以将其用作你自己工作的基础。 + +瞧!你已经建立了自己的在线商店,准备个性化定制吧! + +![搭建完成的 Scipio ERP 在线商店][21] + +*一个搭建完成的基于 Scipio ERP的在线商店。* + +### 接下来是什么? + +Scipio ERP 是一个功能强大的框架,可简化复杂的电子商务应用程序的开发。为了更完整的理解,请查看项目[文档][7],尝试[在线演示][22],或者[加入社区][23]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/scipio-erp + +作者:[Paul Piper][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/madppiper +[b]: https://github.com/lujun9972 +[1]: https://www.scipioerp.com +[2]: https://ofbiz.apache.org/ +[3]: https://www.scipioerp.com/community/developer/freemarker-macros/ +[4]: https://www.scipioerp.com/community/developer/installation-configuration/configuration/#database-configuration +[5]: /file/419711 +[6]: https://opensource.com/sites/default/files/uploads/setup_step5_sm.jpg (Setup wizard) +[7]: https://www.scipioerp.com/community/developer/architecture/components/ +[8]: https://www.scipioerp.com/community/developer/entities/ +[9]: https://www.scipioerp.com/community/developer/services/ +[10]: https://www.scipioerp.com/community/developer/views-requests/ +[11]: https://www.scipioerp.com/community/developer/events-actions/ +[12]: /file/419716 +[13]: https://opensource.com/sites/default/files/uploads/component_structure.jpg (component directory structure) +[14]: https://www.scipioerp.com/community/developer/views-requests/request-controller/ +[15]: https://www.scipioerp.com/community/developer/views-requests/screen-widgets-decorators/ +[16]: /file/419721 +[17]: https://opensource.com/sites/default/files/uploads/success_screen_sm.jpg (Custom screen) +[18]: /file/419726 +[19]: https://opensource.com/sites/default/files/uploads/theme_structure.jpg (theme component layout) +[20]: /file/419731 +[21]: https://opensource.com/sites/default/files/uploads/finished_shop_1_sm.jpg (Finished Scipio ERP shop) +[22]: https://www.scipioerp.com/demo/ +[23]: https://forum.scipioerp.com/ diff --git a/published/20190401 Build and host a website with Git.md b/published/20190401 Build and host a website with Git.md new file mode 100644 index 0000000000..fd3b19a04f --- /dev/null +++ b/published/20190401 Build and host a website with Git.md @@ -0,0 +1,223 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11303-1.html) +[#]: subject: (Build and host a website with Git) +[#]: via: (https://opensource.com/article/19/4/building-hosting-website-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Git 建立和托管网站 +====== + +> 你可以让 Git 帮助你轻松发布你的网站。在我们《鲜为人知的 Git 用法》系列的第一篇文章中学习如何做到。 + +![](https://img.linux.net.cn/data/attachment/album/201909/04/134312l912496eegpoqaqe.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +创建一个网站曾经是极其简单的,而同时它又是一种黑魔法。回到 Web 1.0 的旧时代(不是每个人都会这样称呼它),你可以打开任何网站,查看其源代码,并对 HTML 及其内联样式和基于表格的布局进行反向工程,在这样的一两个下午之后,你就会感觉自己像一个程序员一样。不过要让你创建的页面放到互联网上,仍然有一些问题,因为这意味着你需要处理服务器、FTP 以及 webroot 目录和文件权限。虽然从那时起,现代网站变得愈加复杂,但如果你让 Git 帮助你,自出版可以同样容易(或更容易!)。 + +### 用 Hugo 创建一个网站 + +[Hugo][3] 是一个开源的静态站点生成器。静态网站是过去的 Web 的基础(如果你回溯到很久以前,那就是 Web 的*全部*了)。静态站点有几个优点:它们相对容易编写,因为你不必编写代码;它们相对安全,因为页面上没有执行代码;并且它们可以非常快,因为除了在页面上传输的任何内容之外没有任何处理。 + +Hugo 并不是唯一一个静态站点生成器。[Grav][4]、[Pico][5]、[Jekyll][6]、[Podwrite][7] 以及许多其他的同类软件都提供了一种创建一个功能最少的、只需要很少维护的网站的简单方法。Hugo 恰好是内置集成了 GitLab 集成的一个静态站点生成器,这意味着你可以使用免费的 GitLab 帐户生成和托管你的网站。 + +Hugo 也有一些非常大的用户。例如,如果你曾经去过 [Let's Encrypt](https://letsencrypt.org/) 网站,那么你已经用过了一个用 Hugo 构建的网站。 + +![Let's Encrypt website][8] + +#### 安装 Hugo + +Hugo 是跨平台的,你可以在 [Hugo 的入门资源][9]中找到适用于 MacOS、Windows、Linux、OpenBSD 和 FreeBSD 的安装说明。 + +如果你使用的是 Linux 或 BSD,最简单的方法是从软件存储库或 ports 树安装 Hugo。确切的命令取决于你的发行版,但在 Fedora 上,你应该输入: + +``` +$ sudo dnf install hugo +``` + +通过打开终端并键入以下内容确认你已正确安装: + +``` +$ hugo help +``` + +这将打印 `hugo` 命令的所有可用选项。如果你没有看到,你可能没有正确安装 Hugo 或需要[将该命令添加到你的路径][10]。 + +#### 创建你的站点 + +要构建 Hugo 站点,你必须有个特定的目录结构,通过输入以下命令 Hugo 将为你生成它: + +``` +$ hugo new site mysite +``` + +你现在有了一个名为 `mysite` 的目录,它包含构建 Hugo 网站所需的默认目录。 + +Git 是你将网站放到互联网上的接口,因此切换到你新的 `mysite` 文件夹,并将其初始化为 Git 存储库: + +``` +$ cd mysite +$ git init . +``` + +Hugo 与 Git 配合的很好,所以你甚至可以使用 Git 为你的网站安装主题。除非你计划开发你正在安装的主题,否则可以使用 `--depth` 选项克隆该主题的源的最新状态: + +``` +$ git clone --depth 1 https://github.com/darshanbaral/mero.git themes/mero +``` + +现在为你的网站创建一些内容: + +``` +$ hugo new posts/hello.md +``` + +使用你喜欢的文本编辑器编辑 `content/posts` 目录中的 `hello.md` 文件。Hugo 接受 Markdown 文件,并会在发布时将它们转换为经过主题化的 HTML 文件,因此你的内容必须采用 [Markdown 格式][11]。 + +如果要在帖子中包含图像,请在 `static` 目录中创建一个名为 `images` 的文件夹。将图像放入此文件夹,并使用以 `/images` 开头的绝对路径在标记中引用它们。例如: + +``` +![A picture of a thing](/images/thing.jpeg) +``` + +#### 选择主题 + +你可以在 [themes.gohugo.io][12] 找到更多主题,但最好在测试时保持一个基本主题。标准的 Hugo 测试主题是 [Ananke][13]。某些主题具有复杂的依赖关系,而另外一些主题如果没有复杂的配置的话,也许不会以你预期的方式呈现页面。本例中使用的 Mero 主题捆绑了一个详细的 `config.toml` 配置文件,但是(为了简单起见)我将在这里只提供基本的配置。在文本编辑器中打开名为 `config.toml` 的文件,并添加三个配置参数: + +``` +languageCode = "en-us" +title = "My website on the web" +theme = "mero" + +[params] + author = "Seth Kenlon" + description = "My hugo demo" +``` + +#### 预览 + +在你准备发布之前不必(预先)在互联网上放置任何内容。在你开发网站时,你可以通过启动 Hugo 附带的仅限本地访问的 Web 服务器来预览你的站点。 + +``` +$ hugo server --buildDrafts --disableFastRender +``` + +打开 Web 浏览器并导航到 以查看正在进行的工作。 + +### 用 Git 发布到 GitLab + +要在 GitLab 上发布和托管你的站点,请为你的站点内容创建一个存储库。 + +要在 GitLab 中创建存储库,请单击 GitLab 的 “Projects” 页面中的 “New Project” 按钮。创建一个名为 `yourGitLabUsername.gitlab.io` 的空存储库,用你的 GitLab 用户名或组名替换 `yourGitLabUsername`。你必须使用此命名方式作为该项目的名称。你也可以稍后为其添加自定义域。 + +不要在 GitLab 上包含许可证或 README 文件(因为你已经在本地启动了一个项目,现在添加这些文件会使将你的数据推向 GitLab 时更加复杂,以后你可以随时添加它们)。 + +在 GitLab 上创建空存储库后,将其添加为 Hugo 站点的本地副本的远程位置,该站点已经是一个 Git 存储库: + +``` +$ git remote add origin git@gitlab.com:skenlon/mysite.git +``` + +创建名为 `.gitlab-ci.yml` 的 GitLab 站点配置文件并输入以下选项: + +``` +image: monachus/hugo + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +pages: + script: + - hugo + artifacts: + paths: + - public + only: + - master +``` + +`image` 参数定义了一个为你的站点提供服务的容器化图像。其他参数是告诉 GitLab 服务器在将新代码推送到远程存储库时要执行的操作的说明。有关 GitLab 的 CI/CD(持续集成和交付)选项的更多信息,请参阅 [GitLab 文档的 CI/CD 部分][14]。 + +#### 设置排除的内容 + +你的 Git 存储库已配置好,在 GitLab 服务器上构建站点的命令也已设置,你的站点已准备好发布了。对于你的第一个 Git 提交,你必须采取一些额外的预防措施,以便你不会对你不打算进行版本控制的文件进行版本控制。 + +首先,将构建你的站点时 Hugo 创建的 `/public` 目录添加到 `.gitignore` 文件。你无需在 Git 中管理已完成发布的站点;你需要跟踪的是你的 Hugo 源文件。 + +``` +$ echo "/public" >> .gitignore +``` + +如果不创建 Git 子模块,则无法在 Git 存储库中维护另一个 Git 存储库。为了简单起见,请移除嵌入的存储库的 `.git` 目录,以使主题(存储库)只是一个主题(目录)。 + +请注意,你**必须**将你的主题文件添加到你的 Git 存储库,以便 GitLab 可以访问该主题。如果不提交主题文件,你的网站将无法成功构建。 + +``` +$ mv themes/mero/.git ~/.local/share/Trash/files/ +``` + +你也可以像使用[回收站][15]一样使用 `trash`: + +``` +$ trash themes/mero/.git +``` + +现在,你可以将本地项目目录的所有内容添加到 Git 并将其推送到 GitLab: + +``` +$ git add . +$ git commit -m 'hugo init' +$ git push -u origin HEAD +``` + +### 用 GitLab 上线 + +将代码推送到 GitLab 后,请查看你的项目页面。有个图标表示 GitLab 正在处理你的构建。第一次推送代码可能需要几分钟,所以请耐心等待。但是,请不要**一直**等待,因为该图标并不总是可靠地更新。 + +![GitLab processing your build][16] + +当你在等待 GitLab 组装你的站点时,请转到你的项目设置并找到 “Pages” 面板。你的网站准备就绪后,它的 URL 就可以用了。该 URL 是 `yourGitLabUsername.gitlab.io/yourProjectName`。导航到该地址以查看你的劳动成果。 + +![Previewing Hugo site][17] + +如果你的站点无法正确组装,GitLab 提供了可以深入了解 CI/CD 管道的日志。查看错误消息以找出发生了什么问题。 + +### Git 和 Web + +Hugo(或 Jekyll 等类似工具)只是利用 Git 作为 Web 发布工具的一种方式。使用服务器端 Git 挂钩,你可以使用最少的脚本设计你自己的 Git-to-web 工作流。使用 GitLab 的社区版,你可以自行托管你自己的 GitLab 实例;或者你可以使用 [Gitolite][18] 或 [Gitea][19] 等替代方案,并使用本文作为自定义解决方案的灵感来源。祝你玩得开心! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/building-hosting-website-git + +作者:[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/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) +[2]: https://git-scm.com/ +[3]: http://gohugo.io +[4]: http://getgrav.org +[5]: http://picocms.org/ +[6]: https://jekyllrb.com +[7]: http://slackermedia.info/podwrite/ +[8]: https://opensource.com/sites/default/files/uploads/letsencrypt-site.jpg (Let's Encrypt website) +[9]: https://gohugo.io/getting-started/installing +[10]: https://opensource.com/article/17/6/set-path-linux +[11]: https://commonmark.org/help/ +[12]: https://themes.gohugo.io/ +[13]: https://themes.gohugo.io/gohugo-theme-ananke/ +[14]: https://docs.gitlab.com/ee/ci/#overview +[15]: http://slackermedia.info/trashy +[16]: https://opensource.com/sites/default/files/uploads/hugo-gitlab-cicd.jpg (GitLab processing your build) +[17]: https://opensource.com/sites/default/files/uploads/hugo-demo-site.jpg (Previewing Hugo site) +[18]: http://gitolite.com +[19]: http://gitea.io diff --git a/published/20190402 Manage your daily schedule with Git.md b/published/20190402 Manage your daily schedule with Git.md new file mode 100644 index 0000000000..88ae47f664 --- /dev/null +++ b/published/20190402 Manage your daily schedule with Git.md @@ -0,0 +1,244 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11320-1.html) +[#]: subject: (Manage your daily schedule with Git) +[#]: via: (https://opensource.com/article/19/4/calendar-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Git 管理你的每日行程 +====== + +> 像源代码一样对待时间并在 Git 的帮助下维护你的日历。 + +![](https://img.linux.net.cn/data/attachment/album/201909/09/061835la7ne9edtlr7kn18.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天,我们将使用 Git 来跟踪你的日历。 + +### 使用 Git 跟踪你的日程安排 + +如果时间本身只是可以管理和版本控制的源代码呢?虽然证明或反驳这种理论可能超出了本文的范围,但在 Git 的帮助下,你可以将时间视为源代码并管理你的日程安排。 + +日历的卫冕冠军是 [CalDAV][3] 协议,它支撑了如 [NextCloud][4] 这样的流行的开源及闭源的日历应用程序。CalDAV 没什么问题(评论者,请注意),但它并不适合所有人,除此之外,它还有一种不同于单一文化的鼓舞人心的东西。 + +因为我对大量使用 GUI 的 CalDAV 客户端没有兴趣(如果你正在寻找一个好的终端 CalDAV 查看器,请参阅 [khal][5]),我开始研究基于文本的替代方案。基于文本的日历具有在[明文][6]中工作的所有常见好处。它很轻巧,非常便携,只要它结构化,就很容易解析和美化(无论*美丽*对你意味着什么)。 + +最重要的是,它正是 Git 旨在管理的内容。 + +### Org 模式不是一种可怕的方式 + +如果你没有对你的明文添加结构,它很快就会陷入一种天马行空般的混乱,变成恶魔才能懂的符号。幸运的是,有一种用于日历的标记语法,它包含在令人尊敬的生产力 Emacs 模式 —— [Org 模式][7] 中(承认吧,你其实一直想开始使用它)。 + +许多人没有意识到 Org 模式的惊人之处在于[你不需要知道甚至不需要使用 Emacs][8]来利用 Org 模式建立的约定。如果你使用 Emacs,你会得到许多很棒的功能,但是如果 Emacs 对你来说太难了,那么你可以实现一个基于 Git 的 Org 模式的日历系统,而不需要安装 Emacs。 + +关于 Org 模式你唯一需要知道的部分是它的语法。Org 模式的语法维护成本低、直观。使用 Org 模式而不是 GUI 日历应用程序进行日历记录的最大区别在于工作流程:你可以创建一个任务列表,然后每天分配一个任务,而不是转到日历并查找要安排任务的日期。 + +组织模式中的列表使用星号(`*`)作为项目符号。这是我的游戏任务列表: + +``` +* Gaming +** Build Stardrifter character +** Read Stardrifter rules +** Stardrifter playtest + +** Blue Planet @ Mike's + +** Run Rappan Athuk +*** Purchase hard copy +*** Skim Rappan Athuk +*** Build Rappan Athuk maps in maptool +*** Sort Rappan Athuk tokens +``` + +如果你熟悉 [CommonMark][9] 或 Markdown,你会注意到,Org 模式不是使用空格来创建子任务,而是更明确地使用了其它项目符号。无论你的使用背景和列表是什么,这都是一种构建列表的直观且简单的方法,它显然与 Emacs 没有内在联系(尽管使用 Emacs 为你提供了快捷方式,因此你可以快速地重新排列列表)。 + +要将列表转换为日历中的计划任务或事件,请返回并添加关键字 `SCHEDULED` 和(可选)`:CATEGORY:`。 + +``` +* Gaming +:CATEGORY: Game +** Build Stardrifter character +SCHEDULED: <2019-03-22 18:00-19:00> +** Read Stardrifter rules +SCHEDULED: <2019-03-22 19:00-21:00> +** Stardrifter playtest +SCHEDULED: <2019-03-25 0900-1300> +** Blue Planet @ Mike's +SCHEDULED: <2019-03-18 18:00-23:00 +1w> + +and so on... +``` + +`SCHEDULED` 关键字将该条目标记为你希望收到通知的事件,并且可选的 `:CATEGORY:` 关键字是一个可供你自己使用的任意标记系统(在 Emacs 中,你可以根据类别对条目使用颜色代码)。 + +对于重复事件,你可以使用符号(如`+1w`)创建每周事件或 `+2w` 以进行每两周一次的事件,依此类推。 + +所有可用于 Org 模式的花哨标记都[记录于文档][10],所以不要犹豫,找到更多技巧来让它满足你的需求。 + +### 放进 Git + +如果没有 Git,你的 Org 模式的日程安排只不过是本地计算机上的文件。这是 21 世纪,所以你至少需要可以在手机上使用你的日历,即便不是在你所有的个人电脑上。你可以使用 Git 为自己和他人发布日历。 + +首先,为 `.org` 文件创建一个目录。我将我的存储在 `~/cal` 中。 + +``` +$ mkdir ~/cal +``` + +转到你的目录并使其成为 Git 存储库: + +``` +$ cd cal +$ git init +``` + +将 `.org` 文件移动到你本地的 Git 存储库。在实践中,我为每个类别维护一个 `.org` 文件。 + +``` +$ mv ~/*.org ~/cal +$ ls +Game.org Meal.org Seth.org Work.org +``` + +暂存并提交你的文件: + +``` +$ git add *.org +$ git commit -m 'cal init' +``` + +### 创建一个 Git 远程源 + +要在任何地方提供日历,你必须在互联网上拥有 Git 存储库。你的日历是纯文本,因此任何 Git 存储库都可以。你可以将日历放在 [GitLab][11] 或任何其他公共 Git 托管服务(甚至是专有服务)上,只要你的主机允许,你甚至可以将该存储库标记为私有库。如果你不想将日历发布到你无法控制的服务器,则可以自行托管 Git 存储库,或者为单个用户使用裸存储库,或者使用 [Gitolite][12] 或 [Gitea][13] 等前端服务。 + +为了简单起见,我将假设一个自托管的 Git 裸存储库。你可以使用 Git 命令在任何具有 SSH 访问权限的服务器上创建一个远程裸存储库: + +``` +$ ssh -p 22122 [seth@example.com][14] +[remote]$ mkdir cal.git +[remote]$ cd cal.git +[remote]$ git init --bare +[remote]$ exit +``` + +这个裸存储库可以作为你日历在互联网上的家。 + +将其设置为本地 Git 存储库(在你的计算机上,而不是你的服务器上)的远程源: + +``` +$ git remote add origin seth@example.com:/home/seth/cal.git +``` + +然后推送你的日历到该服务器: + +``` +$ git push -u origin HEAD +``` + +将你的日历放在 Git 存储库中,就可以在任何运行 Git 的设备上使用它。这意味着你可以对计划进行更新和更改,并将更改推送到上游,以便在任何地方进行更新。 + +我使用这种方法使我的日历在我的工作笔记本电脑和家庭工作站之间保持同步。由于我每天大部分时间都在使用 Emacs,因此能够在 Emacs 中查看和编辑我的日历是一个很大的便利。对于大多数使用移动设备的人来说也是如此,因此下一步是在移动设备上设置 Org 模式的日历系统。 + +### 移动设备上的 Git + +由于你的日历数据是纯文本的,严格来说,你可以在任何可以读取文本文件的设备上“使用”它。这是这个系统之美的一部分;你永远不会缺少原始数据。但是,要按照你希望的现代日历的工作方式将日历集成到移动设备上,你需要两个组件:移动设备上的 Git 客户端和 Org 模式查看器。 + +#### 移动设备上的 Git 客户端 + +[MGit][15] 是 Android 上的优秀 Git 客户端。同样,iOS 也有 Git 客户端。 + +一旦安装了 MGit(或类似的 Git 客户端),你必须克隆日历存储库,以便在你的手机上有副本。要从移动设备访问服务器,必须设置 SSH 密钥进行身份验证。MGit 可以为你生成和存储密钥,你必须将其添加到服务器的 `~/.ssh/authorized_keys` 文件或托管的 Git 的帐户设置中的 SSH 密钥中。 + +你必须手动执行此操作。MGit 没有登录你的服务器或托管的 Git 帐户的界面。如果你不这样做,你的移动设备将无法访问你的服务器以访问你的日历数据。 + +我是通过将我在 MGit 中生成的密钥文件通过 [KDE Connect][16] 复制到我的笔记本电脑来实现的(但你可以通过蓝牙、SD 卡读卡器或 USB 电缆进行相同操作,具体取决于你访问手机上的数据的首选方法)。 我用这个命令将密钥(一个名为 `calkey` 的文件)复制到我的服务器: + +``` +$ cat calkey | ssh seth@example.com "cat >> /home/seth/.ssh/authorized_keys" +``` + +你可能有不同的方法,但如果你曾经将服务器设置为无密码登录,这是完全相同的过程。如果你使用的是 GitLab 等托管的 Git 服务,则必须将密钥文件的内容复制并粘贴到用户帐户的 SSH 密钥面板中。 + +![Adding key file data to GitLab][17] + +完成后,你的移动设备可以向你的服务器授权,但仍需要知道在哪里查找你的日历数据。不同的应用程序可能使用不同的表示法,但 MGit 使用普通的旧式 Git-over-SSH。这意味着如果你使用的是非标准 SSH 端口,则必须指定要使用的 SSH 端口: + +``` +$ git clone ssh://seth@example.com:22122//home/seth/git/cal.git +``` + +![Specifying SSH port in MGit][18] + +如果你使用其他应用程序,它可能会使用不同的语法,允许你在特殊字段中提供端口,或删除 `ssh://` 前缀。如果遇到问题,请参阅应用程序文档。 + +将存储库克隆到手机。 + +![Cloned repositories][19] + +很少有 Git 应用程序设置为自动更新存储库。有一些应用程序可以用来自动拉取,或者你可以设置 Git 钩子来推送服务器的更新 —— 但我不会在这里讨论这些。目前,在对日历进行更新后,请务必在 MGit 中手动提取新更改(或者如果在手机上更改了事件,请将更改推送到服务器)。 + +![MGit push/pull settings][20] + +#### 移动设备上的日历 + +有一些应用程序可以为移动设备上的 Org 模式提供前端。[Orgzly][21] 是一个很棒的开源 Android 应用程序,它为 Org 模式的从 Agenda 模式到 TODO 列表的大多数功能提供了一个界面。安装并启动它。 + +从主菜单中,选择“设置同步存储库”,然后选择包含日历文件的目录(即,从服务器克隆的 Git 存储库)。 + +给 Orgzly 一点时间来导入数据,然后使用 Orgzly 的[汉堡包][22]菜单选择日程视图。 + +![Orgzly's agenda view][23] + +在 Orgzly 的“设置提醒”菜单中,你可以选择在手机上触发通知的事件类型。你可以获得 `SCHEDULED` 任务,`DEADLINE` 任务或任何分配了事件时间的任何通知。如果你将手机用作任务管理器,那么你将永远不会错过 Org 模式和 Orgzly 的活动。 + +![Orgzly notification][24] + +Orgzly 不仅仅是一个解析器。你可以编辑和更新事件,甚至标记事件为 `DONE`。 + +![Orgzly to-do list][25] + +### 专为你而设计 + +关于使用 Org 模式和 Git 的重要一点是,这两个应用程序都非常灵活,并且你可以自定义它们的工作方式和内容,以便它们能够适应你的需求。如果本文中的内容是对你如何组织生活或管理每周时间表的冒犯,但你喜欢此提案提供的其他部分,那么请丢弃你不喜欢的部分。如果需要,你可以在 Emacs 中使用 Org 模式,或者你可以将其用作日历标记。你可以将手机设置为在一天结束时从计算机上拉取 Git 数据,而不是从互联网上的服务器上,或者你可以将计算机配置为在手机插入时同步日历,或者你可以每天管理它,就像你把你工作日所需的所有东西都装到你的手机上一样。这取决于你,而这是关于 Git、Org 模式和开源的最重要的事情。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/calendar-git + +作者:[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/web-design-monitor-website.png?itok=yUK7_qR0 (website design image) +[2]: https://git-scm.com/ +[3]: https://tools.ietf.org/html/rfc4791 +[4]: http://nextcloud.com +[5]: https://github.com/pimutils/khal +[6]: https://plaintextproject.online/ +[7]: https://orgmode.org +[8]: https://opensource.com/article/19/1/productivity-tool-org-mode +[9]: https://commonmark.org/ +[10]: https://orgmode.org/manual/ +[11]: http://gitlab.com +[12]: http://gitolite.com/gitolite/index.html +[13]: https://gitea.io/en-us/ +[14]: mailto:seth@example.com +[15]: https://f-droid.org/en/packages/com.manichord.mgit +[16]: https://community.kde.org/KDEConnect +[17]: https://opensource.com/sites/default/files/uploads/gitlab-add-key.jpg (Adding key file data to GitLab) +[18]: https://opensource.com/sites/default/files/uploads/mgit-0.jpg (Specifying SSH port in MGit) +[19]: https://opensource.com/sites/default/files/uploads/mgit-1.jpg (Cloned repositories) +[20]: https://opensource.com/sites/default/files/uploads/mgit-2.jpg (MGit push/pull settings) +[21]: https://f-droid.org/en/packages/com.orgzly/ +[22]: https://en.wikipedia.org/wiki/Hamburger_button +[23]: https://opensource.com/sites/default/files/uploads/orgzly-agenda.jpg (Orgzly's agenda view) +[24]: https://opensource.com/sites/default/files/uploads/orgzly-cal-notify.jpg (Orgzly notification) +[25]: https://opensource.com/sites/default/files/uploads/orgzly-cal-todo.jpg (Orgzly to-do list) diff --git a/published/20190403 Use Git as the backend for chat.md b/published/20190403 Use Git as the backend for chat.md new file mode 100644 index 0000000000..100750937b --- /dev/null +++ b/published/20190403 Use Git as the backend for chat.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11342-1.html) +[#]: subject: (Use Git as the backend for chat) +[#]: via: (https://opensource.com/article/19/4/git-based-chat) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 Git 作为聊天应用的后端 +====== + +> GIC 是一个聊天应用程序的原型,展示了一种使用 Git 的新方法。 + +![](https://img.linux.net.cn/data/attachment/album/201909/15/100905euzi3l5xgslsgx7i.png) + +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 + +今天我们来看看 GIC,它是一个基于 Git 的聊天应用。 + +### 初识 GIC + +虽然 Git 的作者们可能期望会为 Git 创建前端,但毫无疑问他们从未预料到 Git 会成为某种后端,如聊天客户端的后端。然而,这正是开发人员 Ephi Gabay 用他的实验性的概念验证应用 [GIC][3] 所做的事情:用 [Node.js][4] 编写的聊天客户端,使用 Git 作为其后端数据库。 + +GIC 并没有打算用于生产用途。这纯粹是一种编程练习,但它证明了开源技术的灵活性。令人惊讶的是,除了 Node 库和 Git 本身,该客户端只包含 300 行代码。这是这个聊天客户端和开源所反映出来的最好的地方之一:建立在现有工作基础上的能力。眼见为实,你应该自己亲自来了解一下 GIC。 + +### 架设起来 + +GIC 使用 Git 作为引擎,因此你需要一个空的 Git 存储库为聊天室和记录器提供服务。存储库可以托管在任何地方,只要你和需要访问聊天服务的人可以访问该存储库就行。例如,你可以在 GitLab 等免费 Git 托管服务上设置 Git 存储库,并授予聊天用户对该 Git 存储库的贡献者访问权限。(他们必须能够提交到存储库,因为每个聊天消息都是一个文本的提交。) + +如果你自己托管,请创建一个中心化的裸存储库。聊天中的每个用户必须在裸存储库所在的服务器上拥有一个帐户。你可以使用如 [Gitolite][5] 或 [Gitea][6] 这样的 Git 托管软件创建特定于 Git 的帐户,或者你可以在服务器上为他们提供个人用户帐户,可以使用 `git-shell` 来限制他们只能访问 Git。 + +自托管实例的性能最好。无论你是自己托管还是使用托管服务,你创建的 Git 存储库都必须具有一个活跃分支,否则 GIC 将无法在用户聊天时进行提交,因为没有 Git HEAD。确保分支初始化和活跃的最简单方法是在创建存储库时提交 `README` 或许可证文件。如果你没有这样做,你可以在事后创建并提交一个: + +``` +$ echo "chat logs" > README +$ git add README +$ git commit -m 'just creating a HEAD ref' +$ git push -u origin HEAD +``` + +### 安装 GIC + +由于 GIC 基于 Git 并使用 Node.js 编写,因此必须首先安装 Git、Node.js 和 Node 包管理器npm(它应该与 Node 捆绑在一起)。安装它们的命令因 Linux 或 BSD 发行版而异,这是 Fedora 上的一个示例命令: + +``` +$ sudo dnf install git nodejs +``` + +如果你没有运行 Linux 或 BSD,请按照 [git-scm.com][7] 和 [nodejs.org][8] 上的安装说明进行操作。 + +因此,GIC 没有安装过程。每个用户(在此示例中为 Alice 和 Bob)必须将存储库克隆到其硬盘驱动器: + +``` +$ git clone https://github.com/ephigabay/GIC GIC +``` + +将目录更改为 GIC 目录并使用 `npm` 安装 Node.js 依赖项: + +``` +$ cd GIC +$ npm install +``` + +等待 Node 模块下载并安装。 + +### 配置 GIC + +GIC 唯一需要的配置是 Git 聊天存储库的位置。编辑 `config.js` 文件: + +``` +module.exports = { + gitRepo: 'seth@example.com:/home/gitchat/chatdemo.git', + messageCheckInterval: 500, + branchesCheckInterval: 5000 +}; +``` + +在尝试 GIC 之前测试你与 Git 存储库的连接,以确保你的配置是正确的: + +``` +$ git clone --quiet seth@example.com:/home/gitchat/chatdemo.git > /dev/null +``` + +假设你没有收到任何错误,就可以开始聊天了。 + +### 用 Git 聊天 + +在 GIC 目录中启动聊天客户端: + +``` +$ npm start +``` + +客户端首次启动时,必须克隆聊天存储库。由于它几乎是一个空的存储库,因此不会花费很长时间。输入你的消息,然后按回车键发送消息。 + +![GIC][10] + +*基于 Git 的聊天客户端。 他们接下来会怎么想?* + +正如问候消息所说,Git 中的分支在 GIC 中就是聊天室或频道。无法在 GIC 的 UI 中创建新分支,但如果你在另一个终端会话或 Web UI 中创建一个分支,它将立即显示在 GIC 中。将一些 IRC 式的命令加到 GIC 中并不需要太多工作。 + +聊了一会儿之后,可以看看你的 Git 存储库。由于聊天发生在 Git 中,因此存储库本身也是聊天日志: + +``` +$ git log --pretty=format:"%p %cn %s" +4387984 Seth Kenlon Hey Chani, did you submit a talk for All Things Open this year? +36369bb Chani No I didn't get a chance. Did you? +[...] +``` + +### 退出 GIC + +Vim 以来,还没有一个应用程序像 GIC 那么难以退出。你看,没有办法停止 GIC。它会一直运行,直到它被杀死。当你准备停止 GIC 时,打开另一个终端选项卡或窗口并发出以下命令: + +``` +$ kill `pgrep npm` +``` + +GIC 是一个新奇的事物。这是一个很好的例子,说明开源生态系统如何鼓励和促进创造力和探索,并挑战我们从不同角度审视应用程序。尝试下 GIC,也许它会给你一些思路。至少,它可以让你与 Git 度过一个下午。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/git-based-chat + +作者:[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/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://git-scm.com/ +[3]: https://github.com/ephigabay/GIC +[4]: https://nodejs.org/en/ +[5]: http://gitolite.com +[6]: http://gitea.io +[7]: http://git-scm.com +[8]: http://nodejs.org +[9]: mailto:seth@example.com +[10]: https://opensource.com/sites/default/files/uploads/gic.jpg (GIC) diff --git a/published/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md b/published/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md new file mode 100644 index 0000000000..bbd85a891f --- /dev/null +++ b/published/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md @@ -0,0 +1,345 @@ +[#]: collector: (lujun9972) +[#]: translator: (LuuMing) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11307-1.html) +[#]: subject: (A beginner's guide to building DevOps pipelines with open source tools) +[#]: via: (https://opensource.com/article/19/4/devops-pipeline) +[#]: author: (Bryant Son https://opensource.com/users/brson/users/milindsingh/users/milindsingh/users/dscripter) + +使用开源工具构建 DevOps 流水线的初学者指南 +====== + +> 如果你是 DevOps 新人,请查看这 5 个步骤来构建你的第一个 DevOps 流水线。 + +![](https://img.linux.net.cn/data/attachment/album/201909/05/060323yizmqwn43zwy13za.jpg) + +DevOps 已经成为解决软件开发过程中出现的缓慢、孤立或者其他故障的默认方式。但是当你刚接触 DevOps 并且不确定从哪开始时,就意义不大了。本文探索了什么是 DevOps 流水线并且提供了创建它的 5 个步骤。尽管这个教程并不全面,但可以给你以后上手和扩展打下基础。首先,插入一个小故事。 + +### 我的 DevOps 之旅 + +我曾经在花旗集团的云小组工作,开发Infrastructure as a Service基础设施即服务网页应用来管理花旗的云基础设施,但我经常对研究如何让开发流水线更加高效以及如何带给团队积极的文化感兴趣。我在 Greg Lavender 推荐的书中找到了答案。Greg Lavender 是花旗的云架构和基础设施工程(即 [Phoenix 项目][2])的 CTO。这本书尽管解释的是 DevOps 原理,但它读起来像一本小说。 + +书后面的一张表展示了不同公司部署在发布环境上的频率: + +公司 | 部署频率 +---|--- +Amazon | 23,000 次/天 +Google | 5,500 次/天 +Netflix | 500 次/天 +Facebook | 1 次/天 +Twitter | 3 次/周 +典型企业 | 1 次/9 个月 + +Amazon、Google、Netflix 怎么能做到如此之频繁?那是因为这些公司弄清楚了如何去实现一个近乎完美的 DevOps 流水线。 + +但在花旗实施 DevOps 之前,情况并非如此。那时候,我的团队拥有不同构建阶段stage的环境,但是在开发服务器上的部署非常手工。所有的开发人员都只能访问一个基于 IBM WebSphere Application 社区版的开发环境服务器。问题是当多个用户同时尝试部署时,服务器就会宕机,因此开发人员在部署时就得互相通知,这一点相当痛苦。此外,还存在代码测试覆盖率低、手动部署过程繁琐以及无法根据定义的任务或用户需求跟踪代码部署的问题。 + +我意识到必须做些事情,同时也找到了一个有同样感受的同事。我们决定合作去构建一个初始的 DevOps 流水线 —— 他设置了一个虚拟机和一个 Tomcat 服务器,而我则架设了 Jenkins,集成了 Atlassian Jira、BitBucket 和代码覆盖率测试。这个业余项目非常成功:我们近乎全自动化了开发流水线,并在开发服务器上实现了几乎 100% 的正常运行,我们可以追踪并改进代码覆盖率测试,并且 Git 分支能够与部署任务和 jira 任务关联在一起。此外,大多数用来构建 DevOps 所使用的工具都是开源的。 + +现在我意识到了我们的 DevOps 流水线是多么的原始,因为我们没有利用像 Jenkins 文件或 Ansible 这样的高级设置。然而,这个简单的过程运作良好,这也许是因为 [Pareto][3] 原则(也被称作 80/20 法则)。 + +### DevOps 和 CI/CD 流水线的简要介绍 + +如果你问一些人,“什么是 DevOps?”,你或许会得到一些不同的回答。DevOps,就像敏捷,已经发展到涵盖着诸多不同的学科,但大多数人至少会同意这些:DevOps 是一个软件开发实践或一个软件开发生命周期software development lifecycle(SDLC),并且它的核心原则是一种文化上的变革 —— 开发人员与非开发人员呼吸着同一片天空的气息,之前手工的事情变得自动化;每个人做着自己擅长的事;同一时间的部署变得更加频繁;吞吐量提升;灵活度增加。 + +虽然拥有正确的软件工具并非实现 DevOps 环境所需的唯一东西,但一些工具却是必要的。最关键的一个便是持续集成和持续部署(CI/CD)。在流水线环境中,拥有不同的构建阶段(例如:DEV、INT、TST、QA、UAT、STG、PROD),手动的工作能实现自动化,开发人员可以实现高质量的代码,灵活而且大量部署。 + +这篇文章描述了一个构建 DevOps 流水线的五步方法,就像下图所展示的那样,使用开源的工具实现。 + +![Complete DevOps pipeline][4] + +闲话少说,让我们开始吧。 + +### 第一步:CI/CD 框架 + +首先你需要的是一个 CI/CD 工具,Jenkins,是一个基于 Java 的 MIT 许可下的开源 CI/CD 工具,它是推广 DevOps 运动的工具,并已成为了事实标准de facto standard。 + +所以,什么是 Jenkins?想象它是一种神奇的万能遥控,能够和许多不同的服务器和工具打交道,并且能够将它们统一安排起来。就本身而言,像 Jenkins 这样的 CI/CD 工具本身是没有用的,但随着接入不同的工具与服务器时会变得非常强大。 + +Jenkins 仅是众多构建 DevOps 流水线的开源 CI/CD 工具之一。 + +名称 | 许可证 +---|--- +[Jenkins][5] | Creative Commons 和 MIT +[Travis CI][6] | MIT +[CruiseControl][7] | BSD +[Buildbot][8] | GPL +[Apache Gump][9] | Apache 2.0 +[Cabie][10] | GNU + +下面就是使用 CI/CD 工具时 DevOps 看起来的样子。 + +![CI/CD tool][11] + +你的 CI/CD 工具在本地主机上运行,但目前你还不能够做些别的。让我们紧随 DevOps 之旅的脚步。 + +### 第二步:源代码控制管理 + +验证 CI/CD 工具可以执行某些魔术的最佳(也可能是最简单)方法是与源代码控制管理(SCM)工具集成。为什么需要源代码控制?假设你在开发一个应用。无论你什么时候构建应用,无论你使用的是 Java、Python、C++、Go、Ruby、JavaScript 或任意一种语言,你都在编程。你所编写的程序代码称为源代码。在一开始,特别是只有你一个人工作时,将所有的东西放进本地文件夹里或许都是可以的。但是当项目变得庞大并且邀请其他人协作后,你就需要一种方式来避免共享代码修改时的合并冲突。你也需要一种方式来恢复一个之前的版本——备份、复制并粘贴的方式已经过时了。你(和你的团队)想要更好的解决方式。 + +这就是 SCM 变得不可或缺的原因。SCM 工具通过在仓库中保存代码来帮助进行版本控制与多人协作。 + +尽管这里有许多 SCM 工具,但 Git 是最标准恰当的。我极力推荐使用 Git,但如果你喜欢这里仍有其他的开源工具。 + +名称 | 许可证 +---|--- +[Git][12] | GPLv2 & LGPL v2.1 +[Subversion][13] | Apache 2.0 +[Concurrent Versions System][14] (CVS) | GNU +[Vesta][15] | LGPL +[Mercurial][16] | GNU GPL v2+ + +拥有 SCM 之后,DevOps 流水线看起来就像这样。 + +![Source control management][17] + +CI/CD 工具能够自动化进行源代码检入检出以及完成成员之间的协作。还不错吧?但是,如何才能把它变成可工作的应用程序,使得数十亿人来使用并欣赏它呢? + +### 第三步:自动化构建工具 + +真棒!现在你可以检出代码并将修改提交到源代码控制,并且可以邀请你的朋友就源代码控制进行协作。但是到目前为止你还没有构建出应用。要想让它成为一个网页应用,必须将其编译并打包成可部署的包或可执行程序(注意,像 JavaScript 或 PHP 这样的解释型编程语言不需要进行编译)。 + +于是就引出了自动化构建工具。无论你决定使用哪一款构建工具,它们都有一个共同的目标:将源代码构建成某种想要的格式,并且将清理、编译、测试、部署到某个位置这些任务自动化。构建工具会根据你的编程语言而有不同,但这里有一些通常使用的开源工具值得考虑。 + +名称 | 许可证 | 编程语言 +---|---|--- +[Maven][18] | Apache 2.0 | Java +[Ant][19] | Apache 2.0 | Java +[Gradle][20] | Apache 2.0 | Java +[Bazel][21] | Apache 2.0 | Java +[Make][22] | GNU | N/A +[Grunt][23] | MIT | JavaScript +[Gulp][24] | MIT | JavaScript +[Buildr][25] | Apache | Ruby +[Rake][26] | MIT | Ruby +[A-A-P][27] | GNU | Python +[SCons][28] | MIT | Python +[BitBake][29] | GPLv2 | Python +[Cake][30] | MIT | C# +[ASDF][31] | Expat (MIT) | LISP +[Cabal][32] | BSD | Haskell + +太棒了!现在你可以将自动化构建工具的配置文件放进源代码控制管理系统中,并让你的 CI/CD 工具构建它。 + +![Build automation tool][33] + +一切都如此美好,对吧?但是在哪里部署它呢? + +### 第四步:网页应用服务器 + +到目前为止,你有了一个可执行或可部署的打包文件。对任何真正有用的应用程序来说,它必须提供某种服务或者接口,所以你需要一个容器来发布你的应用。 + +对于网页应用,网页应用服务器就是容器。应用程序服务器提供了环境,让可部署包中的编程逻辑能够被检测到、呈现界面,并通过打开套接字为外部世界提供网页服务。在其他环境下你也需要一个 HTTP 服务器(比如虚拟机)来安装服务应用。现在,我假设你将会自己学习这些东西(尽管我会在下面讨论容器)。 + +这里有许多开源的网页应用服务器。 + +名称 | 协议 | 编程语言 +---|---|--- +[Tomcat][34] | Apache 2.0 | Java +[Jetty][35] | Apache 2.0 | Java +[WildFly][36] | GNU Lesser Public | Java +[GlassFish][37] | CDDL & GNU Less Public | Java +[Django][38] | 3-Clause BSD | Python +[Tornado][39] | Apache 2.0 | Python +[Gunicorn][40] | MIT | Python +[Python Paste][41] | MIT | Python +[Rails][42] | MIT | Ruby +[Node.js][43] | MIT | Javascript + +现在 DevOps 流水线差不多能用了,干得好! + +![Web application server][44] + +尽管你可以在这里停下来并进行进一步的集成,但是代码质量对于应用开发者来说是一件非常重要的事情。 + +### 第五步:代码覆盖测试 + +实现代码测试件可能是另一个麻烦的需求,但是开发者需要尽早地捕捉程序中的所有错误并提升代码质量来保证最终用户满意度。幸运的是,这里有许多开源工具来测试你的代码并提出改善质量的建议。甚至更好的,大部分 CI/CD 工具能够集成这些工具并将测试过程自动化进行。 + +代码测试分为两个部分:“代码测试框架”帮助进行编写与运行测试,“代码质量改进工具”帮助提升代码的质量。 + +#### 代码测试框架 + +名称 | 许可证 | 编程语言 +---|---|--- +[JUnit][45] | Eclipse Public License | Java +[EasyMock][46] | Apache | Java +[Mockito][47] | MIT | Java +[PowerMock][48] | Apache 2.0 | Java +[Pytest][49] | MIT | Python +[Hypothesis][50] | Mozilla | Python +[Tox][51] | MIT | Python + +#### 代码质量改进工具 + +名称 | 许可证 | 编程语言 +---|---|--- +[Cobertura][52] | GNU | Java +[CodeCover][53] | Eclipse Public (EPL) | Java +[Coverage.py][54] | Apache 2.0 | Python +[Emma][55] | Common Public License | Java +[JaCoCo][56] | Eclipse Public License | Java +[Hypothesis][50] | Mozilla | Python +[Tox][51] | MIT | Python +[Jasmine][57] | MIT | JavaScript +[Karma][58] | MIT | JavaScript +[Mocha][59] | MIT | JavaScript +[Jest][60] | MIT | JavaScript + +注意,之前提到的大多数工具和框架都是为 Java、Python、JavaScript 写的,因为 C++ 和 C# 是专有编程语言(尽管 GCC 是开源的)。 + +现在你已经运用了代码覆盖测试工具,你的 DevOps 流水线应该就像教程开始那幅图中展示的那样了。 + +### 可选步骤 + +#### 容器 + +正如我之前所说,你可以在虚拟机(VM)或服务器上发布你的应用,但是容器是一个更好的解决方法。 + +[什么是容器][61]?简要的介绍就是 VM 需要占用操作系统大量的资源,它提升了应用程序的大小,而容器仅仅需要一些库和配置来运行应用程序。显然,VM 仍有重要的用途,但容器对于发布应用(包括应用程序服务器)来说是一个更为轻量的解决方式。 + +尽管对于容器来说也有其他的选择,但是 Docker 和 Kubernetes 更为广泛。 + +名称 | 许可证 +---|--- +[Docker][62] | Apache 2.0 +[Kubernetes][63] | Apache 2.0 + +了解更多信息,请查看 [Opensource.com][64] 上关于 Docker 和 Kubernetes 的其它文章: + + * [什么是 Docker?][65] + * [Docker 简介][66] + * [什么是 Kubernetes?][67] + * [从零开始的 Kubernetes 实践][68] + +#### 中间件自动化工具 + +我们的 DevOps 流水线大部分集中在协作构建与部署应用上,但你也可以用 DevOps 工具完成许多其他的事情。其中之一便是利用它实现基础设施管理Infrastructure as Code(IaC)工具,这也是熟知的中间件自动化工具。这些工具帮助完成中间件的自动化安装、管理和其他任务。例如,自动化工具可以用正确的配置下拉应用程序,例如网页服务器、数据库和监控工具,并且部署它们到应用服务器上。 + +这里有几个开源的中间件自动化工具值得考虑: + +名称 | 许可证 +---|--- +[Ansible][69] | GNU Public +[SaltStack][70] | Apache 2.0 +[Chef][71] | Apache 2.0 +[Puppet][72] | Apache or GPL + +获取更多中间件自动化工具,查看 [Opensource.com][64] 上的其它文章: + + * [Ansible 快速入门指南][73] + * [Ansible 自动化部署策略][74] + * [配置管理工具 Top 5][75] + +### 之后的发展 + +这只是一个完整 DevOps 流水线的冰山一角。从 CI/CD 工具开始并且探索其他可以自动化的东西来使你的团队更加轻松的工作。并且,寻找[开源通讯工具][76]可以帮助你的团队一起工作的更好。 + +发现更多见解,这里有一些非常棒的文章来介绍 DevOps : + + * [什么是 DevOps][77] + * [掌握 5 件事成为 DevOps 工程师][78] + * [所有人的 DevOps][79] + * [在 DevOps 中开始使用预测分析][80] + +使用开源 agile 工具来集成 DevOps 也是一个很好的主意: + + * [什么是 agile ?][81] + * [4 步成为一个了不起的 agile 开发者][82] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/devops-pipeline + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[LuMing](https://github.com/LuuMing) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson/users/milindsingh/users/milindsingh/users/dscripter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) +[2]: https://www.amazon.com/dp/B078Y98RG8/ +[3]: https://en.wikipedia.org/wiki/Pareto_principle +[4]: https://opensource.com/sites/default/files/uploads/1_finaldevopspipeline.jpg (Complete DevOps pipeline) +[5]: https://github.com/jenkinsci/jenkins +[6]: https://github.com/travis-ci/travis-ci +[7]: http://cruisecontrol.sourceforge.net +[8]: https://github.com/buildbot/buildbot +[9]: https://gump.apache.org +[10]: http://cabie.tigris.org +[11]: https://opensource.com/sites/default/files/uploads/2_runningjenkins.jpg (CI/CD tool) +[12]: https://git-scm.com +[13]: https://subversion.apache.org +[14]: http://savannah.nongnu.org/projects/cvs +[15]: http://www.vestasys.org +[16]: https://www.mercurial-scm.org +[17]: https://opensource.com/sites/default/files/uploads/3_sourcecontrolmanagement.jpg (Source control management) +[18]: https://maven.apache.org +[19]: https://ant.apache.org +[20]: https://gradle.org/ +[21]: https://bazel.build +[22]: https://www.gnu.org/software/make +[23]: https://gruntjs.com +[24]: https://gulpjs.com +[25]: http://buildr.apache.org +[26]: https://github.com/ruby/rake +[27]: http://www.a-a-p.org +[28]: https://www.scons.org +[29]: https://www.yoctoproject.org/software-item/bitbake +[30]: https://github.com/cake-build/cake +[31]: https://common-lisp.net/project/asdf +[32]: https://www.haskell.org/cabal +[33]: https://opensource.com/sites/default/files/uploads/4_buildtools.jpg (Build automation tool) +[34]: https://tomcat.apache.org +[35]: https://www.eclipse.org/jetty/ +[36]: http://wildfly.org +[37]: https://javaee.github.io/glassfish +[38]: https://www.djangoproject.com/ +[39]: http://www.tornadoweb.org/en/stable +[40]: https://gunicorn.org +[41]: https://github.com/cdent/paste +[42]: https://rubyonrails.org +[43]: https://nodejs.org/en +[44]: https://opensource.com/sites/default/files/uploads/5_applicationserver.jpg (Web application server) +[45]: https://junit.org/junit5 +[46]: http://easymock.org +[47]: https://site.mockito.org +[48]: https://github.com/powermock/powermock +[49]: https://docs.pytest.org +[50]: https://hypothesis.works +[51]: https://github.com/tox-dev/tox +[52]: http://cobertura.github.io/cobertura +[53]: http://codecover.org/ +[54]: https://github.com/nedbat/coveragepy +[55]: http://emma.sourceforge.net +[56]: https://github.com/jacoco/jacoco +[57]: https://jasmine.github.io +[58]: https://github.com/karma-runner/karma +[59]: https://github.com/mochajs/mocha +[60]: https://jestjs.io +[61]: /resources/what-are-linux-containers +[62]: https://www.docker.com +[63]: https://kubernetes.io +[64]: http://Opensource.com +[65]: https://opensource.com/resources/what-docker +[66]: https://opensource.com/business/15/1/introduction-docker +[67]: https://opensource.com/resources/what-is-kubernetes +[68]: https://opensource.com/article/17/11/kubernetes-lightning-talk +[69]: https://www.ansible.com +[70]: https://www.saltstack.com +[71]: https://www.chef.io +[72]: https://puppet.com +[73]: https://opensource.com/article/19/2/quickstart-guide-ansible +[74]: https://opensource.com/article/19/1/automating-deployment-strategies-ansible +[75]: https://opensource.com/article/18/12/configuration-management-tools +[76]: https://opensource.com/alternatives/slack +[77]: https://opensource.com/resources/devops +[78]: https://opensource.com/article/19/2/master-devops-engineer +[79]: https://opensource.com/article/18/11/how-non-engineer-got-devops +[80]: https://opensource.com/article/19/1/getting-started-predictive-analytics-devops +[81]: https://opensource.com/article/18/10/what-agile +[82]: https://opensource.com/article/19/2/steps-agile-developer diff --git a/published/20190409 Working with variables on Linux.md b/published/20190409 Working with variables on Linux.md new file mode 100644 index 0000000000..f51bf503fa --- /dev/null +++ b/published/20190409 Working with variables on Linux.md @@ -0,0 +1,261 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11344-1.html) +[#]: subject: (Working with variables on Linux) +[#]: via: (https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html#tk.rss_all) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 中使用变量 +====== + +> 变量通常看起来像 `$var` 这样,但它们也有 `$1`、`$*`、`$?` 和 `$$` 这种形式。让我们来看看所有这些 `$` 值可以告诉你什么。 + +![](https://img.linux.net.cn/data/attachment/album/201909/15/105140faf2jzyybubu1d0c.jpg) + +有许多重要的值都存储在 Linux 系统中,我们称为“变量”,但实际上变量有几种类型,并且一些有趣的命令可以帮助你使用它们。在上一篇文章中,我们研究了[环境变量][2]以及它们定义在何处。在本文中,我们来看一看在命令行和脚本中使用的变量。 + +### 用户变量 + +虽然在命令行中设置变量非常容易,但是有一些有趣的技巧。要设置变量,你只需这样做: + +``` +$ myvar=11 +$ myvar2="eleven" +``` + +要显示这些值,只需这样做: + +``` +$ echo $myvar +11 +$ echo $myvar2 +eleven +``` + +你也可以使用这些变量。例如,要递增一个数字变量,使用以下任意一个命令: + +``` +$ myvar=$((myvar+1)) +$ echo $myvar +12 +$ ((myvar=myvar+1)) +$ echo $myvar +13 +$ ((myvar+=1)) +$ echo $myvar +14 +$ ((myvar++)) +$ echo $myvar +15 +$ let "myvar=myvar+1" +$ echo $myvar +16 +$ let "myvar+=1" +$ echo $myvar +17 +$ let "myvar++" +$ echo $myvar +18 +``` + +使用其中的一些,你可以增加一个变量的值。例如: + +``` +$ myvar0=0 +$ ((myvar0++)) +$ echo $myvar0 +1 +$ ((myvar0+=10)) +$ echo $myvar0 +11 +``` + +通过这些选项,你可能会发现它们是容易记忆、使用方便的。 + +你也可以*删除*一个变量 -- 这意味着没有定义它。 + +``` +$ unset myvar +$ echo $myvar +``` + +另一个有趣的选项是,你可以设置一个变量并将其设为**只读**。换句话说,变量一旦设置为只读,它的值就不能改变(除非一些非常复杂的命令行魔法才可以)。这意味着你也不能删除它。 + +``` +$ readonly myvar3=1 +$ echo $myvar3 +1 +$ ((myvar3++)) +-bash: myvar3: readonly variable +$ unset myvar3 +-bash: unset: myvar3: cannot unset: readonly variable +``` + +你可以使用这些设置和递增选项中来赋值和操作脚本中的变量,但也有一些非常有用的*内部变量*可以用于在脚本中。注意,你无法重新赋值或增加它们的值。 + +### 内部变量 + +在脚本中可以使用很多变量来计算参数并显示有关脚本本身的信息。 + +* `$1`、`$2`、`$3` 等表示脚本的第一个、第二个、第三个等参数。 +* `$#` 表示参数的数量。 +* `$*` 表示所有参数。 +* `$0` 表示脚本的名称。 +* `$?` 表示先前运行的命令的返回码(0 代表成功)。 +* `$$` 显示脚本的进程 ID。 +* `$PPID` 显示 shell 的进程 ID(脚本的父进程)。 + +其中一些变量也适用于命令行,但显示相关信息: + +* `$0` 显示你正在使用的 shell 的名称(例如,-bash)。 +* `$$` 显示 shell 的进程 ID。 +* `$PPID` 显示 shell 的父进程的进程 ID(对我来说,是 sshd)。 + +为了查看它们的结果,如果我们将所有这些变量都放入一个脚本中,比如: + +``` +#!/bin/bash + +echo $0 +echo $1 +echo $2 +echo $# +echo $* +echo $? +echo $$ +echo $PPID +``` + +当我们调用这个脚本时,我们会看到如下内容: + +``` +$ tryme one two three +/home/shs/bin/tryme <== 脚本名称 +one <== 第一个参数 +two <== 第二个参数 +3 <== 参数的个数 +one two three <== 所有的参数 +0 <== 上一条 echo 命令的返回码 +10410 <== 脚本的进程 ID +10109 <== 父进程 ID +``` + +如果我们在脚本运行完毕后检查 shell 的进程 ID,我们可以看到它与脚本中显示的 PPID 相匹配: + +``` +$ echo $$ +10109 <== shell 的进程 ID +``` + +当然,比起简单地显示它们的值,更有用的方式是使用它们。我们来看一看它们可能的用处。 + +检查是否已提供参数: + +``` +if [ $# == 0 ]; then + echo "$0 filename" + exit 1 +fi +``` + +检查特定进程是否正在运行: + +``` +ps -ef | grep apache2 > /dev/null +if [ $? != 0 ]; then + echo Apache is not running + exit +fi +``` + +在尝试访问文件之前验证文件是否存在: + +``` +if [ $# -lt 2 ]; then + echo "Usage: $0 lines filename" + exit 1 +fi + +if [ ! -f $2 ]; then + echo "Error: File $2 not found" + exit 2 +else + head -$1 $2 +fi +``` + +在下面的小脚本中,我们检查是否提供了正确数量的参数、第一个参数是否为数字,以及第二个参数代表的文件是否存在。 + +``` +#!/bin/bash + +if [ $# -lt 2 ]; then + echo "Usage: $0 lines filename" + exit 1 +fi + +if [[ $1 != [0-9]* ]]; then + echo "Error: $1 is not numeric" + exit 2 +fi + +if [ ! -f $2 ]; then + echo "Error: File $2 not found" + exit 3 +else + echo top of file + head -$1 $2 +fi +``` + +### 重命名变量 + +在编写复杂的脚本时,为脚本的参数指定名称通常很有用,而不是继续将它们称为 `$1`、`$2` 等。等到第 35 行,阅读你脚本的人可能已经忘了 `$2` 表示什么。如果你将一个重要参数的值赋给 `$filename` 或 `$numlines`,那么他就不容易忘记。 + +``` +#!/bin/bash + +if [ $# -lt 2 ]; then + echo "Usage: $0 lines filename" + exit 1 +else + numlines=$1 + filename=$2 +fi + +if [[ $numlines != [0-9]* ]]; then + echo "Error: $numlines is not numeric" + exit 2 +fi + +if [ ! -f $ filename]; then + echo "Error: File $filename not found" + exit 3 +else + echo top of file + head -$numlines $filename +fi +``` + +当然,这个示例脚本只是运行 `head` 命令来显示文件中的前 x 行,但它的目的是显示如何在脚本中使用内部参数来帮助确保脚本运行良好,或在失败时清晰地知道失败原因。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/04/variable-key-keyboard-100793080-large.jpg +[2]: https://linux.cn/article-10916-1.html +[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/20190524 Spell Checking Comments.md b/published/20190524 Spell Checking Comments.md new file mode 100644 index 0000000000..d48358c2a9 --- /dev/null +++ b/published/20190524 Spell Checking Comments.md @@ -0,0 +1,40 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11294-1.html) +[#]: subject: (Spell Checking Comments) +[#]: via: (https://emacsredux.com/blog/2019/05/24/spell-checking-comments/) +[#]: author: (Bozhidar Batsov https://emacsredux.com) + +Emacs 注释中的拼写检查 +====== + +我出了名的容易拼错单词(特别是在播客当中)。谢天谢地 Emacs 内置了一个名为 `flyspell` 的超棒模式来帮助像我这样的可怜的打字员。flyspell 会在你输入时突出显示拼错的单词 (也就是实时的) 并提供有用的快捷键来快速修复该错误。 + +大多输入通常会对派生自 `text-mode`(比如 `markdown-mode`,`adoc-mode` )的主模式启用 `flyspell`,但是它对程序员也有所帮助,可以指出他在注释中的错误。所需要的只是启用 `flyspell-prog-mode`。我通常在所有的编程模式中(至少在 `prog-mode` 派生的模式中)都启用它: + +``` +(add-hook 'prog-mode-hook #'flyspell-prog-mode) +``` + +现在当你在注释中输入错误时,就会得到即时反馈了。要修复单词只需要将光标置于单词后,然后按下 `C-c $` (`M-x flyspell-correct-word-before-point`)。(还有许多其他方法可以用 `flyspell` 来纠正拼写错误的单词,但为了简单起见,我们暂时忽略它们。) + +![flyspell_prog_mode.gif][1] + +今天的分享就到这里!我要继续修正这些讨厌的拼写错误了! + +-------------------------------------------------------------------------------- + +via: https://emacsredux.com/blog/2019/05/24/spell-checking-comments/ + +作者:[Bozhidar Batsov][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://emacsredux.com +[b]: https://github.com/lujun9972 +[1]: https://emacsredux.com/assets/images/flyspell_prog_mode.gif diff --git a/published/20190603 How many browser tabs do you usually have open.md b/published/20190603 How many browser tabs do you usually have open.md new file mode 100644 index 0000000000..9366464b0c --- /dev/null +++ b/published/20190603 How many browser tabs do you usually have open.md @@ -0,0 +1,44 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11322-1.html) +[#]: subject: (How many browser tabs do you usually have open?) +[#]: via: (https://opensource.com/article/19/6/how-many-browser-tabs) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst) + +你通常打开多少个浏览器标签页? +====== + +> 外加一些提高浏览器效率的技巧。 + +![Browser of things][1] + +这里有一个别有用心的问题:你通常一次打开多少个浏览器标签页?你是否有多个窗口,每个窗口都有多个标签页?或者你是一个极简主义者,一次只打开两个标签页。另一种选择是将一个 20 个标签页的浏览器窗口移动到另一个屏幕上去,这样在处理特定任务时它就不会碍事了。你的处理方法在工作、个人和移动浏览器之间有什么不同吗?你的浏览器策略是否与你的[工作习惯][2]有关? + +### 4 个提高浏览器效率的技巧 + +1. 了解浏览器快捷键以节省单击。无论你使用 Firefox 还是 Chrome,都有很多快捷键可以让你方便地执行包括切换标签页在内的某些功能。例如,Chrome 可以很方便地打开一个空白的谷歌文档。使用快捷键 `Ctrl + t` 打开一个新标签页,然后键入 `doc.new` 即可。电子表格、幻灯片和表单也可以这样做。 +2. 用书签文件夹组织最频繁的任务。当开始一项特定的任务时,只需打开文件夹中的所有书签 (`Ctrl + 点击`),就可以快速地从列表中勾选它。 +3. 使用正确的浏览器扩展。成千上万的浏览器扩展都声称可以提高工作效率。在安装之前,确定你不是仅仅在屏幕上添加更多的干扰而已。 +4. 使用计时器减少看屏幕的时间。无论你使用的是老式的 egg 定时器还是花哨的浏览器扩展,都没有关系。为了防止眼睛疲劳,执行 20/20/20 规则。每隔 20 分钟,离开屏幕 20 秒,看看 20 英尺以外的东西。 + +参加我们的投票来分享你一次打开多少个浏览器标签。请务必在评论中告诉我们你最喜欢的浏览器技巧。 + +生产力有两个组成部分——做正确的事情和高效地做那些事情…… + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/how-many-browser-tabs + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) +[2]: https://enterprisersproject.com/article/2019/1/5-time-wasting-habits-break-new-year diff --git a/published/20190603 How to stream music with GNOME Internet Radio.md b/published/20190603 How to stream music with GNOME Internet Radio.md new file mode 100644 index 0000000000..3387da566b --- /dev/null +++ b/published/20190603 How to stream music with GNOME Internet Radio.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11325-1.html) +[#]: subject: (How to stream music with GNOME Internet Radio) +[#]: via: (https://opensource.com/article/19/6/gnome-internet-radio) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/r3bl) + +如何使用 GNOME 的 Internet Radio 播放流音乐 +====== + +> 如果你正在寻找一个简单、直观的界面,让你可以播放流媒体,可以尝试一下 GNOME 的 Internet Radio 插件。 + +![](https://img.linux.net.cn/data/attachment/album/201909/10/114049ppzxeug7xx7jm7ko.jpg) + +网络广播是收听世界各地电台节目的好方法。和许多开发人员一样,我喜欢在编写代码时打开电台。你可以使用 [MPlayer][2] 或 [mpv][3] 等终端媒体播放器收听网络广播,我就是这样通过 Linux 命令行收听广播的。但是,如果你喜欢使用图形用户界面 (GUI),你可以尝试一下 [GNOME Internet Radio][4],这是一个用于 GNOME 桌面的漂亮插件。你可以在包管理器中找到它。 + +![GNOME Internet Radio plugin][5] + +使用图形桌面操作系统收听网络广播通常需要启动一个应用程序,比如 [Audacious][6] 或 [Rhythmbox][7]。它们有很好的界面,很多选项,以及很酷的音频可视化工具。但如果你只想要一个简单、直观的界面播放你的流媒体,GNOME Internet Radio 就是你的选择。 + +安装之后,工具栏中会出现一个小图标,你可以在其中进行所有配置和管理。 + +![GNOME Internet Radio icons][8] + +我做的第一件事是进入设置菜单。我启用了以下两个选项:显示标题通知和显示音量调整。 + +![GNOME Internet Radio Settings][9] + +GNOME Internet Radio 包含一些预置的电台,并且很容易添加其他电台。只需点击(“+”)符号即可。你需要输入一个频道名称,它可以是你喜欢的任何内容(包括电台名称)和电台地址。例如,我喜欢听 Synthetic FM。我输入名称(Synthetic FM),以及流地址(https://mediaserv38.live-streams.nl:2199/tunein/syntheticfm.pls)。 + +然后单击流旁边的星号将其添加到菜单中。 + +不管你听什么音乐,不管你选择什么类型,很明显,程序员需要他们的音乐!GNOME Internet Radio 插件使你可以轻松地让你排好喜爱的网络电台。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/gnome-internet-radio + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss/users/r3bl +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My (video editing dashboard) +[2]: https://opensource.com/article/18/12/linux-toy-mplayer +[3]: https://mpv.io/ +[4]: https://extensions.gnome.org/extension/836/internet-radio/ +[5]: https://opensource.com/sites/default/files/uploads/packagemanager_s.png (GNOME Internet Radio plugin) +[6]: https://audacious-media-player.org/ +[7]: https://help.gnome.org/users/rhythmbox/stable/ +[8]: https://opensource.com/sites/default/files/uploads/titlebaricons.png (GNOME Internet Radio icons) +[9]: https://opensource.com/sites/default/files/uploads/gnomeinternetradio_settings.png (GNOME Internet Radio Settings) diff --git a/published/20190628 How to Install and Use R on Ubuntu.md b/published/20190628 How to Install and Use R on Ubuntu.md new file mode 100644 index 0000000000..787e359848 --- /dev/null +++ b/published/20190628 How to Install and Use R on Ubuntu.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11331-1.html) +[#]: subject: (How to Install and Use R on Ubuntu) +[#]: via: (https://itsfoss.com/install-r-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 上安装和使用 R 语言 +====== + +> 这个教程指导你如何在 Ubuntu 上安装 R 语言。你也将同时学习到如何在 Ubuntu 上用不同方法运行简单的 R 语言程序。 + +[R][1],和 Python 一样,它是在统计计算和图形处理上最常用的编程语言,易于处理数据。随着数据分析、数据可视化、数据科学(机器学习热)的火热化,对于想深入这一领域的人来说,它是一个很好的工具。 + +R 语言的优点是它的语法非常简练,你可以找到它的很多实际使用的教程或指南。 + +本文将介绍包含如何在 Ubuntu 下安装 R 语言,也会介绍在 Linux 下如何运行第一个 R 程序。 + +![][2] + +### 如何在 Ubuntu 上安装 R 语言 + +R 默认在 Ubuntu 的软件库里。用以下命令很容易安装: + +``` +sudo apt install r-base +``` + +请注意这可能会安装一个较老的版本。在我写这篇文字的时候,Ubuntu 提供的是 3.4,但是最新的是3.6。 + +*我建议除非你必须使用最新版本,否则直接使用 Ubuntu 的配套版本。* + +#### 如何在 Ubuntu 上安装最新 3.6 版本的 R 环境 + +如果想安装最新的版本(或特殊情况指定版本),你必须用 [CRAN][3](Comprehensive R Archive Network)。这个是 R 最新版本的镜像列表。 + +如需获取 3.6 的版本,需要添加镜像到你的源索引里。我已经简化其命令如下: + +``` +sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran35/" +``` + +下面你需要添加密钥到服务器中: + +``` +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 +``` + +然后更新服务器信息并安装R环境: + +``` +sudo apt update +sudo apt install r-base +``` + +就这样安装完成。 + +### 如何在 Ubuntu 下使用 R 语言编程 + +R 的用法多样,我将介绍运行多个运行 R 语言的方式。 + +#### R 语言的交互模式 + +安装了 R 语言后,你可以在控制台上直接运行: + +``` +R +``` + +这样会打开交互模式: + +![R Interactive Mode][5] + +R 语言的控制台与 Python 和 Haskell 的交互模式很类似。你可以输入 R 命令做一些基本的数学运算,例如: + +``` +> 20+40 +[1] 60 + +> print ("Hello World!") +[1] "Hello World!" +``` + +你可以测试绘图: + +![R Plotting][6] + +如果想退出可以用 `q()`或按下 `CTRL+c`键。接着你会被提示是否保存工作空间镜像;工作空间是创建变量的环境。 + +#### 用 R 脚本运行程序 + +第二种运行 R 程序的方式是直接在 Linux 命令行下运行。你可以用 `RScript` 执行,它是一个包含 `r-base` 软件包的工具。 + +首先,你需要用你在 [Linux 下常用的编辑器][7]保存 R 程序到文件。文件的扩展名必须是 `.r`。 + +下面是一个打印 “Hello World” 的 R 程序。你可以保存其为 `hello.r`。 + +``` +print("Hello World!") +a <- rnorm(100) +plot(a) +``` + +用下面命令运行 R 程序: + +``` +Rscript hello.r +``` + +你会得到如下输出结果: + +``` +[1] "Hello World!" +``` + +结果将会保存到当前工作目录,文件名为 `Rplots.pdf`: + +![Rplots.pdf][8] + +小提示:`Rscript` 默认不会加载 `methods` 包。确保在脚本中[显式加载][9]它。 + +#### 在 Ubuntu 下用 RStudio 运行 R 语言 + +最常见的 R 环境是 [RStudio][10],这是一个强大的跨平台的开源 IDE。你可以用 deb 文件在 Ubuntu 上安装它。下载 deb 文件的链接如下。你需要向下滚动找到 Ubuntu 下的 DEB 文件。 + +- [下载 Ubuntu 的 Rstudio][12] + +下载了 DEB 文件后,直接点击安装。 + +下载后从菜单搜索启动它。程序主界面会弹出如下: + +![RStudio 主界面][13] + +现在可以看到和 R 命令终端一样的工作台。 + +创建一个文件:点击顶栏 “File” 然后选择 “New File > Rscript”(或 `CTRL+Shift+n`): + +![RStudio 新建文件][15] + +按下 `CTRL+s` 保存文件选择路径和命名: + +![RStudio 保存文件][16] + +这样做了后,点击 “Session > Set Working Directory > To Source File Location” 修改工作目录为你的脚本路径: + +![RStudio 工作目录][17] + +现在一切准备就绪!编写代码然后点击运行。你可以在控制台和图形窗口看到结果: + +![RStudio 运行][18] + +### 结束语 + +这篇文章中展示了如何在 Ubuntu 下使用 R 语言。包含了以下几个方面:R 控制台 —— 可用于测试,Rscript —— 终端达人操作,RStudio —— 你想要的 IDE。 + +无论你正在从事数据科学或只是热爱数据统计,作为一个数据分析的完美工具,R 都是一个比较好的编程装备。 + +你想使用 R 吗?你入门了吗?让我们了解你是如何学习 R 的以及为什么要学习 R! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-r-ubuntu/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.r-project.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/install-r-on-ubuntu.jpg?resize=800%2C450&ssl=1 +[3]: https://cran.r-project.org/ +[4]: https://itsfoss.com/bootable-windows-usb-linux/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_interactive_mode.png?fit=800%2C516&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_plotting.jpg?fit=800%2C434&ssl=1 +[7]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rplots_pdf.png?fit=800%2C539&ssl=1 +[9]: https://www.dummies.com/programming/r/how-to-install-load-and-unload-packages-in-r/ +[10]: https://www.rstudio.com/ +[11]: https://itsfoss.com/install-deb-files-ubuntu/ +[12]: https://www.rstudio.com/products/rstudio/download/#download +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_home.jpg?fit=800%2C603&ssl=1 +[14]: https://itsfoss.com/python-setup-linux/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_new_file.png?fit=800%2C392&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_save_file.png?fit=800%2C258&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_working_directory.png?fit=800%2C394&ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_run.jpg?fit=800%2C626&ssl=1 +[19]: https://i1.wp.com/images-na.ssl-images-amazon.com/images/I/51oIJTbUlnL._SL160_.jpg?ssl=1 +[20]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Learn R in a Day) +[21]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Buy on Amazon) + diff --git a/published/201907/20171226 Top 10 Microsoft Visio Alternatives for Linux.md b/published/201907/20171226 Top 10 Microsoft Visio Alternatives for Linux.md new file mode 100644 index 0000000000..d146b9bd16 --- /dev/null +++ b/published/201907/20171226 Top 10 Microsoft Visio Alternatives for Linux.md @@ -0,0 +1,227 @@ +10 个 Linux 中最好的 Visio 替代品 +====== + +> 如果你正在 Linux 中寻找一个好的 Visio 查看器,这里有一些可以在 Linux 中使用的微软 Visio 的替代方案。 + +[微软 Visio][1] 是创建或生成关键任务图和矢量表示的绝佳工具。虽然它可能是制作平面图或其他类型图表的好工具 —— 但它既不是免费的,也不是开源的 + +此外,微软 Visio 不是一个独立的产品。它与微软 Office 捆绑在一起。我们过去已经看过 [MS Office 的开源替代品][2]。今天我们将看看你可以在 Linux 上使用哪些工具代替 Visio。 + +### 适用于 Linux 的最佳 微软 Visio 备选方案 + +![用于 Linux 的微软 Visio 备选方案][4] + +此处为强制性免责声明。该列表不是排名。排名第三的产品并不比排名第六的好。 + +我还提到了两个可以从 Web 界面使用的非开源 Visio 软件。 + +| 软件 | 类型 | 许可证类型 | +| --- | --- | --- | +| [LibreOffice Draw][6] | 桌面软件 | 自由开源 | +| [OpenOffice Draw][10] | 桌面软件 | 自由开源 | +| [Dia][12] | 桌面软件 | 自由开源 | +| [yED Graph Editor][14] | 桌面和基于 Web | 免费增值 | +| [Inkscape][16] | 桌面软件 | 自由开源 | +| [Pencil][18] | 桌面和基于 Web | 自由开源 | +| [Graphviz][20] | 桌面软件 | 自由开源 | +| [darw.io][22] | 桌面和基于 Web | 自由开源 | +| [Lucidchart][24] | 基于 Web | 免费增值 | +| [Calligra Flow][27] | 桌面软件 | 自由开源 | + + +### 1、LibreOffice Draw + +![][5] + +LibreOffice Draw 模块是微软 Visio 的最佳开源替代方案之一。在它的帮助下,你可以选择制作一个想法的速写或一个复杂的专业平面布置图来展示。流程图、组织结构图、网络图、小册子、海报等等!所有这些都不需要花一分钱。 + +好的是它与 LibreOffice 捆绑在一起,默认情况下安装在大多数 Linux 发行版中。 + +#### 主要功能概述: + + * 用于制作宣传册/海报的样式和格式工具 + * Calc 数据可视化 + * PDF 文件编辑功能 + * 通过操作图库中的图片来创建相册 + * 灵活的绘图工具类似于 微软 Visio (智能连接器,尺寸线等)的工具 + * 支持 .VSD 文件(打开) + +官网:[LibreOffice Draw][6] + +### 2、Apache OpenOffice Draw + +![][7] + +很多人都知道 OpenOffice(LibreOffice 项目最初就是基于它的),但他们并没有真正意识到 Apache OpenOffice Draw 可以作为微软 Visio 的替代方案。但事实上,它是另一个令人惊奇的开源图表软件工具。与 LibreOffice Draw 不同,它不支持编辑 PDF 文件,但它为任何类型的图表创建提供了绘图工具。 + +这只是个警告。仅当你的系统中已经有 OpenOffice 时才使用此工具。这是因为[安装 OpenOffice][8] 是一件痛苦的事情,而且它已经[不再继续开发][9]。 + +#### 主要功能概述: + + * 快速创建 3D 形状控制器 + * 创建作品的 flash 版本(.swf) + * 样式和格式工具 + * 与微软 Visio 类似的灵活绘图工具(智能连接器、尺寸线等) + +官网:[Apache OpenOffice Draw][10] + +### 3、Dia + +![][11] + +Dia 是另一个有趣的开源工具。它可能不像前面提到的那样处于积极开发之中。但是,如果你正在寻找一个自由而开源的替代微软 Visio 的简单而体面的图表,那么 Dia 可能是你的选择。这个工具可能唯一让你失望的地方就是它的用户界面。除此之外,它还允许你为复杂的图使用强大的工具(但它看起来可能不太好 —— 所以我们建议你用于更简单的图)。 + +#### 主要功能概述: + + * 它可以通过命令行使用 + * 样式和格式工具 + * 用于自定义形状的形状存储库 + * 与微软 Visio 类似的绘图工具(特殊对象、网格线、图层等) + * 跨平台 + +官网:[Dia][12] + +### 4、yED Graph Editor + +[视频](https://youtu.be/OmSTwKw7dX4) + +是最受欢迎的免费的微软 Visio 替代方案之一。如果你对它是一个免费软件而不是开源项目有些担心,你仍然可以通过 web 浏览器免费使用 [yED 的实时编辑器][13]。如果你想用一个非常易于使用的界面快速绘制图表,这是最好的建议之一。 + +#### 主要功能概述: + + * 拖放功能,方便图表制作 + * 支持导入外部数据进行链接 + +官网:[yED Graph Editor][14] + +### 5、Inkscape + +![][15] + +Inkscape 是一个自由开源的矢量图形编辑器。你将拥有创建流程图或数据流程图的基本功能。它不提供高级的图表绘制工具,而是提供创建更简单图表的基本工具。因此,当你希望通过使用图库中的可用符号,在图库连接器工具的帮助下生成基本图时,Inkscape 可能是你的 Visio 替代品。 + +#### 主要功能概述: + + * 连接器工具 + * 灵活的绘图工具 + * 广泛的文件格式兼容性 + +官网:[Inkscape][16] + +### 6、Pencil 项目 + +![][17] + +Pencil 项目是一个令人印象深刻的开源项目,适用于 Windows、Mac 以及 Linux。它具有易于使用的图形界面,使绘图更容易和方便。它有一个很好的内建形状和符号的集合,可以使你的图表看起来很棒。它还内置了 Android 和 iOS UI 模板,可以让你在需要时创建应用程序原型。 + +你也可以将其安装为 Firefox 扩展,但该扩展不能使用项目的最新版本。 + +#### 主要功能概述: + + * 轻松浏览剪贴画(使用 openclipart.org) + * 导出为 ODT 文件/PDF 文件 + * 图表连接工具 + * 跨平台 + +官网:[Pencil 项目][18] + +### 7、Graphviz + +![][19] + +Graphviz 略有不同。它不是绘图工具,而是专用的图形可视化工具。如果你在网络图中需要多个设计来表示一个节点,那么一定要使用这个工具。当然,你不能用这个工具做平面布置图(至少这不容易)。因此,它最适合于网络图、生物信息学、数据库连接和类似的东西。 + +#### 主要功能概述: + + * 支持命令行使用 + * 支持自定义形状和表格节点布局 + * 基本样式和格式设置工具 + +官网:[Graphviz][20] + +### 8、Draw.io + +[视频](https://youtu.be/Z0D96ZikMkc) + +Draw.io 主要是一个基于 Web 的免费图表工具,它的强大的工具几乎可以制作任何类型的图表。你只需要拖放然后连接它们以创建流程图、ER 图或任何相关的。此外,如果你喜欢该工具,则可以尝试[离线桌面版本][21]。 + +#### 主要功能概述: + + * 直接上传到云存储服务 + * 自定义形状 + * 样式和格式工具 + * 跨平台 + +官网:[Draw.io][22] + +### 9、Lucidchart + +![][23] + +Lucidchart 是一个基于 Web 的高级图表工具,它提供了一个具有有限功能的免费订阅。你可以使用免费订阅创建几种类型的图表,并将其导出为图像或 PDF。但是,免费版本不支持数据链接和 Visio 导入/导出功能。如果你不需要数据链接功能,Lucidchart 可以说是一个生成漂亮的图表的非常好的工具。 + +#### 主要功能概述: + + * 可以集成到 Slack、Jira 核心、Confluence + * 能够制作产品模型 + * 导入 Visio 文件 + +官网:[Lucidchart][24] + +### 10、Calligra Flow + +![calligra flow][25] + +Calligra Flow 是 [Calligra 项目][26]的一部分,旨在提供自由开源的软件工具。使用 Calligra flow 你可以轻松地创建网络图、实体关系图、流程图等 + +#### 主要功能概述: + + * 各种模具盒 + * 样式和格式工具 + +官网:[Calligra Flow][27] + +### 总结 + +既然你已经了解到了这些最好的自由开源的 Visio 替代方案,你对它们有什么看法? + +对于你任何方面的需求,它们是否优于 微软 Visio?另外,如果我们错过了你最喜欢的基于 Linux 的替代微软 Visio 的绘图工具,请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/visio-alternatives-linux/ + +作者:[Ankush Das][a] +译者:[ZhiW5217](https://github.com/ZhiW5217) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/ankush/ +[1]:https://products.office.com/en/visio/flowchart-software +[2]:https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ +[3]:data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs= +[4]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/visio-alternatives-linux-featured.png +[5]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/libreoffice-draw-microsoft-visio-alternatives.jpg +[6]:https://www.libreoffice.org/discover/draw/ +[7]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/apache-open-office-draw.jpg +[8]:https://itsfoss.com/install-openoffice-ubuntu-linux/ +[9]:https://itsfoss.com/openoffice-shutdown/ +[10]:https://www.openoffice.org/product/draw.html +[11]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/dia-screenshot.jpg +[12]:http://dia-installer.de/ +[13]:https://www.yworks.com/products/yed-live +[14]:https://www.yworks.com/products/yed +[15]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/inkscape-screenshot.jpg +[16]:https://inkscape.org/en/ +[17]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/pencil-project.jpg +[18]:http://pencil.evolus.vn/Downloads.html +[19]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/graphviz.jpg +[20]:http://graphviz.org/ +[21]:https://about.draw.io/integrations/#integrations_offline +[22]:https://about.draw.io/ +[23]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/lucidchart-visio-alternative.jpg +[24]:https://www.lucidchart.com/ +[25]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/calligra-flow.jpg +[26]:https://www.calligra.org/ +[27]:https://www.calligra.org/flow/ diff --git a/published/20180406 MX Linux- A Mid-Weight Distro Focused on Simplicity.md b/published/201907/20180406 MX Linux- A Mid-Weight Distro Focused on Simplicity.md similarity index 100% rename from published/20180406 MX Linux- A Mid-Weight Distro Focused on Simplicity.md rename to published/201907/20180406 MX Linux- A Mid-Weight Distro Focused on Simplicity.md diff --git a/published/20180529 Manage your workstation with Ansible- Configure desktop settings.md b/published/201907/20180529 Manage your workstation with Ansible- Configure desktop settings.md similarity index 100% rename from published/20180529 Manage your workstation with Ansible- Configure desktop settings.md rename to published/201907/20180529 Manage your workstation with Ansible- Configure desktop settings.md diff --git a/published/20180620 How To Find The Port Number Of A Service In Linux.md b/published/201907/20180620 How To Find The Port Number Of A Service In Linux.md similarity index 100% rename from published/20180620 How To Find The Port Number Of A Service In Linux.md rename to published/201907/20180620 How To Find The Port Number Of A Service In Linux.md diff --git a/published/20180629 100 Best Ubuntu Apps.md b/published/201907/20180629 100 Best Ubuntu Apps.md similarity index 100% rename from published/20180629 100 Best Ubuntu Apps.md rename to published/201907/20180629 100 Best Ubuntu Apps.md diff --git a/published/20180902 Learning BASIC Like It-s 1983.md b/published/201907/20180902 Learning BASIC Like It-s 1983.md similarity index 100% rename from published/20180902 Learning BASIC Like It-s 1983.md rename to published/201907/20180902 Learning BASIC Like It-s 1983.md diff --git a/published/201907/20180924 5 ways to play old-school games on a Raspberry Pi.md b/published/201907/20180924 5 ways to play old-school games on a Raspberry Pi.md new file mode 100644 index 0000000000..f9a55eda13 --- /dev/null +++ b/published/201907/20180924 5 ways to play old-school games on a Raspberry Pi.md @@ -0,0 +1,173 @@ +在树莓派上玩怀旧游戏的 5 种方法 +====== + +> 使用这些用于树莓派的开源平台来重温游戏的黄金时代。 + +![](https://d3avoj45mekucs.cloudfront.net/rojakdaily/media/jessica-chua/lifestyle/retro%20gaming%20comeback/retro-video-game-event.jpg) + +他们使它们不像过去那样子了,对吧?我是说,电子游戏。 + +当然,现在的设备更强大了。赛达尔公主Princess Zelda在过去每个边只有 16 个像素,而现在的图像处理能力足够处理她头上的每根头发。今天的处理器打败 1988 年的处理器简直不费吹灰之力。 + +但是你知道缺少什么吗?乐趣。 + +你有数之不尽的游戏,按下一个按钮就可以完成教程任务。可能有故事情节,当然杀死坏蛋也可以不需要故事情节,你需要的只是跳跃和射击。因此,毫不奇怪,树莓派最持久的流行用途之一就是重温上世纪八九十年代的 8 位和 16 位游戏的黄金时代。但从哪里开始呢? + +在树莓派上有几种方法可以玩怀旧游戏。每一种都有自己的优点和缺点,我将在这里讨论这些。 + +### RetroPie + +[RetroPie][1] 可能是树莓派上最受欢迎的复古游戏平台。它是一个可靠的万能选手,是模拟经典桌面和控制台游戏系统的绝佳选择。 + +![](https://retropie.org.uk/wp-content/uploads/2016/04/Amiga_Gameplay_2.png) + +#### 介绍 + +RetroPie 构建在 [Raspbian][2] 上运行。如果你愿意,它也可以安装在现有的 Raspbian 镜像上。它使用 [EmulationStation][3] 作为开源仿真器库(包括 [Libretro][4] 仿真器)的图形前端。 + +不过,你要玩游戏其实并不需要理解上面的任何一个词。 + +#### 它有什么好处 + +入门很容易。你需要做的就是将镜像刻录到 SD 卡,配置你的控制器、复制游戏,然后开始杀死坏蛋。 + +它的庞大用户群意味着有大量的支持和信息,活跃的在线社区也可以求助问题。 + +除了随 RetroPie 镜像一起安装的仿真器之外,还有一个可以从包管理器安装的庞大的仿真器库,并且它一直在增长。RetroPie 还提供了用户友好的菜单系统来管理这些,可以节省你的时间。 + +从 RetroPie 菜单中可以轻松添加 Kodi 和配备了 Chromium 浏览器的 Raspbian 桌面。这意味着你的这套复古游戏装备也适于作为家庭影院、[YouTube][5]、[SoundCloud][6] 以及所有其它“休息室电脑”产品。 + +RetroPie 还有许多其它自定义选项:你可以更改菜单中的图形,为不同的模拟器设置不同的控制手柄配置,使你的树莓派文件系统的所有内容对你的本地 Windows 网络可见等等。 + +RetroPie 建立在 Raspbian 上,这意味着你可以探索这个树莓派最受欢迎的操作系统。你所发现的大多数树莓派项目和教程都是为 Raspbian 编写的,因此可以轻松地自定义和安装新内容。我已经使用我的 RetroPie 装备作为无线桥接器,在上面安装了 MIDI 合成器,自学了一些 Python,更重要的是,所有这些都没有影响它作为游戏机的用途。 + +#### 它有什么不太好的 + +RetroPie 的安装简单和易用性在某种程度上是一把双刃剑。你可以在 RetroPie 上玩了很长时间,而甚至没有学习过哪怕像 `sudo apt-get` 这样简单的东西,但这也意味着你错过了很多树莓派的体验。 + +但不一定必须如此;当你需要时,命令行仍然存在于底层,但是也许用户与 Bash shell 有点隔离,而使它最终并没有看上去那么可怕、另外,RetroPie 的主菜单只能通过控制手柄操作,当你没有接入手柄时,这可能很烦人,因为你一直将该系统用于游戏之外的事情。 + +#### 它适用于谁? + +任何想直接玩一些游戏的人,任何想拥有最大、最好的模拟器库的人,以及任何想在不玩游戏的时候开始探索 Linux 的人。 + +### Recalbox + +[Recalbox][7] 是一个较新的树莓派开源模拟器套件。它还支持其它基于 ARM 的小型计算机。 + +![](https://www.recalbox.com/images/features/4playermodo_hu5438825b9b6d1014226d20d231e650c2_230970_500x0_resize_q75_box.jpeg) + +#### 介绍 + +与 Retropie 一样, Recalbox 基于 EmulationStation 和 Libretro。它的不同之处在于它不是基于 Raspbian 构建的,而是基于它自己的 Linux 发行版:RecalboxOS。 + +#### 它有什么好处 + +Recalbox 的设置比 RetroPie 更容易。你甚至不需要做 SD 卡镜像;只需复制一些文件即可。它还为一些游戏控制器提供开箱即用的支持,可以让你更快地开始游戏。它预装了 Kodi。这是一个现成的游戏和媒体平台。 + +#### 它有什么不太好的 + +Recalbox 比 RetroPie 拥有更少的仿真器、更少的自定义选项和更小的用户社区。 + +你的 Recalbox 装备可能一直用于模拟器和 Kodi,安装成什么样就是什么样。如果你想深入了解 Linux,你可能需要为 Raspbian 提供一个新的 SD 卡。 + +#### 它适用于谁? + +如果你想要绝对简单的复古游戏体验,并且不想玩一些比较少见的游戏平台模拟器,或者你害怕一些技术性工作(也没有兴趣去做),那么 Recalbox 非常适合你。 + +对于大多数读者来说,Recalbox 可能最适合推荐给你那些不太懂技术的朋友或亲戚。它超级简单的设置和几乎没什么选项甚至可以让你免去帮助他们解决问题。 + +### 做个你自己的 + +好,你可能已经注意到 Retropie 和 Recalbox 都是由许多相同的开源组件构建的。那么为什么不自己把它们组合在一起呢? + +#### 介绍 + +无论你想要的是什么,开源软件的本质意味着你可以使用现有的模拟器套件作为起点,或者随意使用它们。 + +#### 它有什么好处 + +如果你想有自己的自定义界面,我想除了亲自动手别无它法。这也是安装在 RetroPie 中没有的仿真器的方法,例如 [BeebEm][8]) 或 [ArcEm][9]。 + +#### 它有什么不太好的 + +嗯,工作量有点大。 + +#### 它适用于谁? + +喜欢鼓捣的人,有动手能力的人,开发者,经验丰富的业余爱好者等。 + +### 原生 RISC OS 游戏体验 + +现在有一匹黑马:[RISC OS][10],它是 ARM 设备的原始操作系统。 + +#### 介绍 + +在 ARM 成为世界上最受欢迎的 CPU 架构之前,它最初是作为 Acorn Archimedes 的处理器而开发的。现在看起来这像是一种被遗忘的野兽,但是那几年,它作为世界上最强大的台式计算机独领风骚了好几年,并且吸引了大量的游戏开发项目。 + +树莓派中的 ARM 处理器是 Archimedes 的曾孙辈的 CPU,所以我们仍然可以在其上安装 RISC OS,只要做一点工作,就可以让这些游戏运行起来。这与我们到上面所介绍的仿真器方式不同,我们是在玩为该操作系统和 CPU 架构开发的游戏。 + +#### 它有什么好处 + +这是 RISC OS 的完美展现,这绝对是操作系统的瑰宝,非常值得一试。 + +事实上,你使用的是和以前几乎相同的操作系统来加载和玩你的游戏,这使得你的复古游戏装备像是一个时间机器一样,这无疑为该项目增添了一些魅力和复古价值。 + +有一些精彩的游戏只在 Archimedes 上发布过。Archimedes 的巨大硬件优势也意味着它通常拥有许多多平台游戏大作的最佳图形和最流畅的游戏体验。这类游戏的版权持有者非常慷慨,可以合法地免费下载它们。 + +#### 它有什么不太好的 + +安装了 RISC OS 之后,它仍然需要一些努力才能让游戏运行起来。这是 [入门指南][11]。 + +对于休息室来说,这绝对不是一个很好的全能选手。没有什么比 [Kodi][12] 更好的了。它有一个网络浏览器 [NetSurf][13],但它在支持现代 Web 方面还需要一些努力。你不会像使用模拟器套件那样得到大量可以玩的游戏。RISC OS Open 对于爱好者来说可以免费下载和使用,而且很多源代码已经开源,尽管由于这个名字,它不是一个 100% 的开源操作系统。 + +#### 它适用于谁? + +这是专为追求新奇的人,绝对怀旧的人,想要探索一个来自上世纪 80 年代的有趣的操作系统的人,怀旧过去的 Acorn 机器的人,以及想要一个完全不同的怀旧游戏项目的人而设计的。 + +### 终端游戏 + +你是否真的需要安装模拟器或者一个异域风情的操作系统才能重温辉煌的日子?为什么不从命令行安装一些原生 Linux 游戏呢? + +#### 介绍 + +有一系列原生的 Linux 游戏经过测试可以在 [树莓派][14] 上运行。 + +#### 它有什么好处 + +你可以使用命令行从程序包安装其中的大部分,然后开始玩。很容易。如果你已经有了一个跑起来的 Raspbian,那么它可能是你运行游戏的最快途径。 + +#### 它有什么不太好的 + +严格来说,这并不是真正的复古游戏。Linux 诞生于 1991 年,过了一段时间才成为了一个游戏平台。这些不是经典的 8 位和 16 位时代的游戏体验;后来有一些移植的游戏或受复古影响的游戏。 + +#### 它适用于谁? + +如果你只是想找点乐子,这没问题。但如果你想重温过去,那就不完全是这样了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/retro-gaming-raspberry-pi + +作者:[James Mawson][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[canhetingsky](https://github.com/canhetingsky) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dxmjames +[1]: https://retropie.org.uk/ +[2]: https://www.raspbian.org/ +[3]: https://emulationstation.org/ +[4]: https://www.libretro.com/ +[5]: https://www.youtube.com/ +[6]: https://soundcloud.com/ +[7]: https://www.recalbox.com/ +[8]: http://www.mkw.me.uk/beebem/ +[9]: http://arcem.sourceforge.net/ +[10]: https://opensource.com/article/18/7/gentle-intro-risc-os +[11]: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ +[12]: https://kodi.tv/ +[13]: https://www.netsurf-browser.org/ +[14]: https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 diff --git a/published/20190211 Introducing kids to computational thinking with Python.md b/published/201907/20190211 Introducing kids to computational thinking with Python.md similarity index 100% rename from published/20190211 Introducing kids to computational thinking with Python.md rename to published/201907/20190211 Introducing kids to computational thinking with Python.md diff --git a/published/20190301 Emacs for (even more of) the win.md b/published/201907/20190301 Emacs for (even more of) the win.md similarity index 100% rename from published/20190301 Emacs for (even more of) the win.md rename to published/201907/20190301 Emacs for (even more of) the win.md diff --git a/published/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md b/published/201907/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md similarity index 100% rename from published/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md rename to published/201907/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md diff --git a/published/201907/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md b/published/201907/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md new file mode 100644 index 0000000000..ed9c481007 --- /dev/null +++ b/published/201907/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md @@ -0,0 +1,295 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11147-1.html) +[#]: subject: (ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel) +[#]: via: (https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +ClusterShell:一个在集群节点上并行运行命令的好工具 +====== + +![](https://img.linux.net.cn/data/attachment/album/201907/26/053202pgcgg1y1rc5l5mgg.jpg) + +我们过去曾写过两篇如何并行地在多个远程服务器上运行命令的文章:[并行 SSH(PSSH)][1] 和[分布式 Shell(DSH)][2]。今天,我们将讨论相同类型的主题,但它允许我们在集群节点上执行相同的操作。你可能会想,我可以编写一个小的 shell 脚本来实现这个目的,而不是安装这些第三方软件包。 + +当然,你是对的,如果要在十几个远程系统中运行一些命令,那么你不需要使用它。但是,你的脚本需要一些时间来完成此任务,因为它是按顺序运行的。想想你要是在一千多台服务器上运行一些命令会是什么样子?在这种情况下,你的脚本用处不大。此外,完成任务需要很长时间。所以,要克服这种问题和情况,我们需要可以在远程计算机上并行运行命令。 + +为此,我们需要在一个并行应用程序中使用它。我希望这个解释可以解决你对并行实用程序的疑虑。 + +### ClusterShell + +[ClusterShell][3] 是一个事件驱动的开源 Python 库,旨在在服务器场或大型 Linux 集群上并行运行本地或远程命令。(`clush` 即 [ClusterShell][3])。 + +它将处理在 HPC 集群上遇到的常见问题,例如在节点组上操作,使用优化过的执行算法运行分布式命令,以及收集结果和合并相同的输出,或检索返回代码。 + +ClusterShell 可以利用已安装在系统上的现有远程 shell 设施,如 SSH。 + +ClusterShell 的主要目标是通过为开发人员提供轻量级、但可扩展的 Python API 来改进高性能集群的管理。它还提供了 `clush`、`clubak` 和 `cluset`/`nodeset` 等方便的命令行工具,可以让传统的 shell 脚本利用这个库的一些功能。 + +ClusterShell 是用 Python 编写的,它需要 Python(v2.6+ 或 v3.4+)才能在你的系统上运行。 + +### 如何在 Linux 上安装 ClusterShell? + +ClusterShell 包在大多数发行版的官方包管理器中都可用。因此,使用发行版包管理器工具进行安装。 + +对于 Fedora 系统,使用 [DNF 命令][4]来安装 clustershell。 + +``` +$ sudo dnf install clustershell +``` + +如果系统默认是 Python 2,这会安装 Python 2 模块和工具,可以运行以下命令安装 Python 3 开发包。 + +``` +$ sudo dnf install python3-clustershell +``` + +在执行 clustershell 安装之前,请确保你已在系统上启用 [EPEL 存储库][5]。 + +对于 RHEL/CentOS 系统,使用 [YUM 命令][6] 来安装 clustershell。 + +``` +$ sudo yum install clustershell +``` + +如果系统默认是 Python 2,这会安装 Python 2 模块和工具,可以运行以下命令安装 Python 3 开发包。 + +``` +$ sudo yum install python34-clustershell +``` + +对于 openSUSE Leap 系统,使用 [Zypper 命令][7] 来安装 clustershell。 + +``` +$ sudo zypper install clustershell +``` + +如果系统默认是 Python 2,这会安装 Python 2 模块和工具,可以运行以下命令安装 Python 3 开发包。 + +``` +$ sudo zypper install python3-clustershell +``` + +对于 Debian/Ubuntu 系统,使用 [APT-GET 命令][8] 或 [APT 命令][9] 来安装 clustershell。 + +``` +$ sudo apt install clustershell +``` + +### 如何在 Linux 使用 PIP 安装 ClusterShell? + +可以使用 PIP 安装 ClusterShell,因为它是用 Python 编写的。 + +在执行 clustershell 安装之前,请确保你已在系统上启用了 [Python][10] 和 [PIP][11]。 + +``` +$ sudo pip install ClusterShell +``` + +### 如何在 Linux 上使用 ClusterShell? + +与其他实用程序(如 `pssh` 和 `dsh`)相比,它是直接了当的优秀工具。它有很多选项可以在远程并行执行。 + +在开始使用 clustershell 之前,请确保你已启用系统上的[无密码登录][12]。 + +以下配置文件定义了系统范围的默认值。你不需要修改这里的任何东西。 + +``` +$ cat /etc/clustershell/clush.conf +``` + +如果你想要创建一个服务器组,那也可以。默认情况下有一些示例,请根据你的要求执行相同操作。 + +``` +$ cat /etc/clustershell/groups.d/local.cfg +``` + +只需按以下列格式运行 clustershell 命令即可从给定节点获取信息: + +``` +$ clush -w 192.168.1.4,192.168.1.9 cat /proc/version +192.168.1.9: Linux version 4.15.0-45-generic ([email protected]) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 +192.168.1.4: Linux version 3.10.0-957.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018 +``` + +选项: + + * `-w:` 你要运行该命令的节点。 + +你可以使用正则表达式而不是使用完整主机名和 IP: + +``` +$ clush -w 192.168.1.[4,9] uname -r +192.168.1.9: 4.15.0-45-generic +192.168.1.4: 3.10.0-957.el7.x86_64 +``` + +或者,如果服务器位于同一 IP 系列中,则可以使用以下格式: + +``` +$ clush -w 192.168.1.[4-9] date +192.168.1.6: Mon Mar 4 21:08:29 IST 2019 +192.168.1.7: Mon Mar 4 21:08:29 IST 2019 +192.168.1.8: Mon Mar 4 21:08:29 IST 2019 +192.168.1.5: Mon Mar 4 09:16:30 CST 2019 +192.168.1.9: Mon Mar 4 21:08:29 IST 2019 +192.168.1.4: Mon Mar 4 09:16:30 CST 2019 +``` + +clustershell 允许我们以批处理模式运行命令。使用以下格式来实现此目的: + +``` +$ clush -w 192.168.1.4,192.168.1.9 -b +Enter 'quit' to leave this interactive mode +Working with nodes: 192.168.1.[4,9] +clush> hostnamectl +--------------- +192.168.1.4 +--------------- + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: f9b37a073c534dec8b236885e754cb56 + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 +--------------- +192.168.1.9 +--------------- + Static hostname: Ubuntu18 + Icon name: computer-vm + Chassis: vm + Machine ID: 27f6c2febda84dc881f28fd145077187 + Boot ID: f176f2eb45524d4f906d12e2b5716649 + Virtualization: oracle + Operating System: Ubuntu 18.04.2 LTS + Kernel: Linux 4.15.0-45-generic + Architecture: x86-64 +clush> free -m +--------------- +192.168.1.4 +--------------- + total used free shared buff/cache available +Mem: 1838 641 217 19 978 969 +Swap: 2047 0 2047 +--------------- +192.168.1.9 +--------------- + total used free shared buff/cache available +Mem: 1993 352 1067 1 573 1473 +Swap: 1425 0 1425 +clush> w +--------------- +192.168.1.4 +--------------- + 09:21:14 up 3:21, 3 users, load average: 0.00, 0.01, 0.05 +USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT +daygeek :0 :0 06:02 ?xdm? 1:28 0.30s /usr/libexec/gnome-session-binary --session gnome-classic +daygeek pts/0 :0 06:03 3:17m 0.06s 0.06s bash +daygeek pts/1 192.168.1.6 06:03 52:26 0.10s 0.10s -bash +--------------- +192.168.1.9 +--------------- + 21:13:12 up 3:12, 1 user, load average: 0.08, 0.03, 0.00 +USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT +daygeek pts/0 192.168.1.6 20:42 29:41 0.05s 0.05s -bash +clush> quit +``` + +如果要在一组节点上运行该命令,请使用以下格式: + +``` +$ clush -w @dev uptime +or +$ clush -g dev uptime +or +$ clush --group=dev uptime + +192.168.1.9: 21:10:10 up 3:09, 1 user, load average: 0.09, 0.03, 0.01 +192.168.1.4: 09:18:12 up 3:18, 3 users, load average: 0.01, 0.02, 0.05 +``` + +如果要在多个节点组上运行该命令,请使用以下格式: + +``` +$ clush -w @dev,@uat uptime +or +$ clush -g dev,uat uptime +or +$ clush --group=dev,uat uptime + +192.168.1.7: 07:57:19 up 59 min, 1 user, load average: 0.08, 0.03, 0.00 +192.168.1.9: 20:27:20 up 1:00, 1 user, load average: 0.00, 0.00, 0.00 +192.168.1.5: 08:57:21 up 59 min, 1 user, load average: 0.00, 0.01, 0.05 +``` + +clustershell 允许我们将文件复制到远程计算机。将本地文件或目录复制到同一个远程节点: + +``` +$ clush -w 192.168.1.[4,9] --copy /home/daygeek/passwd-up.sh +``` + +我们可以通过运行以下命令来验证它: + +``` +$ clush -w 192.168.1.[4,9] ls -lh /home/daygeek/passwd-up.sh +192.168.1.4: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 4 09:00 /home/daygeek/passwd-up.sh +192.168.1.9: -rwxr-xr-x 1 daygeek daygeek 159 Mar 4 20:52 /home/daygeek/passwd-up.sh +``` + +将本地文件或目录复制到不同位置的远程节点: + +``` +$ clush -g uat --copy /home/daygeek/passwd-up.sh --dest /tmp +``` + +我们可以通过运行以下命令来验证它: + +``` +$ clush --group=uat ls -lh /tmp/passwd-up.sh +192.168.1.7: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 6 07:44 /tmp/passwd-up.sh +``` + +将文件或目录从远程节点复制到本地系统: + +``` +$ clush -w 192.168.1.7 --rcopy /home/daygeek/Documents/magi.txt --dest /tmp +``` + +我们可以通过运行以下命令来验证它: + +``` +$ ls -lh /tmp/magi.txt.192.168.1.7 +-rw-r--r-- 1 daygeek daygeek 35 Mar 6 20:24 /tmp/magi.txt.192.168.1.7 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/pssh-parallel-ssh-run-execute-commands-on-multiple-linux-servers/ +[2]: https://www.2daygeek.com/dsh-run-execute-shell-commands-on-multiple-linux-servers-at-once/ +[3]: https://cea-hpc.github.io/clustershell/ +[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[5]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[10]: https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-centos-6-system/ +[11]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[12]: https://www.2daygeek.com/linux-passwordless-ssh-login-using-ssh-keygen/ diff --git a/published/20190320 4 cool terminal multiplexers.md b/published/201907/20190320 4 cool terminal multiplexers.md similarity index 100% rename from published/20190320 4 cool terminal multiplexers.md rename to published/201907/20190320 4 cool terminal multiplexers.md diff --git a/published/20190416 Can schools be agile.md b/published/201907/20190416 Can schools be agile.md similarity index 100% rename from published/20190416 Can schools be agile.md rename to published/201907/20190416 Can schools be agile.md diff --git a/published/20190501 Looking into Linux modules.md b/published/201907/20190501 Looking into Linux modules.md similarity index 100% rename from published/20190501 Looking into Linux modules.md rename to published/201907/20190501 Looking into Linux modules.md diff --git a/published/20190505 Blockchain 2.0 - Public Vs Private Blockchain Comparison -Part 7.md b/published/201907/20190505 Blockchain 2.0 - Public Vs Private Blockchain Comparison -Part 7.md similarity index 100% rename from published/20190505 Blockchain 2.0 - Public Vs Private Blockchain Comparison -Part 7.md rename to published/201907/20190505 Blockchain 2.0 - Public Vs Private Blockchain Comparison -Part 7.md diff --git a/published/20190513 When to be concerned about memory levels on Linux.md b/published/201907/20190513 When to be concerned about memory levels on Linux.md similarity index 100% rename from published/20190513 When to be concerned about memory levels on Linux.md rename to published/201907/20190513 When to be concerned about memory levels on Linux.md diff --git a/published/201907/20190518 Best Linux Distributions for Beginners.md b/published/201907/20190518 Best Linux Distributions for Beginners.md new file mode 100644 index 0000000000..e4d374a273 --- /dev/null +++ b/published/201907/20190518 Best Linux Distributions for Beginners.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11145-1.html) +[#]: subject: (Best Linux Distributions for Beginners) +[#]: via: (https://itsfoss.com/best-linux-beginners/) +[#]: author: (Aquil Roshan https://itsfoss.com/author/aquil/) + +最适合于初学者的 Linux 发行版 +====== + +> 在本文中,我们将看到**最适合于初学者的 Linux 发行版**。这将有助于 Linux 新用户选择他们的第一个发行版。 + +让我们面对现实,[Linux][1] 可能会给新用户带来巨大的复杂性。但是,带来这种复杂性的并不是 Linux 本身。相反,是“新奇”因素导致了这种情况。并不是怀旧,但我记得第一次使用 Linux 时,我甚至不知道会发生什么。我喜欢它,但最初这对我来说像是逆流游泳一样。 + +不知道从何处着手可能是一个令人沮丧的原因,特别是对于那些在 PC 上运行 Windows 之外的其它系统没有概念的人来说。 + +Linux 不仅仅是一个操作系统,而是一个理念:在这里大家共同成长,也适合于每个人的不同需要。我们已经介绍过: + +* [Windows 用户的最佳 Linux 发行版][2] +* [最佳轻量级 Linux 发行版][3] +* [黑客攻击的最佳 Linux 发行版][4] +* [最佳 Linux 游戏发行版][5] +* [隐私和匿名的最佳 Linux 发行版][6] +* [看起来像 MacOS 的最佳 Linux 发行版][7] + +除此之外,还有一些能够特别满足新人需求的发行版。这里有一些这样的适合初学者的 Linux 发行版。你也可以在视频中观看并[订阅我们的 YouTube 频道][8]以获取更多与 Linux 相关的视频。 + +[视频](https://youtu.be/QC2B2-gCbbI) + +### 最适合于初学者的 Linux 发行版 + +请记住,此列表没有特别的顺序。编制此列表的主要标准是易于安装、开箱即用的硬件和软件、易用性和软件包的可用性。 + +#### 1、Ubuntu + +如果你在互联网上研究过 Linux,那么你很可能遇到过 Ubuntu。Ubuntu 是领先的 Linux 发行版之一,它也是开始 Linux 之旅的完美之选。 + +![][9] + +Ubuntu 被视为人性化的 Linux,这是因为 Ubuntu 在通用可用性上付出了很多努力。Ubuntu 并不要求你在技术方面懂得很多才能使用它。它打破了 “Linux = 命令行麻烦”这一概念。这是 Ubuntu 飙升到今天的主要优势之一。 + +Ubuntu 提供了非常方便的安装程序。这个安装程序以简单的英语(或你想要的任何主要语言)描述安装过程。你甚至可以在实际执行安装过程之前尝试使用 Ubuntu。安装程序提供了简单的选项: + +* 删除旧操作系统以安装 Ubuntu。 +* 与 Windows 或任何其他现有操作系统[一起][10]安装 Ubuntu(每次启动时都会提供要启动的操作系统的选择列表)。 +* 让高级用户自行配置分区。 + +*初学者提示:如果你不确定该怎么做,请选择第二个选项。* + +Ubuntu 的用户界面采用 GNOME。它简单、高效。你可以通过按 Windows 键搜索从应用程序到文件的任何内容。有什么比这更简单的吗? + +没有驱动程序安装问题,因为 Ubuntu 附带硬件检测器,可以检测、下载和安装适用于你的 PC 的最佳驱动程序。此外,安装会附带所有基本软件,如音乐播放器、视频播放器、办公套件和一些消磨时间的游戏。 + +Ubuntu 拥有出色的文档和社区支持。[Ubuntu 论坛][11]和 [Ask Ubuntu][12] 几乎在 Ubuntu 的所有方面都提供了可观的高质量支持。你的一些问题很有可能已经得到了回答,这些答案是适合初学者的。 + +请在[官方网站][13]查看并下载 [Ubuntu][13]。 + +#### 2、Linux Mint Cinnamon + +多年来,Linux Mint 一直是 [Distrowatch][14] 上的**排名第一的** Linux 发行版。我必须说,这是当之无愧的宝座。Linux Mint 是我个人的最爱之一。它优雅、秀气,提供了卓越的计算体验(开箱即用)。 + +![][15] + +Linux Mint 带有 Cinnamon 桌面环境。仍处于熟悉 Linux 软件阶段的 Linux 新用户会发现 Cinnamon 非常有用。所有软件都按类别分组,非常易于访问。虽然这不是一个令人兴奋的功能,但对于不了解 Linux 软件名称的新用户来说,这是一个巨大的好处。 + +Linux Mint 很快,在旧电脑上也运行良好。Linux Mint 建立在坚如磐石的 Ubuntu 基础之上。它使用与 Ubuntu 相同的软件存储库。而对于 Ubuntu 软件存储库,仅在广泛测试后 Ubuntu 才会将软件推送在其中。这意味着用户不必处理某些新软件容易出现的意外崩溃和故障,对于新的 Linux 用户来说这可能是一个真正不可接受的。 + +![][17] + +Windows 7 爱好者如果没有真的升级到微软 Windows 10 的话,那将会发现 Linux Mint 的可爱。 Linux Mint 桌面非常类似于 Windows 7 桌面。类似的工具栏、类似的菜单、类似的托盘图标都绝对会使 Windows 用户感到十分熟悉。 + +就个人而言,我更倾向于向 Linux 世界的新人推荐 Linux Mint,因为 Linux Mint 确实给用户留下了足够的印象,会让他们接受它。对我来说,Linux Mint 应该是面向初学者的 Linux 列表中的首位。 + +请在这里查看 [Linux Mint][18],看看 Cinnamon 版。 + +#### 3、Zorin OS + +大多数计算机用户是 Windows 用户。当 [Windows 用户拿到一个 Linux][2] 时,他必须经历相当多的“去知识过程”。大量的操作已经固定在我们的肌肉记忆当中。例如,每次要启动应用程序时,鼠标都会移动屏幕的左下角(“开始”菜单)。因此,如果我们能够在 Linux 上找到一些可以缓解这些问题的东西,那就成功了一半了。进入 Zorin OS。 + +![][19] + +Zorin OS 是一款基于 Ubuntu 的高度打磨的 Linux 发行版,完全是为 Windows 难民制作的。尽管几乎每个 Linux 发行版都可供任何人使用,但是当桌面看起来太陌生时,有些人可能会不情愿使用。Zorin OS 避开了这个障碍,因为它与 Windows 外观明显相似。 + +对 Linux 新手来说,软件包管理器是一个新概念。这就是为什么 Zorin OS 带有一个巨大的(我的意思是真的很大)预安装软件列表。你需要的任何东西,很有可能都已经安装在 Zorin OS 上了。好像这还不够,[Wine 和 PlayOnLinux][20] 也预先安装好了,所以你也可以在这里运行你喜爱的 Windows 软件和[游戏][21]。 + +![][22] + +Zorin OS 配备了一款名为 “Zorin look changer” 的惊人的主题引擎。它提供了一些重要的自定义选项和预设,可以使你的操作系统看起来像 Windows 7、XP、2000 甚至是 Mac,你会有宾至如归的感觉。 + +![][23] + +正是这些功能使 Zorin OS 成为**适合初学者的最佳 Linux 发行版**。查看 [Zorin OS 网站][24]以了解更多信息和下载该操作系统。 + +#### 4、Elementary OS + +我们已经看过了给 Windows 用户准备的 Linux 发行版,让我们为 MacOS 用户也提供一些东西。Elementary OS 成名非常迅速,现在总是被列入顶级发行列表之中,这一切都归功于其美学本质。其灵感来自于 MacOS,Elementary OS 是最美丽的 Linux 发行版之一。 + +![][25] + +Elementary OS 是又一个基于 Ubuntu 的操作系统,这意味着操作系统本身无疑是稳定的。Elementary OS 带有 Pantheon 桌面环境。你马上就会注意到它与 MacOS 桌面的相似之处。这对于转换到 Linux 的 MacOS 用户来说是一个优势,因为他们会对桌面非常适应,这确实简化了应对此变化的过程。 + +![][26] + +它的菜单简单,可根据用户喜好自定义。该操作系统是零侵入性的,因此你可以真正专注于工作。它附带了非常少量的预安装软件。因此,新用户都不会被庞杂的内容吓跑。但是,嘿,它具备开箱即用所需要的一切。如果需要更多软件,Elementary OS 提供了一个整洁的 AppCenter。它易于访问且简单易用,一切都在一个地方,你可以一键获得所需的所有软件和升级。 + +经验表明,[Elementary OS][28] 真的是一个很棒的软件。绝对值得[试一试][28]。 + +#### 5、Linux Mint Mate + +许多来了解 Linux 的人都希望让旧电脑焕发新生。随着 Windows 10 的普及,几年前许多具有不错配置的计算机已经变得无力应对。在谷歌上快速搜索一下会建议你在这样的电脑上安装 Linux。通过这种方式,你可以让它们在之后一段时间仍旧能保持水准。如果你正在寻找可以运行在旧计算机上的操作系统,Linux Mint Mate 是一个很棒的 Linux 发行版。 + +![][29] + +Linux Mint Mate 非常轻便,资源利用效率高,而仍然是一个漂亮的发行版。它可以在计算能力较弱的计算机上平稳运行。桌面环境没有各种花哨的东西。但它在功能上和任何其他桌面环境相比毫不逊色。这个操作系统是非侵入式的,允许你获得高效的计算体验而不会妨碍你。 + +同样,Linux Mint Mate 基于 Ubuntu,具有巨大而坚实的 Ubuntu 软件存储库的优势。它预装了最少数量的必需软件。提供了简便的驱动程序安装和设置管理。 + +即使你只有 512 MB 的内存和 9 GB 的硬盘空间(当然是越多越好),你也可以运行 Linux Mint Mate。 + +Mate 桌面环境非常简单易用,没有什么费解的地方。对于 Linux 初学者来说,这确实是一个巨大的优势,更有理由 [尝试 Linux Mint Mate][30]。 + +#### 6、Manjaro Linux + +好吧。任何一个 Linux 的老用户都会说,即使只是在大方向上,引导新手接触 Arch Linux 都是一种罪过。但是听我说。 + +Arch 被认为是专家级 Linux,因为它的安装过程非常复杂。Manajro 和 Arch Linux 有着共同的起源,但它们在其他方面存在很大差异。 + +![][31] + +Manajro Linux 具有非常适合初学者的安装程序。许多事情都是自动化的,比如使用“硬件检测”进行驱动程序安装。Manjaro 极大地解决了困扰许多其它 Linux 发行版的硬件驱动程序的麻烦。即使你遇到任何问题,Manjaro 也有很棒的社区支持。 + +Manjaro 拥有自己的软件存储库,其维护了最新的软件。虽然优先向用户提供最新软件,但它是以保证稳定性不会受到损害为前提的。这是 Arch 和 Manjaro 之间的主要区别之一。Manjaro 延迟软件包的发布以确保它们绝对稳定并且不会导致回退。你还可以访问 Manjaro 上的 Arch User Repository(AUR),因此你可以随时获得所需的一切。 + +如果你想了解更多有关 Manjaro 功能的信息,请阅读我的同事 [John 的 Manjaro Linux 经历以及为什么他会被它迷住][32]。 + +![][33] + +Manjaro Linux 有 XFCE、KDE、Gnome、Cinnamon 以及更多桌面环境,请查看[官方网站][34]。 + +要安装上述 6 个操作系统中的任何一个,你需要创建一个可启动的 U 盘。如果你当前正在使用 Windows [请使用本指南][35]。Mac OS 用户可以[遵循本指南][36]。 + +### 你选择哪个最适合初学者的 Linux 发行版? + +Linux 可能会有学习曲线,但这是一件不会让每个人都感到后悔的事情。进一步获得一个 ISO 文件并体验一下 Linux 吧。如果你已经是 Linux 用户,请分享这篇文章,并帮助人们在这个爱的季节爱上 Linux 吧。加油! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-linux-beginners/ + +作者:[Aquil Roshan][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/aquil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/what-is-linux +[2]: https://itsfoss.com/windows-like-linux-distributions/ +[3]: https://itsfoss.com/lightweight-linux-beginners/ +[4]: https://itsfoss.com/linux-hacking-penetration-testing/ +[5]: https://itsfoss.com/linux-gaming-distributions/ +[6]: https://itsfoss.com/privacy-focused-linux-distributions/ +[7]: https://itsfoss.com/macos-like-linux-distros/ +[8]: https://www.youtube.com/c/itsfoss +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/06/ubuntu-18-04-desktop.jpeg?resize=800%2C450&ssl=1 +[10]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ +[11]: https://ubuntuforums.org/ +[12]: http://askubuntu.com/ +[13]: https://www.ubuntu.com/ +[14]: https://distrowatch.com/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/LM_Home.jpg?ssl=1 +[16]: https://itsfoss.com/install-visual-studio-code-ubuntu/ +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/LM_SS.jpg?ssl=1 +[18]: https://linuxmint.com/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/Zorin.jpg?ssl=1 +[20]: https://itsfoss.com/use-windows-applications-linux/ +[21]: https://itsfoss.com/linux-gaming-guide/ +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/Zorin-office.jpg?ssl=1 +[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/OSX.jpg?ssl=1 +[24]: https://zorinos.com/ +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/02/Pantheon-Desktop.jpg?resize=800%2C500&ssl=1 +[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/Application-Menu.jpg?ssl=1 +[27]: https://itsfoss.com/slack-use-linux/ +[28]: https://elementary.io/ +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/mate.jpg?ssl=1 +[30]: http://blog.linuxmint.com/?p=3182 +[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/manajro.jpg?ssl=1 +[32]: https://itsfoss.com/why-use-manjaro-linux/ +[33]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/manjaro-kde.jpg?ssl=1 +[34]: https://manjaro.org/ +[35]: https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows +[36]: https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-macos diff --git a/published/201907/20190522 Convert Markdown files to word processor docs using pandoc.md b/published/201907/20190522 Convert Markdown files to word processor docs using pandoc.md new file mode 100644 index 0000000000..381510d7a7 --- /dev/null +++ b/published/201907/20190522 Convert Markdown files to word processor docs using pandoc.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11160-1.html) +[#]: subject: (Convert Markdown files to word processor docs using pandoc) +[#]: via: (https://opensource.com/article/19/5/convert-markdown-to-word-pandoc) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt/users/jason-van-gumster/users/kikofernandez) + +使用 pandoc 将 Markdown 转换为格式化文档 +====== + +> 生活在普通文本世界么?以下是无需使用文字处理器而创建别人要的格式化文档的方法。 + +![][1] + +如果你生活在[普通文本][2]世界里,总会有人要求你提供格式化文档。我就经常遇到这个问题,特别是在 Day JobTM。虽然我已经给与我合作的开发团队之一介绍了用于撰写和审阅发行说明的 [Docs Like Code][3] 工作流程,但是还有少数人对 GitHub 和使用 [Markdown][4] 没有兴趣,他们更喜欢为特定的专有应用格式化的文档。 + +好消息是,你不会被卡在将未格式化的文本复制粘贴到文字处理器的问题当中。使用 [pandoc][5],你可以快速地给人们他们想要的东西。让我们看看如何使用 pandoc 将文档从 Markdown 转换为 Linux 中的文字处理器格式。 + +请注意,pandoc 也可用于从两种 BSD([NetBSD][7] 和 [FreeBSD][8])到 Chrome OS、MacOS 和 Windows 等的各种操作系统。 + +### 基本转换 + +首先,在你的计算机上[安装 pandoc][9]。然后,打开控制台终端窗口,并导航到包含要转换的文件的目录。 + +输入此命令以创建 ODT 文件(可以使用 [LibreOffice Writer][10] 或 [AbiWord][11] 等字处理器打开): + +``` +pandoc -t odt filename.md -o filename.odt +``` + +记得用实际文件名称替换 `filename`。如果你需要为其他文字处理器(你知道我的意思)创建一个文件,替换命令行的 `odt` 为 `docx`。以下是本文转换为 ODT 文件时的内容: + +![Basic conversion results with pandoc.][12] + +这些转换结果虽然可用,但有点乏味。让我们看看如何为转换后的文档添加更多样式。 + +### 带样式转换 + +`pandoc` 有一个漂亮的功能,使你可以在将带标记的纯文本文件转换为字处理器格式时指定样式模板。在此文件中,你可以编辑文档中的少量样式,包括控制段落、文章标题和副标题、段落标题、说明、基本的表格和超链接的样式。 + +让我们来看看能做什么。 + +#### 创建模板 + +要设置文档样式,你不能只是使用任何一个模板就行。你需要生成 pandoc 称之为引用模板的文件,这是将文本文件转换为文字处理器文档时使用的模板。要创建此文件,请在终端窗口中键入以下内容: + +``` +pandoc -o custom-reference.odt --print-default-data-file reference.odt +``` + +此命令创建一个名为 `custom-reference.odt` 的文件。如果你正在使用其他文字处理程序,请将命令行中的 “odt” 更改为 “docx”。 + +在 LibreOffice Writer 中打开模板文件,然后按 `F11` 打开 LibreOffice Writer 的 “样式” 窗格。虽然 [pandoc 手册][13]建议不要对该文件进行其他更改,但我会在必要时更改页面大小并添加页眉和页脚。 + +#### 使用模板 + +那么,你要如何使用刚刚创建的模板?有两种方法可以做到这一点。 + +最简单的方法是将模板放在家目录的 `.pandoc` 文件夹中,如果该文件夹不存在,则必须先创建该文件夹。当转换文档时,`pandoc` 会使用此模板文件。如果你需要多个模板,请参阅下一节了解如何从多个模板中进行选择。 + +使用模板的另一种方法是在命令行键入以下转换选项: + +``` +pandoc -t odt file-name.md --reference-doc=path-to-your-file/reference.odt -o file-name.odt +``` + +如果你想知道使用自定义模板转换后的文件是什么样的,这是一个示例: + +![A document converted using a pandoc style template.][14] + +#### 选择模板 + +很多人只需要一个 `pandoc` 模板,但是,有些人需要不止一个。 + +例如,在我的日常工作中,我使用了几个模板:一个带有 DRAFT 水印,一个带有表示内部使用的水印,另一个用于文档的最终版本。每种类型的文档都需要不同的模板。 + +如果你有类似的需求,可以像使用单个模板一样创建文件 `custom-reference.odt`,将生成的文件重命名为例如 `custom-reference-draft.odt` 这样的名字,然后在 LibreOffice Writer 中打开它并修改样式。对你需要的每个模板重复此过程。 + +接下来,将文件复制到家目录中。如果你愿意,你甚至可以将它们放在 `.pandoc` 文件夹中。 + +要在转换时选择特定模板,你需要在终端中运行此命令: + +``` +pandoc -t odt file-name.md --reference-doc=path-to-your-file/custom-template.odt -o file-name.odt +``` + +改变 `custom-template.odt` 为你的模板文件名。 + +### 结语 + +为了不用记住我不经常使用的一组选项,我拼凑了一些简单的、非常蹩脚的单行脚本,这些脚本封装了每个模板的选项。例如,我运行脚本 `todraft.sh` 以使用带有 DRAFT 水印的模板创建文字处理器文档。你可能也想要这样做。 + +以下是使用包含 DRAFT 水印的模板的脚本示例: + +``` +pandoc -t odt $1.md -o $1.odt --reference-doc=~/Documents/pandoc-templates/custom-reference-draft.odt +``` + +使用 pandoc 是一种不必放弃命令行生活而以人们要求的格式提供文档的好方法。此工具也不仅适用于 Markdown。我在本文中讨论的内容还可以让你在各种标记语言之间创建和转换文档。有关更多详细信息,请参阅前面链接的 [pandoc 官网][5]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc + +作者:[Scott Nesbitt][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/scottnesbitt/users/jason-van-gumster/users/kikofernandez +[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 +[2]: https://plaintextproject.online/ +[3]: https://www.docslikecode.com/ +[4]: https://en.wikipedia.org/wiki/Markdown +[5]: https://pandoc.org/ +[6]: /resources/linux +[7]: https://www.netbsd.org/ +[8]: https://www.freebsd.org/ +[9]: https://pandoc.org/installing.html +[10]: https://www.libreoffice.org/discover/writer/ +[11]: https://www.abisource.com/ +[12]: https://opensource.com/sites/default/files/uploads/pandoc-wp-basic-conversion_600_0.png (Basic conversion results with pandoc.) +[13]: https://pandoc.org/MANUAL.html +[14]: https://opensource.com/sites/default/files/uploads/pandoc-wp-conversion-with-tpl_600.png (A document converted using a pandoc style template.) diff --git a/published/20190531 Use Firefox Send with ffsend in Fedora.md b/published/201907/20190531 Use Firefox Send with ffsend in Fedora.md similarity index 100% rename from published/20190531 Use Firefox Send with ffsend in Fedora.md rename to published/201907/20190531 Use Firefox Send with ffsend in Fedora.md diff --git a/published/20190603 How to set up virtual environments for Python on MacOS.md b/published/201907/20190603 How to set up virtual environments for Python on MacOS.md similarity index 100% rename from published/20190603 How to set up virtual environments for Python on MacOS.md rename to published/201907/20190603 How to set up virtual environments for Python on MacOS.md diff --git a/published/20190604 5G will augment Wi-Fi, not replace it.md b/published/201907/20190604 5G will augment Wi-Fi, not replace it.md similarity index 100% rename from published/20190604 5G will augment Wi-Fi, not replace it.md rename to published/201907/20190604 5G will augment Wi-Fi, not replace it.md diff --git a/published/20190606 Zorin OS Becomes Even More Awesome With Zorin 15 Release.md b/published/201907/20190606 Zorin OS Becomes Even More Awesome With Zorin 15 Release.md similarity index 100% rename from published/20190606 Zorin OS Becomes Even More Awesome With Zorin 15 Release.md rename to published/201907/20190606 Zorin OS Becomes Even More Awesome With Zorin 15 Release.md diff --git a/published/20190607 4 tools to help you drive Kubernetes.md b/published/201907/20190607 4 tools to help you drive Kubernetes.md similarity index 100% rename from published/20190607 4 tools to help you drive Kubernetes.md rename to published/201907/20190607 4 tools to help you drive Kubernetes.md diff --git a/published/20190607 Free and Open Source Trello Alternative OpenProject 9 Released.md b/published/201907/20190607 Free and Open Source Trello Alternative OpenProject 9 Released.md similarity index 100% rename from published/20190607 Free and Open Source Trello Alternative OpenProject 9 Released.md rename to published/201907/20190607 Free and Open Source Trello Alternative OpenProject 9 Released.md diff --git a/published/20190609 How to set ulimit and file descriptors limit on Linux Servers.md b/published/201907/20190609 How to set ulimit and file descriptors limit on Linux Servers.md similarity index 100% rename from published/20190609 How to set ulimit and file descriptors limit on Linux Servers.md rename to published/201907/20190609 How to set ulimit and file descriptors limit on Linux Servers.md diff --git a/published/20190610 5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu.md b/published/201907/20190610 5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu.md similarity index 100% rename from published/20190610 5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu.md rename to published/201907/20190610 5 Easy Ways To Free Up Space (Remove Unwanted or Junk Files) on Ubuntu.md diff --git a/published/20190612 BitTorrent Client Deluge 2.0 Released- Here-s What-s New.md b/published/201907/20190612 BitTorrent Client Deluge 2.0 Released- Here-s What-s New.md similarity index 100% rename from published/20190612 BitTorrent Client Deluge 2.0 Released- Here-s What-s New.md rename to published/201907/20190612 BitTorrent Client Deluge 2.0 Released- Here-s What-s New.md diff --git a/published/20190613 IPython is still the heart of Jupyter Notebooks for Python developers.md b/published/201907/20190613 IPython is still the heart of Jupyter Notebooks for Python developers.md similarity index 100% rename from published/20190613 IPython is still the heart of Jupyter Notebooks for Python developers.md rename to published/201907/20190613 IPython is still the heart of Jupyter Notebooks for Python developers.md diff --git a/published/201907/20190617 Use ImageGlass to quickly view JPG images as a slideshow.md b/published/201907/20190617 Use ImageGlass to quickly view JPG images as a slideshow.md new file mode 100644 index 0000000000..8d60619efc --- /dev/null +++ b/published/201907/20190617 Use ImageGlass to quickly view JPG images as a slideshow.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11141-1.html) +[#]: subject: (Use ImageGlass to quickly view JPG images as a slideshow) +[#]: via: (https://opensource.com/article/19/6/use-imageglass-view-jpg-images-slideshow-windows-10) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +使用 ImageGlass 以幻灯片形式快速查看 JPG 图像 +====== + +> 想要在 Windows 10 中以幻灯片形式逐个查看文件夹中的图像么?开源软件可以做到。 + +![Looking back with binoculars][1] + +欢迎阅读今天的系列文章 “我该如何让它实现?”就我而言,我试图在 Windows 10 上以幻灯片形式查看 JPG 图像的文件夹。像往常一样,我转向开源来解决这个问题。 + +在 Mac 上,以幻灯片形式查看 JPG 图像文件夹只需选择文件夹中的所有图像(`Command-A`),然后按 `Option-Command-Y` 即可。之后,你可以使用箭头键向前翻动。当然,在 Windows 中,你可以通过选择第一个图像,然后单击窗口中黄色的**管理**栏,然后选择**幻灯片**来执行类似的操作。在那里,你可以控制速度,但只能做到:慢、中、快。 + +我希望像在 Windows 中能像 Mac 一样翻下一张图片。自然地,我 Google 搜索了一下并找到了一个方案。我发现了 [ImageGlass][2] 这个开源应用,其许可证是 [GPL 3.0][3],并且它完美地做到了。这是它的样子: + +![Viewing an image in ImageGlass.][4] + +### 关于 ImageGlass + +ImageGlass 是由 Dương Diệu Pháp 开发的,根据他的网站,他是一名越南开发人员,在 Chainstack 负责前端。他与在美国的 [Kevin Routley][5] 协作,后者“为 ImageGlass 开发新功能”。源代码可以在 [GitHub][6] 上找到。 + +ImageGlass 支持最常见的图像格式,包括 JPG、GIF、PNG、WEBP、SVG 和 RAW。用户可以轻松自定义扩展名列表。 + +我遇到的具体问题是需要找到一张用于目录封面的图像。不幸的是,它在一个包含数十张照片的文件夹中。在 ImageGlass 中以幻灯片浏览照片,在我想要的照片前停止,并将其下载到我的项目文件夹中变得很容易。开源再次帮助了我,该应用只花了很短的时间下载和使用。 + +在 2016 年 3 月 10 日,Jason Baker 在他的文章 [9 款 Picasa 的开源替代品][7] 中将 ImageGlass 列为其中之一。如果你有需求,里面还有一些其他有趣的图像相关工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/use-imageglass-view-jpg-images-slideshow-windows-10 + +作者:[Jeff Macharyas][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/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/look-binoculars-sight-see-review.png?itok=NOw2cm39 (Looking back with binoculars) +[2]: https://imageglass.org/ +[3]: https://github.com/d2phap/ImageGlass/blob/master/LICENSE +[4]: https://opensource.com/sites/default/files/uploads/imageglass-screenshot.png (Viewing an image in ImageGlass.) +[5]: https://github.com/fire-eggs +[6]: https://github.com/d2phap/ImageGlass +[7]: https://opensource.com/alternatives/picasa diff --git a/published/20190618 A beginner-s guide to Linux permissions.md b/published/201907/20190618 A beginner-s guide to Linux permissions.md similarity index 100% rename from published/20190618 A beginner-s guide to Linux permissions.md rename to published/201907/20190618 A beginner-s guide to Linux permissions.md diff --git a/published/20190619 Leading in the Python community.md b/published/201907/20190619 Leading in the Python community.md similarity index 100% rename from published/20190619 Leading in the Python community.md rename to published/201907/20190619 Leading in the Python community.md diff --git a/published/20190621 Three Ways to Lock and Unlock User Account in Linux.md b/published/201907/20190621 Three Ways to Lock and Unlock User Account in Linux.md similarity index 100% rename from published/20190621 Three Ways to Lock and Unlock User Account in Linux.md rename to published/201907/20190621 Three Ways to Lock and Unlock User Account in Linux.md diff --git a/published/20190624 With Upgraded Specs, Raspberry Pi 4 Takes Aim at Desktop Segment.md b/published/201907/20190624 With Upgraded Specs, Raspberry Pi 4 Takes Aim at Desktop Segment.md similarity index 100% rename from published/20190624 With Upgraded Specs, Raspberry Pi 4 Takes Aim at Desktop Segment.md rename to published/201907/20190624 With Upgraded Specs, Raspberry Pi 4 Takes Aim at Desktop Segment.md diff --git a/published/20190625 5 tiny Linux distros to try before you die.md b/published/201907/20190625 5 tiny Linux distros to try before you die.md similarity index 100% rename from published/20190625 5 tiny Linux distros to try before you die.md rename to published/201907/20190625 5 tiny Linux distros to try before you die.md diff --git a/published/20190625 The innovation delusion.md b/published/201907/20190625 The innovation delusion.md similarity index 100% rename from published/20190625 The innovation delusion.md rename to published/201907/20190625 The innovation delusion.md diff --git a/published/20190626 Tracking down library injections on Linux.md b/published/201907/20190626 Tracking down library injections on Linux.md similarity index 100% rename from published/20190626 Tracking down library injections on Linux.md rename to published/201907/20190626 Tracking down library injections on Linux.md diff --git a/published/20190627 How to use Tig to browse Git logs.md b/published/201907/20190627 How to use Tig to browse Git logs.md similarity index 100% rename from published/20190627 How to use Tig to browse Git logs.md rename to published/201907/20190627 How to use Tig to browse Git logs.md diff --git a/published/20190628 Undo releases Live Recorder 5.0 for Linux debugging.md b/published/201907/20190628 Undo releases Live Recorder 5.0 for Linux debugging.md similarity index 100% rename from published/20190628 Undo releases Live Recorder 5.0 for Linux debugging.md rename to published/201907/20190628 Undo releases Live Recorder 5.0 for Linux debugging.md diff --git a/published/20190630 Donald Trump Now Wants to Ban End-to-End Encryption.md b/published/201907/20190630 Donald Trump Now Wants to Ban End-to-End Encryption.md similarity index 100% rename from published/20190630 Donald Trump Now Wants to Ban End-to-End Encryption.md rename to published/201907/20190630 Donald Trump Now Wants to Ban End-to-End Encryption.md diff --git a/published/20190701 Ubuntu or Fedora- Which One Should You Use and Why.md b/published/201907/20190701 Ubuntu or Fedora- Which One Should You Use and Why.md similarity index 100% rename from published/20190701 Ubuntu or Fedora- Which One Should You Use and Why.md rename to published/201907/20190701 Ubuntu or Fedora- Which One Should You Use and Why.md diff --git a/published/20190702 Jupyter and data science in Fedora.md b/published/201907/20190702 Jupyter and data science in Fedora.md similarity index 100% rename from published/20190702 Jupyter and data science in Fedora.md rename to published/201907/20190702 Jupyter and data science in Fedora.md diff --git a/published/20190702 Make Linux stronger with firewalls.md b/published/201907/20190702 Make Linux stronger with firewalls.md similarity index 100% rename from published/20190702 Make Linux stronger with firewalls.md rename to published/201907/20190702 Make Linux stronger with firewalls.md diff --git a/translated/tech/20190703 How to Manually Install Security Updates on Debian-Ubuntu.md b/published/201907/20190703 How to Manually Install Security Updates on Debian-Ubuntu.md similarity index 91% rename from translated/tech/20190703 How to Manually Install Security Updates on Debian-Ubuntu.md rename to published/201907/20190703 How to Manually Install Security Updates on Debian-Ubuntu.md index 4e76fd235f..600598ce4c 100644 --- a/translated/tech/20190703 How to Manually Install Security Updates on Debian-Ubuntu.md +++ b/published/201907/20190703 How to Manually Install Security Updates on Debian-Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11132-1.html) [#]: subject: (How to Manually Install Security Updates on Debian/Ubuntu?) [#]: via: (https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) @@ -10,13 +10,11 @@ 如何在 Debian/Ubuntu 上手动安装安全更新? ====== -在 Linux 上通过命令行安装一个包程序是一件简单的事。 - -在一行命令中组合使用多个命令能让你更加简单地完成任务。 +在 Linux 上通过命令行安装一个包程序是一件简单的事。在一行命令中组合使用多个命令能让你更加简单地完成任务。 安全更新也同样如此。 -在这个教程里面,我们会向你展示如何查看可用的安全更新,以及如何在 Ubuntu,LinuxMint 等等这些基于 Debian 的系统中安装它们。 +在这个教程里面,我们会向你展示如何查看可用的安全更新,以及如何在 Ubuntu、LinuxMint 等等这些基于 Debian 的系统中安装它们。 有三种方法可以完成这件事,下面会详细地描述这三种方法。 @@ -24,25 +22,23 @@ 如果你因为一些应用的依赖问题不能解决,导致不能给所有的系统进行全部更新。那至少,你应该打上安全补丁来让你的系统 100% 符合要求。 -### 如何在 Debian/Ubuntu 上安装 unattended-upgrades? - -默认情况下,你的系统上应该是已经安装了 unattended-upgrades 包的。但是如果你的系统没有装这个包,那么请使用下面的命令来安装它。 - -使用 **[APT-GET 命令][1]** 或者 **[APT 命令][2]** 来安装 unattended-upgrades 包. - -``` -$ sudo apt-get install unattended-upgrades -or -$ sudo apt install unattended-upgrades -``` - ### 方法一:如何检查 Debian/Ubuntu 中是否有任何可用的安全更新? 在进行补丁安装之前,检查可用安全更新列表始终是一个好习惯。它会为你提供将在你的系统中进行更新的软件包的列表。 +默认情况下,你的系统上应该是已经安装了 `unattended-upgrades` 包的。但是如果你的系统没有装这个包,那么请使用下面的命令来安装它。 + +使用 [APT-GET 命令][1] 或者 [APT 命令][2] 来安装 `unattended-upgrades` 包。 + +``` +$ sudo apt-get install unattended-upgrades +或 +$ sudo apt install unattended-upgrades +``` + **什么是试运行?** 大多数的 Linux 命令都有一个试运行选项,它会给出实际的输出但不会下载或安装任何东西。 -为此,你需要在 unattended-upgrades 命令中添加 --dry-run 选项。 +为此,你需要在 `unattended-upgrades` 命令中添加 `--dry-run` 选项。 ``` $ sudo unattended-upgrade --dry-run -d @@ -101,9 +97,9 @@ vim-tiny xxd ``` -如果在终端里,上面的命令输出说 **“No packages found that can be upgraded unattended and no pending auto-removals”** , 这意味着你的系统已经是最新的了。 +如果在终端里,上面的命令输出说 “No packages found that can be upgraded unattended and no pending auto-removals”,这意味着你的系统已经是最新的了。 -### 如何在 Debian/Ubuntu 中安装可用的安全更新? +#### 如何在 Debian/Ubuntu 中安装可用的安全更新? 如果你在上面的命令输出中获得了任意的软件包更新,就运行下面的命令来安装它们。 @@ -111,7 +107,7 @@ xxd $ sudo unattended-upgrade -d ``` -除此之外,你也可以使用 apt-get 命令来进行安装。但是这个方法有点棘手,我会建议用户用第一个选项。 +除此之外,你也可以使用 `apt-get` 命令来进行安装。但是这个方法有点棘手,我会建议用户用第一个选项。 ### 方法二:如何使用 apt-get 命令在 Debian/Ubuntu 中检查是否有可用的安全更新? @@ -160,7 +156,7 @@ Inst gcc [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, U Inst g++ [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64]) ``` -### 如何使用 apt-get 命令在 Debian/Ubuntu 系统中安装可用的安全更新? +#### 如何使用 apt-get 命令在 Debian/Ubuntu 系统中安装可用的安全更新? 如果你在上面命令的输出中发现任何的软件包更新。就运行下面的命令来安装它们。 @@ -168,7 +164,7 @@ Inst g++ [4:7.3.0-3ubuntu2.1] (4:7.4.0-1ubuntu2.3 Ubuntu:18.04/bionic-updates, U $ sudo apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs apt-get install ``` -除此之外,也可以使用 apt 命令来完成。但是这个方法有点棘手,我会建议用户用第一个选项。 +除此之外,也可以使用 `apt` 命令来完成。但是这个方法有点棘手,我会建议用户用第一个方式。 ### 方法三:如何使用 apt 命令在 Debian/Ubuntu 系统中检查是否有可用的安全更新? @@ -217,7 +213,7 @@ vim-tiny/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 [upgradable xxd/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 [upgradable from: 2:8.0.1453-1ubuntu1] ``` -### 如何在 Debian/Ubuntu 系统中使用 apt 命令来安装可用的安全更新? +#### 如何在 Debian/Ubuntu 系统中使用 apt 命令来安装可用的安全更新? 如果你在上面命令的输出中发现任何的软件包更新。就运行下面的命令来安装它们。 @@ -241,7 +237,7 @@ via: https://www.2daygeek.com/manually-install-security-updates-ubuntu-debian/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201907/20190703 Parse arguments with Python.md b/published/201907/20190703 Parse arguments with Python.md new file mode 100644 index 0000000000..f4f240a4ae --- /dev/null +++ b/published/201907/20190703 Parse arguments with Python.md @@ -0,0 +1,191 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11144-1.html) +[#]: subject: (Parse arguments with Python) +[#]: via: (https://opensource.com/article/19/7/parse-arguments-python) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/notsag) + +使用 Python 解析参数 +====== + +> 使用 argparse 模块像专业人士一样解析参数。 + +![](https://img.linux.net.cn/data/attachment/album/201907/24/210351h99gzcttqmk7c7mx.jpg) + +如果你在使用 [Python][2] 进行开发,你可能会在终端中使用命令,即使只是为了启动 Python 脚本或使用 [pip][3] 安装 Python 模块。命令可能简单而单一: + +``` +$ ls +``` + +命令也可能需要参数: + +``` +$ ls example +``` + +命令也可以有选项或标志: + +``` +$ ls --color example +``` + +有时选项也有参数: + +``` +$ sudo firewall-cmd  --list-all --zone home +``` + +### 参数 + +POSIX shell 会自动将你输入的内容作为命令分成数组。例如,这是一个简单的命令: + +``` +$ ls example +``` + +命令 `ls` 的位置是 `$0`,参数 `example` 位置是 `$1`。 + +你**可以**写一个循环迭代每项。确定它是否是命令、选项还是参数。并据此采取行动。幸运的是,已经有一个名为 [argparse][4] 的模块。 + +### argparse + +argparse 模块很容易集成到 Python 程序中,并有多种便利功能。例如,如果你的用户更改选项的顺序或使用一个不带参数的选项(称为**布尔**,意味着选项可以打开或关闭设置),然后另一个需要参数(例如 `--color red`),argparse 可以处理多种情况。如果你的用户忘记了所需的选项,那么 argparse 模块可以提供友好的错误消息。 + +要在应用中使用 argparse,首先要定义为用户提供的选项。你可以接受几种不同的参数,而语法一致又简单。 + +这是一个简单的例子: + +``` +#!/usr/bin/env python +import argparse +import sys + +def getOptions(args=sys.argv[1:]): +    parser = argparse.ArgumentParser(description="Parses command.") +    parser.add_argument("-i", "--input", help="Your input file.") +    parser.add_argument("-o", "--output", help="Your destination output file.") +    parser.add_argument("-n", "--number", type=int, help="A number.") +    parser.add_argument("-v", "--verbose",dest='verbose',action='store_true', help="Verbose mode.") +    options = parser.parse_args(args) +    return options +``` + +此示例代码创建一个名为 `getOptions` 的函数,并告诉 Python 查看每个可能的参数,前面有一些可识别的字符串(例如 `--input` 或者 `-i`)。 Python 找到的任何选项都将作为 `options` 对象从函数中返回(`options` 是一个任意名称,且没有特殊含义。它只是一个包含函数已解析的所有参数的摘要的数据对象)。 + +默认情况下,Python 将用户给出的任何参数视为字符串。如果需要提取整数(数字),则必须指定选项 `type=int`,如示例代码中的 `--number` 选项。 + +如果你有一个只是关闭和打开功能的参数,那么你必须使用 `boolean` 类型,就像示例代码中的 `--verbose` 标志一样。这种选项只保存 `True` 或 `False`,用户用来指定是否使用标志。如果使用该选项,那么会激活 `stored_true`。 + +当 `getOptions` 函数运行时,你就可以使用 `options` 对象的内容,并让程序根据用户调用命令的方式做出决定。你可以使用测试打印语句查看 `options` 的内容。将其添加到示例文件的底部: + +``` +print(getOptions()) +``` + +然后带上参数运行代码: + +``` +$ python3 ./example.py -i foo -n 4 +Namespace(input='foo', number=4, output=None, verbose=False) +``` + +### 检索值 + +示例代码中的 `options` 对象包含了用户提供的选项后面的值(或派生的布尔值)。例如,在示例代码中,可以通过 `options.number` 来检索 `--number`。 + +``` +options = getOptions(sys.argv[1:]) + +if options.verbose: +    print("Verbose mode on") +else: +    print("Verbose mode off") + +print(options.input) +print(options.output) +print(options.number) + +# 这里插入你的 Python 代码 +``` + +示例中的布尔选项 `--verbose` 是通过测试 `options.verbose` 是否为 `True`(意味着用户使用了 `--verbose` 标志)或 `False`(用户没有使用 `--verbose` 标志),并采取相应的措施。 + +### 帮助和反馈 + +argparse 还包含一个内置的 `--help`(简写 `-h`)选项,它提供了有关如何使用命令的提示。这是从你的代码派生的,因此生成此帮助系统不需要额外的工作: + +``` +$ ./example.py --help +usage: example.py [-h] [-i INPUT] [-o OUTPUT] [-n NUMBER] [-v] + +Parses command. + +optional arguments: +  -h, --help            show this help message and exit +  -i INPUT, --input INPUT +                        Your input file. +  -o OUTPUT, --output OUTPUT +                        Your destination output file. +  -n NUMBER, --number NUMBER +                        A number. +  -v, --verbose         Verbose mode. +``` + +### 像专业人士一样用 Python 解析 + +这是一个简单的示例,来演示如何在 Python 应用中的解析参数以及如何快速有效地记录它的语法。下次编写 Python 脚本时,请使用 argparse 为其提供一些选项。你以后会感到自得,你的命令不会像一个快速的临时脚本,更像是一个“真正的” Unix 命令! + +以下是可用于测试的示例代码: + +``` +#!/usr/bin/env python3 +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import argparse +import sys + +def getOptions(args=sys.argv[1:]): +    parser = argparse.ArgumentParser(description="Parses command.") +    parser.add_argument("-i", "--input", help="Your input file.") +    parser.add_argument("-o", "--output", help="Your destination output file.") +    parser.add_argument("-n", "--number", type=int, help="A number.") +    parser.add_argument("-v", "--verbose",dest='verbose',action='store_true', help="Verbose mode.") +    options = parser.parse_args(args) +    return options + +options = getOptions(sys.argv[1:]) + +if options.verbose: +    print("Verbose mode on") +else: +    print("Verbose mode off") + +print(options.input) +print(options.output) +print(options.number) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/parse-arguments-python + +作者:[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/users/notsag +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cobol-card-punch-programming-code.png?itok=6W6PUqUi (COBOL punch card) +[2]: https://www.python.org/ +[3]: https://pip.pypa.io/en/stable/installing/ +[4]: https://pypi.org/project/argparse/ diff --git a/published/201907/20190705 Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux.md b/published/201907/20190705 Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux.md new file mode 100644 index 0000000000..8f06f3a6a9 --- /dev/null +++ b/published/201907/20190705 Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11171-1.html) +[#]: subject: (Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux) +[#]: via: (https://www.2daygeek.com/linux-bash-script-to-monitor-messages-log-warning-error-critical-send-email/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 上用 Bash 脚本监控 messages 日志 +====== + +目前市场上有许多开源监控工具可用于监控 Linux 系统的性能。当系统达到指定的阈值限制时,它将发送电子邮件警报。它可以监视 CPU 利用率、内存利用率、交换利用率、磁盘空间利用率等所有内容。 + +如果你只有很少的系统并且想要监视它们,那么编写一个小的 shell 脚本可以使你的任务变得非常简单。 + +在本教程中,我们添加了一个 shell 脚本来监视 Linux 系统上的 messages 日志。 + +我们过去添加了许多有用的 shell 脚本。如果要查看这些内容,请导航至以下链接。 + +- [如何使用 shell 脚本监控系统的日常活动?][1] + +此脚本将检查 `/var/log/messages` 文件中的 “warning“、“error” 和 “critical”,如果发现任何有关的东西,就给指定电子邮件地址发邮件。 + +如果服务器有许多匹配的字符串,我们就不能经常运行这个可能填满收件箱的脚本,我们可以在一天内运行一次。 + +为了解决这个问题,我让脚本以不同的方式触发电子邮件。 + +如果 `/var/log/messages` 文件中昨天的日志中找到任何给定字符串,则脚本将向给定的电子邮件地址发送电子邮件警报。 + +**注意:**你需要更改电子邮件地址,而不是我们的电子邮件地址。 + +``` +# vi /opt/scripts/os-log-alert.sh +``` + +``` +#!/bin/bash +#Set the variable which equal to zero +prev_count=0 + +count=$(grep -i "`date --date='yesterday' '+%b %e'`" /var/log/messages | egrep -wi 'warning|error|critical' | wc -l) + +if [ "$prev_count" -lt "$count" ] ; then + # Send a mail to given email id when errors found in log + SUBJECT="WARNING: Errors found in log on "`date --date='yesterday' '+%b %e'`"" + # This is a temp file, which is created to store the email message. + MESSAGE="/tmp/logs.txt" + TO="2daygeek@gmail.com" + echo "ATTENTION: Errors are found in /var/log/messages. Please Check with Linux admin." >> $MESSAGE + echo "Hostname: `hostname`" >> $MESSAGE + echo -e "\n" >> $MESSAGE + echo "+------------------------------------------------------------------------------------+" >> $MESSAGE + echo "Error messages in the log file as below" >> $MESSAGE + echo "+------------------------------------------------------------------------------------+" >> $MESSAGE + grep -i "`date --date='yesterday' '+%b %e'`" /var/log/messages | awk '{ $3=""; print}' | egrep -wi 'warning|error|critical' >> $MESSAGE + mail -s "$SUBJECT" "$TO" < $MESSAGE + #rm $MESSAGE +fi +``` + +为 `os-log-alert.sh` 文件设置可执行权限。 + +``` +$ chmod +x /opt/scripts/os-log-alert.sh +``` + +最后添加一个 cron 任务来自动执行此操作。它将每天 7 点钟运行。 + +``` +# crontab -e +``` + +``` +0 7 * * * /bin/bash /opt/scripts/os-log-alert.sh +``` + +**注意:**你将在每天 7 点收到昨天日志的电子邮件提醒。 + +**输出:**你将收到类似下面的电子邮件提醒。 + +``` +ATTENTION: Errors are found in /var/log/messages. Please Check with Linux admin. + ++-----------------------------------------------------+ +Error messages in the log file as below ++-----------------------------------------------------+ +Jul 3 02:40:11 ns1 kernel: php-fpm[3175]: segfault at 299 ip 000055dfe7cc7e25 sp 00007ffd799d7d38 error 4 in php-fpm[55dfe7a89000+3a7000] +Jul 3 02:50:14 ns1 kernel: lmtp[8249]: segfault at 20 ip 00007f9cc05295e4 sp 00007ffc57bca1a0 error 4 in libdovecot-storage.so.0.0.0[7f9cc04df000+148000] +Jul 3 15:36:09 ns1 kernel: php-fpm[17846]: segfault at 299 ip 000055dfe7cc7e25 sp 00007ffd799d7d38 error 4 in php-fpm[55dfe7a89000+3a7000] +Jul 3 15:45:54 ns1 pure-ftpd: (?@5.188.62.5) [WARNING] Authentication failed for user [daygeek] +Jul 3 16:25:36 ns1 pure-ftpd: (?@104.140.148.58) [WARNING] Sorry, cleartext sessions and weak ciphers are not accepted on this server.#012Please reconnect using TLS security mechanisms. +Jul 3 16:44:20 ns1 kernel: php-fpm[8979]: segfault at 299 ip 000055dfe7cc7e25 sp 00007ffd799d7d38 error 4 in php-fpm[55dfe7a89000+3a7000] +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-bash-script-to-monitor-messages-log-warning-error-critical-send-email/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/20190705 Copy and paste at the Linux command line with xclip.md b/published/201907/20190705 Copy and paste at the Linux command line with xclip.md similarity index 100% rename from published/20190705 Copy and paste at the Linux command line with xclip.md rename to published/201907/20190705 Copy and paste at the Linux command line with xclip.md diff --git a/published/20190705 Manage your shell environment.md b/published/201907/20190705 Manage your shell environment.md similarity index 100% rename from published/20190705 Manage your shell environment.md rename to published/201907/20190705 Manage your shell environment.md diff --git a/published/20190706 How To Delete A Repository And GPG Key In Ubuntu.md b/published/201907/20190706 How To Delete A Repository And GPG Key In Ubuntu.md similarity index 100% rename from published/20190706 How To Delete A Repository And GPG Key In Ubuntu.md rename to published/201907/20190706 How To Delete A Repository And GPG Key In Ubuntu.md diff --git a/published/201907/20190706 How to enable DNS-over-HTTPS (DoH) in Firefox.md b/published/201907/20190706 How to enable DNS-over-HTTPS (DoH) in Firefox.md new file mode 100644 index 0000000000..7a4e915b9e --- /dev/null +++ b/published/201907/20190706 How to enable DNS-over-HTTPS (DoH) in Firefox.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11163-1.html) +[#]: subject: (How to enable DNS-over-HTTPS (DoH) in Firefox) +[#]: via: (https://www.zdnet.com/article/how-to-enable-dns-over-https-doh-in-firefox/) +[#]: author: (Catalin Cimpanu https://www.zdnet.com/meet-the-team/us/catalin.cimpanu/) + +如何在 Firefox 中启用 DNS-over-HTTPS(DoH) +====== + +DNS-over-HTTPS(DoH)协议目前是谈论的焦点,Firefox 是唯一支持它的浏览器。但是,Firefox 默认不启用此功能,用户必须经历许多步骤并修改多个设置才能启动并运行 DoH。 + +在开始如何在 Firefox 中启用 DoH 支持的分步教程之前,让我们先描述它的原理。 + +### DNS-over-HTTPS 的工作原理 + +DNS-over-HTTPS 协议通过获取用户在浏览器中输入的域名,并向 DNS 服务器发送查询,以了解托管该站点的 Web 服务器的 IP 地址。 + +这也是正常 DNS 的工作原理。但是,DoH 通过 443 端口的加密 HTTPS 连接接受 DNS 查询将其发送到兼容 DoH 的 DNS 服务器(解析器),而不是在 53 端口上发送纯文本。这样,DoH 就会在常规 HTTPS 流量中隐藏 DNS 查询,因此第三方监听者将无法嗅探流量,并了解用户的 DNS 查询,从而推断他们将要访问的网站。 + +此外,DNS-over-HTTPS 的第二个特性是该协议工作在应用层。应用可以带上内部硬编码的 DoH 兼容的 DNS 解析器列表,从而向它们发送 DoH 查询。这种操作模式绕过了系统级别的默认 DNS 设置,在大多数情况下,这些设置是由本地 Internet 服务提供商(ISP)设置的。这也意味着支持 DoH 的应用可以有效地绕过本地 ISP 流量过滤器并访问可能被本地电信公司或当地政府阻止的内容 —— 这也是 DoH 目前被誉为用户隐私和安全的福音的原因。 + +这是 DoH 在推出后不到两年的时间里获得相当大的普及的原因之一,同时也是一群[英国 ISP 因为 Mozilla 计划支持 DoH 协议而提名它为 2019 年的“互联网恶棍” (Internet Villian)][1]的原因,ISP 认为 DoH 协议会阻碍他们过滤不良流量的努力。(LCTT 译注:后来这一奖项的提名被取消。) + +作为回应,并且由于英国政府阻止访问侵犯版权内容的复杂情况,以及 ISP 自愿阻止访问虐待儿童网站的情况,[Mozilla 已决定不为英国用户默认启用此功能][2]。 + +下面的分步指南将向英国和世界各地的 Firefox 用户展示如何立即启用该功能,而不用等到 Mozilla 将来启用它 —— 如果它会这么做的话。在 Firefox 中有两种启用 DoH 支持的方法。 + +### 方法 1:通过 Firefox 设置 + +**步骤 1:**进入 Firefox 菜单,选择**工具**,然后选择**首选项**。 可选在 URL 栏中输入 `about:preferences`,然后按下回车。这将打开 Firefox 的首选项。 + +**步骤 2:**在**常规**中,向下滚动到**网络设置**,然后按**设置**按钮。 + +![DoH section in Firefox settings][3] + +**步骤3:**在弹出窗口中,向下滚动并选择“**Enable DNS over HTTPS**”,然后配置你需要的 DoH 解析器。你可以使用内置的 Cloudflare 解析器(该公司与 Mozilla [达成协议][4],记录更少的 Firefox 用户数据),或者你可以在[这个列表][4]中选择一个。 + +![DoH section in Firefox settings][6] + +### 方法 2:通过 about:config + +**步骤 1:**在 URL 栏中输入 `about:config`,然后按回车访问 Firefox 的隐藏配置面板。在这里,用户需要启用和修改三个设置。 + +**步骤 2:**第一个设置是 `network.trr.mode`。这打开了 DoH 支持。此设置支持四个值: + +* `0` - 标准 Firefox 安装中的默认值(当前为 5,表示禁用 DoH) +* `1` - 启用 DoH,但 Firefox 依据哪个请求更快返回选择使用 DoH 或者常规 DNS +* `2` - 启用 DoH,常规 DNS 作为备用 +* `3` - 启用 DoH,并禁用常规 DNS +* `5` - 禁用 DoH + +值为 2 工作得最好 + +![DoH in Firefox][7] + +**步骤3:**需要修改的第二个设置是 `network.trr.uri`。这是与 DoH 兼容的 DNS 服务器的 URL,Firefox 将向它发送 DoH DNS 查询。默认情况下,Firefox 使用 Cloudflare 的 DoH服务,地址是:。但是,用户可以使用自己的 DoH 服务器 URL。他们可以从[这个列表][8]中选择其中一个可用的。Mozilla 在 Firefox 中使用 Cloudflare 的原因是因为与这家公司[达成了协议][4],之后 Cloudflare 将收集来自 Firefox 用户的 DoH 查询的非常少的数据。 + +[DoH in Firefox][9] + +**步骤4:**第三个设置是可选的,你可以跳过此设置。 但是如果设置不起作用,你可以使用此作为步骤 3 的备用。该选项名为 `network.trr.bootstrapAddress`,它是一个输入字段,用户可以输入步骤 3 中兼容 DoH 的 DNS 解析器的 IP 地址。对于 Cloudflare,它是 1.1.1.1。 对于 Google 服务,它是 8.8.8.8。 如果你使用了另一个 DoH 解析器的 URL,如果有必要的话,你需要追踪那台服务器的 IP 地址并输入。 + +![DoH in Firefox][10] + +通常,在步骤 3 中输入的 URL 应该足够了。 +设置应该立即生效,但如果它们不起作用,请重新启动 Firefox。 + +文章信息来源:[Mozilla Wiki][11] + + +-------------------------------------------------------------------------------- + +via: https://www.zdnet.com/article/how-to-enable-dns-over-https-doh-in-firefox/ + +作者:[Catalin Cimpanu][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.zdnet.com/meet-the-team/us/catalin.cimpanu/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11068-1.html +[2]: https://www.zdnet.com/article/mozilla-no-plans-to-enable-dns-over-https-by-default-in-the-uk/ +[3]: https://zdnet1.cbsistatic.com/hub/i/2019/07/07/df30c7b0-3a20-4de7-8640-3dea6d249a49/121bd379b6232e1e2a97c35ea8c7764e/doh-settings-1.png +[4]: https://developers.cloudflare.com/1.1.1.1/commitment-to-privacy/privacy-policy/firefox/ +[6]: https://zdnet3.cbsistatic.com/hub/i/2019/07/07/8608af28-2a28-4ff1-952b-9b6d2deb1ea6/b1fc322caaa2c955b1a2fb285daf0e42/doh-settings-2.png +[7]: https://zdnet1.cbsistatic.com/hub/i/2019/07/06/0232b3a7-82c6-4a6f-90c1-faf0c090254c/6db9b36509021c460fcc7fe825bb74c5/doh-1.png +[8]: https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers +[9]: https://zdnet2.cbsistatic.com/hub/i/2019/07/06/4dd1d5c1-6fa7-4f5b-b7cd-b544748edfed/baa7a70ac084861d94a744a57a3147ad/doh-2.png +[10]: https://zdnet1.cbsistatic.com/hub/i/2019/07/06/8ec20a28-673c-4a17-8195-16579398e90a/538fe8420f9b24724aeb4a6c8d4f0f0f/doh-3.png +[11]: https://wiki.mozilla.org/Trusted_Recursive_Resolver diff --git a/published/20190706 Say WHAAAT- Mozilla has Been Nominated for the -Internet Villain- Award in the UK.md b/published/201907/20190706 Say WHAAAT- Mozilla has Been Nominated for the -Internet Villain- Award in the UK.md similarity index 100% rename from published/20190706 Say WHAAAT- Mozilla has Been Nominated for the -Internet Villain- Award in the UK.md rename to published/201907/20190706 Say WHAAAT- Mozilla has Been Nominated for the -Internet Villain- Award in the UK.md diff --git a/translated/tech/20190708 10 ways to get started with Linux.md b/published/201907/20190708 10 ways to get started with Linux.md similarity index 50% rename from translated/tech/20190708 10 ways to get started with Linux.md rename to published/201907/20190708 10 ways to get started with Linux.md index 316157de65..49ba29a574 100644 --- a/translated/tech/20190708 10 ways to get started with Linux.md +++ b/published/201907/20190708 10 ways to get started with Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11124-1.html) [#]: subject: (10 ways to get started with Linux) [#]: via: (https://opensource.com/article/19/7/ways-get-started-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth/users/don-watkins) @@ -12,9 +12,9 @@ Linux 入门十法 > 想要进入 Linux 之门,试试这十个方法。 -![Penguins gathered together in the Artic][1] +![](https://img.linux.net.cn/data/attachment/album/201907/20/061809wwkmb51vqookoqq5.jpg) -文章《[什么是 Linux 用户?][2]》的作者 Anderson Silva 明确表示,现今人们使用 Linux(在某种程度上)就像使用 Windows 一样,只要你对“使用 Linux”这个事情定义得足够广泛。尽管如此,如果你的生活中没有足够的使用 Linux 的机会,现在正是以前所未有的方式尝试 Linux 的好时机。 +文章《[什么是 Linux 用户?][2]》的作者 Anderson Silva 明确表示,现今人们使用 Linux(在某种程度上)就像使用 Windows 一样,只要你对“使用 Linux”这个事情定义得足够广义。尽管如此,如果你的生活中没有太多的使用 Linux 的机会,现在正是以前所未有的方式尝试 Linux 的好时机。 以下是 Linux 入门的十种方法。你可以试试其中一个或者全部试试。 @@ -22,65 +22,65 @@ Linux 入门十法 ![Free shell screenshot][3] -有很多人在用不上的服务器上运行 Linux (请记住,“Linux 服务器”可以是从最新的超级计算机到丢弃的已经用了 12 年的笔记本电脑中的任何一个)。为了充分利用多余的计算机,许多管理员用这些备用的机器提供了免费的 shell 帐户。 +有很多人在用不上的服务器上运行 Linux (请记住,“Linux 服务器”可以是从最新的超级计算机到丢弃的、已经用了 12 年的笔记本电脑中的任何一个)。为了充分利用多余的计算机,许多管理员用这些备用的机器提供了免费的 shell 帐户。 -如果你想要登录到 Linux 终端中学习命令、shell 脚本、Python 以及 Web 开发的基础知识,那么免费的 shell 帐户是一种简单、免费的入门方式。这是一个简短的列表: +如果你想要登录到 Linux 终端中学习命令、shell 脚本、Python 以及 Web 开发的基础知识,那么免费的 shell 帐户是一种简单、免费的入门方式。下面是一个可以体验一下的简短列表: -* [Freeshell.de][4] 是一个自 2002 年以来一直在线的公用 Linux 系统。你可以通过 SSH、IPv6 和 OpenSSL 进行访问,以获得 Linux shell 体验,并且可以使用 MySQL 数据库。 -* [Blinkenshell][5] 提供了一个学习 Unix、使用 IRC、托管简单网站和共享文件的 Linux shell。它自 2006 年以来一直在线。 -* [SDF 公用 Unix 系统][6]成立于 1987 年,提供了免费的 NetBSD 账户。当然,NetBSD 不是 Linux,但它是开源的 Unix,因此它提供了类似的体验。它也有几个自制应用程序,因此它跨越了老派 BBS 和普通的免费 shell 之间的界限。 +* [Freeshell.de][4] 是一个自 2002 年以来一直在线服务的公用 Linux 系统。你可以通过 SSH、IPv6 和 OpenSSL 进行访问,以获得 Linux shell 体验,并且可以使用 MySQL 数据库。 +* [Blinkenshell][5] 提供了一个学习 Unix、使用 IRC、托管简单网站和共享文件的 Linux shell。它自 2006 年以来一直在线服务。 +* [SDF 公用 Unix 系统][6]成立于 1987 年,提供了免费的 NetBSD 账户。当然,NetBSD 不是 Linux,但它是开源的 Unix,因此它提供了类似的体验。它也有几个自制应用程序,因此它不但有普通的免费 shell,还提供了老派 BBS。 -免费 shell 帐户受到很多滥用,因此你表现出的信任度和参与集体活动的意愿越多,你的体验就越好。你通常可以访问数据库引擎、编译器和高级编程语言(通过特殊请求或小额捐赠来证明声誉)。你还可以要求安装其他软件或库,但需经管理员批准。 +免费 shell 帐户常会受到滥用,因此你表现出的可信程度和积极参与协作的意愿越多,你的体验就越好。你可以通过专门请求或小额捐赠来证明你的诚意,通常可以访问数据库引擎、编译器和高级编程语言。你还可以要求安装其他软件或库,但需经管理员批准。 #### 如何使用 -公用 shell 帐户是尝试真正的 Linux 系统的好方法。你无法获得 root 权限这一事实意味着你可学习本地软件管理,而无需做更多的维护工作。你可以做很多实际操作,以完成真正的工作,尽管它们对于学习关键任务还不够。 +公用 shell 帐户是尝试真正的 Linux 系统的好方法。你无法获得 root 权限这一事实意味着你可以学习本地软件管理,而无需做更多的维护工作。你可以做很多实际操作,以完成真正的工作,尽管它们对于学习关键任务还不够。 ### 2、试试 Windows WSL 2 里面的 Linux -不管你信不信,微软从 2019 年 6 月开始在 Windows 里面带上了 Linux,这意味着你可以从 Windows 运行 Linux 应用程序,这是第二代的 [Windows 里的 Linux 子系统][7](WSL 2)。虽然它主要针对开发人员,但 Windows 用户会发现 WSL 2 是一个熟悉的桌面上的 Linux 环境,而没有被任何虚拟化占用额外资源。这是一个以进程方式运行在 Windows 机器上的 Linux。在这个时候,它仍然是一个新的动向和正在进行中的工作,因此它可能会发生变化。如果你试图用它承担重任,你可能会遇到一两个错误,但是如果你只是想入门 Linux、学习一些命令,并感受在基于文本的环境如何完成工作,那么 WSL 2 可能正是你所需要的。 +不管你信不信,微软从 2019 年 6 月开始在 Windows 里面带上了 Linux,这意味着你可以从 Windows 运行 Linux 应用程序,这是 [Windows 里的 Linux 子系统][7]的第二版(WSL 2)。虽然它主要针对开发人员,但 Windows 用户可以发现 WSL 2 是一个来自于他们熟悉的桌面上的 Linux 环境,而没有被任何虚拟化占用额外资源。这是一个以进程方式运行在 Windows 机器上的 Linux。现阶段,它仍然是一个新的动向和正在进行中的工作,因此它可能会发生变化。如果你试图用它承担重任,你可能会遇到一两个错误,但是如果你只是想入门 Linux、学习一些命令,并感受在基于文本的环境如何完成工作,那么 WSL 2 可能正是你所需要的。 #### 如何使用 -WSL 还没有明确的方向或目的,但它在 Windows 机器上提供了 Linux 环境。你可以获得 root 访问权限,并可以运行 Linux 发行版和应用程序,因此这是一种简单而无缝的学习方式。但是,即使 WSL *是Linux*,它也不能给你典型的 Linux 体验。它是由 Windows 提供的 Linux,而这不太会是你在现实世界中遇到的。WSL 是一个开发和教育工具,但如果你可以使用它,那么你应该试试它。 +WSL 还没有明确的用途或目的,但它在 Windows 机器上提供了 Linux 环境。你可以获得 root 访问权限,并可以运行 Linux 发行版和应用程序,因此这是一种简单而无缝的学习方式。但是,即使 WSL *是Linux*,它也不能给你典型的 Linux 体验。它是由 Windows 提供的 Linux,而这不太会是你在现实世界中遇到的情况。WSL 是一个开发和教育工具,但如果你可以使用它,那么你应该试试它。 ### 3、把 Linux 放到可启动的 U 盘上 ![Porteus Linux][8] -便携 Linux 可以安装到 U 盘上随身携带,并用该 U 盘启动你遇到的任何计算机。你可以获得个性化的 Linux 桌面,而无需担心所启动的主机上的数据。计算机不会接触你的 Linux 操作系统,并且你的 Linux 操作系统也不会影响计算机。它非常适合酒店商务中心、图书馆、学校的公共计算机,或者只是给自己一个不时启动 Linux 的借口。 +便携 Linux 可以安装到 U 盘上随身携带,并用该 U 盘启动你遇到的任何计算机。你可以获得个性化的 Linux 桌面,而无需担心所用于启动的主机上的数据。该计算机上原有的系统不会与你的 Linux 系统相接触,并且你的 Linux 操作系统也不会影响计算机。它非常适合酒店商务中心、图书馆、学校的公共计算机,或者只是给自己一个不时启动 Linux 的借口。 -与许多其他快速取得的 Linux shell 不同,此方法为你提供了一个完整而强大的 Linux 系统,包括桌面环境,可访问你需要的任何软件以及持久的数据存储。 +与许多其他快速获得的 Linux shell 不同,此方法为你提供了一个完整而强大的 Linux 系统,包括桌面环境,可访问你需要的任何软件以及持久的数据存储。 这个系统永远不会改变。你要保存的任何数据都将写入压缩的文件系统中,然后在引导时将其作为覆盖层应用于该系统。这种灵活性允许你选择是以持久模式启动,将所有数据保存回 U 盘;还是以临时模式启动,以便一旦关闭电源,你所做的一切都会消失。换句话说,你可以将其用作不受信任的计算机上的安全信息亭或你信任的计算机上的便携式操作系统。 -你可以尝试很多 [U 盘发行版][9],有些桌面环境很少,适用于低功耗计算机,有些适用于完整桌面环境。我偏爱 [Porteus][10] Linux。在过去的八年里,我每天都把它放在我的钥匙链上,在商务旅行中使用它作为我的主要计算平台,如果在工作或家中计算机发生问题,它也会用作工具盘。它是一个可靠而稳定的操作系统,有趣且易于使用。 +你可以尝试很多 [U 盘发行版][9],有些带有精简的桌面环境,适用于低功耗计算机,而另一些带有完整的桌面环境。我偏爱 [Porteus][10] Linux。在过去的八年里,我每天都把它放在我的钥匙链上,在商务旅行中使用它作为我的主要计算平台,如果在工作场所或家中计算机发生问题,它也会用作工具盘。它是一个可靠而稳定的操作系统,有趣且易于使用。 在 Mac 或 Windows 上,下载 [Fedora Media Writer][11] 以创建你下载的任何便携式发行版的可启动 U 盘。 #### 如何使用 -从 U 盘启动一个“实时 Linux”可提供完整的 Linux 发行版。虽然数据存储与你安装到硬盘驱动器的系统略有不同,但其他所有内容都与你在 Linux 桌面上所期望的一样。在便携式 Linux 操作系统上你几乎没有什么不能做的,所以在你的钥匙串上安装一个以解锁你遇到的每台计算机的全部潜力吧。 +从 U 盘启动一个 “实时 Linux” 可提供完整的 Linux 发行版环境。虽然数据存储与你安装到硬盘驱动器的系统略有不同,但其它的所有内容都与你在 Linux 桌面上所期望的一样。在便携式 Linux 操作系统上你几乎没有什么不能做的,所以在你的钥匙串上挂上一个以解锁你遇到的每台计算机的全部潜力吧。 -### 4、在线导览 +### 4、在线游览 ![Linux tour screenshot][12] -Ubuntu 的某个人想到了在浏览器中托管 Ubuntu GNOME 桌面的好主意。想要自己尝试一下,可以打开 Web 浏览器并导航到 [tour.ubuntu.com][13]。你可以选择要演示的活动,也可以跳过单个课程并单击 “四处看看” 按钮。 +Ubuntu 的某个人想到了在浏览器中托管 Ubuntu GNOME 桌面的好主意。如果想要自己尝试一下,可以打开 Web 浏览器并导航到 [tour.ubuntu.com][13]。你可以选择要演示的活动,也可以跳过单个课程并单击 “四处看看Show Yourself Around” 按钮。 -即使你是 Linux 桌面的新用户,你也可能会发现“四处看看”功能比你想象的更还简单。在线游览中,您可以四处看看,查看可用的应用程序,以及查看典型的默认 Linux 桌面。你不能在 Firefox 中调整设置或启动另一个在线导览(这是我尝试的第一件事),虽然你可以完成安装应用程序的动作,但你无法启动它们。 但是,如果你之前从未使用过 Linux 桌面,并且想要看到各种新奇的东西,那这就是一场旋风之旅。 +即使你是 Linux 桌面的新用户,你也可能会发现“四处看看”功能比你想象的更还简单。在线游览中,你可以四处看看,查看可用的应用程序,以及查看典型的默认 Linux 桌面。你不能在 Firefox 中调整设置或启动另一个在线游览(这是我尝试过的第一件事),虽然你可以完成安装应用程序的动作,但你无法启动它们。但是,如果你之前从未使用过 Linux 桌面,并且想要看到各种新奇的东西,那这就是一场旋风之旅。 #### 如何使用 -在线导览真的只是一次旅行。如果你从未见过 Linux 桌面,那么这是一个了解它的情况的机会。不是为了正式的使用,而是一个吸引过客的展示。 +在线游览真的只是一次旅行。如果你从未见过 Linux 桌面,那么这是一个了解它的情况的机会。这不是一个正式的使用,而是一个吸引过客的展示。 ### 5、在浏览器中用 JavaScript 运行 Linux ![JSLinux][14] -就在不久之前,虚拟化的计算成本还很高,这仅限于使用高级硬件的用户。而现在虚拟化已被优化到可以由 JavaScript 引擎执行的程度,这要归功于 Fabrice Bellard,它是优秀的开源 [QEMU][15] 机器仿真器和虚拟器的创建者。 +就在不久之前,虚拟化的计算成本还很高,还仅限于使用先进的硬件的用户。而现在虚拟化已被优化到可以由 JavaScript 引擎执行的程度,这要归功于 Fabrice Bellard,它是优秀的开源 [QEMU][15] 机器仿真器和虚拟器的创建者。 -Bellard 还启动了 JSLinux 项目,该项目允许你在浏览器中运行 Linux 和其他操作系统,算是闲暇时间的一个乐趣。它仍然是一个实验项目,但它是一个技术奇迹。打开 Web 浏览器导航到 [JSLinux][16] 页面,你可以启动基于文本的 Linux shell 或极简的图形 Linux 环境。你可以上传和下载文件到 JSLinux 主机上或(在理论上)将文件发送到一个网络备份位置,因为 JSLinux 可以通过 VPN 套接字访问互联网(尽管上限速度取决于 VPN 服务)。 +Bellard 还启动了 JSLinux 项目,该项目允许你在浏览器中运行 Linux 和其他操作系统,这算是闲暇时间的一个乐趣。它仍然是一个实验性项目,但它是一个技术奇迹。打开 Web 浏览器导航到 [JSLinux][16] 页面,你可以启动基于文本的 Linux shell 或精简的图形 Linux 环境。你可以上传和下载文件到 JSLinux 主机上或(在理论上可以)将文件发送到一个网络备份位置,因为 JSLinux 可以通过 VPN 套接字访问互联网(尽管上限速度取决于 VPN 服务)。 #### 如何使用 @@ -88,7 +88,7 @@ Bellard 还启动了 JSLinux 项目,该项目允许你在浏览器中运行 Li ### 6、阅读关于它的书 -并非每种 Linux 体验都要用计算机。也许你是那种喜欢在开始新事物之前保持距离,先观察和研究的人,或者你可能还不清楚 “Linux” 所包含的内容,或者你喜欢全情投入其中。关于 Linux 如何工作、运行 Linux 的方式以及 Linux 世界中有什么,有很多书可以读。 +并非每种 Linux 体验都要用到计算机。也许你是那种喜欢在开始新事物之前保持距离先观察和研究的人,或者你可能还不清楚 “Linux” 所包含的内容,或者你喜欢全情投入其中。关于 Linux 如何工作、运行 Linux 的方式以及 Linux 世界中有什么,有很多书可以读。 你越熟悉开源世界,就越容易理解常用术语,将城市神话与实际经验区分开来。我们不时会发布[图书清单] [17],但我的最爱之一是 Hazel Russman 的《[The Charm of Linux][18]》。这是一个从不同角度巡览 Linux 的过程,是由一位独立作者在发现 Linux 时兴奋之余写作的。 @@ -100,41 +100,41 @@ Bellard 还启动了 JSLinux 项目,该项目允许你在浏览器中运行 Li ![Raspberry Pi 4][19] -如果你正在使用[树莓派][20],那么你就正在运行 Linux。Linux 和低功耗计算很容易上手。关于树莓派的好处,除了价格低于 100 美元之外,它的[网站][21]是专为教育而设计的。你可以了解树莓派所做的一切,当你了解之后,就知道了 Linux 可以为你做些什么。 +如果你正在使用[树莓派][20],那么你就正在运行 Linux。Linux 和低功耗计算很容易上手。关于树莓派的好处,除了价格低于 100 美元之外,它的[网站][21]是专为教育而设计的。你可以了解树莓派所能做的一切,当你了解之后,就知道了 Linux 可以为你做些什么。 #### 如何使用 -树莓派被设计为低功耗计算机。这意味着你不能像过去那样做那么多的多任务处理,但这是一种避免不堪重负的方便方法。树莓派是学习 Linux 及其附带的所有可能性的好方法,它是发现环保、小型、简化计算能力的有趣方式。并且一定要关注 Opensource.com 上的[提示][22]和[技巧][23]和[有趣的][24][活动] [25],特别是在每年三月份的树莓派之周期间。 +树莓派被设计为低功耗计算机。这意味着你不能像过去那样做那么多的多任务处理,但这是一种避免不堪重负的方便方法。树莓派是学习 Linux 及其附带的所有可能性的好方法,它是发现环保、小型、简化计算能力的有趣方式。并且一定要关注 Opensource.com 上的[提示][22]、[技巧][23]和[有趣的][24][活动] [25],特别是在每年三月份的树莓派之周的期间。 ### 8、赶上容器热潮 -如果你在神话般的[云][26]的后端附近工作,那么你已经听说过容器热潮。虽然你可以在 Windows、Azure、Mac 和 Linux 上运行 Docker 和 Kubernetes,但你可能不知道容器本身就是 Linux。云计算应用和基础设施实际上是精简的 Linux 系统,部分虚拟化,部分基于裸机。如果启动容器,则会启动微型的超特定的 Linux 发行版。 +如果你从事于神话般的[云服务][26]的后端工作,那么你已经听说过容器热潮。虽然你可以在 Windows、Azure、Mac 和 Linux 上运行 Docker 和 Kubernetes,但你可能不知道容器本身就是 Linux。云计算应用和基础设施实际上是精简的 Linux 系统,部分虚拟化,部分基于裸机。如果启动容器,则会启动微型的超特定的 Linux 发行版。 容器与虚拟机或物理服务器[不同][27]。它们不打算用作通用操作系统。但是,如果你在容器中进行开发,你可以停下来四处打量一下,你将了解到 Linux 系统的结构、保存重要文件的位置以及最常见的命令。你甚至可以[在线尝试容器][28],你可以在我的文章中[深入到 Linux 容器的背后][29]了解它们如何工作的。 #### 如何使用 -根据设计,容器特定于单个任务,但它们是 Linux,因此它们非常灵活。你可以如你预期的使用它们,也可以在你的 Linux 实验当中将容器构建到大部分完整系统中。它虽然不是桌面 Linux 体验,但它是完整的 Linux 体验。 +根据设计,容器特定于一个单一任务,但它们是 Linux,因此它们非常灵活。你可以如你预期的使用它们,也可以在你的 Linux 实验当中将容器构建到大部分完整系统中。它虽然不提供桌面 Linux 体验,但它是完整的 Linux 体验。 ### 9、以虚拟机方式安装 Linux -虚拟化是尝试操作系统的简便方法,[VirtualBox][30]是一种很好的开源虚拟化方法。VirtualBox 可以在 Windows 和 Mac 上运行,因此你可以将 Linux 安装为虚拟机(VM)并使用它,就好像它只是一个应用程序一样。如果你不习惯安装操作系统,VirtualBox 也是一种尝试 Linux 的非常安全的方式,而不会意外地将其安装在你通常的操作系统上。 +虚拟化是尝试操作系统的简便方法,[VirtualBox][30] 是一种很好的开源虚拟化方法。VirtualBox 可以在 Windows 和 Mac 上运行,因此你可以将 Linux 安装为虚拟机(VM)并使用它,就好像它只是一个应用程序一样。如果你不习惯安装操作系统,VirtualBox 也是一种尝试 Linux 的非常安全的方式,而不会意外地将其安装覆盖在你通常的操作系统上。 #### 如何使用 -将 Linux 作为虚拟机运行既方便又简单,既可以作为试运行使用,也可以在需要 Linux 环境时进行双启动或重启。它功能齐全,因为它使用虚拟硬件,主机操作系统负责驱动你的外围设备。将 Linux 作为虚拟机运行的唯一缺点主要是心理上的。如果你打算使用 Linux 作为主操作系统,但最终默认在宿主操作系统做除了特定于 Linux 的大多数任务,那么虚拟机就会让你失望。否则,虚拟机是现代技术的胜利,在 VirtualBox 中使用 Linux 可以为你提供 Linux 所提供的所有最佳功能。 +将 Linux 作为虚拟机运行既方便又简单,既可以作为试运行使用,也可以在需要 Linux 环境时进行双启动或重启进入。它功能齐全,因为它使用虚拟硬件,宿主操作系统负责驱动你的外围设备。将 Linux 作为虚拟机运行的唯一缺点主要是心理上的。如果你打算使用 Linux 作为主要操作系统,但最终默认在宿主操作系统上做除了特定于 Linux 的大多数任务,那么虚拟机就会让你失望。否则,虚拟机是现代技术的胜利,在 VirtualBox 中使用 Linux 可以为你提供 Linux 所提供的所有最佳功能。 ### 10、安装一个 Linux ![Fedora Silverblue][31] -如果对上述方式有疑问,那么总会有传统的方式。如果你想给予 Linux 应有的关注,你可以下载 Linux,将安装程序刻录到 U 盘(或 DVD,如果你更喜欢光学介质的话),并将其安装在你的计算机上。Linux 是开源的,所以任何想要花时间打包 Linux 的人都可以分发 Linux,并且可以将所有可用的部分分配到通常称为发行版的内容中。询问任何 Linux 用户哪个发行版是“最好的”,你必然会得到一个不同的答案(主要是因为术语“最佳”通常是未定义的)。大多数人都认可你应该使用适合你的 Linux 发行版,这意味着你应该测试一些流行的发行版,并坚持使你的计算机按照你期望的行为行事。这是一种务实和功能性的方法。例如,如果发行版无法识别你的网络摄像头而你希望它可以正常工作,则可以使用一个可识别该网络摄像头的发行版。 +如果对上述方式有疑问,那么总会有传统的方式。如果你想给予 Linux 应有的关注,你可以下载 Linux,将安装程序刻录到 U 盘(或 DVD,如果你更喜欢光学介质的话),并将其安装在你的计算机上。Linux 是开源的,所以任何想要花时间打包 Linux 的人都可以分发 Linux,并且可以将所有可用的部分分配到通常称为发行版的内容中。无论问哪一个 Linux 用户什么发行版是“最好的”,你必然都会得到一个不同的答案(主要是因为这个术语“最佳”通常是尚未定义的)。大多数人都认可:你应该使用适合你的 Linux 发行版,这意味着你应该测试一些流行的发行版,并坚持使你的计算机按照你期望的行为行事。这是一种务实和功能性的方法。例如,如果发行版无法识别你的网络摄像头而你希望它可以正常工作,则可以使用一个可识别该网络摄像头的发行版。 -如果你之前从未安装过操作系统,你会发现大多数 Linux 发行版都包含友好且简单的安装程序。只需下载一个发行版(它们作为 ISO 文件提供),然后下载 [Fedora Media Writer][11] 来创建一个可启动的安装 U 盘。 +如果你之前从未安装过操作系统,你会发现大多数 Linux 发行版都包含一个友好且简单的安装程序。只需下载一个发行版(它们以 ISO 文件提供),然后下载 [Fedora Media Writer][11] 来创建一个可启动的安装 U 盘。 #### 如何使用 -安装 Linux 并将其用作操作系统是迈向熟悉和熟悉它的一步。怎么使用它都可以。你可能会发现你从未了解过所需的必备功能,你可能会比你想象的更多地了解计算机,并且可能会改变你的世界观。或者你可以使用 Linux 桌面,因为它易于下载和安装,或者因为你想要削减某些公司霸主的中间人,或者因为它可以帮助你完成工作。 +安装 Linux 并将其用作操作系统是迈向熟悉它的一步。怎么使用它都可以。你可能会发现一些你从未了解过的所需的必备功能,你可能会比你想象的更多地了解计算机,并且可能会改变你的世界观。你使用一个 Linux 桌面,或者是因为它易于下载和安装,或者是因为你想要削弱公司中某些人的霸主地位,或者只是因为它可以帮助你完成工作。 无论你的原因是什么,只需尝试使用上面这些任何(或所有)这些方式。 @@ -145,7 +145,7 @@ via: https://opensource.com/article/19/7/ways-get-started-linux 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20190708 Command line quick tips- Permissions.md b/published/201907/20190708 Command line quick tips- Permissions.md similarity index 52% rename from translated/tech/20190708 Command line quick tips- Permissions.md rename to published/201907/20190708 Command line quick tips- Permissions.md index 20bc371fed..028916247a 100644 --- a/translated/tech/20190708 Command line quick tips- Permissions.md +++ b/published/201907/20190708 Command line quick tips- Permissions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11123-1.html) [#]: subject: (Command line quick tips: Permissions) [#]: via: (https://fedoramagazine.org/command-line-quick-tips-permissions/) [#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) @@ -12,37 +12,34 @@ ![][1] -Fedora 与所有基于 Linux 的系统一样,它提供了一组强大的安全特性。其中一个基本特性是文件和文件夹上的 _权限_。这些权限保护文件和文件夹免受未经授权的访问。本文将简要介绍这些权限,并向你展示如何使用它们共享对文件夹的访问。 +Fedora 与所有基于 Linux 的系统一样,它提供了一组强大的安全特性。其中一个基本特性是文件和文件夹上的*权限*。这些权限保护文件和文件夹免受未经授权的访问。本文将简要介绍这些权限,并向你展示如何使用它们共享对文件夹的访问。 ### 权限基础 -Fedora 本质上是一个多用户操作系统,它也有 _组_,用户可以是其成员。但是,想象一下一个没有权限概念的多用户系统,不同的登录用户可以随意阅读彼此的内容。你可以想象到这对隐私或安全性并不是很好。 +Fedora 本质上是一个多用户操作系统,它也有*组*,用户可以是其成员。但是,想象一下一个没有权限概念的多用户系统,不同的登录用户可以随意阅读彼此的内容。你可以想象到这对隐私或安全性并不是很好。 -Fedora 上的任何文件或文件夹都分配了三组权限。第一组用于拥有文件或文件夹的 _用户_,第二组用于拥有它的 _组_,第三组用于其他人,即不是该文件的用户或拥有该文件的组中的用户。有时这被称为 _world_。(to 校正:这个 world 没理解) +Fedora 上的任何文件或文件夹都分配了三组权限。第一组用于拥有文件或文件夹的*用户*,第二组用于拥有它的*组*,第三组用于其他人,即既不是该文件的用户也不是拥有该文件的组中的用户。有时这被称为*全世界*。 ### 权限意味着什么 -每组权限都有三种形式:_读_,_写_ 和 _执行_。其中每个都可以用首字母来代替,即 _r_、_w_、_x_。 +每组权限都有三种形式:*读*、*写*和*执行*。其中每个都可以用首字母来代替,即 `r`、`w`、`x`。 #### 文件权限 -对于 _文件_,权限的含义如下所示: +对于*文件*,权限的含义如下所示: - * 读(r):可以读取文件内容 + * 读(`r`):可以读取文件内容 + * 写(`w`):可以更改文件内容 + * 执行(`x`):可以执行文件 —— 这主要用于打算直接运行的程序或脚本 - * 写(w):可以更改文件内容 - - * 执行(x):可以执行文件 -- 这主要用于打算直接运行的程序或脚本 - - -当你对任何文件进行详细信息列表查看时,可以看到这三组权限。尝试查看系统上的 _/etc/services_ 文件: +当你对任何文件进行详细信息列表查看时,可以看到这三组权限。尝试查看系统上的 `/etc/services` 文件: ``` $ ls -l /etc/services -rw-r--r--. 1 root root 692241 Apr 9 03:47 /etc/services ``` -注意列表左侧的权限组。如上所述,这些表明三种用户的权限:拥有该文件的用户,拥有该文件的组以及其他人。用户所有者是 _root_,组所有者是 _root_ 组。用户所有者具有对文件的读写权限,_root_ 组中的任何人都只能读取该文件。最后,其他任何人也只能读取该文件。(最左边的破折号显示这是一个常规文件。) +注意列表左侧的权限组。如上所述,这些表明三种用户的权限:拥有该文件的用户,拥有该文件的组以及其他人。用户所有者是 `root`,组所有者是 `root` 组。用户所有者具有对文件的读写权限,`root` 组中的任何人都只能读取该文件。最后,其他任何人也只能读取该文件。(最左边的 `-` 显示这是一个常规文件。) 顺便说一下,你通常会在许多(但不是所有)系统配置文件上发现这组权限,它们只由系统管理员而不是普通用户更改。通常,普通用户需要读取其内容。 @@ -50,19 +47,18 @@ $ ls -l /etc/services 对于文件夹,权限的含义略有不同: - * 读(r):可以读取文件夹内容(例如 _ls_ 命令) - * 写(w):可以更改文件夹内容(可以在此文件夹中创建或删除文件) - * 执行(x):可以搜索文件夹,但无法读取其内容。(这听起来可能很奇怪,但解释起来需要更复杂的文件系统细节,这超出了本文的范围,所以现在就这样吧。) + * 读(`r`):可以读取文件夹内容(例如 `ls` 命令) + * 写(`w`):可以更改文件夹内容(可以在此文件夹中创建或删除文件) + * 执行(`x`):可以搜索文件夹,但无法读取其内容。(这听起来可能很奇怪,但解释起来需要更复杂的文件系统细节,这超出了本文的范围,所以现在就这样吧。) - -看一下 _/etc/grub.d_ 文件夹的例子: +看一下 `/etc/grub.d` 文件夹的例子: ``` $ ls -ld /etc/grub.d drwx------. 2 root root 4096 May 23 16:28 /etc/grub.d ``` -注意最左边的 _d_,它显示这是一个目录或文件夹。权限显示用户所有者(_root_)可以读取、更改和 _cd_ 到此文件夹中。但是,没有其他人可以这样做 - 无论他们是否是 _root_ 组的成员。注意,你不能 _cd_ 进入该文件夹。 +注意最左边的 `d`,它显示这是一个目录或文件夹。权限显示用户所有者(`root`)可以读取、更改和 `cd` 到此文件夹中。但是,没有其他人可以这样做 —— 无论他们是否是 `root` 组的成员。注意,你不能 `cd` 进入该文件夹。 ``` $ cd /etc/grub.d @@ -80,9 +76,9 @@ drwx------. 221 paul paul 28672 Jul 3 14:03 /home/paul ### 创建共享文件夹 -你可以利用此权限功能轻松创建一个文件夹以在组内共享。假设你有一个名为 _finance_ 的小组,其中有几个成员需要共享文档。因为这些是用户文档,所以将它们存储在 _/home_ 文件夹层次结构中是个好主意。 +你可以利用此权限功能轻松创建一个文件夹以在组内共享。假设你有一个名为 `finance` 的小组,其中有几个成员需要共享文档。因为这些是用户文档,所以将它们存储在 `/home` 文件夹层次结构中是个好主意。 -首先,[使用][2] _[sudo][2]_ 创建一个共享文件夹,并将其设置为 _finance_ 组所有: +首先,[使用 sudo][2] 创建一个共享文件夹,并将其设置为 `finance` 组所有: ``` $ sudo mkdir -p /home/shared/finance @@ -95,13 +91,14 @@ $ sudo chgrp finance /home/shared/finance drwxr-xr-x. 2 root root 4096 Jul 6 15:35 finance ``` -对于金融数据来说,这似乎不是一个好主意。接下来,使用 _chmod_ 命令更改共享文件夹的模式(权限)。注意,使用 _g_ 更改所属组的权限,使用 _o_ 更改其他用户的权限。同样,_u_ 会更改用户所有者的权限: +对于金融数据来说,这似乎不是一个好主意。接下来,使用 `chmod` 命令更改共享文件夹的模式(权限)。注意,使用 `g` 更改所属组的权限,使用 `o` 更改其他用户的权限。同样,`u` 会更改用户所有者的权限: ``` $ sudo chmod g+w,o-rx /home/shared/finance ``` -生成的权限看起来更好。现在,_finance_ 组中的任何人(或用户所有者 _root_)都可以完全访问该文件夹及其内容: +生成的权限看起来更好。现在,`finance` 组中的任何人(或用户所有者 `root`)都可以完全访问该文件夹及其内容: + ``` drwxrwx---. 2 root finance 4096 Jul 6 15:35 finance ``` @@ -110,7 +107,7 @@ drwxrwx---. 2 root finance 4096 Jul 6 15:35 finance ### 其他说明 -还有其他方法可以操作这些权限。例如,你可能希望将此文件夹中的任何文件设置为 _finance_ 组所拥有。这需要本文未涉及的其他设置,但请继续关注杂志,以了解关于该主题的更多信息。 +还有其他方法可以操作这些权限。例如,你可能希望将此文件夹中的任何文件设置为 `finance` 组所拥有。这需要本文未涉及的其他设置,但请继续关注我们,以了解关于该主题的更多信息。 -------------------------------------------------------------------------------- @@ -119,7 +116,7 @@ via: https://fedoramagazine.org/command-line-quick-tips-permissions/ 作者:[Paul W. Frields][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md b/published/201907/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md similarity index 100% rename from published/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md rename to published/201907/20190708 Debian 10 (Buster) Installation Steps with Screenshots.md diff --git a/published/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md b/published/201907/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md similarity index 100% rename from published/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md rename to published/201907/20190708 Linux Games Get A Performance Boost for AMD GPUs Thanks to Valve-s New Compiler.md diff --git a/published/20190709 From BASIC to Ruby- Life lessons from first programming languages on Command Line Heroes.md b/published/201907/20190709 From BASIC to Ruby- Life lessons from first programming languages on Command Line Heroes.md similarity index 100% rename from published/20190709 From BASIC to Ruby- Life lessons from first programming languages on Command Line Heroes.md rename to published/201907/20190709 From BASIC to Ruby- Life lessons from first programming languages on Command Line Heroes.md diff --git a/published/20190709 Pipx - Install And Run Python Applications In Isolated Environments.md b/published/201907/20190709 Pipx - Install And Run Python Applications In Isolated Environments.md similarity index 100% rename from published/20190709 Pipx - Install And Run Python Applications In Isolated Environments.md rename to published/201907/20190709 Pipx - Install And Run Python Applications In Isolated Environments.md diff --git a/published/20190709 Sysadmin vs SRE- What-s the difference.md b/published/201907/20190709 Sysadmin vs SRE- What-s the difference.md similarity index 100% rename from published/20190709 Sysadmin vs SRE- What-s the difference.md rename to published/201907/20190709 Sysadmin vs SRE- What-s the difference.md diff --git a/published/20190710 32-bit life support- Cross-compiling with GCC.md b/published/201907/20190710 32-bit life support- Cross-compiling with GCC.md similarity index 100% rename from published/20190710 32-bit life support- Cross-compiling with GCC.md rename to published/201907/20190710 32-bit life support- Cross-compiling with GCC.md diff --git a/published/20190710 How To Find Virtualbox Version From Commandline In Linux.md b/published/201907/20190710 How To Find Virtualbox Version From Commandline In Linux.md similarity index 100% rename from published/20190710 How To Find Virtualbox Version From Commandline In Linux.md rename to published/201907/20190710 How To Find Virtualbox Version From Commandline In Linux.md diff --git a/published/20190710 Test 200- Linux And Unix Operating Systems Online For Free.md b/published/201907/20190710 Test 200- Linux And Unix Operating Systems Online For Free.md similarity index 100% rename from published/20190710 Test 200- Linux And Unix Operating Systems Online For Free.md rename to published/201907/20190710 Test 200- Linux And Unix Operating Systems Online For Free.md diff --git a/translated/tech/20190711 How to install Elasticsearch on MacOS.md b/published/201907/20190711 How to install Elasticsearch on MacOS.md similarity index 68% rename from translated/tech/20190711 How to install Elasticsearch on MacOS.md rename to published/201907/20190711 How to install Elasticsearch on MacOS.md index c64353c88e..b213d2bcd8 100644 --- a/translated/tech/20190711 How to install Elasticsearch on MacOS.md +++ b/published/201907/20190711 How to install Elasticsearch on MacOS.md @@ -1,18 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11125-1.html) [#]: subject: (How to install Elasticsearch on MacOS) [#]: via: (https://opensource.com/article/19/7/installing-elasticsearch-macos) [#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo/users/don-watkins) 如何在 MacOS 上安装 Elasticsearch ====== -安装 Elasticsearch 很复杂!以下是如何在 Mac 上安装。 -![magnifying glass on computer screen][1] -[Elasticsearch][2] 是一个用 Java 开发的开源全文搜索引擎。用户上传 JSON 格式的数据集。然后,Elasticsearch 在向集群索引中的文档添加可搜索引用之前保存原始文档。 +> 安装 Elasticsearch 很复杂!以下是如何在 Mac 上安装。 + +![](https://img.linux.net.cn/data/attachment/album/201907/20/064958dnnwvp8wqzqq4fm2.jpg) + +[Elasticsearch][2] 是一个用 Java 开发的开源全文搜索引擎。用户上传 JSON 格式的数据集。然后,Elasticsearch 在向集群索引中的文档添加可搜索的引用之前先保存原始文档。 Elasticsearch 创建还不到九年,但它是最受欢迎的企业搜索引擎。Elastic 在 2019 年 6 月 25 日发布了最新的更新版本 7.2.0。 @@ -20,7 +22,7 @@ Elasticsearch 创建还不到九年,但它是最受欢迎的企业搜索引擎 [Sunbursts][4]、[地理空间数据地图][5]、[关系分析][6]和实时数据面板只是其中几个功能。并且由于 Elasticsearch 的机器学习能力,你可以了解哪些属性可能会影响你的数据(如服务器或 IP 地址)并查找异常模式。 -在上个月的 [DevFest DC][7] 中,[Summer Rankin 博士][8],Booz Allen Hamilton 的首席数据科学家将 TED Talk 的内容数据集上传到了 Elasticsearch,然后使用 Kibana 快速构建了面板。出于好奇,几天后我去了 Elasticsearch 聚会。 +在上个月的 [DevFest DC][7] 中,Booz Allen Hamilton 的首席数据科学家 [Summer Rankin 博士][8]将 TED Talk 的内容数据集上传到了 Elasticsearch,然后使用 Kibana 快速构建了面板。出于好奇,几天后我去了一个 Elasticsearch 聚会。 由于本课程针对的是新手,因此我们从第一步开始:在我们的笔记本上安装 Elastic 和 Kibana。如果没有安装这两个包,我们无法将莎士比亚的文本数据集作为测试 JSON 文件创建可视化了。 @@ -28,84 +30,72 @@ Elasticsearch 创建还不到九年,但它是最受欢迎的企业搜索引擎 ### 下载适合 MacOS 的 Elasticsearch - 1. 进入 ,你会看到下面的页面: - - +1、进入 ,你会看到下面的页面: ![The Elasticsearch download page.][9] - 2. 在**下载**栏,单击 **MacOS**,将 Elasticsearch TAR 文件(例如,**elasticsearch-7.1.1-darwin-x86_64.tar**)下载到 **Downloads** 文件夹。 -  3. 双击此文件并解压到自己的文件夹中(例如,**elasticsearch-7.1.1**),这其中包含 TAR 中的所有文件。 +2、在**下载**区,单击 **MacOS**,将 Elasticsearch TAR 文件(例如,`elasticsearch-7.1.1-darwin-x86_64.tar`)下载到 `Downloads` 文件夹。 +  +3、双击此文件并解压到自己的文件夹中(例如,`elasticsearch-7.1.1`),这其中包含 TAR 中的所有文件。 - - - -**提示**:如果你希望 Elasticsearch 放在另一个文件夹中,现在可以移动。 +**提示**:如果你希望 Elasticsearch 放在另一个文件夹中,现在可以移动它。 ### 在 MacOS 命令行中运行 Elasticsearch 如果你愿意,你可以只用命令行运行 Elasticsearch。只需遵循以下流程: - 1. [打开**终端**窗口][10]。 -  2. 在终端窗口中,输入你的 Elasticsearch 文件夹。例如(如果你移动了程序,请将 **Downloads** 更改为正确的路径): +1、[打开终端窗口][10]。 +2、在终端窗口中,输入你的 Elasticsearch 文件夹。例如(如果你移动了程序,请将 `Downloads` 更改为正确的路径): -**$ cd ~Downloads/elasticsearch-1.1.0** +``` +$ cd ~Downloads/elasticsearch-1.1.0 +``` - 3. 切换到 Elasticsearch **bin** 子文件夹,然后启动该程序。例如: +3、切换到 Elasticsearch 的 `bin` 子文件夹,然后启动该程序。例如: - - -**$ cd bin $ ./elasticsearch** +``` +$ cd bin +$ ./elasticsearch +``` 这是我启动 Elasticsearch 1.1.0 时命令行终端显示的一些输出: ![Terminal output when running Elasticsearch.][11] -**注意**:默认情况下,Elasticsearch 在前台运行,这可能会导致计算机速度变慢。按 **Ctrl-C** 可以阻止 Elasticsearch 运行。 +**注意**:默认情况下,Elasticsearch 在前台运行,这可能会导致计算机速度变慢。按 `Ctrl-C` 可以阻止 Elasticsearch 运行。 ### 使用 GUI 运行 Elasticsearch -如果你更喜欢点击,你可以像这样运行 Elasticsearch: +如果你更喜欢点击操作,你可以像这样运行 Elasticsearch: - 1. 打开一个新的 **Finder** 窗口。 -  2. 在左侧 Finder 栏中选择 **Downloads**(如果你将 Elasticsearch 移动了另一个文件夹,请进入它)。 -  3. 打开名为 **elasticsearch-7.1.1** 的文件夹(对于此例)。出现了八个子文件夹。 +1、打开一个新的 **Finder** 窗口。 +2、在左侧 Finder 栏中选择 `Downloads`(如果你将 Elasticsearch 移动了另一个文件夹,请进入它)。 +3、打开名为 `elasticsearch-7.1.1` 的文件夹(对于此例)。出现了八个子文件夹。 ![The elasticsearch/bin menu.][12] - 4. 打开 **bin** 子文件夹。如上面的截图所示,此子文件夹中有 20 个文件。 -  5. 单击第一个文件,即 **elasticsearch**。 - - +4、打开 `bin` 子文件夹。如上面的截图所示,此子文件夹中有 20 个文件。 +  +5、单击第一个文件,即 `elasticsearch`。 请注意,你可能会收到安全警告,如下所示: ![The security warning dialog box.][13] -  +这时候要打开程序需要: -这时候要打开程序: - - 1. 在警告对话框中单击 **OK**。 -  2. 打开**系统偏好**。 -  3. 单击**安全和隐私**,打开如下窗口: - - - -![Where you can allow your computer to open the downloaded file.][14] - - 4. 单击**永远打开**,打开如下所示的确认对话框: - - - -![Security confirmation dialog box.][15] - - 5. 单击**打开**。会打开一个终端窗口并启动 Elasticsearch。 +1. 在警告对话框中单击 **OK**。 +2. 打开**系统偏好**。 +3. 单击**安全和隐私**,打开如下窗口: + ![Where you can allow your computer to open the downloaded file.][14] +4. 单击**永远打开**,打开如下所示的确认对话框: + ![Security confirmation dialog box.][15] +5. 单击**打开**。会打开一个终端窗口并启动 Elasticsearch。 启动过程可能需要一段时间,所以让它继续运行。最终,它将完成,你最后将看到类似这样的输出: @@ -115,7 +105,7 @@ Elasticsearch 创建还不到九年,但它是最受欢迎的企业搜索引擎 安装 Elasticsearch 之后,就可以开始探索了! -该工具的 [Elasticsearch:开始使用][17]指南会根据你的目标指导你。它的介绍视频介绍了在 [Elasticsearch Service][18] 上启动托管集群,执行基本搜索查询,通过创建,读取,更新和删除(CRUD)REST API等方式操作数据的步骤。 +该工具的 [Elasticsearch:开始使用][17]指南会根据你的目标指导你。它的介绍视频介绍了在 [Elasticsearch Service][18] 上启动托管集群,执行基本搜索查询,通过创建、读取、更新和删除(CRUD)REST API 等方式操作数据的步骤。 本指南还提供文档链接,开发控制台命令,培训订阅以及 Elasticsearch Service 的免费试用版。此试用版允许你在 AWS 和 GCP 上部署 Elastic 和 Kibana 以支持云中的 Elastic 集群。 @@ -128,7 +118,7 @@ via: https://opensource.com/article/19/7/installing-elasticsearch-macos 作者:[Lauren Maffeo][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201907/20190711 Type Linux Commands In Capital Letters To Run Them As Sudo User.md b/published/201907/20190711 Type Linux Commands In Capital Letters To Run Them As Sudo User.md new file mode 100644 index 0000000000..f10ae9352f --- /dev/null +++ b/published/201907/20190711 Type Linux Commands In Capital Letters To Run Them As Sudo User.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11142-1.html) +[#]: subject: (Type Linux Commands In Capital Letters To Run Them As Sudo User) +[#]: via: (https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +用大写字母输入 Linux 命令以将其作为 sudo 用户运行 +====== + +![Type Linux Commands In Capital Letters To Run Them As Sudo User][1] + +我非常喜欢 Linux 社区的原因是他们创建了很多有趣的项目,你很少能在任何其他操作系统中找到它们。不久前,我们看了一个名为 [Hollywood][2] 的有趣项目,它在类 Ubuntu 系统将终端变成了好莱坞技术情景剧的黑客界面。还有一些其他工具,例如 `cowsay`、`fortune`、`sl` 和 `toilet` 等,用来消磨时间自娱自乐!它们可能没有用,但这些程序娱乐性不错并且使用起来很有趣。今天,我偶然发现了另一个名为 `SUDO` 的类似工具。正如名字暗示的那样,你无论何时用大写字母输入 Linux 命令,`SUDO` 程序都会将它们作为 sudo 用户运行!这意味着,你无需在要运行的 Linux 命令前面输入 `sudo`。很酷,不是么? + +### 安装 SUDO + +> 提醒一句: + +> 在安装这个程序(或任何程序)之前,请查看源代码(最后给出的链接),并查看是否包含会损害你的系统的可疑/恶意代码。在 VM 中测试它。如果你喜欢或觉得它很有用,你可以在个人/生产系统中使用它。 + +用 Git 克隆 `SUDO` 仓库: + +``` +$ git clone https://github.com/jthistle/SUDO.git +``` + +此命令将克隆 SUDO GIT 仓库的内容,并将它们保存在当前目录下的 `SUDO` 的目录中。 + +``` +Cloning into 'SUDO'... +remote: Enumerating objects: 42, done. +remote: Counting objects: 100% (42/42), done. +remote: Compressing objects: 100% (29/29), done. +remote: Total 42 (delta 17), reused 30 (delta 12), pack-reused 0 +Unpacking objects: 100% (42/42), done. +``` + +切换到 `SUDO` 目录: + +``` +$ cd SUDO/ +``` + +并使用命令安装它: + +``` +$ ./install.sh +``` + +该命令将在 `~/.bashrc` 文件中添加以下行: + +``` +[...] +# SUDO - shout at bash to su commands +# Distributed under GNU GPLv2, @jthistle on github + +shopt -s expand_aliases + +IFS_=${IFS} +IFS=":" read -ra PATHS <<< "$PATH" + +for i in "${PATHS[@]}"; do + for j in $( ls "$i" ); do + if [ ${j^^} != $j ] && [ $j != "sudo" ]; then + alias ${j^^}="sudo $j" + fi + done +done + +alias SUDO='sudo $(history -p !!)' + +IFS=${IFS_} + +# end SUDO +``` + +它还会备份你的 `~/.bashrc` 并将其保存为 `~/.bashrc.old`。如果有重大错误,你可以恢复它。 + +最后,使用命令更新更改: + +``` +$ source ~/.bashrc +``` + +### 现在,用大写字母中输入 Linux 命令,将它们作为 Sudo 用户运行 + +通常我们像下面那样执行需要 sudo/root 权限的命令。 + +``` +$ sudo mkdir /ostechnix +``` + +对么?没错!上面的命令将在根目录(`/`)中创建名为 `ostechnix` 的目录。让我们使用 `Ctrl + c` 取消。 + +一旦安装了 `SUDO`,你就可以**在不使用 sudo 的情况下输入任何大写 Linux 命令**并运行它们。因此,你可以像下面那样运行上面的命令: + +``` +$ MKDIR /ostechnix +$ TOUCH /ostechnix/test.txt +$ LS /ostechnix +``` + +![][3] + +用大写字母输入 Linux 命令以将其作为 sudo 用户运行 + +请注意**它无法绕过 sudo 密码**。你仍然需要键入 `sudo` 密码才能执行给定的命令。它只会有助于避免在每个命令前面输入 `sudo`。 + +相关阅读: + + * [如何在 Linux 中没有 sudo 密码运行特定命令][4] + * [如何恢复用户的 sudo 权限][5] + * [如何在 Ubuntu 上为用户授予和删除 sudo 权限][6] + * [如何在 Linux 系统中查找所有 sudo 用户][7] + * [如何在终端中输入密码时显示星号][8] + * [如何更改 Linux 中的 sudo 提示符][9] + + +当然,输入 `sudo` 只需几秒钟,所以这不是什么大问题。 我必须告诉这是一个用来消磨时间的有趣且无用的项目。 如果你不喜欢它,那就去学习一些有用的东西吧。 如果你喜欢它,试一试,玩得开心! + +资源: + + * [SUDO GitHub 仓库][10] + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/sudo-720x340.png +[2]: https://www.ostechnix.com/turn-ubuntu-terminal-hollywood-technical-melodrama-hacker-interface/ +[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/SUDO-in-action.gif +[4]: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/ +[5]: https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/ +[6]: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ +[7]: https://www.ostechnix.com/find-sudo-users-linux-system/ +[8]: https://www.ostechnix.com/display-asterisks-type-password-terminal/ +[9]: https://www.ostechnix.com/change-sudo-prompt-linux-unix/ +[10]: https://github.com/jthistle/SUDO diff --git a/published/201907/20190712 MTTR is dead, long live CIRT.md b/published/201907/20190712 MTTR is dead, long live CIRT.md new file mode 100644 index 0000000000..1055d9e832 --- /dev/null +++ b/published/201907/20190712 MTTR is dead, long live CIRT.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11155-1.html) +[#]: subject: (MTTR is dead, long live CIRT) +[#]: via: (https://opensource.com/article/19/7/measure-operational-performance) +[#]: author: (Julie Gunderson https://opensource.com/users/juliegund/users/kearnsjd/users/ophir) + +MTTR 已死,CIRT 长存 +====== + +> 通过关注影响业务的事件,CIRT 是衡量运维绩效的更准确方法。 + +![Green graph of measurements][1] + +IT 运维圈子的玩法正在发生变化,这意味着过去的规则越来越不合理。机构需要适当环境中的准确的、可理解的、且可操作的指标,以衡量运维绩效并推动关键业务转型。 + +越多的客户使用现代工具,他们管理的事件类型的变化越多,将所有这些不同事件粉碎到一个桶中以计算平均解决时间来表示运维绩效的意义就越少,这就是 IT 一直以来在做的事情。 + +### 历史与指标 + +历史表明,在分析信号以防止错误和误解时,背景信息是关键。例如,在 20 世纪 80 年代,瑞典建立了一个分析水听器信号的系统,以提醒他们在瑞典当地水域出现的俄罗斯潜艇。瑞典人使用了他们认为代表一类俄罗斯潜艇的声学特征 —— 但实际上是鲱鱼在遇到潜在捕食者时释放的[气泡声][2]。这种对指标的误解加剧了各国之间的紧张关系,几乎导致了战争。 + +![Funny fish cartoon][3] + +平均解决时间Mean Time To Resolve(MTTR)是运维经理用于获得实现目标洞察力的主要运维绩效指标。这是一项基于系统可靠性工程systems reliability engineering的古老措施。MTTR 已被许多行业采用,包括制造、设施维护以及最近的 IT 运维,它代表了解决在特定时间段内创建的事件所需的平均时间。 + +MTTR 的计算方法是将所有事件(从事件创建时间到解决时间)所需的时间除以事件总数。 + +![MTTR formula][4] + +正如它所说的,MTTR 是 **所有** 事件的平均值。MTTR 将高紧急事件和低紧急事件混为一谈。它还会重复计算每个单独的、未分组的事件,并得出有效的解决时间。它包括了在相同上下文中手动解决和自动解决的事件。它将在创建了几天(或几个月)甚至完全被忽略的事件混合在一起。最后,MTTR 包括每个小的瞬态突发事件(在 120 秒内自动关闭的事件),这些突发事件要么是非问题噪音,要么已由机器快速解决。 + +![Variability in incident types][5] + +MTTR 将所有事件(无论何种类型)抛入一个桶中,将它们全部混合在一起,并计算整个集合中的“平均”解决时间。这种过于简单化的方法导致运维执行方式的的噪音、错误和误导性指示。 + +### 一种衡量绩效的新方法 + +关键事件响应时间Critical Incident Response Time(CIRT)是评估运维绩效的一种更准确的新方法。PagerDuty 创立了 CIRT 的概念,但该方法可供所有人免费使用。 + +CIRT 通过使用以下技术剔除来自信号的噪声,其重点关注最有可能影响业务的事件: + +1. 真正影响(或可能影响)业务的事件很少是低紧急事件,因此要排除所有低紧急事件。 +2. 真正影响业务的事件很少(如果有的话)可以无需人为干预而通过监控工具自动解决,因此要排除未由人工解决的事件。 +3. 在 120 秒内解决的短暂、爆发性和瞬态事件几乎不可能是真正影响业务的事件,因此要排除它们。 +4. 长时间未被注意、提交或忽略(未确认、未解决)的事件很少会对业务造成影响;排除它们。注意:此阈值可以是特定于客户的统计推导数字(例如,高于均值的两个标准差),以避免使用任意数字。 +5. 由单独警报产生的个别未分组事件并不代表较大的业务影响事件。因此,模拟具有非常保守的阈值(例如,两分钟)的事件分组以计算响应时间。 + +应用这些假设对响应时间有什么影响?简而言之,效果非常非常大! + +通过在关键的、影响业务的事件中关注运维绩效,解决时间分布变窄并极大地向左偏移,因为现在它处理类似类型的事件而不是所有事件。 + +由于 MTTR 计算的响应时间长得多、人为地偏差,因此它是运维绩效较差的一个指标。另一方面,CIRT 是一项有意的措施,专注于对业务最重要的事件。 + +与 CIRT 一起使用的另一个关键措施是确认和解决事故的百分比。这很重要,因为它验证 CIRT(或 MTTA / MTTR)是否值得利用。例如,如果 MTTR 结果很低,比如 10 分钟,那听起来不错,但如果只有 42% 的事件得到解决,那么 MTTR 是可疑的。 + +总之,CIRT 和确认、解决事件的百分比形成了一组有价值的指标,可以让你更好地了解运营的执行情况。衡量绩效是提高绩效的第一步,因此这些新措施对于实现机构的可持续、可衡量的改进周期至关重要。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/measure-operational-performance + +作者:[Julie Gunderson][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/juliegund/users/kearnsjd/users/ophir +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) +[2]: http://blogfishx.blogspot.com/2014/05/herring-fart-to-communicate.html +[3]: https://opensource.com/sites/default/files/uploads/fish.png (Funny fish cartoon) +[4]: https://opensource.com/sites/default/files/uploads/mttr.png (MTTR formula) +[5]: https://opensource.com/sites/default/files/uploads/incidents.png (Variability in incident types) diff --git a/published/20190712 Make an RGB cube with Python and Scribus.md b/published/201907/20190712 Make an RGB cube with Python and Scribus.md similarity index 100% rename from published/20190712 Make an RGB cube with Python and Scribus.md rename to published/201907/20190712 Make an RGB cube with Python and Scribus.md diff --git a/published/201907/20190713 ElectronMail - a Desktop Client for ProtonMail and Tutanota.md b/published/201907/20190713 ElectronMail - a Desktop Client for ProtonMail and Tutanota.md new file mode 100644 index 0000000000..b59148825d --- /dev/null +++ b/published/201907/20190713 ElectronMail - a Desktop Client for ProtonMail and Tutanota.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11128-1.html) +[#]: subject: (ElectronMail – a Desktop Client for ProtonMail and Tutanota) +[#]: via: (https://itsfoss.com/electronmail/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +ElectronMail:ProtonMail 和 Tutanota 的桌面客户端 +====== + +互联网上的大多数人都拥有来自 Google 等大公司的电子邮件帐户,但这些帐户不尊重你的隐私。值得庆幸的是,目前有 [Tutanota][1] 和 [ProtonMail][2] 等具有隐私意识的替代品。问题是并非所有人都有桌面客户端。今天,我们将研究一个为你解决该问题的项目。我们来看看 ElectronMail 吧。 + +> ‘Electron’ 警告! + +> 以下应用是使用 Electron 构建的(也就是名为 ElectronMail 的原因之一)。如果使用 Electron 让你感到不安,请将此视为触发警告。 + +### ElectronMail:Tutanota 和 ProtonMail 的桌面客户端 + +![Electron Mail About][3] + +[ElectronMail][4] 可以简单地视作 ProtonMail 和 Tutanota 的电子邮件客户端。它使用三大技术构建:[Electron][5]、[TypeScript][6] 和 [Angular][7]。它包括以下功能: + +* 针对每个电子邮件提供商提供多帐户支持 +* 加密本地存储 +* 适用于 Linux、Windows、macOS 和 FreeBSD +* 原生通知系统 +* 带有未读消息总数的系统托盘图标 +* 用主密码保护帐户信息 +* 可切换的视图布局 +* 可离线访问电子邮件 +* 电子邮件在本地加密存储 +* 批量导出电子邮件为 EML 文件 +* 全文搜索 +* 内置/预打包的 Web 客户端 +* 可以为每个帐户配置代理 +* 拼写检查 +* 支持双因素身份验证,以提高安全性 + +目前,ElectronMail 仅支持 Tutanota 和 ProtonMail。我觉得他们将来会增加更多。根据 [GitHub 页面][4]:“多电子邮件提供商支持。目前支持 ProtonMail 和 Tutanota。” + +ElectronMail 目前是 MIT 许可证。 + +#### 如何安装 ElectronMail + +目前,有几种方法可以在 Linux 上安装 ElectronMail。对于Arch 和基于 Arch 的发行版,你可以从[Arch 用户仓库][8]安装它。ElectrionMail 还有一个 Snap 包。要安装它,只需输入 `sudo snap install electron-mail` 即可。 + +对于所有其他 Linux 发行版,你可以[下载][9] `.deb` 或 `.rpm` 文件。 + +![Electron Mail Inbox][10] + +你也可以[下载][9]用于 Windows 中的 `.exe` 安装程序或用于 macOS 的 `.dmg` 文件。甚至还有给 FreeBSD 用的文件。 + +#### 删除 ElectronMail + +如果你安装了 ElectronMail 并确定它不适合你,那么[开发者][12]建议采用几个步骤。 **在卸载应用之前,请务必遵循以下步骤。** + +如果你使用了“保持登录”功能,请单击菜单上的“注销”。这将删除本地保存的主密码。卸载 ElectronMail 后也可以删除主密码,但这涉及编辑系统密钥链。 + +你还需要手动删除设置文件夹。在系统托盘中选择应用图标后,单击“打开设置文件夹”可以找到它。 + +![Electron Mail Setting][13] + +### 我对 ElectronMail 的看法 + +我通常不使用电子邮件客户端。事实上,我主要依赖于 Web 客户端。所以,这个应用对我没太大用处。 + +话虽这么说,但是 ElectronMail 看着不错,而且很容易设置。它有大量开箱即用的功能,并且高级功能并不难使用。 + +我遇到的一个问题与搜索有关。根据功能列表,ElectronMail 支持全文搜索。但是,Tutanota 的免费版本仅支持有限的搜索。我想知道 ElectronMail 如何处理这个问题。 + +最后,ElectronMail 只是一个基于 Web Email 的一个 Electron 封装。我宁愿在浏览器中打开它们,而不是将单独的系统资源用于运行 Electron。如果你只[使用 Tutanota,他们有自己官方的 Electron 桌面客户端][14]。你可以尝试一下。 + +我最大的问题是安全性。这是两个非常安全的电子邮件应用的非官方应用。如果有办法捕获你的登录信息或阅读你的电子邮件怎么办?比我聪明的人必须通过源代码才能确定。这始终是一个安全项目的非官方应用的问题。 + +你有没有使用过 ElectronMail?你认为是否值得安装 ElectronMail?你最喜欢的邮件客户端是什么?请在下面的评论中告诉我们。 + +如果你发现这篇文章很有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][15] 上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/electronmail/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/tutanota-review/ +[2]: https://itsfoss.com/protonmail/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/electron-mail-about.jpg?resize=800%2C500&ssl=1 +[4]: https://github.com/vladimiry/ElectronMail +[5]: https://electronjs.org/ +[6]: http://www.typescriptlang.org/ +[7]: https://angular.io/ +[8]: https://aur.archlinux.org/packages/electronmail-bin +[9]: https://github.com/vladimiry/ElectronMail/releases +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/electron-mail-inbox.jpg?ssl=1 +[12]: https://github.com/vladimiry +[14]: https://linux.cn/article-10688-1.html +[15]: http://reddit.com/r/linuxusersgroup diff --git a/published/20190714 Excellent- Ubuntu LTS Users Will Now Get the Latest Nvidia Driver Updates -No PPA Needed Anymore.md b/published/201907/20190714 Excellent- Ubuntu LTS Users Will Now Get the Latest Nvidia Driver Updates -No PPA Needed Anymore.md similarity index 100% rename from published/20190714 Excellent- Ubuntu LTS Users Will Now Get the Latest Nvidia Driver Updates -No PPA Needed Anymore.md rename to published/201907/20190714 Excellent- Ubuntu LTS Users Will Now Get the Latest Nvidia Driver Updates -No PPA Needed Anymore.md diff --git a/published/201907/20190716 Become a lifelong learner and succeed at work.md b/published/201907/20190716 Become a lifelong learner and succeed at work.md new file mode 100644 index 0000000000..c9906592db --- /dev/null +++ b/published/201907/20190716 Become a lifelong learner and succeed at work.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11130-1.html) +[#]: subject: (Become a lifelong learner and succeed at work) +[#]: via: (https://opensource.com/open-organization/19/7/informal-learning-adaptability) +[#]: author: (Colin Willis https://opensource.com/users/colinwillishttps://opensource.com/users/marcobravo) + + +成为终身学习者,并在工作中取得成功 +====== + +> 在具有适应性文化的开放组织中,学习应该一直持续 —— 但不会总是出现在正式场合。我们真的明白它是如何工作的吗? + +![Writing in a notebook][1] + +持续学习是指人们为发展自己而进行的持续的、职业驱动的、有意识的学习过程。对于那些自认是持续学习者的人来说,学习从未停止 —— 这些人从日常经历中看到学习机会。与同事进行辩论、反思反馈、在互联网上寻找问题的解决方案、尝试新事物或冒险都是一个人在工作中可以进行的非正式学习活动的例子。 + +持续学习是开放组织中任何人的核心能力。毕竟,开放的组织是建立在同行相互思考、争论和行动的基础上的。在开放组织的模棱两可、话语驱动的世界中茁壮成长,每天都需要员工具备这些技能。 + +不幸的是,科学文献在传播我们在工作中学习的知识方面、帮助个人欣赏和发展自己的学习能力方面,做得很差。因此,在本文系列中,我将向你介绍非正式学习,并帮助你理解将学习视为一种技能会如何帮助你在任何组织中茁壮成长,尤其是在开放式组织中。 + +### 为什么这么正式? + +迄今为止,对组织中学习的科学研究主要集中在正式学习而不是非正式学习的设计、交付和评估上。 + +投资于员工知识、技能和能力的发展是一个组织保持其相对于竞争对手优势的重要方式。组织通过创建或购买课程、在线课程、研讨会等来使学习机会正规化。这些课程旨在像个人传授与工作相关的内容,就像学校里的班级一样。对于一个组织来说,提供一门课程是一种简单(如果成本高昂的话)的方法,可以确保其员工的技能或知识保持最新。同样,教室环境是研究人员的天然实验室,使得基于培训的研究和工作不仅可能,而且强大。 + +当然,有些东西人们不需要培训来学习;通常,人们通过研究答案、与同事交谈、思考、实验或适应变化来学习。事实上,[最近的评估表明][2] 70% 到 80% 的与工作相关的知识不是在培训中学到的,而是在工作中非正式学到的。这并不是说正规的培训无效;培训可能非常有效,但它是一种精确的干预方式。在工作的大部分方面正式培训一个人是不现实的,尤其是当这些工作变得更加复杂的时候。 + +因此,非正式学习,或者任何发生在结构化学习环境之外的学习,对工作场所来说是极其重要的。事实上,[最近的科学证据][3]表明,非正式学习比正式培训更能预测工作表现。 + +那么,为什么机构和科学界如此关注培训呢? + +### 循环过程 + +除了我前面提到的原因,研究非正式学习可能非常困难。与正式学习不同,非正式学习发生在非结构化环境中,高度依赖于个人,很难或不可能观察到。 + +直到最近,大多数关于非正式学习的研究都集中在定义非正式学习的合格特征和确定非正式学习在理论上是如何与工作经验联系在一起的。研究人员描述了一个[动态的周期性过程][4],通过这个过程,个人可以在组织中非正式地学习。 + +与正式学习一样,非正式学习发生在非结构化环境中,高度依赖于个人,很难或不可能观察。 + +在这个过程中,个人和组织都有创造学习机会的机构。例如,一个人可能对学习某样东西感兴趣,并为此表现出学习行为。组织以向个人提供反馈的形式,可能表明需要学习。这可能是一个糟糕的绩效评估、一个在项目中发表的评论、或者一个不是个人指导的组织环境的更广泛的变化。这些力量在组织环境中(例如,有人尝试了一个新想法,他或她的同事认识到并奖励了这种行为)或者通过在个人的头脑中反思(例如,有人反思了关于他或她的表现的,并决定在学习工作中付出更多的努力)。与培训不同,非正式学习不遵循正式的线性过程。个人可以随时体验过程的任何部分,同时体验过程的多个部分。 + +### 开放组织中的非正式学习 + +具体而言,在开放组织中,既减少了对等级制度的重视程度,又更加注重对参与式文化的重视程度,这两者都推动了这种非正式的学习。简而言之,开放式组织只是为个人和组织环境提供了更多互动和激发学习的机会。此外,想法和变革需要开放式组织中员工给予更广泛的认同 —— 而认同需要对他人的适应性和洞察力的欣赏。 + +也就是说,仅仅增加学习机会并不能保证学习会发生或成功。有人甚至可能会说,开放式组织中常见的模糊性和公开性话语可能会阻止不擅长持续学习的人——同样,随着时间的推移学习的习惯和开放式组织的核心能力——尽可能有效地为组织做出贡献。 + +解决这些问题需要一种以一致的方式跟踪非正式学习。最近,科学界呼吁创造衡量非正式学习的方法,这样就可以进行系统的研究来解决非正式学习的前因后果的问题。我自己的研究集中在这一呼吁上,我花了几年时间发展和完善我们对非正式学习行为的理解,以便可以衡量它们。 + +在本文系列的第二部分,我将重点介绍我最近在一个开放式组织中进行的一项研究的成果,在该研究中,我测试了我对非正式学习行为的研究,并将它们与更广泛的工作环境和个人工作成果联系起来。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/7/informal-learning-adaptability + +作者:[Colin Willis][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/colinwillishttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) +[2]: https://www.groupoe.com/images/Accelerating_On-the-Job-Learning_-_White_Paper.pdf +[3]: https://www.researchgate.net/publication/316490244_Antecedents_and_Outcomes_of_Informal_Learning_Behaviors_a_Meta-Analysis +[4]: https://psycnet.apa.org/record/2008-13469-009 diff --git a/published/201907/20190716 Save and load Python data with JSON.md b/published/201907/20190716 Save and load Python data with JSON.md new file mode 100644 index 0000000000..a716d958c4 --- /dev/null +++ b/published/201907/20190716 Save and load Python data with JSON.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11133-1.html) +[#]: subject: (Save and load Python data with JSON) +[#]: via: (https://opensource.com/article/19/7/save-and-load-data-python-json) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Python 处理 JSON 格式的数据 +====== + +> 如果你不希望从头开始创造一种数据格式来存放数据,JSON 是一个很好的选择。如果你对 Python 有所了解,就更加事半功倍了。下面就来介绍一下如何使用 Python 处理 JSON 数据。 + +![Cloud and databsae incons][1] + +[JSON][2] 的全称是 JavaScript 对象表示法JavaScript Object Notation。这是一种以键值对的形式存储数据的格式,并且很容易解析,因而成为了一种被广泛使用的数据格式。另外,不要因为 JSON 名称而望文生义,JSON 并不仅仅在 JavaScript 中使用,它也可以在其它语言中使用。下文会介绍它是如何在 Python 中使用的。 + +首先我们给出一个 JSON 示例: + +``` +{ + "name":"tux", + "health":"23", + "level":"4" +} +``` + +上面是一个和编程语言无关的原生 JSON 数据。熟悉 Python 的人会看出来这个 JSON 数据跟 Python 中的字典dictionary长得很像。而这两者之间确实非常相似,如果你对 Python 中的列表和字典数据结构有一定的理解,那么 JSON 理解起来也不难。 + +### 使用字典存放数据 + +如果你的应用需要存储一些结构复杂的数据,不妨考虑使用 JSON 格式。对比你可能曾经用过的自定义格式的文本配置文件,JSON 提供了更加结构化的可递归的存储格式。同时,Python 自带的 `json` 模块已经提供了可以将 JSON 数据导入/导出应用时所需的所有解析库。因此,你不需要针对 JSON 自行编写代码进行解析,而其他开发人员在与你的应用进行数据交互的时候也不需要去解析新的数据格式。正是这个原因,JSON 在数据交换时被广泛地采用了。 + +以下是一段在 Python 中使用嵌套字典的代码: + +``` +#!/usr/bin/env python3 + +import json + +# instantiate an empty dict +team = {} + +# add a team member +team['tux'] = {'health': 23, 'level': 4} +team['beastie'] = {'health': 13, 'level': 6} +team['konqi'] = {'health': 18, 'level': 7} +``` + +这段代码声明了一个名为 `team` 的字典,并初始化为一个空字典。 + +如果要给这个字典添加内容,首先需要创建一个键,例如上面示例中的 `tux`、`beastie`、`konqi`,然后为这些键一一提供对应的值。上面示例中的值由一个个包含游戏玩家信息的字典充当。 + +字典是一种可变的变量。字典中的数据可以随时添加、删除或更新。这样的特性使得字典成为了应用程序存储数据的极好选择。 + +### 使用 JSON 格式存储数据 + +如果存放在字典中的数据需要持久存储,这些数据就需要写到文件当中。这个时候就需要用到 Python 中的 `json` 模块了: + +``` +with open('mydata.json', 'w') as f: + json.dump(team, f) +``` + +上面的代码首先创建了一个名为 `mydata.json` 的文件,然后以写模式打开了这个文件,这个被打开的文件以变量 `f` 表示(当然也可以用任何你喜欢的名称,例如 `file`、`output` 等)。而 `json` 模块中的 `dump()` 方法则是用于将一个字典输出到一个文件中。 + +从应用中导出数据就是这么简单,同时这些导出的数据是结构化的、可理解的。现在可以查看导出的数据: + +``` +$ cat mydata.json +{"tux": {"health": 23, "level": 4}, "beastie": {"health": 13, "level": 6}, "konqi": {"health": 18, "level": 7}} +``` + +### 从 JSON 文件中读取数据 + +如果已经将数据以 JSON 格式导出到文件中了,也有可能需要将这些数据读回到应用中去。这个时候,可以使用 Python `json` 模块中的 `load()` 方法: + +``` +#!/usr/bin/env python3 + +import json + +f = open('mydata.json') +team = json.load(f) + +print(team['tux']) +print(team['tux']['health']) +print(team['tux']['level']) + +print(team['beastie']) +print(team['beastie']['health']) +print(team['beastie']['level']) + +# when finished, close the file +f.close() +``` + +这个方法实现了和保存文件大致相反的操作。使用一个变量 `f` 来表示打开了的文件,然后使用 `json` 模块中的 `load()` 方法读取文件中的数据并存放到 `team` 变量中。 + +其中的 `print()` 展示了如何查看读取到的数据。在过于复杂的字典中迭代调用字典键的时候有可能会稍微转不过弯来,但只要熟悉整个数据的结构,就可以慢慢摸索出其中的逻辑。 + +当然,这里使用 `print()` 的方式太不灵活了。你可以将其改写成使用 `for` 循环的形式: + +``` +for i in team.values(): + print(i) +``` + +### 使用 JSON + +如上所述,在 Python 中可以很轻松地处理 JSON 数据。因此只要你的数据符合 JSON 的模式,就可以选择使用 JSON。JSON 非常灵活易用,下次使用 Python 的时候不妨尝试一下。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/save-and-load-data-python-json + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[HankChow](https://github.com/HankChow) +校对:[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/bus_cloud_database.png?itok=lhhU42fg (Cloud and databsae incons) +[2]: https://json.org diff --git a/published/201907/20190717 Bond WiFi and Ethernet for easier networking mobility.md b/published/201907/20190717 Bond WiFi and Ethernet for easier networking mobility.md new file mode 100644 index 0000000000..b8528ca1dd --- /dev/null +++ b/published/201907/20190717 Bond WiFi and Ethernet for easier networking mobility.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11149-1.html) +[#]: subject: (Bond WiFi and Ethernet for easier networking mobility) +[#]: via: (https://fedoramagazine.org/bond-wifi-and-ethernet-for-easier-networking-mobility/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +绑定 WiFi 和以太网,以使网络间移动更轻松 +====== + +![][1] + +有时一个网络接口是不够的。网络绑定允许将多条网络连接与单个逻辑接口一起工作。你可能因为需要给单条连接更多的带宽而这么做,或者你可能希望在有线和无线网络之间来回切换而不会丢失网络连接。 + +我是后面一种情况。在家工作的好处之一是,当天气晴朗时,在阳光明媚的阳台而不是在室内工作是很愉快的。但每当我这样做时,我都会失去网络连接。IRC、SSH、VPN,一切都断开了,客户端重连至少需要一会。本文介绍了如何在 Fedora 30 笔记本上设置网络绑定,以便从笔记本扩展坞的有线连接无缝切换到 WiFi。 + +在 Linux 中,接口绑定由内核模块 `bonding` 处理。默认情况下,Fedora 没有启用此功能,但它包含在 `kernel-core` 软件包中。这意味着启用接口绑定只需一个命令: + +``` +sudo modprobe bonding +``` + +请注意,这只会在你重启之前生效。要永久启用接口绑定,请在 `/etc/modules-load.d` 目录中创建一个名为 `bonding.conf` 的文件,该文件仅包含单词 `bonding`。 + +现在你已启用绑定,现在可以创建绑定接口了。首先,你必须获取要绑定的接口的名称。要列出可用的接口,请运行: + +``` +sudo nmcli device status +``` + +你将看到如下输出: + +``` +DEVICE TYPE STATE CONNECTION +enp12s0u1 ethernet connected Wired connection 1 +tun0 tun connected tun0 +virbr0 bridge connected virbr0 +wlp2s0 wifi disconnected -- +p2p-dev-wlp2s0 wifi-p2p disconnected -- +enp0s31f6 ethernet unavailable -- +lo loopback unmanaged -- +virbr0-nic tun unmanaged -- +``` + +在本例中,有两个(有线)以太网接口可用。 `enp12s0u1` 在笔记本电脑扩展坞上,你可以通过 `STATE` 列知道它已连接。另一个是 `enp0s31f6`,是笔记本电脑中的内置端口。还有一个名为 `wlp2s0` 的 WiFi 连接。 `enp12s0u1` 和 `wlp2s0` 是我们在这里感兴趣的两个接口。(请注意,阅读本文无需了解网络设备的命名方式,但如果你感兴趣,可以查看 [systemd.net-naming-scheme 手册页][2]。) + +第一步是创建绑定接口: + +``` +sudo nmcli connection add type bond ifname bond0 con-name bond0 +``` + +在此示例中,绑定接口名为 `bond0`。`con-name bond0` 将连接名称设置为 `bond0`。直接这样做会有一个名为 `bond-bond0` 的连接。你还可以将连接名设置得更加人性化,例如 “Docking station bond” 或 “Ben”。 + +下一步是将接口添加到绑定接口: + +``` +sudo nmcli connection add type ethernet ifname enp12s0u1 master bond0 con-name bond-ethernet +sudo nmcli connection add type wifi ifname wlp2s0 master bond0 ssid Cotton con-name bond-wifi +``` + +如上所示,连接名称被设置为[更具描述性][3]。请务必使用系统上相应的接口名称替换 `enp12s0u1` 和 `wlp2s0`。对于 WiFi 接口,请使用你自己的网络名称 (SSID)替换我的 “Cotton”。如果你的 WiFi 连接有密码(这当然会有!),你也需要将其添加到配置中。以下假设你使用 [WPA2-PSK][4] 身份验证 + +``` +sudo nmcli connection modify bond-wifi wifi-sec.key-mgmt wpa-psk +sudo nmcli connection edit bond-wif +``` + +第二条命令将进入交互式编辑器,你可以在其中输入密码,而无需将其记录在 shell 历史记录中。输入以下内容,将 `password` 替换为你的实际密码。 + +``` +set wifi-sec.psk password +save +quit +``` + +现在,你可以启动你的绑定接口以及你创建的辅助接口。 + +``` +sudo nmcli connection up bond0 +sudo nmcli connection up bond-ethernet +sudo nmcli connection up bond-wifi +``` + +你现在应该能够在不丢失网络连接的情况下断开有线或无线连接。 + +### 警告:使用其他 WiFi 网络时 + +在指定的 WiFi 网络间移动时,此配置很有效,但是当远离此网络时,那么绑定中使用的 SSID 就不可用了。从理论上讲,可以为每个使用的 WiFi 连接添加一个接口,但这似乎并不合理。相反,你可以禁用绑定接口: + +``` +sudo nmcli connection down bond0 +``` + +回到定义的 WiFi 网络时,只需按上述方式启动绑定接口即可。 + +### 微调你的绑定 + +默认情况下,绑定接口使用“轮询round-robin”模式。这会在接口上平均分配负载。但是,如果你有有线和无线连接,你可能希望更喜欢有线连接。 `active-backup` 模式能实现此功能。你可以在创建接口时指定模式和主接口,或者之后使用此命令(绑定接口应该关闭): + +``` +sudo nmcli connection modify bond0 +bond.options "mode=active-backup,primary=enp12s0u1" +``` + +[内核文档][5]提供了有关绑定选项的更多信息。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/bond-wifi-and-ethernet-for-easier-networking-mobility/ + +作者:[Ben Cotton][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://fedoramagazine.org/author/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/networkingmobility-816x345.jpg +[2]: https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html +[3]: https://en.wikipedia.org/wiki/Master/slave_(technology)#Terminology_concerns +[4]: https://en.wikipedia.org/wiki/Wi-Fi_Protected_Access#Target_users_(authentication_key_distribution) +[5]: https://www.kernel.org/doc/Documentation/networking/bonding.txt diff --git a/published/201907/20190717 How to install Kibana on MacOS.md b/published/201907/20190717 How to install Kibana on MacOS.md new file mode 100644 index 0000000000..a4495adc46 --- /dev/null +++ b/published/201907/20190717 How to install Kibana on MacOS.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11135-1.html) +[#]: subject: (How to install Kibana on MacOS) +[#]: via: (https://opensource.com/article/19/7/installing-kibana-macos) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +如何在 MacOS 上安装 Kibana +====== + +> Elasticsearch 当安装好了之后,Kibana 插件可以为这个功能强大的搜索工具添加可视化功能。 + +![](https://img.linux.net.cn/data/attachment/album/201907/22/204048vl8t88y6q8988229.jpg) + +在我之前的文章中,我向 Mac 用户介绍了[安装 Elasticsearch][2] 的步骤,这是世界上最受欢迎的企业级搜索引擎。(这里有一篇针对 Linux 用户的[单独文章][3]。)其自然语言处理能力使得 Elasticsearch 在数据集中查找细节方面表现出色。一旦你发现了你需要的数据,如果你已经安装了 [Kibana][4],你可以将它提升到一个新的水平。 + +Kibana 是 Elasticsearch 的开源的数据可视化插件。当你在 Elasticsearch 中找到了数据,Kibana 就会帮助你将其放入折线图、[时间序列查询][5]、地理空间地图等。该工具非常适合于必须展示其研究成果的数据科学家,尤其是那些使用开源数据的人。 + +### 安装 Kibana + +你需要在 Elasticsearch 之外单独安装 Kibana。因为我安装了 Elasticsearch 7.1.1,所以我将安装 Kibana 1.1。版本的匹配非常重要,Kibana 需要针对相同版本的 Elasticsearch 节点运行。 (Kibana 运行在 node.js 上。) + +以下是我为 MacOS 安装 Kibana 7.1.1 时所遵循的步骤: + +1、确保 Elasticsearch 已下载并运行。如果需要,请参阅上一篇文章。 + +**注意**:你至少需要先安装 Elasticsearch 1.4.4 或更高版本才能使用 Kibana。这是因为你需要向 Kibana 提供要连接的 Elasticsearch 实例的 URL 以及你要搜索的 Elasticsearch 索引。通常,最好安装两者的最新版本。 + +2、单击[此处][6]下载 Kibana。你将看到如下的网页,它会提示你在**下载**部分的右上角下载 Kibana for Mac: + +![Download Kibana here.][7] + +3、在你的 `Downloads` 文件夹中,打开 .tar 文件以展开它。此操作将创建一个具有相同名称的文件夹(例如,`kibana-7.1.1-darwin-x86_64`)。 + +4、如果你希望 Kibana 放在另一个文件夹中,请立即移动它。 + +仔细检查 Elasticsearch 是否正在运行,如果没有,请在继续之前启动它。(如果你需要说明,请参阅上一篇文章。) + +### 打开 Kibana 插件 + +Elasticsearch 运行起来后,你现在可以启动 Kibana 了。该过程类似于启动 Elasticsearch: + +1、从 Mac 的 `Downloads` 文件夹(或 Kibana 移动到的新文件夹)里,打开 Kibana 文件夹(即 `~Downloads/kibana-7.1.1-darwin-x86_64`)。 + +2、打开 `bin` 子文件夹。 + +![The Kibana bin folder.][8] + +3、运行 `kibana-plugin`。你可能会遇到上一篇文章中出现的相同安全警告: +   +![Security warning][9] + +通常,如果收到此警告,请按照那篇文章中的说明清除警告并打开 Kibana。请注意,如果我在终端中没有运行 Elasticsearch 的情况下打开该插件,我会收到相同的安全警告。要解决此问题,如上一篇文章中所述,打开 Elasticsearch 并在终端中运行它。使用 GUI 启动 Elasticsearch 也应该打开终端。 + +然后,我右键单击 `kibana-plugin` 并选择“打开”。这个解决方案对我有用,但你可能需要尝试几次。 我的 Elasticsearch 聚会中的几个人在他们的设备上打开 Kibana 时遇到了一些麻烦。 + +### 更改 Kibana 的主机和端口号 + +Kibana 的默认设置将其配置为在 `localhost:5601` 上运行。你需要更新文件(在这个例子的情况下)`~Downloads/kibana-7.1.1-darwin-x86_64/config/kibana.yml` 以在运行 Kibana 之前更改主机或端口号。 + +![The Kibana config directory.][10] + +以下是我的 Elasticsearch 聚会组里配置 Kibana 时终端的样子,因此默认为 `http://localhost:9200`,这是查询 Elasticsearch 实例时使用的 URL: + +![Configuring Kibana's host and port connections.][11] + +### 从命令行运行 Kibana + +打开插件后,可以从命令行或 GUI 运行 Kibana。这是终端连接到 Elasticsearch 后的样子: + +![Kibana running once it's connected to Elasticsearch.][12] + +与 Elasticsearch 一样,Kibana 默认在前台运行。你可以按 `Ctrl-C` 来停止它。 + +### 总结 + +Elasticsearch 和 Kibana 是占用大量存储空间的大型软件包。有这么多人一次下载这两个软件包,当我的Elasticsearch 会员和我下载它们两个时,我平均要下载几分钟。这可能是由于 WiFi 不佳和/或用户数量太多,但如果发生同样的事情,请记住这种可能性。 + +之后,由于我的笔记本电脑存储空间不足,我无法上传我们正在使用的 JSON 文件。我能够按照讲师的可视化进行操作,但无法实时使用 Kibana。因此,在下载 Elasticsearch 和 Kibana 之前,请确保设备上有足够的空间(至少几千兆字节)来上传和使用这些工具搜索文件。 + +要了解有关 Kibana 的更多信息,他们的用户指南[简介][13]是理想的。(你可以根据你正在使用的 Kibana 版本配置该指南。)他们的演示还向你展示了如何[在几分钟内构建仪表板][14],然后进行首次部署。 + +玩得开心! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/installing-kibana-macos + +作者:[Lauren Maffeo][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/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://linux.cn/article-11125-1.html +[3]: https://opensource.com/article/19/7/installing-elasticsearch-and-kibana-linux +[4]: https://www.elastic.co/products/kibana +[5]: https://en.wikipedia.org/wiki/Time_series +[6]: https://www.elastic.co/downloads/kibana +[7]: https://opensource.com/sites/default/files/uploads/download_kibana.png (Download Kibana here.) +[8]: https://opensource.com/sites/default/files/uploads/kibana_bin_folder.png (The Kibana bin folder.) +[9]: https://opensource.com/sites/default/files/uploads/security_warning.png (Security warning) +[10]: https://opensource.com/sites/default/files/uploads/kibana_config_directory.png (The Kibana config directory.) +[11]: https://opensource.com/sites/default/files/uploads/kibana_host_port_config.png (Configuring Kibana's host and port connections.) +[12]: https://opensource.com/sites/default/files/uploads/kibana_running.png (Kibana running once it's connected to Elasticsearch.) +[13]: https://www.elastic.co/guide/en/kibana/7.2/introduction.html +[14]: https://www.elastic.co/webinars/getting-started-kibana?baymax=rtp&elektra=docs&storm=top-video&iesrc=ctr diff --git a/published/201907/20190717 Mastering user groups on Linux.md b/published/201907/20190717 Mastering user groups on Linux.md new file mode 100644 index 0000000000..99c57b5d45 --- /dev/null +++ b/published/201907/20190717 Mastering user groups on Linux.md @@ -0,0 +1,219 @@ +[#]: collector: (lujun9972) +[#]: translator: (0x996) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11148-1.html) +[#]: subject: (Mastering user groups on Linux) +[#]: via: (https://www.networkworld.com/article/3409781/mastering-user-groups-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +掌握 Linux 用户组 +====== + +> 在 Linux 系统中管理用户组并不费力,但相关命令可能比你所知的更为灵活。 + +![Scott 97006 \(CC BY 2.0\)][1] + +在 Linux 系统中用户组起着重要作用。用户组提供了一种简单方法供一组用户互相共享文件。用户组也允许系统管理员更加有效地管理用户权限,因为管理员可以将权限分配给用户组而不是逐一分配给单个用户。 + +尽管通常只要在系统中添加用户账户就会创建用户组,关于用户组如何工作以及如何运用用户组还有很多需要了解的。 + +### 一个用户一个用户组? + +Linux 系统中多数用户账户被设为用户名与用户组名相同。用户 `jdoe` 会被赋予一个名为 `jdoe` 的用户组,且成为该新建用户组的唯一成员。如本例所示,该用户的登录名,用户 id 和用户组 id 在新建账户时会被添加到 `/etc/passwd` 和 `/etc/group` 文件中: + +``` +$ sudo useradd jdoe +$ grep jdoe /etc/passwd +jdoe:x:1066:1066:Jane Doe:/home/jdoe:/bin/sh +$ grep jdoe /etc/group +jdoe:x:1066: +``` + +这些文件中的配置使系统得以在文本(`jdoe`)和数字(`1066`)这两种用户 id 形式之间互相转换—— `jdoe` 就是 `1006`,且 `1006` 就是 `jdoe`。 + +分配给每个用户的 UID(用户 id)和 GID(用户组 id)通常是一样的,并且顺序递增。若上例中 Jane Doe 是最近添加的用户,分配给下一个新用户的用户 id 和用户组 id 很可能都是 1067。 + +### GID = UID? + +UID 和 GID 可能不一致。例如,如果你用 `groupadd` 命令添加一个用户组而不指定用户组 id,系统会分配下一个可用的用户组 id(在本例中为 1067)。下一个添加到系统中的用户其 UID 会是 1067 而 GID 则为 1068。 + +你可以避免这个问题,方法是添加用户组的时候指定一个较小的用户组 id 而不是接受默认值。在下面的命令中我们添加一个用户组并提供一个 GID,这个 GID 小于用于用户账户的 GID 取值范围。 + +``` +$ sudo groupadd -g 500 devops +``` + +创建账户时你可以指定一个共享用户组,如果这样对你更合适的话。例如你可能想把新来的开发人员加入同一个 DevOps 用户组而不是一人一个用户组。 + +``` +$ sudo useradd -g staff bennyg +$ grep bennyg /etc/passwd +bennyg:x:1064:50::/home/bennyg:/bin/sh +``` + +### 主要用户组和次要用户组 + +用户组实际上有两种:主要用户组primary group次要用户组secondary group。 + +主要用户组是保存在 `/etc/passwd` 文件中的用户组,该用户组在账户创建时配置。当用户创建一个文件时,用户的主要用户组与此文件关联。 + +``` +$ whoami +jdoe +$ grep jdoe /etc/passwd +jdoe:x:1066:1066:John Doe:/home/jdoe:/bin/bash + ^ + | + +-------- 主要用户组 +$ touch newfile +$ ls -l newfile +-rw-rw-r-- 1 jdoe jdoe 0 Jul 16 15:22 newfile + ^ + | + +-------- 主要用户组 +``` + +用户一旦拥有账户之后被加入的那些用户组是次要用户组。次要用户组成员关系在 `/etc/group` 文件中显示。 + +``` +$ grep devops /etc/group +devops:x:500:shs,jadep + ^ + | + +-------- shs 和 jadep 的次要用户组 +``` + +`/etc/group` 文件给用户组分配组名称(例如 `500` = `devops`)并记录次要用户组成员。 + +### 首选的准则 + +每个用户是他自己的主要用户组成员,并可以成为任意多个次要用户组成员,这样的一种准则允许用户更加容易地将个人文件和需要与同事分享的文件分开。当用户创建一个文件时,用户所属的不同用户组的成员不一定有访问权限。用户必须用 `chgrp` 命令将文件和次要用户组关联起来。 + +### 哪里也不如自己的家目录 + +添加新账户时一个重要的细节是 `useradd` 命令并不一定为新用户添加一个家目录/home家目录。若你只有某些时候想为用户添加家目录,你可以在 `useradd` 命令中加入 `-m` 选项(可以把它想象成“安家”选项)。 + +``` +$ sudo useradd -m -g devops -c "John Doe" jdoe2 +``` + +此命令中的选项如下: + +* `-m` 创建家目录并在其中生成初始文件 +* `-g` 指定用户归属的用户组 +* `-c` 添加账户描述信息(通常是用户的姓名) + +若你希望总是创建家目录,你可以编辑 `/etc/login.defs` 文件来更改默认工作方式。更改或添加 `CREATE_HOME` 变量并将其设置为 `yes`: + +``` +$ grep CREATE_HOME /etc/login.defs +CREATE_HOME yes +``` + +另一种方法是用自己的账户设置别名从而让 `useradd` 一直带有 `-m` 选项。 + +``` +$ alias useradd=’useradd -m’ +``` + +确保将该别名添加到你的 `~/.bashrc` 文件或类似的启动文件中以使其永久生效。 + +### 深入了解 /etc/login.defs + +下面这个命令可列出 `/etc/login.defs` 文件中的全部设置。下面的 `grep` 命令会隐藏所有注释和空行。 + +``` +$ cat /etc/login.defs | grep -v "^#" | grep -v "^$" +MAIL_DIR /var/mail +FAILLOG_ENAB yes +LOG_UNKFAIL_ENAB no +LOG_OK_LOGINS no +SYSLOG_SU_ENAB yes +SYSLOG_SG_ENAB yes +FTMP_FILE /var/log/btmp +SU_NAME su +HUSHLOGIN_FILE .hushlogin +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games +TTYGROUP tty +TTYPERM 0600 +ERASECHAR 0177 +KILLCHAR 025 +UMASK 022 +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 +UID_MIN 1000 +UID_MAX 60000 +GID_MIN 1000 +GID_MAX 60000 +LOGIN_RETRIES 5 +LOGIN_TIMEOUT 60 +CHFN_RESTRICT rwh +DEFAULT_HOME yes +CREATE_HOME yes <=== +USERGROUPS_ENAB yes +ENCRYPT_METHOD SHA512 +``` + +注意此文件中的各种设置会决定用户 id 的取值范围以及密码使用期限和其他设置(如 umask)。 + +### 如何显示用户所属的用户组 + +出于各种原因用户可能是多个用户组的成员。用户组成员身份给与用户对用户组拥有的文件和目录的访问权限,有时候这种工作方式是至关重要的。要生成某个用户所属用户组的清单,用 `groups` 命令即可。 + +``` +$ groups jdoe +jdoe : jdoe adm admin cdrom sudo dip plugdev lpadmin staff sambashare +``` + +你可以键入不带任何参数的 `groups` 命令来列出你自己的用户组。 + +### 如何添加用户至用户组 + +如果你想添加一个已有用户至别的用户组,你可以仿照下面的命令操作: + +``` +$ sudo usermod -a -G devops jdoe +``` + +你也可以指定逗号分隔的用户组列表来添加一个用户至多个用户组: + +``` +$ sudo usermod -a -G devops,mgrs jdoe +``` + +参数 `-a` 意思是“添加”,`-G` 指定用户组列表。 + +你可以编辑 `/etc/group` 文件将用户名从用户组成员名单中删除,从而将用户从用户组中移除。`usermod` 命令或许也有个选项用于从用户组中删除某个成员。 + +``` +fish:x:16:nemo,dory,shark + | + V +fish:x:16:nemo,dory +``` + +### 提要 + +添加和管理用户组并非特别困难,但长远来看配置账户时的一致性可使这项工作更容易些。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3409781/mastering-user-groups-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[0x996](https://github.com/0x996) +校对:[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://images.idgesg.net/images/article/2019/07/carrots-100801917-large.jpg +[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[3]: https://www.networkworld.com/article/3391029/must-know-linux-commands.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/20190718 Epic Games Backs Blender Foundation with -1.2m Epic MegaGrants.md b/published/201907/20190718 Epic Games Backs Blender Foundation with -1.2m Epic MegaGrants.md similarity index 100% rename from published/20190718 Epic Games Backs Blender Foundation with -1.2m Epic MegaGrants.md rename to published/201907/20190718 Epic Games Backs Blender Foundation with -1.2m Epic MegaGrants.md diff --git a/published/201907/20190722 How to run virtual machines with virt-manager.md b/published/201907/20190722 How to run virtual machines with virt-manager.md new file mode 100644 index 0000000000..32f1faea08 --- /dev/null +++ b/published/201907/20190722 How to run virtual machines with virt-manager.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11151-1.html) +[#]: subject: (How to run virtual machines with virt-manager) +[#]: via: (https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/) +[#]: author: (Marco Sarti https://fedoramagazine.org/author/msarti/) + +如何使用 virt-manager 运行虚拟机 +====== + +![][1] + +在早些年,在同一台笔记本中运行多个操作系统只能双启动。当时,这些操作系统很难同时运行或彼此交互。许多年过去了,在普通的 PC 上,可以通过虚拟化在一个系统中运行另一个系统。 + +最近的 PC 或笔记本(包括价格适中的笔记本电脑)都有硬件虚拟化,可以运行性能接近物理主机的虚拟机。 + +虚拟化因此变得常见,它可以用来测试操作系统、学习新技术、创建自己的家庭云、创建自己的测试环境等等。本文将指导你使用 Fedora 上的 Virt Manager 来设置虚拟机。 + +### 介绍 QEMU/KVM 和 Libvirt + +与所有其他 Linux 系统一样,Fedora 附带了虚拟化扩展支持。它由作为内核模块之一的 KVM(基于内核的虚拟机)提供支持。 + +QEMU 是一个完整的系统仿真器,它可与 KVM 协同工作,允许你使用硬件和外部设备创建虚拟机。 + +最后,[libvirt][2] 能让你管理基础设施的 API 层,即创建和运行虚拟机。 + +这三个技术都是开源的,我们将在 Fedora Workstation 上安装它们。 + +### 安装 + +#### 步骤 1:安装软件包 + +安装是一个相当简单的操作。 Fedora 仓库提供了 “virtualization” 软件包组,其中包含了你需要的所有包。 + +``` +sudo dnf install @virtualization +``` + +#### 步骤 2:编辑 libvirtd 配置 + +默认情况下,系统管理仅限于 root 用户,如果要启用常规用户,那么必须按以下步骤操作。 + +打开 `/etc/libvirt/libvirtd.conf` 进行编辑: + +``` +sudo vi /etc/libvirt/libvirtd.conf +``` + +将 UNIX 域套接字组所有者设置为 libvirt: + +``` +unix_sock_group = "libvirt" +``` + +调整 UNIX 域套接字的读写权限: + +``` +unix_sock_rw_perms = "0770" +``` + +#### 步骤 3:启动并启用 libvirtd 服务 + +``` +sudo systemctl start libvirtd +sudo systemctl enable libvirtd +``` + +#### 步骤 4:将用户添加到组 + +为了管理 libvirt 与普通用户,你必须将用户添加到 `libvirt` 组,否则每次启动 `virt-manager` 时,都会要求你输入 sudo 密码。 + +``` +sudo usermod -a -G libvirt $(whoami) +``` + +这会将当前用户添加到组中。你必须注销并重新登录才能应用更改。 + +### 开始使用 virt-manager + +可以通过命令行 (`virsh`) 或通过 `virt-manager` 图形界面管理 libvirt 系统。如果你想做虚拟机自动化配置,那么命令行非常有用,例如使用 [Ansible][3],但在本文中我们将专注于用户友好的图形界面。 + +`virt-manager` 界面很简单。主窗口显示连接列表,其中包括本地系统连接。 + +连接设置包括虚拟网络和存储定义。你可以定义多个虚拟网络,这些网络可用于在客户端系统之间以及客户端系统和主机之间进行通信。 + +### 创建你的第一个虚拟机 + +要开始创建新虚拟机,请按下主窗口左上角的按钮: + +![][4] + +向导的第一步需要选择安装模式。你可以选择本地安装介质、网络引导/安装或导入现有虚拟磁盘: + +![][5] + +选择本地安装介质,下一步将需要选择 ISO 镜像路径: + +![ ][6] + +随后的两个步骤能让你调整新虚拟机的 CPU、内存和磁盘大小。最后一步将要求你选择网络选项:如果你希望虚拟机通过 NAT 与外部隔离,请选择默认网络。如果你希望从外部访问虚拟机,那么选择桥接。请注意,如果选择桥接,那么虚拟机则无法与主机通信。 + +如果要在启动设置之前查看或更改配置,请选中“安装前自定义配置”: + +![][7] + +虚拟机配置窗口能让你查看和修改硬件配置。你可以添加磁盘、网络接口、更改引导选项等。满意后按“开始安装”: + +![][8] + +此时,你将被重定向到控制台来继续安装操作系统。操作完成后,你可以从控制台访问虚拟机: + +![][9] + +刚刚创建的虚拟机将出现在主窗口的列表中,你还能看到 CPU 和内存占用率的图表: + +![][10] + +libvirt 和 `virt-manager` 是功能强大的工具,它们可以以企业级管理为你的虚拟机提供出色的自定义。如果你需要更简单的东西,请注意 Fedora Workstation [预安装的 GNOME Boxes 已经能够满足基础的虚拟化要求][11]。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/ + +作者:[Marco Sarti][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://fedoramagazine.org/author/msarti/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/virt-manager-816x346.jpg +[2]: https://libvirt.org/ +[3]: https://fedoramagazine.org/get-the-latest-ansible-2-8-in-fedora/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-09-41-45.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-09-30-53.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-10-42-39.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-10-43-21.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-10-44-58.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-10-55-35.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/07/Screenshot-from-2019-07-14-11-09-22.png +[11]: https://fedoramagazine.org/getting-started-with-virtualization-in-gnome-boxes/ diff --git a/published/201907/20190723 Getting help for Linux shell built-ins.md b/published/201907/20190723 Getting help for Linux shell built-ins.md new file mode 100644 index 0000000000..490de661c7 --- /dev/null +++ b/published/201907/20190723 Getting help for Linux shell built-ins.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11158-1.html) +[#]: subject: (Getting help for Linux shell built-ins) +[#]: via: (https://www.networkworld.com/article/3410350/getting-help-for-linux-shell-built-ins.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +获取有关 Linux shell 内置命令的帮助 +====== + +> Linux 内置命令属于用户 shell 的一部分,本文将告诉你如何识别它们并获取使用它们的帮助。 + +![](https://img.linux.net.cn/data/attachment/album/201907/28/204915bj1wmhxeargx14lt.jpg) + +Linux 内置命令是内置于 shell 中的命令,很像内置于墙中的书架。与标准 Linux 命令存储在 `/usr/bin` 中的方式不同,你不会找到它们的独立文件,你可能使用过相当多的内置命令,但你不会感觉到它们与 `ls` 和 `pwd` 等命令有何不同。 + +内置命令与其他 Linux 命令一样使用,它们可能要比不属于 shell 的类似命令运行得快一些。Bash 内置命令包括 `alias`、`export` 和 `bg` 等。 + +正如你担心的那样,因为内置命令是特定于 shell 的,所以它们不会提供手册页。使用 `man` 来查看 `bg`,你会看到这样的东西: + +``` +$ man bg +No manual entry for bg +``` + +判断内置命令的另一个提示是当你使用 `which` 命令来识别命令的来源时,Bash 不会响应,表示没有与内置命令关联的文件: + +``` +$ which bg +$ +``` + +另一方面,如果你的 shell 是 `/bin/zsh`,你可能会得到一个更有启发性的响应: + +``` +% which bg +bg: shell built-in command +``` + +bash 提供了额外的帮助信息,但它是通过使用 `help` 命令实现的: + +``` +$ help bg +bg: bg [job_spec ...] + Move jobs to the background. + + Place the jobs identified by each JOB_SPEC in the background, as if they + had been started with `&'. If JOB_SPEC is not present, the shell's notion + of the current job is used. + + Exit Status: + Returns success unless job control is not enabled or an error occurs. +``` + +如果你想要查看 bash 提供的所有内置命令的列表,使用 `compgen -b` 命令。通过管道将命令输出到列中,以获得较好格式的清单。 + +``` +$ compgen -b | column +. compgen exit let return typeset +: complete export local set ulimit +[ compopt false logout shift umask +alias continue fc mapfile shopt unalias +bg declare fg popd source unset +bind dirs getopts printf suspend wait +break disown hash pushd test +builtin echo help pwd times +caller enable history read trap +cd eval jobs readarray true +command exec kill readonly type +``` + +如果你使用 `help` 命令,你将看到一个内置命令列表以及简短描述。但是,这个列表被截断了(以 `help` 命令结尾): + +``` +$ help +GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) +These shell commands are defined internally. Type `help' to see this list. +Type `help name' to find out more about the function `name'. +Use `info bash' to find out more about the shell in general. +Use `man -k' or `info' to find out more about commands not in this list. + +A star (*) next to a name means that the command is disabled. + + job_spec [&] history [-c] [-d offset] [n] or histo> + (( expression )) if COMMANDS; then COMMANDS; [ elif CO> + . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -> + : kill [-s sigspec | -n signum | -sigsp> + [ arg... ] let arg [arg ...] + [[ expression ]] local [option] name[=value] ... + alias [-p] [name[=value] ... ] logout [n] + bg [job_spec ...] mapfile [-d delim] [-n count] [-O ori> + bind [-lpsvPSVX] [-m keymap] [-f filen> popd [-n] [+N | -N] + break [n] printf [-v var] format [arguments] + builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir] + caller [expr] pwd [-LP] + case WORD in [PATTERN [| PATTERN]...) > read [-ers] [-a array] [-d delim] [-i> + cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] [-O o> + command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or> + compgen [-abcdefgjksuv] [-o option] [-> return [n] + complete [-abcdefgjksuv] [-pr] [-DEI] > select NAME [in WORDS ... ;] do COMMA> + compopt [-o|+o option] [-DEI] [name ..> set [-abefhkmnptuvxBCHP] [-o option-n> + continue [n] shift [n] + coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...] + declare [-aAfFgilnrtux] [-p] [name[=va> source filename [arguments] + dirs [-clpv] [+N] [-N] suspend [-f] + disown [-h] [-ar] [jobspec ... | pid . <p>'> test [expr] + echo [-neE] [arg ...] time [-p] pipeline + enable [-a] [-dnps] [-f filename] [nam> times + eval [arg ...] trap [-lp] [[arg] signal_spec ...] + exec [-cl] [-a name] [command [argumen> true + exit [n] type [-afptP] name [name ...] + export [-fn] [name[=value] ...] or exp> typeset [-aAfFgilnrtux] [-p] name[=va> + false ulimit [-SHabcdefiklmnpqrstuvxPT] [li> + fc [-e ename] [-lnr] [first] [last] or> umask [-p] [-S] [mode] + fg [job_spec] unalias [-a] name [name ...] + for NAME [in WORDS ... ] ; do COMMANDS> unset [-f] [-v] [-n] [name ...] + for (( exp1; exp2; exp3 )); do COMMAND> until COMMANDS; do COMMANDS; done + function name { COMMANDS ; } or name (> variables - Names and meanings of som> + getopts optstring name [arg] wait [-fn] [id ...] + hash [-lr] [-p pathname] [-dt] [name .> while COMMANDS; do COMMANDS; done + help [-dms] [pattern ...] { COMMANDS ; } +``` + +从上面的清单中可以看出,`help` 命令本身就是内置的。 + +你可以通过向 `help` 命令提供你感兴趣的内置命令名称来获取关于它们的更多信息,例如 `help dirs`: + +``` +$ help dirs +dirs: dirs [-clpv] [+N] [-N] + Display directory stack. + + Display the list of currently remembered directories. Directories + find their way onto the list with the `pushd' command; you can get + back up through the list with the `popd' command. + + Options: + -c clear the directory stack by deleting all of the elements + -l do not print tilde-prefixed versions of directories relative + to your home directory + -p print the directory stack with one entry per line + -v print the directory stack with one entry per line prefixed + with its position in the stack + + Arguments: + +N Displays the Nth entry counting from the left of the list + shown by dirs when invoked without options, starting with + zero. + + -N Displays the Nth entry counting from the right of the list + shown by dirs when invoked without options, starting with + zero. + + Exit Status: + Returns success unless an invalid option is supplied or an error occurs. +``` + +内置命令提供了每个 shell 的大部分功能。你使用的任何 shell 都有一些内置命令,但是如何获取这些内置命令的信息可能因 shell 而异。例如,对于 `zsh`,你可以使用 `man zshbuiltins` 命令获得其内置命令的描述。 + +``` +$ man zshbuiltins + +ZSHBUILTINS(1) General Commands Manual ZSHBUILTINS(1) + +NAME + zshbuiltins - zsh built-in commands + +SHELL BUILTIN COMMANDS + Some shell builtin commands take options as described in individual en‐ + tries; these are often referred to in the list below as `flags' to avoid + confusion with shell options, which may also have an effect on the behav‐ + iour of builtin commands. In this introductory section, `option' always + has the meaning of an option to a command that should be familiar to most + command line users. +… +``` + +在这个冗长的手册页中,你将找到一个内置命令列表,其中包含有用的描述,如下摘录中所示: + +``` +bg [ job ... ] +job ... & + Put each specified job in the background, or the current job if + none is specified. + +bindkey + See the section `Zle Builtins' in zshzle(1). + +break [ n ] + Exit from an enclosing for, while, until, select or repeat loop. + If an arithmetic expression n is specified, then break n levels + instead of just one. +``` + +### 最后 + +Linux 内置命令对于每个 shell 都很重要,它的操作类似特定于 shell 的命令一样。如果你经常使用不同的 shell,并注意到你经常使用的某些命令似乎不存在或者不能按预期工作,那么它可能是你使用的其他 shell 之一中的内置命令。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3410350/getting-help-for-linux-shell-built-ins.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/07/linux_penguin-100802549-large.jpg +[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[3]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/201907/20190723 How to Create a User Account Without useradd Command in Linux.md b/published/201907/20190723 How to Create a User Account Without useradd Command in Linux.md new file mode 100644 index 0000000000..3bc9a26c39 --- /dev/null +++ b/published/201907/20190723 How to Create a User Account Without useradd Command in Linux.md @@ -0,0 +1,112 @@ +[#]: collector: "lujun9972" +[#]: translator: "hello-wn" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11156-1.html" +[#]: subject: "How to Create a User Account Without useradd Command in Linux?" +[#]: via: "https://www.2daygeek.com/linux-user-account-creation-in-manual-method/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" + +在 Linux 中不使用 useradd 命令如何创建用户账号 +======== + +Linux 中有三个命令可以用来创建用户账号。你尝试过在 Linux 中手动创建用户吗?我的意思是不使用上面说的三个命令。 + +如果你不知道怎么做,本文可以手把手教你,并向你展示细节部分。 + +你可能想,这怎么可能?别担心,正如我们多次提到的那样,在 Linux 上任何事都可以搞定。这只是其中一例。 + +是的,我们可以做到的。想了解更多吗? + +- [在 Linux 中创建用户的三种方法][1] +- [在 Linux 中批量创建用户的两种方法][2] + +话不多说,让我们开始吧。 + +首先,我们要找出最后创建的 UID 和 GID 信息。 掌握了这些信息之后,就可以继续下一步。 + +``` +# cat /etc/passwd | tail -1 +tuser1:x:1153:1154:Test User:/home/tuser1:/bin/bash +``` + +根据以上输出,最后创建的用户 UID 是 1153,GID 是 1154。为了试验,我们将在系统中添加 `tuser2` 用户。 + +现在,在`/etc/passwd` 文件中添加一条用户信息。 总共七个字段,你需要添加一些必要信息。 + +``` ++-----------------------------------------------------------------------+ +|username:password:UID:GID:Comments:User Home Directory:User Login Shell| ++-----------------------------------------------------------------------+ + | | | | | | | + 1 2 3 4 5 6 7 +``` + +1. 用户名:这个字段表示用户名称。字符长度必须在 1 到 32 之间。 +2. 密码(`x`):表示存储在 `/etc/shadow` 文件中的加密密码。 +3. 用户 ID:表示用户的 ID(UID),每个用户都有独一无二的 UID。UID 0 保留给 root 用户,UID 1-99 保留给系统用户,UID 100-999 保留给系统账号/组。 +4. 组 ID:表示用户组的 ID(GID),每个用户组都有独一无二的 GID,存储在 `/etc/group` 文件中。 +5. 注释/用户 ID 信息:这个字段表示备注,用于描述用户信息。 +6. 主目录(`/home/$USER`):表示用户的主目录。 +7. shell(`/bin/bash`):表示用户使用的 shell。 + +在文件最后添加用户信息。 + +``` +# vi /etc/passwd + +tuser2:x:1154:1155:Test User2:/home/tuser2:/bin/bash +``` + +你需要创建相同名字的用户组。同样地,在 `/etc/group` 文件中添加用户组信息。 + +``` +# vi /etc/group + +tuser2:x:1155: +``` + +做完以上两步之后,给用户设置一个密码。 + +``` +# passwd tuser2 + +Changing password for user tuser2. +New password: +Retype new password: +passwd: all authentication tokens updated successfully. +``` + +最后,试着登录新创建的用户。 + +``` +# ssh [email protected] + +[email protected]'s password: +Creating directory '/home/tuser2'. + +$ls -la + +total 16 +drwx------. 2 tuser2 tuser2 59 Jun 17 09:46 . +drwxr-xr-x. 15 root root 4096 Jun 17 09:46 .. +-rw-------. 1 tuser2 tuser2 18 Jun 17 09:46 .bash_logout +-rw-------. 1 tuser2 tuser2 193 Jun 17 09:46 .bash_profile +-rw-------. 1 tuser2 tuser2 231 Jun 17 09:46 .bashrc +``` + +------ + +via: https://www.2daygeek.com/linux-user-account-creation-in-manual-method/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[hello-wn](https://github.com/hello-wn) +校对:[wxy](https://github.com/wxy) + +本文由 [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/linux-user-account-creation-useradd-adduser-newusers/ +[2]: https://www.2daygeek.com/linux-bulk-users-creation-useradd-newusers/ diff --git a/published/201907/20190724 Master the Linux -ls- command.md b/published/201907/20190724 Master the Linux -ls- command.md new file mode 100644 index 0000000000..3744fa3906 --- /dev/null +++ b/published/201907/20190724 Master the Linux -ls- command.md @@ -0,0 +1,328 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11159-1.html) +[#]: subject: (Master the Linux 'ls' command) +[#]: via: (https://opensource.com/article/19/7/master-ls-command) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +精通 Linux 的 ls 命令 +====== + +> Linux 的 ls 命令拥有数量惊人的选项,可以提供有关文件的重要信息。 + +![](https://img.linux.net.cn/data/attachment/album/201907/29/105754ii3874q2ww7lo882.jpg) + +`ls` 命令可以列出一个 [POSIX][2] 系统上的文件。这是一个简单的命令,但它经常被低估,不是它能做什么(因为它确实只做了一件事),而是你该如何优化对它的使用。 + +要知道在最重要的 10 个终端命令中,这个简单的 `ls` 命令可以排进前三,因为 `ls` 不会*只是*列出文件,它还会告诉你有关它们的重要信息。它会告诉你诸如拥有文件或目录的人、每个文件修改的时间、甚至是什么类型的文件。它的附带功能能让你了解你在哪里、附近有些什么,以及你可以用它们做什么。 + +如果你对 `ls` 的体验仅限于你的发行版在 `.bashrc` 中的别名,那么你可能错失了它。 + +### GNU 还是 BSD? + +在了解 `ls` 的隐藏能力之前,你必须确定你正在运行哪个 `ls` 命令。有两个最流行的版本:包含在 GNU coreutils 包中的 GNU 版本,以及 BSD 版本。如果你正在运行 Linux,那么你很可能已经安装了 GNU 版本的 `ls`(LCTT 译注:几乎可以完全确定)。如果你正在运行 BSD 或 MacOS,那么你有的是 BSD 版本。本文会介绍它们的不同之处。 + +你可以使用 `--version` 选项找出你计算机上的版本: + +``` +$ ls --version +``` + +如果它返回有关 GNU coreutils 的信息,那么你拥有的是 GNU 版本。如果它返回一个错误,你可能正在运行的是 BSD 版本(运行 `man ls | head` 以确定)。 + +你还应该调查你的发行版可能具有哪些预设选项。终端命令的自定义通常放在 `$HOME/.bashrc` 或 `$HOME/.bash_aliases` 或 `$HOME/.profile` 中,它们是通过将 `ls` 别名化为更复杂的 `ls` 命令来完成的。例如: + +``` +alias ls='ls --color' +``` + +发行版提供的预设非常有用,但它们确实很难分辨出哪些是 `ls` 本身的特性,哪些是它的附加选项提供的。你要是想要运行 `ls` 命令本身而不是它的别名,你可以用反斜杠“转义”命令: + +``` +$ \ls +``` + +### 分类 + +单独运行 `ls` 会以适合你终端的列数列出文件: + +``` +$ ls ~/example +bunko        jdk-10.0.2 +chapterize   otf2ttf.ff +despacer     overtar.sh +estimate.sh  pandoc-2.7.1 +fop-2.3      safe_yaml +games        tt +``` + +这是有用的信息,但所有这些文件看起来基本相同,没有方便的图标来快速表示出哪个是目录、文本文件或图像等等。 + +使用 `-F`(或 GNU 上的长选项 `--classify`)以在每个条目之后显示标识文件类型的指示符: + +``` +$ ls ~/example +bunko         jdk-10.0.2/ +chapterize*   otf2ttf.ff* +despacer*     overtar.sh* +estimate.sh   pandoc@ +fop-2.3/      pandoc-2.7.1/ +games/        tt* +``` + +使用此选项,终端中列出的项目使用简写符号来按文件类型分类: + +* 斜杠(`/`)表示目录(或“文件夹”)。 +* 星号(`*`)表示可执行文件。这包括二进制文件(编译代码)以及脚本(具有[可执行权限][3]的文本文件)。 +* 符号(`@`)表示符号链接(或“别名”)。 +* 等号(`=`)表示套接字。 +* 在 BSD 上,百分号(`%`)表示涂改whiteout(某些文件系统上的文件删除方法)。 +* 在 GNU 上,尖括号(`>`)表示door([Illumos][4] 和 Solaris上的进程间通信)。 +* 竖线(`|`)表示 [FIFO][5] 管道。 +   +这个选项的一个更简单的版本是 `-p`,它只区分文件和目录。 + +(LCTT 译注:在支持彩色的终端上,使用 `--color` 选项可以以不同的颜色来区分文件类型,但要注意如果将输出导入到管道中,则颜色消失。) + +### 长列表 + +从 `ls` 获取“长列表”的做法是如此常见,以至于许多发行版将 `ll` 别名为 `ls -l`。长列表提供了许多重要的文件属性,例如权限、拥有每个文件的用户、文件所属的组、文件大小(以字节为单位)以及文件上次更改的日期: + +``` +$ ls -l +-rwxrwx---. 1 seth users         455 Mar  2  2017 estimate.sh +-rwxrwxr-x. 1 seth users         662 Apr 29 22:27 factorial +-rwxrwx---. 1 seth users    20697793 Jun 29  2018 fop-2.3-bin.tar.gz +-rwxrwxr-x. 1 seth users        6210 May 22 10:22 geteltorito +-rwxrwx---. 1 seth users         177 Nov 12  2018 html4mutt.sh +[...] +``` + +如果你不想以字节为单位,请添加 `-h` 标志(或 GNU 中的 `--human`)以将文件大小转换为更加人性化的表示方法: + +``` +$ ls --human +-rwxrwx---. 1 seth users    455 Mar  2  2017 estimate.sh +-rwxrwxr-x. 1 seth seth     662 Apr 29 22:27 factorial +-rwxrwx---. 1 seth users    20M Jun 29  2018 fop-2.3-bin.tar.gz +-rwxrwxr-x. 1 seth seth    6.1K May 22 10:22 geteltorito +-rwxrwx---. 1 seth users    177 Nov 12  2018 html4mutt.sh +``` + +要看到更少的信息,你可以带有 `-o` 选项只显示所有者的列,或带有 `-g` 选项只显示所属组的列: + +``` +$ ls -o +-rwxrwx---. 1 seth    455 Mar  2  2017 estimate.sh +-rwxrwxr-x. 1 seth    662 Apr 29 22:27 factorial +-rwxrwx---. 1 seth    20M Jun 29  2018 fop-2.3-bin.tar.gz +-rwxrwxr-x. 1 seth   6.1K May 22 10:22 geteltorito +-rwxrwx---. 1 seth    177 Nov 12  2018 html4mutt.sh +``` + +也可以将两个选项组合使用以显示两者。 + +### 时间和日期格式 + +`ls` 的长列表格式通常如下所示: + +``` +-rwxrwx---. 1 seth users         455 Mar  2  2017 estimate.sh +-rwxrwxr-x. 1 seth users         662 Apr 29 22:27 factorial +-rwxrwx---. 1 seth users    20697793 Jun 29  2018 fop-2.3-bin.tar.gz +-rwxrwxr-x. 1 seth users        6210 May 22 10:22 geteltorito +-rwxrwx---. 1 seth users         177 Nov 12  2018 html4mutt.sh +``` + +月份的名字不便于排序,无论是通过计算还是识别(取决于你的大脑是否倾向于喜欢字符串或整数)。你可以使用 `--time-style` 选项和格式名称更改时间戳的格式。可用格式为: + +* `full-iso`:ISO 完整格式(1970-01-01 21:12:00) +* `long-iso`:ISO 长格式(1970-01-01 21:12) +* `iso`:iso 格式(01-01 21:12) +* `locale`:本地化格式(使用你的区域设置) +* `posix-STYLE`:POSIX 风格(用区域设置定义替换 `STYLE`) + +你还可以使用 `date` 命令的正式表示法创建自定义样式。 + +### 按时间排序 + +通常,`ls` 命令按字母顺序排序。你可以使用 `-t` 选项根据文件的最近更改的时间(最新的文件最先列出)进行排序。 + +例如: + +``` +$ touch foo bar baz +$ ls +bar  baz  foo +$ touch foo +$ ls -t +foo bar baz +``` + +### 列出方式 + +`ls` 的标准输出平衡了可读性和空间效率,但有时你需要按照特定方式排列的文件列表。 + +要以逗号分隔文件列表,请使用 `-m`: + +``` +ls -m ~/example +bar, baz, foo +``` + +要强制每行一个文件,请使用 `-1` 选项(这是数字 1,而不是小写的 L): + +``` +$ ls -1 ~/bin/ +bar +baz +foo +``` + +要按文件扩展名而不是文件名对条目进行排序,请使用 `-X`(这是大写 X): + +``` +$ ls +bar.xfc  baz.txt  foo.asc +$ ls -X +foo.asc  baz.txt  bar.xfc +``` + +### 隐藏杂项 + +在某些 `ls` 列表中有一些你可能不关心的条目。例如,元字符 `.` 和 `..` 分别代表“本目录”和“父目录”。如果你熟悉在终端中如何切换目录,你可能已经知道每个目录都将自己称为 `.`,并将其父目录称为 `..`,因此当你使用 `-a` 选项显示隐藏文件时并不需要它经常提醒你。 + +要显示几乎所有隐藏文件(`.` 和 `..` 除外),请使用 `-A` 选项: + +``` +$ ls -a +. +.. +.android +.atom +.bash_aliases +[...] +$ ls -A +.android +.atom +.bash_aliases +[...] +``` + +有许多优秀的 Unix 工具有保存备份文件的传统,它们会在保存文件的名称后附加一些特殊字符作为备份文件。例如,在 Vim 中,备份会以在文件名后附加 `~` 字符的文件名保存。 + +这些类型的备份文件已经多次使我免于愚蠢的错误,但是经过多年享受它们提供的安全感后,我觉得不需要用视觉证据来证明它们存在。我相信 Linux 应用程序可以生成备份文件(如果它们声称这样做的话),我很乐意相信它们存在 —— 而不用必须看到它们。 + +要隐藏备份文件,请使用 `-B` 或 `--ignore-backups` 隐藏常用备份格式(此选项在 BSD 的 `ls` 中不可用): + +``` +$ ls +bar.xfc  baz.txt  foo.asc~  foo.asc +$ ls -B +bar.xfc  baz.txt  foo.asc +``` + +当然,备份文件仍然存在;它只是过滤掉了,你不必看到它。 + +除非另有配置,GNU Emacs 在文件名的开头和结尾添加哈希字符(`#`)来保存备份文件(`#file#`)。其他应用程序可能使用不同的样式。使用什么模式并不重要,因为你可以使用 `--hide` 选项创建自己的排除项: + +``` +$ ls +bar.xfc  baz.txt  #foo.asc#  foo.asc +$ ls --hide="#*#" +bar.xfc  baz.txt  foo.asc +``` + +### 递归地列出目录 + +除非你在指定目录上运行 `ls`,否则子目录的内容不会与 `ls` 命令一起列出: + +``` +$ ls -F +example/  quux*  xyz.txt +$ ls -R +quux  xyz.txt + +./example: +bar.xfc  baz.txt  #foo.asc#  foo.asc +``` + +### 使用别名使其永久化 + +`ls` 命令可能是 shell 会话期间最常使用的命令。这是你的眼睛和耳朵,为你提供上下文信息和确认命令的结果。虽然有很多选项很有用,但 `ls` 之美的一部分就是简洁:两个字符和回车键,你就知道你到底在哪里以及附近有什么。如果你不得不停下思考(更不用说输入)几个不同的选项,它会变得不那么方便,所以通常情况下,即使最有用的选项也不会用了。 + +解决方案是为你的 `ls` 命令添加别名,以便在使用它时,你可以获得最关心的信息。 + +要在 Bash shell 中为命令创建别名,请在主目录中创建名为 `.bash_aliases` 的文件(必须在开头包含 `.`)。 在此文件中,列出要创建的别名,然后是要为其创建别名的命令。例如: + +``` +alias ls='ls -A -F -B --human --color' +``` + +这一行导致你的 Bash shell 将 `ls` 命令解释为 `ls -A -F -B --human --color`。 + +你不必仅限于重新定义现有命令,还可以创建自己的别名: + +``` +alias ll='ls -l' +alias la='ls -A' +alias lh='ls -h' +``` + +要使别名起作用,shell 必须知道 `.bash_aliases` 配置文件存在。在编辑器中打开 `.bashrc` 文件(如果它不存在则创建它),并包含以下代码块: + +``` +if [ -e $HOME/.bash_aliases ]; then +    source $HOME/.bash_aliases +fi +``` + +每次加载 `.bashrc`(这是一个新的 Bash shell 启动的时候),Bash 会将 `.bash_aliases` 加载到你的环境中。你可以关闭并重新启动 Bash 会话,或者直接强制它执行此操作: + +``` +$ source ~/.bashrc +``` + +如果你忘了你是否有别名命令,`which` 命令可以告诉你: + +``` +$ which ls +alias ls='ls -A -F -B --human --color' +        /usr/bin/ls +``` + +如果你将 `ls` 命令别名为带有选项的 `ls` 命令,则可以通过将反斜杠前缀到 `ls` 前来覆盖你的别名。例如,在示例别名中,使用 `-B` 选项隐藏备份文件,这意味着无法使用 `ls` 命令显示备份文件。 可以覆盖该别名以查看备份文件: + +``` +$ ls +bar  baz  foo +$ \ls +bar  baz  baz~  foo +``` + +### 做一件事,把它做好 + +`ls` 命令有很多选项,其中许多是特定用途的或高度依赖于你所使用的终端。在 GNU 系统上查看 `info ls`,或在 GNU 或 BSD 系统上查看 `man ls` 以了解更多选项。 + +你可能会觉得奇怪的是,一个以每个工具“做一件事,把它做好”的前提而闻名的系统会让其最常见的命令背负 50 个选项。但是 `ls` 只做一件事:它列出文件,而这 50 个选项允许你控制接收列表的方式,`ls` 的这项工作做得非常、*非常*好。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/master-ls-command + +作者:[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/sethhttps://opensource.com/users/sambocettahttps://opensource.com/users/scottnesbitthttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/sethhttps://opensource.com/users/don-watkinshttps://opensource.com/users/sethhttps://opensource.com/users/jamesfhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/19/6/understanding-linux-permissions +[4]: https://www.illumos.org/ +[5]: https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics) diff --git a/published/201907/20190724 WPS Office on Linux is a Free Alternative to Microsoft Office.md b/published/201907/20190724 WPS Office on Linux is a Free Alternative to Microsoft Office.md new file mode 100644 index 0000000000..1b74136442 --- /dev/null +++ b/published/201907/20190724 WPS Office on Linux is a Free Alternative to Microsoft Office.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11170-1.html) +[#]: subject: (WPS Office on Linux is a Free Alternative to Microsoft Office) +[#]: via: (https://itsfoss.com/wps-office-linux/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +WPS Office:Linux 上的 Microsoft Office 的免费替代品 +====== + +> 如果你在寻找 Linux 上 Microsoft Office 免费替代品,那么 WPS Office 是最佳选择之一。它可以免费使用,并兼容 MS Office 文档格式。 + +[WPS Office][1] 是一个跨平台的办公生产力套件。它轻巧,并且与 Microsoft Office、Google Docs/Sheets/Slide 和 Adobe PDF 完全兼容。 + +对于许多用户而言,WPS Office 足够直观,并且能够满足他们的需求。由于它在外观和兼容性方面与 Microsoft Office 非常相似,因此广受欢迎。 + +![WPS Office 2019 All In One Mode][2] + +WPS office 由中国的金山公司创建。对于 Windows 用户而言,WPS Office 有免费版和高级版。对于 Linux 用户,WPS Office 可通过其[社区项目][3]免费获得。 + +> **非 FOSS 警告!** + +> WPS Office 不是一个开源软件。因为它对于 Linux 用户免费使用,我们已经在这介绍过它,有时我们也会介绍即使不是开源的 Linux 软件。 + +### Linux 上的 WPS Office + +![WPS Office in Linux | Image Credit: Ubuntu Handbook][4] + +WPS Office 有四个主要组件: + + * WPS 文字 + * WPS 演示 + * WPS 表格 + * WPS PDF + +WPS Office 与 MS Office 完全兼容,支持 .doc、.docx、.dotx、.ppt、.pptx、.xls、.xlsx、.docm、.dotm、.xml、.txt、.html、.rtf (等其他),以及它自己的格式(.wps、.wpt)。它还默认包含 Microsoft 字体(以确保兼容性),它可以导出 PDF 并提供超过 10 种语言的拼写检查功能。 + +但是,它在 ODT、ODP 和其他开放文档格式方面表现不佳。 + +三个主要的 WPS Office 应用都有与 Microsoft Office 非常相似的界面,都有相同的 Ribbon UI。尽管存在细微差别,但使用习惯仍然相对一致。你可以使用 WPS Office 轻松克隆任何 Microsoft Office/LibreOffice 文档。 + +![WPS Office Writer][5] + +你可能唯一不喜欢的是一些默认的样式设置(一些标题下面有很多空间等),但这些可以很容易地调整。 + +默认情况下,WPS 以 .docx、.pptx 和 .xlsx 文件类型保存文件。你还可以将文档保存到 **[WPS 云][7]**中并与他人协作。另一个不错的功能是能从[这里][8]下载大量模板。 + +### 在 Linux 上安装 WPS Office + +WPS 为 Linux 发行版提供 DEB 和 RPM 安装程序。如果你使用的是 Debian/Ubuntu 或基于 Fedora 的发行版,那么安装 WPS Office 就简单了。 + +你可以在下载区那下载 Linux 中的 WPS: + +- [下载 WPS Office for Linux][9] + +向下滚动,你将看到最新版本包的链接: + +![WPS Office Download][10] + +下载适合你发行版的文件。只需双击 DEB 或者 RPM 就能[安装它们][11]。这会打开软件中心,你将看到安装选项: + +![WPS Office Install Package][12] + +几秒钟后,应用应该成功安装到你的系统上了! + +你现在可以在“应用程序”菜单中搜索 **WPS**,查找 WPS Office 套件中所有的应用: + +![WPS Applications Menu][13] + +### 你是否使用 WPS Office 或其他软件? + +还有其他 [Microsoft Office 的开源替代方案][14],但它们与 MS Office 的兼容性很差。 + +就个人而言,我更喜欢 LibreOffice,但如果你必须要用到 Microsoft Office,你可以尝试在 Linux 上使用 WPS Office。它看起来和 MS Office 类似,并且与 MS 文档格式具有良好的兼容性。它在 Linux 上是免费的,因此你也不必担心 Office 365 订阅。 + +你在系统上使用什么办公套件?你曾经在 Linux 上使用过 WPS Office 吗?你的体验如何? + +---------------------------------------------------------------------------- + +via: https://itsfoss.com/wps-office-linux/ + +作者:[Sergiu][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://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.wps.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/wps2019-all-in-one-mode.png?resize=800%2C526&ssl=1 +[3]: http://wps-community.org/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/wps-2019-Linux.jpg?resize=800%2C450&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/wps-office-writer.png?resize=800%2C454&ssl=1 +[7]: https://account.wps.com/?cb=https%3A%2F%2Fdrive.wps.com%2F +[8]: https://template.wps.com/ +[9]: http://wps-community.org/downloads +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/wps_office_download.jpg?fit=800%2C413&ssl=1 +[11]: https://itsfoss.com/install-deb-files-ubuntu/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/wps_office_install_package.png?fit=800%2C719&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/wps_applications_menu.jpg?fit=800%2C355&ssl=1 +[14]: https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ diff --git a/published/201907/20190725 How to Enable Canonical Kernel Livepatch Service on Ubuntu LTS System.md b/published/201907/20190725 How to Enable Canonical Kernel Livepatch Service on Ubuntu LTS System.md new file mode 100644 index 0000000000..ebda41f03c --- /dev/null +++ b/published/201907/20190725 How to Enable Canonical Kernel Livepatch Service on Ubuntu LTS System.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11152-1.html) +[#]: subject: (How to Enable Canonical Kernel Livepatch Service on Ubuntu LTS System?) +[#]: via: (https://www.2daygeek.com/enable-canonical-kernel-livepatch-service-on-ubuntu-lts-system/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Ubuntu LTS 系统上启用 Canonical 的内核实时补丁服务 +====== + +![](https://img.linux.net.cn/data/attachment/album/201907/27/072251d3dij23lndtuutzr.jpg) + +Canonical 在 Ubuntu 14.04 LTS 系统中引入了内核实时补丁服务Kernel Livepatch Service。实时补丁服务允许你安装和应用关键的 Linux 内核安全更新,而无需重新启动系统。这意味着,在应用内核补丁程序后,你无需重新启动系统。而通常情况下,我们需要在安装内核补丁后重启 Linux 服务器才能供系统使用。 + +实时修补非常快。大多数内核修复程序只需要几秒钟。Canonical 的实时补丁服务对于不超过 3 个系统的用户无需任何费用。你可以通过命令行在桌面和服务器中启用 Canonical 实时补丁服务。 + +这个实时补丁系统旨在解决高级和关键的 Linux 内核安全漏洞。 + +有关[支持的系统][1]和其他详细信息,请参阅下表。 + +Ubuntu 版本 | 架构 | 内核版本 | 内核变体 +---|---|---|--- +Ubuntu 18.04 LTS | 64-bit x86 | 4.15 | 仅 GA 通用和低电压内核 +Ubuntu 16.04 LTS | 64-bit x86 | 4.4 | 仅 GA 通用和低电压内核 +Ubuntu 14.04 LTS | 64-bit x86 | 4.4 | 仅 Hardware Enablement 内核 + +**注意**:Ubuntu 14.04 中的 Canonical 实时补丁服务 LTS 要求用户在 Trusty 中运行 Ubuntu v4.4 内核。如果你当前没有运行使用该服务,请重新启动到此内核。 + +为此,请按照以下步骤操作。 + +### 如何获取实时补丁令牌? + +导航到 [Canonical 实时补丁服务页面][2],如果要使用免费服务,请选择“Ubuntu 用户”。它适用于不超过 3 个系统的用户。如果你是 “UA 客户” 或多于 3 个系统,请选择 “Ubuntu customer”。最后,单击 “Get your Livepatch token” 按钮。 + +![][4] + +确保你已经在 “Ubuntu One” 中拥有帐号。否则,可以创建一个新的。 + +登录后,你将获得你的帐户密钥。 + +![][5] + +### 在系统中安装 Snap 守护程序 + +实时补丁系统通过快照包安装。因此,请确保在 Ubuntu 系统上安装了 snapd 守护程序。 + +``` +$ sudo apt update +$ sudo apt install snapd +``` + +### 如何系统中安装和配置实时补丁服务? + +通过运行以下命令安装 `canonical-livepatch` 守护程序。 + +``` +$ sudo snap install canonical-livepatch +canonical-livepatch 9.4.1 from Canonical* installed +``` + +运行以下命令以在 Ubuntu 计算机上启用实时内核补丁程序。 + +``` +$ sudo canonical-livepatch enable xxxxc4xxxx67xxxxbxxxxbxxxxfbxx4e + +Successfully enabled device. Using machine-token: xxxxc4xxxx67xxxxbxxxxbxxxxfbxx4e +``` + +运行以下命令查看实时补丁机器的状态。 + +``` +$ sudo canonical-livepatch status + +client-version: 9.4.1 +architecture: x86_64 +cpu-model: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz +last-check: 2019-07-24T12:30:04+05:30 +boot-time: 2019-07-24T12:11:06+05:30 +uptime: 19m11s +status: +- kernel: 4.15.0-55.60-generic + running: true + livepatch: + checkState: checked + patchState: nothing-to-apply + version: "" + fixes: "" +``` + +使用 `--verbose` 开关运行上述相同的命令,以获取有关实时修补机器的更多信息。 + +``` +$ sudo canonical-livepatch status --verbose +``` + +如果要手动运行补丁程序,请执行以下命令。 + +``` +$ sudo canonical-livepatch refresh + +Before refresh: + +kernel: 4.15.0-55.60-generic +fully-patched: true +version: "" + +After refresh: + +kernel: 4.15.0-55.60-generic +fully-patched: true +version: "" +``` + +`patchState` 会有以下状态之一: + +* `applied`:未发现任何漏洞 +* `nothing-to-apply`:成功找到并修补了漏洞 +* `kernel-upgrade-required`:实时补丁服务无法安装补丁来修复漏洞 + +请注意,安装内核补丁与在系统上升级/安装新内核不同。如果安装了新内核,则必须重新引导系统以激活新内核。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/enable-canonical-kernel-livepatch-service-on-ubuntu-lts-system/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.ubuntu.com/Kernel/Livepatch +[2]: https://auth.livepatch.canonical.com/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: https://www.2daygeek.com/wp-content/uploads/2019/07/enable-canonical-livepatch-service-on-ubuntu-lts-system-1.jpg +[5]: https://www.2daygeek.com/wp-content/uploads/2019/07/enable-canonical-livepatch-service-on-ubuntu-lts-system-2.jpg diff --git a/published/201907/20190730 Is This the End of Floppy Disk in Linux- Linus Torvalds Marks Floppy Disks ‘Orphaned.md b/published/201907/20190730 Is This the End of Floppy Disk in Linux- Linus Torvalds Marks Floppy Disks ‘Orphaned.md new file mode 100644 index 0000000000..7a4e3e0404 --- /dev/null +++ b/published/201907/20190730 Is This the End of Floppy Disk in Linux- Linus Torvalds Marks Floppy Disks ‘Orphaned.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11167-1.html) +[#]: subject: (Is This the End of Floppy Disk in Linux? Linus Torvalds Marks Floppy Disks ‘Orphaned’) +[#]: via: (https://itsfoss.com/end-of-floppy-disk-in-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 中的软盘走向终结了吗?Torvalds 将软盘的驱动标记为“孤儿” +====== + +> 在 Linux 内核最近的提交当中,Linus Torvalds 将软盘的驱动程序标记为孤儿。这标志着软盘在 Linux 中步入结束了吗? + +有可能你很多年没见过真正的软盘了。如果你正在寻找带软盘驱动器的计算机,可能需要去博物馆里看看。 + +在二十多年前,软盘是用于存储数据和运行操作系统的流行介质。[早期的 Linux 发行版][1]使用软盘进行“分发”。软盘也广泛用于保存和传输数据。 + +你有没有想过为什么许多应用程序中的保存图标看起来像软盘?因为它就是软盘啊!软盘常用于保存数据,因此许多应用程序将其用作保存图标,并且这个传统一直延续至今。 + +![][2] + +今天我为什么要说起软盘?因为 Linus Torvalds 在一个 Linux 内核代码的提交里标记软盘的驱动程序为“孤儿”。 + +### 在 Linux 内核中被标记为“孤儿”的软盘驱动程序 + +正如你可以在 [GitHub 镜像上的提交][3]中看到的那样,开发人员 Jiri 不再使用带有软驱的工作计算机了。而如果没有正确的硬件,Jiri 将无法继续开发。这就是 Torvalds 将其标记为孤儿的原因。 + +> 越来越难以找到可以实际工作的软盘的物理硬件,虽然 Willy 能够对此进行测试,但我认为从实际的硬件角度来看,这个驱动程序几乎已经死了。目前仍然销售的硬件似乎主要是基于 USB 的,根本不使用这种传统的驱动器。 + +![][4] + +### “孤儿”在 Linux 内核中意味着什么? + +“孤儿”意味着没有开发人员能够或愿意支持这部分代码。如果没有其他人出现继续维护和开发它,孤儿模块可能会被弃用并最终删除。 + +### 它没有被立即删除 + +Torvalds 指出,各种虚拟环境模拟器仍在使用软盘驱动器。所以软盘的驱动程序不会被立即丢弃。 + +> 各种 VM 环境中仍然在仿真旧的软盘控制器,因此该驱动程序不会消失,但让我们看看是否有人有兴趣进一步维护它。 + +为什么不永远保持内核中的软盘驱动器支持呢?因为这将构成安全威胁。即使没有真正的计算机使用软盘驱动程序,虚拟机仍然拥有它,这将使虚拟机容易受到攻击。 + +### 一个时代的终结? + +这将是一个时代的结束还是会有其他人出现并承担起在 Linux 中继续维护软盘驱动程序的责任?只有时间会给出答案。 + +在 Linux 内核中,软盘驱动器成为孤儿我不觉得有什么可惜的。 + +在过去的十五年里我没有使用过软盘,我怀疑很多人也是如此。那么你呢?你有没有用过软盘?如果是的话,你最后一次使用它的时间是什么时候? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/end-of-floppy-disk-in-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/earliest-linux-distros/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/floppy-disk-icon-of-saving.png?resize=800%2C300&ssl=1 +[3]: https://github.com/torvalds/linux/commit/47d6a7607443ea43dbc4d0f371bf773540a8f8f4 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/End-of-Floppy-in-Linux.png?resize=800%2C450&ssl=1 +[5]: https://itsfoss.com/valve-annouces-linux-based-gaming-operating-system-steamos/ diff --git a/published/20191110 What is DevSecOps.md b/published/201907/20191110 What is DevSecOps.md similarity index 100% rename from published/20191110 What is DevSecOps.md rename to published/201907/20191110 What is DevSecOps.md diff --git a/published/20190701 Get modular with Python functions.md b/published/20190701 Get modular with Python functions.md new file mode 100644 index 0000000000..37124c8e2b --- /dev/null +++ b/published/20190701 Get modular with Python functions.md @@ -0,0 +1,322 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11295-1.html) +[#]: subject: (Get modular with Python functions) +[#]: via: (https://opensource.com/article/19/7/get-modular-python-functions) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/xd-deng/users/nhuntwalker/users/don-watkins) + +使用 Python 函数进行模块化 +====== + +> 使用 Python 函数来最大程度地减少重复任务编码工作量。 + +![](https://img.linux.net.cn/data/attachment/album/201909/01/234309ja7ooanopazo3o2m.jpg) + +你是否对函数、类、方法、库和模块等花哨的编程术语感到困惑?你是否在与变量作用域斗争?无论你是自学成才的还是经过正式培训的程序员,代码的模块化都会令人困惑。但是类和库鼓励模块化代码,因为模块化代码意味着只需构建一个多用途代码块集合,就可以在许多项目中使用它们来减少编码工作量。换句话说,如果你按照本文对 [Python][2] 函数的研究,你将找到更聪明的工作方法,这意味着更少的工作。 + +本文假定你对 Python 很熟(LCTT 译注:稍微熟悉就可以),并且可以编写和运行一个简单的脚本。如果你还没有使用过 Python,请首先阅读我的文章:[Python 简介][3]。 + +### 函数 + +函数是迈向模块化过程中重要的一步,因为它们是形式化的重复方法。如果在你的程序中,有一个任务需要反复执行,那么你可以将代码放入一个函数中,根据需要随时调用该函数。这样,你只需编写一次代码,就可以随意使用它。 + +以下一个简单函数的示例: + +``` +#!/usr/bin/env python3 +import time + +def Timer(): +    print("Time is " + str(time.time() )) +``` + +创建一个名为 `mymodularity` 的目录,并将以上函数代码保存为该目录下的 `timestamp.py`。 + +除了这个函数,在 `mymodularity` 目录中创建一个名为 `__init__.py` 的文件,你可以在文件管理器或 bash shell 中执行此操作: + +``` +$ touch mymodularity/__init__.py +``` + +现在,你已经创建了属于你自己的 Python 库(Python 中称为“模块”),名为 `mymodularity`。它不是一个特别有用的模块,因为它所做的只是导入 `time` 模块并打印一个时间戳,但这只是一个开始。 + +要使用你的函数,像对待任何其他 Python 模块一样对待它。以下是一个小应用,它使用你的 `mymodularity` 软件包来测试 Python `sleep()` 函数的准确性。将此文件保存为 `sleeptest.py`,注意要在 `mymodularity` 文件夹 *之外*,因为如果你将它保存在 `mymodularity` *里面*,那么它将成为你的包中的一个模块,你肯定不希望这样。 + +``` +#!/usr/bin/env python3 + +import time +from mymodularity import timestamp + +print("Testing Python sleep()...") + +# modularity +timestamp.Timer() +time.sleep(3) +timestamp.Timer() +``` + +在这个简单的脚本中,你从 `mymodularity` 包中调用 `timestamp` 模块两次。从包中导入模块时,通常的语法是从包中导入你所需的模块,然后使用 *模块名称 + 一个点 + 要调用的函数名*(例如 `timestamp.Timer()`)。 + +你调用了两次 `Timer()` 函数,所以如果你的 `timestamp` 模块比这个简单的例子复杂些,那么你将节省大量重复代码。 + +保存文件并运行: + +``` +$ python3 ./sleeptest.py +Testing Python sleep()... +Time is 1560711266.1526039 +Time is 1560711269.1557732 +``` + +根据测试,Python 中的 `sleep` 函数非常准确:在三秒钟等待之后,时间戳成功且正确地增加了 3,在微秒单位上差距很小。 + +Python 库的结构看起来可能令人困惑,但其实它并不是什么魔法。Python *被编程* 为一个包含 Python 代码的目录,并附带一个 `__init__.py` 文件,那么这个目录就会被当作一个包,并且 Python 会首先在当前目录中查找可用模块。这就是为什么语句 `from mymodularity import timestamp` 有效的原因:Python 在当前目录查找名为 `mymodularity` 的目录,然后查找 `timestamp.py` 文件。 + +你在这个例子中所做的功能和以下这个非模块化的版本是一样的: + +``` +#!/usr/bin/env python3 + +import time +from mymodularity import timestamp + +print("Testing Python sleep()...") + +# no modularity +print("Time is " + str(time.time() ) ) +time.sleep(3) +print("Time is " + str(time.time() ) ) +``` + +对于这样一个简单的例子,其实没有必要以这种方式编写测试,但是对于编写自己的模块来说,最佳实践是你的代码是通用的,可以将它重用于其他项目。 + +通过在调用函数时传递信息,可以使代码更通用。例如,假设你想要使用模块来测试的不是 *系统* 的 `sleep` 函数,而是 *用户自己实现* 的 `sleep` 函数,更改 `timestamp` 代码,使它接受一个名为 `msg` 的传入变量,它将是一个字符串,控制每次调用 `timestamp` 时如何显示: + +``` +#!/usr/bin/env python3 + +import time + +# 更新代码 +def Timer(msg): +    print(str(msg) + str(time.time() ) ) +``` + +现在函数比以前更抽象了。它仍会打印时间戳,但是它为用户打印的内容 `msg` 还是未定义的。这意味着你需要在调用函数时定义它。 + +`Timer` 函数接受的 `msg` 参数是随便命名的,你可以使用参数 `m`、`message` 或 `text`,或是任何对你来说有意义的名称。重要的是,当调用 `timestamp.Timer` 函数时,它接收一个文本作为其输入,将接收到的任何内容放入 `msg` 变量中,并使用该变量完成任务。 + +以下是一个测试测试用户正确感知时间流逝能力的新程序: + +``` +#!/usr/bin/env python3 + +from mymodularity import timestamp + +print("Press the RETURN key. Count to 3, and press RETURN again.") + +input() +timestamp.Timer("Started timer at ") + +print("Count to 3...") + +input() +timestamp.Timer("You slept until ") +``` + +将你的新程序保存为 `response.py`,运行它: + +``` +$ python3 ./response.py +Press the RETURN key. Count to 3, and press RETURN again. + +Started timer at 1560714482.3772075 +Count to 3... + +You slept until 1560714484.1628013 +``` + +### 函数和所需参数 + +新版本的 `timestamp` 模块现在 *需要* 一个 `msg` 参数。这很重要,因为你的第一个应用程序将无法运行,因为它没有将字符串传递给 `timestamp.Timer` 函数: + +``` +$ python3 ./sleeptest.py +Testing Python sleep()... +Traceback (most recent call last): +  File "./sleeptest.py", line 8, in <module> +    timestamp.Timer() +TypeError: Timer() missing 1 required positional argument: 'msg' +``` + +你能修复你的 `sleeptest.py` 应用程序,以便它能够与更新后的模块一起正确运行吗? + +### 变量和函数 + +通过设计,函数限制了变量的范围。换句话说,如果在函数内创建一个变量,那么这个变量 *只* 在这个函数内起作用。如果你尝试在函数外部使用函数内部出现的变量,就会发生错误。 + +下面是对 `response.py` 应用程序的修改,尝试从 `timestamp.Timer()` 函数外部打印 `msg` 变量: + +``` +#!/usr/bin/env python3 + +from mymodularity import timestamp + +print("Press the RETURN key. Count to 3, and press RETURN again.") + +input() +timestamp.Timer("Started timer at ") + +print("Count to 3...") + +input() +timestamp.Timer("You slept for ") + +print(msg) +``` + +试着运行它,查看错误: + +``` +$ python3 ./response.py +Press the RETURN key. Count to 3, and press RETURN again. + +Started timer at 1560719527.7862902 +Count to 3... + +You slept for 1560719528.135406 +Traceback (most recent call last): +  File "./response.py", line 15, in <module> +    print(msg) +NameError: name 'msg' is not defined +``` + +应用程序返回一个 `NameError` 消息,因为没有定义 `msg`。这看起来令人困惑,因为你编写的代码定义了 `msg`,但你对代码的了解比 Python 更深入。调用函数的代码,不管函数是出现在同一个文件中,还是打包为模块,都不知道函数内部发生了什么。一个函数独立地执行它的计算,并返回你想要它返回的内容。这其中所涉及的任何变量都只是 *本地的*:它们只存在于函数中,并且只存在于函数完成其目的所需时间内。 + +#### Return 语句 + +如果你的应用程序需要函数中特定包含的信息,那么使用 `return` 语句让函数在运行后返回有意义的数据。 + +时间就是金钱,所以修改 `timestamp` 函数,以使其用于一个虚构的收费系统: + +``` +#!/usr/bin/env python3 + +import time + +def Timer(msg): +    print(str(msg) + str(time.time() ) ) +    charge = .02 +    return charge +``` + +现在,`timestamp` 模块每次调用都收费 2 美分,但最重要的是,它返回每次调用时所收取的金额。 + +以下一个如何使用 `return` 语句的演示: + +``` +#!/usr/bin/env python3 + +from mymodularity import timestamp + +print("Press RETURN for the time (costs 2 cents).") +print("Press Q RETURN to quit.") + +total = 0 + +while True: +    kbd = input() +    if kbd.lower() == "q": +        print("You owe $" + str(total) ) +        exit() +    else: +        charge = timestamp.Timer("Time is ") +        total = total+charge +``` + +在这个示例代码中,变量 `charge` 为 `timestamp.Timer()` 函数的返回,它接收函数返回的任何内容。在本例中,函数返回一个数字,因此使用一个名为 `total` 的新变量来跟踪已经进行了多少更改。当应用程序收到要退出的信号时,它会打印总花费: + +``` +$ python3 ./charge.py +Press RETURN for the time (costs 2 cents). +Press Q RETURN to quit. + +Time is 1560722430.345412 + +Time is 1560722430.933996 + +Time is 1560722434.6027434 + +Time is 1560722438.612629 + +Time is 1560722439.3649364 +q +You owe $0.1 +``` + +#### 内联函数 + +函数不必在单独的文件中创建。如果你只是针对一个任务编写一个简短的脚本,那么在同一个文件中编写函数可能更有意义。唯一的区别是你不必导入自己的模块,但函数的工作方式是一样的。以下是时间测试应用程序的最新迭代: + +``` +#!/usr/bin/env python3 + +import time + +total = 0 + +def Timer(msg): +    print(str(msg) + str(time.time() ) ) +    charge = .02 +    return charge + +print("Press RETURN for the time (costs 2 cents).") +print("Press Q RETURN to quit.") + +while True: +    kbd = input() +    if kbd.lower() == "q": +        print("You owe $" + str(total) ) +        exit() +    else: +        charge = Timer("Time is ") +        total = total+charge +``` + +它没有外部依赖(Python 发行版中包含 `time` 模块),产生与模块化版本相同的结果。它的优点是一切都位于一个文件中,缺点是你不能在其他脚本中使用 `Timer()` 函数,除非你手动复制和粘贴它。 + +#### 全局变量 + +在函数外部创建的变量没有限制作用域,因此它被视为 *全局* 变量。 + +全局变量的一个例子是在 `charge.py` 中用于跟踪当前花费的 `total` 变量。`total` 是在函数之外创建的,因此它绑定到应用程序而不是特定函数。 + +应用程序中的函数可以访问全局变量,但要将变量传入导入的模块,你必须像发送 `msg` 变量一样将变量传入模块。 + +全局变量很方便,因为它们似乎随时随地都可用,但也很难跟踪它们,很难知道哪些变量不再需要了但是仍然在系统内存中停留(尽管 Python 有非常好的垃圾收集机制)。 + +但是,全局变量很重要,因为不是所有的变量都可以是函数或类的本地变量。现在你知道了如何向函数传入变量并获得返回,事情就变得容易了。 + +### 总结 + +你已经学到了很多关于函数的知识,所以开始将它们放入你的脚本中 —— 如果它不是作为单独的模块,那么作为代码块,你不必在一个脚本中编写多次。在本系列的下一篇文章中,我将介绍 Python 类。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/get-modular-python-functions + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/xd-deng/users/nhuntwalker/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm +[2]: https://www.python.org/ +[3]: https://opensource.com/article/17/10/python-10 diff --git a/published/20190705 Learn object-oriented programming with Python.md b/published/20190705 Learn object-oriented programming with Python.md new file mode 100644 index 0000000000..1d2767d601 --- /dev/null +++ b/published/20190705 Learn object-oriented programming with Python.md @@ -0,0 +1,305 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11317-1.html) +[#]: subject: (Learn object-oriented programming with Python) +[#]: via: (https://opensource.com/article/19/7/get-modular-python-classes) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Python 学习面对对象的编程 +====== + +> 使用 Python 类使你的代码变得更加模块化。 + +![](https://img.linux.net.cn/data/attachment/album/201909/08/091142y2bdbboctw7xdbjq.jpg) + +在我上一篇文章中,我解释了如何通过使用函数、创建模块或者两者一起来[使 Python 代码更加模块化][2]。函数对于避免重复多次使用的代码非常有用,而模块可以确保你在不同的项目中复用代码。但是模块化还有另一种方法:类。 + +如果你已经听过面对对象编程object-oriented programming(OOP)这个术语,那么你可能会对类的用途有一些概念。程序员倾向于将类视为一个虚拟对象,有时与物理世界中的某些东西直接相关,有时则作为某种编程概念的表现形式。无论哪种表示,当你想要在程序中为你或程序的其他部分创建“对象”时,你都可以创建一个类来交互。 + +### 没有类的模板 + +假设你正在编写一个以幻想世界为背景的游戏,并且你需要这个应用程序能够涌现出各种坏蛋来给玩家的生活带来一些刺激。了解了很多关于函数的知识后,你可能会认为这听起来像是函数的一个教科书案例:需要经常重复的代码,但是在调用时可以考虑变量而只编写一次。 + +下面一个纯粹基于函数的敌人生成器实现的例子: + +``` +#!/usr/bin/env python3 + +import random + +def enemy(ancestry,gear): + enemy=ancestry + weapon=gear + hp=random.randrange(0,20) + ac=random.randrange(0,20) + return [enemy,weapon,hp,ac] + +def fight(tgt): + print("You take a swing at the " + tgt[0] + ".") + hit=random.randrange(0,20) + if hit > tgt[3]: + print("You hit the " + tgt[0] + " for " + str(hit) + " damage!") + tgt[2] = tgt[2] - hit + else: + print("You missed.") + + +foe=enemy("troll","great axe") +print("You meet a " + foe[0] + " wielding a " + foe[1]) +print("Type the a key and then RETURN to attack.") + +while True: + action=input() + + if action.lower() == "a": + fight(foe) + + if foe[2] < 1: + print("You killed your foe!") + else: + print("The " + foe[0] + " has " + str(foe[2]) + " HP remaining") +``` + +`enemy` 函数创造了一个具有多个属性的敌人,例如谱系、武器、生命值和防御等级。它返回每个属性的列表,表示敌人全部特征。 + +从某种意义上说,这段代码创建了一个对象,即使它还没有使用类。程序员将这个 `enemy` 称为*对象*,因为该函数的结果(本例中是一个包含字符串和整数的列表)表示游戏中一个单独但复杂的*东西*。也就是说,列表中字符串和整数不是任意的:它们一起描述了一个虚拟对象。 + +在编写描述符集合时,你可以使用变量,以便随时使用它们来生成敌人。这有点像模板。 + +在示例代码中,当需要对象的属性时,会检索相应的列表项。例如,要获取敌人的谱系,代码会查询 `foe[0]`,对于生命值,会查询 `foe[2]`,以此类推。 + +这种方法没有什么不妥,代码按预期运行。你可以添加更多不同类型的敌人,创建一个敌人类型列表,并在敌人创建期间从列表中随机选择,等等,它工作得很好。实际上,[Lua][3] 非常有效地利用这个原理来近似了一个面对对象模型。 + +然而,有时候对象不仅仅是属性列表。 + +### 使用对象 + +在 Python 中,一切都是对象。你在 Python 中创建的任何东西都是某个预定义模板的*实例*。甚至基本的字符串和整数都是 Python `type` 类的衍生物。你可以在这个交互式 Python shell 中见证: + +``` +>>> foo=3 +>>> type(foo) + +>>> foo="bar" +>>> type(foo) + +``` + +当一个对象由一个类定义时,它不仅仅是一个属性的集合,Python 类具有各自的函数。从逻辑上讲,这很方便,因为只涉及某个对象类的操作包含在该对象的类中。 + +在示例代码中,`fight` 的代码是主应用程序的功能。这对于一个简单的游戏来说是可行的,但对于一个复杂的游戏来说,世界中不仅仅有玩家和敌人,还可能有城镇居民、牲畜、建筑物、森林等等,它们都不需要使用战斗功能。将战斗代码放在敌人的类中意味着你的代码更有条理,在一个复杂的应用程序中,这是一个重要的优势。 + +此外,每个类都有特权访问自己的本地变量。例如,敌人的生命值,除了某些功能之外,是不会改变的数据。游戏中的随机蝴蝶不应该意外地将敌人的生命值降低到 0。理想情况下,即使没有类,也不会发生这种情况。但是在具有大量活动部件的复杂应用程序中,确保不需要相互交互的部件永远不会发生这种情况,这是一个非常有用的技巧。 + +Python 类也受垃圾收集的影响。当不再使用类的实例时,它将被移出内存。你可能永远不知道这种情况会什么时候发生,但是你往往知道什么时候它不会发生,因为你的应用程序占用了更多的内存,而且运行速度比较慢。将数据集隔离到类中可以帮助 Python 跟踪哪些数据正在使用,哪些不在需要了。 + +### 优雅的 Python + +下面是一个同样简单的战斗游戏,使用了 `Enemy` 类: + +``` +#!/usr/bin/env python3 + +import random + +class Enemy(): + def __init__(self,ancestry,gear): + self.enemy=ancestry + self.weapon=gear + self.hp=random.randrange(10,20) + self.ac=random.randrange(12,20) + self.alive=True + + def fight(self,tgt): + print("You take a swing at the " + self.enemy + ".") + hit=random.randrange(0,20) + + if self.alive and hit > self.ac: + print("You hit the " + self.enemy + " for " + str(hit) + " damage!") + self.hp = self.hp - hit + print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") + else: + print("You missed.") + + if self.hp < 1: + self.alive=False + +# 游戏开始 +foe=Enemy("troll","great axe") +print("You meet a " + foe.enemy + " wielding a " + foe.weapon) + +# 主函数循环 +while True: + + print("Type the a key and then RETURN to attack.") + + action=input() + + if action.lower() == "a": + foe.fight(foe) + + if foe.alive == False: + print("You have won...this time.") + exit() +``` + +这个版本的游戏将敌人作为一个包含相同属性(谱系、武器、生命值和防御)的对象来处理,并添加一个新的属性来衡量敌人时候已被击败,以及一个战斗功能。 + +类的第一个函数是一个特殊的函数,在 Python 中称为 `init` 或初始化的函数。这类似于其他语言中的[构造器][4],它创建了类的一个实例,你可以通过它的属性和调用类时使用的任何变量来识别它(示例代码中的 `foe`)。 + +### Self 和类实例 + +类的函数接受一种你在类之外看不到的新形式的输入:`self`。如果不包含 `self`,那么当你调用类函数时,Python 无法知道要使用的类的*哪个*实例。这就像在一间充满兽人的房间里说:“我要和兽人战斗”,向一个兽人发起。没有人知道你指的是谁,所有兽人就都上来了。 + +![Image of an Orc, CC-BY-SA by Buch on opengameart.org][5] + +*CC-BY-SA by Buch on opengameart.org* + +类中创建的每个属性都以 `self` 符号作为前缀,该符号将变量标识为类的属性。一旦派生出类的实例,就用表示该实例的变量替换掉 `self` 前缀。使用这个技巧,你可以在一间满是兽人的房间里说:“我要和谱系是 orc 的兽人战斗”,这样来挑战一个兽人。当 orc 听到 “gorblar.orc” 时,它就知道你指的是谁(他自己),所以你得到是一场公平的战斗而不是斗殴。在 Python 中: + +``` +gorblar=Enemy("orc","sword") +print("The " + gorblar.enemy + " has " + str(gorblar.hp) + " remaining.") +``` + +通过检索类属性(`gorblar.enemy` 或 `gorblar.hp` 或你需要的任何对象的任何值)而不是查询 `foe[0]`(在函数示例中)或 `gorblar[0]` 来寻找敌人。 + +### 本地变量 + +如果类中的变量没有以 `self` 关键字作为前缀,那么它就是一个局部变量,就像在函数中一样。例如,无论你做什么,你都无法访问 `Enemy.fight` 类之外的 `hit` 变量: + +``` +>>> print(foe.hit) +Traceback (most recent call last): + File "./enclass.py", line 38, in + print(foe.hit) +AttributeError: 'Enemy' object has no attribute 'hit' + +>>> print(foe.fight.hit) +Traceback (most recent call last): + File "./enclass.py", line 38, in + print(foe.fight.hit) +AttributeError: 'function' object has no attribute 'hit' +``` + +`hit` 变量包含在 Enemy 类中,并且只能“存活”到在战斗中发挥作用。 + +### 更模块化 + +本例使用与主应用程序相同的文本文档中的类。在一个复杂的游戏中,我们更容易将每个类看作是自己独立的应用程序。当多个开发人员处理同一个应用程序时,你会看到这一点:一个开发人员负责一个类,另一个开发人员负责主程序,只要他们彼此沟通这个类必须具有什么属性,就可以并行地开发这两个代码块。 + +要使这个示例游戏模块化,可以把它拆分为两个文件:一个用于主应用程序,另一个用于类。如果它是一个更复杂的应用程序,你可能每个类都有一个文件,或每个逻辑类组有一个文件(例如,用于建筑物的文件,用于自然环境的文件,用于敌人或 NPC 的文件等)。 + +将只包含 `Enemy` 类的一个文件保存为 `enemy.py`,将另一个包含其他内容的文件保存为 `main.py`。 + +以下是 `enemy.py`: + +``` +import random + +class Enemy(): + def __init__(self,ancestry,gear): + self.enemy=ancestry + self.weapon=gear + self.hp=random.randrange(10,20) + self.stg=random.randrange(0,20) + self.ac=random.randrange(0,20) + self.alive=True + + def fight(self,tgt): + print("You take a swing at the " + self.enemy + ".") + hit=random.randrange(0,20) + + if self.alive and hit > self.ac: + print("You hit the " + self.enemy + " for " + str(hit) + " damage!") + self.hp = self.hp - hit + print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") + else: + print("You missed.") + + if self.hp < 1: + self.alive=False +``` + +以下是 `main.py`: + +``` +#!/usr/bin/env python3 + +import enemy as en + +# game start +foe=en.Enemy("troll","great axe") +print("You meet a " + foe.enemy + " wielding a " + foe.weapon) + +# main loop +while True: + + print("Type the a key and then RETURN to attack.") + + action=input() + + if action.lower() == "a": + foe.fight(foe) + + if foe.alive == False: + print("You have won...this time.") + exit() +``` + +导入模块 `enemy.py` 使用了一条特别的语句,引用类文件名称而不用带有 `.py` 扩展名,后跟你选择的命名空间指示符(例如,`import enemy as en`)。这个指示符是在你调用类时在代码中使用的。你需要在导入时添加指示符,例如 `en.Enemy`,而不是只使用 `Enemy()`。 + +所有这些文件名都是任意的,尽管在原则上不要使用罕见的名称。将应用程序的中心命名为 `main.py` 是一个常见约定,和一个充满类的文件通常以小写形式命名,其中的类都以大写字母开头。是否遵循这些约定不会影响应用程序的运行方式,但它确实使经验丰富的 Python 程序员更容易快速理解应用程序的工作方式。 + +在如何构建代码方面有一些灵活性。例如,使用该示例代码,两个文件必须位于同一目录中。如果你只想将类打包为模块,那么必须创建一个名为 `mybad` 的目录,并将你的类移入其中。在 `main.py` 中,你的 `import` 语句稍有变化: + +``` +from mybad import enemy as en +``` + +两种方法都会产生相同的结果,但如果你创建的类足够通用,你认为其他开发人员可以在他们的项目中使用它们,那么后者更好。 + +无论你选择哪种方式,都可以启动游戏的模块化版本: + +``` +$ python3 ./main.py +You meet a troll wielding a great axe +Type the a key and then RETURN to attack. +a +You take a swing at the troll. +You missed. +Type the a key and then RETURN to attack. +a +You take a swing at the troll. +You hit the troll for 8 damage! +The troll has 4 HP remaining +Type the a key and then RETURN to attack. +a +You take a swing at the troll. +You hit the troll for 11 damage! +The troll has -7 HP remaining +You have won...this time. +``` + +游戏启动了,它现在更加模块化了。现在你知道了面对对象的应用程序意味着什么,但最重要的是,当你向兽人发起决斗的时候,你知道是哪一个。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/get-modular-python-classes + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_development_programming.png?itok=M_QDcgz5 (Developing code.) +[2]: https://linux.cn/article-11295-1.html +[3]: https://opensource.com/article/17/4/how-program-games-raspberry-pi +[4]: https://opensource.com/article/19/6/what-java-constructor +[5]: https://opensource.com/sites/default/files/images/orc-buch-opengameart_cc-by-sa.jpg (CC-BY-SA by Buch on opengameart.org) diff --git a/published/20190730 How to manage logs in Linux.md b/published/20190730 How to manage logs in Linux.md new file mode 100644 index 0000000000..b3d448a305 --- /dev/null +++ b/published/20190730 How to manage logs in Linux.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11336-1.html) +[#]: subject: (How to manage logs in Linux) +[#]: via: (https://www.networkworld.com/article/3428361/how-to-manage-logs-in-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 中管理日志 +====== + +> Linux 系统上的日志文件包含了**很多**信息——比你有时间查看的还要多。以下是一些建议,告诉你如何正确的使用它们……而不是淹没在其中。 + +![Greg Lobinski \(CC BY 2.0\)][1] + +在 Linux 系统上管理日志文件可能非常容易,也可能非常痛苦。这完全取决于你所认为的日志管理是什么。 + +如果你认为是如何确保日志文件不会耗尽你的 Linux 服务器上的所有磁盘空间,那么这个问题通常很简单。Linux 系统上的日志文件会自动翻转,系统将只维护固定数量的翻转日志。即便如此,一眼看去一组上百个文件可能会让人不知所措。在这篇文章中,我们将看看日志轮换是如何工作的,以及一些最相关的日志文件。 + +### 自动日志轮换 + +日志文件是经常轮转的。当前的日志会获得稍微不同的文件名,并建立一个新的日志文件。以系统日志文件为例。对于许多正常的系统 messages 文件来说,这个文件是一个包罗万象的东西。如果你 `cd` 转到 `/var/log` 并查看一下,你可能会看到一系列系统日志文件,如下所示: + +``` +$ ls -l syslog* +-rw-r----- 1 syslog adm 28996 Jul 30 07:40 syslog +-rw-r----- 1 syslog adm 71212 Jul 30 00:00 syslog.1 +-rw-r----- 1 syslog adm 5449 Jul 29 00:00 syslog.2.gz +-rw-r----- 1 syslog adm 6152 Jul 28 00:00 syslog.3.gz +-rw-r----- 1 syslog adm 7031 Jul 27 00:00 syslog.4.gz +-rw-r----- 1 syslog adm 5602 Jul 26 00:00 syslog.5.gz +-rw-r----- 1 syslog adm 5995 Jul 25 00:00 syslog.6.gz +-rw-r----- 1 syslog adm 32924 Jul 24 00:00 syslog.7.gz +``` + +轮换发生在每天午夜,旧的日志文件会保留一周,然后删除最早的系统日志文件。`syslog.7.gz` 文件将被从系统中删除,`syslog.6.gz` 将被重命名为 `syslog.7.gz`。日志文件的其余部分将依次改名,直到 `syslog` 变成 `syslog.1` 并创建一个新的 `syslog` 文件。有些系统日志文件会比其他文件大,但是一般来说,没有一个文件可能会变得非常大,并且你永远不会看到超过八个的文件。这给了你一个多星期的时间来回顾它们收集的任何数据。 + +某种特定日志文件维护的文件数量取决于日志文件本身。有些文件可能有 13 个。请注意 `syslog` 和 `dpkg` 的旧文件是如何压缩以节省空间的。这里的考虑是你对最近的日志最感兴趣,而更旧的日志可以根据需要用 `gunzip` 解压。 + +``` +# ls -t dpkg* +dpkg.log dpkg.log.3.gz dpkg.log.6.gz dpkg.log.9.gz dpkg.log.12.gz +dpkg.log.1 dpkg.log.4.gz dpkg.log.7.gz dpkg.log.10.gz +dpkg.log.2.gz dpkg.log.5.gz dpkg.log.8.gz dpkg.log.11.gz +``` + +日志文件可以根据时间和大小进行轮换。检查日志文件时请记住这一点。 + +尽管默认值适用于大多数 Linux 系统管理员,但如果你愿意,可以对日志文件轮换进行不同的配置。查看这些文件,如 `/etc/rsyslog.conf` 和 `/etc/logrotate.conf`。 + +### 使用日志文件 + +对日志文件的管理也包括时不时的使用它们。使用日志文件的第一步可能包括:习惯每个日志文件可以告诉你有关系统如何工作以及系统可能会遇到哪些问题。从头到尾读取日志文件几乎不是一个好的选择,但是当你想了解你的系统运行的情况或者需要跟踪一个问题时,知道如何从日志文件中获取信息会是有很大的好处。这也表明你对每个文件中存储的信息有一个大致的了解了。例如: + +``` +$ who wtmp | tail -10 显示最近的登录信息 +$ who wtmp | grep shark 显示特定用户的最近登录信息 +$ grep "sudo:" auth.log 查看谁在使用 sudo +$ tail dmesg 查看(最近的)内核日志 +$ tail dpkg.log 查看最近安装和更新的软件包 +$ more ufw.log 查看防火墙活动(假如你使用 ufw) +``` + +你运行的一些命令也会从日志文件中提取信息。例如,如果你想查看系统重新启动的列表,可以使用如下命令: + +``` +$ last reboot +reboot system boot 5.0.0-20-generic Tue Jul 16 13:19 still running +reboot system boot 5.0.0-15-generic Sat May 18 17:26 - 15:19 (21+21:52) +reboot system boot 5.0.0-13-generic Mon Apr 29 10:55 - 15:34 (18+04:39) +``` + +### 使用更高级的日志管理器 + +虽然你可以编写脚本来更容易地在日志文件中找到感兴趣的信息,但是你也应该知道有一些非常复杂的工具可用于日志文件分析。一些可以把来自多个来源的信息联系起来,以便更全面地了解你的网络上发生了什么。它们也可以提供实时监控。这些工具,如 [Solarwinds Log & Event Manager][3] 和 [PRTG 网络监视器][4](包括日志监视)浮现在脑海中。 + +还有一些免费工具可以帮助分析日志文件。其中包括: + + * Logwatch — 用于扫描系统日志中感兴趣的日志行的程序 + * Logcheck — 系统日志分析器和报告器 + +在接下来的文章中,我将提供一些关于这些工具的见解和帮助。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3428361/how-to-manage-logs-in-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[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://images.idgesg.net/images/article/2019/07/logs-100806633-large.jpg +[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[3]: https://www.esecurityplanet.com/products/solarwinds-log-event-manager-siem.html +[4]: https://www.paessler.com/prtg +[5]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/published/201908/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md b/published/201908/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md new file mode 100644 index 0000000000..c582a3bd3f --- /dev/null +++ b/published/201908/20171113 IT disaster recovery- Sysadmins vs. natural disasters - HPE.md @@ -0,0 +1,172 @@ +IT 灾备:系统管理员对抗自然灾害 +====== + +![](https://www.hpe.com/content/dam/hpe/insights/articles/2017/11/it-disaster-recovery-sysadmins-vs-natural-disasters/featuredStory/Sysadmins-vs-natural-disasters-1740.jpg.transform/nxt-1043x496-crop/image.jpeg) + +> 面对倾泻的洪水或地震时业务需要继续运转。在飓风卡特里娜、桑迪和其他灾难中幸存下来的系统管理员向在紧急状况下负责 IT 的人们分享真实世界中的建议。 + +说到自然灾害,2017 年可算是多灾多难。(LCTT 译注:本文发表于 2017 年)飓风哈维、厄玛和玛莉亚给休斯顿、波多黎各、弗罗里达和加勒比造成了严重破坏。此外,西部的野火将多处住宅和商业建筑付之一炬。 + +再来一篇关于[有备无患][1]的警示文章 —— 当然其中都是好的建议 —— 是很简单的,但这无法帮助网络管理员应对湿漉漉的烂摊子。那些善意的建议中大多数都假定掌权的人乐于投入资金来实施这些建议。 + +我们对真实世界更感兴趣。不如让我们来充分利用这些坏消息。 + +一个很好的例子:自然灾害的一个后果是老板可能突然愿意给灾备计划投入预算。如同一个纽约地区的系统管理员所言,“[我发现飓风桑迪的最大好处][2]是我们的客户对 IT 投资更有兴趣了,但愿你也能得到更多预算。” + +不过别指望这种意愿持续很久。任何想提议改进基础设施的系统管理员最好趁热打铁。如同另一位飓风桑迪中幸存下来的 IT 专员懊悔地提及那样,“[对 IT 开支最初的兴趣持续到当年为止][3]。到了第二年,任何尚未开工的计划都因为‘预算约束’被搁置了,大约 6 个月之后则完全被遗忘。” + +在管理层忘记恶劣的自然灾害也可能降临到好公司头上之前提醒他们这点会有所帮助。根据商业和家庭安全协会Institute for Business & Home Safety的说法,[自然灾害后歇业的公司中 25% 再也没能重新开业][4]。联邦紧急事务管理署FEMA认为这过于乐观。根据他们的统计,“灾后 [40% 的小公司再也没能重新开门营业][5]。” + +如果你是个系统管理员,你能帮忙挽救你的公司。这里有一些幸存者的最好的主意,这些主意是基于他们从过去几次自然灾害中得到的经验。 + +### 制订一个计划 + +当灯光忽明忽暗,狂风象火车机车一样怒号时,就该启动你的业务持续计划和灾备计划了。 + +有太多的系统管理员报告当暴风雨来临时这两个计划中一个也没有。这并不令人惊讶。2014 年[灾备预备状态委员会][6]Disaster Recovery Preparedness Council发现[世界范围内被调查的公司中有 73% 没有足够的灾备计划][7]。 + +“**足够**”是关键词。正如一个系统管理员 2016 年在 Reddit 上写的那样,“[我们的灾备计划就是一场灾难。][8]我们所有的数据都备份在离这里大约 30 英里的一个存储区域网络SAN。我们没有将数据重新上线的硬件,甚至好几天过去了都没能让核心服务器启动运行起来。我们是个年营收 40 亿美元的公司,却不愿为适当的设备投入几十万美元,或是在数据中心添置几台服务器。当添置硬件的提案被提出的时候,我们的管理层说,‘嗐,碰到这种事情的机会能有多大呢’。” + +同一个帖子中另一个人说得更简洁:“眼下我的灾备计划只能在黑暗潮湿的角落里哭泣,但愿没人在乎损失的任何东西。” + +如果你在哭泣,但愿你至少不是独自流泪。任何灾备计划,即便是 IT 部门制订的灾备计划,必须确定[你能跟别人通讯][10],如同系统管理员 Jim Thompson 从卡特里娜飓风中得到的教训:“确保你有一个与人们通讯的计划。在一场严重的区域性灾难期间,你将无法给身处灾区的任何人打电话。” + +有一个选择可能会让有技术头脑的人感兴趣:[业余电台][11]ham radio。[它在波多黎各发挥了巨大作用][12]。 + +### 列一个愿望清单 + +第一步是承认问题。“许多公司实际上对灾备计划不感兴趣,或是消极对待”,[Micro Focus][14] 的首席架构师 [Joshua Focus][13] 说。“将灾备看作业务持续性的一个方面是种不同的视角。所有公司都要应对业务持续性,所以灾备应被视为业务持续性的一部分。” + +IT 部门需要将其需求书面化以确保适当的灾备和业务持续性计划。即使是你不知道如何着手,或尤其是这种时候,也是如此。正如一个系统管理员所言,“我喜欢有一个‘想法转储’,让所有计划、点子、改进措施毫无保留地提出来。(这)[对一类情况尤其有帮助,即当你提议变更][15],并付诸实施,接着 6 个月之后你警告过的状况就要来临。”现在你做好了一切准备并且可以开始讨论:“如同我们之前在 4 月讨论过的那样……” + +因此,当你的管理层对业务持续性计划回应道“嗐,碰到这种事的机会能有多大呢?”的时候你能做些什么呢?有个系统管理员称这也完全是管理层的正常行为。在这种糟糕的处境下,老练的系统管理员建议用书面形式把这些事情记录下来。记录应清楚表明你告知管理层需要采取的措施,且[他们拒绝采纳建议][16]。“总的来说就是有足够的书面材料能让他们搓成一根绳子上吊,”该系统管理员补充道。 + +如果那也不起作用,恢复一个被洪水淹没的数据中心的相关经验对你[找个新工作][17]是很有帮助的。 + +### 保护有形的基础设施 + +“[我们的办公室是幢摇摇欲坠的建筑][18],”飓风哈维重创休斯顿之后有个系统管理员提到。“我们盲目地进入那幢建筑,现场的基础设施糟透了。正是我们给那幢建筑里带去了最不想要的一滴水,现在基础设施整个都沉在水下了。” + +尽管如此,如果你想让数据中心继续运转——或在暴风雨过后恢复运转 —— 你需要确保该场所不仅能经受住你所在地区那些意料中的灾难,而且能经受住那些意料之外的灾难。一个旧金山的系统管理员知道为什么重要的是确保公司的服务器安置在可以承受里氏 7 级地震的建筑内。一家圣路易斯的公司知道如何应对龙卷风。但你应当为所有可能发生的事情做好准备:加州的龙卷风、密苏里州的地震,或[僵尸末日][19](给你在 IT 预算里增加一把链锯提供了充分理由)。 + +在休斯顿的情况下,[多数数据中心保持运转][20],因为它们是按照抵御暴风雨和洪水的标准建造的。[Data Foundry][21] 的首席技术官 Edward Henigin 说他们公司的数据中心之一,“专门建造的休斯顿 2 号的设计能抵御 5 级飓风的风速。这个场所的公共供电没有中断,我们得以避免切换到后备发电机。” + +那是好消息。坏消息是伴随着超级飓风桑迪于 2012 年登场,如果[你的数据中心没准备好应对洪水][22],你会陷入一个麻烦不断的世界。一个不能正常运转的数据中心 [Datagram][23] 服务的客户包括 Gawker、Gizmodo 和 Buzzfeed 等知名网站。 + +当然,有时候你什么也做不了。正如某个波多黎各圣胡安的系统管理员在飓风厄玛扫过后悲伤地写到,“发电机没油了。服务器机房靠电池在运转但是没有(空调)。[永别了,服务器][24]。”由于 MPLSMultiprotocol Lable Switching 线路亦中断,该系统管理员没法切换到灾备措施:“多么充实的一天。” + +总而言之,IT 专业人士需要了解他们所处的地区,了解他们面临的风险并将他们的服务器安置在能抵御当地自然灾害的数据中心内。 + +### 关于云的争议 + +当暴风雨席卷一切时避免 IT 数据中心失效的最佳方法就是确保灾备数据中心在其他地方。选择地点时需要审慎的决策。你的灾备数据中心不应在会被同一场自然灾害影响到的地域region;你的资源应安置在多个可用区availability zone内。考虑一下主备数据中心位于一场地震中的同一条断层带上,或是主备数据中心易于受互通河道导致的洪灾影响这类情况。 + +有些系统管理员[利用云作为冗余设施][25]。例如,总是用微软 Azure 云存储服务保存副本以确保持久性和高可用性。根据你的选择,Azure 复制功能将你的数据要么拷贝到同一个数据中心要么拷贝到另一个数据中心。多数公有云提供类似的自动备份服务以确保数据安全,不论你的数据中心发生什么情况——除非你的云服务供应商全部设施都在暴风雨的行进路径上。 + +昂贵么?是的。跟业务中断 1、2 天一样昂贵么?并非如此。 + +信不过公有云?可以考虑 colocolocation 服务。有了 colo,你依旧拥有你的硬件,运行你自己的应用,但这些硬件可以远离麻烦。例如飓风哈维期间,一家公司“虚拟地”将它的资源从休斯顿搬到了其位于德克萨斯奥斯汀的 colo。但是那些本地数据中心和 colo 场所需要准备好应对灾难;这点是你选择场所时要考虑的一个因素。举个例子,一个寻找 colo 场所的西雅图系统管理员考虑的“全都是抗震和旱灾应对措施(加固的地基以及补给冷却系统的运水卡车)。” + +### 周围一片黑暗时 + +正如 Forrester Research 的分析师 Rachel Dines 在一份为[灾备期刊][27]所做的调查中报告的那样,宣布的灾难中[最普遍的原因就是断电][26]。尽管你能应对一般情况下的断电,飓风、火灾和洪水的考验会超越设备的极限。 + +某个系统管理员挖苦式的计划是什么呢?“趁 UPS 完蛋之前把你能关的机器关掉,不能关的就让它崩溃咯。然后,[喝个痛快直到供电恢复][28]。” + +在 2016 年德尔塔和西南航空停电事故之后,IT 员工推动的一个更加严肃的计划是由一个有管理的服务供应商为其客户[部署不间断电源][29]:“对于至关重要的部分,在供电中断时我们结合使用简单网络管理协议SNMP信令和 PowerChute 网络关机PowerChute Nrework Shutdown客户端来关闭设备。至于重新开机,那取决于客户。有些是自动启动,有些则需要人工干预。” + +另一种做法是用来自两个供电所的供电线路支持数据中心。例如,[西雅图威斯汀大厦数据中心][30]有来自不同供电所的多路 13.4 千伏供电线路,以及多个 480 伏三相变电箱。 + +预防严重断电的系统不是“通用的”设备。系统管理员应当[为数据中心请求一台定制的柴油发电机][31]。除了按你特定的需求调整,发电机必须能迅速跳至全速运转并承载全部电力负荷而不致影响系统负载性能。” + +这些发电机也必须加以保护。例如,将你的发电机安置在泛洪区的一楼就不是个聪明的主意。位于纽约百老街Broad street的数据中心在超级飓风桑迪期间就是类似情形,备用发电机的燃料油桶在地下室 —— 并且被水淹了。尽管一场[“人力接龙”用容量 5 加仑的水桶将柴油输送到 17 段楼梯之上的发电机][32]使 [Peer 1 Hosting][33] 得以继续运营,但这不是一个切实可行的业务持续计划。 + +正如多数数据中心专家所知那样,如果你有时间 —— 假设一个飓风离你有一天的距离 —— 确保你的发电机正常工作,加满油,准备好当供电线路被刮断时立即开启,不管怎样你之前应当每月测试你的发电机。你之前是那么做的,是吧?是就好! + +### 测试你对备份的信心 + +普通用户几乎从不备份,检查备份是否实际完好的就更少了。系统管理员对此更加了解。 + +有些 [IT 部门在寻求将他们的备份迁移到云端][34]。但有些系统管理员仍对此不买账 —— 他们有很好的理由。最近有人报告,“在用了整整 5 天[从亚马逊 Glacier 恢复了(400 GB)数据][35]之后,我欠了亚马逊将近 200 美元的传输费,并且(我还是)处于未完全恢复状态,还差大约 100 GB 文件。” + +结果是有些系统管理员依然喜欢磁带备份。磁带肯定不够时髦,但正如操作系统专家 Andrew S. Tanenbaum 说的那样,“[永远不要低估一辆装满磁带在高速上飞驰的旅行车的带宽][36]。” + +目前每盘磁带可以存储 10 TB 数据;有的进行中的实验可在磁带上存储高达 200 TB 数据。诸如[线性磁带文件系统][37]Linear Tape File System之类的技术允许你象访问网络硬盘一样读取磁带数据。 + +然而对许多人而言,磁带[绝对是最后选择的手段][38]。没关系,因为备份应该有大量的可选方案。在这种情况下,一个系统管理员说到,“故障时我们会用这些方法(恢复备份):(Windows)服务器层面的 VSS (Volume Shadow Storage)快照,存储区域网络SAN层面的卷快照,以及存储区域网络层面的异地归档快照。但是万一有什么事情发生并摧毁了我们的虚拟机,存储区域网络和备份存储区域网络,我们还是可以取回磁带并恢复数据。” + +当麻烦即将到来时,可使用副本工具如 [Veeam][39],它会为你的服务器创建一个虚拟机副本。若出现故障,副本会自动启动。没有麻烦,没有手忙脚乱,正如某个系统管理员在这个流行的系统管理员帖子中所说,“[我爱你 Veeam][40]。” + +### 网络?什么网络? + +当然,如果员工们无法触及他们的服务,没有任何云、colo 和远程数据中心能帮到你。你不需要一场自然灾害来证明冗余互联网连接的正确性。只需要一台挖断线路的挖掘机或断掉的光缆就能让你在工作中渡过糟糕的一天。 + +“理想状态下”,某个系统管理员明智地观察到,“你应该有[两路互联网接入线路连接到有独立基础设施的两个 ISP][41]。例如,你不希望两个 ISP 都依赖于同一根光缆。你也不希望采用两家本地 ISP,并发现他们的上行带宽都依赖于同一家骨干网运营商。” + +聪明的系统管理员知道他们公司的互联网接入线路[必须是商业级别的][43],带有服务等级协议service-level agreement(SLA),其中包含“修复时间”条款。或者更好的是采用互联网接入专线dedicated Internet access。技术上这与任何其他互联网接入方式没有区别。区别在于互联网接入专线不是一种“尽力而为”的接入方式,而是你会得到明确规定的专供你使用的带宽并附有服务等级协议。这种专线不便宜,但正如一句格言所说的那样,“速度、可靠性、便宜,只能挑两个。”当你的业务跑在这条线路上并且一场暴风雨即将来袭,“可靠性”必须是你挑的两个之一。 + +### 晴空重现之时 + +你没法准备应对所有自然灾害,但你可以为其中很多做好计划。有一个深思熟虑且经过测试的灾备和业务持续计划,并逐字逐句严格执行,当竞争对手溺毙的时候,你的公司可以幸存下来。 + +### 系统管理员对抗自然灾害:给领导者的教训 + + * 你的 IT 员工得说多少次:不要仅仅备份,还得测试备份? + * 没电就没公司。确保你的服务器有足够的应急电源来满足业务需要,并确保它们能正常工作。 + * 如果你的公司在一场自然灾害中幸存下来,或者避开了灾害,明智的系统管理员知道这就是向管理层申请被他们推迟的灾备预算的时候了。因为下次你就未必有这么幸运了。 + + +-------------------------------------------------------------------------------- + +via: https://www.hpe.com/us/en/insights/articles/it-disaster-recovery-sysadmins-vs-natural-disasters-1711.html + +作者:[Steven-J-Vaughan-Nichols][a] +译者:[0x996](https://github.com/0x996) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.hpe.com/us/en/insights/contributors/steven-j-vaughan-nichols.html +[1]:https://www.hpe.com/us/en/insights/articles/what-is-disaster-recovery-really-1704.html +[2]:https://www.reddit.com/r/sysadmin/comments/6wricr/dear_houston_tx_sysadmins/ +[3]:https://www.reddit.com/r/sysadmin/comments/6wricr/dear_houston_tx_sysadmins/dma6gse/ +[4]:https://disastersafety.org/wp-content/uploads/open-for-business-english.pdf +[5]:https://www.fema.gov/protecting-your-businesses +[6]:http://drbenchmark.org/about-us/our-council/ +[7]:https://www.prnewswire.com/news-releases/global-benchmark-study-reveals-73-of-companies-are-unprepared-for-disaster-recovery-248359051.html +[8]:https://www.reddit.com/r/sysadmin/comments/3cob1k/what_does_your_disaster_recovery_plan_look_like/csxh8sn/ +[9]:https://www.hpe.com/us/en/resources/servers/datacenter-trends-challenges.html?jumpid=in_insights~510287587~451research_datacenter~sjvnSysadmin +[10]:http://www.theregister.co.uk/2015/07/12/surviving_hurricane_katrina +[11]:https://theprepared.com/guides/beginners-guide-amateur-ham-radio-preppers/ +[12]:http://www.npr.org/2017/09/29/554600989/amateur-radio-operators-stepped-in-to-help-communications-with-puerto-rico +[13]:http://www8.hp.com/us/en/software/joshua-brusse.html +[14]:https://www.microfocus.com/ +[15]:https://www.reddit.com/r/sysadmin/comments/6wricr/dear_houston_tx_sysadmins/dma87xv/ +[16]:https://www.hpe.com/us/en/insights/articles/my-boss-asked-me-to-do-what-how-to-handle-worrying-work-requests-1710.html +[17]:https://www.hpe.com/us/en/insights/articles/sysadmin-survival-guide-1707.html +[18]:https://www.reddit.com/r/sysadmin/comments/6wk92q/any_houston_admins_executing_their_dr_plans_this/dm8xj0q/ +[19]:https://community.spiceworks.com/how_to/1243-ensure-your-dr-plan-is-ready-for-a-zombie-apocolypse +[20]:http://www.datacenterdynamics.com/content-tracks/security-risk/houston-data-centers-withstand-hurricane-harvey/98867.article +[21]:https://www.datafoundry.com/ +[22]:http://www.datacenterknowledge.com/archives/2012/10/30/major-flooding-nyc-data-centers +[23]:https://datagram.com/ +[24]:https://www.reddit.com/r/sysadmin/comments/6yjb3p/shutting_down_everything_blame_irma/ +[25]:https://www.hpe.com/us/en/insights/articles/everything-you-need-to-know-about-clouds-and-hybrid-it-1701.html +[26]:https://www.drj.com/images/surveys_pdf/forrester/2011Forrester_survey.pdf +[27]:https://www.drj.com +[28]:https://www.reddit.com/r/sysadmin/comments/4x3mmq/datacenter_power_failure_procedures_what_do_yours/d6c71p1/ +[29]:https://www.reddit.com/r/sysadmin/comments/4x3mmq/datacenter_power_failure_procedures_what_do_yours/ +[30]:https://cloudandcolocation.com/datacenters/the-westin-building-seattle-data-center/ +[31]:https://www.techrepublic.com/article/what-to-look-for-in-a-data-center-backup-generator/ +[32]:http://www.datacenterknowledge.com/archives/2012/10/31/peer-1-mobilizes-diesel-bucket-brigade-at-75-broad +[33]:https://www.cogecopeer1.com/ +[34]:https://www.reddit.com/r/sysadmin/comments/7a6m7n/aws_glacier_archival/ +[35]:https://www.reddit.com/r/sysadmin/comments/63mypu/the_dangers_of_cloudberry_and_amazon_glacier_how/ +[36]:https://en.wikiquote.org/wiki/Andrew_S._Tanenbaum +[37]:http://www.snia.org/ltfs +[38]:https://www.reddit.com/r/sysadmin/comments/5visaq/backups_how_many_of_you_still_have_tapes/de2d0qm/ +[39]:https://helpcenter.veeam.com/docs/backup/vsphere/failover.html?ver=95 +[40]:https://www.reddit.com/r/sysadmin/comments/5rttuo/i_love_you_veeam/ +[41]:https://www.reddit.com/r/sysadmin/comments/5rmqfx/ars_surviving_a_cloudbased_disaster_recovery_plan/dd90auv/ +[42]:https://www.hpe.com/us/en/insights/articles/how-do-you-evaluate-cloud-service-agreements-and-slas-very-carefully-1705.html +[43]:http://www.e-vergent.com/what-is-dedicated-internet-access/ diff --git a/published/201908/20171216 Sysadmin 101- Troubleshooting.md b/published/201908/20171216 Sysadmin 101- Troubleshooting.md new file mode 100644 index 0000000000..0beb6eeb67 --- /dev/null +++ b/published/201908/20171216 Sysadmin 101- Troubleshooting.md @@ -0,0 +1,138 @@ +系统管理员入门:排除故障 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/06/100659pox8xkkr8zek888r.jpg) + +我通常会严格保持此博客的技术性,将观察、意见等内容保持在最低限度。但是,这篇和接下来的几篇文章将介绍刚进入系统管理/SRE/系统工程师/sysops/devops-ops(无论你想称自己是什么)角色的常见的基础知识。 + +请跟我来! + +> “我的网站很慢!” + +我只是随机选择了本文的问题类型,这也可以应用于任何与系统管理员相关的故障排除。我并不是要炫耀那些可以发现最多的信息的最聪明的“金句”。它也不是一个详尽的、一步步指导的、并在最后一个方框中导向“利润”一词的“流程图”。 + +我会通过一些例子展示常规的方法。 + +示例场景仅用于说明本文目的。它们有时会做一些不适用于所有情况的假设,而且肯定会有很多读者在某些时候说“哦,但我觉得你会发现……”。 + +但那可能会让我们错失重点。 + +十多年来,我一直在从事于支持工作,或在支持机构工作,有一件事让我一次又一次地感到震惊,这促使我写下了这篇文章。 + +**有许多技术人员在遇到问题时的本能反应,就是不管三七二十一去尝试可能的解决方案。** + +*“我的网站很慢,所以”,* + +* 我将尝试增大 `MaxClients`/`MaxRequestWorkers`/`worker_connections` +* 我将尝试提升 `innodb_buffer_pool_size`/`effective_cache_size` +* 我打算尝试启用 `mod_gzip`(遗憾的是,这是真实的故事) + +*“我曾经看过这个问题,它是因为某种原因造成的 —— 所以我估计还是这个原因,它应该能解决这个问题。”* + +这浪费了很多时间,并会让你在黑暗中盲目乱撞,胡乱鼓捣。 + +你的 InnoDB 的缓冲池也许达到 100% 的利用率,但这可能只是因为有人运行了一段时间的一次性大型报告导致的。如果没有排除这种情况,那你就是在浪费时间。 + +### 开始之前 + +在这里,我应该说明一下,虽然这些建议同样适用于许多角色,但我是从一般的支持系统管理员的角度来撰写的。在一个成熟的内部组织中,或与规模较大的、规范管理的或“企业级”客户合作时,你通常会对一切都进行检测、测量、绘制、整理(甚至不是文字),并发出警报。那么你的方法也往往会有所不同。让我们在这里先忽略这种情况。 + +如果你没有这种东西,那就随意了。 + +### 澄清问题 + +首先确定实际上是什么问题。“慢”可以是多种形式的。是收到第一个字节的时间吗?从糟糕的 Javascript 加载和每页加载要拉取 15 MB 的静态内容,这是一个完全不同类型的问题。是慢,还是比通常慢?这是两个非常不同的解决方案! + +在你着手做某事之前,确保你知道实际报告和遇到的问题。找到问题的根源通常很困难,但即便找不到也必须找到问题本身。 + +否则,这相当于系统管理员带着一把刀去参加枪战。 + +### 唾手可得 + +首次登录可疑服务器时,你可以查找一些常见的嫌疑对象。事实上,你应该这样做!每当我登录到服务器时,我都会发出一些命令来快速检查一些事情:我们是否发生了页交换(`free` / `vmstat`),磁盘是否繁忙(`top` / `iostat` / `iotop`),是否有丢包(`netstat` / `proc` / `net` / `dev`),是否处于连接数过多的状态(`netstat`),有什么东西占用了 CPU(`top`),谁在这个服务器上(`w` / `who`),syslog 和 `dmesg` 中是否有引人注目的消息? + +如果你从 RAID 控制器得到 2000 条抱怨直写式缓存没有生效的消息,那么继续进行是没有意义的。 + +这用不了半分钟。如果什么都没有引起你的注意 —— 那么继续。 + +### 重现问题 + +如果某处确实存在问题,并且找不到唾手可得的信息。 + +那么采取所有步骤来尝试重现问题。当你可以重现该问题时,你就可以观察它。**当你能观察到时,你就可以解决。**如果在第一步中尚未显现出或覆盖了问题所在,询问报告问题的人需要采取哪些确切步骤来重现问题。 + +对于由太阳耀斑或只能运行在 OS/2 上的客户端引起的问题,重现并不总是可行的。但你的第一个停靠港应该是至少尝试一下!在一开始,你所知道的是“某人认为他们的网站很慢”。对于那些人,他们可能还在用他们的 GPRS 手机,也可能正在安装 Windows 更新。你在这里挖掘得再深也是浪费时间。 + +尝试重现! + +### 检查日志 + +我对于有必要包括这一点感到很难过。但是我曾经看到有人在运行 `tail /var/log/...` 之后几分钟就不看了。大多数 *NIX 工具都特别喜欢记录日志。任何明显的错误都会在大多数应用程序日志中显得非常突出。检查一下。 + +### 缩小范围 + +如果没有明显的问题,但你可以重现所报告的问题,那也很棒。所以,你现在知道网站是慢的。现在你已经把范围缩小到:浏览器的渲染/错误、应用程序代码、DNS 基础设施、路由器、防火墙、网卡(所有的)、以太网电缆、负载均衡器、数据库、缓存层、会话存储、Web 服务器软件、应用程序服务器、内存、CPU、RAID 卡、磁盘等等。 + +根据设置添加一些其他可能的罪魁祸首。它们也可能是 SAN,也不要忘记硬件 WAF!以及…… 你明白我的意思。 + +如果问题是接收到第一个字节的时间,你当然会开始对 Web 服务器去应用上已知的修复程序,就是它响应缓慢,你也觉得几乎就是它,对吧?但是你错了! + +你要回去尝试重现这个问题。只是这一次,你要试图消除尽可能多的潜在问题来源。 + +你可以非常轻松地消除绝大多数可能的罪魁祸首:你能从服务器本地重现问题吗?恭喜,你刚刚节省了自己必须尝试修复 BGP 路由的时间。 + +如果不能,请尝试使用同一网络上的其他计算机。如果可以的话,至少你可以将防火墙移到你的嫌疑人名单上,(但是要注意一下那个交换机!) + +是所有的连接都很慢吗?虽然服务器是 Web 服务器,但并不意味着你不应该尝试使用其他类型的服务进行重现问题。[netcat][1] 在这些场景中非常有用(但是你的 SSH 连接可能会一直有延迟,这可以作为线索)! 如果这也很慢,你至少知道你很可能遇到了网络问题,可以忽略掉整个 Web 软件及其所有组件的问题。用这个知识(我不收 200 美元)再次从顶部开始,按你的方式由内到外地进行! + +即使你可以在本地复现 —— 仍然有很多“因素”留下。让我们排除一些变量。你能用普通文件重现它吗? 如果 `i_am_a_1kb_file.html` 很慢,你就知道它不是数据库、缓存层或 OS 以外的任何东西和 Web 服务器本身的问题。 + +你能用一个需要解释或执行的 `hello_world.(py|php|js|rb..)` 文件重现问题吗?如果可以的话,你已经大大缩小了范围,你可以专注于少数事情。如果 `hello_world` 可以马上工作,你仍然学到了很多东西!你知道了没有任何明显的资源限制、任何满的队列或在任何地方卡住的 IPC 调用,所以这是应用程序正在做的事情或它正在与之通信的事情。 + +所有页面都慢吗?或者只是从第三方加载“实时分数数据”的页面慢? + +**这可以归结为:你仍然可以重现这个问题所涉及的最少量的“因素”是什么?** + +我们的示例是一个缓慢的网站,但这同样适用于几乎所有问题。邮件投递?你能在本地投递吗?能发给自己吗?能发给<常见的服务提供者>吗?使用小的、纯文本的消息进行测试。尝试直到遇到 2MB 拥堵时。使用 STARTTLS 和不使用 STARTTLS 呢?按你的方式由内到外地进行! + +这些步骤中的每一步都只需要几秒钟,远远快于实施大多数“可能的”修复方案。 + +### 隔离观察 + +到目前为止,当你去除特定组件时无法重现问题时,你可能已经偶然发现了问题所在。 + +但如果你还没有,或者你仍然不知道**为什么**:一旦你找到了一种方法来重现问题,你和问题之间的“东西”(某个技术术语)最少,那么就该开始隔离和观察了。 + +请记住,许多服务可以在前台运行和/或启用调试。对于某些类别的问题,执行此操作通常非常有帮助。 + +这也是你的传统武器库发挥作用的地方。`strace`、`lsof`、`netstat`、`GDB`、`iotop`、`valgrind`、语言分析器(cProfile、xdebug、ruby-prof ……)那些类型的工具。 + +一旦你走到这一步,你就很少能摆脱剖析器或调试器了。 + +[strace][2] 通常是一个非常好的起点。 + +你可能会注意到应用程序停留在某个连接到端口 3306 的套接字文件描述符上的特定 `read()` 调用上。你会知道该怎么做。 + +转到 MySQL 并再次从顶部开始。显而易见:“等待某某锁”、死锁、`max_connections` ……进而:是所有查询?还是只写请求?只有某些表?还是只有某些存储引擎?等等…… + +你可能会注意到调用外部 API 资源的 `connect()` 需要五秒钟才能完成,甚至超时。你会知道该怎么做。 + +你可能会注意到,在同一对文件中有 1000 个调用 `fstat()` 和 `open()` 作为循环依赖的一部分。你会知道该怎么做。 + +它可能不是那些特别的东西,但我保证,你会发现一些东西。 + +如果你只是从这一部分学到一点,那也不错;学习使用 `strace` 吧!**真的**学习它,阅读整个手册页。甚至不要跳过历史部分。`man` 每个你还不知道它做了什么的系统调用。98% 的故障排除会话以 `strace` 而终结。 + +--------------------------------------------------------------------- + +via: http://northernmost.org/blog/troubleshooting-101/index.html + +作者:[Erik Ljungstrom][a] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://northernmost.org +[1]:http://nc110.sourceforge.net/ +[2]:https://linux.die.net/man/1/strace diff --git a/published/201908/20180104 How allowing myself to be vulnerable made me a better leader.md b/published/201908/20180104 How allowing myself to be vulnerable made me a better leader.md new file mode 100644 index 0000000000..f52b693856 --- /dev/null +++ b/published/201908/20180104 How allowing myself to be vulnerable made me a better leader.md @@ -0,0 +1,56 @@ +怎样通过示弱增强领导力 +====== +![](https://img.linux.net.cn/data/attachment/album/201908/25/052430b01hc00qrcz99p9w.jpg) + +传统观念中的领导者总是强壮、大胆、果决的。我也确实见过一些拥有这些特点的领导者。但更多时候,领导者也许看起来比传统印象中的领导者要更脆弱些,他们内心有很多这样的疑问:我的决策正确吗?我真的适合这个职位吗?我有没有在做最该做的事情? + +解决这些问题的方法是把问题说出来。把问题憋在心里只会助长它们,一名开明的领导者更倾向于把自己的脆弱之处暴露出来,这样我们才能从有过相同经验的人那里得到慰藉。 + +为了证明这个观点,我来讲一个故事。 + +### 一个扰人的想法 + +假如你在教育领域工作,你会发现发现大家更倾向于创造[一个包容性的环境][1] —— 一个鼓励多样性繁荣发展的环境。长话短说,我一直以来都认为自己是出于营造包容性环境的考量,而进行的“多样性雇佣”,意思就是人事雇佣我看重的是我的性别而非能力,这个想法一直困扰着我。随之而来的开始自我怀疑:我真的是这个岗位的最佳人选吗?还是只是因为我是个女人?许多年来,我都认为公司雇佣我是因为我的能力最好。但如今却发现,对那些雇主们来说,与我的能力相比,他们似乎更关注我的性别。 + +我开解自己:我到底是因为什么被雇佣并不重要,我知道我是这个职位的最佳人选而且我会用实际行动去证明。我工作很努力,达到过预期,也犯过错,也收获了很多,我做了一个老板想要自己雇员做的一切事情。 + +但那个“多样性雇佣”问题的阴影并未因此散去。我无法摆脱它,甚至回避一切与之相关的话题如蛇蝎,最终意识到自己拒绝谈论它意味着我能做的只有直面它。如果我继续回避这个问题,早晚会影响到我的工作,这是我最不希望看到的。 + +### 倾诉心中的困扰 + +直接谈论多样性和包容性这个话题有点尴尬,在进行自我剖析之前有几个问题需要考虑: + + * 我们能够相信我们的同事,能够在他们面前表露脆弱吗? + * 一个团队的领导者在同事面前表露脆弱合适吗? + * 如果我玩脱了呢?会不会影响我的工作? + +于是我和一位主管在午餐时间进行了一场小型的 Q&A 会议,这位主管负责着集团很多领域,并且以正直坦率著称。一位女同事问他,“我是因为多样性才被招进来的吗?”,他停下手头工作花了很长时间和一屋子女性员工解释了这件事,我不想复述他讲话的全部内容,我只说对我触动最大的几句:如果你知道自己能够胜任这个职位,并且面试很顺利,那么不必质疑招聘的结果。每个怀疑自己是因为多样性雇佣进公司的人私下都有自己的问题,你不必重蹈他们的覆辙。 + +完毕。 + +我很希望我能由衷地说我放下这个问题了,但事实上我没有。这问题挥之不去:万一我就是被破格录取的那个呢?万一我就是多样性雇佣的那个呢?我认识到我不能避免地反复思考这些问题。 + +几周后我和这位主管进行了一次一对一谈话,在谈话的末尾,我提到作为一位女性,自己很欣赏他那番对于多样性和包容性的坦率发言。当得知领导很有交流的意愿时,谈论这种话题变得轻松许多。我也向他提出了最初的问题,“我是因为多样性才被雇佣的吗?”,他回答得很干脆:“我们谈论过这个问题。”谈话后我意识到,我急切地想找人谈论这些需要勇气的问题,其实只是因为我需要有一个人的关心、倾听和好言劝说。 + +但正因为我有展露脆弱的勇气——去和那位主管谈论我的问题——我承受我的秘密困扰的能力提高了。我觉得身轻如燕,我开始组织各种对话,主要围绕着内隐偏见及其引起的一系列问题、怎样增加自身的包容性和多样性的表现等。通过这些经历,我发现每个人对于多样性都有不同的认识,如果我只囿于自己的秘密,我不会有机会组织参与这些精彩的对话。 + +我有谈论内心脆弱的勇气,我希望你也有。 + +我们可以谈谈那些影响我们领导力的秘密,这样从任何意义上来说,我们距离成为一位开明的领导就近了一些。那么适当示弱有帮助你成为更好的领导者吗? + +### 作者简介 + +Angela Robertson 是微软的一名高管。她和她的团队对社群互助有着极大热情,并参与开源工作。在加入微软之前,Angela 就职于红帽公司。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/how-allowing-myself-be-vulnerable-made-me-better-leader + +作者:[Angela Robertson][a] +译者:[Valoniakim](https://github.com/Valoniakim) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/arobertson98 +[1]:https://opensource.com/open-organization/17/9/building-for-inclusivity diff --git a/published/201908/20180116 Command Line Heroes- Season 1- OS Wars.md b/published/201908/20180116 Command Line Heroes- Season 1- OS Wars.md new file mode 100644 index 0000000000..6858132c13 --- /dev/null +++ b/published/201908/20180116 Command Line Heroes- Season 1- OS Wars.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11251-1.html) +[#]: subject: (Command Line Heroes: Season 1: OS Wars) +[#]: via: (https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-1) +[#]: author: (redhat https://www.redhat.com) + +《代码英雄》第一季(1):操作系统战争(上) +====== + +> 代码英雄讲述了开发人员、程序员、黑客、极客和开源反叛者如何彻底改变技术前景的真实史诗故事。 + +![](https://www.redhat.com/files/webux/img/bandbg/bkgd-clh-ep1-2000x950.png) + +本文是《[代码英雄](https://www.redhat.com/en/command-line-heroes)》系列播客[第一季(1):操作系统战争(上)](https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-1) 的[音频](https://dts.podtrac.com/redirect.mp3/audio.simplecast.com/f7670e99.mp3)脚本。 + +**Saron Yitbarek:**有些故事如史诗般,惊险万分,在我脑海中似乎出现了星球大战电影开头的爬行文字。你知道的,就像—— + +配音:“第一集,操作系统大战” + +**Saron Yitbarek:**是的,就像那样子。 + +配音:这是一个局势紧张加剧的时期。比尔·盖茨Bill Gates史蒂夫·乔布斯Steve Jobs的帝国发起了一场无可避免的专有软件之战。[00:00:30] 盖茨与 IBM 结成了强大的联盟,而乔布斯则拒绝了对它的硬件和操作系统开放授权。他们争夺统治地位的争斗在一场操作系统战争中席卷了整个银河系。与此同时,这些帝王们所不知道的偏远之地,开源的反叛者们开始集聚。 + +**Saron Yitbarek:**好吧。这也许有点戏剧性,但当我们谈论上世纪八九十年代和 2000 年代的操作系统之争时,这也不算言过其实。*[00:01:00]* 确实曾经发生过一场史诗级的统治之战。史蒂夫·乔布斯和比尔·盖茨确实掌握着数十亿人的命运。掌控了操作系统,你就掌握了绝大多数人使用计算机的方式、互相通讯的方式、获取信息的方式。我可以一直罗列下去,不过你知道我的意思。掌握了操作系统,你就是帝王。 + +我是 Saron Yitbarek,你现在收听的是代码英雄,一款红帽公司原创的博客节目。*[00:01:30]* 你问,什么是代码英雄Command Line Hero?嗯,如果你愿意创造而不仅仅是使用,如果你相信开发者拥有构建美好未来的能力,如果你希望拥有一个大家都有权利表达科技如何塑造生活的世界,那么你,我的朋友,就是一位代码英雄。在本系列节目中,我们将为你带来那些“白码起家”(LCTT 译注:原文是 “from the command line up”,应该是演绎自 “from the ground up”——白手起家)改变技术的程序员故事。*[00:02:00]* 那么我是谁,凭什么指导你踏上这段艰苦的旅程?Saron Yitbarek 是哪根葱?嗯,事实上我觉得我跟你差不多。我是一名面向初学者的开发人员,我做的任何事都依赖于开源软件,我的世界就是如此。通过在博客中讲故事,我可以跳出无聊的日常工作,鸟瞰全景,希望这对你也一样有用。 + +我迫不及待地想知道,开源技术从何而来?我的意思是,我对林纳斯·托瓦兹Linus Torvalds和 Linux^® 的荣耀有一些了解,*[00:02:30]* 我相信你也一样,但是说真的,开源并不是一开始就有的,对吗?如果我想发自内心的感激这些最新、最棒的技术,比如 DevOps 和容器之类的,我感觉我对那些早期的开发者缺乏了解,我有必要了解这些东西来自何处。所以,让我们暂时先不用担心内存泄露和缓冲溢出。我们的旅程将从操作系统之战开始,这是一场波澜壮阔的桌面控制之战。*[00:03:00]* 这场战争亘古未有,因为:首先,在计算机时代,大公司拥有指数级的规模优势;其次,从未有过这么一场控制争夺战是如此变化多端。比尔·盖茨和史蒂夫·乔布斯? 他们也不知道结果会如何,但是到目前为止,这个故事进行到一半的时候,他们所争夺的所有东西都将发生改变、进化,最终上升到云端。 + +*[00:03:30]* 好的,让我们回到 1983 年的秋季。还有六年我才出生。那时候的总统还是罗纳德·里根Ronald Reagan,美国和苏联扬言要把地球拖入核战争之中。在檀香山(火奴鲁鲁)的市政中心正在举办一年一度的苹果公司销售会议。一群苹果公司的员工正在等待史蒂夫·乔布斯上台。他 28 岁,热情洋溢,看起来非常自信。乔布斯很严肃地对着麦克风说他邀请了三个行业专家来就软件进行了一次小组讨论。*[00:04:00]* 然而随后发生的事情你肯定想不到。超级俗气的 80 年代音乐响彻整个房间。一堆多彩灯管照亮了舞台,然后一个播音员的声音响起- + +**配音:**女士们,先生们,现在是麦金塔软件的约会游戏时间。 + +**Saron Yitbarek:**乔布斯的脸上露出一个大大的笑容,台上有三个 CEO 都需要轮流向他示好。这基本上就是 80 年代钻石王老五,不过是科技界的。*[00:04:30]* 两个软件大佬讲完话后,然后就轮到第三个人讲话了。仅此而已不是吗?是的。新面孔比尔·盖茨带着一个大大的遮住了半张脸的方框眼镜。他宣称在 1984 年,微软的一半收入将来自于麦金塔软件。他的这番话引来了观众热情的掌声。*[00:05:00]* 但是他们不知道的是,在一个月后,比尔·盖茨将会宣布发布 Windows 1.0 的计划。你永远也猜不到乔布斯正在跟苹果未来最大的敌人打情骂俏。但微软和苹果即将经历科技史上最糟糕的婚礼。他们会彼此背叛、相互毁灭,但又深深地、痛苦地捆绑在一起。 + +**James Allworth:***[00:05:30]* 我猜从哲学上来讲,一个更理想化、注重用户体验高于一切,是一个一体化的组织,而微软则更务实,更模块化 —— + +**Saron Yitbarek:**这位是 James Allworth。他是一位多产的科技作家,曾在苹果零售的企业团队工作。注意他给出的苹果的定义,一个一体化的组织,那种只对自己负责的公司,一个不想依赖别人的公司,这是关键。 + +**James Allworth:***[00:06:00]* 苹果是一家一体化的公司,它希望专注于令人愉悦的用户体验,这意味着它希望控制整个技术栈以及交付的一切内容:从硬件到操作系统,甚至运行在操作系统上的应用程序。当新的创新、重要的创新刚刚进入市场,而你需要横跨软硬件,并且能够根据自己意愿和软件的革新来改变硬件时,这是一个优势。例如 ——, + +**Saron Yitbarek:***[00:06:30]* 很多人喜欢这种一体化的模式,并因此成为了苹果的铁杆粉丝。还有很多人则选择了微软。让我们回到檀香山的销售会议上,在同一场活动中,乔布斯向观众展示了他即将发布的超级碗广告。你可能已经亲眼见过这则广告了。想想乔治·奥威尔George Orwell的 《一九八四》。在这个冰冷、灰暗的世界里,无意识的机器人正在独裁者的投射凝视下徘徊。*[00:07:00]* 这些机器人就像是 IBM 的用户们。然后,代表苹果公司的漂亮而健美的安娅·梅杰Anya Major穿着鲜艳的衣服跑过大厅。她向着大佬们的屏幕猛地投出大锤,将它砸成了碎片。老大哥的咒语解除了,一个低沉的声音响起,苹果公司要开始介绍麦金塔了。 + +**配音:**这就是为什么现实中的 1984 跟小说《一九八四》不一样了。 + +Saron Yitbarek:是的,现在回顾那则广告,认为苹果是一个致力于解放大众的自由斗士的想法有点过分了。但这件事触动了我的神经。*[00:07:30]* Ken Segal 曾在为苹果制作这则广告的广告公司工作过。在早期,他为史蒂夫·乔布斯做了十多年的广告。 + +**Ken Segal:**1984 这则广告的风险很大。事实上,它的风险太大,以至于苹果公司在看到它的时候都不想播出它。你可能听说了史蒂夫喜欢它,但苹果公司董事会的人并不喜欢它。事实上,他们很愤怒,这么多钱被花在这么一件事情上,以至于他们想解雇广告代理商。*[00:08:00]* 史蒂夫则为我们公司辩护。 + +**Saron Yitbarek:**乔布斯,一如既往地,慧眼识英雄。 + +**Ken Segal:**这则广告在公司内、在业界内都引起了共鸣,成为了苹果产品的代表。无论人们那天是否有在购买电脑,它都带来了一种持续了一年又一年的影响,并有助于定义这家公司的品质:我们是叛军,我们是拿着大锤的人。 + +**Saron Yitbarek:***[00:08:30]* 因此,在争夺数十亿潜在消费者心智的过程中,苹果公司和微软公司的帝王们正在学着把自己塑造成救世主、非凡的英雄、一种对生活方式的选择。但比尔·盖茨知道一些苹果难以理解的事情。那就是在一个相互连接的世界里,没有人,即便是帝王,也不能独自完成任务。 + +*[00:09:00]* 1985 年 6 月 25 日。盖茨给当时的苹果 CEO John Scully 发了一份备忘录。那是一个迷失的年代。乔布斯刚刚被逐出公司,直到 1996 年才回到苹果。也许正是因为乔布斯离开了,盖茨才敢写这份东西。在备忘录中,他鼓励苹果授权制造商分发他们的操作系统。我想读一下备忘录的最后部分,让你们知道这份备忘录是多么的有洞察力。*[00:09:30]* 盖茨写道:“如果没有其他个人电脑制造商的支持,苹果现在不可能让他们的创新技术成为标准。苹果必须开放麦金塔的架构,以获得快速发展和建立标准所需的支持。”换句话说,你们不要再自己玩自己的了。你们必须有与他人合作的意愿。你们必须与开发者合作。 + +*[00:10:00]* 多年后你依然可以看到这条哲学思想,当微软首席执行官史蒂夫·鲍尔默Steve Ballmer上台做主题演讲时,他开始大喊:“开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者。”你懂我的意思了吧。微软喜欢开发人员。虽然目前(LCTT 译注:本播客发布于 2018 年初)他们不打算与这些开发人员共享源代码,但是他们确实想建立起整个合作伙伴生态系统。*[00:10:30]* 而当比尔·盖茨建议苹果公司也这么做时,如你可能已经猜到的,这个想法就被苹果公司抛到了九霄云外。他们的关系产生了间隙,五个月后,微软发布了 Windows 1.0。战争开始了。 + +> 开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者,开发者。 + +*[00:11:00]* 你正在收听的是来自红帽公司的原创播客《代码英雄》。本集是第一集,我们将回到过去,重温操作系统战争的史诗故事,我们将会发现,科技巨头之间的战争是如何为我们今天所生活的开源世界扫清道路的 + +好的,让我们先来个背景故事吧。如果你已经听过了,那么请原谅我,但它很经典。当时是 1979 年,史蒂夫·乔布斯开车去帕洛阿尔托Palo Alto施乐公园研究中心Xerox Park research center。*[00:11:30]* 那里的工程师一直在为他们所谓的图形用户界面开发一系列的元素。也许你听说过。它们有菜单、滚动条、按钮、文件夹和重叠的窗口。这是对计算机界面的一个美丽的新设想。这是前所未有的。作家兼记者 Steve Levy 会谈到它的潜力。 + +**Steven Levy:***[00:12:00]* 对于这个新界面来说,有很多令人激动的地方,它比以前的交互界面更友好,以前用的所谓的命令行 —— 你和电脑之间的交互方式跟现实生活中的交互方式完全不同。鼠标和电脑上的图像让你可以做到像现实生活中的交互一样,你可以像指向现实生活中的东西一样指向电脑上的东西。这让事情变得简单多了。你无需要记住所有那些命令。 + +**Saron Yitbarek:***[00:12:30]* 不过,施乐的高管们并没有意识到他们正坐在金矿上。一如既往地,工程师比主管们更清楚它的价值。因此那些工程师,当被要求向乔布斯展示所有这些东西是如何工作时,有点紧张。然而这是毕竟是高管的命令。乔布斯觉得,用他的话来说,“这个产品天才本来能够让施乐公司垄断整个行业,可是它最终会被公司的经营者毁掉,因为他们对产品的好坏没有概念。”*[00:13:00]* 这话有些苛刻,但是,乔布斯带着一卡车施乐高管错过的想法离开了会议。这几乎包含了他需要革新桌面计算体验的所有东西。1983 年,苹果发布了 Lisa 电脑,1984 年又发布了 Mac 电脑。这些设备的创意是抄袭自施乐公司的。 + +让我感兴趣的是,乔布斯对控诉他偷了图形用户界面的反应。他对此很冷静。他引用毕加索的话:“好的艺术家抄袭,伟大的艺术家偷窃。”他告诉一位记者,“我们总是无耻地窃取伟大的创意。”*[00:13:30]* 伟大的艺术家偷窃,好吧,我的意思是,我们说的并不是严格意义上的“偷窃”。没人拿到了专有的源代码并公然将其集成到他们自己的操作系统中去。这要更温和些,更像是创意的借用。这就难控制的多了,就像乔布斯自己即将学到的那样。传奇的软件奇才、真正的代码英雄 Andy Hertzfeld 就是麦金塔开发团队的最初成员。 + +**Andy Hertzfeld:***[00:14:00]* 是的,微软是我们的第一个麦金塔电脑软件合作伙伴。当时,我们并没有把他们当成是竞争对手。他们是苹果之外,我们第一家交付麦金塔电脑原型的公司。我通常每周都会和微软的技术主管聊一次。他们是第一个尝试我们所编写软件的外部团队。*[00:14:30]* 他们给了我们非常重要的反馈,总的来说,我认为我们的关系非常好。但我也注意到,在我与技术主管的交谈中,他开始问一些系统实现方面的问题,而他本无需知道这些,我觉得,他们想要复制麦金塔电脑。我很早以前就向史蒂夫·乔布斯反馈过这件事,但在 1983 年秋天,这件事达到了高潮。*[00:15:00]* 我们发现,他们在 1983 年 11 月的 COMDEX 上发布了 Windows,但却没有提前告诉我们。对此史蒂夫·乔布斯勃然大怒。他认为那是一种背叛。 + +**Saron Yitbarek:**随着新版 Windows 的发布,很明显,微软从苹果那里学到了苹果从施乐那里学来的所有想法。乔布斯很易怒。他的关于伟大艺术家如何偷窃的毕加索名言被别人学去了,而且恐怕盖茨也正是这么做的。*[00:15:30]* 据报道,当乔布斯怒斥盖茨偷了他们的东西时,盖茨回应道:“史蒂夫,我觉得这更像是我们都有一个叫施乐的富有邻居,我闯进他家偷电视机,却发现你已经偷过了”。苹果最终以窃取 GUI 的外观和风格为名起诉了微软。这个案子持续了好几年,但是在 1993 年,第 9 巡回上诉法院的一名法官最终站在了微软一边。*[00:16:00]* Vaughn Walker 法官宣布外观和风格不受版权保护。这是非常重要的。这一决定让苹果在无法垄断桌面计算的界面。很快,苹果短暂的领先优势消失了。以下是 Steven Levy 的观点。 + +**Steven Levy:**他们之所以失去领先地位,不是因为微软方面窃取了知识产权,而是因为他们无法巩固自己在上世纪 80 年代拥有的更好的操作系统的优势。坦率地说,他们的电脑索价过高。*[00:16:30]* 因此微软从 20 世纪 80 年代中期开始开发 Windows 系统,但直到 1990 年开发出的 Windows 3,我想,它才真正算是一个为黄金时期做好准备的版本,才真正可供大众使用。*[00:17:00]* 从此以后,微软能够将数以亿计的用户迁移到图形界面,而这是苹果无法做到的。虽然苹果公司有一个非常好的操作系统,但是那已经是 1984 年的产品了。 + +**Saron Yitbarek:**现在微软主导着操作系统的战场。他们占据了 90% 的市场份额,并且针对各种各样的个人电脑进行了标准化。操作系统的未来看起来会由微软掌控。此后发生了什么?*[00:17:30]* 1997 年,波士顿 Macworld 博览会上,你看到了一个几近破产的苹果,一个谦逊的多的史蒂夫·乔布斯走上舞台,开始谈论伙伴关系的重要性,特别是他们与微软的新型合作伙伴关系。史蒂夫·乔布斯呼吁双方缓和关系,停止火拼。微软将拥有巨大的市场份额。从表面看,我们可能会认为世界和平了。但当利益如此巨大时,事情就没那么简单了。*[00:18:00]* 就在苹果和微软在数十年的争斗中伤痕累累、最终败退到死角之际,一名 21 岁的芬兰计算机科学专业学生出现了。几乎是偶然地,他彻底改变了一切。 + +我是 Saron Yitbarek,这里是代码英雄。 + +正当某些科技巨头正忙着就专有软件相互攻击时,自由软件和开源软件的新领军者如雨后春笋般涌现。*[00:18:30]* 其中一位优胜者就是理查德·斯托尔曼Richard Stallman。你也许对他的工作很熟悉。他想要有自由软件和自由社会。这就像言论自由一样的自由free,而不是像免费啤酒一样的免费free。早在 80 年代,斯托尔曼就发现,除了昂贵的专有操作系统(如 UNIX)外,就没有其他可行的替代品。因此他决定自己做一个。斯托尔曼的自由软件基金会Free Software Foundation开发了 GNU,当然,它的意思是 “GNU's not UNIX”。它将是一个像 UNIX 一样的操作系统,但不包含所有的 UNIX 代码,而且用户可以自由共享。 + +*[00:19:00]* 为了让你体会到上世纪 80 年代自由软件概念的重要性,从不同角度来说拥有 UNIX 代码的两家公司,AT&T 贝尔实验室AT&T Bell Laboratories以及UNIX 系统实验室UNIX System Laboratories威胁将会起诉任何看过 UNIX 源代码后又创建自己操作系统的人。这些人是次级专利所属。*[00:19:30]* 用这两家公司的话来说,所有这些程序员都在“精神上受到了污染”,因为他们都见过 UNIX 代码。在 UNIX 系统实验室和伯克利软件设计公司Berkeley Software Design之间的一个著名的法庭案例中,有人认为任何功能类似的系统,即使它本身没有使用 UNIX 代码,也侵犯版权。Paul Jones 当时是一名开发人员。他现在是数字图书馆 ibiblio.org 的主管。 + +**Paul Jones:***[00:20:00]* 任何看过代码的人都受到了精神污染是他们的观点。因此几乎所有在安装有与 UNIX 相关操作系统的电脑上工作过的人以及任何在计算机科学部门工作的人都受到精神上的污染。因此,在 USENIX 的一年里,我们都得到了一写带有红色字母的白色小别针,上面写着“精神受到了污染”。我们很喜欢带着这些别针到处走,以表达我们跟着贝尔实验室混,因为我们的精神受到了污染。 + +**Saron Yitbarek:***[00:20:30]* 整个世界都被精神污染了。想要保持纯粹、保持事物的美好和专有的旧哲学正变得越来越不现实。正是在这被污染的现实中,历史上最伟大的代码英雄之一诞生了,他是一个芬兰男孩,名叫林纳斯·托瓦兹Linus Torvalds。如果这是《星球大战》,那么林纳斯·托瓦兹就是我们的卢克·天行者Luke Skywalker。他是赫尔辛基大学一名温文尔雅的研究生。*[00:21:00]* 有才华,但缺乏大志。典型的被逼上梁山的英雄。和其他年轻的英雄一样,他也感到沮丧。他想把 386 处理器整合到他的新电脑中。他对自己的 IBM 兼容电脑上运行的 MS-DOS 操作系统并不感冒,也负担不起 UNIX 软件 5000 美元的价格,而只有 UNIX 才能让他自由地编程。解决方案是托瓦兹在 1991 年春天基于 MINIX 开发了一个名为 Linux 的操作系统内核。他自己的操作系统内核。 + +**Steven Vaughan-Nichols:***[00:21:30]* 林纳斯·托瓦兹真的只是想找点乐子而已。 + +**Saron Yitbarek:**Steven Vaughan-Nichols 是 ZDNet.com 的特约编辑,而且他从科技行业出现以来就一直在写科技行业相关的内容。 + +**Steven Vaughan-Nichols:**当时有几个类似的操作系统。他最关注的是一个名叫 MINIX 的操作系统,MINIX 旨在让学生学习如何构建操作系统。林纳斯看到这些,觉得很有趣,但他想建立自己的操作系统。*[00:22:00]* 所以,它实际上始于赫尔辛基的一个 DIY 项目。一切就这样开始了,基本上就是一个大孩子在玩耍,学习如何做些什么。*[00:22:30]* 但不同之处在于,他足够聪明、足够执着,也足够友好,让所有其他人都参与进来,然后他开始把这个项目进行到底。27 年后,这个项目变得比他想象的要大得多。 + +**Saron Yitbarek:**到 1991 年秋季,托瓦兹发布了 10000 行代码,世界各地的人们开始评头论足,然后进行优化、添加和修改代码。*[00:23:00]* 对于今天的开发人员来说,这似乎很正常,但请记住,在那个时候,像这样的开放协作是对微软、苹果和 IBM 已经做的很好的整个专有系统的道德侮辱。随后这种开放性被奉若神明。托瓦兹将 Linux 置于 GNU 通用公共许可证(GPL)之下。曾经保障斯托尔曼的 GNU 系统自由的许可证现在也将保障 Linux 的自由。Vaughan-Nichols 解释道,这种融入到 GPL 的重要性怎么强调都不过分,它基本上能永远保证软件的自由和开放性。 + +**Steven Vaughan-Nichols:***[00:23:30]* 事实上,根据 Linux 所遵循的许可协议,即 GPL 第 2 版,如果你想贩卖 Linux 或者向全世界展示它,你必须与他人共享代码,所以如果你对其做了一些改进,仅仅给别人使用是不够的。事实上你必须和他们分享所有这些变化的具体细节。然后,如果这些改进足够好,就会被 Linux 所吸收。 + +**Saron Yitbarek:***[00:24:00]* 事实证明,这种公开的方式极具吸引力。埃里克·雷蒙德Eric Raymond 是这场运动的早期传道者之一,他在他那篇著名的文章中写道:“微软和苹果这样的公司一直在试图建造软件大教堂,而 Linux 及类似的软件则提供了一个由不同议程和方法组成的巨大集市,集市比大教堂有趣多了。” + +**tormy Peters:**我认为在那个时候,真正吸引人的是人们终于可以把控自己的世界了。 + +**Saron Yitbarek:**Stormy Peters 是一位行业分析师,也是自由和开源软件的倡导者。 + +**Stormy Peters:***[00:24:30]* 当开源软件第一次出现的时候,所有的操作系统都是专有的。如果不使用专有软件,你甚至不能添加打印机,你不能添加耳机,你不能自己开发一个小型硬件设备,然后让它在你的笔记本电脑上运行。你甚至不能放入 DVD 并复制它,因为你不能改变软件,即使你拥有这张 DVD,你也无法复制它。*[00:25:00]* 你无法控制你购买的硬件/软件系统。你不能从中创造出任何新的、更大的、更好的东西。这就是为什么开源操作系统在一开始就如此重要的原因。我们需要一个开源协作环境,在那里我们可以构建更大更好的东西。 + +**Saron Yitbarek:**请注意,Linux 并不是一个纯粹的平等主义乌托邦。林纳斯·托瓦兹不会批准对内核的所有修改,而是主导了内核的变更。他安排了十几个人来管理内核的不同部分。*[00:25:30]* 这些人也会信任自己下面的人,以此类推,形成信任金字塔。变化可能来自任何地方,但它们都是经过判断和策划的。 + +然而,考虑到到林纳斯的 DIY 项目一开始是多么的简陋和随意,这项成就令人十分惊讶。他完全不知道自己就是这一切中的卢克·天行者。当时他只有 21 岁,一半的时间都在编程。但是当魔盒第一次被打开,人们开始给他反馈。*[00:26:00]* 几十个,然后几百个,成千上万的贡献者。有了这样的众包基础,Linux 很快就开始成长。真的成长得很快。甚至最终引起了微软的注意。他们的首席执行官史蒂夫·鲍尔默Steve Ballmer将 Linux 称为是“一种癌症,从知识产权得角度来看,它传染了接触到得任何东西 ”。Steven Levy 将会描述 Ballmer 的由来。 + +**Steven Levy:***[00:26:30]* 一旦微软真正巩固了它的垄断地位,而且它也确实被联邦法院判定为垄断,他们将会对任何可能对其构成威胁的事情做出强烈反应。因此,既然他们对软件收费,很自然得,他们将自由软件得出现看成是一种癌症。他们试图提出一个知识产权理论,来解释为什么这对消费者不利。 + +**Saron Yitbarek:***[00:27:00]* Linux 在不断传播,微软也开始担心起来。到了 2006 年,Linux 成为仅次于 Windows 的第二大常用操作系统,全球约有 5000 名开发人员在使用它。5000 名开发者。还记得比尔·盖茨给苹果公司的备忘录吗?在那份备忘录中,他向苹果公司的员工们论述了与他人合作的重要性。事实证明,开源将把伙伴关系的概念提升到一个全新的水平,这是比尔·盖茨从未预见到的。 + +*[00:27:30]* 我们一直在谈论操作系统之间的大战,但是到目前为止,并没有怎么提到无名英雄和开发者们。在下次的代码英雄中,情况就不同了。第二集讲的是操作系统大战的第二部分,是关于 Linux 崛起的。业界醒悟过来,认识到了开发人员的重要性。这些开源反叛者变得越来越强大,战场从桌面转移到了服务器领域。*[00:28:00]* 这里有商业间谍活动、新的英雄人物,还有科技史上最不可思议的改变。这一切都在操作系统大战的后半集内达到了高潮。 + +要想免费自动获得新一集的代码英雄,请点击订阅苹果播客、Spotify、谷歌 Play,或其他应用获取该播客。在这一季剩下的时间里,我们将参观最新的战场,相互争斗的版图,这里是下一代的代码英雄留下印记的地方。*[00:28:30]* 更多信息,请访问 https://redhat.com/commandlineheroes 。我是 Saron Yitbarek。下次之前,继续编码。 + +-------------------------------------------------------------------------------- + +via: https://www.redhat.com/en/command-line-heroes/season-1/os-wars-part-1 + +作者:[redhat][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.redhat.com +[b]: https://github.com/lujun9972 diff --git a/published/201908/20180119 Two great uses for the cp command Bash shortcuts.md b/published/201908/20180119 Two great uses for the cp command Bash shortcuts.md new file mode 100644 index 0000000000..1428f65555 --- /dev/null +++ b/published/201908/20180119 Two great uses for the cp command Bash shortcuts.md @@ -0,0 +1,137 @@ +两种 cp 命令的绝佳用法的快捷方式 +=================== + +> 这篇文章是关于如何在使用 cp 命令进行备份以及同步时提高效率。 + +![Two great uses for the cp command: Bash shortcuts ](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC) + +去年七月,我写了一篇[关于 cp 命令的两种绝佳用法][7]的文章:备份一个文件,以及同步一个文件夹的备份。 + +虽然这些工具确实很好用,但同时,输入这些命令太过于累赘了。为了解决这个问题,我在我的 Bash 启动文件里创建了一些 Bash 快捷方式。现在,我想把这些捷径分享给你们,以便于你们在需要的时候可以拿来用,或者是给那些还不知道怎么使用 Bash 的别名以及函数的用户提供一些思路。 + +### 使用 Bash 别名来更新一个文件夹的副本 + +如果要使用 `cp` 来更新一个文件夹的副本,通常会使用到的命令是: + +``` +cp -r -u -v SOURCE-FOLDER DESTINATION-DIRECTORY +``` + +其中 `-r` 代表“向下递归访问文件夹中的所有文件”,`-u` 代表“更新目标”,`-v` 代表“详细模式”,`SOURCE-FOLDER` 是包含最新文件的文件夹的名称,`DESTINATION-DIRECTORY` 是包含必须同步的`SOURCE-FOLDER` 副本的目录。 + +因为我经常使用 `cp` 命令来复制文件夹,我会很自然地想起使用 `-r` 选项。也许再想地更深入一些,我还可以想起用 `-v` 选项,如果再想得再深一层,我会想起用选项 `-u`(不知道这个选项是代表“更新”还是“同步”还是一些什么其它的)。 + +或者,还可以使用[Bash 的别名功能][8]来将 `cp` 命令以及其后的选项转换成一个更容易记忆的单词,就像这样: + +``` +alias sync='cp -r -u -v' +``` + +如果我将其保存在我的主目录中的 `.bash_aliases` 文件中,然后启动一个新的终端会话,我可以使用该别名了,例如: + +``` +sync Pictures /media/me/4388-E5FE +``` + +可以将我的主目录中的图片文件夹与我的 USB 驱动器中的相同版本同步。 + +不清楚 `sync` 是否已经定义了?你可以在终端里输入 `alias` 这个单词来列出所有正在使用的命令别名。 + +喜欢吗?想要现在就立即使用吗?那就现在打开终端,输入: + +``` +echo "alias sync='cp -r -u -v'" >> ~/.bash_aliases +``` + +然后启动一个新的终端窗口并在命令提示符下键入 `alias`。你应该看到这样的东西: + +``` +me@mymachine~$ alias + +alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' +alias egrep='egrep --color=auto' +alias fgrep='fgrep --color=auto' +alias grep='grep --color=auto' +alias gvm='sdk' +alias l='ls -CF' +alias la='ls -A' +alias ll='ls -alF' +alias ls='ls --color=auto' +alias sync='cp -r -u -v' +me@mymachine:~$ +``` + +这里你能看到 `sync` 已经定义了。 + +### 使用 Bash 函数来为备份编号 + +若要使用 `cp` 来备份一个文件,通常使用的命令是: + +``` +cp --force --backup=numbered WORKING-FILE BACKED-UP-FILE +``` + +其中 `--force` 代表“强制制作副本”,`--backup= numbered` 代表“使用数字表示备份的生成”,`WORKING-FILE` 是我们希望保留的当前文件,`BACKED-UP-FILE` 与 `WORKING-FILE` 的名称相同,并附加生成信息。 + +我们不仅需要记得所有 `cp` 的选项,我们还需要记得去重复输入 `WORKING-FILE` 的名字。但当[Bash 的函数功能][9]已经可以帮我们做这一切,为什么我们还要不断地重复这个过程呢?就像这样: + +再一次提醒,你可将下列内容保存入你在家目录下的 `.bash_aliases` 文件里: + +``` +function backup { +    if [ $# -ne 1 ]; then +        echo "Usage: $0 filename" +    elif [ -f $1 ] ; then +        echo "cp --force --backup=numbered $1 $1" +        cp --force --backup=numbered $1 $1 +    else +        echo "$0: $1 is not a file" +    fi +} +``` + +我将此函数称之为 `backup`,因为我的系统上没有任何其他名为 `backup` 的命令,但你可以选择适合的任何名称。 + +第一个 `if` 语句是用于检查是否提供有且只有一个参数,否则,它会用 `echo` 命令来打印出正确的用法。 + +`elif` 语句是用于检查提供的参数所指向的是一个文件,如果是的话,它会用第二个 `echo` 命令来打印所需的 `cp` 的命令(所有的选项都是用全称来表示)并且执行它。 + +如果所提供的参数不是一个文件,文件中的第三个 `echo` 用于打印错误信息。 + +在我的家目录下,如果我执行 `backup` 这个命令,我可以发现目录下多了一个文件名为`checkCounts.sql.~1~` 的文件,如果我再执行一次,便又多了另一个名为 `checkCounts.sql.~2~` 的文件。 + +成功了!就像所想的一样,我可以继续编辑 `checkCounts.sql`,但如果我可以经常地用这个命令来为文件制作快照的话,我可以在我遇到问题的时候回退到最近的版本。 + +也许在未来的某个时间,使用 `git` 作为版本控制系统会是一个好主意。但像上文所介绍的 `backup` 这个简单而又好用的工具,是你在需要使用快照的功能时却还未准备好使用 `git` 的最好工具。 + +### 结论 + +在我的上一篇文章里,我保证我会通过使用脚本,shell 里的函数以及别名功能来简化一些机械性的动作来提高生产效率。 + +在这篇文章里,我已经展示了如何在使用 `cp` 命令同步或者备份文件时运用 shell 函数以及别名功能来简化操作。如果你想要了解更多,可以读一下这两篇文章:[怎样通过使用命令别名功能来减少敲击键盘的次数][10] 以及由我的同事 Greg 和 Seth 写的 [Shell 编程:shift 方法和自定义函数介绍][11]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/two-great-uses-cp-command-update + +作者:[Chris Hermansen][a] +译者:[zyk2290](https://github.com/zyk2290) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/clhermansen +[1]:https://opensource.com/users/clhermansen +[2]:https://opensource.com/users/clhermansen +[3]:https://opensource.com/user/37806/feed +[4]:https://opensource.com/article/18/1/two-great-uses-cp-command-update?rate=J_7R7wSPbukG9y8jrqZt3EqANfYtVAwZzzpopYiH3C8 +[5]:https://opensource.com/article/18/1/two-great-uses-cp-command-update#comments +[6]:https://www.flickr.com/photos/internetarchivebookimages/14803082483/in/photolist-oy6EG4-pZR3NZ-i6r3NW-e1tJSX-boBtf7-oeYc7U-o6jFKK-9jNtc3-idt2G9-i7NG1m-ouKjXe-owqviF-92xFBg-ow9e4s-gVVXJN-i1K8Pw-4jybMo-i1rsBr-ouo58Y-ouPRzz-8cGJHK-85Evdk-cru4Ly-rcDWiP-gnaC5B-pAFsuf-hRFPcZ-odvBMz-hRCE7b-mZN3Kt-odHU5a-73dpPp-hUaaAi-owvUMK-otbp7Q-ouySkB-hYAgmJ-owo4UZ-giHgqu-giHpNc-idd9uQ-osAhcf-7vxk63-7vwN65-fQejmk-pTcLgA-otZcmj-fj1aSX-hRzHQk-oyeZfR +[7]:https://opensource.com/article/17/7/two-great-uses-cp-command +[8]:https://opensource.com/article/17/5/introduction-alias-command-line-tool +[9]:https://opensource.com/article/17/1/shell-scripting-shift-method-custom-functions +[10]:https://opensource.com/article/17/5/introduction-alias-command-line-tool +[11]:https://opensource.com/article/17/1/shell-scripting-shift-method-custom-functions +[12]:https://opensource.com/tags/linux +[13]:https://opensource.com/users/clhermansen +[14]:https://opensource.com/users/clhermansen diff --git a/published/201908/20180131 How to test Webhooks when youre developing locally.md b/published/201908/20180131 How to test Webhooks when youre developing locally.md new file mode 100644 index 0000000000..2ac7fb588b --- /dev/null +++ b/published/201908/20180131 How to test Webhooks when youre developing locally.md @@ -0,0 +1,201 @@ +本地开发如何测试 Webhook +=================== + +![](https://img.linux.net.cn/data/attachment/album/201908/11/090540wipp5c65iinyyf63.jpg) + +[Webhook][10] 可用于外部系统通知你的系统发生了某个事件或更新。可能最知名的 [Webhook][10] 类型是支付服务提供商(PSP)通知你的系统支付状态有了更新。 + +它们通常以监听的预定义 URL 的形式出现,例如 `http://example.com/webhooks/payment-update`。同时,另一个系统向该 URL 发送具有特定有效载荷的 POST 请求(例如支付 ID)。一旦请求进入,你就会获得支付 ID,可以通过 PSP 的 API 用这个支付 ID 向它们询问最新状态,然后更新你的数据库。 + +其他例子可以在这个对 Webhook 的出色的解释中找到:[https://sendgrid.com/blog/whats-webhook/][12]。 + +只要系统可通过互联网公开访问(这可能是你的生产环境或可公开访问的临时环境),测试这些 webhook 就相当顺利。而当你在笔记本电脑上或虚拟机内部(例如,Vagrant 虚拟机)进行本地开发时,它就变得困难了。在这些情况下,发送 webhook 的一方无法公开访问你的本地 URL。此外,监视发送的请求也很困难,这可能使开发和调试变得困难。 + +因此,这个例子将解决: + +* 测试来自本地开发环境的 webhook,该环境无法通过互联网访问。从服务器向 webhook 发送数据的服务无法访问它。 +* 监控发送的请求和数据,以及应用程序生成的响应。这样可以更轻松地进行调试,从而缩短开发周期。 + +前置需求: + +* *可选*:如果你使用虚拟机(VM)进行开发,请确保它正在运行,并确保在 VM 中完成后续步骤。 +* 对于本教程,我们假设你定义了一个 vhost:`webhook.example.vagrant`。我在本教程中使用了 Vagrant VM,但你可以自由选择 vhost。 +* 按照这个[安装说明][3]安装 `ngrok`。在 VM 中,我发现它的 Node 版本也很有用:[https://www.npmjs.com/package/ngrok][4],但你可以随意使用其他方法。 + +我假设你没有在你的环境中运行 SSL,但如果你使用了,请将在下面的示例中的端口 80 替换为端口 433,`http://` 替换为 `https://`。 + +### 使 webhook 可测试 + +我们假设以下示例代码。我将使用 PHP,但请将其视作伪代码,因为我留下了一些关键部分(例如 API 密钥、输入验证等)没有编写。 + +第一个文件:`payment.php`。此文件创建一个 `$payment` 对象,将其注册到 PSP。然后它获取客户需要访问的 URL,以便支付并将用户重定向到客户那里。 + +请注意,此示例中的 `webhook.example.vagrant` 是我们为开发设置定义的本地虚拟主机。它无法从外部世界进入。 + +``` + 123, + 'amount' => 25.00, + 'description' => 'Test payment', + 'redirect_url' => 'http://webhook.example.vagrant/redirect.php', + 'webhook_url' => 'http://webhook.example.vagrant/webhook.php', +]; + +$payment = $paymentProvider->createPayment($payment); +header("Location: " . $payment->getPaymentUrl()); +``` + +第二个文件:`webhook.php`。此文件等待 PSP 调用以获得有关更新的通知。 + +``` +getPayment($paymentId); +$status = $paymentInfo->getStatus(); + +// Perform actions in here to update your system +if ($status === 'paid') { + .. +} +elseif ($status === 'cancelled') { + .. +} +``` + +我们的 webhook URL 无法通过互联网访问(请记住它:`webhook.example.vagrant`)。因此,PSP 永远不可能调用文件 `webhook.php`,你的系统将永远不会知道付款状态,这最终导致订单永远不会被运送给客户。 + +幸运的是,`ngrok` 可以解决这个问题。 [ngrok][13] 将自己描述为: + +> ngrok 通过安全隧道将 NAT 和防火墙后面的本地服务器暴露给公共互联网。 + +让我们为我们的项目启动一个基本的隧道。在你的环境中(在你的系统上或在 VM 上)运行以下命令: + +``` +ngrok http -host-header=rewrite webhook.example.vagrant:80 +``` + +> 阅读其文档可以了解更多配置选项:[https://ngrok.com/docs][14]。 + +会出现这样的屏幕: + +![](https://cdn-images-1.medium.com/max/1000/1*BZZE-CvZwHZ3pxsElJMWbA.png) + +*ngrok 输出* + +我们刚刚做了什么?基本上,我们指示 `ngrok` 在端口 80 建立了一个到 `http://webhook.example.vagrant` 的隧道。同一个 URL 也可以通过 `http://39741ffc.ngrok.io` 或 `https://39741ffc.ngrok.io` 访问,它们能被任何知道此 URL 的人通过互联网公开访问。 + +请注意,你可以同时获得 HTTP 和 HTTPS 两个服务。这个文档提供了如何将此限制为 HTTPS 的示例:[https://ngrok.com/docs#bind-tls][16]。 + +那么,我们如何让我们的 webhook 现在工作起来?将 `payment.php` 更新为以下代码: + +``` + 123, + 'amount' => 25.00, + 'description' => 'Test payment', + 'redirect_url' => 'http://webhook.example.vagrant/redirect.php', + 'webhook_url' => 'https://39741ffc.ngrok.io/webhook.php', +]; + +$payment = $paymentProvider->createPayment($payment); +header("Location: " . $payment->getPaymentUrl()); +``` + +现在,我们告诉 PSP 通过 HTTPS 调用此隧道 URL。只要 PSP 通过隧道调用 webhook,`ngrok` 将确保使用未修改的有效负载调用内部 URL。 + +### 如何监控对 webhook 的调用? + +你在上面看到的屏幕截图概述了对隧道主机的调用,这些数据相当有限。幸运的是,`ngrok` 提供了一个非常好的仪表板,允许你检查所有调用: + +![](https://cdn-images-1.medium.com/max/1000/1*qZw9GRTnG1sMgEUmsJPz3g.png) + +我不会深入研究这个问题,因为它是不言自明的,你只要运行它就行了。因此,我将解释如何在 Vagrant 虚拟机上访问它,因为它不是开箱即用的。 + +仪表板将允许你查看所有调用、其状态代码、标头和发送的数据。你将看到应用程序生成的响应。 + +仪表板的另一个优点是它允许你重放某个调用。假设你的 webhook 代码遇到了致命的错误,开始新的付款并等待 webhook 被调用将会很繁琐。重放上一个调用可以使你的开发过程更快。 + +默认情况下,仪表板可在 `http://localhost:4040` 访问。 + +### 虚拟机中的仪表盘 + +为了在 VM 中完成此工作,你必须执行一些额外的步骤: + +首先,确保可以在端口 4040 上访问 VM。然后,在 VM 内创建一个文件已存放此配置: + +``` +web_addr: 0.0.0.0:4040 +``` + +现在,杀死仍在运行的 `ngrok` 进程,并使用稍微调整过的命令启动它: + +``` +ngrok http -config=/path/to/config/ngrok.conf -host-header=rewrite webhook.example.vagrant:80 +``` + +尽管 ID 已经更改,但你将看到类似于上一屏幕截图的屏幕。之前的网址不再有效,但你有了一个新网址。 此外,`Web Interface` URL 已更改: + +![](https://cdn-images-1.medium.com/max/1000/1*3FZq37TF4dmBqRc1R0FMVg.png) + +现在将浏览器指向 `http://webhook.example.vagrant:4040` 以访问仪表板。另外,对 `https://e65642b5.ngrok.io/webhook.php` 做个调用。这可能会导致你的浏览器出错,但仪表板应显示正有一个请求。 + +### 最后的备注 + +上面的例子是伪代码。原因是每个外部系统都以不同的方式使用 webhook。我试图基于一个虚构的 PSP 实现给出一个例子,因为可能很多开发人员在某个时刻肯定会处理付款。 + +请注意,你的 webhook 网址也可能被意图不好的其他人使用。确保验证发送给它的任何输入。 + +更好的的,可以向 URL 添加令牌,该令牌对于每个支付是唯一的。只有你的系统和发送 webhook 的系统才能知道此令牌。 + +祝你测试和调试你的 webhook 顺利! + +注意:我没有在 Docker 上测试过本教程。但是,这个 Docker 容器看起来是一个很好的起点,并包含了明确的说明:[https://github.com/wernight/docker-ngrok][19] 。 + +-------- + +via: https://medium.freecodecamp.org/testing-webhooks-while-using-vagrant-for-development-98b5f3bedb1d + +作者:[Stefan Doorn][a] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://medium.freecodecamp.org/@stefandoorn +[1]:https://unsplash.com/photos/MYTyXb7fgG0?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[2]:https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[3]:https://ngrok.com/download +[4]:https://www.npmjs.com/package/ngrok +[5]:http://webhook.example.vagrnat/ +[6]:http://39741ffc.ngrok.io/ +[7]:http://39741ffc.ngrok.io/ +[8]:http://webhook.example.vagrant:4040/ +[9]:https://e65642b5.ngrok.io/webhook.php. +[10]:https://sendgrid.com/blog/whats-webhook/ +[11]:http://example.com/webhooks/payment-update%29 +[12]:https://sendgrid.com/blog/whats-webhook/ +[13]:https://ngrok.com/ +[14]:https://ngrok.com/docs +[15]:http://39741ffc.ngrok.io%2C/ +[16]:https://ngrok.com/docs#bind-tls +[17]:http://localhost:4040./ +[18]:https://e65642b5.ngrok.io/webhook.php. +[19]:https://github.com/wernight/docker-ngrok +[20]:https://github.com/stefandoorn +[21]:https://twitter.com/stefan_doorn +[22]:https://www.linkedin.com/in/stefandoorn diff --git a/published/201908/20180622 Use LVM to Upgrade Fedora.md b/published/201908/20180622 Use LVM to Upgrade Fedora.md new file mode 100644 index 0000000000..2c4f9ff474 --- /dev/null +++ b/published/201908/20180622 Use LVM to Upgrade Fedora.md @@ -0,0 +1,214 @@ +使用 LVM 升级 Fedora +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/06/lvm-upgrade-816x345.jpg) + +大多数用户发现使用标准流程升级[从一个 Fedora 版本升级到下一个][1]很简单。但是,Fedora 升级也不可避免地会遇到许多特殊情况。本文介绍了使用 DNF 和逻辑卷管理(LVM)进行升级的一种方法,以便在出现问题时保留可引导备份。这个例子是将 Fedora 26 系统升级到 Fedora 28。 + +此处展示的过程比标准升级过程更复杂。在使用此过程之前,你应该充分掌握 LVM 的工作原理。如果没有适当的技能和细心,你可能会丢失数据和/或被迫重新安装系统!如果你不知道自己在做什么,那么**强烈建议**你坚持只使用得到支持的升级方法。 + +### 准备系统 + +在开始之前,请确保你的现有系统已完全更新。 + +``` +$ sudo dnf update +$ sudo systemctl reboot # 或采用 GUI 方式 +``` + +检查你的根文件系统是否是通过 LVM 挂载的。 + +``` +$ df / +Filesystem 1K-blocks Used Available Use% Mounted on +/dev/mapper/vg_sdg-f26 20511312 14879816 4566536 77% / + +$ sudo lvs +LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert +f22 vg_sdg -wi-ao---- 15.00g +f24_64 vg_sdg -wi-ao---- 20.00g +f26 vg_sdg -wi-ao---- 20.00g +home vg_sdg -wi-ao---- 100.00g +mockcache vg_sdg -wi-ao---- 10.00g +swap vg_sdg -wi-ao---- 4.00g +test vg_sdg -wi-a----- 1.00g +vg_vm vg_sdg -wi-ao---- 20.00g +``` + +如果你在安装 Fedora 时使用了默认值,你可能会发现根文件系统挂载在名为 `root` 的逻辑卷(LV)上。卷组(VG)的名称可能会有所不同。看看根卷的总大小。在该示例中,根文件系统名为 `f26`,大小为 `20G`。 + +接下来,确保 LVM 中有足够的可用空间。 + +``` +$ sudo vgs +VG #PV #LV #SN Attr VSize VFree +vg_sdg 1 8 0 wz--n- 232.39g 42.39g +``` + +该系统有足够的可用空间,可以为升级后的 Fedora 28 的根卷分配 20G 的逻辑卷。如果你使用的是默认安装,则你的 LVM 中将没有可用空间。对 LVM 的一般性管理超出了本文的范围,但这里有一些情形下可能采取的方法: + +1、`/home` 在自己的逻辑卷,而且 `/home` 中有大量空闲空间。 + +你可以从图形界面中注销并切换到文本控制台,以 `root` 用户身份登录。然后你可以卸载 `/home`,并使用 `lvreduce -r` 调整大小并重新分配 `/home` 逻辑卷。你也可以从现场镜像Live image启动(以便不使用 `/home`)并使用 gparted GUI 实用程序进行分区调整。 + +2、大多数 LVM 空间被分配给根卷,该文件系统中有大量可用空间。 + +你可以从现场镜像启动并使用 gparted GUI 实用程序来减少根卷的大小。此时也可以考虑将 `/home` 移动到另外的文件系统,但这超出了本文的范围。 + +3、大多数文件系统已满,但你有个已经不再需要逻辑卷。 + +你可以删除不需要的逻辑卷,释放卷组中的空间以进行此操作。 + +### 创建备份 + +首先,为升级后的系统分配新的逻辑卷。确保为系统的卷组(VG)使用正确的名称。在这个例子中它是 `vg_sdg`。 + +``` +$ sudo lvcreate -L20G -n f28 vg_sdg +Logical volume "f28" created. +``` + +接下来,创建当前根文件系统的快照。此示例创建名为 `f26_s` 的快照卷。 + +``` +$ sync +$ sudo lvcreate -s -L1G -n f26_s vg_sdg/f26 +Using default stripesize 64.00 KiB. +Logical volume "f26_s" created. +``` + +现在可以将快照复制到新逻辑卷。当你替换自己的卷名时,**请确保目标正确**。如果不小心,就会不可撤销地删除了数据。此外,请确保你从根卷的快照复制,**而不是**从你的现在的根卷。 + +``` +$ sudo dd if=/dev/vg_sdg/f26_s of=/dev/vg_sdg/f28 bs=256k +81920+0 records in +81920+0 records out +21474836480 bytes (21 GB, 20 GiB) copied, 149.179 s, 144 MB/s +``` + +给新文件系统一个唯一的 UUID。这不是绝对必要的,但 UUID 应该是唯一的,因此这避免了未来的混淆。以下是在 ext4 根文件系统上的方法: + +``` +$ sudo e2fsck -f /dev/vg_sdg/f28 +$ sudo tune2fs -U random /dev/vg_sdg/f28 +``` + +然后删除不再需要的快照卷: + +``` +$ sudo lvremove vg_sdg/f26_s +Do you really want to remove active logical volume vg_sdg/f26_s? [y/n]: y +Logical volume "f26_s" successfully removed +``` + +如果你单独挂载了 `/home`,你可能希望在此处制作 `/home` 的快照。有时,升级的应用程序会进行与旧版 Fedora 版本不兼容的更改。如果需要,编辑**旧**根文件系统上的 `/etc/fstab` 文件以在 `/home` 上挂载快照。请记住,当快照已满时,它将消失!另外,你可能还希望给 `/home` 做个正常备份。 + +### 配置以使用新的根 + +首先,安装新的逻辑卷并备份现有的 GRUB 设置: + +``` +$ sudo mkdir /mnt/f28 +$ sudo mount /dev/vg_sdg/f28 /mnt/f28 +$ sudo mkdir /mnt/f28/f26 +$ cd /boot/grub2 +$ sudo cp -p grub.cfg grub.cfg.old +``` + +编辑 `grub.conf` 并在第一个菜单项 `menuentry` 之前添加这些,除非你已经有了: + +``` +menuentry 'Old boot menu' { + configfile /grub2/grub.cfg.old +} +``` + +编辑 `grub.conf` 并更改默认菜单项以激活并挂载新的根文件系统。改变这一行: + +``` +linux16 /vmlinuz-4.16.11-100.fc26.x86_64 root=/dev/mapper/vg_sdg-f26 ro rd.lvm.lv=vg_sdg/f26 rd.lvm.lv=vg_sdg/swap rhgb quiet LANG=en_US.UTF-8 +``` + +如你看到的这样。请记住使用你系统上的正确的卷组和逻辑卷条目名称! + +``` +linux16 /vmlinuz-4.16.11-100.fc26.x86_64 root=/dev/mapper/vg_sdg-f28 ro rd.lvm.lv=vg_sdg/f28 rd.lvm.lv=vg_sdg/swap rhgb quiet LANG=en_US.UTF-8 +``` + +编辑 `/mnt/f28/etc/default/grub` 并改变在启动时激活的默认的根卷: + +``` +GRUB_CMDLINE_LINUX="rd.lvm.lv=vg_sdg/f28 rd.lvm.lv=vg_sdg/swap rhgb quiet" +``` + +编辑 `/mnt/f28/etc/fstab`,将挂载的根文件系统从旧的逻辑卷: + +``` +/dev/mapper/vg_sdg-f26 / ext4 defaults 1 1 +``` + +改为新的: + +``` +/dev/mapper/vg_sdg-f28 / ext4 defaults 1 1 +``` + +然后,出于参考的用途,只读挂载旧的根卷: + +``` +/dev/mapper/vg_sdg-f26 /f26 ext4 ro,nodev,noexec 0 0 +``` + +如果你的根文件系统是通过 UUID 挂载的,你需要改变这个方式。如果你的根文件系统是 ext4 你可以这样做: + +``` +$ sudo e2label /dev/vg_sdg/f28 F28 +``` + +现在编辑 `/mnt/f28/etc/fstab` 使用该卷标。改变该根文件系统的挂载行,像这样: + +``` +LABEL=F28 / ext4 defaults 1 1 +``` + +### 重启与升级 + +重新启动,你的系统将使用新的根文件系统。它仍然是 Fedora 26,但是是带有新的逻辑卷名称的副本,并可以进行 `dnf` 系统升级!如果出现任何问题,请使用旧引导菜单引导回到你的工作系统,此过程可避免触及旧系统。 + +``` +$ sudo systemctl reboot # or GUI equivalent +... +$ df / /f26 +Filesystem 1K-blocks Used Available Use% Mounted on +/dev/mapper/vg_sdg-f28 20511312 14903196 4543156 77% / +/dev/mapper/vg_sdg-f26 20511312 14866412 4579940 77% /f26 +``` + +你可能希望验证使用旧的引导菜单确实可以让你回到挂载在旧的根文件系统上的根。 + +现在按照[此维基页面][2]中的说明进行操作。如果系统升级出现任何问题,你还会有一个可以重启回去的工作系统。 + +### 进一步的考虑 + +创建新的逻辑卷并将根卷的快照复制到其中的步骤可以使用通用脚本自动完成。它只需要新的逻辑卷的名称,因为现有根的大小和设备很容易确定。例如,可以输入以下命令: + +``` +$ sudo copyfs / f28 +``` + +提供挂载点以进行复制可以更清楚地了解发生了什么,并且复制其他挂载点(例如 `/home`)可能很有用。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-lvm-upgrade-fedora/ + +作者:[Stuart D Gathman][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://fedoramagazine.org/author/sdgathman/ +[1]:https://fedoramagazine.org/upgrading-fedora-27-fedora-28/ +[2]:https://fedoraproject.org/wiki/DNF_system_upgrade diff --git a/published/201908/20180720 A brief history of text-based games and open source.md b/published/201908/20180720 A brief history of text-based games and open source.md new file mode 100644 index 0000000000..bc3026be9f --- /dev/null +++ b/published/201908/20180720 A brief history of text-based games and open source.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (cycoe) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11272-1.html) +[#]: subject: (A brief history of text-based games and open source) +[#]: via: (https://opensource.com/article/18/7/interactive-fiction-tools) +[#]: author: (Jason Mclntosh https://opensource.com/users/jmac) + +互动小说及其开源简史 +====== + +> 了解开源如何促进互动小说的成长和发展。 + +![](https://img.linux.net.cn/data/attachment/album/201908/27/142657ryf4pa2lym6fe6f1.jpg) + +[互动小说技术基金会][1]Interactive Fiction Technology Foundation(IFTF) 是一个非营利组织,致力于保护和改进那些用来生成我们称之为互动小说interactive fiction的数字艺术形式的技术。当 Opensource.com 的一位社区版主提出一篇关于 IFTF、它支持的技术与服务,以及它如何与开源相交织的文章时,我发现这对于我讲了数几十年的开源故事来说是个新颖的视角。互动小说的历史比自由及开源软件Free and Open Source Software(FOSS)运动的历史还要长,但同时也与之密切相关。希望你们能喜欢我在这里的分享。 + +### 定义和历史 + +对于我来说,互动小说这个术语涵盖了读者主要通过文本与之交互的任何视频游戏或数字化艺术作品。这个术语起源于 20 世纪 80 年代,当时由语法解析器驱动的文本冒险游戏确立了什么是家用电脑娱乐,在美国主要以 [魔域][2]、[银河系漫游指南][3] 和 [Infocom][4] 公司的其它佳作为代表。在 20 世纪 90 年代,它的主流商业价值被挖掘殆尽,但在线爱好者社区接过了该传统,继续发布这类游戏和游戏创建工具。 + +在四分之一个世纪之后的今天,互动小说包括了品种繁多并且妙趣橫生的作品,如从充满谜题的文字冒险游戏到衍生改良的超文本类型。定期举办的在线竞赛和节日为品鉴和试玩新作品提供了个好地方---英语互动小说世界每年都会举办一些活动,包括 [Spring Thing][5] 和 [IFComp][6]。后者是自 1995 年以来现代互动小说的核心活动,这也使它成为在同类型活动中持续举办时间最长的游戏展示活动。[IFComp 从 2017 年开始的评选和排名记录][7] 显示了如今基于文本的游戏在形式、风格和主题方面的惊人多样性。 + +(作者注:以上我特指英语,因为可能出于写作方面的技术原因,互动小说社区倾向于按语言进行区分。例如也有 [法语][8] 或 [意大利语][9] 的互动小说年度活动,我就听说过至少一届的中文互动小说节。幸运的是,这些边界易于打破。在我管理 IFComp 的四年中,我们很欢迎来自国际社区的所有英语翻译工作。) + +![“假冒的猴子”游戏截图][11] + +*在解释器 Lectrote 上启动 Emily Short 的“假冒的猴子”新游戏(二者皆为开源软件)。* + +此外由于互动小说专注于文本,它为玩家和作者都提供了最方便的平台。几乎所有能阅读数字化文本的人(包括能通过文字转语音软件等辅助技术阅读的用户)都能玩大部分的互动小说作品。同样,互动小说的创作对所有愿意学习和使用其工具和技术的作家开放。 + +这使我们了解了互动小说与开源的长期关系,以及从它的全盛时期以来,对于艺术形式可用性的积极影响。接下来我将概述当代开源互动小说创建工具,并讨论共享源代码的互动小说作品古老且有点稀奇的传统。 + +### 开源互动小说工具的世界 + +一些开发平台(其中大部分是开源的)可用于创建传统的语法解析器驱动互动小说,其中用户可通过输入命令(如 `向北走`、`拾取提灯`、`收养小猫` 或 `向 Zoe 询问量子机械学`)来与游戏世界交互。20 世纪 90 年代初期出现了几个适于魔改hacker-friendly的语法解析器游戏开发工具,其中目前还在使用的有 [TADS][12]、[Alan][13] 和 [Quest][14],它们都是开源的,并且后两者兼容 FOSS 许可证。 + +其中最出名的是 [Inform][15],1993 年 Graham Nelson 发布了第一个版本,目前由 Nelson 领导的一个团队进行维护。Inform 的源代码是不太寻常的半开源:Inform 6 是前一个主要版本,[它通过 Artistic 许可证开放源码][16]。这其中蕴涵着比我们所看到的更直接的相关性,因为它专有的 Inform 7 将 Inform 6 作为其核心,可以让它在将作品编译为机器码之前,将其 [杰出的自然语言语法][17] (LCTT 译注:此链接已遗失)翻译为其前一代的那种更类似 C 的代码。 + +![inform 7 集成式开发环境截图][19] + +*Inform 7 集成式开发环境,打开了文档以及一个示例项目* + +Inform 游戏运行在虚拟机上,这是 Infocom 时代的遗留产物。当时的发行者为了让同一个游戏可以运行在 Apple II、Commodore 4、Atari 800 以及其它种类的“[家用计算机][20]”上,将虚拟机作为解决方案。这些原本流行的操作系统中只有少数至今仍存在,但 Inform 的虚拟机使得它创建的作品能够通过 Inform 解释器运行在任何的计算机上。这些虚拟机包括相对现代的 [Glulx][21],或者通过对 Infocom 过去的虚拟机进行逆向工程克隆得到的可爱的古董 [Z-machine][22]。现在,流行的跨平台解释器包括如 [lectrote][23] 和 [Gargoyle][24] 等桌面程序,以及如 [Quixe][25] 和 [Parchment][26] 等基于浏览器的程序。以上所有均为开源软件。 + +如其它的流行开源项目一样,如果 Inform 的发展进程随着它的成熟而逐渐变缓,它为我们留下的最重要的财富就是其活跃透明的生态环境。对于 Inform 来说,(这些财富)包括前面提到的解释器、[一套语言扩展][27](通常混合使用 Inform 6 和 Inform 7 写成),当然也包括所有用它们写成并分享于全世界的作品,有的时候也包括那些源代码。(在这篇文章的后半部分我会回到这个话题) + +互动小说创建工具发明于 21 世纪,力求在传统的语法解析器之外探索一种新的玩家交互方式,即创建任何现代 Web 浏览器都能加载的超文本驱动作品。其中的领头羊是 [Twine][28],原本由 Klimas 在 2009 年开发,目前是 [GNU 许可证开源项目][29],有许多贡献者正在积极开发。(事实上,[Twine][30] 的开源软件血统可追溯到 [TiddlyWiki][31],Klimas 的项目最初是从该项目衍生而来的) + +对于互动小说开发来说,Twine 代表着一系列最开放及最可用的方法。由于它天生的 FOSS 属性,它将其输出渲染为一个自包含的网站,不依赖于需要进一步特殊解析的机器码,而是使用开放并且成熟的 HTML、CSS 和 JavaScript 标准。作为一个创建工具,Twine 能够根据创建者的技能等级,展示出与之相匹配的复杂度。拥有很少或没有编程知识的用户能够创建简单但是可玩的互动小说作品,但那些拥有更多编码和设计技能(包括通过开发 Twine 游戏获得的技能提升)的用户能够创建更复杂的项目。这也难怪近几年 Twine 在教育领域的曝光率和流行度有不小的提升。 + +另一些值得注意的开源互动小说开发项目包括由 Ian Millington 开发的以 MIT 许可证发布的 [Undum][32],以及由 Dan Fabulich 和 [Choice of Games][34] 团队开发的 [ChoiceScript][33],两者也专注于将 Web 浏览器作为游戏平台。除了以上专用的开发系统以外,基于 Web 的互动小说也呈现给我们以开源作品的丰富、变幻的生态。比如 Furkle 的 [Twine 扩展工具集][35],以及 Liza Daly 为自己的互动小说游戏创建的名为 [Windrift][36] 的 JavaScript 框架。 + +### 程序、游戏,以及游戏程序 + +Twine 受益于 [一个致力于提供支持的长期 IFTF 计划][37],公众可以为其维护和发展提供资助。IFTF 还直接支持两个长期公共服务:IFComp 和互动小说归档IF Archive,这两个服务都依赖并回馈开源软件和技术。 + +![Harmonia 开场截图][39] + +*由 Liza Daly 开发的“Harmonia”的开场画面,该游戏使用 Windrift 开源互动小说创建框架创建。* + +自 2014 年以来,用于运行 IFComp 网站的基于 Perl 和 JavaScript 的应用程序一直是 [一个共享源代码项目][40],它反映了 [互动小说特有子组件使用的 FOSS 许可证是个大杂烩][41],其中包括那些可以让以语法解析器驱动的竞争项目在 Web 浏览器中运行的各式各样的代码库。在 1992 年上线并 [在 2017 年成为一个 IFTF 项目][43] 的 [互动小说归档][42]IF Archive,是一套完全基于古老且稳定的互联网标准的镜像仓库,只使用了 [一点开源 Pyhon 脚本][44] 用来处理索引。 + +### 最后,也是最有趣的部分,让我们聊聊开源文字游戏 + +互动小说归档的主体 [由游戏组成][45],当然,是那些历经岁月的游戏。它们反映了数十年来不断发展的游戏设计趋势和互动小说工具发展。 + +许多互动小说作品都共享其源代码,要快速找到它们的快速很简单 —— [在 IFDB 中搜索标签 “source available”][46]。IFDB 是另一个长期运行的互动小说社区服务,由 TADS 的创立者 Mike Roberts 私人运营。对更加简单的界面感到舒适的用户,也可以浏览互动小说归档的 [games/source 目录][47],该目录按开发平台和编写语言对内容运行分组(也有很多作品,由于太繁杂或太古老而无法分类,只能浮于顶级目录)。 + +对这些代码共享游戏随机抽取的几个样本,揭示了一个有趣的窘境:与更广阔的开源软件世界不同,互动小说社区缺少一种普遍认同的方式来授权它生成的所有代码。与软件工具(包括我们用来创建互动小说的所有工具)不同的是,从字面意思上讲,交互式小说游戏是一件艺术作品。这意味着,将面向软件的开源许可证用于交互式小说游戏,并不会比将其用于其它像散文或诗歌作品更适合。但同样,互动小说游戏也是一个软件,它展示了创建者希望合法地与世界分享的源代码模式和技术。一个拥有开源意识的互动小说创建者会怎么做呢? + +有些游戏通过将其代码放到公共领域来解决这一问题,或者通过明确的许可证,亦或者如 [42 年前由 Crowther 和 Woods 开发的“冒险之旅Adventure”][48] 一样通过社区发布。一些人试图将其中的不同部分分开,应用他们自己的许可证,允许免费复用游戏公开的业务逻辑,但禁止针对其散文内容的再创作。这是我在开源自己的游戏 [莺巢][49]The Warbler’s Nest 时采取的策略。天知道这是否能在法律上站得住脚,但我当时没有更好的主意。 + +当然,你会发现一些作品对所有部分使用单一的许可证,而不介意反对者。一个突出的例子就是 [Emily Short 的史诗作品“假冒的猴子Counterfeit Monkey”][50],其全部采用 Creative Commons 4.0 许可证发布。[CC 对其应用于代码感到不满][51],但你可以认为 [Inform 7 源码这种不寻常的散文风格特性][52] 至少比传统的软件项目更适合 CC 许可证。 + +### 接下来要做什么呢,冒险者? + +如果你希望开始探索互动小说的世界,这里有几个链接可供你参考: + ++ 如上所述,[IFDB][53] 和[互动小说归档][54]都提供了可浏览的界面,用于浏览超过 40 年价值的互动小说作品。其中大部分可以在 Web 浏览器中玩,但有些需要额外的解释器程序。IFDB 能帮助你找到并安装它们。[IFComp 的年度结果页面][55]展现了另一个视图,帮助你了解最佳的免费和归档可用作品。 ++ [互动小说技术基金会][56]是一个非营利组织,主要帮助并支持 Twine、IFComp 和互动小说归档的发展,以及提升互动小说的无障碍功能、探索互动小说在教育领域中的应用等等。加入其[邮件列表][57],可以接收 IFTF 的每月资讯,浏览其[博客][58],亦或浏览[一些主题商品][59]。 ++ 在今年的早些时候,John Paul Wohlscheid 写了这篇[关于开源互动小说工具][60]的文章。它涵盖了一些这里没有提及的平台,所以如果你还想了解更多,请看一看这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/interactive-fiction-tools + +作者:[Jason Mclntosh][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[cycoe](https://github.com/cycoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jmac +[1]:http://iftechfoundation.org/ +[2]:https://en.wikipedia.org/wiki/Zork +[3]:https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy_(video_game) +[4]:https://en.wikipedia.org/wiki/Infocom +[5]:http://www.springthing.net/ +[6]:http://ifcomp.org/ +[7]:https://ifcomp.org/comp/2017 +[8]:http://www.fiction-interactive.fr/ +[9]:http://www.oldgamesitalia.net/content/marmellata-davventura-2018 +[10]:/file/403396 +[11]:https://opensource.com/sites/default/files/uploads/monkey.png (counterfeit monkey game screenshot) +[12]:http://tads.org/ +[13]:https://www.alanif.se/ +[14]:http://textadventures.co.uk/quest/ +[15]:http://inform7.com/ +[16]:https://github.com/DavidKinder/Inform6 +[17]:http://inform7.com/learn/man/RB_4_1.html#e307 +[18]:/file/403386 +[19]:https://opensource.com/sites/default/files/uploads/inform.png (inform 7 IDE screenshot) +[20]:https://www.youtube.com/watch?v=bu55q_3YtOY +[21]:http://ifwiki.org/index.php/Glulx +[22]:http://ifwiki.org/index.php/Z-machine +[23]:https://github.com/erkyrath/lectrote +[24]:https://github.com/garglk/garglk/ +[25]:http://eblong.com/zarf/glulx/quixe/ +[26]:https://github.com/curiousdannii/parchment +[27]:https://github.com/i7/extensions +[28]:http://twinery.org/ +[29]:https://github.com/klembot/twinejs +[30]:https://opensource.com/article/18/7/twine-vs-renpy-interactive-fiction +[31]:https://tiddlywiki.com/ +[32]:https://github.com/idmillington/undum +[33]:https://github.com/dfabulich/choicescript +[34]:https://www.choiceofgames.com/ +[35]:https://github.com/furkle +[36]:https://github.com/lizadaly/windrift +[37]:http://iftechfoundation.org/committees/twine/ +[38]:/file/403391 +[39]:https://opensource.com/sites/default/files/uploads/harmonia.png (Harmonia opening screen shot) +[40]:https://github.com/iftechfoundation/ifcomp +[41]:https://github.com/iftechfoundation/ifcomp/blob/master/LICENSE.md +[42]:https://www.ifarchive.org/ +[43]:http://blog.iftechfoundation.org/2017-06-30-iftf-is-adopting-the-if-archive.html +[44]:https://github.com/iftechfoundation/ifarchive-ifmap-py +[45]:https://www.ifarchive.org/indexes/if-archiveXgames +[46]:http://ifdb.tads.org/search?sortby=ratu&searchfor=%22source+available%22 +[47]:https://www.ifarchive.org/indexes/if-archiveXgamesXsource.html +[48]:http://ifdb.tads.org/viewgame?id=fft6pu91j85y4acv +[49]:https://github.com/jmacdotorg/warblers-nest/ +[50]:https://github.com/i7/counterfeit-monkey +[51]:https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software +[52]:https://github.com/i7/counterfeit-monkey/blob/master/Counterfeit%20Monkey.materials/Extensions/Counterfeit%20Monkey/Liquids.i7x +[53]:http://ifdb.tads.org/ +[54]:https://ifarchive.org/ +[55]:https://ifcomp.org/comp/last_comp +[56]:http://iftechfoundation.org/ +[57]:http://iftechfoundation.org/cgi-bin/mailman/listinfo/friends +[58]:http://blog.iftechfoundation.org/ +[59]:http://blog.iftechfoundation.org/2017-12-20-the-iftf-gift-shop-is-now-open.html +[60]:https://itsfoss.com/create-interactive-fiction/ diff --git a/published/201908/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md b/published/201908/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md new file mode 100644 index 0000000000..ad09ac44cf --- /dev/null +++ b/published/201908/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md @@ -0,0 +1,146 @@ +4 种方式来自定义 Xfce 来给它一个现代化外观 +====== + +> Xfce 是一个非常轻量的桌面环境,但它有一个缺点,它看起来有点老旧。但是你没有必要坚持默认外观。让我们看看你可以自定义 Xfce 的各种方法,来给它一个现代化的、漂亮的外观。 + +![Customize Xfce desktop envirnment][1] + +首先,Xfce 是最[受欢迎的桌面环境][2]之一。作为一个轻量级桌面环境,你可以在非常低的资源上运行 Xfce,并且它仍然能很好地工作。这是为什么很多[轻量级 Linux 发行版][3]默认使用 Xfce 的原因之一。 + +一些人甚至喜欢在高端设备上使用它,说明它的简单性、易用性和非资源依赖性是主要原因。 + +[Xfce][4] 自身很小,而且只提供你需要的东西。令人烦恼的一点是会令人觉得它的外观和感觉很老了。然而,你可以简单地自定义 Xfce 以使其看起来现代化和漂亮,但又不会像 Unity/GNOME 会话那样占用系统资源。 + +### 4 种方式来自定义 Xfce 桌面 + +让我们看看一些方法,我们可以通过这些方法改善你的 Xfce 桌面环境的外观和感觉。 + +默认 Xfce 桌面环境看起来有些像这样: + +![Xfce default screen][5] + +如你所见,默认 Xfce 桌面有点乏味。我们将使用主题、图标包以及更改默认 dock 来使它看起来新鲜和有点惊艳。 + +#### 1. 在 Xfce 中更改主题 + +我们将做的第一件事是从 [xfce-look.org][6] 中找到一款主题。我最喜欢的 Xfce 主题是 [XFCE-D-PRO][7]。 + +你可以从[这里][8]下载主题,并提取到某处。 + +你可以复制提取出的这些主题文件到你的家目录中的 `.theme` 文件夹。如果该文件夹尚不存在,你可以创建一个,同样的道理,图标需要放在一个在家目录中的 `.icons` 文件夹。 + +打开 **设置 > 外观 > 样式** 来选择该主题,注销并重新登录以查看更改。默认的 Adwaita-dark 也是一个不错的主题。 + +![Appearance Xfce][9] + +你可以在 Xfce 上使用各种[好的 GTK 主题][10]。 + +#### 2. 在 Xfce 中更改图标 + +Xfce-look.org 也提供你可以下载的图标主题,提取并放置图标到你的家目录中 `.icons` 目录。在你添加图标主题到 `.icons` 目录中后,转到 **设置 > 外观 > 图标** 来选择这个图标主题。 + +![Moka icon theme][11] + +我已经安装 [Moka 图标集][12] ,它看起来令人惊艳。 + +![Moka theme][13] + +你也可以参考我们[令人惊艳的图标主题][14]列表。 + +##### 可选: 通过 Synaptic 安装主题 + +如果你想避免手工搜索和复制文件,在你的系统中安装 Synaptic 软件包管理器。你可以通过网络来查找最佳的主题和图标集,使用 synaptic 软件包管理器,你可以搜索和安装主题。 + +``` +sudo apt-get install synaptic +``` + +**通过 Synaptic 搜索和安装主题/图标** + +打开 synaptic,并在**搜索**上单击。输入你期望的主题名,接下来,它将显示匹配主题的列表。勾选所有更改所需的附加依赖,并在**应用**上单击。这些操作将下载主题和安装主题。 + +![Arc Theme][15] + +在安装后,你可以打开**外观**选项来选择期望的主题。 + +在我看来,这不是在 Xfce 中安装主题的最佳方法。 + +#### 3. 在 Xfce 中更改桌面背景 + +再强调一次,默认 Xfce 桌面背景也不错。但是你可以把桌面背景更改成与你的图标和主题相匹配的东西。 + +为在 Xfce 中更改桌面背景,在桌面上右击,并单击**桌面设置**。从文件夹选择中选择**背景**,并选择任意一个默认背景或自定义背景。 + +![Changing desktop wallpapers][16] + +#### 4. 在 Xfce 中更改 dock + +默认 dock 也不错,恰如其分。但是,再强调一次,它看来有点平平淡淡。 + +![Docky][17] + +不过,如果你想你的 dock 变得更好,并带有更多一点的自定义选项,你可以安装另一个 dock 。 + +Plank 是一个简单而轻量级的、高度可配置的 dock。 + +为安装 Plank ,使用下面的命令: + +``` +sudo apt-get install plank +``` + +如果 Plank 在默认存储库中没有,你可以从这个 PPA 中安装它。 + +``` +sudo add-apt-repository ppa:ricotz/docky +sudo apt-get update +sudo apt-get install plank +``` + +在你使用 Plank 前,你应该通过右键单击移除默认的 dock,并在**面板设置**下,单击**删除**。 + +在完成后,转到 **附件 > Plank** 来启动 Plank dock 。 + +![Plank][18] + +Plank 从你正在使用的图标主题中选取图标。因此,如果你更改图标主题,你也将在 dock 中看到相关的更改。 + +### 总结 + +XFCE 是一个轻量级、快速和高度可自定义的桌面环境。如果你的系统资源有限,它服务很好,并且你可以简单地自定义它来看起来更好。这是在应用这些步骤后,我的屏幕的外观。 + +![XFCE desktop][19] + +这只是半个小时的努力成果,你可以使用不同的主题/图标自定义使它看起来更好。请随意在评论区分享你自定义的 XFCE 桌面屏幕,以及你正在使用的主题和图标组合。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/customize-xfce/ + +作者:[Ambarish Kumar][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/ambarish/ +[1]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/xfce-customization.jpeg +[2]:https://itsfoss.com/best-linux-desktop-environments/ +[3]:https://itsfoss.com/lightweight-linux-beginners/ +[4]:https://xfce.org/ +[5]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/06/1-1-800x410.jpg +[6]:http://xfce-look.org +[7]:https://www.xfce-look.org/p/1207818/XFCE-D-PRO +[8]:https://www.xfce-look.org/p/1207818/startdownload?file_id=1523730502&file_name=XFCE-D-PRO-1.6.tar.xz&file_type=application/x-xz&file_size=105328&url=https%3A%2F%2Fdl.opendesktop.org%2Fapi%2Ffiles%2Fdownloadfile%2Fid%2F1523730502%2Fs%2F6019b2b57a1452471eac6403ae1522da%2Ft%2F1529360682%2Fu%2F%2FXFCE-D-PRO-1.6.tar.xz +[9]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/4.jpg +[10]:https://itsfoss.com/best-gtk-themes/ +[11]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/6.jpg +[12]:https://snwh.org/moka +[13]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/11-800x547.jpg +[14]:https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[15]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/5-800x531.jpg +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/7-800x546.jpg +[17]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/8.jpg +[18]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/9.jpg +[19]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/10-800x447.jpg diff --git a/published/201908/20180928 Quiet log noise with Python and machine learning.md b/published/201908/20180928 Quiet log noise with Python and machine learning.md new file mode 100644 index 0000000000..d6471b3969 --- /dev/null +++ b/published/201908/20180928 Quiet log noise with Python and machine learning.md @@ -0,0 +1,106 @@ +Logreduce:用 Python 和机器学习去除日志噪音 +====== + +> Logreduce 可以通过从大量日志数据中挑选出异常来节省调试时间。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sound-radio-noise-communication.png?itok=KMNn9QrZ) + +持续集成(CI)作业会生成大量数据。当一个作业失败时,弄清楚出了什么问题可能是一个繁琐的过程,它涉及到调查日志以发现根本原因 —— 这通常只能在全部的作业输出的一小部分中找到。为了更容易地将最相关的数据与其余数据分开,可以使用先前成功运行的作业结果来训练 [Logreduce][1] 机器学习模型,以从失败的运行日志中提取异常。 + +此方法也可以应用于其他用例,例如,从 [Journald][2] 或其他系统级的常规日志文件中提取异常。 + +### 使用机器学习来降低噪音 + +典型的日志文件包含许多标称事件(“基线”)以及与开发人员相关的一些例外事件。基线可能包含随机元素,例如难以检测和删除的时间戳或唯一标识符。要删除基线事件,我们可以使用 [k-最近邻模式识别算法][3](k-NN)。 + +![](https://opensource.com/sites/default/files/uploads/ml-generic-workflow.png) + +日志事件必须转换为可用于 k-NN 回归的数值。使用通用特征提取工具 [HashingVectorizer][4] 可以将该过程应用于任何类型的日志。它散列每个单词并在稀疏矩阵中对每个事件进行编码。为了进一步减少搜索空间,这个标记化过程删除了已知的随机单词,例如日期或 IP 地址。 + +![](https://opensource.com/sites/default/files/uploads/hashing-vectorizer.png) + +训练模型后,k-NN 搜索可以告诉我们每个新事件与基线的距离。 + +![](https://opensource.com/sites/default/files/uploads/kneighbors.png) + +这个 [Jupyter 笔记本][5] 演示了该稀疏矩阵向量的处理和图形。 + +![](https://opensource.com/sites/default/files/uploads/anomaly-detection-with-scikit-learn.png) + +### Logreduce 介绍 + +Logreduce Python 软件透明地实现了这个过程。Logreduce 的最初目标是使用构建数据库来协助分析 [Zuul CI][6] 作业的失败问题,现在它已集成到 [Software Factory 开发车间][7]的作业日志处理中。 + +最简单的是,Logreduce 会比较文件或目录并删除相似的行。Logreduce 为每个源文件构建模型,并使用以下语法输出距离高于定义阈值的任何目标行:`distance | filename:line-number: line-content`。 + +``` +$ logreduce diff /var/log/audit/audit.log.1 /var/log/audit/audit.log +INFO  logreduce.Classifier - Training took 21.982s at 0.364MB/s (1.314kl/s) (8.000 MB - 28.884 kilo-lines) +0.244 | audit.log:19963:        type=USER_AUTH acct="root" exe="/usr/bin/su" hostname=managesf.sftests.com +INFO  logreduce.Classifier - Testing took 18.297s at 0.306MB/s (1.094kl/s) (5.607 MB - 20.015 kilo-lines) +99.99% reduction (from 20015 lines to 1 + +``` + +更高级的 Logreduce 用法可以离线训练模型以便重复使用。可以使用基线的许多变体来拟合 k-NN 搜索树。 + +``` +$ logreduce dir-train audit.clf /var/log/audit/audit.log.* +INFO  logreduce.Classifier - Training took 80.883s at 0.396MB/s (1.397kl/s) (32.001 MB - 112.977 kilo-lines) +DEBUG logreduce.Classifier - audit.clf: written +$ logreduce dir-run audit.clf /var/log/audit/audit.log +``` + +Logreduce 还实现了接口,以发现 Journald 时间范围(天/周/月)和 Zuul CI 作业构建历史的基线。它还可以生成 HTML 报告,该报告在一个简单的界面中将在多个文件中发现的异常进行分组。 + +![](https://opensource.com/sites/default/files/uploads/html-report.png) + +### 管理基线 + +使用 k-NN 回归进行异常检测的关键是拥有一个已知良好基线的数据库,该模型使用数据库来检测偏离太远的日志行。此方法依赖于包含所有标称事件的基线,因为基线中未找到的任何内容都将报告为异常。 + +CI 作业是 k-NN 回归的重要目标,因为作业的输出通常是确定性的,之前的运行结果可以自动用作基线。 Logreduce 具有 Zuul 作业角色,可以将其用作失败的作业发布任务的一部分,以便发布简明报告(而不是完整作业的日志)。只要可以提前构建基线,该原则就可以应用于其他情况。例如,标称系统的 [SoS 报告][8] 可用于查找缺陷部署中的问题。 + +![](https://opensource.com/sites/default/files/uploads/baselines.png) + +### 异常分类服务 + +下一版本的 Logreduce 引入了一种服务器模式,可以将日志处理卸载到外部服务,在外部服务中可以进一步分析该报告。它还支持导入现有报告和请求以分析 Zuul 构建。这些服务以异步方式运行分析,并具有 Web 界面以调整分数并消除误报。 + +![](https://opensource.com/sites/default/files/uploads/classification-interface.png) + +已审核的报告可以作为独立数据集存档,其中包含目标日志文件和记录在一个普通的 JSON 文件中的异常行的分数。 + +### 项目路线图 + +Logreduce 已经能有效使用,但是有很多机会来改进该工具。未来的计划包括: + +* 策划在日志文件中发现的许多带注释的异常,并生成一个公共域数据集以进行进一步研究。日志文件中的异常检测是一个具有挑战性的主题,并且有一个用于测试新模型的通用数据集将有助于识别新的解决方案。 +* 重复使用带注释的异常模型来优化所报告的距离。例如,当用户通过将距离设置为零来将日志行标记为误报时,模型可能会降低未来报告中这些日志行的得分。 +* 对存档异常取指纹特征以检测新报告何时包含已知的异常。因此,该服务可以通知用户该作业遇到已知问题,而不是报告异常的内容。解决问题后,该服务可以自动重新启动该作业。 +* 支持更多基准发现接口,用于 SOS 报告、Jenkins 构建、Travis CI 等目标。 + +如果你有兴趣参与此项目,请通过 #log-classify Freenode IRC 频道与我们联系。欢迎反馈! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/quiet-log-noise-python-and-machine-learning + +作者:[Tristan de Cacqueray][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[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/tristanc +[1]: https://pypi.org/project/logreduce/ +[2]: http://man7.org/linux/man-pages/man8/systemd-journald.service.8.html +[3]: https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm +[4]: http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.HashingVectorizer.html +[5]: https://github.com/TristanCacqueray/anomaly-detection-workshop-opendev/blob/master/datasets/notebook/anomaly-detection-with-scikit-learn.ipynb +[6]: https://zuul-ci.org +[7]: https://www.softwarefactory-project.io +[8]: https://sos.readthedocs.io/en/latest/ +[9]: https://www.openstack.org/summit/berlin-2018/summit-schedule/speakers/4307 +[10]: https://www.openstack.org/summit/berlin-2018/ diff --git a/published/201908/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md b/published/201908/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md new file mode 100644 index 0000000000..86f0c467f3 --- /dev/null +++ b/published/201908/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md @@ -0,0 +1,249 @@ +探索 Linux 内核:Kconfig/kbuild 的秘密 +====== + +> 深入理解 Linux 配置/构建系统是如何工作的。 + +![](https://img.linux.net.cn/data/attachment/album/201908/15/093935dvyk5znoaooaooba.jpg) + +自从 Linux 内核代码迁移到 Git 以来,Linux 内核配置/构建系统(也称为 Kconfig/kbuild)已存在很长时间了。然而,作为支持基础设施,它很少成为人们关注的焦点;甚至在日常工作中使用它的内核开发人员也从未真正思考过它。 + +为了探索如何编译 Linux 内核,本文将深入介绍 Kconfig/kbuild 内部的过程,解释如何生成 `.config` 文件和 `vmlinux`/`bzImage` 文件,并介绍一个巧妙的依赖性跟踪技巧。 + +### Kconfig + +构建内核的第一步始终是配置。Kconfig 有助于使 Linux 内核高度模块化和可定制。Kconfig 为用户提供了许多配置目标: + + +| 配置目标 | 解释 | +| ---------------- | --------------------------------------------------------- | +| `config` | 利用命令行程序更新当前配置 | +| `nconfig` | 利用基于 ncurses 菜单的程序更新当前配置 | +| `menuconfig` | 利用基于菜单的程序更新当前配置 | +| `xconfig` | 利用基于 Qt 的前端程序更新当前配置 | +| `gconfig` | 利用基于 GTK+ 的前端程序更新当前配置 | +| `oldconfig` | 基于提供的 `.config` 更新当前配置 | +| `localmodconfig` | 更新当前配置,禁用没有载入的模块 | +| `localyesconfig` | 更新当前配置,转换本地模块到核心 | +| `defconfig` | 带有来自架构提供的 `defconcig` 默认值的新配置 | +| `savedefconfig` | 保存当前配置为 `./defconfig`(最小配置) | +| `allnoconfig` | 所有选项回答为 `no` 的新配置 | +| `allyesconfig` | 所有选项回答为 `yes` 的新配置 | +| `allmodconfig` | 尽可能选择所有模块的新配置 | +| `alldefconfig` | 所有符号(选项)设置为默认值的新配置 | +| `randconfig` | 所有选项随机选择的新配置 | +| `listnewconfig` | 列出新选项 | +| `olddefconfig` | 同 `oldconfig` 一样,但设置新符号(选项)为其默认值而无须提问 | +| `kvmconfig` | 启用支持 KVM 访客内核模块的附加选项 | +| `xenconfig` | 启用支持 xen 的 dom0 和 访客内核模块的附加选项 | +| `tinyconfig` | 配置尽可能小的内核 | + +我认为 `menuconfig` 是这些目标中最受欢迎的。这些目标由不同的主程序host program处理,这些程序由内核提供并在内核构建期间构建。一些目标有 GUI(为了方便用户),而大多数没有。与 Kconfig 相关的工具和源代码主要位于内核源代码中的 `scripts/kconfig/` 下。从 `scripts/kconfig/Makefile` 中可以看到,这里有几个主程序,包括 `conf`、`mconf` 和 `nconf`。除了 `conf` 之外,每个都负责一个基于 GUI 的配置目标,因此,`conf` 处理大多数目标。 + +从逻辑上讲,Kconfig 的基础结构有两部分:一部分实现一种[新语言][1]来定义配置项(参见内核源代码下的 Kconfig 文件),另一部分解析 Kconfig 语言并处理配置操作。 + +大多数配置目标具有大致相同的内部过程(如下所示): + +![](https://opensource.com/sites/default/files/uploads/kconfig_process.png) + +请注意,所有配置项都具有默认值。 + +第一步读取源代码根目录下的 Kconfig 文件,构建初始配置数据库;然后它根据如下优先级读取现有配置文件来更新初始数据库: + +1. `.config` +2. `/lib/modules/$(shell,uname -r)/.config` +3. `/etc/kernel-config` +4. `/boot/config-$(shell,uname -r)` +5. `ARCH_DEFCONFIG` +6. `arch/$(ARCH)/defconfig` + +如果你通过 `menuconfig` 进行基于 GUI 的配置或通过 `oldconfig` 进行基于命令行的配置,则根据你的自定义更新数据库。最后,该配置数据库被转储到 `.config` 文件中。 + +但 `.config` 文件不是内核构建的最终素材;这就是 `syncconfig` 目标存在的原因。`syncconfig`曾经是一个名为 `silentoldconfig` 的配置目标,但它没有做到其旧名称所说的工作,所以它被重命名。此外,因为它是供内部使用的(不适用于用户),所以它已从上述列表中删除。 + +以下是 `syncconfig` 的作用: + +![](https://opensource.com/sites/default/files/uploads/syncconfig.png) + +`syncconfig` 将 `.config` 作为输入并输出许多其他文件,这些文件分为三类: + +* `auto.conf` & `tristate.conf` 用于 makefile 文本处理。例如,你可以在组件的 makefile 中看到这样的语句:`obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o`。 +* `autoconf.h` 用于 C 语言的源文件。 +* `include/config/` 下空的头文件用于 kbuild 期间的配置依赖性跟踪。下面会解释。 + +配置完成后,我们将知道哪些文件和代码片段未编译。 + +### kbuild + +组件式构建,称为*递归 make*,是 GNU `make` 管理大型项目的常用方法。kbuild 是递归 make 的一个很好的例子。通过将源文件划分为不同的模块/组件,每个组件都由其自己的 makefile 管理。当你开始构建时,顶级 makefile 以正确的顺序调用每个组件的 makefile、构建组件,并将它们收集到最终的执行程序中。 + +kbuild 指向到不同类型的 makefile: + +* `Makefile` 位于源代码根目录的顶级 makefile。 +* `.config` 是内核配置文件。 +* `arch/$(ARCH)/Makefile` 是架构的 makefile,它用于补充顶级 makefile。 +* `scripts/Makefile.*` 描述所有的 kbuild makefile 的通用规则。 +* 最后,大约有 500 个 kbuild makefile。 + +顶级 makefile 会将架构 makefile 包含进去,读取 `.config` 文件,下到子目录,在 `scripts/ Makefile.*` 中定义的例程的帮助下,在每个组件的 makefile 上调用 `make`,构建每个中间对象,并将所有的中间对象链接为 `vmlinux`。内核文档 [Documentation/kbuild/makefiles.txt][2] 描述了这些 makefile 的方方面面。 + +作为一个例子,让我们看看如何在 x86-64 上生成 `vmlinux`: + +![vmlinux overview][4] + +(此插图基于 Richard Y. Steven 的[博客][5]。有过更新,并在作者允许的情况下使用。) + +进入 `vmlinux` 的所有 `.o` 文件首先进入它们自己的 `built-in.a`,它通过变量`KBUILD_VMLINUX_INIT`、`KBUILD_VMLINUX_MAIN`、`KBUILD_VMLINUX_LIBS` 表示,然后被收集到 `vmlinux` 文件中。 + +在下面这个简化的 makefile 代码的帮助下,了解如何在 Linux 内核中实现递归 make: + +``` +# In top Makefile +vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) +                +$(call if_changed,link-vmlinux) + +# Variable assignments +vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) + +export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) +export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) +export KBUILD_VMLINUX_LIBS := $(libs-y1) +export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds + +init-y          := init/ +drivers-y       := drivers/ sound/ firmware/ +net-y           := net/ +libs-y          := lib/ +core-y          := usr/ +virt-y          := virt/ + +# Transform to corresponding built-in.a +init-y          := $(patsubst %/, %/built-in.a, $(init-y)) +core-y          := $(patsubst %/, %/built-in.a, $(core-y)) +drivers-y       := $(patsubst %/, %/built-in.a, $(drivers-y)) +net-y           := $(patsubst %/, %/built-in.a, $(net-y)) +libs-y1         := $(patsubst %/, %/lib.a, $(libs-y)) +libs-y2         := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y))) +virt-y          := $(patsubst %/, %/built-in.a, $(virt-y)) + +# Setup the dependency. vmlinux-deps are all intermediate objects, vmlinux-dirs +# are phony targets, so every time comes to this rule, the recipe of vmlinux-dirs +# will be executed. Refer "4.6 Phony Targets" of `info make` +$(sort $(vmlinux-deps)): $(vmlinux-dirs) ; + +# Variable vmlinux-dirs is the directory part of each built-in.a +vmlinux-dirs    := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ +                     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ +                     $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y))) + +# The entry of recursive make +$(vmlinux-dirs): +                $(Q)$(MAKE) $(build)=$@ need-builtin=1 +``` + +递归 make 的配方recipe被扩展开是这样的: + +``` +make -f scripts/Makefile.build obj=init need-builtin=1 +``` + +这意味着 `make` 将进入 `scripts/Makefile.build` 以继续构建每个 `built-in.a`。在`scripts/link-vmlinux.sh` 的帮助下,`vmlinux` 文件最终位于源根目录下。 + +#### vmlinux 与 bzImage 对比 + +许多 Linux 内核开发人员可能不清楚 `vmlinux` 和 `bzImage` 之间的关系。例如,这是他们在 x86-64 中的关系: + +![](https://opensource.com/sites/default/files/uploads/vmlinux-bzimage.png) + +源代码根目录下的 `vmlinux` 被剥离、压缩后,放入 `piggy.S`,然后与其他对等对象链接到 `arch/x86/boot/compressed/vmlinux`。同时,在 `arch/x86/boot` 下生成一个名为 `setup.bin` 的文件。可能有一个可选的第三个文件,它带有重定位信息,具体取决于 `CONFIG_X86_NEED_RELOCS` 的配置。 + +由内核提供的称为 `build` 的宿主程序将这两个(或三个)部分构建到最终的 `bzImage` 文件中。 + +#### 依赖跟踪 + +kbuild 跟踪三种依赖关系: + +1. 所有必备文件(`*.c` 和 `*.h`) +2. 所有必备文件中使用的 `CONFIG_` 选项 +3. 用于编译该目标的命令行依赖项 + +第一个很容易理解,但第二个和第三个呢? 内核开发人员经常会看到如下代码: + +``` +#ifdef CONFIG_SMP +__boot_cpu_id = cpu; +#endif +``` + +当 `CONFIG_SMP` 改变时,这段代码应该重新编译。编译源文件的命令行也很重要,因为不同的命令行可能会导致不同的目标文件。 + +当 `.c` 文件通过 `#include` 指令使用头文件时,你需要编写如下规则: + +``` +main.o: defs.h +        recipe... +``` + +管理大型项目时,需要大量的这些规则;把它们全部写下来会很乏味无聊。幸运的是,大多数现代 C 编译器都可以通过查看源文件中的 `#include` 行来为你编写这些规则。对于 GNU 编译器集合(GCC),只需添加一个命令行参数:`-MD depfile` + +``` +# In scripts/Makefile.lib +c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \ +                 -include $(srctree)/include/linux/compiler_types.h       \ +                 $(__c_flags) $(modkern_cflags)                           \ +                 $(basename_flags) $(modname_flags) +``` + +这将生成一个 `.d` 文件,内容如下: + +``` +init_task.o: init/init_task.c include/linux/kconfig.h \ +  include/generated/autoconf.h include/linux/init_task.h \ +  include/linux/rcupdate.h include/linux/types.h \ +  ... +``` + +然后主程序 [fixdep][6] 通过将 depfile 文件和命令行作为输入来处理其他两个依赖项,然后以 makefile 格式输出一个 `..cmd` 文件,它记录命令行和目标的所有先决条件(包括配置)。 它看起来像这样: + +``` +# The command line used to compile the target +cmd_init/init_task.o := gcc -Wp,-MD,init/.init_task.o.d  -nostdinc ... +... +# The dependency files +deps_init/init_task.o := \ + $(wildcard include/config/posix/timers.h) \ + $(wildcard include/config/arch/task/struct/on/stack.h) \ + $(wildcard include/config/thread/info/in/task.h) \ + ... + include/uapi/linux/types.h \ + arch/x86/include/uapi/asm/types.h \ + include/uapi/asm-generic/types.h \ + ... +``` + +在递归 make 中,`..cmd` 文件将被包含,以提供所有依赖关系信息并帮助决定是否重建目标。 + +这背后的秘密是 `fixdep` 将解析 depfile(`.d` 文件),然后解析里面的所有依赖文件,搜索所有 `CONFIG_` 字符串的文本,将它们转换为相应的空的头文件,并将它们添加到目标的先决条件。每次配置更改时,相应的空的头文件也将更新,因此 kbuild 可以检测到该更改并重建依赖于它的目标。因为还记录了命令行,所以很容易比较最后和当前的编译参数。 + +### 展望未来 + +Kconfig/kbuild 在很长一段时间内没有什么变化,直到新的维护者 Masahiro Yamada 于 2017 年初加入,现在 kbuild 正在再次积极开发中。如果你不久后看到与本文中的内容不同的内容,请不要感到惊讶。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/10/kbuild-and-kconfig + +作者:[Cao Jin][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/pinocchio +[b]: https://github.com/lujun9972 +[1]: https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-language.txt +[2]: https://www.mjmwired.net/kernel/Documentation/kbuild/makefiles.txt +[3]: https://opensource.com/file/411516 +[4]: https://opensource.com/sites/default/files/uploads/vmlinux_generation_process.png (vmlinux overview) +[5]: https://blog.csdn.net/richardysteven/article/details/52502734 +[6]: https://github.com/torvalds/linux/blob/master/scripts/basic/fixdep.c diff --git a/published/201908/20181029 Create animated, scalable vector graphic images with MacSVG.md b/published/201908/20181029 Create animated, scalable vector graphic images with MacSVG.md new file mode 100644 index 0000000000..601c64ed31 --- /dev/null +++ b/published/201908/20181029 Create animated, scalable vector graphic images with MacSVG.md @@ -0,0 +1,69 @@ +使用 MacSVG 创建 SVG 动画 +====== + +> 开源 SVG:墙上的魔法字。 + +![](https://img.linux.net.cn/data/attachment/album/201908/18/000809mzl1wb1ww754z455.jpg) + +新巴比伦的摄政王[伯沙撒][1]没有注意到他在盛宴期间神奇地[书写在墙上的文字][2]。但是,如果他在公元前 539 年有一台笔记本电脑和良好的互联网连接,他可能会通过在浏览器上阅读 SVG 来避开那些讨厌的波斯人。 + +出现在网页上的动画文本和对象是建立用户兴趣和参与度的好方法。有几种方法可以实现这一点,例如视频嵌入、动画 GIF 或幻灯片 —— 但你也可以使用[可缩放矢量图形(SVG)][3]。 + +SVG 图像与 JPG 不同,因为它可以缩放而不会丢失其分辨率。矢量图像是由点而不是像素创建的,所以无论它放大到多大,它都不会失去分辨率或像素化。充分利用可缩放的静态图像的一个例子是网站的徽标。 + +### 动起来,动起来 + +你可以使用多种绘图程序创建 SVG 图像,包括开源的 [Inkscape][4] 和 Adobe Illustrator。让你的图像“能动起来”需要更多的努力。幸运的是,有一些开源解决方案甚至可以引起伯沙撒的注意。 + +[MacSVG][5] 是一款可以让你的图像动起来的工具。你可以在 [GitHub][6] 上找到源代码。 + +根据其[官网][5]说,MacSVG 由阿肯色州康威的 Douglas Ward 开发,是一个“用于设计 HTML5 SVG 艺术和动画的开源 Mac OS 应用程序”。 + +我想使用 MacSVG 来创建一个动画签名。我承认我发现这个过程有点令人困惑,并且在我第一次尝试创建一个实际的动画 SVG 图像时失败了。 + +![](https://opensource.com/sites/default/files/uploads/macsvg-screen.png) + +重要的是首先要了解要展示的书法内容实际写的是什么。 + +动画文字背后的属性是 [stroke-dasharray][7]。将该术语分成三个单词有助于解释正在发生的事情:“stroke” 是指用笔(无论是物理的笔还是数字化笔)制作的线条或笔画。“dash” 意味着将笔划分解为一系列折线。“array” 意味着将整个东西生成为数组。这是一个简单的概述,但它可以帮助我理解应该发生什么以及为什么。 + +使用 MacSVG,你可以导入图形(.PNG)并使用钢笔工具描绘书写路径。我使用了草书来表示我的名字。然后,只需应用该属性来让书法动画起来、增加和减少笔划的粗细、改变其颜色等等。完成后,动画的书法将导出为 .SVG 文件,并可以在网络上使用。除书写外,MacSVG 还可用于许多不同类型的 SVG 动画。 + +### 在 WordPress 中书写 + +我准备在我的 [WordPress][8] 网站上传和分享我的 SVG 示例,但我发现 WordPress 不允许进行 SVG 媒体导入。幸运的是,我找到了一个方便的插件:Benbodhi 的 [SVG 支持][9]插件允许快速、轻松地导入我的 SVG,就像我将 JPG 导入媒体库一样。我能够在世界各地向巴比伦人展示我[写在墙上的魔法字][10]。 + +我在 [Brackets][11] 中开源了 SVG 的源代码,结果如下: + +``` + + +Path animation with stroke-dasharrayThis example demonstrates the use of a path element, an animate element, and the stroke-dasharray attribute to simulate drawing. +``` + +你会使用 MacSVG 做什么? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/10/macsvg-open-source-tool-animation + +作者:[Jeff Macharyas][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/rikki-endsley +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Belshazzar +[2]: https://en.wikipedia.org/wiki/Belshazzar%27s_feast +[3]: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics +[4]: https://inkscape.org/ +[5]: https://macsvg.org/ +[6]: https://github.com/dsward2/macSVG +[7]: https://gist.github.com/mbostock/5649592 +[8]: https://macharyas.com/ +[9]: https://wordpress.org/plugins/svg-support/ +[10]: https://macharyas.com/index.php/2018/10/14/open-source-svg/ +[11]: http://brackets.io/ diff --git a/published/201908/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md b/published/201908/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md new file mode 100644 index 0000000000..0c15bde2ea --- /dev/null +++ b/published/201908/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md @@ -0,0 +1,150 @@ +DF-SHOW:一个基于老式 DOS 应用的终端文件管理器 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-720x340.png) + +如果你曾经使用过老牌的 MS-DOS,你可能已经使用或听说过 DF-EDIT。DF-EDIT,意即 **D**irectory **F**ile **Edit**,它是一个鲜为人知的 DOS 文件管理器,最初由 Larry Kroeker 为 MS-DOS 和 PC-DOS 系统而编写。它用于在 MS-DOS 和 PC-DOS 系统中显示给定目录或文件的内容。今天,我偶然发现了一个名为 DF-SHOW 的类似实用程序(**D**irectory **F**ile **Show**),这是一个类 Unix 操作系统的终端文件管理器。它是鲜为人知的 DF-EDIT 文件管理器的 Unix 重写版本,其基于 1986 年发布的 DF-EDIT 2.3d。DF-SHOW 完全是自由开源的,并在 GPLv3 下发布。 + +DF-SHOW 可以: + +* 列出目录的内容, +* 查看文件, +* 使用你的默认文件编辑器编辑文件, +* 将文件复制到不同位置, +* 重命名文件, +* 删除文件, +* 在 DF-SHOW 界面中创建新目录, +* 更新文件权限,所有者和组, +* 搜索与搜索词匹配的文件, +* 启动可执行文件。 + +### DF-SHOW 用法 + +DF-SHOW 实际上是两个程序的结合,名为 `show` 和 `sf`。 + +#### Show 命令 + +`show` 程序(类似于 `ls` 命令)用于显示目录的内容、创建新目录、重命名和删除文件/文件夹、更新权限、搜索文件等。 + +要查看目录中的内容列表,请使用以下命令: + +``` +$ show +``` + +示例: + +``` +$ show dfshow +``` + +这里,`dfshow` 是一个目录。如果在未指定目录路径的情况下调用 `show` 命令,它将显示当前目录的内容。 + +这是 DF-SHOW 默认界面的样子。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-1.png) + +如你所见,DF-SHOW 的界面不言自明。 + +在顶部栏上,你会看到可用的选项列表,例如复制、删除、编辑、修改等。 + +完整的可用选项列表如下: + + * `C` opy(复制) + * `D` elete(删除) + * `E` dit(编辑) + * `H` idden(隐藏) + * `M` odify(修改) + * `Q` uit(退出) + * `R` ename(重命名) + * `S` how(显示) + * h `U` nt(文件内搜索) + * e `X` ec(执行) + * `R` un command(运行命令) + * `E` dit file(编辑文件) + * `H` elp(帮助) + * `M` ake dir(创建目录) + * `S` how dir(显示目录) + +在每个选项中,有一个字母以大写粗体标记。只需按下该字母即可执行相应的操作。例如,要重命名文件,只需按 `R` 并键入新名称,然后按回车键重命名所选项目。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-2.png) + +要显示所有选项或取消操作,只需按 `ESC` 键即可。 + +此外,你将在 DF-SHOW 界面的底部看到一堆功能键,以浏览目录的内容。 + +* `UP` / `DOWN` 箭头或 `F1` / `F2` - 上下移动(一次一行), +* `PgUp` / `PgDn` - 一次移动一页, +* `F3` / `F4` - 立即转到列表的顶部和底部, +* `F5` - 刷新, +* `F6` - 标记/取消标记文件(标记的文件将在它们前面用 `*` 表示), +* `F7` / `F8` - 一次性标记/取消标记所有文件, +* `F9` - 按以下顺序对列表排序 - 日期和时间、名称、大小。 + +按 `h` 了解有关 `show` 命令及其选项的更多详细信息。 + +要退出 DF-SHOW,只需按 `q` 即可。 + +#### SF 命令 + +`sf` (显示文件)用于显示文件的内容。 + +``` +$ sf +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-3.png) + +按 `h` 了解更多 `sf` 命令及其选项。要退出,请按 `q`。 + +想试试看?很好,让我们继续在 Linux 系统上安装 DF-SHOW,如下所述。 + +### 安装 DF-SHOW + +DF-SHOW 在 [AUR][1] 中可用,因此你可以使用 AUR 程序(如 [yay][2])在任何基于 Arch 的系统上安装它。 + +``` +$ yay -S dfshow +``` + +在 Ubuntu 及其衍生版上: + +``` +$ sudo add-apt-repository ppa:ian-hawdon/dfshow +$ sudo apt-get update +$ sudo apt-get install dfshow +``` + +在其他 Linux 发行版上,你可以从源代码编译和构建它,如下所示。 + +``` +$ git clone https://github.com/roberthawdon/dfshow +$ cd dfshow +$ ./bootstrap +$ ./configure +$ make +$ sudo make install +``` + +DF-SHOW 项目的作者只重写了 DF-EDIT 实用程序的一些应用程序。由于源代码可以在 GitHub 上免费获得,因此你可以添加更多功能、改进代码并提交或修复错误(如果有的话)。它仍处于 beta 阶段,但功能齐全。 + +你有没试过吗?如果试过,觉得如何?请在下面的评论部分告诉我们你的体验。 + +不管如何,希望这有用。还有更多好东西。敬请关注! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/df-show-a-terminal-file-manager-based-on-an-old-dos-application/ + +作者:[SK][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://aur.archlinux.org/packages/dfshow/ +[2]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ diff --git a/published/201908/20181030 Podman- A more secure way to run containers.md b/published/201908/20181030 Podman- A more secure way to run containers.md new file mode 100644 index 0000000000..50e64225a4 --- /dev/null +++ b/published/201908/20181030 Podman- A more secure way to run containers.md @@ -0,0 +1,128 @@ +Podman:一个更安全的运行容器的方式 +====== + +> Podman 使用传统的 fork/exec 模型(相对于客户端/服务器模型)来运行容器。 + +![](https://img.linux.net.cn/data/attachment/album/201908/23/234924m55sn8zt3b5q8815.jpg) + +在进入本文的主要主题 [Podman][1] 和容器之前,我需要了解一点 Linux 审计功能的技术。 + +### 什么是审计? + +Linux 内核有一个有趣的安全功能,叫做**审计**。它允许管理员在系统上监视安全事件,并将它们记录到`audit.log` 中,该文件可以本地存储或远程存储在另一台机器上,以防止黑客试图掩盖他的踪迹。 + +`/etc/shadow` 文件是一个经常要监控的安全文件,因为向其添加记录可能允许攻击者获得对系统的访问权限。管理员想知道是否有任何进程修改了该文件,你可以通过执行以下命令来执行此操作: + +``` +# auditctl -w /etc/shadow +``` + +现在让我们看看当我修改了 `/etc/shadow` 文件会发生什么: + +``` +# touch /etc/shadow +# ausearch -f /etc/shadow -i -ts recent + +type=PROCTITLE msg=audit(10/10/2018 09:46:03.042:4108) : proctitle=touch /etc/shadow type=SYSCALL msg=audit(10/10/2018 09:46:03.042:4108) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7ffdb17f6704 a2=O_WRONLY|O_CREAT|O_NOCTTY| O_NONBLOCK a3=0x1b6 items=2 ppid=2712 pid=3727 auid=dwalsh uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=3 comm=touch exe=/usr/bin/touch subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)` +``` + +审计记录中有很多信息,但我重点注意到它记录了 root 修改了 `/etc/shadow` 文件,并且该进程的审计 UID(`auid`)的所有者是 `dwalsh`。 + +内核修改了这个文件了么? + +#### 跟踪登录 UID + +登录 UID(`loginuid`),存储在 `/proc/self/loginuid` 中,它是系统上每个进程的 proc 结构的一部分。该字段只能设置一次;设置后,内核将不允许任何进程重置它。 + +当我登录系统时,登录程序会为我的登录过程设置 `loginuid` 字段。 + +我(`dwalsh`)的 UID 是 3267。 + +``` +$ cat /proc/self/loginuid +3267 +``` + +现在,即使我变成了 root,我的登录 UID 仍将保持不变。 + +``` +$ sudo cat /proc/self/loginuid +3267 +``` + +请注意,从初始登录过程 fork 并 exec 的每个进程都会自动继承 `loginuid`。这就是内核知道登录的人是 `dwalsh` 的方式。 + +### 容器 + +现在让我们来看看容器。 + +``` +sudo podman run fedora cat /proc/self/loginuid +3267 +``` + +甚至容器进程也保留了我的 `loginuid`。 现在让我们用 Docker 试试。 + +``` +sudo docker run fedora cat /proc/self/loginuid +4294967295 +``` + +### 为什么不一样? + +Podman 对于容器使用传统的 fork/exec 模型,因此容器进程是 Podman 进程的后代。Docker 使用客户端/服务器模型。我执行的 `docker` 命令是 Docker 客户端工具,它通过客户端/服务器操作与 Docker 守护进程通信。然后 Docker 守护程序创建容器并处理 stdin/stdout 与 Docker 客户端工具的通信。 + +进程的默认 `loginuid`(在设置 `loginuid` 之前)是 `4294967295`(LCTT 译注:2^32 - 1)。由于容器是 Docker 守护程序的后代,而 Docker 守护程序是 init 系统的子代,所以,我们看到 systemd、Docker 守护程序和容器进程全部具有相同的 `loginuid`:`4294967295`,审计系统视其为未设置审计 UID。 + +``` +cat /proc/1/loginuid +4294967295 +``` + +### 怎么会被滥用? + +让我们来看看如果 Docker 启动的容器进程修改 `/etc/shadow` 文件会发生什么。 + +``` +$ sudo docker run --privileged -v /:/host fedora touch /host/etc/shadow +$ sudo ausearch -f /etc/shadow -i type=PROCTITLE msg=audit(10/10/2018 10:27:20.055:4569) : proctitle=/usr/bin/coreutils --coreutils-prog-shebang=touch /usr/bin/touch /host/etc/shadow type=SYSCALL msg=audit(10/10/2018 10:27:20.055:4569) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7ffdb6973f50 a2=O_WRONLY|O_CREAT|O_NOCTTY| O_NONBLOCK a3=0x1b6 items=2 ppid=11863 pid=11882 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=touch exe=/usr/bin/coreutils subj=system_u:system_r:spc_t:s0 key=(null) +``` + +在 Docker 情形中,`auid` 是未设置的(`4294967295`);这意味着安全人员可能知道有进程修改了 `/etc/shadow` 文件但身份丢失了。 + +如果该攻击者随后删除了 Docker 容器,那么在系统上谁修改 `/etc/shadow` 文件将没有任何跟踪信息。 + +现在让我们看看相同的场景在 Podman 下的情况。 + +``` +$ sudo podman run --privileged -v /:/host fedora touch /host/etc/shadow +$ sudo ausearch -f /etc/shadow -i type=PROCTITLE msg=audit(10/10/2018 10:23:41.659:4530) : proctitle=/usr/bin/coreutils --coreutils-prog-shebang=touch /usr/bin/touch /host/etc/shadow type=SYSCALL msg=audit(10/10/2018 10:23:41.659:4530) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7fffdffd0f34 a2=O_WRONLY|O_CREAT|O_NOCTTY| O_NONBLOCK a3=0x1b6 items=2 ppid=11671 pid=11683 auid=dwalsh uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=3 comm=touch exe=/usr/bin/coreutils subj=unconfined_u:system_r:spc_t:s0 key=(null) +``` + +由于它使用传统的 fork/exec 方式,因此 Podman 正确记录了所有内容。 + +这只是观察 `/etc/shadow` 文件的一个简单示例,但审计系统对于观察系统上的进程非常有用。使用 fork/exec 容器运行时(而不是客户端/服务器容器运行时)来启动容器允许你通过审计日志记录保持更好的安全性。 + +### 最后的想法 + +在启动容器时,与客户端/服务器模型相比,fork/exec 模型还有许多其他不错的功能。例如,systemd 功能包括: + +* `SD_NOTIFY`:如果将 Podman 命令放入 systemd 单元文件中,容器进程可以通过 Podman 返回通知,表明服务已准备好接收任务。这是在客户端/服务器模式下无法完成的事情。 +* 套接字激活:你可以将连接的套接字从 systemd 传递到 Podman,并传递到容器进程以便使用它们。这在客户端/服务器模型中是不可能的。 + +在我看来,其最好的功能是**作为非 root 用户运行 Podman 和容器**。这意味着你永远不会在宿主机上授予用户 root 权限,而在客户端/服务器模型中(如 Docker 使用的),你必须打开以 root 身份运行的特权守护程序的套接字来启动容器。在那里,你将受到守护程序中实现的安全机制与宿主机操作系统中实现的安全机制的支配 —— 这是一个危险的主张。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/10/podman-more-secure-way-run-containers + +作者:[Daniel J Walsh][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/rhatdan +[b]: https://github.com/lujun9972 +[1]: https://podman.io diff --git a/published/201908/20181202 How To Customize The GNOME 3 Desktop.md b/published/201908/20181202 How To Customize The GNOME 3 Desktop.md new file mode 100644 index 0000000000..5e89f068b4 --- /dev/null +++ b/published/201908/20181202 How To Customize The GNOME 3 Desktop.md @@ -0,0 +1,285 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: subject: (How To Customize The GNOME 3 Desktop?) +[#]: via: (https://www.2daygeek.com/how-to-customize-the-gnome-3-desktop/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) +[#]: url: (https://linux.cn/article-11256-1.html) + +如何自定义 GNOME 3 桌面? +====== + +我们收到很多来自用户的电子邮件,要我们写一篇关于 GNOME 3 桌面自定义的文章,但是,我们没有时间来写这个主题。 + +在很长时间内,我一直在我的主要笔记本电脑上使用 Ubuntu 操作系统,并且,渐感无聊,我想测试一些与 Arch Linux 相关的其它的发行版。 + +我比较喜欢 Majaro,我在我的笔记本电脑中安装使用了 GNOME 3 桌面的 Manjaro 18.0 。 + +我按照我想要的自定义我的桌面。所以,我想抓住这个机会来详细撰写这篇文章,以帮助其他人。 + +这篇文章帮助其他人来轻松地自定义他们的桌面。 + +我不打算包括我所有的自定义,并且,我将强制性地添加一个对 Linux 桌面用户来说有用的必要的东西。 + +如果你觉得这篇文章中缺少一些调整,请你在评论区提到缺少的东西。对其它用户来说这是非常有用的 。 + +### 1) 如何在 GNOME 3 桌面中启动活动概述? + +活动概述将显示所有运行的应用程序,或通过单击 `Super` 键 ,或在左上角上单击“活动”按钮来启动/打开窗口。 + +它允许你来启动一个新的应用程序、切换窗口,和在工作空间之间移动窗口。 + +你可以通过选择如下任一操作简单地退出活动概述,如选择一个窗口、应用程序或工作区间,或通过按 `Super` 键或 `Esc` 键。 + +![][2] + +*活动概述屏幕截图* + +### 2) 如何在 GNOME 3 桌面中重新调整窗口大小? + +通过下面的组合键来将启动的窗口最大化、取消最大化,并吸附到屏幕的一侧(左侧或右侧)。 + + * `Super Key+下箭头`:来非最大化窗口。 + * `Super Key+上箭头`:来最大化窗口。 + * `Super Key+右箭头`:来在填充半个屏幕的右侧窗口。 + * `Super Key+作箭头`:来在填充半个屏幕的左侧窗口。 + + +![][3] + +*使用 `Super Key+下箭头` 来取消最大化窗口。* + +![][4] + +*使用 `Super Key+上箭头` 来最大化窗口。* + + +![][5] + +*使用 `Super Key+右箭头` 来在填充半个屏幕的右侧窗口。* + +![][6] + +*使用 `Super Key+左箭头` 来在填充半个屏幕的左侧窗口。* + +这个功能将帮助你可以一次查看两个应用程序,又名,拆分屏幕。 + +![][7] + +### 3) 如何在 GNOME 3 桌面中显示应用程序? + +在 Dash 中,单击“显示应用程序网格”按钮来显示在你的系统上的所有已安装的应用程序。 + +![][8] + +### 4) 如何在 GNOME 3 桌面中的 Dash 中添加应用程序? + +为加速你的日常活动,你可能想要把频繁使用的应用程序添加到 Dash 中,或拖拽应用程序启动器到 Dash 中。 + +它将允许你直接启动你的收藏夹中的应用程序,而不用先去搜索应用程序。为做到这样,在应用程序上简单地右击,并使用选项“添加到收藏夹”。 + +![][9] + +为从 Dash 中移除一个应用程序启动器(收藏的程序),要么从 Dash 中拖拽应用程序到网格按钮,或者在应用程序上简单地右击,并使用选项“从收藏夹中移除”。 + +![][10] + +### 5) 如何在 GNOME 3 桌面中的工作区间之间切换? + +工作区间允许你将窗口组合在一起。它将帮助你恰当地分隔你的工作。如果你正在做多项工作,并且你想对每项工作和相关的事物进行单独地分组,那么,它将是非常便利的,对你来说是一个非常方便和完美的选项。 + +你可以用两种方法切换工作区间,打开活动概述,并从右手边选择一个工作区间,或者使用下面的组合键。 + + * 使用 `Ctrl+Alt+Up` 切换到上一个工作区间。 + * 使用 `Ctrl+Alt+Down` 切换到下一个工作区间。 + +![][11] + +### 6) 如何在 GNOME 3 桌面中的应用程序之间切换 (应用程序切换器) ? + +使用 `Alt+Tab` 或 `Super+Tab` 来在应用程序之间切换。为启动应用程序切换器,使用 `Alt+Tab` 或 `Super+Tab` 。 + +在启动后,只需要按住 `Alt` 或 `Super` 键,按 `Tab` 键来从左到右的依次移动接下来的应用程序。 + +### 7) 如何在 GNOME 3 桌面中添加用户姓名到顶部面板? + +如果你想添加你的用户姓名到顶部面板,那么安装下面的[添加用户姓名到顶部面板][12] GNOME 扩展。 + +![][13] + +### 8) 如何在 GNOME 3 桌面中添加微软 Bing 的桌面背景? + +安装下面的 [Bing 桌面背景更换器][14] GNOME shell 扩展,来每天更改你的桌面背景为微软 Bing 的桌面背景。 + +![][15] + +### 9) 如何在 GNOME 3 桌面中启用夜光? + +夜光应用程序是著名的应用程序之一,它通过在日落后把你的屏幕从蓝光调成暗黄色,来减轻眼睛疲劳。 + +它在智能手机上也可用。相同目标的其它已知应用程序是 flux 和 [redshift][16]。 + +为启用这个特色,导航到**系统设置** >> **设备** >> **显示** ,并打开夜光。 + +![][17] + +在它启用后,状态图标将被放置到顶部面板上。 + +![][18] + +### 10) 如何在 GNOME 3 桌面中显示电池百分比? + +电池百分比将向你精确地显示电池使用情况。为启用这个功能,遵循下面的步骤。 + +启动 GNOME Tweaks >> **顶部栏** >> **电池百分比** ,并打开它。 + +![][19] + +在修改后,你能够在顶部面板上看到电池百分比图标。 + +![][20] + +### 11) 如何在 GNOME 3 桌面中启用鼠标右键单击? + +在 GNOME 3 桌面环境中右键单击是默认禁用的。为启用这个特色,遵循下面的步骤。 + +启动 GNOME Tweaks >> **键盘和鼠标** >> 鼠标点击硬件仿真,并选择“区域”选项。 + +![][21] + +### 12) 如何在 GNOME 3 桌面中启用单击最小化? + +启用单击最小化功能,这将帮助我们最小化打开的窗口,而不必使用最小化选项。 + +``` +$ gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize' +``` + +### 13) 如何在 GNOME 3 桌面中自定义 Dock ? + +如果你想更改你的 Dock,类似于 Deepin 桌面或 Mac 桌面,那么使用下面的一组命令。 + +``` +$ gsettings set org.gnome.shell.extensions.dash-to-dock dock-position BOTTOM +$ gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false +$ gsettings set org.gnome.shell.extensions.dash-to-dock transparency-mode FIXED +$ gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 50 +``` + +![][22] + +### 14) 如何在 GNOME 3桌面中显示桌面? + +默认 `Super 键 + D` 快捷键不能显示你的桌面。为配置这种情况,遵循下面的步骤。 + +设置 >> **设备** >> **键盘** >> 单击在导航下的 **隐藏所有普通窗口** ,然后按 `Super 键 + D` ,最后按`设置`按钮来启用它。 + +![][23] + +### 15) 如何自定义日期和时间格式? + +GNOME 3 默认用 `Sun 04:48` 的格式来显示日期和时间。它并不清晰易懂,如果你想获得以下格式的输出:`Sun Dec 2 4:49 AM` ,遵循下面的步骤。 + +**对于日期修改:** 打开 GNOME Tweaks >> **顶部栏** ,并在时钟下启用“星期”选项。 + +![][24] + +**对于时间修改:** 设置 >> **具体情况** >> **日期和时间** ,然后,在时间格式中选择 `AM/PM` 选项。 + +![][25] + +在修改后,你能够看到与下面相同的日期和时间格式。 + +![][26] + +### 16) 如何在启动程序中永久地禁用不使用的服务? + +就我来说,我不使用 **蓝牙** & **cups(打印机服务)**。因此,在我的笔记本电脑上禁用这些服务。为在基于 Arch 的系统上禁用服务,使用 [Pacman 软件包管理器][27]。 + +对于蓝牙: + +``` +$ sudo systemctl stop bluetooth.service +$ sudo systemctl disable bluetooth.service +$ sudo systemctl mask bluetooth.service +$ systemctl status bluetooth.service +``` + +对于 cups: + +``` +$ sudo systemctl stop org.cups.cupsd.service +$ sudo systemctl disable org.cups.cupsd.service +$ sudo systemctl mask org.cups.cupsd.service +$ systemctl status org.cups.cupsd.service +``` + +最后,使用以下命令验证这些服务是否在启动程序中被禁用。如果你想再次确认这一点,你可以重新启动一次,并检查相同的东西。导航到以下链接来了解更多关于 [systemctl][28] 的用法, + +``` +$ systemctl list-unit-files --type=service | grep enabled +[email protected] enabled +dbus-org.freedesktop.ModemManager1.service enabled +dbus-org.freedesktop.NetworkManager.service enabled +dbus-org.freedesktop.nm-dispatcher.service enabled +display-manager.service enabled +gdm.service enabled +[email protected] enabled +linux-module-cleanup.service enabled +ModemManager.service enabled +NetworkManager-dispatcher.service enabled +NetworkManager-wait-online.service enabled +NetworkManager.service enabled +systemd-fsck-root.service enabled-runtime +tlp-sleep.service enabled +tlp.service enabled +``` + +### 17) 在 GNOME 3 桌面中安装图标和主题? + +有大量的图标和主题可供 GNOME 桌面使用,因此,选择吸引你的 [GTK 主题][29] 和 [图标主题][30]。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-customize-the-gnome-3-desktop/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-overview-screenshot.jpg +[3]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-unmaximize-the-window.jpg +[4]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-maximize-the-window.jpg +[5]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-fill-a-window-right-side.jpg +[6]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-fill-a-window-left-side.jpg +[7]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-split-screen.jpg +[8]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-applications.jpg +[9]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-applications-on-dash.jpg +[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-remove-applications-from-dash.jpg +[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-workspaces-screenshot.jpg +[12]: https://extensions.gnome.org/extension/1108/add-username-to-top-panel/ +[13]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-username-to-top-panel.jpg +[14]: https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/ +[15]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-microsoft-bings-wallpaper.jpg +[16]: https://www.2daygeek.com/install-redshift-reduce-prevent-protect-eye-strain-night-linux/ +[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-night-light.jpg +[18]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-night-light-1.jpg +[19]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-battery-percentage.jpg +[20]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-battery-percentage-1.jpg +[21]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-mouse-right-click.jpg +[22]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-dock-customization.jpg +[23]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-show-desktop.jpg +[24]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-date.jpg +[25]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-time.jpg +[26]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-date-time.jpg +[27]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[28]: https://www.2daygeek.com/sysvinit-vs-systemd-cheatsheet-systemctl-command-usage/ +[29]: https://www.2daygeek.com/category/gtk-theme/ +[30]: https://www.2daygeek.com/category/icon-theme/ diff --git a/published/201908/20181213 Podman and user namespaces- A marriage made in heaven.md b/published/201908/20181213 Podman and user namespaces- A marriage made in heaven.md new file mode 100644 index 0000000000..ebf5c606a5 --- /dev/null +++ b/published/201908/20181213 Podman and user namespaces- A marriage made in heaven.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11268-1.html) +[#]: subject: (Podman and user namespaces: A marriage made in heaven) +[#]: via: (https://opensource.com/article/18/12/podman-and-user-namespaces) +[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) + +Podman 和用户名字空间:天作之合 +====== + +> 了解如何使用 Podman 在单独的用户空间运行容器。 + +![](https://img.linux.net.cn/data/attachment/album/201908/25/220204khh9psjo1phllkok.jpg) + +[Podman][1] 是 [libpod][2] 库的一部分,使用户能够管理 pod、容器和容器镜像。在我的上一篇文章中,我写过将 [Podman 作为一种更安全的运行容器的方式][3]。在这里,我将解释如何使用 Podman 在单独的用户命名空间中运行容器。 + +作为分离容器的一个很棒的功能,我一直在思考[用户命名空间][4]user namespace,它主要是由 Red Hat 的 Eric Biederman 开发的。用户命名空间允许你指定用于运行容器的用户标识符(UID)和组标识符(GID)映射。这意味着你可以在容器内以 UID 0 运行,在容器外以 UID 100000 运行。如果容器进程逃逸出了容器,内核会将它们视为以 UID 100000 运行。不仅如此,任何未映射到用户命名空间的 UID 所拥有的文件对象都将被视为 `nobody` 所拥有(UID 是 `65534`, 由 `kernel.overflowuid` 指定),并且不允许容器进程访问,除非该对象可由“其他人”访问(即世界可读/可写)。 + +如果你拥有一个权限为 [660][5] 的属主为“真实” `root` 的文件,而当用户命名空间中的容器进程尝试读取它时,会阻止它们访问它,并且会将该文件视为 `nobody` 所拥有。 + +### 示例 + +以下是它是如何工作的。首先,我在 `root` 拥有的系统中创建一个文件。 + +``` +$ sudo bash -c "echo Test > /tmp/test" +$ sudo chmod 600 /tmp/test +$ sudo ls -l /tmp/test +-rw-------. 1 root root 5 Dec 17 16:40 /tmp/test +``` + +接下来,我将该文件卷挂载到一个使用用户命名空间映射 `0:100000:5000` 运行的容器中。 + +``` +$ sudo podman run -ti -v /tmp/test:/tmp/test:Z --uidmap 0:100000:5000 fedora sh +# id +uid=0(root) gid=0(root) groups=0(root) +# ls -l /tmp/test +-rw-rw----. 1 nobody nobody 8 Nov 30 12:40 /tmp/test +# cat /tmp/test +cat: /tmp/test: Permission denied +``` + +上面的 `--uidmap` 设置告诉 Podman 在容器内映射一系列的 5000 个 UID,从容器外的 UID 100000 开始的范围(100000-104999)映射到容器内 UID 0 开始的范围(0-4999)。在容器内部,如果我的进程以 UID 1 运行,则它在主机上为 100001。 + +由于实际的 `UID=0` 未映射到容器中,因此 `root` 拥有的任何文件都将被视为 `nobody` 所拥有。即使容器内的进程具有 `CAP_DAC_OVERRIDE` 能力,也无法覆盖此种保护。`DAC_OVERRIDE` 能力使得 root 的进程能够读/写系统上的任何文件,即使进程不是 `root` 用户拥有的,也不是全局可读或可写的。 + +用户命名空间的功能与宿主机上的功能不同。它们是命名空间的功能。这意味着我的容器的 root 只在容器内具有功能 —— 实际上只有该范围内的 UID 映射到内用户命名空间。如果容器进程逃逸出了容器,则它将没有任何非映射到用户命名空间的 UID 之外的功能,这包括 `UID=0`。即使进程可能以某种方式进入另一个容器,如果容器使用不同范围的 UID,它们也不具备这些功能。 + +请注意,SELinux 和其他技术还限制了容器进程破开容器时会发生的情况。 + +### 使用 podman top 来显示用户名字空间 + +我们在 `podman top` 中添加了一些功能,允许你检查容器内运行的进程的用户名,并标识它们在宿主机上的真实 UID。 + +让我们首先使用我们的 UID 映射运行一个 `sleep` 容器。 + +``` +$ sudo podman run --uidmap 0:100000:5000 -d fedora sleep 1000 +``` + +现在运行 `podman top`: + +``` +$ sudo podman top --latest user huser +USER   HUSER +root   100000 + +$ ps -ef | grep sleep +100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +``` + +注意 `podman top` 报告用户进程在容器内以 `root` 身份运行,但在宿主机(`HUSER`)上以 UID 100000 运行。此外,`ps` 命令确认 `sleep` 过程以 UID 100000 运行。 + +现在让我们运行第二个容器,但这次我们将选择一个单独的 UID 映射,从 200000 开始。 + +``` +$ sudo podman run --uidmap 0:200000:5000 -d fedora sleep 1000 +$ sudo podman top --latest user huser +USER   HUSER +root   200000 + +$ ps -ef | grep sleep +100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +200000   23644 23632  1 08:08 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 +``` + +请注意,`podman top` 报告第二个容器在容器内以 `root` 身份运行,但在宿主机上是 UID=200000。 + +另请参阅 `ps` 命令,它显示两个 `sleep` 进程都在运行:一个为 100000,另一个为 200000。 + +这意味着在单独的用户命名空间内运行容器可以在进程之间进行传统的 UID 分离,而这从一开始就是 Linux/Unix 的标准安全工具。 + +### 用户名字空间的问题 + +几年来,我一直主张用户命名空间应该作为每个人应该有的安全工具,但几乎没有人使用过。原因是没有任何文件系统支持,也没有一个移动文件系统shifting file system。 + +在容器中,你希望在许多容器之间共享**基本**镜像。上面的每个示例中使用了 Fedora 基本镜像。Fedora 镜像中的大多数文件都由真实的 `UID=0` 拥有。如果我在此镜像上使用用户名称空间 `0:100000:5000` 运行容器,默认情况下它会将所有这些文件视为 `nobody` 所拥有,因此我们需要移动所有这些 UID 以匹配用户名称空间。多年来,我想要一个挂载选项来告诉内核重新映射这些文件 UID 以匹配用户命名空间。上游内核存储开发人员还在继续研究,在此功能上已经取得一些进展,但这是一个难题。 + +由于由 Nalin Dahyabhai 领导的团队开发的自动 [chown][6] 内置于[容器/存储][7]中,Podman 可以在同一镜像上使用不同的用户名称空间。当 Podman 使用容器/存储,并且 Podman 在新的用户命名空间中首次使用一个容器镜像时,容器/存储会 “chown”(如,更改所有权)镜像中的所有文件到用户命名空间中映射的 UID 并创建一个新镜像。可以把它想象成一个 `fedora:0:100000:5000` 镜像。 + +当 Podman 在具有相同 UID 映射的镜像上运行另一个容器时,它使用“预先 chown”的镜像。当我在`0:200000:5000` 上运行第二个容器时,容器/存储会创建第二个镜像,我们称之为 `fedora:0:200000:5000`。 + +请注意,如果你正在执行 `podman build` 或 `podman commit` 并将新创建的镜像推送到容器注册库,Podman 将使用容器/存储来反转该移动,并将推送所有文件属主变回真实 UID=0 的镜像。 + +这可能会导致在新的 UID 映射中创建容器时出现真正的减速,因为 `chown` 可能会很慢,具体取决于镜像中的文件数。此外,在普通的 [OverlayFS][8] 上,镜像中的每个文件都会被复制。普通的 Fedora 镜像最多可能需要 30 秒才能完成 `chown` 并启动容器。 + +幸运的是,Red Hat 内核存储团队(主要是 Vivek Goyal 和 Miklos Szeredi)在内核 4.19 中为 OverlayFS 添加了一项新功能。该功能称为“仅复制元数据”。如果使用 `metacopy=on` 选项来挂载层叠文件系统,则在更改文件属性时,它不会复制较低层的内容;内核会创建新的 inode,其中包含引用指向较低级别数据的属性。如果内容发生变化,它仍会复制内容。如果你想试用它,可以在 Red Hat Enterprise Linux 8 Beta 中使用此功能。 + +这意味着容器 `chown` 可能在两秒钟内发生,并且你不会倍增每个容器的存储空间。 + +这使得像 Podman 这样的工具在不同的用户命名空间中运行容器是可行的,大大提高了系统的安全性。 + +### 前瞻 + +我想向 Podman 添加一个新选项,比如 `--userns=auto`,它会为你运行的每个容器自动选择一个唯一的用户命名空间。这类似于 SELinux 与单独的多类别安全(MCS)标签一起使用的方式。如果设置环境变量 `PODMAN_USERNS=auto`,则甚至不需要设置该选项。 + +Podman 最终允许用户在不同的用户名称空间中运行容器。像 [Buildah][9] 和 [CRI-O][10] 这样的工具也可以利用用户命名空间。但是,对于 CRI-O,Kubernetes 需要了解哪个用户命名空间将运行容器引擎,上游正在开发这个功能。 + +在我的下一篇文章中,我将解释如何在用户命名空间中将 Podman 作为非 root 用户运行。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/podman-and-user-namespaces + +作者:[Daniel J Walsh][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/rhatdan +[b]: https://github.com/lujun9972 +[1]: https://podman.io/ +[2]: https://github.com/containers/libpod +[3]: https://linux.cn/article-11261-1.html +[4]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html +[5]: https://chmodcommand.com/chmod-660/ +[6]: https://en.wikipedia.org/wiki/Chown +[7]: https://github.com/containers/storage +[8]: https://en.wikipedia.org/wiki/OverlayFS +[9]: https://buildah.io/ +[10]: http://cri-o.io/ diff --git a/published/201908/20181220 Getting started with Prometheus.md b/published/201908/20181220 Getting started with Prometheus.md new file mode 100644 index 0000000000..47a9160dab --- /dev/null +++ b/published/201908/20181220 Getting started with Prometheus.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11234-1.html) +[#]: subject: (Getting started with Prometheus) +[#]: via: (https://opensource.com/article/18/12/introduction-prometheus) +[#]: author: (Michael Zamot https://opensource.com/users/mzamot) + +Prometheus 入门 +====== + +> 学习安装 Prometheus 监控和警报系统并编写它的查询。 + +![](https://img.linux.net.cn/data/attachment/album/201908/16/113724zqe12khkdye2mesy.jpg) + +[Prometheus][1] 是一个开源的监控和警报系统,它直接从目标主机上运行的代理程序中抓取指标,并将收集的样本集中存储在其服务器上。也可以使用像 `collectd_exporter` 这样的插件推送指标,尽管这不是 Promethius 的默认行为,但在主机位于防火墙后面或位于安全策略禁止打开端口的某些环境中它可能很有用。 + +Prometheus 是[云原生计算基金会(CNCF)][2]的一个项目。它使用联合模型federation model进行扩展,该模型使得一个 Prometheus 服务器能够抓取另一个 Prometheus 服务器的数据。这允许创建分层拓扑,其中中央系统或更高级别的 Prometheus 服务器可以抓取已从下级实例收集的聚合数据。 + +除 Prometheus 服务器外,其最常见的组件是[警报管理器][3]及其输出器。 + +警报规则可以在 Prometheus 中创建,并配置为向警报管理器发送自定义警报。然后,警报管理器处理和管理这些警报,包括通过电子邮件或第三方服务(如 [PagerDuty][4])等不同机制发送通知。 + +Prometheus 的输出器可以是库、进程、设备或任何其他能将 Prometheus 抓取的指标公开出去的东西。 这些指标可在端点 `/metrics` 中获得,它允许 Prometheus 无需代理直接抓取它们。本文中的教程使用 `node_exporter` 来公开目标主机的硬件和操作系统指标。输出器的输出是明文的、高度可读的,这是 Prometheus 的优势之一。 + +此外,你可以将 Prometheus 作为后端,配置 [Grafana][5] 来提供数据可视化和仪表板功能。 + +### 理解 Prometheus 的配置文件 + +抓取 `/metrics` 的间隔秒数控制了时间序列数据库的粒度。这在配置文件中定义为 `scrape_interval` 参数,默认情况下设置为 60 秒。 + +在 `scrape_configs` 部分中为每个抓取作业设置了目标。每个作业都有自己的名称和一组标签,可以帮助你过滤、分类并更轻松地识别目标。一项作业可以有很多目标。 + +### 安装 Prometheus + +在本教程中,为简单起见,我们将使用 Docker 安装 Prometheus 服务器和 `node_exporter`。Docker 应该已经在你的系统上正确安装和配置。对于更深入、自动化的方法,我推荐 Steve Ovens 的文章《[如何使用 Ansible 与 Prometheus 建立系统监控][6]》。 + +在开始之前,在工作目录中创建 Prometheus 配置文件 `prometheus.yml`,如下所示: + +``` +global: + scrape_interval: 15s + evaluation_interval: 15s + +scrape_configs: + - job_name: 'prometheus' + + static_configs: + - targets: ['localhost:9090'] + + - job_name: 'webservers' + + static_configs: + - targets: [':9100'] +``` + +通过运行以下命令用 Docker 启动 Prometheus: + +``` +$ sudo docker run -d -p 9090:9090 -v +/path/to/prometheus.yml:/etc/prometheus/prometheus.yml +prom/prometheus +``` + +默认情况下,Prometheus 服务器将使用端口 9090。如果此端口已在使用,你可以通过在上一个命令的后面添加参数 `--web.listen-address=":"` 来更改它。 + +在要监视的计算机中,使用以下命令下载并运行 `node_exporter` 容器: + +``` +$ sudo docker run -d -v "/proc:/host/proc" -v "/sys:/host/sys" -v +"/:/rootfs" --net="host" prom/node-exporter --path.procfs +/host/proc --path.sysfs /host/sys --collector.filesystem.ignored- +mount-points "^/(sys|proc|dev|host|etc)($|/)" +``` + +出于本文练习的目的,你可以在同一台机器上安装 `node_exporter` 和 Prometheus。请注意,生产环境中在 Docker 下运行 `node_exporter` 是不明智的 —— 这仅用于测试目的。 + +要验证 `node_exporter` 是否正在运行,请打开浏览器并导航到 `http://:9100/metrics`,这将显示收集到的所有指标;也即是 Prometheus 将要抓取的相同指标。 + +![](https://opensource.com/sites/default/files/uploads/check-node_exporter.png) + +要确认 Prometheus 服务器安装成功,打开浏览器并导航至:。 + +你应该看到了 Prometheus 的界面。单击“Status”,然后单击“Targets”。在 “Status” 下,你应该看到你的机器被列为 “UP”。 + +![](https://opensource.com/sites/default/files/uploads/targets-up.png) + +### 使用 Prometheus 查询 + +现在是时候熟悉一下 [PromQL][7](Prometheus 的查询语法)及其图形化 Web 界面了。转到 Prometheus 服务器上的 `http://localhost:9090/graph`。你将看到一个查询编辑器和两个选项卡:“Graph” 和 “Console”。 + +Prometheus 将所有数据存储为时间序列,使用指标名称标识每个数据。例如,指标 `node_filesystem_avail_bytes` 显示可用的文件系统空间。指标的名称可以在表达式框中使用,以选择具有此名称的所有时间序列并生成即时向量。如果需要,可以使用选择器和标签(一组键值对)过滤这些时间序列,例如: + +``` +node_filesystem_avail_bytes{fstype="ext4"} +``` + +过滤时,你可以匹配“完全相等”(`=`)、“不等于”(`!=`),“正则匹配”(`=~`)和“正则排除匹配”(`!~`)。以下示例说明了这一点: + +要过滤 `node_filesystem_avail_bytes` 以显示 ext4 和 XFS 文件系统: + +``` +node_filesystem_avail_bytes{fstype=~"ext4|xfs"} +``` + +要排除匹配: + +``` +node_filesystem_avail_bytes{fstype!="xfs"} +``` + +你还可以使用方括号得到从当前时间往回的一系列样本。你可以使用 `s` 表示秒,`m` 表示分钟,`h` 表示小时,`d` 表示天,`w` 表示周,而 `y` 表示年。使用时间范围时,返回的向量将是范围向量。 + +例如,以下命令生成从五分钟前到现在的样本: + +``` +node_memory_MemAvailable_bytes[5m] +``` + +Prometheus 还包括了高级查询的功能,例如: + +``` +100 * (1 - avg by(instance)(irate(node_cpu_seconds_total{job='webservers',mode='idle'}[5m]))) +``` + +请注意标签如何用于过滤作业和模式。指标 `node_cpu_seconds_total` 返回一个计数器,`irate()`函数根据范围间隔的最后两个数据点计算每秒的变化率(意味着该范围可以小于五分钟)。要计算 CPU 总体使用率,可以使用 `node_cpu_seconds_total` 指标的空闲(`idle`)模式。处理器的空闲比例与繁忙比例相反,因此从 1 中减去 `irate` 值。要使其为百分比,请将其乘以 100。 + +![](https://opensource.com/sites/default/files/uploads/cpu-usage.png) + +### 了解更多 + +Prometheus 是一个功能强大、可扩展、轻量级、易于使用和部署的监视工具,对于每个系统管理员和开发人员来说都是必不可少的。出于这些原因和其他原因,许多公司正在将 Prometheus 作为其基础设施的一部分。 + +要了解有关 Prometheus 及其功能的更多信息,我建议使用以下资源: + ++ 关于 [PromQL][8] ++ 什么是 [node_exporters 集合][9] ++ [Prometheus 函数][10] ++ [4 个开源监控工具] [11] ++ [现已推出:DevOps 监控工具的开源指南] [12] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/introduction-prometheus + +作者:[Michael Zamot][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/mzamot +[b]: https://github.com/lujun9972 +[1]: https://prometheus.io/ +[2]: https://www.cncf.io/ +[3]: https://prometheus.io/docs/alerting/alertmanager/ +[4]: https://en.wikipedia.org/wiki/PagerDuty +[5]: https://grafana.com/ +[6]: https://opensource.com/article/18/3/how-use-ansible-set-system-monitoring-prometheus +[7]: https://prometheus.io/docs/prometheus/latest/querying/basics/ +[8]: https://prometheus.io/docs/prometheus/latest/querying/basics/ +[9]: https://github.com/prometheus/node_exporter#collectors +[10]: https://prometheus.io/docs/prometheus/latest/querying/functions/ +[11]: https://opensource.com/article/18/8/open-source-monitoring-tools +[12]: https://opensource.com/article/18/8/now-available-open-source-guide-devops-monitoring-tools diff --git a/published/201908/20181222 How to detect automatically generated emails.md b/published/201908/20181222 How to detect automatically generated emails.md new file mode 100644 index 0000000000..1ce4775088 --- /dev/null +++ b/published/201908/20181222 How to detect automatically generated emails.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11200-1.html) +[#]: subject: (How to detect automatically generated emails) +[#]: via: (https://arp242.net/weblog/autoreply.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +如何检测自动生成的电子邮件 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/08/003503fw0w0pzx2ue6a6a6.jpg) + +当你用电子邮件系统发送自动回复时,你需要注意不要向自动生成的电子邮件发送回复。最好的情况下,你将获得无用的投递失败消息。更可能的是,你会得到一个无限的电子邮件循环和一个混乱的世界。 + +事实证明,可靠地检测自动生成的电子邮件并不总是那么容易。以下是基于为此编写的检测器并使用它扫描大约 100,000 封电子邮件(大量的个人存档和公司存档)的观察结果。 + +### Auto-submitted 信头 + +由 [RFC 3834][1] 定义。 + +这是表示你的邮件是自动回复的“官方”标准。如果存在 `Auto-Submitted` 信头,并且其值不是 `no`,你应该**不**发送回复。 + +### X-Auto-Response-Suppress 信头 + +[由微软][2]定义。 + +此信头由微软 Exchange、Outlook 和其他一些产品使用。许多新闻订阅等都设定了这个。如果 `X-Auto-Response-Suppress` 包含 `DR`(“抑制投递报告”)、`AutoReply`(“禁止 OOF 通知以外的自动回复消息”)或 `All`,你应该**不**发送回复。 + +### List-Id 和 List-Unsubscribe 信头 + +由 [RFC 2919][3] 定义。 + +你通常不希望给邮件列表或新闻订阅发送自动回复。几乎所有的邮件列表和大多数新闻订阅都至少设置了其中一个信头。如果存在这些信头中的任何一个,你应该**不**发送回复。这个信头的值不重要。 + +### Feedback-ID 信头 + +[由谷歌][4]定义。 + +Gmail 使用此信头识别邮件是否是新闻订阅,并使用它为这些新闻订阅的所有者生成统计信息或报告。如果此信头存在,你应该**不**发送回复。这个信头的值不重要。 + +### 非标准方式 + +上述方法定义明确(即使有些是非标准的)。不幸的是,有些电子邮件系统不使用它们中的任何一个 :-( 这里有一些额外的措施。 + +#### Precedence 信头 + +在 [RFC 2076][5] 中没有真正定义,不鼓励使用它(但通常会遇到此信头)。 + +请注意,不建议检查是否存在此信头,因为某些邮件使用 `normal` 和其他一些(少见的)值(尽管这不常见)。 + +我的建议是如果其值不区分大小写地匹配 `bulk`、`auto_reply` 或 `list`,则**不**发送回复。 + +#### 其他不常见的信头 + +这是我遇到的另外的一些(不常见的)信头。如果设置了其中一个,我建议**不**发送自动回复。大多数邮件也设置了上述信头之一,但有些没有(这并不常见)。 + +* `X-MSFBL`:无法真正找到定义(Microsoft 信头?),但我只有自动生成的邮件带有此信头。 +* `X-Loop`:在任何地方都没有真正定义过,有点罕见,但有时有。它通常设置为不应该收到电子邮件的地址,但也会遇到 `X-Loop: yes`。 +* `X-Autoreply`:相当罕见,并且似乎总是具有 `yes` 的值。 + +#### Email 地址 + +检查 `From` 或 `Reply-To` 信头是否包含 `noreply`、`no-reply` 或 `no_reply`(正则表达式:`^no.?reply@`)。 + +#### 只有 HTML 部分 + +如果电子邮件只有 HTML 部分,而没有文本部分,则表明这是一个自动生成的邮件或新闻订阅。几乎所有邮件客户端都设置了文本部分。 + +#### 投递失败消息 + +许多传递失败消息并不能真正表明它们是失败的。一些检查方法: + +* `From` 包含 `mailer-daemon` 或 `Mail Delivery Subsystem` + +#### 特定的邮件库特征 + +许多邮件类库留下了某种痕迹,大多数常规邮件客户端使用自己的数据覆盖它。检查这个似乎工作得相当可靠。 + +* `X-Mailer: Microsoft CDO for Windows 2000`:由某些微软软件设置;我只能在自动生成的邮件中找到它。是的,在 2015 年它仍然在使用。 +* `Message-ID` 信头包含 `.JavaMail.`:我发现了一些(5 个 50k 大小的)常规消息,但不是很多;绝大多数(数千封)邮件是新闻订阅、订单确认等。 +* `^X-Mailer` 以 `PHP` 开头。这应该会同时看到 `X-Mailer: PHP/5.5.0` 和 `X-Mailer: PHPmailer XXX XXX`。与 “JavaMail” 相同。 +* 出现了 `X-Library`;似乎只有 [Indy][6] 设定了这个。 +* `X-Mailer` 以 `wdcollect` 开头。由一些 Plesk 邮件设置。 +* `X-Mailer` 以 `MIME-tools` 开头。 + +### 最后的预防措施:限制回复的数量 + +即使遵循上述所有建议,你仍可能会遇到一个避开所有这些检测的电子邮件程序。这可能非常危险,因为电子邮件系统只是“如果有电子邮件那么发送”,就有可能导致无限的电子邮件循环。 + +出于这个原因,我建议你记录你自动发送的电子邮件,并将此速率限制为在几分钟内最多几封电子邮件。这将打破循环链条。 + +我们使用每五分钟一封电子邮件的设置,但没这么严格的设置可能也会运作良好。 + +### 你需要为自动回复设置什么信头 + +具体细节取决于你发送的邮件类型。这是我们用于自动回复邮件的内容: + +``` +Auto-Submitted: auto-replied +X-Auto-Response-Suppress: All +Precedence: auto_reply +``` + +### 反馈 + +你可以发送电子邮件至 [martin@arp242.net][7] 或 [创建 GitHub 议题][8]以提交反馈、问题等。 + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/autoreply.html + +作者:[Martin Tournoij][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://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: http://tools.ietf.org/html/rfc3834 +[2]: https://msdn.microsoft.com/en-us/library/ee219609(v=EXCHG.80).aspx +[3]: https://tools.ietf.org/html/rfc2919) +[4]: https://support.google.com/mail/answer/6254652?hl=en +[5]: http://www.faqs.org/rfcs/rfc2076.html +[6]: http://www.indyproject.org/index.en.aspx +[7]: mailto:martin@arp242.net +[8]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/published/201908/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md b/published/201908/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..8d83afa0dd --- /dev/null +++ b/published/201908/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11282-1.html) +[#]: subject: (How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-virtualbox-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装 VirtualBox +====== + +> 本新手教程解释了在 Ubuntu 和其他基于 Debian 的 Linux 发行版上安装 VirtualBox 的各种方法。 + +![](https://img.linux.net.cn/data/attachment/album/201908/30/072113uzitwinnt9betilt.jpg) + +Oracle 公司的自由开源产品 [VirtualBox][1] 是一款出色的虚拟化工具,专门用于桌面操作系统。与另一款虚拟化工具 [Linux 上的 VMWare Workstation][2] 相比起来,我更喜欢它。 + +你可以使用 VirtualBox 等虚拟化软件在虚拟机中安装和使用其他操作系统。 + +例如,你可以[在 Windows 上的 VirtualBox 中安装 Linux][3]。同样地,你也可以[用 VirtualBox 在 Linux 中安装 Windows][4]。 + +你也可以用 VirtualBox 在你当前的 Linux 系统中安装别的 Linux 发行版。事实上,这就是我用它的原因。如果我听说了一个不错的 Linux 发行版,我会在虚拟机上测试它,而不是安装在真实的系统上。当你想要在安装之前尝试一下别的发行版时,用虚拟机会很方便。 + +![Linux installed inside Linux using VirtualBox][5] + +*安装在 Ubuntu 18.04 内的 Ubuntu 18.10* + +在本新手教程中,我将向你展示在 Ubuntu 和其他基于 Debian 的 Linux 发行版上安装 VirtualBox 的各种方法。 + +### 在 Ubuntu 和基于 Debian 的 Linux 发行版上安装 VirtualBox + +这里提出的安装方法也适用于其他基于 Debian 和 Ubuntu 的 Linux 发行版,如 Linux Mint、elementar OS 等。 + +#### 方法 1:从 Ubuntu 仓库安装 VirtualBox + +**优点**:安装简便 + +**缺点**:较旧版本 + +在 Ubuntu 上下载 VirtualBox 最简单的方法可能是从软件中心查找并下载。 + +![VirtualBox in Ubuntu Software Center][6] + +*VirtualBox 在 Ubuntu 软件中心提供* + +你也可以使用这条命令从命令行安装: + +``` +sudo apt install virtualbox +``` + +然而,如果[在安装前检查软件包版本][7],你会看到 Ubuntu 仓库提供的 VirtualBox 版本已经很老了。 + +举个例子,在写下本教程时 VirtualBox 的最新版本是 6.0,但是在软件中心提供的是 5.2。这意味着你无法获得[最新版 VirtualBox ][8]中引入的新功能。 + +#### 方法 2:使用 Oracle 网站上的 Deb 文件安装 VirtualBox + +**优点**:安装简便,最新版本 + +**缺点**:不能更新 + +如果你想要在 Ubuntu 上使用 VirtualBox 的最新版本,最简单的方法就是[使用 Deb 文件][9]。 + +Oracle 为 VirtiualBox 版本提供了开箱即用的二进制文件。如果查看其下载页面,你将看到为 Ubuntu 和其他发行版下载 deb 安装程序的选项。 + +![VirtualBox Linux Download][10] + +你只需要下载 deb 文件并双击它即可安装。就是这么简单。 + +- [下载 virtualbox for Ubuntu](https://www.virtualbox.org/wiki/Linux_Downloads) + +然而,这种方法的问题在于你不能自动更新到最新的 VirtualBox 版本。唯一的办法是移除现有版本,下载最新版本并再次安装。不太方便,是吧? + +#### 方法 3:用 Oracle 的仓库安装 VirtualBox + +**优点**:自动更新 + +**缺点**:安装略微复杂 + +现在介绍的是命令行安装方法,它看起来可能比较复杂,但与前两种方法相比,它更具有优势。你将获得 VirtualBox 的最新版本,并且未来它还将自动更新到更新的版本。我想那就是你想要的。 + +要通过命令行安装 VirtualBox,请在你的仓库列表中添加 Oracle VirtualBox 的仓库。添加 GPG 密钥以便你的系统信任此仓库。现在,当你安装 VirtualBox 时,它会从 Oracle 仓库而不是 Ubuntu 仓库安装。如果发布了新版本,本地 VirtualBox 将跟随一起更新。让我们看看怎么做到这一点: + +首先,添加仓库的密钥。你可以通过这一条命令下载和添加密钥: + +``` +wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - +``` + +> Mint 用户请注意: + +> 下一步只适用于 Ubuntu。如果你使用的是 Linux Mint 或其他基于 Ubuntu 的发行版,请将命令行中的 `$(lsb_release -cs)` 替换成你当前版本所基于的 Ubuntu 版本。例如,Linux Mint 19 系列用户应该使用 bionic,Mint 18 系列用户应该使用 xenial,像这样: + +> ``` +> sudo add-apt-repository “deb [arch=amd64] **bionic** contrib“` +> ``` + +现在用以下命令来将 Oracle VirtualBox 仓库添加到仓库列表中: + +``` +sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" +``` + +如果你有读过我的文章[检查 Ubuntu 版本][11],你大概知道 `lsb_release -cs` 将打印你的 Ubuntu 系统的代号。 + +**注**:如果你看到 “[add-apt-repository command not found][12]” 错误,你需要下载 `software-properties-common` 包。 + +现在你已经添加了正确的仓库,请通过此仓库刷新可用包列表并安装 VirtualBox: + +``` +sudo apt update && sudo apt install virtualbox-6.0 +``` + +**提示**:一个好方法是输入 `sudo apt install virtualbox-` 并点击 `tab` 键以查看可用于安装的各种 VirtualBox 版本,然后通过补全命令来选择其中一个版本。 + +![Install VirtualBox via terminal][13] + +### 如何从 Ubuntu 中删除 VirtualBox + +现在你已经学会了如何安装 VirtualBox,我还想和你提一下删除它的步骤。 + +如果你是从软件中心安装的,那么删除它最简单的方法是从软件中心下手。你只需要在[已安装的应用程序列表][14]中找到它,然后单击“删除”按钮。 + +另一种方式是使用命令行: + +``` +sudo apt remove virtualbox virtualbox-* +``` + +请注意,这不会删除你用 VirtualBox 安装的操作系统关联的虚拟机和文件。这并不是一件坏事,因为你可能希望以后或在其他系统中使用它们是安全的。 + +### 最后… + +我希望你能在以上方法中选择一种安装 VirtualBox。我还将在另一篇文章中写到如何有效地使用 VirtualBox。目前,如果你有点子、建议或任何问题,请随时在下面发表评论。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-virtualbox-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[beamrolling](https://github.com/beamrolling) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.virtualbox.org +[2]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[3]: https://itsfoss.com/install-linux-in-virtualbox/ +[4]: https://itsfoss.com/install-windows-10-virtualbox-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/linux-inside-linux-virtualbox.png?resize=800%2C450&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-ubuntu-software-center.jpg?ssl=1 +[7]: https://itsfoss.com/know-program-version-before-install-ubuntu/ +[8]: https://itsfoss.com/oracle-virtualbox-release/ +[9]: https://itsfoss.com/install-deb-files-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-download.jpg?resize=800%2C433&ssl=1 +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://itsfoss.com/add-apt-repository-command-not-found/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-virtualbox-ubuntu-terminal.png?resize=800%2C165&ssl=1 +[14]: https://itsfoss.com/list-installed-packages-ubuntu/ diff --git a/published/201908/20190304 How to Install MongoDB on Ubuntu.md b/published/201908/20190304 How to Install MongoDB on Ubuntu.md new file mode 100644 index 0000000000..1ba0edae1f --- /dev/null +++ b/published/201908/20190304 How to Install MongoDB on Ubuntu.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11175-1.html) +[#]: subject: (How to Install MongoDB on Ubuntu) +[#]: via: (https://itsfoss.com/install-mongodb-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 上安装 MongoDB +====== + +> 本教程介绍了在 Ubuntu 和基于 Ubuntu 的 Linux 发行版上安装 MongoDB 的两种方法。 + +[MongoDB][1] 是一个越来越流行的自由开源的 NoSQL 数据库,它将数据存储在类似 JSON 的灵活文档集中,这与 SQL 数据库中常见的表格形式形成对比。 + +你很可能发现在现代 Web 应用中使用 MongoDB。它的文档模型使得使用各种编程语言能非常直观地访问和处理它。 + +![mongodb Ubuntu][2] + +在本文中,我将介绍两种在 Ubuntu 上安装 MongoDB 的方法。 + +### 在基于 Ubuntu 的发行版上安装 MongoDB + +1. 使用 Ubuntu 仓库安装 MongoDB。简单但不是最新版本的 MongoDB +2. 使用其官方仓库安装 MongoDB。稍微复杂,但你能得到最新版本的 MongoDB。 + +第一种安装方法更容易,但如果你计划使用官方支持的最新版本,那么我建议使用第二种方法。 + +有些人可能更喜欢使用 snap 包。Ubuntu 软件中心提供了 snap,但我不建议使用它们,因为他们现在已经过期了,因此我这里不会提到。 + +### 方法 1:从 Ubuntu 仓库安装 MongoDB + +这是在系统中安装 MongoDB 的简便方法,你只需输入一个命令即可。 + +#### 安装 MongoDB + +首先,确保你的包是最新的。打开终端并输入: + +``` +sudo apt update && sudo apt upgrade -y +``` + +继续安装 MongoDB: + +``` +sudo apt install mongodb +``` + +这就完成了!MongoDB 现在安装到你的计算机上了。 + +MongoDB 服务应该在安装时自动启动,但要检查服务状态: + +``` +sudo systemctl status mongodb +``` + +![Check if the MongoDB service is running.][3] + +你可以看到该服务是**活动**的。 + +#### 运行 MongoDB + +MongoDB 目前是一个 systemd 服务,因此我们使用 `systemctl` 来检查和修改它的状态,使用以下命令: + +``` +sudo systemctl status mongodb +sudo systemctl stop mongodb +sudo systemctl start mongodb +sudo systemctl restart mongodb +``` + +你也可以修改 MongoDB 是否自动随系统启动(默认:启用): + +``` +sudo systemctl disable mongodb +sudo systemctl enable mongodb +``` + +要开始使用(创建和编辑)数据库,请输入: + +``` +mongo +``` + +这将启动 **mongo shell**。有关查询和选项的详细信息,请查看[手册][4]。 + +**注意:**根据你计划使用 MongoDB 的方式,你可能需要调整防火墙。不过这超出了本篇的内容,并且取决于你的配置。 + +#### 卸载 MongoDB + +如果你从 Ubuntu 仓库安装 MongoDB 并想要卸载它(可能要使用官方支持的方式安装),请输入: + +``` +sudo systemctl stop mongodb +sudo apt purge mongodb +sudo apt autoremove +``` + +这应该会完全卸载 MongoDB。确保**备份**你可能想要保留的任何集合或文档,因为它们将被删除! + +### 方法 2:在 Ubuntu 上安装 MongoDB 社区版 + +这是推荐的安装 MongoDB 的方法,它使用包管理器。你需要多打几条命令,对于 Linux 新手而言,这可能会感到害怕。 + +但没有什么可怕的!我们将一步步说明安装过程。 + +#### 安装 MongoDB + +由 MongoDB Inc. 维护的包称为 `mongodb-org`,而不是 `mongodb`(这是 Ubuntu 仓库中包的名称)。在开始之前,请确保系统上未安装 `mongodb`。因为包之间会发生冲突。让我们开始吧! + +首先,我们必须导入公钥: + +``` +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 +``` + +现在,你需要在源列表中添加一个新的仓库,以便你可以安装 MongoDB 社区版并获得自动更新: + +``` +echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list +``` + +要安装 `mongodb-org`,我们需要更新我们的包数据库,以便系统知道可用的新包: + +``` +sudo apt update +``` + +现在你可以安装**最新稳定版**的 MongoDB: + +``` +sudo apt install -y mongodb-org +``` + +或者某个**特定版本**(在 `=` 后面修改版本号) + +``` +sudo apt install -y mongodb-org=4.0.6 mongodb-org-server=4.0.6 mongodb-org-shell=4.0.6 mongodb-org-mongos=4.0.6 mongodb-org-tools=4.0.6 +``` + +如果你选择安装特定版本,请确保在所有位置都修改了版本号。如果你修改了 `mongodb-org=4.0.6`,你将安装最新版本。 + +默认情况下,使用包管理器(`apt-get`)更新时,MongoDB 将更新为最新的版本。要阻止这种情况发生(并冻结为已安装的版本),请使用: + +``` +echo "mongodb-org hold" | sudo dpkg --set-selections +echo "mongodb-org-server hold" | sudo dpkg --set-selections +echo "mongodb-org-shell hold" | sudo dpkg --set-selections +echo "mongodb-org-mongos hold" | sudo dpkg --set-selections +echo "mongodb-org-tools hold" | sudo dpkg --set-selections +``` + +你现在已经成功安装了 MongoDB! + +#### 配置 MongoDB + +默认情况下,包管理器将创建 `/var/lib/mongodb` 和 `/var/log/mongodb`,MongoDB 将使用 `mongodb` 用户帐户运行。 + +我不会去更改这些默认设置,因为这超出了本指南的范围。有关详细信息,请查看[手册][5]。 + +`/etc/mongod.conf` 中的设置在启动/重新启动 **mongodb** 服务实例时生效。 + +##### 运行 MongoDB + +要启动 mongodb 的守护进程 `mongod`,请输入: + +``` +sudo service mongod start +``` + +现在你应该验证 `mongod` 进程是否已成功启动。此信息(默认情况下)保存在 `/var/log/mongodb/mongod.log` 中。我们来看看文件的内容: + +``` +sudo cat /var/log/mongodb/mongod.log +``` + +![Check MongoDB logs to see if the process is running properly.][6] + +只要你在某处看到:`[initandlisten] waiting for connections on port 27017`,就说明进程正常运行。 + +**注意**:27017 是 `mongod` 的默认端口。 + +要停止/重启 `mongod`,请输入: + +``` +sudo service mongod stop +sudo service mongod restart +``` + +现在,你可以通过打开 **mongo shell** 来使用 MongoDB: + +``` +mongo +``` + +#### 卸载 MongoDB + +运行以下命令: + +``` +sudo service mongod stop +sudo apt purge mongodb-org* +``` + +要删除**数据库**和**日志文件**(确保**备份**你要保留的内容!): + +``` +sudo rm -r /var/log/mongodb +sudo rm -r /var/lib/mongodb +``` + +### 总结 + +MongoDB 是一个很棒的 NoSQL 数据库,它易于集成到现代项目中。我希望本教程能帮助你在 Ubuntu 上安装它!在下面的评论中告诉我们你计划如何使用 MongoDB。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-mongodb-ubuntu + +作者:[Sergiu][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://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.mongodb.com/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/mongodb-ubuntu.jpeg?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_check_status.jpg?fit=800%2C574&ssl=1 +[4]: https://docs.mongodb.com/manual/tutorial/getting-started/ +[5]: https://docs.mongodb.com/manual/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_org_check_logs.jpg?fit=800%2C467&ssl=1 diff --git a/published/201908/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md b/published/201908/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md new file mode 100644 index 0000000000..88ffc6fc24 --- /dev/null +++ b/published/201908/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md @@ -0,0 +1,228 @@ +[#]: collector: "lujun9972" +[#]: translator: "wxy" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11198-1.html" +[#]: subject: "How To Parse And Pretty Print JSON With Linux Commandline Tools" +[#]: via: "https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/" +[#]: author: "EDITOR https://www.ostechnix.com/author/editor/" + +如何用 Linux 命令行工具解析和格式化输出 JSON +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/json-720x340.png) + +JSON 是一种轻量级且与语言无关的数据存储格式,易于与大多数编程语言集成,也易于人类理解 —— 当然,如果格式正确的话。JSON 这个词代表 **J**ava **S**cript **O**bject **N**otation,虽然它以 JavaScript 开头,而且主要用于在服务器和浏览器之间交换数据,但现在正在用于许多领域,包括嵌入式系统。在这里,我们将使用 Linux 上的命令行工具解析并格式化打印 JSON。它对于在 shell 脚本中处理大型 JSON 数据或在 shell 脚本中处理 JSON 数据非常有用。 + +### 什么是格式化输出? + +JSON 数据的结构更具人性化。但是在大多数情况下,JSON 数据会存储在一行中,甚至没有行结束字符。 + +显然,这对于手动阅读和编辑不太方便。 + +这是格式化输出pretty print就很有用。这个该名称不言自明:重新格式化 JSON 文本,使人们读起来更清晰。这被称为 **JSON 格式化输出**。 + +### 用 Linux 命令行工具解析和格式化输出 JSON + +可以使用命令行文本处理器解析 JSON 数据,例如 `awk`、`sed` 和 `gerp`。实际上 `JSON.awk` 是一个来做这个的 awk 脚本。但是,也有一些专用工具可用于同一目的。 + +1. `jq` 或 `jshon`,shell 下的 JSON 解析器,它们都非常有用。 +2. Shell 脚本,如 `JSON.sh` 或 `jsonv.sh`,用于在 bash、zsh 或 dash shell 中解析JSON。 +3. `JSON.awk`,JSON 解析器 awk 脚本。 +4. 像 `json.tool` 这样的 Python 模块。 +5. `undercore-cli`,基于 Node.js 和 javascript。 + +在本教程中,我只关注 `jq`,这是一个 shell 下的非常强大的 JSON 解析器,具有高级过滤和脚本编程功能。 + +### JSON 格式化输出 + +JSON 数据可能放在一行上使人难以解读,因此为了使其具有一定的可读性,JSON 格式化输出就可用于此目的的。 + +**示例:**来自 `jsonip.com` 的数据,使用 `curl` 或 `wget` 工具获得 JSON 格式的外部 IP 地址,如下所示。 + +``` +$ wget -cq http://jsonip.com/ -O - +``` + +实际数据看起来类似这样: + +``` +{"ip":"111.222.333.444","about":"/about","Pro!":"http://getjsonip.com"} +``` + +现在使用 `jq` 格式化输出它: + +``` +$ wget -cq http://jsonip.com/ -O - | jq '.' +``` + +通过 `jq` 过滤了该结果之后,它应该看起来类似这样: + +``` +{ + "ip": "111.222.333.444", + "about": "/about", + "Pro!": "http://getjsonip.com" +} +``` + +同样也可以通过 Python `json.tool` 模块做到。示例如下: + +``` +$ cat anything.json | python -m json.tool +``` + +这种基于 Python 的解决方案对于大多数用户来说应该没问题,但是如果没有预安装或无法安装 Python 则不行,比如在嵌入式系统上。 + +然而,`json.tool` Python 模块具有明显的优势,它是跨平台的。因此,你可以在 Windows、Linux 或 Mac OS 上无缝使用它。 + +### 如何用 jq 解析 JSON + +首先,你需要安装 `jq`,它已被大多数 GNU/Linux 发行版选中,并使用各自的软件包安装程序命令进行安装。 + +在 Arch Linux 上: + +``` +$ sudo pacman -S jq +``` + +在 Debian、Ubuntu、Linux Mint 上: + +``` +$ sudo apt-get install jq +``` + +在 Fedora 上: + +``` +$ sudo dnf install jq +``` + +在 openSUSE 上: + +``` +$ sudo zypper install jq +``` + +对于其它操作系统或平台参见[官方的安装指导][1]。 + +#### jq 的基本过滤和标识符功能 + +`jq` 可以从 `STDIN` 或文件中读取 JSON 数据。你可以根据情况使用。 + +单个符号 `.` 是最基本的过滤器。这些过滤器也称为**对象标识符-索引**。`jq` 使用单个 `.` 过滤器基本上相当将输入的 JSON 文件格式化输出。 + +- **单引号**:不必始终使用单引号。但是如果你在一行中组合几个过滤器,那么你必须使用它们。 +- **双引号**:你必须用两个双引号括起任何特殊字符,如 `@`、`#`、`$`,例如 `jq .foo.”@bar”`。 +- **原始数据打印**:不管出于任何原因,如果你只需要最终解析的数据(不包含在双引号内),请使用带有 `-r` 标志的 `jq` 命令,如下所示:`jq -r .foo.bar`。 + +#### 解析特定数据 + +要过滤出 JSON 的特定部分,你需要了解格式化输出的 JSON 文件的数据层次结构。 + +来自维基百科的 JSON 数据示例: + +``` +{ + "firstName": "John", + "lastName": "Smith", + "age": 25, + "address": { + "streetAddress": "21 2nd Street", + "city": "New York", + "state": "NY", + "postalCode": "10021" +}, + "phoneNumber": [ +{ + "type": "home", + "number": "212 555-1234" +}, +{ + "type": "fax", + "number": "646 555-4567" +} +], + "gender": { + "type": "male" + } +} +``` + +我将在本教程中将此 JSON 数据用作示例,将其保存为 `sample.json`。 + +假设我想从 `sample.json` 文件中过滤出地址。所以命令应该是这样的: + +``` +$ jq .address sample.json +``` + +示例输出: + +``` +{ + "streetAddress": "21 2nd Street", + "city": "New York", + "state": "NY", + "postalCode": "10021" +} +``` + +再次,我想要邮政编码,然后我要添加另一个**对象标识符-索引**,即另一个过滤器。 + +``` +$ cat sample.json | jq .address.postalCode +``` + +另请注意,**过滤器区分大小写**,并且你必须使用完全相同的字符串来获取有意义的输出,否则就是 null。 + +#### 从 JSON 数组中解析元素 + +JSON 数组的元素包含在方括号内,这无疑是非常通用的。 + +要解析数组中的元素,你必须使用 `[]` 标识符以及其他对象标识符索引。 + +在此示例 JSON 数据中,电话号码存储在数组中,要从此数组中获取所有内容,你只需使用括号,像这个示例: + +``` +$ jq .phoneNumber[] sample.json +``` + +假设你只想要数组的第一个元素,然后使用从 `0` 开始的数组对象编号,对于第一个项目,使用 `[0]`,对于下一个项目,它应该每步增加 1。 + +``` +$ jq .phoneNumber[0] sample.json +``` + +#### 脚本编程示例 + +假设我只想要家庭电话,而不是整个 JSON 数组数据。这就是用 `jq` 命令脚本编写的方便之处。 + +``` +$ cat sample.json | jq -r '.phoneNumber[] | select(.type == "home") | .number' +``` + +首先,我将一个过滤器的结果传递给另一个,然后使用 `select` 属性选择特定类型的数据,再次将结果传递给另一个过滤器。 + +解释每种类型的 `jq` 过滤器和脚本编程超出了本教程的范围和目的。强烈建议你阅读 `jq` 手册,以便更好地理解下面的内容。 + +资源: + +- https://stedolan.github.io/jq/manual/ +- http://www.compciv.org/recipes/cli/jq-for-parsing-json/ +- https://lzone.de/cheat-sheet/jq + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/ + +作者:[ostechnix][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.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://stedolan.github.io/jq/download/ diff --git a/published/201908/20190318 Let-s try dwm - dynamic window manager.md b/published/201908/20190318 Let-s try dwm - dynamic window manager.md new file mode 100644 index 0000000000..241869a24d --- /dev/null +++ b/published/201908/20190318 Let-s try dwm - dynamic window manager.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11235-1.html) +[#]: subject: (Let’s try dwm — dynamic window manager) +[#]: via: (https://fedoramagazine.org/lets-try-dwm-dynamic-window-manger/) +[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) + +试试动态窗口管理器 dwm 吧 +====== + +![][1] + +如果你崇尚效率和极简主义,并且正在为你的 Linux 桌面寻找新的窗口管理器,那么你应该尝试一下动态窗口管理器dynamic window manager dwm。以不到 2000 标准行的代码写就的 dwm,是一个速度极快而功能强大,且可高度定制的窗口管理器。 + +你可以在平铺、单片和浮动布局之间动态选择,使用标签将窗口组织到多个工作区,并使用键盘快捷键快速导航。本文将帮助你开始使用 dwm。 + +### 安装 + +要在 Fedora 上安装 dwm,运行: + +``` +$ sudo dnf install dwm dwm-user +``` + +`dwm` 包会安装窗口管理器本身,`dwm-user` 包显著简化了配置,本文稍后将对此进行说明。 + +此外,为了能够在需要时锁定屏幕,我们还将安装 `slock`,这是一个简单的 X 显示锁屏。 + +``` +$ sudo dnf install slock +``` + +当然,你可以根据你的个人喜好使用其它的锁屏。 + +### 快速入门 + +要启动 dwm,在登录屏选择 “dwm-user” 选项。 + +![][2] + +登录后,你将看到一个非常简单的桌面。事实上,顶部唯一的一个面板列出了代表工作空间的 9 个标签和一个代表窗户布局的 `[]=` 符号。 + +#### 启动应用 + +在查看布局之前,首先启动一些应用程序,以便你可以随时使用布局。可以通过按 `Alt+p` 并键入应用程序的名称,然后回车来启动应用程序。还有一个快捷键 `Alt+Shift+Enter` 用于打开终端。 + +现在有一些应用程序正在运行了,请查看布局。 + +#### 布局 + +默认情况下有三种布局:平铺布局,单片布局和浮动布局。 + +平铺布局由条形图上的 `[]=` 表示,它将窗口组织为两个主要区域:左侧为主区域,右侧为堆叠区。你可以按 `Alt+t` 激活平铺布局。 + +![][3] + +平铺布局背后的想法是,主窗口放在主区域中,同时仍然可以看到堆叠区中的其他窗口。你可以根据需要在它们之间快速切换。 + +要在两个区域之间交换窗口,请将鼠标悬停在堆叠区中的一个窗口上,然后按 `Alt+Enter` 将其与主区域中的窗口交换。 + +![][4] + +单片布局由顶部栏上的 `[N]` 表示,可以使你的主窗口占据整个屏幕。你可以按 `Alt+m` 切换到它。 + +最后,浮动布局可让你自由移动和调整窗口大小。它的快捷方式是 `Alt+f`,顶栏上的符号是 `><>`。 + +#### 工作区和标签 + +每个窗口都分配了一个顶部栏中列出的标签(1-9)。要查看特定标签,请使用鼠标单击其编号或按 `Alt+1..9`。你甚至可以使用鼠标右键单击其编号,一次查看多个标签。 + +通过使用鼠标突出显示后,并按 `Alt+Shift+1..9`,窗口可以在不同标签之间移动。 + +### 配置 + +为了使 dwm 尽可能简约,它不使用典型的配置文件。而是你需要修改代表配置的 C 语言头文件,并重新编译它。但是不要担心,在 Fedora 中你只需要简单地编辑主目录中的一个文件,而其他一切都会在后台发生,这要归功于 Fedora 的维护者提供的 `dwm-user` 包。 + +首先,你需要使用类似于以下的命令将文件复制到主目录中: + +``` +$ mkdir ~/.dwm +$ cp /usr/src/dwm-VERSION-RELEASE/config.def.h ~/.dwm/config.h +``` + +你可以通过运行 `man dwm-start` 来获取确切的路径。 + +其次,只需编辑 `~/.dwm/config.h` 文件。例如,让我们配置一个新的快捷方式:通过按 `Alt+Shift+L` 来锁定屏幕。 + +考虑到我们已经安装了本文前面提到的 `slock` 包,我们需要在文件中添加以下两行以使其工作: + +在 `/* commands */` 注释下,添加: + +``` +static const char *slockcmd[] = { "slock", NULL }; +``` + +添加下列行到 `static Key keys[]` 中: + +``` +{ MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } }, +``` + +最终,它应该看起来如下: + +``` +... + /* commands */ + static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ + static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; + static const char *termcmd[] = { "st", NULL }; + static const char *slockcmd[] = { "slock", NULL }; + + static Key keys[] = { + /* modifier key function argument */ + { MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } }, + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + ... +``` + +保存文件。 + +最后,按 `Alt+Shift+q` 注销,然后重新登录。`dwm-user` 包提供的脚本将识别你已更改主目录中的`config.h` 文件,并会在登录时重新编译 dwm。因为 dwm 非常小,它快到你甚至都不会注意到它重新编译了。 + +你现在可以尝试按 `Alt+Shift+L` 锁定屏幕,然后输入密码并按回车键再次登录。 + +### 总结 + +如果你崇尚极简主义并想要一个非常快速而功能强大的窗口管理器,dwm 可能正是你一直在寻找的。但是,它可能不适合初学者,你可能需要做许多其他配置才能按照你的喜好进行配置。 + +要了解有关 dwm 的更多信息,请参阅该项目的主页: 。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/lets-try-dwm-dynamic-window-manger/ + +作者:[Adam Šamalík][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://fedoramagazine.org/author/asamalik/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/03/dwm-magazine-image-816x345.png +[2]: https://fedoramagazine.org/wp-content/uploads/2019/03/choosing-dwm-1024x469.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/03/dwm-desktop-1024x593.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-2019-03-15-at-11.12.32-1024x592.png diff --git a/published/201908/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md b/published/201908/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md new file mode 100644 index 0000000000..3afa479e52 --- /dev/null +++ b/published/201908/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11245-1.html) +[#]: subject: (How To Turn On And Shutdown The Raspberry Pi [Absolute Beginner Tip]) +[#]: via: (https://itsfoss.com/turn-on-raspberry-pi/) +[#]: author: (Chinmay https://itsfoss.com/author/chinmay/) + +如何打开和关闭树莓派(绝对新手) +====== + +> 这篇短文教你如何打开树莓派以及如何在之后正确关闭它。 + +![](https://img.linux.net.cn/data/attachment/album/201908/19/192825rlrjy3sj77j7j79y.jpg) + +[树莓派][1]是[最流行的 SBC(单板计算机)][2]之一。如果你对这个话题感兴趣,我相信你已经有了一个树莓派。我还建议你使用[其他树莓派配件][3]来开始使用你的设备。 + +你已经准备好打开并开始使用。与桌面和笔记本电脑等传统电脑相比,它有相似以及不同之处。 + +今天,让我们继续学习如何打开和关闭树莓派,因为它并没有真正的“电源按钮”。 + +在本文中,我使用的是树莓派 3B+,但对于所有树莓派变体都是如此。 + +### 如何打开树莓派 + +![Micro USB port for Power][7] + +micro USB 口为树莓派供电,打开它的方式是将电源线插入 micro USB 口。但是开始之前,你应该确保做了以下事情。 + +* 根据官方[指南][8]准备带有 Raspbian 的 micro SD 卡并插入 micro SD 卡插槽。 +* 插入 HDMI 线、USB 键盘和鼠标。 +* 插入以太网线(可选)。 + +成上述操作后,请插入电源线。这会打开树莓派,显示屏将亮起并加载操作系统。 + +如果您将其关闭并且想要再次打开它,则必须从电源插座(首选)或从电路板的电源端口拔下电源线,然后再插上。它没有电源按钮。 + +### 关闭树莓派 + +关闭树莓派非常简单,单击菜单按钮并选择关闭。 + +![Turn off Raspberry Pi graphically][9] + +或者你可以在终端使用 [shutdown 命令][10] + +``` +sudo shutdown now +``` + +`shutdown` 执行后**等待**它完成,接着你可以关闭电源。 + +再说一次,树莓派关闭后,没有真正的办法可以在不关闭再打开电源的情况下打开树莓派。你可以使用 GPIO 打开树莓派,但这需要额外的改装。 + +*注意:Micro USB 口往往是脆弱的,因此请关闭/打开电源,而不是经常拔出插入 micro USB 口。 + +好吧,这就是关于打开和关闭树莓派的所有内容,你打算用它做什么?请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/turn-on-raspberry-pi/ + +作者:[Chinmay][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://itsfoss.com/author/chinmay/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://linux.cn/article-10823-1.html +[3]: https://itsfoss.com/things-you-need-to-get-your-raspberry-pi-working/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/04/raspberry-pi-3-microusb.png?fit=800%2C532&ssl=1 +[8]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/04/Raspbian-ui-menu.jpg?fit=800%2C492&ssl=1 +[10]: https://linuxhandbook.com/linux-shutdown-command/ diff --git a/published/201908/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md b/published/201908/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md new file mode 100644 index 0000000000..001e909fc1 --- /dev/null +++ b/published/201908/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (zionfuo) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11275-1.html) +[#]: subject: (Blockchain 2.0 – An Introduction To Hyperledger Project (HLP) [Part 8]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/) +[#]: author: (editor https://www.ostechnix.com/author/editor/) + +区块链 2.0:Hyperledger 项目简介(八) +====== + +![Introduction To Hyperledger Project][1] + +一旦一个新技术平台在积极发展和商业利益方面达到了一定程度的受欢迎程度,全球的主要公司和小型的初创企业都急于抓住这块蛋糕。在当时 Linux 就是这样的一个平台。一旦实现了其应用程序的普及,个人、公司和机构就开始对其表现出兴趣,到 2000 年,Linux 基金会就成立了。 + +Linux 基金会旨在通过赞助他们的开发团队来将 Linux 作为一个平台来标准化和发展。Linux 基金会是一个由软件和 IT 巨头([如微软、甲骨文、三星、思科、 IBM 、英特尔等][7])支持的非营利组织。这不包括为改进该平台而提供服务的数百名个人开发者。多年来,Linux 基金会已经在旗下开展了许多项目。**Hyperledger** 项目是迄今为止发展最快的项目。 + +在将技术推进至可用且有用的方面上,这种联合主导的开发具有很多优势。为大型项目提供开发标准、库和所有后端协议既昂贵又耗费资源,而且不会从中产生丝毫收入。因此,对于公司来说,通过支持这些组织来汇集他们的资源来开发常见的那些 “烦人” 部分是有很意义的,以及随后完成这些标准部分的工作以简单地即插即用和定制他们的产品。除了这种模型的经济性之外,这种合作努力还产生了标准,使其容易使用和集成到优秀的产品和服务中。 + +上述联盟模式,在曾经或当下的创新包括 WiFi(Wi-Fi 联盟)、移动电话等标准。 + +### Hyperledger 项目(HLP)简介 + +Hyperledger 项目(HLP)于 2015 年 12 月由 Linux 基金会启动,目前是其孵化的增长最快的项目之一。它是一个伞式组织umbrella organization,用于合作开发和推进基于[区块链][2]的分布式账本技术 (DLT) 的工具和标准。支持该项目的主要行业参与者包括 IBM、英特尔 和 SAP Ariba [等][3]。HLP 旨在为个人和公司创建框架,以便根据需要创建共享和封闭的区块链,以满足他们自己的需求。其设计原则是开发一个专注于隐私和未来可审计性的全球可部署、可扩展、强大的区块链平台。[^2] 同样要注意的是大多数提出的区块链及其框架。 + +### 开发目标和构造:即插即用 + +虽然面向企业的平台有以太坊联盟之类的产品,但根据定义,HLP 是面向企业的,并得到行业巨头的支持,他们在 HLP 旗下的许多模块中做出贡献并进一步发展。HLP 还孵化开发的周边项目,并这些创意项目推向公众。HLP 的成员贡献了他们自己的力量,例如 IBM 为如何协作开发贡献了他们的 Fabric 平台。该代码库由 IBM 在其项目组内部研发,并开源出来供所有成员使用。 + +这些过程使得 HLP 中的模块具有高度灵活的插件框架,这将支持企业环境中的快速开发和部署。此外,默认情况下,其他对比的平台是开放的免许可链permission-less blockchain或是公有链public blockchain,甚至可以将它们应用到特定应用当中。HLP 模块本身支持该功能。 + +有关公有链和私有链的差异和用例更多地涵盖在[这篇][4]比较文章当中。 + +根据该项目执行董事 Brian Behlendorf 的说法,Hyperledger 项目的使命有四个。 + +分别是: + + 1. 创建企业级 DLT 框架和标准,任何人都可以移植以满足其特定的行业或个人需求。 + 2. 创建一个强大的开源社区来帮助生态系统发展。 + 3. 促进所述的生态系统的行业成员(如成员公司)的参与。 + 4. 为 HLP 社区提供中立且无偏见的基础设施,以收集和分享相关的更新和发展。 + +可以在这里访问[原始文档][5]。 + +### HLP 的架构 + +HLP 由 12 个项目组成,这些项目被归类为独立的模块,每个项目通常都是结构化的,可以独立开发其模块的。在孵化之前,首先对它们的能力和活力进行研究。该组织的任何成员都可以提出附加建议。在项目孵化后,就会进行积极开发,然后才会推出。这些模块之间的互操作性具有很高的优先级,因此这些组之间的定期通信由社区维护。目前,这些项目中有 4 个被归类为活跃项目。被标为活跃意味着它们已经准备好使用,但还没有准备好发布主要版本。这 4 个模块可以说是推动区块链革命的最重要或相当基本的模块。稍后,我们将详细介绍各个模块及其功能。然而,Hyperledger Fabric 平台的简要描述,可以说是其中最受欢迎的。 + +### Hyperledger Fabric + +Hyperledger Fabric 是一个完全开源的、基于区块链的许可 (非公开) DLT 平台,设计时考虑了企业的使用。该平台提供了适合企业环境的功能和结构。它是高度模块化的,允许开发人员在不同的共识协议、链上代码协议([智能合约][6])或身份管理系统等中进行选择。这是一个基于区块链的许可平台,它利用身份管理系统,这意味着参与者将知道彼此在企业环境中的身份。Fabric 允许以各种主流编程语言 (包括 Java、Javascript、Go 等) 开发智能合约(“链码chaincode”,是 Hyperledger 团队使用的术语)。这使得机构和企业可以利用他们在该领域的现有人才,而无需雇佣或重新培训开发人员来开发他们自己的智能合约。与标准订单验证系统相比,Fabric 还使用执行顺序验证execute-order-validate系统来处理智能合约,以提供更好的可靠性,这些系统由提供智能合约功能的其他平台使用。与标准订单验证系统相比,Fabric还使用执行顺序验证系统来处理智能合约,以提供更好的可靠性,这些系统由提供智能合约功能的其他平台使用。Fabric 的其他功能还有可插拔性能、身份管理系统、数据库管理系统、共识平台等,这些功能使它在竞争中保持领先地位。 + +### 结论 + +诸如 Hyperledger Fabric 平台这样的项目能够在主流用例中更快地采用区块链技术。Hyperledger 社区结构本身支持开放治理原则,并且由于所有项目都是作为开源平台引导的,因此这提高了团队在履行承诺时表现出来的安全性和责任感。 + +由于此类项目的主要应用涉及与企业合作及进一步开发平台和标准,因此 Hyperledger 项目目前在其他类似项目前面处于有利地位。 + +[^2]: E. Androulaki et al., “Hyperledger Fabric: A Distributed Operating System for Permissioned Blockchains,” 2018. + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ + +作者:[ostechnix][a] +选题:[lujun9972][b] +译者:[zionfuo](https://github.com/zionfuo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Introduction-To-Hyperledger-Project-720x340.png +[2]: https://linux.cn/article-10650-1.html +[3]: https://www.hyperledger.org/members +[4]: https://linux.cn/article-11080-1.html +[5]: http://www.hitachi.com/rev/archive/2017/r2017_01/expert/index.html +[6]: https://linux.cn/article-10956-1.html +[7]: https://www.theinquirer.net/inquirer/news/2182438/samsung-takes-seat-intel-ibm-linux-foundation diff --git a/sources/tech/20190510 Check storage performance with dd.md b/published/201908/20190510 Check storage performance with dd.md similarity index 54% rename from sources/tech/20190510 Check storage performance with dd.md rename to published/201908/20190510 Check storage performance with dd.md index 8cdea81f69..a8ba54c657 100644 --- a/sources/tech/20190510 Check storage performance with dd.md +++ b/published/201908/20190510 Check storage performance with dd.md @@ -1,74 +1,64 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11195-1.html) [#]: subject: (Check storage performance with dd) [#]: via: (https://fedoramagazine.org/check-storage-performance-with-dd/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -Check storage performance with dd +使用 dd 检查存储性能 ====== ![][1] -This article includes some example commands to show you how to get a _rough_ estimate of hard drive and RAID array performance using the _dd_ command. Accurate measurements would have to take into account things like [write amplification][2] and [system call overhead][3], which this guide does not. For a tool that might give more accurate results, you might want to consider using [hdparm][4]. +本文包含一些示例命令,向你展示如何使用 `dd` 命令*粗略*估计硬盘驱动器和 RAID 阵列的性能。准确的测量必须考虑诸如[写入放大][2]和[系统调用开销][3]之类的事情,本指南不会考虑这些。对于可能提供更准确结果的工具,你可能需要考虑使用 [hdparm][4]。 -To factor out performance issues related to the file system, these examples show how to test the performance of your drives and arrays at the block level by reading and writing directly to/from their block devices. **WARNING** : The _write_ tests will destroy any data on the block devices against which they are run. **Do not run them against any device that contains data you want to keep!** +为了分解与文件系统相关的性能问题,这些示例显示了如何通过直接读取和写入块设备来在块级测试驱动器和阵列的性能。**警告**:*写入*测试将会销毁用来运行测试的块设备上的所有数据。**不要对包含你想要保留的数据的任何设备运行这些测试!** -### Four tests +### 四个测试 -Below are four example dd commands that can be used to test the performance of a block device: +下面是四个示例 `dd` 命令,可用于测试块设备的性能: - 1. One process reading from $MY_DISK: +1、 从 `$MY_DISK` 读取的一个进程: ``` # dd if=$MY_DISK of=/dev/null bs=1MiB count=200 iflag=nocache ``` - 2. One process writing to $MY_DISK: +2、写入到 `$MY_DISK` 的一个进程: ``` # dd if=/dev/zero of=$MY_DISK bs=1MiB count=200 oflag=direct ``` - 3. Two processes reading concurrently from $MY_DISK: +3、从 `$MY_DISK` 并发读取的两个进程: ``` # (dd if=$MY_DISK of=/dev/null bs=1MiB count=200 iflag=nocache &); (dd if=$MY_DISK of=/dev/null bs=1MiB count=200 iflag=nocache skip=200 &) ``` - 4. Two processes writing concurrently to $MY_DISK: +4、 并发写入到 `$MY_DISK` 的两个进程: ``` # (dd if=/dev/zero of=$MY_DISK bs=1MiB count=200 oflag=direct &); (dd if=/dev/zero of=$MY_DISK bs=1MiB count=200 oflag=direct skip=200 &) ``` +- 执行读写测试时,相应的 `iflag=nocache` 和 `oflag=direct` 参数非常重要,因为没有它们,`dd` 命令有时会显示从[内存][5]中传输数据的结果速度,而不是从硬盘。 +- `bs` 和 `count` 参数的值有些随意,我选择的值应足够大,以便在大多数情况下为当前硬件提供合适的平均值。 +- `null` 和 `zero` 设备在读写测试中分别用于目标和源,因为它们足够快,不会成为性能测试中的限制因素。 +- 并发读写测试中第二个 `dd` 命令的 `skip=200` 参数是为了确保 `dd` 的两个副本在硬盘驱动器的不同区域上运行。 +### 16 个示例 +下面是演示,显示针对以下四个块设备中之一运行上述四个测试中的各个结果: -– The _iflag=nocache_ and _oflag=direct_ parameters are important when performing the read and write tests (respectively) because without them the dd command will sometimes show the resulting speed of transferring the data to/from [RAM][5] rather than the hard drive. +1. `MY_DISK=/dev/sda2`(用在示例 1-X 中) +2. `MY_DISK=/dev/sdb2`(用在示例 2-X 中) +3. `MY_DISK=/dev/md/stripped`(用在示例 3-X 中) +4. `MY_DISK=/dev/md/mirrored`(用在示例 4-X 中) -– The values for the _bs_ and _count_ parameters are somewhat arbitrary and what I have chosen should be large enough to provide a decent average in most cases for current hardware. - -– The _null_ and _zero_ devices are used for the destination and source (respectively) in the read and write tests because they are fast enough that they will not be the limiting factor in the performance tests. - -– The _skip=200_ parameter on the second dd command in the concurrent read and write tests is to ensure that the two copies of dd are operating on different areas of the hard drive. - -### 16 examples - -Below are demonstrations showing the results of running each of the above four tests against each of the following four block devices: - - 1. MY_DISK=/dev/sda2 (used in examples 1-X) - 2. MY_DISK=/dev/sdb2 (used in examples 2-X) - 3. MY_DISK=/dev/md/stripped (used in examples 3-X) - 4. MY_DISK=/dev/md/mirrored (used in examples 4-X) - - - -A video demonstration of the these tests being run on a PC is provided at the end of this guide. - -Begin by putting your computer into _rescue_ mode to reduce the chances that disk I/O from background services might randomly affect your test results. **WARNING** : This will shutdown all non-essential programs and services. Be sure to save your work before running these commands. You will need to know your _root_ password to get into rescue mode. The _passwd_ command, when run as the root user, will prompt you to (re)set your root account password. +首先将计算机置于*救援*模式,以减少后台服务的磁盘 I/O 随机影响测试结果的可能性。**警告**:这将关闭所有非必要的程序和服务。在运行这些命令之前,请务必保存你的工作。你需要知道 `root` 密码才能进入救援模式。`passwd` 命令以 `root` 用户身份运行时,将提示你(重新)设置 `root` 帐户密码。 ``` $ sudo -i @@ -77,14 +67,14 @@ $ sudo -i # systemctl rescue ``` -You might also want to temporarily disable logging to disk: +你可能还想暂时禁止将日志记录到磁盘: ``` # sed -r -i.bak 's/^#?Storage=.*/Storage=none/' /etc/systemd/journald.conf # systemctl restart systemd-journald.service ``` -If you have a swap device, it can be temporarily disabled and used to perform the following tests: +如果你有交换设备,可以暂时禁用它并用于执行后面的测试: ``` # swapoff -a @@ -93,7 +83,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th # mdadm --zero-superblock $MY_DEVS ``` -#### Example 1-1 (reading from sda) +#### 示例 1-1 (从 sda 读取) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 1) @@ -106,7 +96,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.7003 s, 123 MB/s ``` -#### Example 1-2 (writing to sda) +#### 示例 1-2 (写入到 sda) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 1) @@ -119,7 +109,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.67117 s, 125 MB/s ``` -#### Example 1-3 (reading concurrently from sda) +#### 示例 1-3 (从 sda 并发读取) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 1) @@ -135,7 +125,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 3.52614 s, 59.5 MB/s ``` -#### Example 1-4 (writing concurrently to sda) +#### 示例 1-4 (并发写入到 sda) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 1) @@ -150,7 +140,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 3.60872 s, 58.1 MB/s ``` -#### Example 2-1 (reading from sdb) +#### 示例 2-1 (从 sdb 读取) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 2) @@ -163,7 +153,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.67285 s, 125 MB/s ``` -#### Example 2-2 (writing to sdb) +#### 示例 2-2 (写入到 sdb) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 2) @@ -176,7 +166,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.67198 s, 125 MB/s ``` -#### Example 2-3 (reading concurrently from sdb) +#### 示例 2-3 (从 sdb 并发读取) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 2) @@ -192,7 +182,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 3.57736 s, 58.6 MB/s ``` -#### Example 2-4 (writing concurrently to sdb) +#### 示例 2-4 (并发写入到 sdb) ``` # MY_DISK=$(echo $MY_DEVS | cut -d ' ' -f 2) @@ -208,7 +198,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 3.81475 s, 55.0 MB/s ``` -#### Example 3-1 (reading from RAID0) +#### 示例 3-1 (从 RAID0 读取) ``` # mdadm --create /dev/md/stripped --homehost=any --metadata=1.0 --level=0 --raid-devices=2 $MY_DEVS @@ -222,7 +212,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 0.837419 s, 250 MB/s ``` -#### Example 3-2 (writing to RAID0) +#### 示例 3-2 (写入到 RAID0) ``` # MY_DISK=/dev/md/stripped @@ -235,7 +225,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 0.823648 s, 255 MB/s ``` -#### Example 3-3 (reading concurrently from RAID0) +#### 示例 3-3 (从 RAID0 并发读取) ``` # MY_DISK=/dev/md/stripped @@ -251,7 +241,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.80016 s, 116 MB/s ``` -#### Example 3-4 (writing concurrently to RAID0) +#### 示例 3-4 (并发写入到 RAID0) ``` # MY_DISK=/dev/md/stripped @@ -267,7 +257,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.81323 s, 116 MB/s ``` -#### Example 4-1 (reading from RAID1) +#### 示例 4-1 (从 RAID1 读取) ``` # mdadm --stop /dev/md/stripped @@ -282,7 +272,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.74963 s, 120 MB/s ``` -#### Example 4-2 (writing to RAID1) +#### 示例 4-2 (写入到 RAID1) ``` # MY_DISK=/dev/md/mirrored @@ -295,7 +285,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.74625 s, 120 MB/s ``` -#### Example 4-3 (reading concurrently from RAID1) +#### 示例 4-3 (从 RAID1 并发读取) ``` # MY_DISK=/dev/md/mirrored @@ -311,7 +301,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 1.67685 s, 125 MB/s ``` -#### Example 4-4 (writing concurrently to RAID1) +#### 示例 4-4 (并发写入到 RAID1) ``` # MY_DISK=/dev/md/mirrored @@ -327,7 +317,7 @@ If you have a swap device, it can be temporarily disabled and used to perform th 209715200 bytes (210 MB, 200 MiB) copied, 4.1067 s, 51.1 MB/s ``` -#### Restore your swap device and journald configuration +#### 恢复交换设备和日志配置 ``` # mdadm --stop /dev/md/stripped /dev/md/mirrored @@ -339,23 +329,19 @@ If you have a swap device, it can be temporarily disabled and used to perform th # reboot ``` -### Interpreting the results +### 结果解读 -Examples 1-1, 1-2, 2-1, and 2-2 show that each of my drives read and write at about 125 MB/s. +示例 1-1、1-2、2-1 和 2-2 表明我的每个驱动器以大约 125 MB/s 的速度读写。 -Examples 1-3, 1-4, 2-3, and 2-4 show that when two reads or two writes are done in parallel on the same drive, each process gets at about half the drive’s bandwidth (60 MB/s). +示例 1-3、1-4、2-3 和 2-4 表明,当在同一驱动器上并行完成两次读取或写入时,每个进程的驱动器带宽大约为一半(60 MB/s)。 -The 3-x examples show the performance benefit of putting the two drives together in a RAID0 (data stripping) array. The numbers, in all cases, show that the RAID0 array performs about twice as fast as either drive is able to perform on its own. The trade-off is that you are twice as likely to lose everything because each drive only contains half the data. A three-drive array would perform three times as fast as a single drive (all drives being equal) but it would be thrice as likely to suffer a [catastrophic failure][6]. +3-X 示例显示了将两个驱动器放在 RAID0(数据条带化)阵列中的性能优势。在所有情况下,这些数字表明 RAID0 阵列的执行速度是任何一个驱动器能够独立提供的速度的两倍。相应的是,丢失所有内容的可能性也是两倍,因为每个驱动器只包含一半的数据。一个三个驱动器阵列的执行速度是单个驱动器的三倍(所有驱动器规格都相同),但遭受[灾难性故障][6]的可能也是三倍。 -The 4-x examples show that the performance of the RAID1 (data mirroring) array is similar to that of a single disk except for the case where multiple processes are concurrently reading (example 4-3). In the case of multiple processes reading, the performance of the RAID1 array is similar to that of the RAID0 array. This means that you will see a performance benefit with RAID1, but only when processes are reading concurrently. For example, if a process tries to access a large number of files in the background while you are trying to use a web browser or email client in the foreground. The main benefit of RAID1 is that your data is unlikely to be lost [if a drive fails][7]. +4-X 示例显示 RAID1(数据镜像)阵列的性能类似于单个磁盘的性能,除了多个进程同时读取的情况(示例4-3)。在多个进程读取的情况下,RAID1 阵列的性能类似于 RAID0 阵列的性能。这意味着你将看到 RAID1 的性能优势,但仅限于进程同时读取时。例如,当你在前台使用 Web 浏览器或电子邮件客户端时,进程会尝试访问后台中的大量文件。RAID1 的主要好处是,[如果驱动器出现故障][7],你的数据不太可能丢失。 -### Video demo +### 故障排除 -Testing storage throughput using dd - -### Troubleshooting - -If the above tests aren’t performing as you expect, you might have a bad or failing drive. Most modern hard drives have built-in Self-Monitoring, Analysis and Reporting Technology ([SMART][8]). If your drive supports it, the _smartctl_ command can be used to query your hard drive for its internal statistics: +如果上述测试未按预期执行,则可能是驱动器坏了或出现故障。大多数现代硬盘都内置了自我监控、分析和报告技术([SMART][8])。如果你的驱动器支持它,`smartctl` 命令可用于查询你的硬盘驱动器的内部统计信息: ``` # smartctl --health /dev/sda @@ -363,21 +349,21 @@ If the above tests aren’t performing as you expect, you might have a bad or fa # smartctl -x /dev/sda ``` -Another way that you might be able to tune your PC for better performance is by changing your [I/O scheduler][9]. Linux systems support several I/O schedulers and the current default for Fedora systems is the [multiqueue][10] variant of the [deadline][11] scheduler. The default performs very well overall and scales extremely well for large servers with many processors and large disk arrays. There are, however, a few more specialized schedulers that might perform better under certain conditions. +另一种可以调整 PC 以获得更好性能的方法是更改 [I/O 调度程序][9]。Linux 系统支持多个 I/O 调度程序,Fedora 系统的当前默认值是 [deadline][11] 调度程序的 [multiqueue][10] 变体。默认情况下它的整体性能非常好,并且对于具有许多处理器和大型磁盘阵列的大型服务器,其扩展性极为出色。但是,有一些更专业的调度程序在某些条件下可能表现更好。 -To view which I/O scheduler your drives are using, issue the following command: +要查看驱动器正在使用的 I/O 调度程序,请运行以下命令: ``` $ for i in /sys/block/sd?/queue/scheduler; do echo "$i: $(<$i)"; done ``` -You can change the scheduler for a drive by writing the name of the desired scheduler to the /sys/block//queue/scheduler file: +你可以通过将所需调度程序的名称写入 `/sys/block//queue/scheduler` 文件来更改驱动器的调度程序: ``` # echo bfq > /sys/block/sda/queue/scheduler ``` -You can make your changes permanent by creating a [udev rule][12] for your drive. The following example shows how to create a udev rule that will set all [rotational drives][13] to use the [BFQ][14] I/O scheduler: +你可以通过为驱动器创建 [udev 规则][12]来永久更改它。以下示例显示了如何创建将所有的[旋转式驱动器][13]设置为使用 [BFQ][14] I/O 调度程序的 udev 规则: ``` # cat << END > /etc/udev/rules.d/60-ioscheduler-rotational.rules @@ -385,7 +371,7 @@ ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue END ``` -Here is another example that sets all [solid-state drives][15] to use the [NOOP][16] I/O scheduler: +这是另一个设置所有的[固态驱动器][15]使用 [NOOP][16] I/O 调度程序的示例: ``` # cat << END > /etc/udev/rules.d/60-ioscheduler-solid-state.rules @@ -393,11 +379,7 @@ ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue END ``` -Changing your I/O scheduler won’t affect the raw throughput of your devices, but it might make your PC seem more responsive by prioritizing the bandwidth for the foreground tasks over the background tasks or by eliminating unnecessary block reordering. - -* * * - -_Photo by _[ _James Donovan_][17]_ on _[_Unsplash_][18]_._ +更改 I/O 调度程序不会影响设备的原始吞吐量,但通过优先考虑后台任务的带宽或消除不必要的块重新排序,可能会使你的 PC 看起来响应更快。 -------------------------------------------------------------------------------- @@ -405,8 +387,8 @@ via: https://fedoramagazine.org/check-storage-performance-with-dd/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201908/20190611 What is a Linux user.md b/published/201908/20190611 What is a Linux user.md new file mode 100644 index 0000000000..e3cd069b2b --- /dev/null +++ b/published/201908/20190611 What is a Linux user.md @@ -0,0 +1,57 @@ +[#]: collector: "lujun9972" +[#]: translator: "qfzy1233 " +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11231-1.html" +[#]: subject: "What is a Linux user?" +[#]: via: "https://opensource.com/article/19/6/what-linux-user" +[#]: author: "Anderson Silva https://opensource.com/users/ansilva/users/petercheer/users/ansilva/users/greg-p/users/ansilva/users/ansilva/users/bcotton/users/ansilva/users/seth/users/ansilva/users/don-watkins/users/ansilva/users/seth" + +何谓 Linux 用户? +====== + +> “Linux 用户”这一定义已经拓展到了更大的范围,同时也发生了巨大的改变。 + +![](https://img.linux.net.cn/data/attachment/album/201908/15/211706trkbzp8juhbzifia.jpg) + +*编者按: 本文更新于 2019 年 6 月 11 日下午 1:15:19,以更准确地反映作者对 Linux 社区中开放和包容的社区性的看法。* + +再有不到两年,Linux 内核就要迎来它 30 岁的生日了。让我们回想一下!1991 年的时候你在哪里?你出生了吗?那年我 13 岁!在 1991 到 1993 年间只推出了少数几款 Linux 发行版,至少它们中的三个:Slackware、Debian 和 Red Hat 为 Linux 运动发展提供了[支柱][2]。 + +当年获得 Linux 发行版的副本,并在笔记本或服务器上进行安装和配置,和今天相比是很不一样的。当时是十分艰难的!也是令人沮丧的!如果你让能让它运行起来,就是一个了不起的成就!我们不得不与不兼容的硬件、设备上的配置跳线、BIOS 问题以及许多其他问题作斗争。甚至即使硬件是兼容的,很多时候,你仍然需要编译内核、模块和驱动程序才能让它们在你的系统上工作。 + +如果你当时经过过那些,你可能会表示赞同。有些读者甚至称它们为“美好的过往”,因为选择使用 Linux 意味着仅仅是为了让操作系统继续运行,你就必须学习操作系统、计算机体系架构、系统管理、网络,甚至编程。但我并不赞同他们的说法,窃以为:Linux 在 IT 行业带给我们的最让人惊讶的改变就是,它成为了我们每个人技术能力的基础组成部分! + +将近 30 年过去了,无论是桌面和服务器领域 Linux 系统都有了脱胎换骨的变换。你可以在汽车上,在飞机上,家用电器上,智能手机上……几乎任何地方发现 Linux 的影子!你甚至可以购买预装 Linux 的笔记本电脑、台式机和服务器。如果你考虑云计算,企业甚至个人都可以一键部署 Linux 虚拟机,由此可见 Linux 的应用已经变得多么普遍了。 + +考虑到这些,我想问你的问题是:**这个时代如何定义“Linux 用户”?** + +如果你从 System76 或 Dell 为你的父母或祖父母购买一台 Linux 笔记本电脑,为其登录好他们的社交媒体和电子邮件,并告诉他们经常单击“系统升级”,那么他们现在就是 Linux 用户了。如果你是在 Windows 或 MacOS 机器上进行以上操作,那么他们就是 Windows 或 MacOS 用户。令人难以置信的是,与 90 年代不同,现在的 Linux 任何人都可以轻易上手。 + +由于种种原因,这也归因于 web 浏览器成为了桌面计算机上的“杀手级应用程序”。现在,许多用户并不关心他们使用的是什么操作系统,只要他们能够访问到他们的应用程序或服务。 + +你知道有多少人经常使用他们的电话、桌面或笔记本电脑,但不会管理他们系统上的文件、目录和驱动程序?又有多少人不会安装“应用程序商店”没有收录的二进制文件程序?更不要提从头编译应用程序,对我来说,几乎全是这样的。这正是成熟的开源软件和相应的生态对于易用性的改进的动人之处。 + +今天的 Linux 用户不需要像上世纪 90 年代或 21 世纪初的 Linux 用户那样了解、学习甚至查询信息,这并不是一件坏事。过去那种认为 Linux 只适合工科男使用的想法已经一去不复返了。 + +对于那些对计算机、操作系统以及在自由软件上创建、使用和协作的想法感兴趣、好奇、着迷的 Linux 用户来说,Liunx 依旧有研究的空间。如今在 Windows 和 MacOS 上也有同样多的空间留给创造性的开源贡献者。今天,成为 Linux 用户就是成为一名与 Linux 系统同行的人。这是一件很棒的事情。 + +### Linux 用户定义的转变 + +当我开始使用 Linux 时,作为一个 Linux 用户意味着知道操作系统如何以各种方式、形态和形式运行。Linux 在某种程度上已经成熟,这使得“Linux 用户”的定义可以包含更广泛的领域及那些领域里的人们。这可能是显而易见的一点,但重要的还是要说清楚:任何 Linux 用户皆“生”而平等。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/what-linux-user + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva/users/petercheer/users/ansilva/users/greg-p/users/ansilva/users/ansilva/users/bcotton/users/ansilva/users/seth/users/ansilva/users/don-watkins/users/ansilva/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 +[2]: https://en.wikipedia.org/wiki/Linux_distribution#/media/File:Linux_Distribution_Timeline.svg diff --git a/published/201908/20190613 Continuous integration testing for the Linux kernel.md b/published/201908/20190613 Continuous integration testing for the Linux kernel.md new file mode 100644 index 0000000000..38f262eabe --- /dev/null +++ b/published/201908/20190613 Continuous integration testing for the Linux kernel.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11176-1.html) +[#]: subject: (Continuous integration testing for the Linux kernel) +[#]: via: (https://opensource.com/article/19/6/continuous-kernel-integration-linux) +[#]: author: (Major Hayden https://opensource.com/users/mhayden) + +Linux 内核的持续集成测试 +====== + +> CKI 团队是如何防止 bug 被合并到 Linux 内核中。 + +![](https://img.linux.net.cn/data/attachment/album/201908/02/112520aidijdddo9wwvbiv.jpg) + +Linux 内核的每个发布版本包含了来自 1,700 个开发者产生的 14,000 个变更集,很显然,这使得 Linux 内核快速迭代的同时也产生了巨大的复杂性问题。内核上 Bug 有小麻烦也有大问题,有时是系统崩溃,有时是数据丢失。 + +随着越来越多的项目对于持续集成(CI)的呼声,[内核持续集成(CKI)][2]小组秉承着一个任务目标:防止 Bug 被合并到内核当中。 + +### Linux 测试问题 + +许多 Linux 发行版只在需要的时候对 Linux 内核进行测试。而这种测试往往只在版本发布时或者用户发现错误时进行。 + +有时候,出现玄学问题时,维护人员需要在包含了数万个补丁的变更中匆忙地寻找哪个补丁导致这个新的玄学 Bug。诊断 Bug 需要专业的硬件设备、一系列的触发器以及内核相关的专业知识。 + +#### CI 和 Linux + +许多现代软件代码库都采用某种自动化 CI 测试机制,能够在提交进入代码存储库之前对其进行测试。这种自动化测试使得维护人员可以通过查看 CI 测试报告来发现软件质量问题以及大多数的错误。一些简单的项目,比如某个 Python 库,附带的大量工具使得整个检查过程更简单。 + +在任何测试之前都需要配置和编译 Linux。而这么做将耗费大量的时间和计算资源。此外,Linux 内核必需在虚拟机或者裸机上启动才能进行测试。而访问某些硬件架构需要额外的开销或者非常慢的仿真。因此,人们必须确定一组能够触发错误或者验证修复的测试集。 + +#### CKI 团队如何运作? + +Red Hat 公司的 CKI 团队当前正追踪来自数个内部内核分支和上游的[稳定内核分支树][3]等内核分支的更改。我们关注每个代码库的两类关键事件: + + 1. 当维护人员合并 PR 或者补丁时,代码库变化后的最终结果。 + 2. 当开发人员通过拼凑或者稳定补丁队列发起变更合并时。 + +当这些事件发生时,自动化工具开始执行,[GitLab CI 管道][4]开始进行测试。一旦管道开始执行 [linting][5] 脚本、合并每一个补丁,并为多种硬件架构编译内核,真正的测试便开始了。我们会在六分钟内完成四种硬件架构的内核编译工作,并且通常会在两个小时或更短的时间内将反馈提交到稳定邮件列表中。(自 2019 年 1 月起)每月执行超过 100,000 次内核测试,并完成了超过 11,000 个 GitLab 管道。 + +每个内核都会在本地硬件架构上启动,其中包含: + +* [aarch64][6]:64 位 [ARM][7],例如 [Cavium(当前是 Marvell)ThunderX][8]。 +* [ppc64/ppc64le][9]:大端和小端的 [IBM POWER][10] 系统。 +* [s390x][11]:[IBM Zseries][12] 大型机 +* [x86_64][13]:[Intel][14] 和 [AMD][15] 工作站、笔记本和服务器。 + +这些内核上运行了包括 [Linux 测试项目(LTP)][16]在内的多个测试,其中包括使用常用测试工具的大量测试。我们 CKI 团队开源了超过 44 个测试并将继续开源更多测试。 + +### 参与其中 + +上游的内核测试工作日渐增多。包括 [Google][17]、Intel、[Linaro][18] 和 [Sony][19] 在内的许多公司为各种内核提供了测试输出。每一项工作都专注于为上游内核以及每个公司的客户群带来价值。 + +如果你或者你的公司想要参与这一工作,请参加在 9 月份在葡萄牙里斯本举办的 [Linux Plumbers Conference 2019][20]。在会议结束后的两天加入我们的 Kernel CI hackfest 活动,并推动快速内核测试的发展。 + +更多详细信息,[请见][21]我在 Texas Linux Fest 2019 上的演讲。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/continuous-kernel-integration-linux + +作者:[Major Hayden][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mhayden +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_kernel_clang_vscode.jpg?itok=fozZ4zrr "Linux kernel source code (C) in Visual Studio Code" +[2]: https://cki-project.org/ +[3]: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html +[4]: https://docs.gitlab.com/ee/ci/pipelines.html +[5]: https://en.wikipedia.org/wiki/Lint_(software) +[6]: https://en.wikipedia.org/wiki/ARM_architecture +[7]: https://www.arm.com/ +[8]: https://www.marvell.com/server-processors/thunderx-arm-processors/ +[9]: https://en.wikipedia.org/wiki/Ppc64 +[10]: https://www.ibm.com/it-infrastructure/power +[11]: https://en.wikipedia.org/wiki/Linux_on_z_Systems +[12]: https://www.ibm.com/it-infrastructure/z +[13]: https://en.wikipedia.org/wiki/X86-64 +[14]: https://www.intel.com/ +[15]: https://www.amd.com/ +[16]: https://github.com/linux-test-project/ltp +[17]: https://www.google.com/ +[18]: https://www.linaro.org/ +[19]: https://www.sony.com/ +[20]: https://www.linuxplumbersconf.org/ +[21]: https://docs.google.com/presentation/d/1T0JaRA0wtDU0aTWTyASwwy_ugtzjUcw_ZDmC5KFzw-A/edit?usp=sharing diff --git a/sources/tech/20190617 How To Check Linux Package Version Before Installing It.md b/published/201908/20190617 How To Check Linux Package Version Before Installing It.md similarity index 55% rename from sources/tech/20190617 How To Check Linux Package Version Before Installing It.md rename to published/201908/20190617 How To Check Linux Package Version Before Installing It.md index 0ce1a510ac..574b0bb031 100644 --- a/sources/tech/20190617 How To Check Linux Package Version Before Installing It.md +++ b/published/201908/20190617 How To Check Linux Package Version Before Installing It.md @@ -1,38 +1,38 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11243-1.html) [#]: subject: (How To Check Linux Package Version Before Installing It) [#]: via: (https://www.ostechnix.com/how-to-check-linux-package-version-before-installing-it/) [#]: author: (sk https://www.ostechnix.com/author/sk/) -How To Check Linux Package Version Before Installing It +如何在安装之前检查 Linux 软件包的版本? ====== ![Check Linux Package Version][1] -Most of you will know how to [**find the version of an installed package**][2] in Linux. But, what would you do to find the packages’ version which are not installed in the first place? No problem! This guide describes how to check Linux package version before installing it in Debian and its derivatives like Ubuntu. This small tip might be helpful for those wondering what version they would get before installing a package. +大多数人都知道如何在 Linux 中[查找已安装软件包的版本][2],但是,你会如何查找那些还没有安装的软件包的版本呢?很简单!本文将介绍在 Debian 及其衍生品(如 Ubuntu)中,如何在软件包安装之前检查它的版本。对于那些想在安装之前知道软件包版本的人来说,这个小技巧可能会有所帮助。 -### Check Linux Package Version Before Installing It +### 在安装之前检查 Linux 软件包版本 -There are many ways to find a package’s version even if it is not installed already in DEB-based systems. Here I have given a few methods. +在基于 DEB 的系统中,即使软件包还没有安装,也有很多方法可以查看他的版本。接下来,我将一一介绍。 -##### Method 1 – Using Apt +#### 方法 1 – 使用 Apt -The quick and dirty way to check a package version, simply run: +检查软件包的版本的懒人方法: ``` $ apt show ``` -**Example:** +**示例:** ``` $ apt show vim ``` -**Sample output:** +**示例输出:** ``` Package: vim @@ -67,23 +67,21 @@ Description: Vi IMproved - enhanced vi editor N: There is 1 additional record. Please use the '-a' switch to see it ``` -As you can see in the above output, “apt show” command displays, many important details of the package such as, +正如你在上面的输出中看到的,`apt show` 命令显示了软件包许多重要的细节,例如: - 1. package name, - 2. version, - 3. origin (from where the vim comes from), - 4. maintainer, - 5. home page of the package, - 6. dependencies, - 7. download size, - 8. description, - 9. and many. + 1. 包名称, + 2. 版本, + 3. 来源(vim 来自哪里), + 4. 维护者, + 5. 包的主页, + 6. 依赖, + 7. 下载大小, + 8. 简介, + 9. 其他。 +因此,Ubuntu 仓库中可用的 Vim 版本是 **8.0.1453**。如果我把它安装到我的 Ubuntu 系统上,就会得到这个版本。 - -So, the available version of Vim package in the Ubuntu repositories is **8.0.1453**. This is the version I get if I install it on my Ubuntu system. - -Alternatively, use **“apt policy”** command if you prefer short output: +或者,如果你不想看那么多的内容,那么可以使用 `apt policy` 这个命令: ``` $ apt policy vim @@ -98,7 +96,7 @@ vim: 500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages ``` -Or even shorter: +甚至更短: ``` $ apt list vim @@ -107,17 +105,17 @@ vim/bionic-updates,bionic-security 2:8.0.1453-1ubuntu1.1 amd64 N: There is 1 additional version. Please use the '-a' switch to see it ``` -**Apt** is the default package manager in recent Ubuntu versions. So, this command is just enough to find the detailed information of a package. It doesn’t matter whether given package is installed or not. This command will simply list the given package’s version along with all other details. +`apt` 是 Ubuntu 最新版本的默认包管理器。因此,这个命令足以找到一个软件包的详细信息,给定的软件包是否安装并不重要。这个命令将简单地列出给定包的版本以及其他详细信息。 -##### Method 2 – Using Apt-get +#### 方法 2 – 使用 Apt-get -To find a package version without installing it, we can use **apt-get** command with **-s** option. +要查看软件包的版本而不安装它,我们可以使用 `apt-get` 命令和 `-s` 选项。 ``` $ apt-get -s install vim ``` -**Sample output:** +**示例输出:** ``` NOTE: This is only a simulation! @@ -136,19 +134,19 @@ Inst vim (2:8.0.1453-1ubuntu1.1 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic Conf vim (2:8.0.1453-1ubuntu1.1 Ubuntu:18.04/bionic-updates, Ubuntu:18.04/bionic-security [amd64]) ``` -Here, -s option indicates **simulation**. As you can see in the output, It performs no action. Instead, It simply performs a simulation to let you know what is going to happen when you install the Vim package. +这里,`-s` 选项代表 **模拟**。正如你在输出中看到的,它不执行任何操作。相反,它只是模拟执行,好让你知道在安装 Vim 时会发生什么。 -You can substitute “install” option with “upgrade” option to see what will happen when you upgrade a package. +你可以将 `install` 选项替换为 `upgrade`,以查看升级包时会发生什么。 ``` $ apt-get -s upgrade vim ``` -##### Method 3 – Using Aptitude +#### 方法 3 – 使用 Aptitude -**Aptitude** is an ncurses and commandline-based front-end to APT package manger in Debian and its derivatives. +在 Debian 及其衍生品中,`aptitude` 是一个基于 ncurses(LCTT 译注:ncurses 是终端基于文本的字符处理的库)和命令行的前端 APT 包管理器。 -To find the package version with Aptitude, simply run: +使用 aptitude 来查看软件包的版本,只需运行: ``` $ aptitude versions vim @@ -156,7 +154,7 @@ p 2:8.0.1453-1ubuntu1 p 2:8.0.1453-1ubuntu1.1 bionic-security,bionic-updates 500 ``` -You can also use simulation option ( **-s** ) to see what would happen if you install or upgrade package. +你还可以使用模拟选项(`-s`)来查看安装或升级包时会发生什么。 ``` $ aptitude -V -s install vim @@ -167,33 +165,29 @@ Need to get 1,152 kB of archives. After unpacking 2,852 kB will be used. Would download/install/remove packages. ``` -Here, **-V** flag is used to display detailed information of the package version. - -Similarly, just substitute “install” with “upgrade” option to see what would happen if you upgrade a package. +这里,`-V` 标志用于显示软件包的详细信息。 ``` $ aptitude -V -s upgrade vim ``` -Another way to find the non-installed package’s version using Aptitude command is: +类似的,只需将 `install` 替换为 `upgrade` 选项,即可查看升级包会发生什么。 ``` $ aptitude search vim -F "%c %p %d %V" ``` -Here, +这里, - * **-F** is used to specify which format should be used to display the output, - * **%c** – status of the given package (installed or not installed), - * **%p** – name of the package, - * **%d** – description of the package, - * **%V** – version of the package. + * `-F` 用于指定应使用哪种格式来显示输出, + * `%c` – 包的状态(已安装或未安装), + * `%p` – 包的名称, + * `%d` – 包的简介, + * `%V` – 包的版本。 +当你不知道完整的软件包名称时,这非常有用。这个命令将列出包含给定字符串(即 vim)的所有软件包。 - -This is helpful when you don’t know the full package name. This command will list all packages that contains the given string (i.e vim). - -Here is the sample output of the above command: +以下是上述命令的示例输出: ``` [...] @@ -207,17 +201,17 @@ p vim-voom Vim two-pane out p vim-youcompleteme fast, as-you-type, fuzzy-search code completion engine for Vim 0+20161219+git ``` -##### Method 4 – Using Apt-cache +#### 方法 4 – 使用 Apt-cache -**Apt-cache** command is used to query APT cache in Debian-based systems. It is useful for performing many operations on APT’s package cache. One fine example is we can [**list installed applications from a certain repository/ppa**][3]. +`apt-cache` 命令用于查询基于 Debian 的系统中的 APT 缓存。对于要在 APT 的包缓存上执行很多操作时,它很有用。一个很好的例子是我们可以从[某个仓库或 ppa 中列出已安装的应用程序][3]。 -Not just installed applications, we can also find the version of a package even if it is not installed. For instance, the following command will find the version of Vim package: +不仅是已安装的应用程序,我们还可以找到软件包的版本,即使它没有被安装。例如,以下命令将找到 Vim 的版本: ``` $ apt-cache policy vim ``` -Sample output: +示例输出: ``` vim: @@ -231,19 +225,19 @@ vim: 500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages ``` -As you can see in the above output, Vim is not installed. If you wanted to install it, you would get version **8.0.1453**. It also displays from which repository the vim package is coming from. +正如你在上面的输出中所看到的,Vim 并没有安装。如果你想安装它,你会知道它的版本是 **8.0.1453**。它还显示 vim 包来自哪个仓库。 -##### Method 5 – Using Apt-show-versions +#### 方法 5 – 使用 Apt-show-versions -**Apt-show-versions** command is used to list installed and available package versions in Debian and Debian-based systems. It also displays the list of all upgradeable packages. It is quite handy if you have a mixed stable/testing environment. For instance, if you have enabled both stable and testing repositories, you can easily find the list of applications from testing and also you can upgrade all packages in testing. +在 Debian 和基于 Debian 的系统中,`apt-show-versions` 命令用于列出已安装和可用软件包的版本。它还显示所有可升级软件包的列表。如果你有一个混合的稳定或测试环境,这是非常方便的。例如,如果你同时启用了稳定和测试仓库,那么你可以轻松地从测试库找到应用程序列表,还可以升级测试库中的所有软件包。 -Apt-show-versions is not installed by default. You need to install it using command: +默认情况下系统没有安装 `apt-show-versions`,你需要使用以下命令来安装它: ``` $ sudo apt-get install apt-show-versions ``` -Once installed, run the following command to find the version of a package,for example Vim: +安装后,运行以下命令查找软件包的版本,例如 Vim: ``` $ apt-show-versions -a vim @@ -253,15 +247,15 @@ vim:amd64 2:8.0.1453-1ubuntu1.1 bionic-updates archive.ubuntu.com vim:amd64 not installed ``` -Here, **-a** switch prints all available versions of the given package. +这里,`-a` 选项打印给定软件包的所有可用版本。 -If the given package is already installed, you need not to use **-a** option. In that case, simply run: +如果已经安装了给定的软件包,那么就不需要使用 `-a` 选项。在这种情况下,只需运行: ``` $ apt-show-versions vim ``` -And, that’s all. If you know any other methods, please share them in the comment section below. I will check and update this guide. +差不多完了。如果你还了解其他方法,在下面的评论中分享,我将检查并更新本指南。 -------------------------------------------------------------------------------- @@ -269,8 +263,8 @@ via: https://www.ostechnix.com/how-to-check-linux-package-version-before-install 作者:[sk][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201908/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md b/published/201908/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md new file mode 100644 index 0000000000..85b9e0ff98 --- /dev/null +++ b/published/201908/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11182-1.html) +[#]: subject: (Enable ‘Tap to click’ on Ubuntu Login Screen [Quick Tip]) +[#]: via: (https://itsfoss.com/enable-tap-to-click-on-ubuntu-login-screen/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 登录屏幕上启用轻击 +====== + +> 轻击tap to click选项在 Ubuntu 18.04 GNOME 桌面的登录屏幕上不起作用。在本教程中,你将学习如何在 Ubuntu 登录屏幕上启用“轻击”。 + +安装 Ubuntu 后我做的第一件事就是确保启用了轻击功能。作为笔记本电脑用户,我更喜欢轻击触摸板进行左键单击。这比使用触摸板上的左键单击按钮更方便。 + +我登录并使用操作系统时可以轻击。但是,如果你在登录屏幕上,轻击不起作用,这是一个烦恼。 + +在 Ubuntu(或使用 GNOME 桌面的其他发行版)的 [GDM 登录屏幕][1]上,你必须单击用户名才能显示密码字段。现在,如果你习惯了轻击,即使你已启用了它并在登录系统后可以使用,它也无法在登录屏幕上运行。 + +这是一个轻微的烦恼,但仍然是一个烦恼。好消息是你可以解决这个烦恼。让我告诉你如何在这个快速提示中做到这一点。 + +### 在 Ubuntu 登录屏幕上启用轻击 + +![][2] + +你必须在这里使用终端和一些命令。我希望你能够适应。 + +[在 Ubuntu 中使用 Ctrl + Alt + T 快捷键打开终端][3]。由于 Ubuntu 18.04 仍在使用 X 显示服务器,因此需要启用它才能连接到 [X 服务器][4]。为此,你可以将 `gdm` 添加到访问控制列表中。 + +首先切换到 `root` 用户。这是必需的,因为你必须稍后切换为 `gdm` 用户,而不能以非 `root` 用户身份执行此操作。 + +``` +sudo -i +``` + +[在 Ubuntu 中没有为 root 用户设置密码][5]。你可以使用管理员用户帐户访问它。因此,当要求输入密码时,请使用你自己的密码。输入密码时,屏幕上不会显示任何输入内容。 + +``` +xhost +SI:localuser:gdm +``` + +这是我的输出: + +``` +xhost +SI:localuser:gdm +localuser:gdm being added to access control list +``` + +现在运行此命令,以便 `gdm` 用户具有正确的轻击设置。 + +``` +gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true +``` + +如果你看到这样的警告:`(process:6339): dconf-WARNING **: 19:52:21.217: Unable to open /root/.local/share/flatpak/exports/share/dconf/profile/user: Permission denied`。别担心。忽略它就行。 + +[][6] + +这将使你能够轻击登录屏幕。为什么在系统设置中进行更改之前无法使用轻击?这是因为在登录屏幕上,你还没有选择用户名。只有在屏幕上选择用户时才能使用你的帐户。这就是你必须使用用户 `gdm` 并使用它添加正确设置的原因。 + +重新启动 Ubuntu,你会看到现在可以使用轻击来选择你的用户帐户。 + +#### 还原改变 + +如果你因为某些原因不喜欢在 Ubuntu 登录界面轻击,可以还原更改。 + +你必须执行上一节中的所有步骤:切换到 `root`,将 `gdm` 与 X 服务器连接,切换到 `gdm` 用户。但是,你需要运行此命令,而不是上一个命令: + +``` +gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click false +``` + +就是这样。 + +正如我所说,这是一件小事。我的意思是你可以轻松地点击左键而不是轻击。这只是一次单击的问题。但是,当你在几次轻击后被迫使用左键单击时,它会打破操作“连续性”。 + +我希望你喜欢这个快速的小调整。如果你知道其他一些很酷的调整,请与我们分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/enable-tap-to-click-on-ubuntu-login-screen/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.archlinux.org/index.php/GDM +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/tap-to-click-on-ubuntu-login.jpg?ssl=1 +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://en.wikipedia.org/wiki/X.Org_Server +[5]: https://itsfoss.com/change-password-ubuntu/ +[6]: https://itsfoss.com/change-hostname-ubuntu/ diff --git a/published/201908/20190706 Install NetData Performance Monitoring Tool On Linux.md b/published/201908/20190706 Install NetData Performance Monitoring Tool On Linux.md new file mode 100644 index 0000000000..5a5dc8d958 --- /dev/null +++ b/published/201908/20190706 Install NetData Performance Monitoring Tool On Linux.md @@ -0,0 +1,306 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11173-1.html) +[#]: subject: (Install NetData Performance Monitoring Tool On Linux) +[#]: via: (https://www.ostechnix.com/netdata-real-time-performance-monitoring-tool-linux/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +在 Linux 上安装 NetData 性能监控工具 +====== + +![][1] + +**NetData** 是一个用于系统和应用的分布式实时性能和健康监控工具。它提供了对系统中实时发生的所有事情的全面检测。你可以在高度互动的 Web 仪表板中查看结果。使用 Netdata,你可以清楚地了解现在发生的事情,以及之前系统和应用中发生的事情。你无需成为专家即可在 Linux 系统中部署此工具。NetData 开箱即用,零配置、零依赖。只需安装它然后坐等,之后 NetData 将负责其余部分。 + +它有自己的内置 Web 服务器,以图形形式显示结果。NetData 非常快速高效,安装后可立即开始分析系统性能。它是用 C 编程语言编写的,所以它非常轻量。它占用的单核 CPU 使用率不到 3%,内存占用 10-15MB。我们可以轻松地在任何现有网页上嵌入图表,并且它还有一个插件 API,以便你可以监控任何应用。 + +以下是 Linux 系统中 NetData 的监控列表。 + +* CPU 使用率 +* RAM 使用率 +* 交换内存使用率 +* 内核内存使用率 +* 硬盘及其使用率 +* 网络接口 +* IPtables +* Netfilter +* DDoS 保护 +* 进程 +* 应用 +* NFS 服务器 +* Web 服务器 (Apache 和 Nginx) +* 数据库服务器 (MySQL), +* DHCP 服务器 +* DNS 服务器 +* 电子邮件服务 +* 代理服务器 +* Tomcat +* PHP +* SNP 设备 +* 等等 + +NetData 是自由开源工具,它支持 Linux、FreeBSD 和 Mac OS。 + +### 在 Linux 上安装 NetData + +Netdata 可以安装在任何安装了 Bash 的 Linux 发行版上。 + +最简单的安装 Netdata 的方法是从终端运行以下命令: + +``` +$ bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) +``` + +这将下载并安装启动和运行 Netdata 所需的一切。 + +有些用户可能不想在没有研究的情况下将某些东西直接注入到 Bash。如果你不喜欢此方法,可以按照以下步骤在系统上安装它。 + +#### 在 Arch Linux 上 + +Arch Linux 默认仓库中提供了最新版本。所以,我们可以使用以下 [pacman][2] 命令安装它: + +``` +$ sudo pacman -S netdata +``` + +#### 在基于 DEB 和基于 RPM 的系统上 + +在基于 DEB (Ubuntu / Debian)或基于 RPM(RHEL / CentOS / Fedora) 系统的默认仓库没有 NetData。我们需要从它的 Git 仓库手动安装 NetData。 + +首先安装所需的依赖项: + +``` +# Debian / Ubuntu +$ sudo apt-get install zlib1g-dev uuid-dev libuv1-dev liblz4-dev libjudy-dev libssl-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl + +# Fedora +$ sudo dnf install zlib-devel libuuid-devel libuv-devel lz4-devel Judy-devel openssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils + +# CentOS / Red Hat Enterprise Linux +$ sudo yum install epel-release +$ sudo yum install autoconf automake curl gcc git libmnl-devel libuuid-devel openssl-devel libuv-devel lz4-devel Judy-devel lm_sensors make MySQL-python nc pkgconfig python python-psycopg2 PyYAML zlib-devel + +# openSUSE +$ sudo zypper install zlib-devel libuuid-devel libuv-devel liblz4-devel judy-devel openssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils +``` + +安装依赖项后,在基于 DEB 或基于 RPM 的系统上安装 NetData,如下所示。 + +Git 克隆 NetData 仓库: + +``` +$ git clone https://github.com/netdata/netdata.git --depth=100 +``` + +上面的命令将在当前工作目录中创建一个名为 `netdata` 的目录。 + +切换到 `netdata` 目录: + +``` +$ cd netdata/ +``` + +最后,使用命令安装并启动 NetData: + +``` +$ sudo ./netdata-installer.sh +``` + +**示例输出:** + +``` +Welcome to netdata! +Nice to see you are giving it a try! + +You are about to build and install netdata to your system. + +It will be installed at these locations: + +- the daemon at /usr/sbin/netdata + - config files at /etc/netdata + - web files at /usr/share/netdata + - plugins at /usr/libexec/netdata + - cache files at /var/cache/netdata + - db files at /var/lib/netdata + - log files at /var/log/netdata + - pid file at /var/run + +This installer allows you to change the installation path. +Press Control-C and run the same command with --help for help. + +Press ENTER to build and install netdata to your system > ## Press ENTER key +``` + +安装完成后,你将在最后看到以下输出: + +``` +------------------------------------------------------------------------------- + +OK. NetData is installed and it is running (listening to *:19999). + +------------------------------------------------------------------------------- + +INFO: Command line options changed. -pidfile, -nd and -ch are deprecated. +If you use custom startup scripts, please run netdata -h to see the +corresponding options and update your scripts. + +Hit http://localhost:19999/ from your browser. + +To stop netdata, just kill it, with: + +killall netdata + +To start it, just run it: + +/usr/sbin/netdata + + +Enjoy! + +Uninstall script generated: ./netdata-uninstaller.sh +``` + +![][3] + +*安装 NetData* + +NetData 已安装并启动。 + +要在其他 Linux 发行版上安装 Netdata,请参阅[官方安装说明页面][4]。 + +### 在防火墙或者路由器上允许 NetData 的默认端口 + +如果你的系统在防火墙或者路由器后面,那么必须允许默认端口 `19999` 以便从任何远程系统访问 NetData 的 web 界面。 + +#### 在 Ubuntu/Debian 中 + +``` +$ sudo ufw allow 19999 +``` + +#### 在 CentOS/RHEL/Fedora 中 + +``` +$ sudo firewall-cmd --permanent --add-port=19999/tcp + +$ sudo firewall-cmd --reload +``` + +### 启动/停止 NetData + +要在使用 Systemd 的系统上启用和启动 Netdata 服务,请运行: + +``` +$ sudo systemctl enable netdata +$ sudo systemctl start netdata +``` + +要停止: + +``` +$ sudo systemctl stop netdata +``` + +要在使用 Init 的系统上启用和启动 Netdata 服务,请运行: + +``` +$ sudo service netdata start +$ sudo chkconfig netdata on +``` + +要停止: + +``` +$ sudo service netdata stop +``` + +### 通过 Web 浏览器访问 NetData + +打开 Web 浏览器,然后打开 `http://127.0.0.1:19999` 或者 `http://localhost:19999/` 或者 `http://ip-address:19999`。你应该看到如下页面。 + +![][5] + +*Netdata 仪表板* + +在仪表板中,你可以找到 Linux 系统的完整统计信息。向下滚动以查看每个部分。 + +你可以随时打开 `http://localhost:19999/netdata.conf` 来下载和/或查看 NetData 默认配置文件。 + +![][6] + +*Netdata 配置文件* + +### 更新 NetData + +在 Arch Linux 中,只需运行以下命令即可更新 NetData。如果仓库中提供了更新版本,那么就会自动安装该版本。 + +``` +$ sudo pacman -Syyu +``` + +在基于 DEB 或 RPM 的系统中,只需进入已克隆它的目录(此例中是 `netdata`)。 + +``` +$ cd netdata +``` + +拉取最新更新: + +``` +$ git pull +``` + +然后,使用命令重新构建并更新它: + +``` +$ sudo ./netdata-installer.sh +``` + +### 卸载 NetData + +进入克隆 NetData 的文件夹。 + +``` +$ cd netdata +``` + +然后,使用命令卸载它: + +``` +$ sudo ./netdata-uninstaller.sh --force +``` + +在 Arch Linux 中,使用以下命令卸载它。 + +``` +$ sudo pacman -Rns netdata +``` + +### 资源 + +* [NetData 网站][7] +* [NetData 的 GitHub 页面][8] + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/netdata-real-time-performance-monitoring-tool-linux/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2016/06/Install-netdata-720x340.png +[2]: https://www.ostechnix.com/getting-started-pacman/ +[3]: https://www.ostechnix.com/wp-content/uploads/2016/06/Deepin-Terminal_002-6.png +[4]: https://docs.netdata.cloud/packaging/installer/ +[5]: https://www.ostechnix.com/wp-content/uploads/2016/06/Netdata-dashboard.png +[6]: https://www.ostechnix.com/wp-content/uploads/2016/06/Netdata-config-file.png +[7]: http://netdata.firehol.org/ +[8]: https://github.com/firehol/netdata diff --git a/published/201908/20190709 How to install Elasticsearch and Kibana on Linux.md b/published/201908/20190709 How to install Elasticsearch and Kibana on Linux.md new file mode 100644 index 0000000000..9b0c4c6363 --- /dev/null +++ b/published/201908/20190709 How to install Elasticsearch and Kibana on Linux.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11221-1.html) +[#]: subject: (How to install Elasticsearch and Kibana on Linux) +[#]: via: (https://opensource.com/article/19/7/install-elasticsearch-and-kibana-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux 上安装 Elasticsearch 和 Kibana +====== + +> 获取我们关于安装两者的简化说明。 + +![5 pengiuns floating on iceburg][1] + +如果你渴望学习基于开源 Lucene 库的著名开源搜索引擎 Elasticsearch,那么没有比在本地安装它更好的方法了。这个过程在 [Elasticsearch 网站][2]中有详细介绍,但如果你是初学者,官方说明就比必要的信息多得多。本文采用一种简化的方法。 + +### 添加 Elasticsearch 仓库 + +首先,将 Elasticsearch 仓库添加到你的系统,以便你可以根据需要安装它并接收更新。如何做取决于你的发行版。在基于 RPM 的系统上,例如 [Fedora][3]、[CentOS] [4]、[Red Hat Enterprise Linux(RHEL)][5] 或 [openSUSE][6],(本文任何地方引用 Fedora 或 RHEL 的也适用于 CentOS 和 openSUSE)在 `/etc/yum.repos.d/` 中创建一个名为 `elasticsearch.repo` 的仓库描述文件: + +``` +$ cat << EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md +EOF +``` + +在 Ubuntu 或 Debian 上,不要使用 `add-apt-repository` 工具。由于它自身默认的和 Elasticsearch 仓库提供的不匹配而导致错误。相反,设置这个: + +``` +$ echo "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list +``` + +在你从该仓库安装之前,导入 GPG 公钥,然后更新: + +``` +$ sudo apt-key adv --keyserver \ +hkp://keyserver.ubuntu.com:80 \ +--recv D27D666CD88E42B4 +$ sudo apt update +``` + +此存储库仅包含 Elasticsearch 的开源功能,在 [Apache 许可证][7]下发布,没有提供订阅版本的额外功能。如果你需要仅限订阅的功能(这些功能是**并不**开源),那么 `baseurl` 必须设置为: + +``` +baseurl=https://artifacts.elastic.co/packages/7.x/yum +``` + +### 安装 Elasticsearch + +你需要安装的软件包的名称取决于你使用的是开源版本还是订阅版本。本文使用开源版本,包名最后有 `-oss` 后缀。如果包名后没有 `-oss`,那么表示你请求的是仅限订阅版本。 + +如果你创建了订阅版本的仓库却尝试安装开源版本,那么就会收到“非指定”的错误。如果你创建了一个开源版本仓库却没有将 `-oss` 添加到包名后,那么你也会收到错误。 + +使用包管理器安装 Elasticsearch。例如,在 Fedora、CentOS 或 RHEL 上运行以下命令: + +``` +$ sudo dnf install elasticsearch-oss +``` + +在 Ubuntu 或 Debian 上,运行: + +``` +$ sudo apt install elasticsearch-oss +``` + +如果你在安装 Elasticsearch 时遇到错误,那么你可能安装的是错误的软件包。如果你想如本文这样使用开源包,那么请确保使用正确的 apt 仓库或在 Yum 配置正确的 `baseurl`。 + +### 启动并启用 Elasticsearch + +安装 Elasticsearch 后,你必须启动并启用它: + +``` +$ sudo systemctl daemon-reload +$ sudo systemctl enable --now elasticsearch.service +``` + +要确认 Elasticsearch 在其默认端口 9200 上运行,请在 Web 浏览器中打开 `localhost:9200`。你可以使用 GUI 浏览器,也可以在终端中执行此操作: + + +``` +$ curl localhost:9200 +{ + + "name" : "fedora30", + "cluster_name" : "elasticsearch", + "cluster_uuid" : "OqSbb16NQB2M0ysynnX1hA", + "version" : { + "number" : "7.2.0", + "build_flavor" : "oss", + "build_type" : "rpm", + "build_hash" : "508c38a", + "build_date" : "2019-06-20T15:54:18.811730Z", + "build_snapshot" : false, + "lucene_version" : "8.0.0", + "minimum_wire_compatibility_version" : "6.8.0", + "minimum_index_compatibility_version" : "6.0.0-beta1" + }, + "tagline" : "You Know, for Search" +} +``` + +### 安装 Kibana + +Kibana 是 Elasticsearch 数据可视化的图形界面。它包含在 Elasticsearch 仓库,因此你可以使用包管理器进行安装。与 Elasticsearch 本身一样,如果你使用的是 Elasticsearch 的开源版本,那么必须将 `-oss` 放到包名最后,订阅版本则不用(两者安装需要匹配): + + +``` +$ sudo dnf install kibana-oss +``` + +在 Ubuntu 或 Debian 上: + +``` +$ sudo apt install kibana-oss +``` + +Kibana 在端口 5601 上运行,因此打开图形化 Web 浏览器并进入 `localhost:5601` 来开始使用 Kibana,如下所示: + +![Kibana running in Firefox.][8] + +### 故障排除 + +如果在安装 Elasticsearch 时出现错误,请尝试手动安装 Java 环境。在 Fedora、CentOS 和 RHEL 上: + +``` +$ sudo dnf install java-openjdk-devel java-openjdk +``` + +在 Ubuntu 上: + +``` +$ sudo apt install default-jdk +``` + +如果所有其他方法都失败,请尝试直接从 Elasticsearch 服务器安装 Elasticsearch RPM: + +``` +$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.2.0-x86_64.rpm{,.sha512} +$ shasum -a 512 -c elasticsearch-oss-7.2.0-x86_64.rpm.sha512 && sudo rpm --install elasticsearch-oss-7.2.0-x86_64.rpm +``` + +在 Ubuntu 或 Debian 上,请使用 DEB 包。 + +如果你无法使用 Web 浏览器访问 Elasticsearch 或 Kibana,那么可能是你的防火墙阻止了这些端口。你可以通过调整防火墙设置来允许这些端口上的流量。例如,如果你运行的是 `firewalld`(Fedora 和 RHEL 上的默认防火墙,并且可以在 Debian 和 Ubuntu 上安装),那么你可以使用 `firewall-cmd`: + +``` +$ sudo firewall-cmd --add-port=9200/tcp --permanent +$ sudo firewall-cmd --add-port=5601/tcp --permanent +$ sudo firewall-cmd --reload +``` + +设置完成了,你可以关注我们接下来的 Elasticsearch 和 Kibana 安装文章。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/install-elasticsearch-and-kibana-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/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) +[2]: https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html +[3]: https://getfedora.org +[4]: https://www.centos.org +[5]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[6]: https://www.opensuse.org +[7]: http://www.apache.org/licenses/ +[8]: https://opensource.com/sites/default/files/uploads/kibana.jpg (Kibana running in Firefox.) diff --git a/published/201908/20190711 What is a golden image.md b/published/201908/20190711 What is a golden image.md new file mode 100644 index 0000000000..df526a9b36 --- /dev/null +++ b/published/201908/20190711 What is a golden image.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11202-1.html) +[#]: subject: (What is a golden image?) +[#]: via: (https://opensource.com/article/19/7/what-golden-image) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +什么是黄金镜像? +====== + +> 正在开发一个将广泛分发的项目吗?了解一下黄金镜像吧,以便在出现问题时轻松恢复到“完美”状态。 + +![](https://img.linux.net.cn/data/attachment/album/201908/08/184231ivv745lukchbrhul.jpg) + +如果你正在从事于质量保证、系统管理或媒体制作(没想到吧),你可能听说过正式版gold master这一术语的某些变体,如黄金镜像golden image母片master image等等。这个术语已经进入了每个参与创建**完美**模具的人的集体意识,然后从该模具中产生许多复制品。母片或黄金镜像就是:一种虚拟模具,你可以从中打造可分发的模型。 + +在媒体制作中,这就是所有人努力开发母片的过程。这个最终产品是独一无二的。它看起来和听起来像是可以看和听的最好的电影或专辑(或其他任何东西)。可以制作和压缩该母片的副本并发送给急切的公众。 + +在软件中,与该术语相关联的也是类似的意思。一旦软件经过编译和一再测试,完美的构建成果就会被声明为**黄金版本**,不允许对它进一步更改,并且所有可分发的副本都是从此母片生成的(当软件是用 CD 或 DVD 分发时,这实际上就是母盘)。 + +在系统管理中,你可能会遇到你的机构所选的操作系统的黄金镜像,其中的重要设置已经就绪,如安装好的虚拟专用网络(VPN)证书、设置好的电子邮件收件服务器的邮件客户端等等。同样,你可能也会在虚拟机(VM)的世界中听到这个术语,其中精心配置了虚拟驱动器的黄金镜像是所有克隆的新虚拟机的源头。 + +### GNOME Boxes + +正式版的概念很简单,但往往忽视将其付诸实践。有时,你的团队很高兴能够达成他们的目标,但没有人停下来考虑将这些成就指定为权威版本。在其他时候,没有简单的机制来做到这一点。 + +黄金镜像等同于部分历史的保存和提前备份计划。一旦你制作了一个完美的模型,无论你正在努力做什么,你都应该为自己保留这项工作,因为它不仅标志着你的进步,而且如果你继续工作时遇到问题,它就会成为一个后备。 + +[GNOME Boxes][2],是随 GNOME 桌面一起提供的虚拟化平台,可以用作简单的演示用途。如果你从未使用过 GNOME Boxes,你可以在 Alan Formy-Duval 的文章 [GNOME Boxes 入门][3]中学习它的基础知识。 + +想象一下,你使用 GNOME Boxes 创建虚拟机,然后将操作系统安装到该 VM 中。现在,你想要制作一个黄金镜像。GNOME Boxes 已经率先摄取了你的安装快照,可以作为更多的操作系统安装的黄金镜像。 + +打开 GNOME Boxes 并在仪表板视图中,右键单击任何虚拟机,然后选择**属性**。在**属性**窗口中,选择**快照**选项卡。由 GNOME Boxes 自动创建的第一个快照是“Just Installed”。顾名思义,这是你最初安装到虚拟机上的操作系统。 + +![The Just Installed snapshot, or initial golden image, in GNOME Boxes.][4] + +如果你的虚拟机变成了你不想要的状态,你可以随时恢复为“Just Installed”镜像。 + +当然,如果你已经为自己调整了环境,那么在安装后恢复操作系统将是一个极大的工程。这就是为什么虚拟机的常见工作流程是:首先安装操作系统,然后根据你的要求或偏好修改它,然后拍摄快照,将该快照声明为配置好的黄金镜像。例如,如果你使用虚拟机进行 [Flatpak][5] 打包,那么在初始安装之后,你可以添加软件和 Flatpak 开发工具,构建工作环境,然后拍摄快照。创建快照后,你可以重命名该虚拟机以指示其真实用途。 + +要重命名虚拟机,请在仪表板视图中右键单击其缩略图,然后选择**属性**。在**属性**窗口中,输入新名称: + +![Renaming your VM image in GNOME Boxes.][6] + +要克隆你的黄金映像,请右键单击 GNOME Boxes 界面中的虚拟机,然后选择**克隆**。 + +![Cloning your golden image in GNOME Boxes.][7] + +你现在可以从黄金映像的最新快照中克隆了。 + +### 黄金镜像 + +很少有学科无法从黄金镜像中受益。无论你是在 [Git][8] 中标记版本、在 Boxes 中拍摄快照、出版原型黑胶唱片、打印书籍以进行审核、设计用于批量生产的丝网印刷、还是制作文字模具,到处都是各种原型。这只是现代技术让我们人类更聪明而不是更努力的另一种方式,因此为你的项目制作一个黄金镜像,并根据需要随时生成克隆吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/what-golden-image + +作者:[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/origami_star_gold_best_top.jpg?itok=aEc0eutt (Gold star) +[2]: https://wiki.gnome.org/Apps/Boxes +[3]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[4]: https://opensource.com/sites/default/files/uploads/snapshots.jpg (The Just Installed snapshot, or initial golden image.) +[5]: https://opensource.com/business/16/8/flatpak +[6]: https://opensource.com/sites/default/files/uploads/boxes-rename_0.jpg (Renaming your virtual machine in GNOME Boxes.) +[7]: https://opensource.com/sites/default/files/uploads/boxes-clone.jpg (Cloning your golden image in GNOME Boxes.) +[8]: https://git-scm.com diff --git a/published/201908/20190715 Understanding software design patterns.md b/published/201908/20190715 Understanding software design patterns.md new file mode 100644 index 0000000000..0347ad755b --- /dev/null +++ b/published/201908/20190715 Understanding software design patterns.md @@ -0,0 +1,349 @@ +[#]: collector: (lujun9972) +[#]: translator: (arrowfeng) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11208-1.html) +[#]: subject: (Understanding software design patterns) +[#]: via: (https://opensource.com/article/19/7/understanding-software-design-patterns) +[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/erezhttps://opensource.com/users/brson) + +理解软件设计模式 +====== +> 设计模式可以帮助消除冗余代码。学习如何利用 Java 使用单例模式、工厂模式和观察者模式。 + +![](https://img.linux.net.cn/data/attachment/album/201908/10/080849ygyqtrw88f2qtzk4.jpg) + +如果你是一名正在致力于计算机科学或者相关学科的程序员或者学生,很快,你将会遇到一条术语 “软件设计模式software design pattern”。根据维基百科,“*[软件设计模式][2]是在平常的软件设计工作中所遭遇的问题的一种通用的、可重复使用的解决方案*”。我对该定义的理解是:当在从事于一个编码项目时,你经常会思考,“嗯,这里貌似是冗余代码,我觉得是否能改变这些代码使之更灵活和便于修改?”因此,你会开始考虑怎样分割那些保持不变的内容和需要经常改变的内容。 + +> **设计模式**是一种通过分割那些保持不变的部分和经常变化的部分,让你的代码更容易修改的方法。 + +不出意外的话,每个从事编程项目的人都可能会有同样的思考。特别是那些工业级别的项目,在那里通常工作着数十甚至数百名开发者;协作过程表明必须有一些标准和规则来使代码更加优雅并适应变化。这就是为什么我们有了 [面向对象编程][3](OOP)和 [软件框架工具][4]。设计模式有点类似于 OOP,但它通过将变化视为自然开发过程的一部分而进一步发展。基本上,设计模式利用了一些 OOP 的思想,比如抽象和接口,但是专注于改变的过程。 + +当你开始开发项目时,你经常会听到这样一个术语*重构*,它意味着*通过改变代码使它变得更优雅和可复用*;这就是设计模式耀眼的地方。当你处理现有代码时(无论是由其他人构建还是你自己过去构建的),了解设计模式可以帮助你以不同的方式看待事物,你将发现问题以及改进代码的方法。 + +有很多种设计模式,其中单例模式、工厂模式和观察者模式三种最受欢迎,在这篇文章中我将会一一介绍它们。 + +### 如何遵循本指南 + +无论你是一位有经验的编程工作者还是一名刚刚接触的新手,我想让这篇教程让每个人都很容易理解。设计模式概念并不容易理解,减少开始旅程时的学习曲线始终是首要任务。因此,除了这篇带有图表和代码片段的文章外,我还创建了一个 [GitHub 仓库][5],你可以克隆仓库并在你的电脑上运行这些代码来实现这三种设计模式。你也可以观看我创建的 [YouTube视频][6]。 + +#### 必要条件 + +如果你只是想了解一般的设计模式思想,则无需克隆示例项目或安装任何工具。但是,如果要运行示例代码,你需要安装以下工具: + + * **Java 开发套件(JDK)**:我强烈建议使用 [OpenJDK][7]。 + * **Apache Maven**:这个简单的项目使用 [Apache Maven][8] 构建;好的是许多 IDE 自带了Maven。 + * **交互式开发编辑器(IDE)**:我使用 [社区版 IntelliJ][9],但是你也可以使用 [Eclipse IDE][10] 或者其他你喜欢的 Java IDE。 + * **Git**:如果你想克隆这个工程,你需要 [Git][11] 客户端。 + +安装好 Git 后运行下列命令克隆这个工程: + +``` +git clone https://github.com/bryantson/OpensourceDotComDemos.git +``` + +然后在你喜欢的 IDE 中,你可以将 TopDesignPatterns 仓库中的代码作为 Apache Maven 项目导入。 + +我使用的是 Java,但你也可以使用支持[抽象原则][12]的任何编程语言来实现设计模式。 + +### 单例模式:避免每次创建一个对象 + +[单例模式][13]singleton pattern是非常流行的设计模式,它的实现相对来说很简单,因为你只需要一个类。然而,许多开发人员争论单例设计模式的是否利大于弊,因为它缺乏明显的好处并且容易被滥用。很少有开发人员直接实现单例;相反,像 Spring Framework 和 Google Guice 等编程框架内置了单例设计模式的特性。 + +但是了解单例模式仍然有巨大的用处。单例模式确保一个类仅创建一次且提供了一个对它的全局访问点。 + +> **单例模式**:确保仅创建一个实例且避免在同一个项目中创建多个实例。 + +下面这幅图展示了典型的类对象创建过程。当客户端请求创建一个对象时,构造函数会创建或者实例化一个对象并调用方法返回这个类给调用者。但是每次请求一个对象都会发生这样的情况:构造函数被调用,一个新的对象被创建并且它返回了一个独一无二的对象。我猜面向对象语言的创建者有每次都创建一个新对象的理由,但是单例过程的支持者说这是冗余的且浪费资源。 + +![Normal class instantiation][14] + +下面这幅图使用单例模式创建对象。这里,构造函数仅当对象首次通过调用预先设计好的 `getInstance()` 方法时才会被调用。这通常通过检查该值是否为 `null` 来完成,并且这个对象被作为私有变量保存在单例类的内部。下次 `getInstance()` 被调用时,这个类会返回第一次被创建的对象。而没有新的对象产生;它只是返回旧的那一个。 + +![Singleton pattern instantiation][15] + +下面这段代码展示了创建单例模式最简单的方法: + +``` +package org.opensource.demo.singleton; + +public class OpensourceSingleton { + + private static OpensourceSingleton uniqueInstance; + + private OpensourceSingleton() { + } + + public static OpensourceSingleton getInstance() { + if (uniqueInstance == null) { + uniqueInstance = new OpensourceSingleton(); + } + return uniqueInstance; + } + +} +``` + +在调用方,这里展示了如何调用单例类来获取对象: + +``` +Opensource newObject = Opensource.getInstance(); +``` + +这段代码很好的验证了单例模式的思想: + + 1. 当 `getInstance()` 被调用时,它通过检查 `null` 值来检查对象是否已经被创建。 + 2. 如果值为 `null`,它会创建一个新对象并把它保存到私有域,返回这个对象给调用者。否则直接返回之前被创建的对象。 + +单例模式实现的主要问题是它忽略了并行进程。当多个进程使用线程同时访问资源时,这个问题就产生了。对于这种情况有对应的解决方案,它被称为*双重检查锁*,用于多线程安全,如下所示: + +``` +package org.opensource.demo.singleton; + +public class ImprovedOpensourceSingleton { + + private volatile static ImprovedOpensourceSingleton uniqueInstance; + + private ImprovedOpensourceSingleton() {} + + public static ImprovedOpensourceSingleton getInstance() { + if (uniqueInstance == null) { + synchronized (ImprovedOpensourceSingleton.class) { + if (uniqueInstance == null) { + uniqueInstance = new ImprovedOpensourceSingleton(); + } + } + } + return uniqueInstance; + } + +} +``` + +再强调一下前面的观点,确保只有在你认为这是一个安全的选择时才直接实现你的单例模式。最好的方法是通过使用一个制作精良的编程框架来利用单例功能。 + +### 工厂模式:将对象创建委派给工厂类以隐藏创建逻辑 + +[工厂模式][16]factory pattern是另一种众所周知的设计模式,但是有一小点复杂。实现工厂模式的方法有很多,而下列的代码示例为最简单的实现方式。为了创建对象,工厂模式定义了一个接口,让它的子类去决定实例化哪一个类。 + +> **工厂模式**:将对象创建委派给工厂类,因此它能隐藏创建逻辑。 + +下列的图片展示了最简单的工厂模式是如何实现的。 + +![Factory pattern][17] + +客户端请求工厂类创建类型为 x 的某个对象,而不是客户端直接调用对象创建。根据其类型,工厂模式决定要创建和返回的对象。 + +在下列代码示例中,`OpensourceFactory` 是工厂类实现,它从调用者那里获取*类型*并根据该输入值决定要创建和返回的对象: + +``` +package org.opensource.demo.factory; + +public class OpensourceFactory { + + public OpensourceJVMServers getServerByVendor(String name) { + if(name.equals("Apache")) { + return new Tomcat(); + } + else if(name.equals("Eclipse")) { + return new Jetty(); + } + else if (name.equals("RedHat")) { + return new WildFly(); + } + else { + return null; + } + } +} +``` + +`OpenSourceJVMServer` 是一个 100% 的抽象类(即接口类),它指示要实现的是什么,而不是怎样实现: + +``` +package org.opensource.demo.factory; + +public interface OpensourceJVMServers { + public void startServer(); + public void stopServer(); + public String getName(); +} +``` + +这是一个 `OpensourceJVMServers` 类的实现示例。当 `RedHat` 被作为类型传递给工厂类,`WildFly` 服务器将被创建: + +``` +package org.opensource.demo.factory; + +public class WildFly implements OpensourceJVMServers { + public void startServer() { + System.out.println("Starting WildFly Server..."); + } + + public void stopServer() { + System.out.println("Shutting Down WildFly Server..."); + } + + public String getName() { + return "WildFly"; + } +} +``` + +### 观察者模式:订阅主题并获取相关更新的通知 + +最后是[观察者模式][20]observer pattern。像单例模式那样,很少有专业的程序员直接实现观察者模式。但是,许多消息队列和数据服务实现都借用了观察者模式的概念。观察者模式在对象之间定义了一对多的依赖关系,当一个对象的状态发生改变时,所有依赖它的对象都将被自动地通知和更新。 + +> **观察者模式**:如果有更新,那么订阅了该话题/主题的客户端将被通知。 + +理解观察者模式的最简单方法是想象一个邮件列表,你可以在其中订阅任何主题,无论是开源、技术、名人、烹饪还是您感兴趣的任何其他内容。每个主题维护者一个它的订阅者列表,在观察者模式中它们相当于观察者。当某一个主题更新时,它所有的订阅者(观察者)都将被通知这次改变。并且订阅者总是能取消某一个主题的订阅。 + +如下图所示,客户端可以订阅不同的主题并添加观察者以获得最新信息的通知。因为观察者不断的监听着这个主题,这个观察者会通知客户端任何发生的改变。 + +![Observer pattern][21] + +让我们来看看观察者模式的代码示例,从主题/话题类开始: + +``` +package org.opensource.demo.observer; + +public interface Topic { + + public void addObserver(Observer observer); + public void deleteObserver(Observer observer); + public void notifyObservers(); +} +``` + +这段代码描述了一个为不同的主题去实现已定义方法的接口。注意一个观察者如何被添加、移除和通知的。 + +这是一个主题的实现示例: + +``` +package org.opensource.demo.observer; + +import java.util.List; +import java.util.ArrayList; + +public class Conference implements Topic { + private List listObservers; + private int totalAttendees; + private int totalSpeakers; + private String nameEvent; + + public Conference() { + listObservers = new ArrayList(); + } + + public void addObserver(Observer observer) { + listObservers.add(observer); + } + + public void deleteObserver(Observer observer) { + int i = listObservers.indexOf(observer); + if (i >= 0) { + listObservers.remove(i); + } + } + + public void notifyObservers() { + for (int i=0, nObservers = listObservers.size(); i < nObservers; ++ i) { + Observer observer = listObservers.get(i); + observer.update(totalAttendees,totalSpeakers,nameEvent); + } + } + + public void setConferenceDetails(int totalAttendees, int totalSpeakers, String nameEvent) { + this.totalAttendees = totalAttendees; + this.totalSpeakers = totalSpeakers; + this.nameEvent = nameEvent; + notifyObservers(); + } +} +``` + +这段代码定义了一个特定主题的实现。当发生改变时,这个实现调用它自己的方法。注意这将获取观察者的数量,它以列表方式存储,并且可以通知和维护观察者。 + +这是一个观察者类: + +``` +package org.opensource.demo.observer; + +public interface Observer { + public void update(int totalAttendees, int totalSpeakers, String nameEvent); +} +``` + +这个类定义了一个接口,不同的观察者可以实现该接口以执行特定的操作。 + +例如,实现了该接口的观察者可以在会议上打印出与会者和发言人的数量: + +``` +package org.opensource.demo.observer; + +public class MonitorConferenceAttendees implements Observer { + private int totalAttendees; + private int totalSpeakers; + private String nameEvent; + private Topic topic; + + public MonitorConferenceAttendees(Topic topic) { + this.topic = topic; + topic.addObserver(this); + } + + public void update(int totalAttendees, int totalSpeakers, String nameEvent) { + this.totalAttendees = totalAttendees; + this.totalSpeakers = totalSpeakers; + this.nameEvent = nameEvent; + printConferenceInfo(); + } + + public void printConferenceInfo() { + System.out.println(this.nameEvent + " has " + totalSpeakers + " speakers and " + totalAttendees + " attendees"); + } +} +``` + +### 接下来 + +现在你已经阅读了这篇对于设计模式的介绍引导,你还可以去寻求了解其他设计模式,例如外观模式,模版模式和装饰器模式。也有一些并发和分布式系统的设计模式如断路器模式和锚定模式。 + +可是,我相信最好的磨砺你的技能的方式首先是通过在你的业余项目或者练习中实现这些设计模式。你甚至可以开始考虑如何在实际项目中应用这些设计模式。接下来,我强烈建议你查看 OOP 的 [SOLID 原则][23]。之后,你就准备好了解其他设计模式。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/understanding-software-design-patterns + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[arrowfeng](https://github.com/arrowfeng) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brsonhttps://opensource.com/users/erezhttps://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://en.wikipedia.org/wiki/Software_design_pattern +[3]: https://en.wikipedia.org/wiki/Object-oriented_programming +[4]: https://en.wikipedia.org/wiki/Software_framework +[5]: https://github.com/bryantson/OpensourceDotComDemos/tree/master/TopDesignPatterns +[6]: https://www.youtube.com/watch?v=VlBXYtLI7kE&feature=youtu.be +[7]: https://openjdk.java.net/ +[8]: https://maven.apache.org/ +[9]: https://www.jetbrains.com/idea/download/#section=mac +[10]: https://www.eclipse.org/ide/ +[11]: https://git-scm.com/ +[12]: https://en.wikipedia.org/wiki/Abstraction_principle_(computer_programming) +[13]: https://en.wikipedia.org/wiki/Singleton_pattern +[14]: https://opensource.com/sites/default/files/uploads/designpatterns1_normalclassinstantiation.jpg (Normal class instantiation) +[15]: https://opensource.com/sites/default/files/uploads/designpatterns2_singletonpattern.jpg (Singleton pattern instantiation) +[16]: https://en.wikipedia.org/wiki/Factory_method_pattern +[17]: https://opensource.com/sites/default/files/uploads/designpatterns3_factorypattern.jpg (Factory pattern) +[18]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[19]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[20]: https://en.wikipedia.org/wiki/Observer_pattern +[21]: https://opensource.com/sites/default/files/uploads/designpatterns4_observerpattern.jpg (Observer pattern) +[22]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+observer +[23]: https://en.wikipedia.org/wiki/SOLID diff --git a/published/201908/20190715 What is POSIX- Richard Stallman explains.md b/published/201908/20190715 What is POSIX- Richard Stallman explains.md new file mode 100644 index 0000000000..916fb50757 --- /dev/null +++ b/published/201908/20190715 What is POSIX- Richard Stallman explains.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (martin2011qi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11222-1.html) +[#]: subject: (What is POSIX? Richard Stallman explains) +[#]: via: (https://opensource.com/article/19/7/what-posix-richard-stallman-explains) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +POSIX 是什么?让我们听听 Richard Stallman 的诠释 +====== + +> 从计算机自由先驱的口中探寻操作系统兼容性标准背后的本质。 + +![](https://img.linux.net.cn/data/attachment/album/201908/13/231737robbwoss7p3p7jwo.jpg) + +[POSIX][2] 是什么?为什么如此重要?你可能在很多的技术类文章中看到这个术语,但往往会在探寻其本质时迷失在技术初始主义techno-initialisms的海洋或是以 X 结尾的行话jargon-that-ends-in-X中。我给 [Richard Stallman][3] 博士(在黑客圈里面常称之为 RMS)发了邮件以探寻这个术语的起源及其背后的概念。 + +Richard Stallman 认为用 “开源” 和 “闭源” 来归类软件是一种错误的方法。Stallman 将程序分类为 尊重自由的freedom-respecting(“自由free” 或 “自由(西语)libre”)和 践踏自由的freedom-trampling(“非自由non-free” 或 “专有proprietary”)。开源讨论通常会为了(用户)实际得到的优势/便利advantages考虑去鼓励某些做法,而非作为道德层面上的约束。 + +Stallman 在由其本人于 1984 年发起的自由软件运动The free software movement表明,不仅仅是这些 优势/便利advantages 受到了威胁。计算机的用户 理应得到deserve 计算机的控制权,因此拒绝被用户控制的程序即是 非正义injustice,理应被拒绝rejected排斥eliminated。对于用户的控制权,程序应当给予用户 [四项基本自由][4]: + + * 自由度 0:无论用户出于何种目的,必须可以按照用户意愿,自由地运行该软件。 + * 自由度 1:用户可以自由地学习并修改该软件,以便按照自己的意愿进行计算。作为前提,用户必须可以访问到该软件的源代码。 + * 自由度 2:用户可以自由地分发该软件的副本,以便可以帮助他人。 + * 自由度 3:用户可以自由地分发该软件修改后的副本。借此,你可以让整个社区受益于你的改进。作为前提,用户必须可以访问到该软件的源代码。 + +### 关于 POSIX + +**Seth:** POSIX 标准是由 [IEEE][5] 发布,用于描述 “可移植操作系统portable operating system” 的文档。只要开发人员编写符合此描述的程序,他们生产的便是符合 POSIX 的程序。在科技行业,我们称之为 “规范specification” 或将其简写为 “spec”。就技术用语而言,这是可以理解的,但我们不禁要问是什么使操作系统 “可移植”? + +**RMS:** 我认为是接口interface应该(在不同系统之间)是可移植的,而非任何一种*系统*。实际上,内部构造不同的各种系统都支持部分的 POSIX 接口规范。 + +**Seth:** 因此,如果两个系统皆具有符合 POSIX 的程序,那么它们便可以彼此假设,从而知道如何相互 “交谈”。我了解到 “POSIX” 这个简称是你想出来的。那你是怎么想出来的呢?它是如何就被 IEEE 采纳了呢? + +**RMS:** IEEE 已经完成了规范的开发,但还没为其想好简练的名称。标题类似是 “可移植操作系统接口”,虽然我已记不清确切的单词。委员会倾向于将 “IEEEIX” 作为简称。而我认为那不太好。发音有点怪 - 听起来像恐怖的尖叫,“Ayeee!” - 所以我觉得人们反而会倾向于称之为 “Unix”。 + +但是,由于 [GNU 并不是 Unix][6]GNU's Not Unix,并且它打算取代之,我不希望人们将 GNU 称为 “Unix 系统”。因此,我提出了人们可能会实际使用的简称。那个时候也没有什么灵感,我就用了一个并不是非常聪明的方式创造了这个简称:我使用了 “可移植操作系统portable operating system” 的首字母缩写,并在末尾添加了 “ix” 作为简称。IEEE 也欣然接受了。 + +**Seth:** POSIX 缩写中的 “操作系统” 是仅涉及 Unix 和类 Unix 的系统(如 GNU)呢?还是意图包含所有操作系统? + +**RMS:** 术语 “操作系统” 抽象地说,涵盖了完全不像 Unix 的系统、完全和 POSIX 规范无关的系统。但是,POSIX 规范适用于大量类 Unix 系统;也只有这样的系统才适合 POSIX 规范。 + +**Seth:** 你是否参与审核或更新当前版本的 POSIX 标准? + +**RMS:** 现在不了。 + +**Seth:** GNU Autotools 工具链可以使应用程序更容易移植,至少在构建和安装时如此。所以可以认为 Autotools 是构建可移植基础设施的重要一环吗? + +**RMS:** 是的,因为即使在遵循 POSIX 的系统中,也存在着诸多差异。而 Autotools 可以使程序更容易适应这些差异。顺带一提,如果有人想助力 Autotools 的开发,可以发邮件联系我。 + +**Seth:** 我想,当 GNU 刚刚开始让人们意识到一个非 Unix 的系统可以从专有的技术中解放出来的时候,关于自由软件如何协作方面,这其间一定存在一些空白区域吧。 + +**RMS:** 我不认为有任何空白或不确定性。我只是照着 BSD 的接口写而已。 + +**Seth:** 一些 GNU 应用程序符合 POSIX 标准,而另一些 GNU 应用程序的 GNU 特定的功能,要么不在 POSIX 规范中,要么缺少该规范要求的功能。对于 GNU 应用程序 POSIX 合规性有多重要? + +**RMS:** 遵循标准对于利于用户的程度很重要。我们不将标准视为权威,而是且将其作为可能有用的指南来遵循。因此,我们谈论的是遵循following标准而不是“遵守complying”。可以参考 GNU 编码标准GNU Coding Standards中的 [非 GNU 标准][7] 段落。 + +我们努力在大多数问题上与标准兼容,因为在大多数的问题上这最有利于用户。但也偶有例外。 + +例如,POSIX 指定某些实用程序以 512 字节为单位测量磁盘空间。我要求委员会将其改为 1K,但被拒绝了,说是有个官僚主义的规则bureaucratic rule强迫选用 512。我不记得有多少人试图争辩说,用户会对这个决定感到满意的。 + +由于 GNU 在用户的自由freedom之后的第二优先级,是用户的便利convenience,我们使 GNU 程序以默认 1K 为单位按块测量磁盘空间。 + +然而,为了防止竞争对手利用这点给 GNU 安上 “不合规noncompliant” 的骂名,我们实现了遵循 POSIX 和 ISO C 的可选模式,这种妥协着实可笑。想要遵循 POSIX,只需设置环境变量 `POSIXLY_CORRECT`,即可使程序符合 POSIX 以 512 字节为单位列出磁盘空间。如果有人知道实际使用 `POSIXLY_CORRECT` 或者 GCC 中对应的 `--pedantic` 会为某些用户提供什么实际好处的话,请务必告诉我。 + +**Seth:** 符合 POSIX 标准的自由软件项目是否更容易移植到其他类 Unix 系统? + +**RMS:** 我认为是这样,但自上世纪 80 年代开始,我决定不再把时间浪费在将软件移植到 GNU 以外的系统上。我开始专注于推进 GNU 系统,使其不必使用任何非自由软件。至于将 GNU 程序移植到非类 GNU 系统就留给想在其他系统上运行它们的人们了。 + +**Seth:** POSIX 对于软件的自由很重要吗? + +**RMS:** 本质上说,(遵不遵循 POSIX)其实没有任何区别。但是,POSIX 和 ISO C 的标准化确实使 GNU 系统更容易迁移,这有助于我们更快地实现从非自由软件中解放用户的目标。这个目标于上世纪 90 年代早期达成,当时Linux成为自由软件,同时也填补了 GNU 中内核的空白。 + +### POSIX 采纳 GNU 的创新 + +我还问过 Stallman 博士,是否有任何 GNU 特定的创新或惯例后来被采纳为 POSIX 标准。他无法回想起具体的例子,但友好地代我向几位开发者发了邮件。 + +开发者 Giacomo Catenazzi,James Youngman,Eric Blake,Arnold Robbins 和 Joshua Judson Rosen 对以前的 POSIX 迭代以及仍在进行中的 POSIX 迭代做出了回应。POSIX 是一个 “活的living” 标准,因此会不断被行业专业人士更新和评审,许多从事 GNU 项目的开发人员提出了对 GNU 特性的包含。 + +为了回顾这些有趣的历史,接下来会罗列一些已经融入 POSIX 的流行的 GNU 特性。 + +#### Make + +一些 GNU **Make** 的特性已经被 POSIX 的 `make` 定义所采用。相关的 [规范][8] 提供了从现有实现中借来的特性的详细归因。 + +#### Diff 和 patch + +[diff][9] 和 [patch][10] 命令都直接从这些工具的 GNU 版本中引进了 `-u` 和 `-U` 选项。 + +#### C 库 + +POSIX 采用了 GNU C 库 **glibc** 的许多特性。血统Lineage一时已难以追溯,但 James Youngman 如是写道: + +> “我非常确定 GCC 首创了许多 ISO C 的特性。例如,**_Noreturn** 是 C11 中的新特性,但 GCC-1.35 便具有此功能(使用 `volatile` 作为声明函数的修饰符)。另外尽管我不确定,GCC-1.35 支持的可变长度数组似乎与现代 C 中的(柔性数组conformant array)非常相似。” + +Giacomo Catenazzi 援引 Open Group 的 [strftime][11] 文章,并指出其归因:“这是基于某版本 GNU libc 的 `strftime()` 的特性。” + +Eric Blake 指出,对于 `getline()` 和各种基于语言环境的 `*_l()` 函数,GNU 绝对是这方面的先驱。 + +Joshua Judson Rosen 补充道,他清楚地记得,在全然不同的操作系统的代码中奇怪地目睹了熟悉的 GNU 式的行为后,对 `getline()` 函数的采用给他留下了深刻的印象。 + +“等等……那不是 GNU 特有的吗?哦,显然已经不再是了。” + +Rosen 向我指出了 [getline 手册页][12] 中写道: + +> `getline()` 和 `getdelim()` 最初都是 GNU 扩展。在 POSIX.1-2008 中被标准化。 + +Eric Blake 向我发送了一份其他扩展的列表,这些扩展可能会在下一个 POSIX 修订版中添加(代号为 Issue 8,大约在 2021 年前后): + + * [ppoll][13] + * [pthread_cond_clockwait et al.][14] + * [posix_spawn_file_actions_addchdir][15] + * [getlocalename_1][16] + * [reallocarray][17] + +### 关于用户空间的扩展 + +POSIX 不仅为开发人员定义了函数和特性,还为用户空间定义了标准行为。 + +#### ls + +`-A` 选项会排除来自 `ls` 命令结果中的符号 `.`(代表当前位置)和 `..`(代表上一级目录)。它被 POSIX 2008 采纳。 + +#### find + +`find` 命令是一个特别的ad hoc [for 循环][18] 工具,也是 [并行parallel][19] 处理的出入口。 + +一些从 GNU 引入到 POSIX 的便捷操作conveniences,包括 `-path` 和 `-perm` 选项。 + +`-path` 选项帮你过滤与文件系统路径模式匹配的搜索结果,并且从 1996 年(根据 `findutil` 的 Git 仓库中最早的记录)GNU 版本的 `find` 便可使用此选项。James Youngman 指出 [HP-UX][20] 也很早就有这个选项,所以究竟是 GNU 还是 HP-UX 做出的这一创新(抑或两者兼而有之)无法考证。 + +`-perm` 选项帮你按文件权限过滤搜索结果。这在 1996 年 GNU 版本的 `find` 中便已存在,随后被纳入 POSIX 标准 “IEEE Std 1003.1,2004 Edition” 中。 + +`xargs` 命令是 `findutils` 软件包的一部分,1996 年的时候就有一个 `-p` 选项会将 `xargs` 置于交互模式(用户将被提示是否继续),随后被纳入 POSIX 标准 “IEEE Std 1003.1, 2004 Edition” 中。 + +#### Awk + +GNU awk(即 `/usr/bin` 目录中的 `gawk` 命令,可能也是符号链接 `awk` 的目标地址)的维护者 Arnold Robbins 说道,`gawk` 和 `mawk`(另一个GPL 的 `awk` 实现)允许 `RS`(记录分隔符)是一个正则表达式,即这时 `RS` 的长度会大于 1。这一特性还不是 POSIX 的特性,但有 [迹象表明它即将会是][21]: + +> NUL 在扩展正则表达式中产生的未定义行为允许 GNU `gawk` 程序未来可以扩展以处理二进制数据。 +> +> 使用多字符 RS 值的未指定行为是为了未来可能的扩展,它是基于用于记录分隔符(RS)的扩展正则表达式的。目前的历史实现为采用该字符串的第一个字符而忽略其他字符。 + +这是一个重大的增强,因为 `RS` 符号定义了记录之间的分隔符。可能是逗号、分号、短划线、或者是任何此类字符,但如果它是字符*序列*,则只会使用第一个字符,除非你使用的是 `gawk` 或 `mawk`。想象一下这种情况,使用省略号(连续的三个点)作为解析 IP 地址文档的分隔记录,只是想获取在每个 IP 地址的每个点处解析的结果。 + +[mawk][22] 首先支持这个功能,但是几年来没有维护者,留下来的火把由 `gawk` 接过。(`mawk` 已然获得了一个新的维护者,可以说是大家薪火传承地将这一特性推向共同的预期值。) + +### POSIX 规范 + +总的来说,Giacomo Catenzzi 指出,“……因为 GNU 的实用程序使用广泛,而且许多其他的选项和行为又对标规范。在 shell 的每次更改中,Bash 都会(作为一等公民)被用作比较。” 当某些东西被纳入 POSIX 规范时,无需提及 GNU 或任何其他影响,你可以简单地认为 POSIX 规范会受到许多方面的影响,GNU 只是其中之一。 + +共识是 POSIX 存在的意义所在。一群技术人员共同努力为了实现共同规范,再分享给数以百计各异的开发人员,经由他们的赋能,从而实现软件的独立性,以及开发人员和用户的自由。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/what-posix-richard-stallman-explains + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[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/document_free_access_cut_security.png?itok=ocvCv8G2 (Scissors cutting open access to files) +[2]: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/ +[3]: https://stallman.org/ +[4]: https://www.gnu.org/philosophy/free-sw.en.html +[5]: https://www.ieee.org/ +[6]: http://gnu.org +[7]: https://www.gnu.org/prep/standards/html_node/Non_002dGNU-Standards.html +[8]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html +[9]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html +[10]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/patch.html +[11]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html +[12]: http://man7.org/linux/man-pages/man3/getline.3.html +[13]: http://austingroupbugs.net/view.php?id=1263 +[14]: http://austingroupbugs.net/view.php?id=1216 +[15]: http://austingroupbugs.net/view.php?id=1208 +[16]: http://austingroupbugs.net/view.php?id=1220 +[17]: http://austingroupbugs.net/view.php?id=1218 +[18]: https://opensource.com/article/19/6/how-write-loop-bash +[19]: https://opensource.com/article/18/5/gnu-parallel +[20]: https://www.hpe.com/us/en/servers/hp-ux.html +[21]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html +[22]: https://invisible-island.net/mawk/ diff --git a/published/201908/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md b/published/201908/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md new file mode 100644 index 0000000000..14e36860b6 --- /dev/null +++ b/published/201908/20190720 How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11172-1.html) +[#]: subject: (How to Upgrade Debian 9 (Stretch) to Debian 10 (Buster) via Command Line) +[#]: via: (https://www.linuxtechi.com/upgrade-debian-9-to-debian-10-command-line/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何通过命令行升级 Debian 9 为 Debian 10 +====== + +我们已经在先前的文章中看到如何安装 [Debian 10(Buster)][1]。今天,我们将学习如何从 Debian 9 升级为 Debian 10,虽然我们已将看到 Debian 10 和它的特色,所以这里我们不会深入介绍。但是可能读者没有机会读到那篇文章,让我们快速了解一下 Debian 10 和它的新功能。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/Upgrade-Debian-9-to-Debian-10.jpg) + +在差不多两年的开发后,Debian 团队最终发布一个稳定版本,Debian 10 的代码名称是 Buster。Buster 是一个 LTS (长期支持支持)版本,因此未来将由 Debian 支持 5 年。 + +### Debian 10(Buster)新的特色 + +Debian 10(Buster)回报给大多数 Debian 爱好者大量的新特色。一些特色包括: + + * GNOME 桌面 3.30 + * 默认启用 AppArmor + * 支持 Linux 内核 4.19.0-4 + * 支持 OpenJDk 11.0 + * 从 Nodejs 4 ~ 8 升级到 Nodejs 10.15.2 + * Iptables 替换为 NFTables + +等等。 + +### 从 Debian 9 到 Debian 10 的逐步升级指南 + +在我们开始升级 Debian 10 前,让我们看看升级需要的必备条件: + +#### 步骤 1) Debian 升级必备条件 + + * 一个良好的网络连接 + * root 用户权限 + * 数据备份 + +备份你所有的应用程序代码库、数据文件、用户账号详细信息、配置文件是极其重要的,以便在升级出错时,你可以总是可以还原到先前的版本。 + +#### 步骤 2) 升级 Debian 9 现有的软件包 + +接下来的步骤是升级你所有现有的软件包,因为一些软件包被标志为保留不能升级,从 Debian 9 升级为 Debian 10 有失败或引发一些问题的可能性。所以,我们不冒任何风险,更好地升级软件包。使用下面的代码来升级软件包: + +``` +root@linuxtechi:~$ sudo apt update && sudo apt upgrade -y +``` + +#### 步骤 3) 修改软件包存储库文件 /etc/sources.list + +接下来的步骤是修改软件包存储库文件 `/etc/sources.list`,你需要用文本 `Buster` 替换 `Stretch`。 + +但是,在你更改任何东西前,确保如下创建一个 `sources.list` 文件的备份: + +``` +root@linuxtechi:~$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak +``` + +现在使用下面的 `sed` 命令来在软件包存储库文件中使用 `buster` 替换 `stretch`,示例如下显示: + +``` +root@linuxtechi:~$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list +root@linuxtechi:~$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/*.list +``` + +更新后,你需要如下更新软件包存储库索引: + +``` +root@linuxtechi:~$ sudo apt update +``` + +在开始升级你现有的 Debian 操作系统前,让我们使用下面的命令验证当前版本, + +``` +root@linuxtechi:~$ cat /etc/*-release +PRETTY_NAME="Debian GNU/Linux 9 (stretch)" +NAME="Debian GNU/Linux" +VERSION_ID="9" +VERSION="9 (stretch)" +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" +root@linuxtechi:~$ +``` + +#### 步骤 4) 从 Debian 9 升级到 Debian 10 + +你做完所有的更改后,是时候从 Debian 9 升级到 Debian 10 了。但是在这之前,再次如下确保更新你的软件包: + +``` +root@linuxtechi:~$ sudo apt update && sudo apt upgrade -y +``` + +在软件包升级期间,你将被提示启动服务,所以选择你较喜欢的选项。 + +一旦你系统的所有软件包升级完成,就升级你的发行版的软件包。使用下面的代码来升级发行版: + +``` +root@linuxtechi:~$ sudo apt dist-upgrade -y +``` + +升级过程可能花费一些时间,取决于你的网络速度。记住在升级过程中,你将被询问一些问题,在软件包升级后是否需要重启服务、你是否需要保留现存的配置文件等。如果你不想进行一些自定义更改,简单地键入 “Y” ,来让升级过程继续。 + +#### 步骤 5) 验证升级 + +一旦升级过程完成,重启你的机器,并使用下面的方法检测版本: + +``` +root@linuxtechi:~$ lsb_release -a +``` + +如果你获得如下输出: + +``` +Distributor ID: Debian +Description: Debian GNU/Linux 10 (buster) +Release: 10 +Codename: buster +root@linuxtechi:~$ +``` + +是的,你已经成功地从 Debian 9 升级到 Debian 10。 + +验证升级的备用方法: + +``` +root@linuxtechi:~$ cat /etc/*-release +PRETTY_NAME="Debian GNU/Linux 10 (buster)" +NAME="Debian GNU/Linux" +VERSION_ID="10" +VERSION="10 (buster)" +VERSION_CODENAME=buster +ID=debian +HOME_URL="https://www.debian.org/" +SUPPORT_URL="https://www.debian.org/support" +BUG_REPORT_URL="https://bugs.debian.org/" +root@linuxtechi:~$ +``` + +### 结束 + +希望上面的逐步指南为你提供了从 Debian 9(Stretch)简单地升级为 Debian 10(Buster)的所有信息。在评论部分,请给予你使用 Debian 10 的反馈、建议、体验。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/upgrade-debian-9-to-debian-10-command-line/ + +作者:[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://linux.cn/article-11083-1.html diff --git a/published/201908/20190724 3 types of metric dashboards for DevOps teams.md b/published/201908/20190724 3 types of metric dashboards for DevOps teams.md new file mode 100644 index 0000000000..8d2f7aebe5 --- /dev/null +++ b/published/201908/20190724 3 types of metric dashboards for DevOps teams.md @@ -0,0 +1,78 @@ +[#]: collector: "lujun9972" +[#]: translator: "hello-wn" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11183-1.html" +[#]: subject: "3 types of metric dashboards for DevOps teams" +[#]: via: "https://opensource.com/article/19/7/dashboards-devops-teams" +[#]: author: "Daniel Oh https://opensource.com/users/daniel-oh" + +DevOps 团队必备的 3 种指标仪表板 +========= + +> 仪表板可以帮助 DevOps 团队观测和监控系统,以提高性能。 + +![](https://img.linux.net.cn/data/attachment/album/201908/04/083434ixlm9lgv8ev8dlyd.jpg) + +指标仪表板帮助 [DevOps][2] 团队监控整个 DevOps 平台,以便实时响应议题issue。在处理生产环境宕机或者应用服务中断等情况时,指标仪表板显得尤为重要。 + +DevOps 仪表板聚合了多个监测工具的指标,为开发和运维团队生成监控报告。它还允许团队跟踪多项指标,例如服务部署时间、程序 bug、报错信息、工作项、待办事项等等。 + +下面三种指标仪表板可以帮助 DevOps 团队监测系统,改善服务性能。 + +### 敏捷项目管理仪表板 + +这种类型的仪表板为 DevOps 团队的工作项提供可视化视图,优化敏捷项目的工作流。有利于提高团队协作效率,对工作进行可视化并提供灵活的视图 —— 就像我们过去在白板上使用便利贴来共享项目进度、议题issue和待办事项一样。 + +- [Kanban boards][3] 允许 DevOps 团队创建卡片、标签、任务和栏目,便于持续交付敏捷项目。 +- [Burndown charts][4] 对指定时间段内未完成的工作或待办事项提供可视化视图,并记录团队当前的效率和轨迹,这些指标通常用于敏捷项目和 DevOps 项目管理。 +- [Jira boards][5] 帮助 DevOps 团队创建议题、计划迭代并生成团队总结。这些灵活的仪表板还能帮助团队综合考虑并确定个人和团队任务的优先级;实时查看、汇报和跟踪正在进行的工作;并提高团队绩效。 +- [GitHub project boards][6] 帮助确定团队任务的优先级。它们还支持拉取请求,因此团队成员可以方便地提交 DevOps 项目相关的信息。 + +### 应用程序监控仪表板 + +开发者负责优化应用和服务的性能,并开发新功能。应用程序监控面板则帮助开发者在持续集成/持续开发CI / CD流程下,加快修复 bug、增强程序健壮性、发布安全修丁的进度。另外,这些可视化仪表板有利于查看请求模式、请求耗时、报错和网络拓扑信息。 + +- [Jaeger][7] 帮助开发人员跟踪请求数量、请求响应时间等。对于分布式网络系统上的云原生应用程序,它还使用 [Istio 服务网格][8]加强了监控和跟踪。 +- [OpenCensus][9] 帮助团队查看运行应用程序的主机上的数据,它还提供了一个可插拔的导出系统,用于将数据导出到数据中心。 + +### DevOps 平台监控面板 + +你可能使用多种技术和工具在云上或本地构建 DevOps 平台,但 Linux 容器管理工具(如 Kubernetes 和 OpenShift )更利于搭建出一个成功的 DevOps 平台。因为 Linux 容器的不可变性和可移植性使得应用程序从开发环境到生产环境的编译、测试和部署变得更快更容易。 + +DevOps 平台监控仪表板帮助运营团队从机器/节点故障和服务报错中收集各种按时序排列的数据,用于编排应用程序容器和基于软件的基础架构,如网络(SDN)和存储(SDS)。这些仪表板还能可视化多维数据格式,方便地查询数据模式。 + +- [Prometheus dashboards][12] 从平台节点或者运行中的容器化应用中收集指标。帮助 DevOps 团队构建基于指标的监控系统和仪表板,监控微服务的客户端/服务器工作负载,及时识别出异常节点故障。 +- [Grafana boards][13] 帮助收集事件驱动的各项指标,包括服务响应持续时间、请求量、客户端/服务器client/server工作负载、网络流量等,并提供了可视化面板。DevOps 团队可以通过多种方式分享指标面板,也可以生成编码的当前监控数据快照分享给其他团队。 + +### 总结 + +这些仪表板提供了可视化的工作流程,能够发现团队协作、应用程序交付和平台状态中的各种问题。它们帮助开发团队增强其在快速应用交付、安全运行和自动化 CI/CD 等领域的能力。 + +------ + +via: https://opensource.com/article/19/7/dashboards-devops-teams + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[hello-wn](https://github.com/hello-wn) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-ohhttps://opensource.com/users/daniel-ohhttps://opensource.com/users/heronthecli +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png +[2]: https://opensource.com/resources/devops +[3]: https://opensource.com/article/19/1/productivity-tool-taskboard +[4]: https://openpracticelibrary.com/practice/burndown/ +[5]: https://www.atlassian.com/software/jira +[6]: https://opensource.com/life/15/11/short-introduction-github +[7]: https://www.jaegertracing.io/ +[8]: https://opensource.com/article/19/3/getting-started-jaeger +[9]: https://opencensus.io/ +[10]: https://opensource.com/article/18/11/intro-software-defined-networking +[11]: https://opensource.com/business/14/10/sage-weil-interview-openstack-ceph +[12]: https://opensource.com/article/18/12/introduction-prometheus +[13]: https://opensource.com/article/17/8/linux-grafana + diff --git a/published/201908/20190725 How to transition into a career as a DevOps engineer.md b/published/201908/20190725 How to transition into a career as a DevOps engineer.md new file mode 100644 index 0000000000..0446257826 --- /dev/null +++ b/published/201908/20190725 How to transition into a career as a DevOps engineer.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (beamrolling) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11285-1.html) +[#]: subject: (How to transition into a career as a DevOps engineer) +[#]: via: (https://opensource.com/article/19/7/how-transition-career-devops-engineer) +[#]: author: (Conor Delanbanque https://opensource.com/users/cdelanbanquehttps://opensource.com/users/daniel-ohhttps://opensource.com/users/herontheclihttps://opensource.com/users/marcobravohttps://opensource.com/users/cdelanbanque) + +如何转职为 DevOps 工程师 +====== + +> 无论你是刚毕业的大学生,还是想在职业中寻求进步的经验丰富的 IT 专家,这些提示都可以帮你成为 DevOps 工程师。 + +![](https://img.linux.net.cn/data/attachment/album/201908/30/171751rodhw6wko6fkkwkq.jpg) + +DevOps 工程是一个备受称赞的热门职业。不管你是刚毕业正在找第一份工作,还是在利用之前的行业经验的同时寻求学习新技能的机会,本指南都能帮你通过正确的步骤成为 [DevOps 工程师][2]。 + +### 让自己沉浸其中 + +首先学习 [DevOps][3] 的基本原理、实践以及方法。在使用工具之前,先了解 DevOps 背后的“为什么”。DevOps 工程师的主要目标是在整个软件开发生命周期(SDLC)中提高速度并保持或提高质量,以提供最大的业务价值。阅读文章、观看 YouTube 视频、参加当地小组聚会或者会议 —— 成为热情的 DevOps 社区中的一员,在那里你将从先行者的错误和成功中学习。 + +### 考虑你的背景 + +如果你有从事技术工作的经历,例如软件开发人员、系统工程师、系统管理员、网络运营工程师或者数据库管理员,那么你已经拥有了广泛的见解和有用的经验,它们可以帮助你在未来成为 DevOps 工程师。如果你在完成计算机科学或任何其他 STEM(LCTT 译注:STEM 是科学Science技术Technology工程Engineering数学Math四个学科的首字母缩略字)领域的学业后刚开始职业生涯,那么你将拥有在这个过渡期间需要的一些基本踏脚石。 + +DevOps 工程师的角色涵盖了广泛的职责。以下是企业最有可能使用他们的三种方向: + +* **偏向于开发(Dev)的 DevOps 工程师**,在构建应用中扮演软件开发的角色。他们日常工作的一部分是利用持续集成 / 持续交付(CI/CD)、共享仓库、云和容器,但他们不一定负责构建或实施工具。他们了解基础架构,并且在成熟的环境中,能将自己的代码推向生产环境。 +* **偏向于运维技术(Ops)的 DevOps 工程师**,可以与系统工程师或系统管理员相比较。他们了解软件的开发,但并不会把一天的重心放在构建应用上。相反,他们更有可能支持软件开发团队实现手动流程的自动化,并提高人员和技术系统的效率。这可能意味着分解遗留代码,并用不太繁琐的自动化脚本来运行相同的命令,或者可能意味着安装、配置或维护基础结构和工具。他们确保为任何有需要的团队安装可使用的工具。他们也会通过教团队如何利用 CI / CD 和其他 DevOps 实践来帮助他们。 +* **网站可靠性工程师(SRE)**,就像解决运维和基础设施的软件工程师。SRE 专注于创建可扩展、高可用且可靠的软件系统。 + +在理想的世界中,DevOps 工程师将了解以上所有领域;这在成熟的科技公司中很常见。然而,顶级银行和许多财富 500 强企业的 DevOps 职位通常会偏向开发(Dev)或运营(Ops)。 + +### 要学习的技术 + +DevOps 工程师需要了解各种技术才能有效完成工作。无论你的背景如何,请从作为 DevOps 工程师需要使用和理解的基本技术开始。 + +#### 操作系统 + +操作系统是一切运行的地方,拥有相关的基础知识十分重要。[Linux][4] 是你最有可能每天使用的操作系统,尽管有的组织会使用 Windows 操作系统。要开始使用,你可以在家中安装 Linux,在那里你可以随心所欲地中断,并在此过程中学习。 + +#### 脚本 + +接下来,选择一门语言来学习脚本编程。有很多语言可供选择,包括 Python、Go、Java、Bash、PowerShell、Ruby 和 C / C++。我建议[从 Python 开始][5],因为它相对容易学习和解释,是最受欢迎的语言之一。Python 通常是遵循面向对象编程(OOP)的准则编写的,可用于 Web 开发、软件开发以及创建桌面 GUI 和业务应用程序。 + +#### 云 + +学习了 [Linux][4] 和 [Python][5] 之后,我认为下一个该学习的是云计算。基础设施不再只是“运维小哥”的事情了,因此你需要接触云平台,例如 AWS 云服务、Azure 或者谷歌云平台。我会从 AWS 开始,因为它有大量免费学习工具,可以帮助你降低作为开发人员、运维人员,甚至面向业务的部门的任何障碍。事实上,你可能会被它提供的东西所淹没。考虑从 EC2、S3 和 VPC 开始,然后看看你从其中想学到什么。 + +#### 编程语言 + +如果你对 DevOps 的软件开发充满热情,请继续提高你的编程技能。DevOps 中的一些优秀和常用的编程语言和你用于脚本编程的相同:Python、Go、Java、Bash、PowerShell、Ruby 和 C / C++。你还应该熟悉 Jenkins 和 Git / Github,你将会在 CI / CD 过程中经常使用到它们。 + +#### 容器 + +最后,使用 Docker 和编排平台(如 Kubernetes)等工具开始学习[容器化][6]。网上有大量的免费学习资源,大多数城市都有本地的线下小组,你可以在友好的环境中向有经验的人学习(还有披萨和啤酒哦!)。 + +#### 其他的呢? + +如果你缺乏开发经验,你依然可以通过对自动化的热情,提高效率,与他人协作以及改进自己的工作来[参与 DevOps][3]。我仍然建议学习上述工具,但重点不要放在编程 / 脚本语言上。了解基础架构即服务、平台即服务、云平台和 Linux 会非常有用。你可能会设置工具并学习如何构建具有弹性和容错能力的系统,并在编写代码时利用它们。 + +### 找一份 DevOps 的工作 + +求职过程会有所不同,具体取决于你是否一直从事技术工作,是否正在进入 DevOps 领域,或者是刚开始职业生涯的毕业生。 + +#### 如果你已经从事技术工作 + +如果你正在从一个技术领域转入 DevOps 角色,首先尝试在你当前的公司寻找机会。你能通过和其他的团队一起工作来重新掌握技能吗?尝试跟随其他团队成员,寻求建议,并在不离开当前工作的情况下获得新技能。如果做不到这一点,你可能需要换另一家公司。如果你能从上面列出的一些实践、工具和技术中学习,你将能在面试时展示相关知识从而占据有利位置。关键是要诚实,不要担心失败。大多数招聘主管都明白你并不知道所有的答案;如果你能展示你一直在学习的东西,并解释你愿意学习更多,你应该有机会获得 DevOps 的工作。 + +#### 如果你刚开始职业生涯 + +申请雇用初级 DevOps 工程师的公司的空缺机会。不幸的是,许多公司表示他们希望寻找更富有经验的人,并建议你在获得经验后再申请该职位。这是“我们需要经验丰富的人”的典型,令人沮丧的场景,并且似乎没人愿意给你第一次机会。 + +然而,并不是所有求职经历都那么令人沮丧;一些公司专注于培训和提升刚从大学毕业的学生。例如,我工作的 [MThree][7] 会聘请应届毕业生并且对其进行 8 周的培训。当完成培训后,参与者们可以充分了解到整个 SDLC,并充分了解它在财富 500 强公司环境中的运用方式。毕业生被聘为 MThree 的客户公司的初级 DevOps 工程师 —— MThree 在前 18 - 24 个月内支付全职工资和福利,之后他们将作为直接雇员加入客户。这是弥合从大学到技术职业的间隙的好方法。 + +### 总结 + +转职成 DevOps 工程师的方法有很多种。这是一条非常有益的职业路线,可能会让你保持繁忙和挑战 — 并增加你的收入潜力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/how-transition-career-devops-engineer + +作者:[Conor Delanbanque][a] +选题:[lujun9972][b] +译者:[beamrolling](https://github.com/beamrolling) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cdelanbanquehttps://opensource.com/users/daniel-ohhttps://opensource.com/users/herontheclihttps://opensource.com/users/marcobravohttps://opensource.com/users/cdelanbanque +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hiring_talent_resume_job_career.png?itok=Ci_ulYAH (technical resume for hiring new talent) +[2]: https://opensource.com/article/19/7/devops-vs-sysadmin +[3]: https://opensource.com/resources/devops +[4]: https://opensource.com/resources/linux +[5]: https://opensource.com/resources/python +[6]: https://opensource.com/article/18/8/sysadmins-guide-containers +[7]: https://www.mthreealumni.com/ diff --git a/published/201908/20190725 Introduction to GNU Autotools.md b/published/201908/20190725 Introduction to GNU Autotools.md new file mode 100644 index 0000000000..71cda2d23a --- /dev/null +++ b/published/201908/20190725 Introduction to GNU Autotools.md @@ -0,0 +1,245 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11218-1.html) +[#]: subject: (Introduction to GNU Autotools) +[#]: via: (https://opensource.com/article/19/7/introduction-gnu-autotools) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +GNU Autotools 介绍 +====== + +> 如果你仍未使用过 Autotools,那么这篇文章将改变你递交代码的方式。 + +![](https://img.linux.net.cn/data/attachment/album/201908/13/094739ahql50gx9x10y157.jpg) + +你有没有下载过流行的软件项目的源代码,要求你输入几乎是仪式般的 `./configure; make && make install` 命令序列来构建和安装它?如果是这样,你已经使用过 [GNU Autotools][2] 了。如果你曾经研究过这样的项目所附带的一些文件,你可能会对这种构建系统的显而易见的复杂性感到害怕。 + +好的消息是,GNU Autotools 的设置要比你想象的要简单得多,GNU Autotools 本身可以为你生成这些上千行的配置文件。是的,你可以编写 20 或 30 行安装代码,并免费获得其他 4,000 行。 + +### Autotools 工作方式 + +如果你是初次使用 Linux 的用户,正在寻找有关如何安装应用程序的信息,那么你不必阅读本文!如果你想研究如何构建软件,欢迎阅读它;但如果你只是要安装一个新应用程序,请阅读我在[在 Linux 上安装应用程序][3]的文章。 + +对于开发人员来说,Autotools 是一种管理和打包源代码的快捷方式,以便用户可以编译和安装软件。 Autotools 也得到了主要打包格式(如 DEB 和 RPM)的良好支持,因此软件存储库的维护者可以轻松管理使用 Autotools 构建的项目。 + +Autotools 工作步骤: + +1. 首先,在 `./configure` 步骤中,Autotools 扫描宿主机系统(即当前正在运行的计算机)以发现默认设置。默认设置包括支持库所在的位置,以及新软件应放在系统上的位置。 +2. 接下来,在 `make` 步骤中,Autotools 通常通过将人类可读的源代码转换为机器语言来构建应用程序。 +3. 最后,在 `make install` 步骤中,Autotools 将其构建好的文件复制到计算机上(在配置阶段检测到)的相应位置。 + +这个过程看起来很简单,和你使用 Autotools 的步骤一样。 + +### Autotools 的优势 + +GNU Autotools 是我们大多数人认为理所当然的重要软件。与 [GCC(GNU 编译器集合)][4]一起,Autotools 是支持将自由软件构建和安装到正在运行的系统的脚手架。如果你正在运行 [POSIX][5] 系统,可以毫不保守地说,你的计算机上的操作系统里大多数可运行软件都是这些这样构建的。 + +即使是你的项目是个玩具项目不是操作系统,你可能会认为 Autotools 对你的需求来说太过分了。但是,尽管它的名气很大,Autotools 有许多可能对你有益的小功能,即使你的项目只是一个相对简单的应用程序或一系列脚本。 + +#### 可移植性 + +首先,Autotools 考虑到了可移植性。虽然它无法使你的项目在所有 POSIX 平台上工作(这取决于你,编码的人),但 Autotools 可以确保你标记为要安装的文件安装到已知平台上最合理的位置。而且由于 Autotools,高级用户可以轻松地根据他们自己的系统情况定制和覆盖任何非最佳设定。 + +使用 Autotools,你只要知道需要将文件安装到哪个常规位置就行了。它会处理其他一切。不需要可能破坏未经测试的操作系统的定制安装脚本。 + +#### 打包 + +Autotools 也得到了很好的支持。将一个带有 Autotools 的项目交给一个发行版打包者,无论他们是打包成 RPM、DEB、TGZ 还是其他任何东西,都很简单。打包工具知道 Autotools,因此可能不需要修补、魔改或调整。在许多情况下,将 Autotools 项目结合到流程中甚至可以实现自动化。 + +### 如何使用 Autotools + +要使用 Autotools,必须先安装它。你的发行版可能提供一个单个的软件包来帮助开发人员构建项目,或者它可能为每个组件提供了单独的软件包,因此你可能需要在你的平台上进行一些研究以发现需要安装的软件包。 + +Autotools 的组件是: + + * `automake` + * `autoconf` + * `automake` + * `make` + +虽然你可能需要安装项目所需的编译器(例如 GCC),但 Autotools 可以很好地处理不需要编译的脚本或二进制文件。实际上,Autotools 对于此类项目非常有用,因为它提供了一个 `make uninstall` 脚本,以便于删除。 + +安装了所有组件之后,现在让我们了解一下你的项目文件的组成结构。 + +#### Autotools 项目结构 + +GNU Autotools 有非常具体的预期规范,如果你经常下载和构建源代码,可能大多数都很熟悉。首先,源代码本身应该位于一个名为 `src` 的子目录中。 + +你的项目不必遵循所有这些预期规范,但如果你将文件放在非标准位置(从 Autotools 的角度来看),那么你将不得不稍后在 `Makefile` 中对其进行调整。 + +此外,这些文件是必需的: + + * `NEWS` + * `README` + * `AUTHORS` + * `ChangeLog` + +你不必主动使用这些文件,它们可以是包含所有信息的单个汇总文档(如 `README.md`)的符号链接,但它们必须存在。 + +#### Autotools 配置 + +在你的项目根目录下创建一个名为 `configure.ac` 的文件。`autoconf` 使用此文件来创建用户在构建之前运行的 `configure` shell 脚本。该文件必须至少包含 `AC_INIT` 和 `AC_OUTPUT` [M4 宏][6]。你不需要了解有关 M4 语言的任何信息就可以使用这些宏;它们已经为你编写好了,并且所有与 Autotools 相关的内容都在该文档中定义好了。 + +在你喜欢的文本编辑器中打开该文件。`AC_INIT` 宏可以包括包名称、版本、报告错误的电子邮件地址、项目 URL 以及可选的源 TAR 文件名称等参数。 + +[AC_OUTPUT][7] 宏更简单,不用任何参数。 + +``` +AC_INIT([penguin], [2019.3.6], [[seth@example.com][8]]) +AC_OUTPUT +``` + +如果你此刻运行 `autoconf`,会依据你的 `configure.ac` 文件生成一个 `configure` 脚本,它是可以运行的。但是,也就是能运行而已,因为到目前为止你所做的就是定义项目的元数据,并要求创建一个配置脚本。 + +你必须在 `configure.ac` 文件中调用的下一个宏是创建 [Makefile][9] 的函数。 `Makefile` 会告诉 `make` 命令做什么(通常是如何编译和链接程序)。 + +创建 `Makefile` 的宏是 `AM_INIT_AUTOMAKE`,它不接受任何参数,而 `AC_CONFIG_FILES` 接受的参数是你要输出的文件的名称。 + +最后,你必须添加一个宏来考虑你的项目所需的编译器。你使用的宏显然取决于你的项目。如果你的项目是用 C++ 编写的,那么适当的宏是 `AC_PROG_CXX`,而用 C 编写的项目需要 `AC_PROG_CC`,依此类推,详见 Autoconf 文档中的 [Building Programs and Libraries][10] 部分。 + +例如,我可能会为我的 C++ 程序添加以下内容: + +``` +AC_INIT([penguin], [2019.3.6], [[seth@example.com][8]]) +AC_OUTPUT +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) +AC_PROG_CXX +``` + +保存该文件。现在让我们将目光转到 `Makefile`。 + +#### 生成 Autotools Makefile + +`Makefile` 并不难手写,但 Autotools 可以为你编写一个,而它生成的那个将使用在 `./configure` 步骤中检测到的配置选项,并且它将包含比你考虑要包括或想要自己写的还要多得多的选项。然而,Autotools 并不能检测你的项目构建所需的所有内容,因此你必须在文件 `Makefile.am` 中添加一些细节,然后在构造 `Makefile` 时由 `automake` 使用。 + +`Makefile.am` 使用与 `Makefile` 相同的语法,所以如果你曾经从头开始编写过 `Makefile`,那么这个过程将是熟悉和简单的。通常,`Makefile.am` 文件只需要几个变量定义来指示要构建的文件以及它们的安装位置即可。 + +以 `_PROGRAMS` 结尾的变量标识了要构建的代码(这通常被认为是原语primary目标;这是 `Makefile` 存在的主要意义)。Automake 也会识别其他原语,如 `_SCRIPTS`、`_ DATA`、`_LIBRARIES`,以及构成软件项目的其他常见部分。 + +如果你的应用程序在构建过程中需要实际编译,那么你可以用 `bin_PROGRAMS` 变量将其标记为二进制程序,然后使用该程序名称作为变量前缀引用构建它所需的源代码的任何部分(这些部分可能是将被编译和链接在一起的一个或多个文件): + +``` +bin_PROGRAMS = penguin +penguin_SOURCES = penguin.cpp +``` + +`bin_PROGRAMS` 的目标被安装在 `bindir` 中,它在编译期间可由用户配置。 + +如果你的应用程序不需要实际编译,那么你的项目根本不需要 `bin_PROGRAMS` 变量。例如,如果你的项目是用 Bash、Perl 或类似的解释语言编写的脚本,那么定义一个 `_SCRIPTS` 变量来替代: + +``` +bin_SCRIPTS = bin/penguin +``` + +Automake 期望源代码位于名为 `src` 的目录中,因此如果你的项目使用替代目录结构进行布局,则必须告知 Automake 接受来自外部源的代码: + +``` +AUTOMAKE_OPTIONS = foreign subdir-objects +``` + +最后,你可以在 `Makefile.am` 中创建任何自定义的 `Makefile` 规则,它们将逐字复制到生成的 `Makefile` 中。例如,如果你知道一些源代码中的临时值需要在安装前替换,则可以为该过程创建自定义规则: + +``` +all-am: penguin +        touch bin/penguin.sh +        +penguin: bin/penguin.sh +        @sed "s|__datadir__|@datadir@|" $< >bin/$@ +``` + +一个特别有用的技巧是扩展现有的 `clean` 目标,至少在开发期间是这样的。`make clean` 命令通常会删除除了 Automake 基础结构之外的所有生成的构建文件。它是这样设计的,因为大多数用户很少想要 `make clean` 来删除那些便于构建代码的文件。 + +但是,在开发期间,你可能需要一种方法可靠地将项目返回到相对不受 Autotools 影响的状态。在这种情况下,你可能想要添加: + +``` +clean-local: +        @rm config.status configure config.log +        @rm Makefile +        @rm -r autom4te.cache/ +        @rm aclocal.m4 +        @rm compile install-sh missing Makefile.in +``` + +这里有很多灵活性,如果你还不熟悉 `Makefile`,那么很难知道你的 `Makefile.am` 需要什么。最基本需要的是原语目标,无论是二进制程序还是脚本,以及源代码所在位置的指示(无论是通过 `_SOURCES` 变量还是使用 `AUTOMAKE_OPTIONS` 告诉 Automake 在哪里查找源代码)。 + +一旦定义了这些变量和设置,如下一节所示,你就可以尝试生成构建脚本,并调整缺少的任何内容。 + +#### 生成 Autotools 构建脚本 + +你已经构建了基础结构,现在是时候让 Autotools 做它最擅长的事情:自动化你的项目工具。对于开发人员(你),Autotools 的接口与构建代码的用户的不同。 + +构建者通常使用这个众所周知的顺序: + +``` +$ ./configure +$ make +$ sudo make install +``` + +但是,要使这种咒语起作用,你作为开发人员必须引导构建这些基础结构。首先,运行 `autoreconf` 以生成用户在运行 `make` 之前调用的 `configure` 脚本。使用 `-install` 选项将辅助文件(例如符号链接)引入到 `depcomp`(这是在编译过程中生成依赖项的脚本),以及 `compile` 脚本的副本(一个编译器的包装器,用于说明语法,等等)。 + +``` +$ autoreconf --install +configure.ac:3: installing './compile' +configure.ac:2: installing './install-sh' +configure.ac:2: installing './missing' +``` + +使用此开发构建环境,你可以创建源代码分发包: + +``` +$ make dist +``` + +`dist` 目标是从 Autotools “免费”获得的规则。这是一个内置于 `Makefile` 中的功能,它是通过简单的 `Makefile.am` 配置生成的。该目标可以生成一个 `tar.gz` 存档,其中包含了所有源代码和所有必要的 Autotools 基础设施,以便下载程序包的人员可以构建项目。 + +此时,你应该仔细查看存档文件的内容,以确保它包含你要发送给用户的所有内容。当然,你也应该尝试自己构建: + +``` +$ tar --extract --file penguin-0.0.1.tar.gz +$ cd penguin-0.0.1 +$ ./configure +$ make +$ DESTDIR=/tmp/penguin-test-build make install +``` + +如果你的构建成功,你将找到由 `DESTDIR` 指定的已编译应用程序的本地副本(在此示例的情况下为 `/tmp/penguin-test-build`)。 + +``` +$ /tmp/example-test-build/usr/local/bin/example +hello world from GNU Autotools +``` + +### 去使用 Autotools + +Autotools 是一个很好的脚本集合,可用于可预测的自动发布过程。如果你习惯使用 Python 或 Bash 构建器,这个工具集对你来说可能是新的,但它为你的项目提供的结构和适应性可能值得学习。 + +而 Autotools 也不只是用于代码。Autotools 可用于构建 [Docbook][11] 项目,保持媒体有序(我使用 Autotools 进行音乐发布),文档项目以及其他任何可以从可自定义安装目标中受益的内容。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/introduction-gnu-autotools + +作者:[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/linux_kernel_clang_vscode.jpg?itok=fozZ4zrr (Linux kernel source code (C) in Visual Studio Code) +[2]: https://www.gnu.org/software/automake/faq/autotools-faq.html +[3]: https://linux.cn/article-9486-1.html +[4]: https://en.wikipedia.org/wiki/GNU_Compiler_Collection +[5]: https://en.wikipedia.org/wiki/POSIX +[6]: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Initializing-configure.html +[7]: https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Output.html#Output +[8]: mailto:seth@example.com +[9]: https://www.gnu.org/software/make/manual/html_node/Introduction.html +[10]: https://www.gnu.org/software/automake/manual/html_node/Programs.html#Programs +[11]: https://opensource.com/article/17/9/docbook diff --git a/published/201908/20190726 Manage your passwords with Bitwarden and Podman.md b/published/201908/20190726 Manage your passwords with Bitwarden and Podman.md new file mode 100644 index 0000000000..0abb8e1378 --- /dev/null +++ b/published/201908/20190726 Manage your passwords with Bitwarden and Podman.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11181-1.html) +[#]: subject: (Manage your passwords with Bitwarden and Podman) +[#]: via: (https://fedoramagazine.org/manage-your-passwords-with-bitwarden-and-podman/) +[#]: author: (Eric Gustavsson https://fedoramagazine.org/author/egustavs/) + +使用 Bitwarden 和 Podman 管理你的密码 +====== + +![][1] + +在过去的一年中,你可能会遇到一些试图向你推销密码管理器的广告。比如 [LastPass][2]、[1Password][3] 或 [Dashlane][4]。密码管理器消除了记住所有网站密码的负担。你不再需要使用重复或容易记住的密码。相反,你只需要记住一个可以解锁所有其他密码的密码。 + +通过使用一个强密码而​​不是许多弱密码,这可以使你更安全。如果你有基于云的密码管理器(例如 LastPass、1Password 或 Dashlane),你还可以跨设备同步密码。不幸的是,这些产品都不是开源的。幸运的是,还有其他开源替代品。 + +### 开源密码管理器 + +替代方案包括 Bitwarden、[LessPass][5] 或 [KeePass][6]。Bitwarden 是一款[开源密码管理器][7],它会将所有密码加密存储在服务器上,它的工作方式与 LastPass、1Password 或 Dashlane 相同。LessPass 有点不同,因为它专注于成为无状态密码管理器。这意味着它根据主密码、网站和用户名生成密码,而不是保存加密的密码。另一方面,KeePass 是一个基于文件的密码管理器,它的插件和应用具有很大的灵活性。 + +这三个应用中的每一个都有其自身的缺点。Bitwarden 将所有东西保存在一个地方,并通过其 API 和网站接口暴露给网络。LessPass 无法保存自定义密码,因为它是无状态的,因此你需要使用它生成的密码。KeePass 是一个基于文件的密码管理器,因此无法在设备之间轻松同步。你可以使用云存储和 [WebDAV][8] 来解决此问题,但是有许多客户端不支持它,如果设备无法正确同步,你可能会遇到文件冲突。 + +本文重点介绍 Bitwarden。 + +### 运行非官方的 Bitwarden 实现 + +有一个名为 [bitwarden_rs][9] 的服务器及其 API 的社区实现。这个实现是完全开源的,因为它可以使用 SQLite 或 MariaDB/MySQL,而不是官方服务器使用的专有 Microsoft SQL Server。 + +有一点重要的是要认识到官方和非官方版本之间存在一些差异。例如,[官方服务器已经由第三方审核][10],而非官方服务器还没有。在实现方面,非官方版本缺少[电子邮件确认和采用 Duo 或邮件码的双因素身份验证][11]。 + +让我们在 SELinux 中运行服务器。根据 bitwarden_rs 的文档,你可以如下构建一个 Podman 命令: + +``` +$ podman run -d \ + --userns=keep-id \ + --name bitwarden \ + -e SIGNUPS_ALLOWED=false \ + -e ROCKET_PORT=8080 \ + -v /home/egustavs/Bitwarden/bw-data/:/data/:Z \ + -p 8080:8080 \ + bitwardenrs/server:latest +``` + +这将下载 bitwarden_rs 镜像并在用户命名空间下的用户容器中运行它。它使用 1024 以上的端口,以便非 root 用户可以绑定它。它还使用 `:Z` 更改卷的 SELinux 上下文,以防止在 `/data` 中的读写权限问题。 + +如果你在某个域下托管它,建议将此服务器放在 Apache 或 Nginx 的反向代理下。这样,你可以使用 80 和 443 端口指向容器的 8080 端口,而无需以 root 身份运行容器。 + +### 在 systemd 下运行 + +Bitwarden 现在运行了,你可能希望保持这种状态。接下来,创建一个使容器保持运行的单元文件,如果它没有响应则自动重新启动,并在系统重启后开始运行。创建文件 `/etc/systemd/system/bitwarden.service`: + +``` +[Unit] +Description=Bitwarden Podman container +Wants=syslog.service + +[Service] +User=egustavs +Group=egustavs +TimeoutStartSec=0 +ExecStart=/usr/bin/podman run 'bitwarden' +ExecStop=-/usr/bin/podman stop -t 10 'bitwarden' +Restart=always +RestartSec=30s +KillMode=none + +[Install] +WantedBy=multi-user.target +``` + +现在使用 [sudo][12] 启用并启动该服务: + +``` +$ sudo systemctl enable bitwarden.service && sudo systemctl start bitwarden.service +$ systemctl status bitwarden.service +bitwarden.service - Bitwarden Podman container + Loaded: loaded (/etc/systemd/system/bitwarden.service; enabled; vendor preset: disabled) + Active: active (running) since Tue 2019-07-09 20:23:16 UTC; 1 day 14h ago + Main PID: 14861 (podman) + Tasks: 44 (limit: 4696) + Memory: 463.4M +``` + +成功了!Bitwarden 现在运行了并将继续运行。 + +### 添加 LetsEncrypt + +如果你有域名,强烈建议你使用类似 LetsEncrypt 的加密证书运行你的 Bitwarden 实例。Certbot 是一个为我们创建 LetsEncrypt 证书的机器人,这里有个[在 Fedora 中操作的指南][13]。 + +生成证书后,你可以按照 [bitwarden_rs 指南中关于 HTTPS 的部分来][14]。只要记得将 `:Z` 附加到 LetsEncrypt 来处理权限,而不用更改端口。 + +* * * + +照片由 [CMDR Shane][15] 拍摄,发表在 [Unsplash][16] 上。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/manage-your-passwords-with-bitwarden-and-podman/ + +作者:[Eric Gustavsson][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://fedoramagazine.org/author/egustavs/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/bitwarden-816x345.jpg +[2]: https://www.lastpass.com +[3]: https://1password.com/ +[4]: https://www.dashlane.com/ +[5]: https://lesspass.com/ +[6]: https://keepass.info/ +[7]: https://bitwarden.com/ +[8]: https://en.wikipedia.org/wiki/WebDAV +[9]: https://github.com/dani-garcia/bitwarden_rs/ +[10]: https://blog.bitwarden.com/bitwarden-completes-third-party-security-audit-c1cc81b6d33 +[11]: https://github.com/dani-garcia/bitwarden_rs/wiki#missing-features +[12]: https://fedoramagazine.org/howto-use-sudo/ +[13]: https://certbot.eff.org/instructions +[14]: https://github.com/dani-garcia/bitwarden_rs/wiki/Enabling-HTTPS +[15]: https://unsplash.com/@cmdrshane?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[16]: https://unsplash.com/search/photos/password?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/201908/20190729 Command line quick tips- More about permissions.md b/published/201908/20190729 Command line quick tips- More about permissions.md new file mode 100644 index 0000000000..bbe0b4c66a --- /dev/null +++ b/published/201908/20190729 Command line quick tips- More about permissions.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11185-1.html) +[#]: subject: (Command line quick tips: More about permissions) +[#]: via: (https://fedoramagazine.org/command-line-quick-tips-more-about-permissions/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +命令行快速提示:权限进阶 +====== + +![][1] + +前一篇文章[介绍了 Fedora 系统上有关文件权限的一些基础知识][2]。本部分介绍使用权限管理文件访问和共享的其他方法。它建立在前一篇文章中的知识和示例的基础上,所以如果你还没有阅读过那篇文章,请[查看][2]它。 + +### 符号与八进制 + +在上一篇文章中,你了解到文件有三个不同的权限集。拥有该文件的用户有一个集合,拥有该文件的组的成员有一个集合,然后最终一个集合适用于其他所有人。在长列表(`ls -l`)中这些权限使用符号模式显示在屏幕上。 + +每个集合都有 `r`、`w` 和 `x` 条目,表示特定用户(所有者、组成员或其他)是否可以读取、写入或执行该文件。但是还有另一种表达这些权限的方法:八进制模式。 + +你已经习惯了[十进制][3]编号系统,它有十个不同的值(`0` 到 `9`)。另一方面,八进制系统有八个不同的值(`0` 到 `7`)。在表示权限时,八进制用作速记来显示 `r`、`w` 和 `x` 字段的值。将每个字段视为具有如下值: + + * `r` = 4 + * `w` = 2 + * `x` = 1 + +现在,你可以使用单个八进制值表达任何组合。例如,读取和写入权限(但没有执行权限)的值为 `6`。读取和执行权限的值仅为 `5`。文件的 `rwxr-xr-x` 符号权限的八进制值为 `755`。 + +与符号值类似,你可以使用八进制值使用 `chmod` 命令设置文件权限。以下两个命令对文件设置相同的权限: + +``` +chmod u=rw,g=r,o=r myfile1 +chmod 644 myfile1 +``` + +### 特殊权限位 + +文件上还有几个特殊权限位。这些被称为 `setuid`(或 `suid`)、`setgid`(或 `sgid`),以及粘滞位sticky bit(或阻止删除位delete inhibit)。 将此视为另一组八进制值: + + * `setuid` = 4 + * `setgid` = 2 + * `sticky` = 1 + +**除非**该文件是可执行的,否则 `setuid` 位是被忽略的。如果是可执行的这种情况,则该文件(可能是应用程序或脚本)的运行就像拥有该文件的用户启动的一样。`setuid` 的一个很好的例子是 `/bin/passwd` 实用程序,它允许用户设置或更改密码。此实用程序必须能够写入到不允许普通用户更改的文件中(LCTT 译注:此处是指 `/etc/passwd` 和 `/etc/shadow`)。因此它需要精心编写,由 `root` 用户拥有,并具有 `setuid` 位,以便它可以更改密码相关文件。 + +`setgid` 位对于可执行文件的工作方式类似。该文件将使用拥有它的组的权限运行。但是,`setgid` 对于目录还有一个额外的用途。如果在具有 `setgid` 权限的目录中创建文件,则该文件的组所有者将设置为该目录的组所有者。 + +最后,虽然文件粘滞位没有意义会被忽略,但它对目录很有用。在目录上设置的粘滞位将阻止用户删除其他用户拥有的该目录中的文件。 + +在八进制模式下使用 `chmod` 设置这些位的方法是添加一个值前缀,例如 `4755`,可以将 `setuid` 添加到可执行文件中。在符号模式下,`u` 和 `g` 也可用于设置或删除 `setuid` 和 `setgid`,例如 `u+s,g+s`。粘滞位使用 `o+t` 设置。(其他的组合,如 `o+s` 或 `u+t`,是没有意义的,会被忽略。) + +### 共享与特殊权限 + +回想一下前一篇文章中关于需要共享文件的财务团队的示例。可以想象,特殊权限位有助于更有效地解决问题。原来的解决方案只是创建了一个整个组可以写入的目录: + +``` +drwxrwx---. 2 root finance 4096 Jul 6 15:35 finance +``` + +此目录的一个问题是,`finance` 组成员的用户 `dwayne` 和 `jill` 可以删除彼此的文件。这对于共享空间来说不是最佳选择。它在某些情况下可能有用,但在处理财务记录时可能不会! + +另一个问题是此目录中的文件可能无法真正共享,因为它们将由 `dwayne` 和 `jill` 的默认组拥有 - 很可能用户私有组也命名为 `dwayne` 和 `jill`,而不是 `finance`。 + +解决此问题的更好方法是在文件夹上设置 `setgid` 和粘滞位。这将做两件事:使文件夹中创建的文件自动归 `finance` 组所有,并防止 `dwayne` 和 `jill` 删除彼此的文件。下面这些命令中的任何一个都可以工作: + +``` +sudo chmod 3770 finance +sudo chmod u+rwx,g+rwxs,o+t finance +``` + +该文件的长列表现在显示了所应用的新特殊权限。粘滞位显示为 `T` 而不是 `t`,因为 `finance` 组之外的用户无法搜索该文件夹。 + +``` +drwxrws--T. 2 root finance 4096 Jul 6 15:35 finance +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/command-line-quick-tips-more-about-permissions/ + +作者:[Paul W. Frields][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://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg +[2]: https://linux.cn/article-11123-1.html +[3]: https://en.wikipedia.org/wiki/Decimal diff --git a/published/201908/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md b/published/201908/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md new file mode 100644 index 0000000000..48264d8479 --- /dev/null +++ b/published/201908/20190729 Top 8 Things to do after Installing Debian 10 (Buster).md @@ -0,0 +1,288 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11178-1.html) +[#]: subject: (Top 8 Things to do after Installing Debian 10 (Buster)) +[#]: via: (https://www.linuxtechi.com/things-to-do-after-installing-debian-10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +Debian 10(Buster)安装后要做的前 8 件事 +====== + +Debian 10 的代号是 Buster,它是来自 Debian 家族的最新 LTS 发布版本,并包含大量的特色功能。因此,如果你已经在你的电脑上安装了 Debian 10,并在思考接下来该做什么,那么,请继续阅读这篇文章直到结尾,因为我们为你提供在安装 Debian 10 后要做的前 8 件事。对于还没有安装 Debian 10 的人们,请阅读这篇指南 [图解 Debian 10 (Buster) 安装步骤][1]。 让我们继续这篇文章。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/Things-to-do-after-installing-debian10.jpg) + +### 1) 安装和配置 sudo + +在设置完成 Debian 10 后,你需要做的第一件事是安装 sudo 软件包,因为它能够使你获得管理员权限来安装你需要的软件包。为安装和配置 sudo,请使用下面的命令: + +变成 root 用户,然后使用下面的命令安装 sudo 软件包, + +``` +root@linuxtechi:~$ su - +Password: +root@linuxtechi:~# apt install sudo -y +``` + +添加你的本地用户到 sudo 组,使用下面的 [usermod][2] 命令, + +``` +root@linuxtechi:~# usermod -aG sudo pkumar +root@linuxtechi:~# +``` + +现在验证是否本地用户获得 sudo 权限: + +``` +root@linuxtechi:~$ id +uid=1000(pkumar) gid=1000(pkumar) groups=1000(pkumar),27(sudo) +root@linuxtechi:~$ sudo vi /etc/hosts +[sudo] password for pkumar: +root@linuxtechi:~$ +``` + +### 2) 校正日期和时间 + +在你成功配置 sudo 软件包后,接下来,你需要根据你的位置来校正日期和时间。为了校正日期和时间, + +转到系统 **设置** –> **详细说明** –> **日期和时间** ,然后更改为适合你的位置的时区。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/Adjust-date-time-Debian10.jpg) + +一旦时区被更改,你可以看到时钟中的时间自动更改。 + +### 3) 应用所有更新 + +在 Debian 10 安装后,建议安装所有 Debian 10 软件包存储库中可用的更新,执行下面的 `apt` 命令: + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt upgrade -y +``` + +**注意:** 如果你是 vi 编辑器的忠实粉丝,那么使用下面的 `apt` 命令安装 `vim`: + +``` +root@linuxtechi:~$ sudo apt install vim -y +``` + +### 4) 安装 Flash 播放器插件 + +默认情况下,Debian 10(Buster)存储库不包含 Flash 插件,因此,用户需要遵循下面的介绍来在他们的系统中查找和安装 flash 播放器。 + +为 Flash 播放器配置存储库: + +``` +root@linuxtechi:~$ echo "deb http://ftp.de.debian.org/debian buster main contrib" | sudo tee -a /etc/apt/sources.list +deb http://ftp.de.debian.org/debian buster main contrib +root@linuxtechi:~ +``` + +现在使用下面的命令更新软件包索引: + +``` +root@linuxtechi:~$ sudo apt update +``` + +使用下面的 `apt` 命令安装 Flash 插件: + +``` +root@linuxtechi:~$ sudo apt install pepperflashplugin-nonfree -y +``` + +一旦软件包被成功安装,接下来,尝试播放 YouTube 中的视频: + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/Flash-Player-plugin-Debian10.jpg) + +### 5) 安装软件,如 VLC、Skype、FileZilla 和截图工具 + +如此,现在我们已经启用 Flash 播放器,是时候在我们的 Debian 10 系统中安装所有其它的软件,如 VLC、Skype,Filezilla 和截图工具(flameshot)。 + +#### 安装 VLC 多媒体播放器 + +为在你的系统中安装 VLC 播放器,使用下面的 `apt` 命令: + +``` +root@linuxtechi:~$ sudo apt install vlc -y +``` + +在成功安装 VLC 播放器后,尝试播放你喜欢的视频。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/Debian10-VLC.jpg) + +#### 安装 Skype + +首先,下载最新的 Skype 软件包: + +``` +root@linuxtechi:~$ wget https://go.skype.com/skypeforlinux-64.deb +``` + +接下来,使用 `apt` 命令安装软件包: + +``` +root@linuxtechi:~$ sudo apt install ./skypeforlinux-64.deb +``` + +在成功安装 Skype 后,尝试访问它,并输入你的用户名和密码。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/skype-Debian10.jpg) + +#### 安装 Filezilla + +为在你的系统中安装 Filezilla,使用下面的 `apt` 命令, + +``` +root@linuxtechi:~$ sudo apt install filezilla -y +``` + +一旦 FileZilla 软件包被成功安装,尝试访问它。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/FileZilla-Debian10.jpg) + +#### 安装截图工具(flameshot) + +使用下面的命令来安装截图工具:flameshot, + +``` +root@linuxtechi:~$ sudo apt install flameshot -y +``` + +**注意:** Shutter 工具在 Debian 10 中已被移除。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/flameshoot-debian10.jpg) + +### 6) 启用和启动防火墙 + +总是建议启动防火墙来使你的网络安全。如果你希望在 Debian 10 中启用防火墙, **UFW**(简单的防火墙)是最好的控制防火墙的工具。UFW 在 Debian 存储库中可用,它非常容易安装,如下: + +``` +root@linuxtechi:~$ sudo apt install ufw +``` + +在你安装 UFW 后,接下来的步骤是设置防火墙。因此,设置防火墙,通过拒绝端口来禁用所有的传入流量,并且只允许需要的端口传出,像 ssh、http 和 https。 + +``` +root@linuxtechi:~$ sudo ufw default deny incoming +Default incoming policy changed to 'deny' +(be sure to update your rules accordingly) +root@linuxtechi:~$ sudo ufw default allow outgoing +Default outgoing policy changed to 'allow' +(be sure to update your rules accordingly) +root@linuxtechi:~$ +``` + +允许 SSH 端口: + +``` +root@linuxtechi:~$ sudo ufw allow ssh +Rules updated +Rules updated (v6) +root@linuxtechi:~$ +``` + +假使你在系统中已经安装 Web 服务器,那么使用下面的 `ufw` 命令来在防火墙中允许它们的端口: + +``` +root@linuxtechi:~$ sudo ufw allow 80 +Rules updated +Rules updated (v6) +root@linuxtechi:~$ sudo ufw allow 443 +Rules updated +Rules updated (v6) +root@linuxtechi:~$ +``` + +最后,你可以使用下面的命令启用 UFW: + +``` +root@linuxtechi:~$ sudo ufw enable +Command may disrupt existing ssh connections. Proceed with operation (y|n)? y +Firewall is active and enabled on system startup +root@linuxtechi:~$ +``` + +假使你想检查你的防火墙的状态,你可以使用下面的命令检查它: + +``` +root@linuxtechi:~$ sudo ufw status +``` + +### 7) 安装虚拟化软件(VirtualBox) + +安装 Virtualbox 的第一步是将 Oracle VirtualBox 存储库的公钥导入到你的 Debian 10 系统: + +``` +root@linuxtechi:~$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - +OK +root@linuxtechi:~$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - +OK +root@linuxtechi:~$ +``` + +如果导入成功,你将看到一个 “OK” 显示信息。 + +接下来,你需要添加存储库到仓库列表: + +``` +root@linuxtechi:~$ sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian buster contrib" +root@linuxtechi:~$ +``` + +最后,是时候在你的系统中安装 VirtualBox 6.0: + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install virtualbox-6.0 -y +``` + +一旦 VirtualBox 软件包被成功安装,尝试访问它,并开始创建虚拟机。 + +![](https://www.linuxtechi.com/wp-content/uploads/2019/07/VirtualBox6-Debian10-Workstation.jpg) + +### 8) 安装最新的 AMD 驱动程序 + +最后,你也可以安装需要的附加 AMD 显卡驱动程序(如 ATI 专有驱动)和 Nvidia 图形驱动程序。为安装最新的 AMD 驱动程序,首先,我们需要修改 `/etc/apt/sources.list` 文件,在包含 **main** 和 **contrib** 的行中添加 **non-free** 单词,示例如下显示: + +``` +root@linuxtechi:~$ sudo vi /etc/apt/sources.list +``` + +``` +... +deb http://deb.debian.org/debian/ buster main non-free contrib +deb-src http://deb.debian.org/debian/ buster main non-free contrib + +deb http://security.debian.org/debian-security buster/updates main contrib non-free +deb-src http://security.debian.org/debian-security buster/updates main contrib non-free + +deb http://ftp.us.debian.org/debian/ buster-updates main contrib non-free +... +``` + +现在,使用下面的 `apt` 命令来在 Debian 10 系统中安装最新的 AMD 驱动程序。 + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install firmware-linux firmware-linux-nonfree libdrm-amdgpu1 xserver-xorg-video-amdgpu -y +``` + +这就是这篇文章的全部内容,我希望你了解在安装 Debian 10 后应该做什么。请在下面的评论区,分享你的反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/things-to-do-after-installing-debian-10/ + +作者:[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://linux.cn/article-11083-1.html +[2]: https://www.linuxtechi.com/linux-commands-to-manage-local-accounts/ diff --git a/published/201908/20190730 How to create a pull request in GitHub.md b/published/201908/20190730 How to create a pull request in GitHub.md new file mode 100755 index 0000000000..b92280d6a0 --- /dev/null +++ b/published/201908/20190730 How to create a pull request in GitHub.md @@ -0,0 +1,131 @@ +[#]: collector: "lujun9972" +[#]: translator: "furrybear" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11215-1.html" +[#]: subject: "How to create a pull request in GitHub" +[#]: via: "https://opensource.com/article/19/7/create-pull-request-github" +[#]: author: "Kedar Vijay Kulkarni https://opensource.com/users/kkulkarn" + +如何在 Github 上创建一个拉取请求 +====== + +> 学习如何复刻一个仓库,进行更改,并要求维护人员审查并合并它。 + +![a checklist for a team][1] + +你知道如何使用 git 了,你有一个 [GitHub][2] 仓库并且可以向它推送。这一切都很好。但是你如何为他人的 GitHub 项目做出贡献? 这是我在学习 git 和 GitHub 之后想知道的。在本文中,我将解释如何复刻fork一个 git 仓库、进行更改并提交一个拉取请求pull request。 + +当你想要在一个 GitHub 项目上工作时,第一步是复刻一个仓库。 + +![Forking a GitHub repo][3] + +你可以使用[我的演示仓库][4]试一试。 + +当你在这个页面时,单击右上角的 “Fork”(复刻)按钮。这将在你的 GitHub 用户账户下创建我的演示仓库的一个新副本,其 URL 如下: + +``` +https://github.com/<你的用户名>/demo +``` + +这个副本包含了原始仓库中的所有代码、分支和提交。 + +接下来,打开你计算机上的终端并运行命令来克隆clone仓库: + +``` +git clone https://github.com/<你的用户名>/demo +``` + +一旦仓库被克隆后,你需要做两件事: + +1、通过发出命令创建一个新分支 `new_branch` : + +``` +git checkout -b new_branch +``` + +2、使用以下命令为上游仓库创建一个新的远程remote: + +``` +git remote add upstream https://github.com/kedark3/demo +``` + +在这种情况下,“上游仓库”指的是你创建复刻来自的原始仓库。 + +现在你可以更改代码了。以下代码创建一个新分支,进行任意更改,并将其推送到 `new_branch` 分支: + +``` +$ git checkout -b new_branch +Switched to a new branch ‘new_branch’ +$ echo “some test file” > test +$ cat test +Some test file +$ git status +On branch new_branch +No commits yet +Untracked files: +  (use "git add <file>..." to include in what will be committed) +    test +nothing added to commit but untracked files present (use "git add" to track) +$ git add test +$ git commit -S -m "Adding a test file to new_branch" +[new_branch (root-commit) 4265ec8] Adding a test file to new_branch + 1 file changed, 1 insertion(+) + create mode 100644 test +$ git push -u origin new_branch +Enumerating objects: 3, done. +Counting objects: 100% (3/3), done. +Writing objects: 100% (3/3), 918 bytes | 918.00 KiB/s, done. +Total 3 (delta 0), reused 0 (delta 0) +Remote: Create a pull request for ‘new_branch’ on GitHub by visiting: +Remote:   +Remote: + * [new branch]         new_branch -> new_branch +``` + +一旦你将更改推送到您的仓库后, “Compare & pull request”(比较和拉取请求)按钮将出现在GitHub。 + +![GitHub's Compare & Pull Request button][5] + +单击它,你将进入此屏幕: + +![GitHub's Open pull request button][6] + +单击 “Create pull request”(创建拉取请求)按钮打开一个拉取请求。这将允许仓库的维护者们审查你的贡献。然后,如果你的贡献是没问题的,他们可以合并它,或者他们可能会要求你做一些改变。 + +### 精简版 + +总之,如果您想为一个项目做出贡献,最简单的方法是: + + 1. 找到您想要贡献的项目 + 2. 复刻它 + 3. 将其克隆到你的本地系统 + 4. 建立一个新的分支 + 5. 进行你的更改 + 6. 将其推送回你的仓库 + 7. 单击 “Compare & pull request”(比较和拉取请求)按钮 + 8. 单击 “Create pull request”(创建拉取请求)以打开一个新的拉取请求 + +如果审阅者要求更改,请重复步骤 5 和 6,为你的拉取请求添加更多提交。 + +快乐编码! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/create-pull-request-github + +作者:[Kedar Vijay Kulkarni][a] +选题:[lujun9972][b] +译者:[furrybear](https://github.com/furrybear) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kkulkarnhttps://opensource.com/users/fontanahttps://opensource.com/users/mhanwellhttps://opensource.com/users/mysentimentshttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk "a checklist for a team" +[2]: https://github.com/ +[3]: https://opensource.com/sites/default/files/uploads/forkrepo.png "Forking a GitHub repo" +[4]: https://github.com/kedark3/demo +[5]: https://opensource.com/sites/default/files/uploads/compare-and-pull-request-button.png "GitHub's Compare & Pull Request button" +[6]: https://opensource.com/sites/default/files/uploads/open-a-pull-request_crop.png "GitHub's Open pull request button" diff --git a/published/201908/20190730 OpenHMD- Open Source Project for VR Development.md b/published/201908/20190730 OpenHMD- Open Source Project for VR Development.md new file mode 100644 index 0000000000..1d4ee0c1aa --- /dev/null +++ b/published/201908/20190730 OpenHMD- Open Source Project for VR Development.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11193-1.html) +[#]: subject: (OpenHMD: Open Source Project for VR Development) +[#]: via: (https://itsfoss.com/openhmd/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +OpenHMD:用于 VR 开发的开源项目 +====== + +> 在这个时代,有一些开源替代品可满足你的所有计算需求。甚至还有一个 VR 眼镜之类的开源平台。让我们快速看一下 OpenHMD 这个项目。 + +![][5] + +### 什么是 OpenHMD? + +![][1] + +[OpenHMD][2] 是一个为沉浸式技术创建开源 API 及驱动的项目。这类技术包括带内置头部跟踪的头戴式显示器。 + +它目前支持很多系统,包括 Android、FreeBSD、Linux、OpenBSD、mac OS 和 Windows。它支持的[设备][3]包括 Oculus Rift、HTC Vive、DreamWorld DreamGlass、Playstation Move 等。它还支持各种语言,包括 Go、Java、.NET、Perl、Python 和 Rust。 + +OpenHMD 项目是在 [Boost 许可证][4]下发布的。 + +### 新版本中的更多功能和改进功能 + +最近,OpenHMD 项目[发布版本 0.3.0][6],代号为 Djungelvral([Djungelvral][7] 是来自瑞典的盐渍甘草)。它带来了不少变化。 + +这次更新添加了对以下设备的支持: + + * 3Glasses D3 + * Oculus Rift CV1 + * HTC Vive 和 HTC Vive Pro + * NOLO VR + * Windows Mixed Reality HMD 支持 + * Deepoon E2 + * GearVR Gen1 + +OpenHMD 增加了一个通用扭曲着色器。这一新增功能“可以方便地在驱动程序中设置一些变量,为着色器提供有关镜头尺寸、色差、位置和 Quirks 的信息。” + +他们还宣布计划改变构建系统。OpenHMD 增加了对 Meson 的支持,并将在下一个 (0.4) 版本中将删除对 Autotools 的支持。 + +OpenHMD 背后的团队还不得不删除一些功能,因为他们希望他们的系统适合所有人。由于 Windows 和 mac OS 对 HID 头的兼容问题,因此禁用了对 PlayStation VR 的支持。NOLO 有一堆固件版本,很多都会有小改动。OpenHMD 无法测试所有固件版本,因此某些版本可能无法正常工作。他们建议升级到最新的固件版本。最后,几个设备仅提供有限的支持,因此不包含在此版本中。 + +他们预计将加快 OpenHMD 发布周期,以便更快地获得更新的功能并为用户提供更多设备支持。他们优先要做的是“让当前在主干分支中禁用的设备在下次发布补丁时能够试用,同时让支持的头戴式显示器支持位置跟踪。” + +### 最后总结 + +我没有 VR 设备而且从未使用过。我相信它们有很大的潜力,甚至能超越游戏。我很兴奋(但并不惊讶)有一个开源实现会去支持许多设备。我很高兴他们专注于各种各样的设备,而不是专注于一些非品牌的 VR 的努力。 + +我希望 OpenHMD 团队做得不错,并希望他们创建一个平台,让它们成为 VR项目。 + +你曾经使用或看到过 OpenHMD 吗?你有没有使用 VR 进行游戏和其他用途?如果是,你是否用过任何开源硬件或软件?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/openhmd/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/openhmd-logo.png?resize=300%2C195&ssl=1 +[2]: http://www.openhmd.net/ +[3]: http://www.openhmd.net/index.php/devices/ +[4]: https://github.com/OpenHMD/OpenHMD/blob/master/LICENSE +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/virtual-reality-development.jpg?ssl=1 +[6]: http://www.openhmd.net/index.php/2019/07/12/openhmd-0-3-0-djungelvral-released/ +[7]: https://www.youtube.com/watch?v=byP5i6LdDXs +[9]: http://reddit.com/r/linuxusersgroup diff --git a/published/201908/20190731 Bash aliases you can-t live without.md b/published/201908/20190731 Bash aliases you can-t live without.md new file mode 100644 index 0000000000..056c8a2006 --- /dev/null +++ b/published/201908/20190731 Bash aliases you can-t live without.md @@ -0,0 +1,421 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11179-1.html) +[#]: subject: (Bash aliases you can’t live without) +[#]: via: (https://opensource.com/article/19/7/bash-aliases) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +不可或缺的 Bash 别名 +====== + +> 厌倦了一遍又一遍地输入相同的长命令?你觉得在命令行上工作效率低吗?Bash 别名可以为你创造一个与众不同的世界。 + +![](https://img.linux.net.cn/data/attachment/album/201908/03/095855ip0h0jpi5u9t3r00.jpg) + +Bash 别名是一种用新的命令补充或覆盖 Bash 命令的方法。Bash 别名使用户可以轻松地在 [POSIX][2] 终端中自定义其体验。它们通常定义在 `$HOME/.bashrc` 或 `$HOME/bash_aliases` 中(它是由 `$HOME/.bashrc` 加载的)。 + +大多数发行版在新用户帐户的默认 `.bashrc` 文件中至少添加了一些流行的别名。这些可以用来简单演示 Bash 别名的语法: + +``` +alias ls='ls -F' +alias ll='ls -lh' +``` + +但并非所有发行版都附带预先添加好的别名。如果你想手动添加别名,则必须将它们加载到当前的 Bash 会话中: + +``` +$ source ~/.bashrc +``` + +否则,你可以关闭终端并重新打开它,以便重新加载其配置文件。 + +通过 Bash 初始化脚本中定义的那些别名,你可以键入 `ll` 而得到 `ls -l` 的结果,当你键入 `ls` 时,得到也不是原来的 [ls][3] 的普通输出。 + +那些别名很棒,但它们只是浅尝辄止。以下是十大 Bash 别名,一旦你试过它们,你会发现再也不能离开它们。 + +### 首先设置 + +在开始之前,创建一个名为 `~/.bash_aliases` 的文件: + +``` +$ touch ~/.bash_aliases +``` + +然后,确认这些代码出现在你的 `~/.bashrc` 文件当中: + +``` +if [ -e $HOME/.bash_aliases ]; then +    source $HOME/.bash_aliases +fi +``` + +如果你想亲自尝试本文中的任何别名,请将它们输入到 `.bash_aliases` 文件当中,然后使用 `source ~/.bashrc` 命令将它们加载到当前 Bash 会话中。 + +### 按文件大小排序 + +如果你一开始使用过 GNOME 中的 Nautilus、MacOS 中的 Finder 或 Windows 中的资源管理器等 GUI 文件管理器,那么你很可能习惯了按文件大小排序文件列表。你也可以在终端上做到这一点,但这条命令不是很简洁。 + +将此别名添加到 GNU 系统上的配置中: + +``` +alias lt='ls --human-readable --size -1 -S --classify' +``` + +此别名将 `lt` 替换为 `ls` 命令,该命令在单个列中显示每个项目的大小,然后按大小对其进行排序,并使用符号表示文件类型。加载新别名,然后试一下: + +``` +$ source ~/.bashrc +$ lt +total 344K +140K configure* + 44K aclocal.m4 + 36K LICENSE + 32K config.status* + 24K Makefile + 24K Makefile.in + 12K config.log +8.0K README.md +4.0K info.slackermedia.Git-portal.json +4.0K git-portal.spec +4.0K flatpak.path.patch +4.0K Makefile.am* +4.0K dot-gitlab.ci.yml +4.0K configure.ac* +   0 autom4te.cache/ +   0 share/ +   0 bin/ +   0 install-sh@ +   0 compile@ +   0 missing@ +   0 COPYING@ +``` + +在 MacOS 或 BSD 上,`ls` 命令没有相同的选项,因此这个别名可以改为: + +``` +alias lt='du -sh * | sort -h' +``` + +这个版本的结果稍有不同: + +``` +$ du -sh * | sort -h +0       compile +0       COPYING +0       install-sh +0       missing +4.0K    configure.ac +4.0K    dot-gitlab.ci.yml +4.0K    flatpak.path.patch +4.0K    git-portal.spec +4.0K    info.slackermedia.Git-portal.json +4.0K    Makefile.am +8.0K    README.md +12K     config.log +16K     bin +24K     Makefile +24K     Makefile.in +32K     config.status +36K     LICENSE +44K     aclocal.m4 +60K     share +140K    configure +476K    autom4te.cache +``` + +实际上,即使在 Linux上,上面这个命令也很有用,因为使用 `ls` 列出的目录和符号链接的大小为 0,这可能不是你真正想要的信息。使用哪个看你自己的喜好。 + +*感谢 Brad Alexander 提供的这个别名的思路。* + +### 只查看挂载的驱动器 + +`mount` 命令过去很简单。只需一个命令,你就可以获得计算机上所有已挂载的文件系统的列表,它经常用于概览连接到工作站有哪些驱动器。在过去看到超过三、四个条目就会令人印象深刻,因为大多数计算机没有那么多的 USB 端口,因此这个结果还是比较好查看的。 + +现在计算机有点复杂,有 LVM、物理驱动器、网络存储和虚拟文件系统,`mount` 的结果就很难一目了然: + +``` +sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel) +proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) +devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=8131024k,nr_inodes=2032756,mode=755) +securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) +[...] +/dev/nvme0n1p2 on /boot type ext4 (rw,relatime,seclabel) +/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro) +[...] +gvfsd-fuse on /run/user/100977/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=100977,group_id=100977) +/dev/sda1 on /run/media/seth/pocket type ext4 (rw,nosuid,nodev,relatime,seclabel,uhelper=udisks2) +/dev/sdc1 on /run/media/seth/trip type ext4 (rw,nosuid,nodev,relatime,seclabel,uhelper=udisks2) +binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime) +``` + +要解决这个问题,试试这个别名: + +``` +alias mnt='mount | awk -F' ' '{ printf "%s\t%s\n",$1,$3; }' | column -t | egrep ^/dev/ | sort' +``` + +此别名使用 `awk` 按列解析 `mount` 的输出,将输出减少到你可能想要查找的内容(挂载了哪些硬盘驱动器,而不是文件系统): + +``` +$ mnt +/dev/mapper/fedora-root  / +/dev/nvme0n1p1           /boot/efi +/dev/nvme0n1p2           /boot +/dev/sda1                /run/media/seth/pocket +/dev/sdc1                /run/media/seth/trip +``` + +在 MacOS 上,`mount` 命令不提供非常详细的输出,因此这个别名可能过度精简了。但是,如果你更喜欢简洁的报告,请尝试以下方法: + +``` +alias mnt='mount | grep -E ^/dev | column -t' +``` + +结果: + +``` +$ mnt +/dev/disk1s1  on  /                (apfs,  local,  journaled) +/dev/disk1s4  on  /private/var/vm  (apfs,  local,  noexec,     journaled,  noatime,  nobrowse) +``` + +### 在你的 grep 历史中查找命令 + +有时你好不容易弄清楚了如何在终端完成某件事,并觉得自己永远不会忘记你刚学到的东西。然后,一个小时过去之后你就完全忘记了你做了什么。 + +搜索 Bash 历史记录是每个人不时要做的事情。如果你确切地知道要搜索的内容,可以使用 `Ctrl + R` 对历史记录进行反向搜索,但有时你无法记住要查找的确切命令。 + +这是使该任务更容易的别名: + +``` +alias gh='history|grep' +``` + +这是如何使用的例子: + +``` +$ gh bash +482 cat ~/.bashrc | grep _alias +498 emacs ~/.bashrc +530 emacs ~/.bash_aliases +531 source ~/.bashrc +``` + +### 按修改时间排序 + +每个星期一都会这样:你坐在你的电脑前开始工作,你打开一个终端,你发现你已经忘记了上周五你在做什么。你需要的是列出最近修改的文件的别名。 + +你可以使用 `ls` 命令创建别名,以帮助你找到上次离开的位置: + +``` +alias left='ls -t -1' +``` + +输出很简单,但如果你愿意,可以使用 `--long` 选项扩展它。这个别名列出的显示如下: + +``` +$ left +demo.jpeg +demo.xcf +design-proposal.md +rejects.txt +brainstorm.txt +query-letter.xml +``` + +### 文件计数 + +如果你需要知道目录中有多少文件,那么该解决方案是 UNIX 命令构造的最典型示例之一:使用 `ls` 命令列出文件,用`-1` 选项将其输出控制为只有一列,然后输出到 `wc`(单词计数)命令的管道,以计算有多少行。 + +这是 UNIX 理念如何允许用户使用小型的系统组件构建自己的解决方案的精彩演示。如果你碰巧每天都要做几次,这个命令组合也要输入很多字母,如果没有使用 `-R` 选项,它就不能用于目录,这会为输出引入新行并导致无用的结果。 + +而这个别名使这个过程变得简单: + +``` +alias count='find . -type f | wc -l' +``` + +这个别名会计算文件,忽略目录,但**不会**忽略目录的内容。如果你有一个包含两个目录的项目文件夹,每个目录包含两个文件,则该别名将返回 4,因为整个项目中有 4 个文件。 + +``` +$ ls +foo   bar +$ count +4 +``` + +### 创建 Python 虚拟环境 + +你用 Python 编程吗? + +你用 Python 编写了很多程序吗? + +如果是这样,那么你就知道创建 Python 虚拟环境至少需要 53 次击键。 + +这个数字里有 49 次是多余的,它很容易被两个名为 `ve` 和 `va` 的新别名所解决: + +``` +alias ve='python3 -m venv ./venv' +alias va='source ./venv/bin/activate' +``` + +运行 `ve` 会创建一个名为 `venv` 的新目录,其中包含 Python 3 的常用虚拟环境文件系统。`va` 别名在当前 shell 中的激活该环境: + +``` +$ cd my-project +$ ve +$ va +(venv) $ +``` + +### 增加一个复制进度条 + +每个人都会吐槽进度条,因为它们似乎总是不合时宜。然而,在内心深处,我们似乎都想要它们。UNIX 的 `cp` 命令没有进度条,但它有一个 `-v` 选项用于显示详细信息,它回显了复制的每个文件名到终端。这是一个相当不错的技巧,但是当你复制一个大文件并且想要了解还有多少文件尚未传输时,它的作用就没那么大了。 + +`pv` 命令可以在复制期间提供进度条,但它并不常用。另一方面,`rsync` 命令包含在几乎所有的 POSIX 系统的默认安装中,并且它被普遍认为是远程和本地复制文件的最智能方法之一。 + +更好的是,它有一个内置的进度条。 + +``` +alias cpv='rsync -ah --info=progress2' +``` + +像使用 `cp` 命令一样使用此别名: + +``` +$ cpv bigfile.flac /run/media/seth/audio/ +          3.83M 6%  213.15MB/s    0:00:00 (xfr#4, to-chk=0/4) +``` + +使用此命令的一个有趣的副作用是 `rsync` 无需 `-r` 标志就可以复制文件和目录,而 `cp` 则需要。 + +### 避免意外删除 + +你不应该使用 `rm` 命令。`rm` 手册甚至这样说: + +> **警告:**如果使用 `rm` 删除文件,通常可以恢复该文件的内容。如果你想要更加确保内容真正无法恢复,请考虑使用 `shred`。 + +如果要删除文件,则应将文件移动到“废纸篓”,就像使用桌面时一样。 + +POSIX 使这很简单,因为垃圾桶是文件系统中可访问的一个实际位置。该位置可能会发生变化,具体取决于你的平台:在 [FreeDesktop][4] 上,“垃圾桶”位于 `~/.local/share/Trash`,而在 MacOS 上则是 `~/.Trash`,但无论如何,它只是一个目录,你可以将文件藏在那个看不见的地方,直到你准备永久删除它们为止。 + +这个简单的别名提供了一种从终端将文件扔进垃圾桶的方法: + +``` +alias tcn='mv --force -t ~/.local/share/Trash ' +``` + +该别名使用一个鲜为人知的 `mv` 标志(`-t`),使你能够提供作为最终移动目标的参数,而忽略了首先列出要移动的文件的通常要求。现在,你可以使用新命令将文件和文件夹移动到系统垃圾桶: + +``` +$ ls +foo  bar +$ tcn foo +$ ls +bar +``` + +现在文件已“消失”,只有在你一头冷汗的时候才意识到你还需要它。此时,你可以从系统垃圾桶中抢救该文件;这肯定可以给 Bash 和 `mv` 开发人员提供一些帮助。 + +**注意:**如果你需要一个具有更好的 FreeDesktop 兼容性的更强大的垃圾桶命令,请参阅 [Trashy][5]。 + +### 简化 Git 工作流 + +每个人都有自己独特的工作流程,但无论如何,通常都会有重复的任务。如果你经常使用 Git,那么你可能会发现自己经常重复的一些操作序列。也许你会发现自己回到主分支并整天一遍又一遍地拉取最新的变化,或者你可能发现自己创建了标签然后将它们推到远端,抑或可能完全是其它的什么东西。 + +无论让你厌倦一遍遍输入的 Git 魔咒是什么,你都可以通过 Bash 别名减轻一些痛苦。很大程度上,由于它能够将参数传递给钩子,Git 拥有着丰富的内省命令,可以让你不必在 Bash 中执行那些丑陋冗长的命令。 + +例如,虽然你可能很难在 Bash 中找到项目的顶级目录(就 Bash 而言,它是一个完全随意的名称,因为计算机的绝对顶级是根目录),但 Git 可以通过简单的查询找到项目的顶级目录。如果你研究过 Git 钩子,你会发现自己能够找到 Bash 一无所知的各种信息,而你可以利用 Bash 别名来利用这些信息。 + +这是一个来查找 Git 项目的顶级目录的别名,无论你当前在哪个项目中工作,都可以将目录改变为顶级目录,切换到主分支,并执行 Git 拉取: + +``` +alias startgit='cd `git rev-parse --show-toplevel` && git checkout master && git pull' +``` + +这种别名绝不是一个普遍有用的别名,但它演示了一个相对简单的别名如何能够消除大量繁琐的导航、命令和等待提示。 + +一个更简单,可能更通用的别名将使你返回到 Git 项目的顶级目录。这个别名非常有用,因为当你在一个项目上工作时,该项目或多或少会成为你的“临时家目录”。它应该像回家一样简单,就像回你真正的家一样,这里有一个别名: + +``` +alias cg='cd `git rev-parse --show-toplevel`' +``` + +现在,命令 `cg` 将你带到 Git 项目的顶部,无论你下潜的目录结构有多深。 + +### 切换目录并同时查看目录内容 + +(据称)曾经一位著名科学家提出过,我们可以通过收集极客输入 `cd` 后跟 `ls` 消耗的能量来解决地球上的许多能量问题。 + +这是一种常见的用法,因为通常当你更改目录时,你都会有查看周围的内容的冲动或需要。 + +但是在你的计算机的目录树中移动并不一定是一个走走停停的过程。 + +这是一个作弊,因为它根本不是别名,但它是探索 Bash 功能的一个很好的借口。虽然别名非常适合快速替换一个命令,但 Bash 也允许你在 `.bashrc` 文件中添加本地函数(或者你加载到 `.bashrc` 中的单独函数文件,就像你的别名文件一样)。 + +为了保持模块化,创建一个名为 `~/.bash_functions` 的新文件,然后让你的 `.bashrc` 加载它: + +``` +if [ -e $HOME/.bash_functions ]; then +    source $HOME/.bash_functions +fi +``` + +在该函数文件中,添加这些代码: + +``` +function cl() { +    DIR="$*"; +        # if no DIR given, go home +        if [ $# -lt 1 ]; then +                DIR=$HOME; +    fi; +    builtin cd "${DIR}" && \ +    # use your preferred ls command +        ls -F --color=auto +} +``` + +将函数加载到 Bash 会话中,然后尝试: + +``` +$ source ~/.bash_functions +$ cl Documents +foo bar baz +$ pwd +/home/seth/Documents +$ cl .. +Desktop  Documents  Downloads +[...] +$ pwd +/home/seth +``` + +函数比别名更灵活,但有了这种灵活性,你就有责任确保代码有意义并达到你的期望。别名是简单的,所以要保持简单而有用。要正式修改 Bash 的行为,请使用保存到 `PATH` 环境变量中某个位置的函数或自定义的 shell 脚本。 + +附注,有一些巧妙的奇技淫巧来实现 `cd` 和 `ls` 序列作为别名,所以如果你足够耐心,那么即使是一个简单的别名也永无止限。 + +### 开始别名化和函数化吧 + +可以定制你的环境使得 Linux 变得如此有趣,提高效率使得 Linux 可以改变生活。开始使用简单的别名,进而使用函数,并在评论中发布你必须拥有的别名! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/bash-aliases + +作者:[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/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://www.freedesktop.org/wiki/ +[5]: https://gitlab.com/trashy/trashy diff --git a/published/201908/20190801 5 Free Partition Managers for Linux.md b/published/201908/20190801 5 Free Partition Managers for Linux.md new file mode 100644 index 0000000000..09a078fed0 --- /dev/null +++ b/published/201908/20190801 5 Free Partition Managers for Linux.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11196-1.html) +[#]: subject: (5 Free Partition Managers for Linux) +[#]: via: (https://itsfoss.com/partition-managers-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +5 个免费的 Linux 分区管理器 +====== + +> 以下是我们推荐的 Linux 分区工具。它们能让你删除、添加、调整或缩放 Linux 系统上的磁盘分区。 + +通常,你在安装操作系统时决定磁盘分区。但是,如果你需要在安装后的某个时间修改分区,该怎么办?你无法回到系统安装阶段。因此,这就需要分区管理器(或准确地说是磁盘分区管理器)上场了。 + +在大多数情况下,你无需单独安装分区管理器,因为它已预先安装。此外,值得注意的是,你可以选择基于命令行或有 GUI 的分区管理器。 + +**注意!** + +> 磁盘分区是一项有风险的任务。除非绝对必要,否则不要这样做。 +> +> 如果你使用的是基于命令行的分区工具,那么需要学习完成任务的命令。否则,你可能最终会擦除整个磁盘。 + +### Linux 中的 5 个管理磁盘分区的工具 + +![][1] + +下面的列表没有特定的排名顺序。大多数分区工具应该存在于 Linux 发行版的仓库中。 + +#### GParted + +![GParted][2] + +这可能是 Linux 发行版中最流行的基于 GUI 的分区管理器。你可能已在某些发行版中预装它。如果还没有,只需在软件中心搜索它即可完成安装。 + +它会在启动时直接提示你以 root 用户进行身份验证。所以,你根本不需要在这里使用终端。身份验证后,它会分析设备,然后让你调整磁盘分区。如果发生数据丢失或意外删除文件,你还可以找到“尝试数据救援”的选项。 + +- [GParted][3] + +#### GNOME Disks + +![Gnome Disks][4] + +一个基于 GUI 的分区管理器,随 Ubuntu 或任何基于 Ubuntu 的发行版(如 Zorin OS)一起出现。 + +它能让你删除、添加、缩放和微调分区。如果你遇到故障,它甚至可以[在 Ubuntu 中格式化 USB][6] 来帮助你救援机器。 + +你甚至可以借助此工具尝试修复分区。它的选项还包括编辑文件系统、创建分区镜像、还原镜像以及对分区进行基准测试。 + +- [GNOME Disks][7] + +#### KDE Partition Manager + +![Kde Partition Manager][8] + +KDE Partition Manager 应该已经预装在基于 KDE 的 Linux 发行版上了。但是,如果没有,你可以在软件中心搜索并轻松安装它。 + +如果你不是预装的,那么可能会在尝试启动时通知你没有管理权限。没有管理员权限,你无法做任何事情。因此,在这种情况下,请输入以下命令: + +``` +sudo partitionmanager +``` + +它将扫描你的设备,然后你就可以创建、移动、复制、删除和缩放分区。你还可以导入/导出分区表及使用其他许多调整选项。 + +- [KDE Partition Manager][9] + +#### Fdisk(命令行) + +![Fdisk][10] + +[fdisk][11] 是一个命令行程序,它在每个类 Unix 的系统中都有。不要担心,即使它需要你启动终端并输入命令,但这并不是很困难。但是,如果你在使用基于文本的程序时感到困惑,那么你应该继续使用上面提到的 GUI 程序。它们都做同样的事情。 + +要启动 `fdisk`,你必须是 root 用户并指定管理分区的设备。以下是该命令的示例: + +``` +sudo fdisk /dev/sdc +``` + +你可以参考 [Linux 文档项目的维基页面][12]以获取命令列表以及有关其工作原理的更多详细信息。 + +#### GNU Parted(命令行) + +![Gnu Parted][13] + +这是在你 Linux 发行版上预安装的另一个命令行程序。你需要输入下面的命令启动: + +``` +sudo parted +``` + +### 总结 + +我不会忘了说 [QtParted][15] 是分区管理器的替代品之一。但它已经几年没有维护,因此我不建议使用它。 + +你如何看待这里提到的分区管理器?我有错过你最喜欢的吗?让我知道,我将根据你的建议更新这个 Linux 分区管理器列表。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/partition-managers-linux/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/disk-partitioning-tools-linux.jpg?resize=800%2C450&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/g-parted.png?ssl=1 +[3]: https://gparted.org/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/gnome-disks.png?ssl=1 +[6]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/ +[7]: https://wiki.gnome.org/Apps/Disks +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/kde-partition-manager.jpg?resize=800%2C404&ssl=1 +[9]: https://kde.org/applications/system/org.kde.partitionmanager +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/fdisk.jpg?fit=800%2C496&ssl=1 +[11]: https://en.wikipedia.org/wiki/Fdisk +[12]: https://www.tldp.org/HOWTO/Partition/fdisk_partitioning.html +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/gnu-parted.png?fit=800%2C559&ssl=1 +[15]: http://qtparted.sourceforge.net/ diff --git a/published/201908/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md b/published/201908/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md new file mode 100644 index 0000000000..b030243efe --- /dev/null +++ b/published/201908/20190801 Bash Script to Send a Mail When a New User Account is Created in System.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11199-1.html) +[#]: subject: (Bash Script to Send a Mail When a New User Account is Created in System) +[#]: via: (https://www.2daygeek.com/linux-bash-script-to-monitor-user-creation-send-email/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在系统创建新用户时发送邮件的 Bash 脚本 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/07/232807l7x4j7y77555j1j5.jpg) + +目前市场上有许多开源监测工具可用于监控 Linux 系统的性能。当系统到达指定的阈值时,它将发送邮件提醒。 + +它会监控 CPU 利用率、内存利用率、交换内存利用率、磁盘空间利用率等所有内容。但我不认为它们可以选择监控新用户创建活动,并发送提醒。 + +如果没有,这并不重要,因为我们可以编写自己的 bash 脚本来实现这一点。 + +我们过去写了许多有用的 shell 脚本。如果要查看它们,请点击以下链接。 + +* [如何使用 shell 脚本自动化执行日常任务?][1] + +这个脚本做了什么?它监测 `/var/log/secure` 文件,并在系统创建新帐户时提醒管理员。 + +我们不会经常运行此脚本,因为创建用户不经常发生。但是,我打算一天运行一次这个脚本。因此,我们可以获得有关用户创建的综合报告。 + +如果在昨天的 `/var/log/secure` 中找到了 “useradd” 字符串,那么该脚本将向指定的邮箱发送邮件提醒,其中包含了新用户的详细信息。 + +**注意:**你需要更改邮箱而不是使用我们的邮箱。 + +``` +# vi /opt/scripts/new-user.sh +``` + +``` +#!/bin/bash + +#Set the variable which equal to zero +prev_count=0 +count=$(grep -i "`date --date='yesterday' '+%b %e'`" /var/log/secure | egrep -wi 'useradd' | wc -l) + +if [ "$prev_count" -lt "$count" ] ; then + # Send a mail to given email id when errors found in log + SUBJECT="ATTENTION: New User Account is created on server : `date --date='yesterday' '+%b %e'`" + # This is a temp file, which is created to store the email message. + MESSAGE="/tmp/new-user-logs.txt" + TO="2daygeek@gmail.com" + echo "Hostname: `hostname`" >> $MESSAGE + echo -e "\n" >> $MESSAGE + echo "The New User Details are below." >> $MESSAGE + echo "+------------------------------+" >> $MESSAGE + grep -i "`date --date='yesterday' '+%b %e'`" /var/log/secure | egrep -wi 'useradd' | grep -v 'failed adding'| awk '{print $4,$8}' | uniq | sed 's/,/ /' >> $MESSAGE + echo "+------------------------------+" >> $MESSAGE + mail -s "$SUBJECT" "$TO" < $MESSAGE + rm $MESSAGE +fi +``` + +给 `new-user.sh` 添加可执行权限。 + +``` +$ chmod +x /opt/scripts/new-user.sh +``` + +最后添加一个 cron 任务来自动化执行它。它会在每天 7 点运行。 + +``` +# crontab -e + +0 7 * * * /bin/bash /opt/scripts/new-user.sh +``` + +注意:你将在每天 7 点收到一封邮件提醒,但这是昨天的日志。 + +你将会看到类似下面的邮件提醒。 + +``` +# cat /tmp/logs.txt + +Hostname: 2g.server10.com + +The New User Details are below. ++------------------------------+ +2g.server10.com name=magesh +2g.server10.com name=daygeek ++------------------------------+ +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-bash-script-to-monitor-user-creation-send-email/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/201908/20190802 Linux Smartphone Librem 5 is Available for Preorder.md b/published/201908/20190802 Linux Smartphone Librem 5 is Available for Preorder.md new file mode 100644 index 0000000000..3c9cc4e7f0 --- /dev/null +++ b/published/201908/20190802 Linux Smartphone Librem 5 is Available for Preorder.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (scvoet) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11229-1.html) +[#]: subject: (Linux Smartphone Librem 5 is Available for Preorder) +[#]: via: (https://itsfoss.com/librem-5-available/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +基于 Linux 的智能手机 Librem 5 开启预售 +====== + +Purism 近期[宣布][1]了 [Librem 5 智能手机][2]的最终规格。它不是基于 Android 或 iOS 的,而是基于 [Android 的开源替代品][4]--[PureOS][3]。 + +随着这一消息的宣布,Librem 5 也正式[以 649 美元的价格开启预售][5](这是 7 月 31 日前的早鸟价),在那以后价格将会上涨 50 美元,产品将会于 2019 年第三季度发货。 + +![][6] + +以下是 Purism 博客文章中关于 Librem 5 的信息: + +> 我们认为手机不应该跟踪你,也不应该利用你的数字生活。 + +> Librem 5 意味着你有机会通过自由开源软件、开放式治理和透明度来收回和保护你的私人信息和数字生活。Librem 5 是一个**基于 [PureOS][3] 的手机**,这是一个完全免费、符合道德的**不基于 Android 或 iOS** 的开源操作系统(了解更多关于[为什么这很重要][7]的信息)。 + +> 我们已成功超额完成了众筹计划,我们将会一一去实现我们的承诺。Librem 5 的硬件和软件开发正在[稳步前进][8],它计划在 2019 年的第三季度发行初始版本。你可以用 649 美元的价格预购直到产品发货或正式价格生效。现在附赠外接显示器、键盘和鼠标的套餐也可以预购了。 + +### Librem 5 的配置 + +从它的预览来看,Librem 5 旨在提供更好的隐私保护和安全性。除此之外,它试图避免使用 Google 或 Apple 的服务。 + +虽然这个想法够好,它是如何成为一款低于 700 美元的商用智能手机? + +![Librem 5 智能手机][9] + +让我们来看一下它的配置: + +![Librem 5][10] + +从数据上讲它的配置已经足够高了。不是很好,也不是很差。但是,性能呢?用户体验呢? + +我们并不能够确切地了解到它的信息,除非我们用过它。所以,如果你打算预购,应该要考虑到这一点。 + +### Librem 5 提供终身软件更新支持 + +当然,和同价位的智能手机相比,它的这些配置并不是很优秀。 + +然而,随着他们做出终身软件更新支持的承诺后,它看起来确实像被开源爱好者所钟情的一个好产品。 + +### 其他关键特性 + +Purism 还强调 Librem 5 将成为有史以来第一款以 [Matrix][12] 提供支持的智能手机。这意味着它将支持端到端的分布式加密通讯的短信、电话。 + +除了这些,耳机接口和用户可以自行更换电池使它成为一个可靠的产品。 + +### 总结 + +即使它很难与 Android 或 iOS 智能手机竞争,但多一种选择方式总是好的。Librem 5 不可能成为每个用户都喜欢的智能手机,但如果你是一个开源爱好者,而且正在寻找一款尊重隐私和安全,不使用 Google 和 Apple 服务的简单智能手机,那么这就很适合你。 + +另外,它提供终身的软件更新支持,这让它成为了一个优秀的智能手机。 + +你如何看待 Librem 5?有在考虑预购吗?请在下方的评论中将你的想法告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/librem-5-available/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[Scvoet][c] +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[c]: https://github.com/scvoet +[1]: https://puri.sm/posts/librem-5-smartphone-final-specs-announced/ +[2]: https://itsfoss.com/librem-linux-phone/ +[3]: https://pureos.net/ +[4]: https://itsfoss.com/open-source-alternatives-android/ +[5]: https://shop.puri.sm/shop/librem-5/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/librem-5-linux-smartphone.jpg?resize=800%2C450&ssl=1 +[7]: https://puri.sm/products/librem-5/pureos-mobile/ +[8]: https://puri.sm/posts/tag/phones +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/librem-5-smartphone.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/librem-5-specs.png?ssl=1 +[11]: https://itsfoss.com/linux-games-performance-boost-amd-gpu/ +[12]: http://matrix.org diff --git a/published/201908/20190802 Use Postfix to get email from your Fedora system.md b/published/201908/20190802 Use Postfix to get email from your Fedora system.md new file mode 100644 index 0000000000..f6dce46a4d --- /dev/null +++ b/published/201908/20190802 Use Postfix to get email from your Fedora system.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11224-1.html) +[#]: subject: (Use Postfix to get email from your Fedora system) +[#]: via: (https://fedoramagazine.org/use-postfix-to-get-email-from-your-fedora-system/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +使用 Postfix 从 Fedora 系统中获取电子邮件 +====== + +![][1] + +交流是非常重要的。你的电脑可能正试图告诉你一些重要的事情。但是,如果你没有正确配置邮件传输代理([MTA][2]),那么你可能不会收到通知。Postfix 是一个[易于配置且以强大的安全记录而闻名][3]的 MTA。遵循以下步骤,以确保从本地服务发送的电子邮件通知将通过 Postfix MTA 路由到你的互联网电子邮件账户中。 + +### 安装软件包 + +使用 `dnf` 来安装一些必须软件包([你应该配置了 sudo,对吧?][4]): + +``` +$ sudo -i +# dnf install postfix mailx +``` + +如果以前配置了不同的 MTA,那么你可能需要将 Postfix 设置为系统默认。使用 `alternatives` 命令设置系统默认 MTA: + +``` +$ sudo alternatives --config mta +There are 2 programs which provide 'mta'. + Selection Command +*+ 1 /usr/sbin/sendmail.sendmail + 2 /usr/sbin/sendmail.postfix +Enter to keep the current selection[+], or type selection number: 2 +``` + +### 创建一个 password_maps 文件 + +你需要创建一个 Postfix 查询表条目,其中包含你要用于发送电子邮件账户的地址和密码: + +``` +# MY_EMAIL_ADDRESS=glb@gmail.com +# MY_EMAIL_PASSWORD=abcdefghijklmnop +# MY_SMTP_SERVER=smtp.gmail.com +# MY_SMTP_SERVER_PORT=587 +# echo "[$MY_SMTP_SERVER]:$MY_SMTP_SERVER_PORT $MY_EMAIL_ADDRESS:$MY_EMAIL_PASSWORD" >> /etc/postfix/password_maps +# chmod 600 /etc/postfix/password_maps +# unset MY_EMAIL_PASSWORD +# history -c +``` + +如果你使用的是 Gmail 账户,那么你需要为 Postfix 配置一个“应用程序密码”而不是使用你的 Gmail 密码。有关配置应用程序密码的说明,参阅“[使用应用程序密码登录][5]”。 + +接下来,你必须对 Postfix 查询表运行 `postmap` 命令,以创建或更新 Postfix 实际使用的文件的散列版本: + +``` +# postmap /etc/postfix/password_maps +``` + +散列后的版本将具有相同的文件名,但后缀为 `.db`。 + +### 更新 main.cf 文件 + +更新 Postfix 的 `main.cf` 配置文件,以引用刚刚创建 Postfix 查询表。编辑该文件并添加以下行: + +``` +relayhost = smtp.gmail.com:587 +smtp_tls_security_level = verify +smtp_tls_mandatory_ciphers = high +smtp_tls_verify_cert_match = hostname +smtp_sasl_auth_enable = yes +smtp_sasl_security_options = noanonymous +smtp_sasl_password_maps = hash:/etc/postfix/password_maps +``` + +这里假设你使用 Gmail 作为 `relayhost` 设置,但是你可以用正确的主机名和端口替换系统应该将邮件发送到的邮件主机。 + +有关上述配置选项的最新详细信息,参考 man 帮助: + +``` +$ man postconf.5 +``` + +### 启用、启动和测试 Postfix + +更新 `main.cf` 文件后,启用并启动 Postfix 服务: + +``` +# systemctl enable --now postfix.service +``` + +然后,你可以使用 `exit` 命令或 `Ctrl+D` 以 root 身份退出 `sudo` 会话。你现在应该能够使用 `mail` 命令测试你的配置: + +``` +$ echo 'It worked!' | mail -s "Test: $(date)" glb@gmail.com +``` + +### 更新服务 + +如果你安装了像 [logwatch][6]、[mdadm][7]、[fail2ban][8]、[apcupsd][9] 或 [certwatch][10] 这样的服务,你现在可以更新它们的配置,以便它们的电子邮件通知转到你的 Internet 电子邮件地址。 + +另外,你可能希望将发送到本地系统 root 账户的所有电子邮件都转到互联网电子邮件地址中,将以下行添加到系统的 `/etc/alises` 文件中(你需要使用 `sudo` 编辑此文件,或首先切换到 `root` 账户): + +``` +root: glb+root@gmail.com +``` + +现在运行此命令重新读取别名: + +``` +# newaliases +``` + +* 提示: 如果你使用的是 Gmail,那么你可以在用户名和 `@` 符号之间[添加字母数字标记][11],如上所示,以便更轻松地识别和过滤从计算机收到的电子邮件。 + +### 常用命令 + +**查看邮件队列:** + +``` +$ mailq +``` + +**清除队列中的所有电子邮件:** + +``` +# postsuper -d ALL +``` + +**过滤设置,以获得感兴趣的值:** + +``` +$ postconf | grep "^relayhost\|^smtp_" +``` + +**查看 `postfix/smtp` 日志:** + +``` +$ journalctl --no-pager -t postfix/smtp +``` + +**进行配置更改后重新加载 postfix:** + +``` +$ systemctl reload postfix +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-postfix-to-get-email-from-your-fedora-system/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/postfix-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Message_transfer_agent +[3]: https://en.wikipedia.org/wiki/Postfix_(software) +[4]: https://fedoramagazine.org/howto-use-sudo/ +[5]: https://support.google.com/accounts/answer/185833 +[6]: https://src.fedoraproject.org/rpms/logwatch +[7]: https://fedoramagazine.org/mirror-your-system-drive-using-software-raid/ +[8]: https://fedoraproject.org/wiki/Fail2ban_with_FirewallD +[9]: https://src.fedoraproject.org/rpms/apcupsd +[10]: https://www.linux.com/learn/automated-certificate-expiration-checks-centos +[11]: https://gmail.googleblog.com/2008/03/2-hidden-ways-to-get-more-from-your.html +[12]: https://unsplash.com/@sharonmccutcheon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[13]: https://unsplash.com/search/photos/envelopes?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/201908/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md b/published/201908/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md new file mode 100644 index 0000000000..d721d097c0 --- /dev/null +++ b/published/201908/20190803 The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11187-1.html) +[#]: subject: (The fastest open source CPU ever, Facebook shares AI algorithms fighting harmful content, and more news) +[#]: via: (https://opensource.com/article/19/8/news-august-3) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +开源新闻综述:有史以来最快的开源 CPU、Facebook 分享对抗有害内容的 AI 算法 +====== + +> 不要错过最近两周最大的开源新闻。 + +![Weekly news roundup with TV][1] + +在本期开源新闻综述中,我们分享了 Facebook 开源了两种算法来查找有害内容,Apple 在数据传输项目中的新角色以及你应该知道的更多新闻。 + +### Facebook 开源算法用于查找有害内容 + +Facebook 宣布它[开源两种算法][2]用于在该平台上发现儿童剥削、恐怖主义威胁和写实暴力。在 8 月 1 日的博客文章中,Facebook 分享了 PDQ 和 TMK + PDQF 这两种将文件存储为数字哈希的技术,然后将它们与已知的有害内容示例进行比较 - [现在已放在 GitHub 上][3]。 + +该代码是在 Facebook 要尽快将有害内容从平台上移除的压力之下发布的。三月份在新西兰的大规模谋杀案被曝光在 Facebook Live 上,澳大利亚政府[威胁][4]如果视频没有及时删除 Facebook 高管将被处以罚款和入狱。通过发布这些算法的源代码,Facebook 表示希望非营利组织、科技公司和独立开发人员都能帮助他们更快地找到并删除有害内容。 + +### 阿里巴巴发布了最快的开源 CPU + +上个月,阿里巴巴的子公司平头哥半导体公司[发布了其玄铁 91 处理器][5]。它可以用于人工智能、物联网、5G 和自动驾驶汽车等基础设施。它拥有 7.1 Coremark/MHz 的基准,使其成为市场上最快的开源 CPU。 + +平头哥宣布计划在今年 9 月在 GitHub 上提供其优质代码。分析师认为此次发布旨在帮助中国实现其目标,即到 2021 年使用本地供应商满足 40% 的处理器需求。近期美国的关税调整威胁要破坏这一目标,从而造成了对开源计算机组件的需求。 + +### Mattermost 为开源协作应用提供了理由 + +所有开源社区都受益于可以从一个或多个地方彼此进行通信。团队聊天应用程序的世界似乎由 Slack 和 Microsoft Teams 等极少数的强大工具主导。大多数选择都是基于云的和专有产品的;而 Mattermost 采用了不同的方法,销售开源协作应用程序的价值。 + +“人们想要一个开源替代品,因为他们需要信任、灵活性和只有开源才能提供的创新,”Mattermost 的联合创始人兼首席执行官 Ian Tien 说。 + +随着从优步到国防部的客户,Mattermost 走上了一个关键市场:需要开源软件的团队,他们可以信任这些软件并安装在他们自己的服务器上。对于需要协作应用程序在其内部基础架构上运行的企业,Mattermost 填补了 [Atlassian 离开后][6] 的空白。在 Computerworld 的一篇文章中,Matthew Finnegan [探讨][7]了为什么在本地部署的开源聊天工具尚未死亡。 + +### Apple 加入了开源数据传输项目 + +Google、Facebook、Twitter 和微软去年联合创建了数据传输项目Data Transfer Project(DTP)。DTP 被誉为通过自己的数据提升数据安全性和用户代理的一种方式,是一种罕见的技术上的团结展示。本周,Apple 宣布他们也将[加入][8]。 + +DTP 的目标是帮助用户通过开源平台将数据从一个在线服务转移到另一个在线服务。DTP 旨在通过使用 API 和授权工具来取消中间人,以便用户将数据从一个服务转移到另一个服务。这将消除用户下载数据然后将其上传到另一个服务的需要。Apple 加入 DTP 的选择将允许用户将数据传入和传出 iCloud,这可能是隐私权拥护者的一大胜利。 + +#### 其它新闻 + +* [FlexiWAN 的开源 SD-WAN 可在公共测试版中下载] [9] +* [开源的 Windows 计算器应用程序获得了永远置顶模式] [10] +* [通过 Zowe,开源和 DevOps 正在使大型计算机民主化] [11] +* [Mozilla 首次推出 WebThings Gateway 开源路由器固件的实现] [12] +* [更新:向 Mozilla 代码库做成贡献][13] + +*谢谢 Opensource.com 的工作人员和主持人本周的帮助。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/news-august-3 + +作者:[Lauren Maffeo][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/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://www.theverge.com/2019/8/1/20750752/facebook-child-exploitation-terrorism-open-source-algorithm-pdq-tmk +[3]: https://github.com/facebook/ThreatExchange/tree/master/hashing/tmk +[4]: https://www.buzzfeed.com/hannahryan/social-media-facebook-livestreaming-laws-christchurch +[5]: https://hexus.net/tech/news/cpu/133229-alibabas-16-core-risc-v-fastest-open-source-cpu-yet/ +[6]: https://lab.getapp.com/atlassian-slack-on-premise-software/ +[7]: https://www.computerworld.com/article/3428679/mattermost-makes-case-for-open-source-as-team-messaging-market-booms.html +[8]: https://www.techspot.com/news/81221-apple-joins-data-transfer-project-open-source-project.html +[9]: https://www.fiercetelecom.com/telecom/flexiwan-s-open-source-sd-wan-available-for-download-public-beta-release +[10]: https://mspoweruser.com/open-source-windows-calculator-app-to-get-always-on-top-mode/ +[11]: https://siliconangle.com/2019/07/29/zowe-open-source-devops-democratizing-mainframe-computer/ +[12]: https://venturebeat.com/2019/07/25/mozilla-debuts-webthings-gateway-open-source-router-firmware-for-turris-omnia/ +[13]: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Introduction diff --git a/published/201908/20190805 4 cool new projects to try in COPR for August 2019.md b/published/201908/20190805 4 cool new projects to try in COPR for August 2019.md new file mode 100644 index 0000000000..741d098f5c --- /dev/null +++ b/published/201908/20190805 4 cool new projects to try in COPR for August 2019.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11206-1.html) +[#]: subject: (4 cool new projects to try in COPR for August 2019) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-august-2019/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +COPR 仓库中 4 个很酷的新项目(2019.8) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +这是 COPR 中一组新的有趣项目。 + +### Duc + +[duc][3] 是磁盘使用率检查和可视化工具的集合。Duc 使用索引数据库来保存系统上文件的大小。索引完成后,你可以通过命令行界面或 GUI 快速查看磁盘使用情况。 + +![][4] + +#### 安装说明 + +该[仓库][5]目前为 EPEL 7、Fedora 29 和 30 提供 duc。要安装 duc,请使用以下命令: + +``` +sudo dnf copr enable terrywang/duc +sudo dnf install duc +``` + +### MuseScore + +[MuseScore][6] 是一个处理音乐符号的软件。使用 MuseScore,你可以使用鼠标、虚拟键盘或 MIDI 控制器创建乐谱。然后,MuseScore 可以播放创建的音乐或将其导出为 PDF、MIDI 或 MusicXML。此外,它还有一个由 MuseScore 用户创建的含有大量乐谱的数据库。 + +![][7] + +#### 安装说明 + +该[仓库][5]目前为 Fedora 29 和 30 提供 MuseScore。要安装 MuseScore,请使用以下命令: + +``` +sudo dnf copr enable jjames/MuseScore +sudo dnf install musescore +``` + +### 动态墙纸编辑器 + +[动态墙纸编辑器][9] 是一个可在 GNOME 中创建和编辑随时间变化的壁纸集合的工具。这可以使用 XML 文件来完成,但是,动态墙纸编辑器通过其图形界面使其变得简单,你可以在其中简单地添加图片、排列图片并设置每张图片的持续时间以及它们之间的过渡。 + +![][10] + +#### 安装说明 + +该[仓库][11]目前为 Fedora 30 和 Rawhide 提供动态墙纸编辑器。要安装它,请使用以下命令: + +``` +sudo dnf copr enable atim/dynamic-wallpaper-editor +sudo dnf install dynamic-wallpaper-editor +``` + +### Manuskript + +[Manuskript][12] 是一个给作者的工具,旨在让创建大型写作项目更容易。它既可以作为编写文本的编辑器,也可以作为组织故事本身、故事人物和单个情节的注释的工具。 + +![][13] + +#### 安装说明 + +该[仓库][14]目前为 Fedora 29、30 和 Rawhide 提供 Manuskript。要安装 Manuskript,请使用以下命令: + +``` +sudo dnf copr enable notsag/manuskript +sudo dnf install manuskript +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-august-2019/ + +作者:[Dominik Turecek][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://fedoramagazine.org/author/dturecek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://duc.zevv.nl/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/07/duc.png +[5]: https://copr.fedorainfracloud.org/coprs/terrywang/duc/ +[6]: https://musescore.org/ +[7]: https://fedoramagazine.org/wp-content/uploads/2019/07/musescore-1024x512.png +[8]: https://copr.fedorainfracloud.org/coprs/jjames/MuseScore/ +[9]: https://github.com/maoschanz/dynamic-wallpaper-editor +[10]: https://fedoramagazine.org/wp-content/uploads/2019/07/dynamic-walppaper-editor.png +[11]: https://copr.fedorainfracloud.org/coprs/atim/dynamic-wallpaper-editor/ +[12]: https://www.theologeek.ch/manuskript/ +[13]: https://fedoramagazine.org/wp-content/uploads/2019/07/manuskript-1024x600.png +[14]: https://copr.fedorainfracloud.org/coprs/notsag/manuskript/ diff --git a/published/201908/20190805 Find The Linux Distribution Name, Version And Kernel Details.md b/published/201908/20190805 Find The Linux Distribution Name, Version And Kernel Details.md new file mode 100644 index 0000000000..f133239088 --- /dev/null +++ b/published/201908/20190805 Find The Linux Distribution Name, Version And Kernel Details.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11270-1.html) +[#]: subject: (Find The Linux Distribution Name, Version And Kernel Details) +[#]: via: (https://www.ostechnix.com/find-out-the-linux-distribution-name-version-and-kernel-details/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +查找 Linux 发行版名称、版本和内核详细信息 +====== + +![Find The Linux Distribution Name, Version And Kernel Details][1] + +本指南介绍了如何查找 Linux 发行版名称、版本和内核详细信息。如果你的 Linux 系统有 GUI 界面,那么你可以从系统设置中轻松找到这些信息。但在命令行模式下,初学者很难找到这些详情。没有问题!我这里给出了一些命令行方法来查找 Linux 系统信息。可能有很多,但这些方法适用于大多数 Linux 发行版。 + +### 1、查找 Linux 发行版名称、版本 + +有很多方法可以找出 VPS 中运行的操作系统。 + +#### 方法 1: + +打开终端并运行以下命令: + +``` +$ cat /etc/*-release +``` + +CentOS 7 上的示例输出: + +``` +CentOS Linux release 7.0.1406 (Core) +NAME="CentOS Linux" +VERSION="7 (Core)" +ID="centos" +ID_LIKE="rhel fedora" +VERSION_ID="7" +PRETTY_NAME="CentOS Linux 7 (Core)" +ANSI_COLOR="0;31" +CPE_NAME="cpe:/o:centos:centos:7" +HOME_URL="https://www.centos.org/" +BUG_REPORT_URL="https://bugs.centos.org/" + +CentOS Linux release 7.0.1406 (Core) +CentOS Linux release 7.0.1406 (Core) +``` + +Ubuntu 18.04 上的示例输出: + +``` +DISTRIB_ID=Ubuntu +DISTRIB_RELEASE=18.04 +DISTRIB_CODENAME=bionic +DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS" +NAME="Ubuntu" +VERSION="18.04.2 LTS (Bionic Beaver)" +ID=ubuntu +ID_LIKE=debian +PRETTY_NAME="Ubuntu 18.04.2 LTS" +VERSION_ID="18.04" +HOME_URL="https://www.ubuntu.com/" +SUPPORT_URL="https://help.ubuntu.com/" +BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" +PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" +VERSION_CODENAME=bionic +UBUNTU_CODENAME=bionic +``` + +#### 方法 2: + +以下命令也能获取你发行版的详细信息。 + +``` +$ cat /etc/issue +``` + +Ubuntu 18.04 上的示例输出: + +``` +Ubuntu 18.04.2 LTS \n \l +``` + +#### 方法 3: + +以下命令能在 Debian 及其衍生版如 Ubuntu、Linux Mint 上获取发行版详细信息。 + +``` +$ lsb_release -a +``` + +示例输出: + +``` +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 18.04.2 LTS +Release: 18.04 +Codename: bionic +``` + +### 2、查找 Linux 内核详细信息 + +#### 方法 1: + +要查找 Linux 内核详细信息,请在终端运行以下命令。 + +``` +$ uname -a +``` + +CentOS 7 上的示例输出: + +``` +Linux server.ostechnix.lan 3.10.0-123.9.3.el7.x86_64 #1 SMP Thu Nov 6 15:06:03 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux +``` + +Ubuntu 18.04 上的示例输出: + +``` +Linux ostechnix 4.18.0-25-generic #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux +``` + +或者, + +``` +$ uname -mrs +``` + +示例输出: + +``` +Linux 4.18.0-25-generic x86_64 +``` + +这里, + + * `Linux` – 内核名 + * `4.18.0-25-generic` – 内核版本 + * `x86_64` – 系统硬件架构(即 64 位系统) + +有关 `uname` 命令的更多详细信息,请参考手册页。 + +``` +$ man uname +``` + +#### 方法2: + +在终端中,运行以下命令: + +``` +$ cat /proc/version +``` + +CentOS 7 上的示例输出: + +``` +Linux version 3.10.0-123.9.3.el7.x86_64 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Thu Nov 6 15:06:03 UTC 2014 +``` + +Ubuntu 18.04 上的示例输出: + +``` +Linux version 4.18.0-25-generic ([email protected]) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 +``` + +这些是查找 Linux 发行版的名称、版本和内核详细信息的几种方法。希望你觉得它有用。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/find-out-the-linux-distribution-name-version-and-kernel-details/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2015/08/Linux-Distribution-Name-Version-Kernel-720x340.png diff --git a/published/201908/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md b/published/201908/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md new file mode 100644 index 0000000000..423a6a06f5 --- /dev/null +++ b/published/201908/20190805 GameMode - A Tool To Improve Gaming Performance On Linux.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11211-1.html) +[#]: subject: (GameMode – A Tool To Improve Gaming Performance On Linux) +[#]: via: (https://www.ostechnix.com/gamemode-a-tool-to-improve-gaming-performance-on-linux/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +GameMode:提高 Linux 游戏性能的工具 +====== + +![Gamemmode improve gaming performance on Linux][1] + +去问一些 Linux 用户为什么他们仍然坚持 Windows 双启动,他们的答案可能是 - “游戏!”。这是真的!幸运的是,开源游戏平台如 [Lutris][2] 和专有游戏平台 Steam 已经为 Linux 平台带来了许多游戏,并且近几年来显著改善了 Linux 的游戏体验。今天,我偶然发现了另一款名为 GameMode 的 Linux 游戏相关开源工具,它能让用户提高 Linux 上的游戏性能。 + +GameMode 基本上是一组守护进程/库,它可以按需优化 Linux 系统的游戏性能。我以为 GameMode 是一个杀死在后台运行的对资源消耗大进程的工具。但它并不是。它实际上只是让 CPU **在用户玩游戏时自动运行在高性能模式下**并帮助 Linux 用户从游戏中获得最佳性能。 + +在玩游戏时,GameMode 通过对宿主机请求临时应用一组优化来显著提升游戏性能。目前,它支持下面这些优化: + +* CPU 调控器, +* I/O 优先级, +* 进程 nice 值 +* 内核调度器(SCHED_ISO), +* 禁止屏幕保护, +* GPU 高性能模式(NVIDIA 和 AMD),GPU 超频(NVIDIA), +* 自定义脚本。 + +GameMode 是由世界领先的游戏发行商 [Feral Interactive][3] 开发的自由开源的系统工具。 + +### 安装 GameMode + +GameMode 适用于许多 Linux 发行版。 + +在 Arch Linux 及其变体上,你可以使用任何 AUR 助手程序,如 [Yay][5] 从 [AUR][4] 安装它。 + +``` +$ yay -S gamemode +``` + +在 Debian、Ubuntu、Linux Mint 和其他基于 Deb 的系统上: + +``` +$ sudo apt install gamemode +``` + +如果 GameMode 不适用于你的系统,你可以按照它的 Github 页面中开发章节下的描述从源码手动编译和安装它。 + +### 激活 GameMode 支持以改善 Linux 上的游戏性能 + +以下是集成支持了 GameMode 的游戏列表,因此我们无需进行任何其他配置即可激活 GameMode 支持。 + + * 古墓丽影:崛起 + * 全面战争传奇:不列颠尼亚王座 + * 全面战争:战锤 2 + * 尘埃 4 + * 全面战争:三国 + +只需运行这些游戏,就会自动启用 GameMode 支持。 + +这里还有将 GameMode 与 GNOME shell 集成的的[扩展][6]。它会在顶部指示 GameMode 何时处于活跃。 + +对于其他游戏,你可能需要手动请求 GameMode 支持,如下所示。 + +``` +gamemoderun ./game +``` + +我不喜欢游戏,并且我已经很多年没玩游戏了。所以,我无法分享一些实际的基准测试。 + +但是,我在 Youtube 上找到了一个简短的[视频教程](https://youtu.be/4gyRyYfyGJw),以便为 Lutris 游戏启用 GameMode 支持。对于那些想要第一次尝试 GameMode 的人来说,这是个不错的开始。 + +通过浏览视频中的评论,我可以说 GameMode 确实提高了 Linux 上的游戏性能。 + +对于更多细节,请参阅 [GameMode 的 GitHub 仓库][7]。 + +相关阅读: + +* [GameHub – 将所有游戏集合在一起的仓库][8] +* [如何在 Linux 中运行 MS-DOS 游戏和程序][9] + +你用过 GameMode 吗?它真的有改善 Linux 上的游戏性能吗?请在下面的评论栏分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/gamemode-a-tool-to-improve-gaming-performance-on-linux/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/Gamemode-720x340.png +[2]: https://www.ostechnix.com/manage-games-using-lutris-linux/ +[3]: http://www.feralinteractive.com/en/ +[4]: https://aur.archlinux.org/packages/gamemode/ +[5]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ +[6]: https://github.com/gicmo/gamemode-extension +[7]: https://github.com/FeralInteractive/gamemode +[8]: https://www.ostechnix.com/gamehub-an-unified-library-to-put-all-games-under-one-roof/ +[9]: https://www.ostechnix.com/how-to-run-ms-dos-games-and-programs-in-linux/ diff --git a/published/201908/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md b/published/201908/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md new file mode 100644 index 0000000000..bc993a7595 --- /dev/null +++ b/published/201908/20190805 How To Add ‘New Document- Option In Right Click Context Menu In Ubuntu 18.04.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (scvoet) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11232-1.html) +[#]: subject: (How To Add ‘New Document’ Option In Right Click Context Menu In Ubuntu 18.04) +[#]: via: ((https://www.ostechnix.com/how-to-add-new-document-option-in-right-click-context-menu-in-ubuntu-18-04/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 18.04 的右键单击菜单中添加“新建文档”按钮 +====== + +![Add 'New Document' Option In Right Click Context Menu In Ubuntu 18.04 GNOME desktop][1] + +前几天,我在各种在线资源站点上收集关于 [Linux 包管理器][2] 的参考资料。在我想创建一个用于保存笔记的文件,我突然发现我的 Ubuntu 18.04 LTS 桌面并没有“新建文件”的按钮了,它好像离奇失踪了。在谷歌一下后,我发现原来“新建文档”按钮不再被集成在 Ubuntu GNOME 版本中了。庆幸的是,我找到了一个在 Ubuntu 18.04 LTS 桌面的右键单击菜单中添加“新建文档”按钮的简易解决方案。 + +就像你在下方截图中看到的一样,Nautilus 文件管理器的右键单击菜单中并没有“新建文件”按钮。 + +![][3] + +*Ubuntu 18.04 移除了右键点击菜单中的“新建文件”的选项。* + +如果你想添加此按钮,请按照以下步骤进行操作。 + +### 在 Ubuntu 的右键单击菜单中添加“新建文件”按钮 + +首先,你需要确保你的系统中有 `~/Templates` 文件夹。如果没有的话,可以按照下面的命令进行创建。 + +``` +$ mkdir ~/Templates +``` + +然后打开终端应用并使用 `cd` 命令进入 `~/Templates` 文件夹: + +``` +$ cd ~/Templates +``` + +创建一个空文件: + +``` +$ touch Empty\ Document +``` + +或 + +``` +$ touch "Empty Document" +``` + +![][4] + +新打开一个 Nautilus 文件管理器,然后检查一下右键单击菜单中是否成功添加了“新建文档”按钮。 + +![][5] + +*在 Ubuntu 18.04 的右键单击菜单中添加“新建文件”按钮* + +如上图所示,我们重新启用了“新建文件”的按钮。 + +你还可以为不同文件类型添加按钮。 + +``` +$ cd ~/Templates + +$ touch New\ Word\ Document.docx +$ touch New\ PDF\ Document.pdf +$ touch New\ Text\ Document.txt +$ touch New\ PyScript.py +``` + +![][6] + +在“新建文件”子菜单中给不同的文件类型添加按钮 + +注意,所有文件都应该创建在 `~/Templates` 文件夹下。 + +现在,打开 Nautilus 并检查“新建文件” 菜单中是否有相应的新建文件按钮。 + +![][7] + +如果你要从子菜单中删除任一文件类型,只需在 Templates 目录中移除相应的文件即可。 + +``` +$ rm ~/Templates/New\ Word\ Document.docx +``` + +我十分好奇为什么最新的 Ubuntu GNOME 版本将这个常用选项移除了。不过,重新启用这个按钮也十分简单,只需要几分钟。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-add-new-document-option-in-right-click-context-menu-in-ubuntu-18-04/ + +作者:[sk][a] +选题:[lujun9972][b] +译者:[scvoet](https://github.com/scvoet) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/Add-New-Document-Option-In-Right-Click-Context-Menu-1-720x340.png +[2]: https://www.ostechnix.com/linux-package-managers-compared-appimage-vs-snap-vs-flatpak/ +[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/new-document-option-missing.png +[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/Create-empty-document-in-Templates-directory.png +[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/Add-New-Document-Option-In-Right-Click-Context-Menu-In-Ubuntu.png +[6]: https://www.ostechnix.com/wp-content/uploads/2019/07/Add-options-for-different-files-types.png +[7]: https://www.ostechnix.com/wp-content/uploads/2019/07/Add-New-Document-Option-In-Right-Click-Context-Menu.png diff --git a/published/201908/20190805 How To Find Hardware Specifications On Linux.md b/published/201908/20190805 How To Find Hardware Specifications On Linux.md new file mode 100644 index 0000000000..453b19f74c --- /dev/null +++ b/published/201908/20190805 How To Find Hardware Specifications On Linux.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11194-1.html) +[#]: subject: (How To Find Hardware Specifications On Linux) +[#]: via: (https://www.ostechnix.com/getting-hardwaresoftware-specifications-in-linux-mint-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +如何在 Linux 上查找硬件规格 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/06/111717t1f77n7v3egxhf18.jpg) + +在 Linux 系统上有许多工具可用于查找硬件规格。在这里,我列出了四种最常用的工具,可以获取 Linux 系统的几乎所有硬件(和软件)细节。好在是这些工具在某些 Linux 发行版上默认预装。我在 Ubuntu 18.04 LTS 桌面上测试了这些工具,但是它们也适用于其他 Linux 发行版。 + +### 1、LSHW + +lshw(硬件列表)是一个简单但功能齐全的实用程序,它提供了 Linux 系统上的硬件规格的详细信息。它可以报告确切的内存规格、固件版本、主板规格、CPU 版本和速度、缓存规格、总线速度等。信息可以以纯文本、XML 或 HTML 格式输出。 + +它目前支持 DMI(仅限 x86 和 EFI)、Open Firmware 设备树(仅限 PowerPC)、PCI/AGP、ISA PnP(x86)、CPUID(x86)、IDE/ATA/ATAPI、PCMCIA(仅在 x86 上测试过)、USB 和 SCSI。 + +就像我已经说过的那样,Ubuntu 默认预装了 lshw。如果它未安装在你的 Ubuntu 系统中,请使用以下命令安装它: + +``` +$ sudo apt install lshw lshw-gtk +``` + +在其他 Linux 发行版上,例如 Arch Linux,运行: + +``` +$ sudo pacman -S lshw lshw-gtk +``` + +安装后,运行 `lshw` 以查找系统硬件详细信息: + +``` +$ sudo lshw +``` + +你将看到输出详细的系统硬件。 + +示例输出: + +![][2] + +*使用 lshw 在 Linux 上查找硬件规格* + +请注意,如果你没有以 `sudo` 权限运行 `lshw` 命令,则输出可能不完整或不准确。 + +`lshw` 可以将输出显示为 HTML 页面。为此,请使用: + +``` +$ sudo lshw -html +``` + +同样,我们可以将设备树输出为 XML 和 json 格式,如下所示: + +``` +$ sudo lshw -xml +$ sudo lshw -json +``` + +要输出显示硬件路径的设备树,请使用 `-short` 选项: + +``` +$ sudo lshw -short +``` + +![][3] + +*使用 lshw 显示具有硬件路径的设备树* + +要列出设备的总线信息、详细的 SCSI、USB、IDE 和 PCI 地址,请运行: + +``` +$ sudo lshw -businfo +``` + +默认情况下,`lshw` 显示所有硬件详细信息。你还可以使用类选项查看特定硬件详细信息的硬件信息,例如处理器、内存、显示器等。可以使用 `lshw -short` 或 `lshw -businfo` 找到类选项。 + +要显示特定硬件详细信息,例如处理器,请执行以下操作: + +``` +$ sudo lshw -class processor +``` + +示例输出: + +``` +*-cpu +description: CPU +product: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz +vendor: Intel Corp. +physical id: 4 +bus info: [email protected] +version: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz +serial: To Be Filled By O.E.M. +slot: CPU 1 +size: 913MHz +capacity: 2300MHz +width: 64 bits +clock: 100MHz +capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer xsave avx lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm arat pln pts md_clear flush_l1d cpufreq +configuration: cores=2 enabledcores=1 threads=2 +``` + +类似的,你可以得到系统细节: + +``` +$ sudo lshw -class system +``` + +硬盘细节: + +``` +$ sudo lshw -class disk +``` + +网络细节: + +``` +$ sudo lshw -class network +``` + +内存细节: + +``` +$ sudo lshw -class memory +``` + +你也可以像下面这样列出多个设备的细节: + +``` +$ sudo lshw -class storage -class power -class volume +``` + +如果你想要查看带有硬件路径的细节信息,加上 `-short` 选项即可: + +``` +$ sudo lshw -short -class processor +``` + +示例输出: + +``` +H/W path Device Class Description +======================================================= +/0/4 processor Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz +``` + +有时,你可能希望将某些硬件详细信息共享给别人,例如客户支持人员。如果是这样,你可以从输出中删除潜在的敏感信息,如 IP 地址、序列号等,如下所示。 + +``` +$ lshw -sanitize +``` + +#### lshw-gtk GUI 工具 + +如果你对 CLI 不熟悉,可以使用 `lshw-gtk`,这是 `lshw` 命令行工具的图形界面。 + +它可以从终端或 Dash 中打开。 + +要从终端启动它,只需执行以下操作: + +``` +$ sudo lshw-gtk +``` + +这是 `lshw` 工具的默认 GUI 界面。 + +![][4] + +*使用 lshw-gtk 在 Linux 上查找硬件* + +只需双击“Portable Computer”即可进一步展开细节。 + +![][5] + +*使用 lshw-gtk GUI 在 Linux 上查找硬件* + +你可以双击后续的硬件选项卡以获取详细视图。 + +有关更多详细信息,请参阅手册页。 + +``` +$ man lshw +``` + +### 2、Inxi + +Inxi 是我查找 Linux 系统上几乎所有内容的另一个最喜欢的工具。它是一个自由开源的、功能齐全的命令行系统信息工具。它显示了系统硬件、CPU、驱动程序、Xorg、桌面、内核、GCC 版本、进程、RAM 使用情况以及各种其他有用信息。无论是硬盘还是 CPU、主板还是整个系统的完整细节,inxi 都能在几秒钟内更准确地显示它。由于它是 CLI 工具,你可以在桌面或服务器版本中使用它。有关更多详细信息,请参阅以下指南。 + +* [如何使用 inxi 发现系统细节][6] + +### 3、Hardinfo + +Hardinfo 将为你提供 `lshw` 中没有的系统硬件和软件详细信息。 + +HardInfo 可以收集有关系统硬件和操作系统的信息,执行基准测试,并以 HTML 或纯文本格式生成可打印的报告。 + +如果 Ubuntu 中未安装 Hardinfo,请使用以下命令安装: + +``` +$ sudo apt install hardinfo +``` + +安装后,Hardinfo 工具可以从终端或菜单中进行。 + +以下是 Hardinfo 默认界面的外观。 + +![][7] + +*使用 Hardinfo 在 Linux 上查找硬件* + +正如你在上面的屏幕截图中看到的,Hardinfo 的 GUI 简单直观。 + +所有硬件信息分为四个主要组:计算机、设备、网络和基准。每个组都显示特定的硬件详细信息。 + +例如,要查看处理器详细信息,请单击“设备”组下的“处理器”选项。 + +![][8] + +*使用 hardinfo 显示处理器详细信息* + +与 `lshw` 不同,Hardinfo 可帮助你查找基本软件规范,如操作系统详细信息、内核模块、区域设置信息、文件系统使用情况、用户/组和开发工具等。 + +![][9] + +*使用 hardinfo 显示操作系统详细信息* + +Hardinfo 的另一个显着特点是它允许我们做简单的基准测试来测试 CPU 和 FPU 功能以及一些图形用户界面功能。 + +![][10] + +*使用 hardinfo 执行基准测试* + +建议阅读: + +* [Phoronix 测试套件 - 开源测试和基准测试工具][11] +* [UnixBench - 类 Unix 系统的基准套件][12] +* [如何从命令行对 Linux 命令和程序进行基准测试][13] + +我们可以生成整个系统以及各个设备的报告。要生成报告,只需单击菜单栏上的“生成报告”按钮,然后选择要包含在报告中的信息。 + +![][14] + +*使用 hardinfo 生成系统报告* + +Hardinfo 也有几个命令行选项。 + +例如,要生成报告并在终端中显示它,请运行: + +``` +$ hardinfo -r +``` + +列出模块: + +``` +$ hardinfo -l +``` + +更多信息请参考手册: + +``` +$ man hardinfo +``` + +### 4、Sysinfo + +Sysinfo 是 HardInfo 和 lshw-gtk 实用程序的另一个替代品,可用于获取下面列出的硬件和软件信息。 + +* 系统详细信息,如发行版版本、GNOME 版本、内核、gcc 和 Xorg 以及主机名。 +* CPU 详细信息,如供应商标识、型号名称、频率、L2 缓存、型号和标志。 +* 内存详细信息,如系统全部内存、可用内存、交换空间总量和空闲、缓存、活动/非活动的内存。 +* 存储控制器,如 IDE 接口、所有 IDE 设备、SCSI 设备。 +* 硬件详细信息,如主板、图形卡、声卡和网络设备。 + +让我们使用以下命令安装 sysinfo: + +``` +$ sudo apt install sysinfo +``` + +Sysinfo 可以从终端或 Dash 启动。 + +要从终端启动它,请运行: + +``` +$ sysinfo +``` + +这是 Sysinfo 实用程序的默认界面。 + +![][15] + +*sysinfo 界面* + +如你所见,所有硬件(和软件)详细信息都分为五类,即系统、CPU、内存、存储和硬件。单击导航栏上的类别以获取相应的详细信息。 + +![][16] + +*使用 Sysinfo 在 Linux 上查找硬件* + +更多细节可以在手册页上找到。 + +``` +$ man sysinfo +``` + +就这样。就像我已经提到的那样,可以有很多工具可用于显示硬件/软件规范。但是,这四个工具足以找到你的 Linux 发行版的所有软硬件规格信息。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/getting-hardwaresoftware-specifications-in-linux-mint-ubuntu/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[2]: https://www.ostechnix.com/wp-content/uploads/2013/01/Find-Hardware-Specifications-On-Linux-using-lshw-1.png +[3]: https://www.ostechnix.com/wp-content/uploads/2013/01/Show-device-tree-with-hardware-path-using-lshw.png +[4]: https://www.ostechnix.com/wp-content/uploads/2013/01/Find-Hardware-Specifications-On-Linux-using-lshw-gtk-1.png +[5]: https://www.ostechnix.com/wp-content/uploads/2013/01/Find-Hardware-Specifications-On-Linux-using-lshw-gtk-2.png +[6]: https://www.ostechnix.com/how-to-find-your-system-details-using-inxi/ +[7]: https://www.ostechnix.com/wp-content/uploads/2013/01/Find-Hardware-Specifications-On-Linux-Using-Hardinfo.png +[8]: https://www.ostechnix.com/wp-content/uploads/2013/01/Show-processor-details-using-hardinfo.png +[9]: https://www.ostechnix.com/wp-content/uploads/2013/01/Show-operating-system-details-using-hardinfo.png +[10]: https://www.ostechnix.com/wp-content/uploads/2013/01/Perform-benchmarks-using-hardinfo.png +[11]: https://www.ostechnix.com/phoronix-test-suite-open-source-testing-benchmarking-tool/ +[12]: https://www.ostechnix.com/unixbench-benchmark-suite-unix-like-systems/ +[13]: https://www.ostechnix.com/how-to-benchmark-linux-commands-and-programs-from-commandline/ +[14]: https://www.ostechnix.com/wp-content/uploads/2013/01/Generate-system-reports-using-hardinfo.png +[15]: https://www.ostechnix.com/wp-content/uploads/2013/01/sysinfo-interface.png +[16]: https://www.ostechnix.com/wp-content/uploads/2013/01/Find-Hardware-Specifications-On-Linux-Using-Sysinfo.png diff --git a/published/201908/20190805 How To Set Up Time Synchronization On Ubuntu.md b/published/201908/20190805 How To Set Up Time Synchronization On Ubuntu.md new file mode 100644 index 0000000000..22254d2f1c --- /dev/null +++ b/published/201908/20190805 How To Set Up Time Synchronization On Ubuntu.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11220-1.html) +[#]: subject: (How To Set Up Time Synchronization On Ubuntu) +[#]: via: (https://www.ostechnix.com/how-to-set-up-time-synchronization-on-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 上设置时间同步 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/13/135423xnk7zib00nn2aebv.jpg) + +你可能设置过 [cron 任务][2] 来在特定时间备份重要文件或执行系统相关任务。也许你配置了一个日志服务器在特定时间间隔[轮转日志][3]。但如果你的时钟不同步,这些任务将无法按时执行。这就是要在 Linux 系统上设置正确的时区并保持时钟与互联网同步的原因。本指南介绍如何在 Ubuntu Linux 上设置时间同步。下面的步骤已经在 Ubuntu 18.04 上进行了测试,但是对于使用 systemd 的 `timesyncd` 服务的其他基于 Ubuntu 的系统它们是相同的。 + +### 在 Ubuntu 上设置时间同步 + +通常,我们在安装时设置时区。但是,你可以根据需要更改或设置不同的时区。 + +首先,让我们使用 `date` 命令查看 Ubuntu 系统中的当前时区: + +``` +$ date +``` + +示例输出: + +``` +Tue Jul 30 11:47:39 UTC 2019 +``` + +如上所见,`date` 命令显示实际日期和当前时间。这里,我当前的时区是 **UTC**,代表**协调世界时**。 + +或者,你可以在 `/etc/timezone` 文件中查找当前时区。 + +``` +$ cat /etc/timezone +UTC +``` + +现在,让我们看看时钟是否与互联网同步。只需运行: + +``` +$ timedatectl +``` + +示例输出: + +``` +Local time: Tue 2019-07-30 11:53:58 UTC +Universal time: Tue 2019-07-30 11:53:58 UTC +RTC time: Tue 2019-07-30 11:53:59 +Time zone: Etc/UTC (UTC, +0000) +System clock synchronized: yes +systemd-timesyncd.service active: yes +RTC in local TZ: no +``` + +如你所见,`timedatectl` 命令显示本地时间、世界时、时区以及系统时钟是否与互联网服务器同步,以及 `systemd-timesyncd.service` 是处于活动状态还是非活动状态。就我而言,系统时钟已与互联网时间服务器同步。 + +如果时钟不同步,你会看到下面截图中显示的 `System clock synchronized: no`。 + +![][4] + +*时间同步已禁用。* + +注意:上面的截图是旧截图。这就是你看到不同日期的原因。 + +如果你看到 `System clock synchronized:` 值设置为 `no`,那么 `timesyncd` 服务可能处于非活动状态。因此,只需重启服务并看下是否正常。 + +``` +$ sudo systemctl restart systemd-timesyncd.service +``` + +现在检查 `timesyncd` 服务状态: + +``` +$ sudo systemctl status systemd-timesyncd.service +● systemd-timesyncd.service - Network Time Synchronization +Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) +Active: active (running) since Tue 2019-07-30 10:50:18 UTC; 1h 11min ago +Docs: man:systemd-timesyncd.service(8) +Main PID: 498 (systemd-timesyn) +Status: "Synchronized to time server [2001:67c:1560:8003::c7]:123 (ntp.ubuntu.com)." +Tasks: 2 (limit: 2319) +CGroup: /system.slice/systemd-timesyncd.service +└─498 /lib/systemd/systemd-timesyncd + +Jul 30 10:50:30 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:31 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:31 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:32 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:32 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:35 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:35 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:35 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:50:35 ubuntuserver systemd-timesyncd[498]: Network configuration changed, trying to estab +Jul 30 10:51:06 ubuntuserver systemd-timesyncd[498]: Synchronized to time server [2001:67c:1560:800 +``` + +如果此服务已启用并处于活动状态,那么系统时钟应与互联网时间服务器同步。 + +你可以使用命令验证是否启用了时间同步: + +``` +$ timedatectl +``` + +如果仍然不起作用,请运行以下命令以启用时间同步: + +``` +$ sudo timedatectl set-ntp true +``` + +现在,你的系统时钟将与互联网时间服务器同步。 + +#### 使用 timedatectl 命令更改时区 + +如果我想使用 UTC 以外的其他时区怎么办?这很容易! + +首先,使用命令列出可用时区: + +``` +$ timedatectl list-timezones +``` + +你将看到类似于下图的输出。 + +![][5] + +*使用 timedatectl 命令列出时区* + +你可以使用以下命令设置所需的时区(例如,Asia/Shanghai): + +(LCTT 译注:本文原文使用印度时区作为示例,这里为了便于使用,换为中国标准时区 CST。另外,在时区设置中,要注意 CST 这个缩写会代表四个不同的时区,因此建议使用城市和 UTC+8 来说设置。) + +``` +$ sudo timedatectl set-timezone Asia/Shanghai +``` + +使用 `date` 命令再次检查时区是否已真正更改: + +``` +$ date +Tue Jul 30 20:22:33 CST 2019 +``` + +或者,如果需要详细输出,请使用 `timedatectl` 命令: + +``` +$ timedatectl +Local time: Tue 2019-07-30 20:22:35 CST +Universal time: Tue 2019-07-30 12:22:35 UTC +RTC time: Tue 2019-07-30 12:22:36 +Time zone: Asia/Shanghai (CST, +0800) +System clock synchronized: yes +systemd-timesyncd.service active: yes +RTC in local TZ: no +``` + +如你所见,我已将时区从 UTC 更改为 CST(中国标准时间)。 + +要切换回 UTC 时区,只需运行: + +``` +$ sudo timedatectl set-timezone UTC +``` + +#### 使用 tzdata 更改时区 + +在较旧的 Ubuntu 版本中,没有 `timedatectl` 命令。这种情况下,你可以使用 `tzdata`(Time zone data)来设置时间同步。 + +``` +$ sudo dpkg-reconfigure tzdata +``` + +选择你居住的地理区域。对我而言,我选择 **Asia**。选择 OK,然后按回车键。 + +![][6] + +接下来,选择与你的时区对应的城市或地区。这里,我选择了 **Kolkata**(LCTT 译注:中国用户请相应使用 Shanghai 等城市)。 + +![][7] + +最后,你将在终端中看到类似下面的输出。 + +``` +Current default time zone: 'Asia/Shanghai' +Local time is now: Tue Jul 30 21:59:25 CST 2019. +Universal Time is now: Tue Jul 30 13:59:25 UTC 2019. +``` + +#### 在图形模式下配置时区 + +有些用户可能对命令行方式不太满意。如果你是其中之一,那么你可以轻松地在图形模式的系统设置面板中进行设置。 + +点击 Super 键(Windows 键),在 Ubuntu dash 中输入 **settings**,然后点击设置图标。 + +![][8] + +*从 Ubuntu dash 启动系统的设置* + +或者,单击位于 Ubuntu 桌面右上角的向下箭头,然后单击左上角的“设置”图标。 + +![][9] + +*从顶部面板启动系统的设置* + +在下一个窗口中,选择“细节”,然后单击“日期与时间”选项。打开“自动的日期与时间”和“自动的时区”。 + +![][10] + +*在 Ubuntu 中设置自动时区* + +关闭设置窗口就行了!你的系统始终应该与互联网时间服务器同步了。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-set-up-time-synchronization-on-ubuntu/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/Set-Up-Time-Synchronization-On-Ubuntu-720x340.png +[2]: https://www.ostechnix.com/a-beginners-guide-to-cron-jobs/ +[3]: https://www.ostechnix.com/manage-log-files-using-logrotate-linux/ +[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/timedatectl-command-output-ubuntu.jpeg +[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/List-timezones-using-timedatectl-command.png +[6]: https://www.ostechnix.com/wp-content/uploads/2019/07/configure-time-zone-using-tzdata-1.png +[7]: https://www.ostechnix.com/wp-content/uploads/2019/07/configure-time-zone-using-tzdata-2.png +[8]: https://www.ostechnix.com/wp-content/uploads/2019/07/System-settings-Ubuntu-dash.png +[9]: https://www.ostechnix.com/wp-content/uploads/2019/07/Ubuntu-system-settings.png +[10]: https://www.ostechnix.com/wp-content/uploads/2019/07/Set-automatic-timezone-in-ubuntu.png diff --git a/published/201908/20190805 How To Verify ISO Images In Linux.md b/published/201908/20190805 How To Verify ISO Images In Linux.md new file mode 100644 index 0000000000..80b5a39a57 --- /dev/null +++ b/published/201908/20190805 How To Verify ISO Images In Linux.md @@ -0,0 +1,147 @@ +[#]: collector: "lujun9972" +[#]: translator: "FSSlc" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11212-1.html" +[#]: subject: "How To Verify ISO Images In Linux" +[#]: via: "https://www.ostechnix.com/how-to-verify-iso-images-in-linux/" +[#]: author: "sk https://www.ostechnix.com/author/sk/" + +如何在 Linux 中验证 ISO 镜像 +====== + +![如何在 Linux 中校验 ISO 镜像][1] + +你从喜爱的 Linux 发行版的官方网站或第三方网站下载了它的 ISO 镜像之后,接下来要做什么呢?是[创建可启动介质][2]并开始安装系统吗?并不是,请稍等一下。在开始使用它之前,强烈建议你检查一下你刚下载到本地系统中的 ISO 文件是否是下载镜像站点中 ISO 文件的一个精确拷贝。因为在前几年 [Linux Mint 的网站被攻破了][3],并且攻击者创建了一个包含后门的经过修改的 Linux Mint ISO 文件。 所以验证下载的 Linux ISO 镜像的可靠性和完整性是非常重要的一件事儿。假如你不知道如何在 Linux 中验证 ISO 镜像,本次的简要介绍将给予你帮助,请接着往下看! + +### 在 Linux 中验证 ISO 镜像 + +我们可以使用 ISO 镜像的“校验和”来验证 ISO 镜像。校验和是一系列字母和数字的组合,用来检验下载文件的数据是否有错以及验证其可靠性和完整性。当前存在不同类型的校验和,例如 SHA-0、SHA-1、SHA-2(224、256、384、512)和 MD5。MD5 校验和最为常用,但对于现代的 Linux 发行版,SHA-256 最常被使用。 + +我们将使用名为 `gpg` 和 `sha256` 的两个工具来验证 ISO 镜像的可靠性和完整性。 + +#### 下载校验和及签名 + +针对本篇指南的目的,我将使用 Ubuntu 18.04 LTS 服务器 ISO 镜像来做验证,但对于其他的 Linux 发行版应该也是适用的。 + +在靠近 Ubuntu 下载页的最上端,你将看到一些额外的文件(校验和及签名),正如下面展示的图片那样: + +![Ubuntu 18.04 的校验和及签名][4] + +其中名为 `SHA256SUMS` 的文件包含了这里所有可获取镜像的校验和,而 `SHA256SUMS.gpg` 文件则是这个文件的 GnuPG 签名。在下面的步骤中,我们将使用这个签名文件来 **验证** 校验和文件。 + +下载 Ubuntu 的 ISO 镜像文件以及刚才提到的那两个文件,然后将它们放到同一目录下,例如这里的 `ISO` 目录: + +``` +$ ls ISO/ +SHA256SUMS SHA256SUMS.gpg ubuntu-18.04.2-live-server-amd64.iso +``` + +如你所见,我已经下载了 Ubuntu 18.04.2 LTS 服务器版本的镜像,以及对应的校验和文件和签名文件。 + +#### 下载有效的签名秘钥 + +现在,使用下面的命令来下载正确的签名秘钥: + +``` +$ gpg --keyid-format long --keyserver hkp://keyserver.ubuntu.com --recv-keys 0x46181433FBB75451 0xD94AA3F0EFE21092 +``` + +示例输出如下: + +``` +gpg: key D94AA3F0EFE21092: 57 signatures not checked due to missing keys +gpg: key D94AA3F0EFE21092: public key "Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>" imported +gpg: key 46181433FBB75451: 105 signatures not checked due to missing keys +gpg: key 46181433FBB75451: public key "Ubuntu CD Image Automatic Signing Key <[email protected]>" imported +gpg: no ultimately trusted keys found +gpg: Total number processed: 2 +gpg: imported: 2 +``` + +#### 验证 SHA-256 校验和 + +接下来我们将使用签名来验证校验和文件: + +``` +$ gpg --keyid-format long --verify SHA256SUMS.gpg SHA256SUMS +``` + +下面是示例输出: + +``` +gpg: Signature made Friday 15 February 2019 04:23:33 AM IST +gpg: using DSA key 46181433FBB75451 +gpg: Good signature from "Ubuntu CD Image Automatic Signing Key <[email protected]>" [unknown] +gpg: WARNING: This key is not certified with a trusted signature! +gpg: There is no indication that the signature belongs to the owner. +Primary key fingerprint: C598 6B4F 1257 FFA8 6632 CBA7 4618 1433 FBB7 5451 +gpg: Signature made Friday 15 February 2019 04:23:33 AM IST +gpg: using RSA key D94AA3F0EFE21092 +gpg: Good signature from "Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>" [unknown] +gpg: WARNING: This key is not certified with a trusted signature! +gpg: There is no indication that the signature belongs to the owner. +Primary key fingerprint: 8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092 +``` + +假如你在输出中看到 `Good signature` 字样,那么该校验和文件便是由 Ubuntu 开发者制作的,并且由秘钥文件的所属者签名认证。 + +#### 检验下载的 ISO 文件 + +下面让我们继续检查下载的 ISO 文件是否和所给的校验和相匹配。为了达到该目的,只需要运行: + +``` +$ sha256sum -c SHA256SUMS 2>&1 | grep OK +ubuntu-18.04.2-live-server-amd64.iso: OK +``` + +假如校验和是匹配的,你将看到 `OK` 字样,这意味着下载的文件是合法的,没有被改变或篡改过。 + +假如你没有获得类似的输出,或者看到不同的输出,则该 ISO 文件可能已经被修改过或者没有被正确地下载。你必须从一个更好的下载源重新下载该文件。 + +某些 Linux 发行版已经在它的下载页面中包含了校验和。例如 Pop!_os 的开发者在他们的下载页面中提供了所有 ISO 镜像的 SHA-256 校验和,这样你就可以快速地验证这些 ISO 镜像。 + +![Pop os 位于其下载页面中的 SHA256 校验和][5] + +在下载完 ISO 镜像文件后,可以使用下面的命令来验证它们: + +``` +$ sha256sum Soft_backup/ISOs/pop-os_18.04_amd64_intel_54.iso +``` + +示例输出如下: + +``` +680e1aa5a76c86843750e8120e2e50c2787973343430956b5cbe275d3ec228a6 Soft_backup/ISOs/pop-os_18.04_amd64_intel_54.iso +``` + +![Pop os 的 SHA256 校验和的值][6] + +在上面的输出中,以 `680elaa` 开头的部分为 SHA-256 校验和的值。请将该值与位于下载页面中提供的 SHA-256 校验和的值进行比较,如果这两个值相同,那说明这个下载的 ISO 文件是合法的,与它的原有状态相比没有经过更改或者篡改。万事俱备,你可以进行下一步了! + +上面的内容便是我们如何在 Linux 中验证一个 ISO 文件的可靠性和完整性的方法。无论你是从官方站点或者第三方站点下载 ISO 文件,我们总是推荐你在使用它们之前做一次简单的快速验证。希望本篇的内容对你有所帮助。 + +参考文献: + +* [https://tutorials.ubuntu.com/tutorial/tutorial-how-to-verify-ubuntu][7] + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-verify-iso-images-in-linux/ + +作者:[sk][a] +选题:[lujun9972][b] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/Verify-ISO-Images-In-Linux-720x340.png +[2]: https://www.ostechnix.com/etcher-beauitiful-app-create-bootable-sd-cards-usb-drives/ +[3]: https://blog.linuxmint.com/?p=2994 +[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/Ubuntu-18.04-checksum-and-signature.png +[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/Pop-os-SHA256-sum.png +[6]: https://www.ostechnix.com/wp-content/uploads/2019/07/Pop-os-SHA256-sum-value.png +[7]: https://tutorials.ubuntu.com/tutorial/tutorial-how-to-verify-ubuntu diff --git a/published/201908/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md b/published/201908/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md new file mode 100644 index 0000000000..22eeb954f7 --- /dev/null +++ b/published/201908/20190806 Microsoft finds Russia-backed attacks that exploit IoT devices.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11207-1.html) +[#]: subject: (Microsoft finds Russia-backed attacks that exploit IoT devices) +[#]: via: (https://www.networkworld.com/article/3430356/microsoft-finds-russia-backed-attacks-that-exploit-iot-devices.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +微软发现由俄罗斯背后支持的利用物联网设备进行的攻击 +====== + +> 微软表示,默认密码、未打补丁的设备,物联网设备库存不足是导致俄罗斯的 STRONTIUM 黑客组织发起针对公司的攻击的原因。 + +![Zmeel / Getty Images][1] + +在微软安全响应中心周一发布的博客文章中,该公司称,STRONTIUM 黑客组织对未披露名字的微软客户进行了基于 [IoT][2] 的攻击,安全研究人员相信 STRONTIUM 黑客组织和俄罗斯 GRU 军事情报机构有密切的关系。 + +微软[在博客中说][3],它在 4 月份发现的攻击针对三种特定的物联网设备:一部 VoIP 电话、一部视频解码器和一台打印机(该公司拒绝说明品牌),并将它们用于获得对不特定的公司网络的访问权限。其中两个设备遭到入侵是因为没有更改过制造商的默认密码,而另一个设备则是因为没有应用最新的安全补丁。 + +以这种方式受到攻击的设备成为了安全的网络的后门,允许攻击者自由扫描这些网络以获得进一步的漏洞,并访问其他系统获取更多的信息。攻击者也被发现其在调查受攻击网络上的管理组,试图获得更多访问权限,以及分析本地子网流量以获取其他数据。 + +STRONTIUM,也被称为 Fancy Bear、Pawn Storm、Sofacy 和 APT28,被认为是代表俄罗斯政府进行的一系列恶意网络活动的幕后黑手,其中包括 2016 年对民主党全国委员会的攻击,对世界反兴奋剂机构的攻击,针对记者调查马来西亚航空公司 17 号航班在乌克兰上空被击落的情况,向美国军人的妻子发送捏造的死亡威胁等等。 + +根据 2018 年 7 月特别顾问罗伯特·穆勒办公室发布的起诉书,STRONTIUM 袭击的指挥者是一群俄罗斯军官,所有这些人都被 FBI 通缉与这些罪行有关。 + +微软通知客户发现其遭到了民族国家的攻击,并在过去 12 个月内发送了大约 1,400 条与 STRONTIUM 相关的通知。微软表示,其中大多数(五分之四)是对政府、军队、国防、IT、医药、教育和工程领域的组织的攻击,其余的则是非政府组织、智囊团和其他“政治附属组织”。 + +根据微软团队的说法,漏洞的核心是机构缺乏对其网络上运行的所有设备的充分认识。另外,他们建议对在企业环境中运行的所有 IoT 设备进行编目,为每个设备实施自定义安全策略,在可行的情况下在各自独立的网络上屏蔽物联网设备,并对物联网组件执行定期补丁和配置审核。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3430356/microsoft-finds-russia-backed-attacks-that-exploit-iot-devices.html + +作者:[Jon Gold][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/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/07/cso_russian_hammer_and_sickle_binary_code_by_zmeel_gettyimages-927363118_2400x1600-100801412-large.jpg +[2]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[3]: https://msrc-blog.microsoft.com/2019/08/05/corporate-iot-a-path-to-intrusion/ +[4]: https://www.networkworld.com/article/3207535/internet-of-things/what-is-the-iot-how-the-internet-of-things-works.html +[5]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html +[6]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html +[7]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html +[8]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html +[9]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html +[10]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html +[11]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html +[12]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html +[13]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/published/201908/20190806 Unboxing the Raspberry Pi 4.md b/published/201908/20190806 Unboxing the Raspberry Pi 4.md new file mode 100644 index 0000000000..b4a72adf63 --- /dev/null +++ b/published/201908/20190806 Unboxing the Raspberry Pi 4.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11248-1.html) +[#]: subject: (Unboxing the Raspberry Pi 4) +[#]: via: (https://opensource.com/article/19/8/unboxing-raspberry-pi-4) +[#]: author: (Anderson Silva https://opensource.com/users/ansilvahttps://opensource.com/users/bennuttall) + +树莓派 4 开箱记 +====== + +> 树莓派 4 与其前代产品相比具有令人印象深刻的性能提升,而入门套件使其易于快速启动和运行。 + +![](https://img.linux.net.cn/data/attachment/album/201908/20/091730rl99q2ahycd4sz9h.jpg) + +当树莓派 4 [在 6 月底宣布发布][2]时,我没有迟疑,在发布的同一天就从 [CanaKit][3] 订购了两套树莓派 4 入门套件。1GB RAM 版本有现货,但 4GB 版本要在 7 月 19 日才能发货。由于我想两个都试试,这两个都订购了让它们一起发货。 + +![CanaKit's Raspberry Pi 4 Starter Kit and official accessories][4] + +这是我开箱我的树莓派 4 后所看到的。 + +### 电源 + +树莓派 4 使用 USB-C 连接器供电。虽然 USB-C 电缆现在非常普遍,但你的树莓派 4 [可能不喜欢你的USB-C 线][5](至少对于树莓派 4 的第一版如此)。因此,除非你确切知道自己在做什么,否则我建议你订购含有官方树莓派充电器的入门套件。如果你想尝试手头的充电设备,那么该设备的输入是 100-240V ~ 50/60Hz 0.5A,输出为 5.1V - 3.0A。 + +![Raspberry Pi USB-C charger][6] + +### 键盘和鼠标 + +官方的键盘和鼠标是和入门套件是[分开出售][7]的,总价 25 美元,并不很便宜,因为你的这台树莓派电脑也才只有 35 到 55 美元。但树莓派徽标印在这个键盘上(而不是 Windows 徽标),并且外观相宜。键盘也是 USB 集线器,因此它允许你插入更多设备。我插入了我的 [YubiKey][8] 安全密钥,它运行得非常好。我会把键盘和鼠标分类为“值得拥有”而不是“必须拥有”。你的常规键盘和鼠标应该也可以正常工作。 + +![Official Raspberry Pi keyboard \(with YubiKey plugged in\) and mouse.][9] + +![Raspberry Pi logo on the keyboard][10] + +### Micro-HDMI 电缆 + +可能让一些人惊讶的是,与带有 Mini-HDMI 端口的树莓派 Zero 不同,树莓派 4 配备了 Micro-HDMI。它们不是同一个东西!因此,即使你手头有合适的 USB-C 线缆/电源适配器、鼠标和键盘,也很有可能需要使用 Micro-HDMI 转 HDMI 的线缆(或适配器)来将你的新树莓派接到显示器上。 + +### 外壳 + +树莓派的外壳已经有了很多年,这可能是树莓派基金会销售的第一批“官方”外围设备之一。有些人喜欢它们,而有些人不喜欢。我认为将一个树莓派放在一个盒子里可以更容易携带它,可以避免静电和针脚弯曲。 + +另一方面,把你的树莓派装在盒子里会使电路板过热。这款 CanaKit 入门套件还配备了处理器散热器,这可能有所帮助,因为较新的树莓派已经[以运行相当热而闻名][11]了。 + +![Raspberry Pi 4 case][12] + +### Raspbian 和 NOOBS + +入门套件附带的另一个东西是 microSD 卡,其中预装了树莓派 4 的 [NOOBS][13] 操作系统的正确版本。(我拿到的是 3.19 版,发布于 2019 年 6 月 24 日)。如果你是第一次使用树莓派并且不确定从哪里开始,这可以为你节省大量时间。入门套件中的 microSD 卡容量为 32GB。 + +插入 microSD 卡并连接所有电缆后,只需启动树莓派,引导进入 NOOBS,选择 Raspbian 发行版,然后等待安装。 + +![Raspberry Pi 4 with 4GB of RAM][14] + +我注意到在安装最新的 Raspbian 时有一些改进。(如果它们已经出现了一段时间,请原谅我 —— 自从树莓派 3 出现以来我没有对树莓派进行过全新安装。)其中一个是 Raspbian 会要求你在安装后的首次启动为你的帐户设置一个密码,另一个是它将运行软件更新(假设你有网络连接)。这些都是很大的改进,有助于保持你的树莓派更安全。我很希望能有一天在安装时看到加密 microSD 卡的选项。 + +![Running Raspbian updates at first boot][15] + +![Raspberry Pi 4 setup][16] + +运行非常顺畅! + +### 结语 + +虽然 CanaKit 不是美国唯一授权的树莓派零售商,但我发现它的入门套件的价格物超所值。 + +到目前为止,我对树莓派 4 的性能提升印象深刻。我打算尝试用一整个工作日将它作为我唯一的计算机,我很快就会写一篇关于我探索了多远的后续文章。敬请关注! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/unboxing-raspberry-pi-4 + +作者:[Anderson Silva][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/ansilvahttps://opensource.com/users/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi4_board_hardware.jpg?itok=KnFU7NvR (Raspberry Pi 4 board, posterized filter) +[2]: https://opensource.com/article/19/6/raspberry-pi-4 +[3]: https://www.canakit.com/raspberry-pi-4-starter-kit.html +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi4_canakit.jpg (CanaKit's Raspberry Pi 4 Starter Kit and official accessories) +[5]: https://www.techrepublic.com/article/your-new-raspberry-pi-4-wont-power-on-usb-c-cable-problem-now-officially-confirmed/ +[6]: https://opensource.com/sites/default/files/uploads/raspberrypi_usb-c_charger.jpg (Raspberry Pi USB-C charger) +[7]: https://www.canakit.com/official-raspberry-pi-keyboard-mouse.html?defpid=4476 +[8]: https://www.yubico.com/products/yubikey-hardware/ +[9]: https://opensource.com/sites/default/files/uploads/raspberrypi_keyboardmouse.jpg (Official Raspberry Pi keyboard (with YubiKey plugged in) and mouse.) +[10]: https://opensource.com/sites/default/files/uploads/raspberrypi_keyboardlogo.jpg (Raspberry Pi logo on the keyboard) +[11]: https://www.theregister.co.uk/2019/07/22/raspberry_pi_4_too_hot_to_handle/ +[12]: https://opensource.com/sites/default/files/uploads/raspberrypi4_case.jpg (Raspberry Pi 4 case) +[13]: https://www.raspberrypi.org/downloads/noobs/ +[14]: https://opensource.com/sites/default/files/uploads/raspberrypi4_ram.jpg (Raspberry Pi 4 with 4GB of RAM) +[15]: https://opensource.com/sites/default/files/uploads/raspberrypi4_rasbpianupdate.jpg (Running Raspbian updates at first boot) +[16]: https://opensource.com/sites/default/files/uploads/raspberrypi_setup.jpg (Raspberry Pi 4 setup) diff --git a/published/201908/20190808 Find Out How Long Does it Take To Boot Your Linux System.md b/published/201908/20190808 Find Out How Long Does it Take To Boot Your Linux System.md new file mode 100644 index 0000000000..f3202d96af --- /dev/null +++ b/published/201908/20190808 Find Out How Long Does it Take To Boot Your Linux System.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11238-1.html) +[#]: subject: (Find Out How Long Does it Take To Boot Your Linux System) +[#]: via: (https://itsfoss.com/check-boot-time-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +你的 Linux 系统开机时间已经击败了 99% 的电脑 +====== + +当你打开系统电源时,你会等待制造商的徽标出现,屏幕上可能会显示一些消息(以非安全模式启动),然后是 [Grub][1] 屏幕、操作系统加载屏幕以及最后的登录屏。 + +你检查过这花费了多长时间么?也许没有。除非你真的需要知道,否则你不会在意开机时间。 + +但是如果你很想知道你的 Linux 系统需要很长时间才能启动完成呢?使用秒表是一种方法,但在 Linux 中,你有一种更好、更轻松地了解系统启动时间的方法。 + +### 在 Linux 中使用 systemd-analyze 检查启动时间 + +![](https://img.linux.net.cn/data/attachment/album/201908/17/104358s1ho8ug868hso1y8.jpg) + +无论你是否喜欢,[systemd][3] 运行在大多数流行的 Linux 发行版中。systemd 有许多管理 Linux 系统的工具。其中一个就是 `systemd-analyze`。 + +`systemd-analyze` 命令为你提供最近一次启动时运行的服务数量以及消耗时间的详细信息。 + +如果在终端中运行以下命令: + +``` +systemd-analyze +``` + +你将获得总启动时间以及固件、引导加载程序、内核和用户空间所消耗的时间: + +``` +Startup finished in 7.275s (firmware) + 13.136s (loader) + 2.803s (kernel) + 12.488s (userspace) = 35.704s + +graphical.target reached after 12.408s in userspace +``` + +正如你在上面的输出中所看到的,我的系统花了大约 35 秒才进入可以输入密码的页面。我正在使用戴尔 XPS Ubuntu。它使用 SSD 存储,尽管如此,它还需要很长时间才能启动。 + +不是那么令人印象深刻,是吗?为什么不共享你们系统的启动时间?我们来比较吧。 + +你可以使用以下命令将启动时间进一步细分为每个单元: + +``` +systemd-analyze blame +``` + +这将生成大量输出,所有服务按所用时间的降序列出。 + +``` +7.347s plymouth-quit-wait.service +6.198s NetworkManager-wait-online.service +3.602s plymouth-start.service +3.271s plymouth-read-write.service +2.120s apparmor.service +1.503s [email protected] +1.213s motd-news.service + 908ms snapd.service + 861ms keyboard-setup.service + 739ms fwupd.service + 702ms bolt.service + 672ms dev-nvme0n1p3.device + 608ms [email protected]:intel_backlight.service + 539ms snap-core-7270.mount + 504ms snap-midori-451.mount + 463ms snap-screencloud-1.mount + 446ms snapd.seeded.service + 440ms snap-gtk\x2dcommon\x2dthemes-1313.mount + 420ms snap-core18-1066.mount + 416ms snap-scrcpy-133.mount + 412ms snap-gnome\x2dcharacters-296.mount +``` + +#### 额外提示:改善启动时间 + +如果查看此输出,你可以看到网络管理器和 [plymouth][4] 都消耗了大量的启动时间。 + +Plymouth 负责你在 Ubuntu 和其他发行版中在登录页面出现之前的引导页面。网络管理器负责互联网连接,可以关闭它来加快启动时间。不要担心,在你登录后,你可以正常使用 wifi。 + +``` +sudo systemctl disable NetworkManager-wait-online.service +``` + +如果要还原更改,可以使用以下命令: + +``` +sudo systemctl enable NetworkManager-wait-online.service +``` + +请不要在不知道用途的情况下自行禁用各种服务。这可能会产生危险的后果。 + +现在你知道了如何检查 Linux 系统的启动时间,为什么不在评论栏分享你的系统的启动时间? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-boot-time-linux/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/software/grub/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-boot-time.jpg?resize=800%2C450&ssl=1 +[3]: https://en.wikipedia.org/wiki/Systemd +[4]: https://wiki.archlinux.org/index.php/Plymouth diff --git a/published/201908/20190808 How to manipulate PDFs on Linux.md b/published/201908/20190808 How to manipulate PDFs on Linux.md new file mode 100644 index 0000000000..3357b5581c --- /dev/null +++ b/published/201908/20190808 How to manipulate PDFs on Linux.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11230-1.html) +[#]: subject: (How to manipulate PDFs on Linux) +[#]: via: (https://www.networkworld.com/article/3430781/how-to-manipulate-pdfs-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 命令行操作 PDF +====== + +> pdftk 命令提供了许多处理 PDF 的命令行操作,包括合并页面、加密文件、添加水印、压缩文件,甚至还有修复 PDF。 + +![](https://img.linux.net.cn/data/attachment/album/201908/15/110119x6sjnjs6s22srnje.jpg) + +虽然 PDF 通常被认为是相当稳定的文件,但在 Linux 和其他系统上你可以做很多处理。包括合并、拆分、旋转、拆分成单页、加密和解密、添加水印、压缩和解压缩,甚至还有修复。 `pdftk` 命令能执行所有甚至更多操作。 + +“pdftk” 代表 “PDF 工具包”(PDF tool kit),这个命令非常易于使用,并且可以很好地操作 PDF。例如,要将独立的文件合并成一个文件,你可以使用以下命令: + +``` +$ pdftk pg1.pdf pg2.pdf pg3.pdf pg4.pdf pg5.pdf cat output OneDoc.pdf +``` + +`OneDoc.pdf` 将包含上面显示的所有五个文档,命令将在几秒钟内运行完毕。请注意,`cat` 选项表示将文件连接在一起,`output` 选项指定新文件的名称。 + +你还可以从 PDF 中提取选定页面来创建单独的 PDF 文件。例如,如果要创建仅包含上面创建的文档的第 1、2、3 和 5 页的新 PDF,那么可以执行以下操作: + +``` +$ pdftk OneDoc.pdf cat 1-3 5 output 4pgs.pdf +``` + +另外,如果你想要第 1、3、4 和 5 页(总计 5 页),我们可以使用以下命令: + +``` +$ pdftk OneDoc.pdf cat 1 3-end output 4pgs.pdf +``` + +你可以选择单独页面或者页面范围,如上例所示。 + +下一个命令将从一个包含奇数页(1、3 等)的文件和一个包含偶数页(2、4 等)的文件创建一个整合文档: + +``` +$ pdftk A=odd.pdf B=even.pdf shuffle A B output collated.pdf +``` + +请注意,`shuffle` 选项使得能够完成整合,并指示文档的使用顺序。另请注意:虽然上面建议用的是奇数/偶数页,但你不限于仅使用两个文件。 + +如果要创建只能由知道密码的收件人打开的加密 PDF,可以使用如下命令: + +``` +$ pdftk prep.pdf output report.pdf user_pw AsK4n0thingGeTn0thing +``` + +选项提供 40(`encrypt_40bit`)和 128(`encrypt_128bit`)位加密。默认情况下使用 128 位加密。 + +你还可以使用 `burst` 选项将 PDF 文件分成单个页面: + +``` +$ pdftk allpgs.pdf burst +$ ls -ltr *.pdf | tail -5 +-rw-rw-r-- 1 shs shs 22933 Aug 8 08:18 pg_0001.pdf +-rw-rw-r-- 1 shs shs 23773 Aug 8 08:18 pg_0002.pdf +-rw-rw-r-- 1 shs shs 23260 Aug 8 08:18 pg_0003.pdf +-rw-rw-r-- 1 shs shs 23435 Aug 8 08:18 pg_0004.pdf +-rw-rw-r-- 1 shs shs 23136 Aug 8 08:18 pg_0005.pdf +``` + +`pdftk` 命令使得合并、拆分、重建、加密 PDF 文件非常容易。要了解更多选项,请查看 [PDF 实验室][3]中的示例页面。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3430781/how-to-manipulate-pdfs-on-linux.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/08/book-pages-100807709-large.jpg +[3]: https://www.pdflabs.com/docs/pdftk-cli-examples/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/201908/20190809 Copying files in Linux.md b/published/201908/20190809 Copying files in Linux.md new file mode 100644 index 0000000000..d657449899 --- /dev/null +++ b/published/201908/20190809 Copying files in Linux.md @@ -0,0 +1,210 @@ +[#]: collector: (lujun9972) +[#]: translator: (tomjlw) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11259-1.html) +[#]: subject: (Copying files in Linux) +[#]: via: (https://opensource.com/article/19/8/copying-files-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/scottnesbitthttps://opensource.com/users/greg-p) + +在 Linux 中复制文档 +====== + +> 了解在 Linux 中多种复制文档的方式以及各自的优点。 + +![](https://img.linux.net.cn/data/attachment/album/201908/23/053859f1stcjezllmj28e8.jpg) + +在办公室里复印文档过去需要专门的员工与机器。如今,复制是电脑用户无需多加思考的任务。在电脑里复制数据是如此微不足道的事,以致于你还没有意识到复制就发生了,例如当拖动文档到外部硬盘的时候。 + +数字实体复制起来十分简单已是一个不争的事实,以致于大部分现代电脑用户从未考虑过其它的复制他们工作的方式。无论如何,在 Linux 中复制文档仍有几种不同的方式。每种方法取决于你的目的不同而都有其独到之处。 + +以下是一系列在 Linux、BSD 及 Mac 上复制文件的方式。 + +### 在 GUI 中复制 + +如大多数操作系统一样,如果你想的话,你可以完全用 GUI 来管理文件。 + +#### 拖拽放下 + +最浅显的复制文件的方式可能就是你以前在电脑中复制文件的方式:拖拽并放下。在大多数 Linux 桌面上,从一个本地文件夹拖拽放下到另一个本地文件夹是*移动*文件的默认方式,你可以通过在拖拽文件开始后按住 `Ctrl` 来改变这个行为。 + +你的鼠标指针可能会有一个指示,例如一个加号以显示你在复制模式。 + +![复制一个文件][2] + +注意如果文件是放在远程系统上的,不管它是一个 Web 服务器还是在你自己网络里用文件共享协议访问的另一台电脑,默认动作经常是复制而不是移动文件。 + +#### 右击 + +如果你觉得在你的桌面拖拽文档不够精准或者有点笨拙,或者这么做会让你的手离开键盘太久,你可以经常使用右键菜单来复制文件。这取决于你所用的文件管理器,但通常来说,右键弹出的关联菜单会包括常见的操作。 + +关联菜单的“复制”动作将你的[文件路径][3](即文件在系统的位置)保存在你的剪切板中,这样你可以将你的文件*粘贴*到别处:(LCTT 译注:此处及下面的描述不确切,这里并非复制的文件路径的“字符串”,而是复制了代表文件实体的对象/指针) + +![从右键菜单复制文件][4] + +在这种情况下,你并没有将文件的内容复制到你的剪切版上。取而代之的是你复制了[文件路径][3]。当你粘贴时,你的文件管理器会查看剪贴板上的路径并执行复制命令,将相应路径上的文件粘贴到你准备复制到的路径。 + +### 用命令行复制 + +虽然 GUI 通常是相对熟悉的复制文件方式,用终端复制却更有效率。 + +#### cp + +在终端上等同于在桌面上复制和粘贴文件的最显而易见的方式就是 `cp` 命令。这个命令可以复制文件和目录,也相对直接。它使用熟悉的*来源*和*目的*(必须以这样的顺序)句法,因此复制一个名为 `example.txt` 的文件到你的 `Documents` 目录就像这样: + +``` +$ cp example.txt ~/Documents +``` + +就像当你拖拽文件放在文件夹里一样,这个动作并不会将 `Documents` 替换为 `example.txt`。取而代之的是,`cp` 察觉到 `Documents` 是一个文件夹,就将 `example.txt` 的副本放进去。 + +你同样可以便捷有效地重命名你复制的文档: + +``` +$ cp example.txt ~/Documents/example_copy.txt +``` + +重要的是,它使得你可以在与原文件相同的目录中生成一个副本: + +``` +$ cp example.txt example.txt +cp: 'example.txt' and 'example.txt' are the same file. +$ cp example.txt example_copy.txt +``` + +要复制一个目录,你必须使用 `-r` 选项(代表 `--recursive`,递归)。以这个选项对目录 `nodes` 运行 `cp` 命令,然后会作用到该目录下的所有文件。没有 `-r` 选项,`cp` 不会将目录当成一个可复制的对象: + +``` +$ cp notes/ notes-backup +cp: -r not specified; omitting directory 'notes/' +$ cp -r notes/ notes-backup +``` + +#### cat + +`cat` 命令是最易被误解的命令,但这只是因为它表现了 [POSIX][5] 系统的极致灵活性。在 `cat` 可以做到的所有事情中(包括其原意的连接文件的用途),它也能复制。例如说使用 `cat` 你可以仅用一个命令就[从一个文件创建两个副本][6]。你用 `cp` 无法做到这一点。 + +使用 `cat` 复制文档要注意的是系统解释该行为的方式。当你使用 `cp` 复制文件时,该文件的属性跟着文件一起被复制,这意味着副本的权限和原件一样。 + +``` +$ ls -l -G -g +-rw-r--r--. 1 57368 Jul 25 23:57  foo.jpg +$ cp foo.jpg bar.jpg +-rw-r--r--. 1 57368 Jul 29 13:37  bar.jpg +-rw-r--r--. 1 57368 Jul 25 23:57  foo.jpg +``` + +然而用 `cat` 将一个文件的内容读取至另一个文件是让系统创建了一个新文件。这些新文件取决于你的默认 umask 设置。要了解 umask 更多的知识,请阅读 Alex Juarez 讲述 [umask][7] 以及权限概览的文章。 + +运行 `unmask` 获取当前设置: + +``` +$ umask +0002 +``` + +这个设置代表在该处新创建的文档被给予 `664`(`rw-rw-r--`)权限,因为该 `unmask` 设置的前几位数字没有遮掩任何权限(而且执行位不是文件创建的默认位),并且写入权限被最终位所屏蔽。 + +当你使用 `cat` 复制时,实际上你并没有真正复制文件。你使用 `cat` 读取文件内容并将输出重定向到了一个新文件: + +``` +$ cat foo.jpg > baz.jpg +$ ls -l -G -g +-rw-r--r--. 1 57368 Jul 29 13:37  bar.jpg +-rw-rw-r--. 1 57368 Jul 29 13:42  baz.jpg +-rw-r--r--. 1 57368 Jul 25 23:57  foo.jpg +``` + +如你所见,`cat` 应用系统默认的 umask 设置创建了一个全新的文件。 + +最后,当你只是想复制一个文件时,这些手段无关紧要。但如果你想复制文件并保持默认权限时,你可以用一个命令 `cat` 完成一切。 + +#### rsync + +有着著名的同步源和目的文件的能力,`rsync` 命令是一个复制文件的多才多艺的工具。最为简单的,`rsync` 可以类似于 `cp` 命令一样使用。 + +``` +$ rsync example.txt example_copy.txt +$ ls +example.txt    example_copy.txt +``` + +这个命令真正的威力藏在其能够*不做*不必要的复制的能力里。如果你使用 `rsync` 来将文件复制进目录里,且其已经存在在该目录里,那么 `rsync` 不会做复制操作。在本地这个差别不是很大,但如果你将海量数据复制到远程服务器,这个特性的意义就完全不一样了。 + +甚至在本地中,真正不一样的地方在于它可以分辨具有相同名字但拥有不同数据的文件。如果你曾发现你面对着同一个目录的两个相同副本时,`rsync` 可以将它们同步至一个包含每一个最新修改的目录。这种配置在尚未发现版本控制威力的业界十分常见,同时也作为需要从一个可信来源复制的备份方案。 + +你可以通过创建两个文件夹有意识地模拟这种情况,一个叫做 `example` 另一个叫做 `example_dupe`: + +``` +$ mkdir example example_dupe +``` + +在第一个文件夹里创建文件: + +``` +$ echo "one" > example/foo.txt +``` + +用 `rsync` 同步两个目录。这种做法最常见的选项是 `-a`(代表 “archive”,可以保证符号链接和其它特殊文件保留下来)和 `-v`(代表 “verbose”,向你提供当前命令的进度反馈): + +``` +$ rsync -av example/ example_dupe/ +``` + +两个目录现在包含同样的信息: + +``` +$ cat example/foo.txt +one +$ cat example_dupe/foo.txt +one +``` + +如果你当作源分支的文件发生改变,目的文件也会随之跟新: + +``` +$ echo "two" >> example/foo.txt +$ rsync -av example/  example_dupe/ +$ cat example_dupe/foo.txt +one +two +``` + +注意 `rsync` 命令是用来复制数据的,而不是充当版本管理系统的。例如假设有一个目的文件比源文件多了改变,那个文件仍将被覆盖,因为 `rsync` 比较文件的分歧并假设目的文件总是应该镜像为源文件: + +``` +$ echo "You will never see this note again" > example_dupe/foo.txt +$ rsync -av example/  example_dupe/ +$ cat example_dupe/foo.txt +one +two +``` + +如果没有改变,那么就不会有复制动作发生。 + +`rsync` 命令有许多 `cp` 没有的选项,例如设置目标权限、排除文件、删除没有在两个目录中出现的过时文件,以及更多。可以使用 `rsync` 作为 `cp` 的强力替代或者有效补充。 + +### 许多复制的方式 + +在 POSIX 系统中有许多能够达成同样目的的方式,因此开源的灵活性名副其实。我忘了哪个复制数据的有效方式吗?在评论区分享你的复制神技。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/copying-files-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[tomjlw](https://github.com/tomjlw) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sethhttps://opensource.com/users/scottnesbitthttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/documents_papers_file_storage_work.png?itok=YlXpAqAJ (Filing papers and documents) +[2]: https://opensource.com/sites/default/files/uploads/copy-nautilus.jpg (Copying a file.) +[3]: https://opensource.com/article/19/7/understanding-file-paths-and-how-use-them +[4]: https://opensource.com/sites/default/files/uploads/copy-files-menu.jpg (Copying a file from the context menu.) +[5]: https://linux.cn/article-11222-1.html +[6]: https://opensource.com/article/19/2/getting-started-cat-command +[7]: https://opensource.com/article/19/7/linux-permissions-101 diff --git a/published/201908/20190809 Use a drop-down terminal for fast commands in Fedora.md b/published/201908/20190809 Use a drop-down terminal for fast commands in Fedora.md new file mode 100644 index 0000000000..337f193c5b --- /dev/null +++ b/published/201908/20190809 Use a drop-down terminal for fast commands in Fedora.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11216-1.html) +[#]: subject: (Use a drop-down terminal for fast commands in Fedora) +[#]: via: (https://fedoramagazine.org/use-a-drop-down-terminal-for-fast-commands-in-fedora/) +[#]: author: (Guilherme Schelp https://fedoramagazine.org/author/schelp/) + +在 Fedora 下使用下拉式终端更快输入命令 +====== + +![][1] + +下拉式终端可以一键打开,并快速输入桌面上的任何命令。通常它会以平滑的方式创建终端,有时会带有下拉效果。本文演示了如何使用 Yakuake、Tilda、Guake 和 GNOME 扩展等下拉式终端来改善和加速日常任务。 + +### Yakuake + +[Yakuake][2] 是一个基于 KDE Konsole 技术的下拉式终端模拟器。它以 GNU GPLv2 条款分发。它包括以下功能: + +* 从屏幕顶部平滑地滚下 +* 标签式界面 +* 尺寸和动画速度可配置 +* 换肤 +* 先进的 D-Bus 接口 + +要安装 Yakuake,请使用以下命令: + +``` +$ sudo dnf install -y yakuake +``` + +#### 启动和配置 + +如果你运行 KDE,请打开系统设置,然后转到“启动和关闭”。将“yakuake”添加到“自动启动”下的程序列表中,如下所示: + +![][3] + +Yakuake 运行时很容易配置,首先在命令行启动该程序: + +``` +$ yakuake & +``` + +随后出现欢迎对话框。如果标准的快捷键和你已经使用的快捷键冲突,你可以设置一个新的。 + +![][4] + +点击菜单按钮,出现如下帮助菜单。接着,选择“配置 Yakuake……”访问配置选项。 + +![][5] + +你可以自定义外观选项,例如透明度、行为(例如当鼠标指针移过它们时聚焦终端)和窗口(如大小和动画)。在窗口选项中,你会发现当你使用两个或更多监视器时最有用的选项之一:“在鼠标所在的屏幕上打开”。 + +#### 使用 Yakuake + +主要的快捷键有: + + * `F12` = 打开/撤回 Yakuake + * `Ctrl+F11` = 全屏模式 + * `Ctrl+)` = 上下分割 + * `Ctrl+(` = 左右分割 + * `Ctrl+Shift+T` = 新会话 + * `Shift+Right` = 下一个会话 + * `Shift+Left` = 上一个会话 + * `Ctrl+Alt+S` = 重命名会话 + +以下是 Yakuake 像[终端多路复用器][6]一样分割会话的示例。使用此功能,你可以在一个会话中运行多个 shell。 + +![][7] + +### Tilda + +[Tilda][8] 是一个下拉式终端,可与其他流行的终端模拟器相媲美,如 GNOME 终端、KDE 的 Konsole、xterm 等等。 + +它具有高度可配置的界面。你甚至可以更改终端大小和动画速度等选项。Tilda 还允许你启用热键,以绑定到各种命令和操作。 + +要安装 Tilda,请运行以下命令: + +``` +$ sudo dnf install -y tilda +``` + +#### 启动和配置 + +大多数用户更喜欢在登录时就在后台运行一个下拉式终端。要设置此选项,请首先转到桌面上的应用启动器,搜索 Tilda,然后将其打开。 + +接下来,打开 Tilda 配置窗口。 选择“隐藏启动 Tilda”,即启动时不会立即显示终端。 + +![][9] + +接下来,你要设置你的桌面自动启动 Tilda。如果你使用的是 KDE,请转到“系统设置 > 启动与关闭 > 自动启动”并“添加一个程序”。 + +![][10] + +如果你正在使用 GNOME,则可以在终端中运行此命令: + +``` +$ ln -s /usr/share/applications/tilda.desktop ~/.config/autostart/ +``` + +当你第一次运行它时,会出现一个向导来设置首选项。如果需要更改设置,请右键单击终端并转到菜单中的“首选项”。 + +![][11] + +你还可以创建多个配置文件,并绑定其他快捷键以在屏幕上的不同位置打开新终端。为此,请运行以下命令: + +``` +$ tilda -C +``` + +每次使用上述命令时,Tilda 都会在名为 `~/.config/tilda/` 文件夹中创建名为 `config_0`、`config_1` 之类的新配置文件。然后,你可以映射组合键以打开具有一组特定选项的新 Tilda 终端。 + +#### 使用 Tilda + +主要快捷键有: + + * `F1` = 拉下终端 Tilda(注意:如果你有多个配置文件,快捷方式是 F1、F2、F3 等) + * `F11` = 全屏模式 + * `F12` = 切换透明模式 + * `Ctrl+Shift+T` = 添加标签 + * `Ctrl+Page Up` = 下一个标签 + * `Ctrl+Page Down` = 上一个标签 + +### GNOME 扩展 + +Drop-down Terminal [GNOME 扩展][12]允许你在 GNOME Shell 中使用这个有用的工具。它易于安装和配置,使你可以快速访问终端会话。 + +#### 安装 + +打开浏览器并转到[此 GNOME 扩展的站点][12]。启用扩展设置为“On”,如下所示: + +![][13] + +然后选择“Install”以在系统上安装扩展。 + +![][14] + +执行此操作后,无需设置任何自动启动选项。只要你登录 GNOME,扩展程序就会自动运行! + +#### 配置 + +安装后,将打开 Drop-down Terminal 配置窗口以设置首选项。例如,可以设置终端大小、动画、透明度和使用滚动条。 + +![][15] + +如果你将来需要更改某些首选项,请运行 `gnome-shell-extension-prefs` 命令并选择“Drop Down Terminal”。 + +#### 使用该扩展 + +快捷键很简单: + + * 反尖号 (通常是 `Tab` 键上面的一个键) = 打开/撤回终端 + * `F12` (可以定制) = 打开/撤回终端 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-a-drop-down-terminal-for-fast-commands-in-fedora/ + +作者:[Guilherme Schelp][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://fedoramagazine.org/author/schelp/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/dropdown-terminals-816x345.jpg +[2]: https://kde.org/applications/system/org.kde.yakuake +[3]: https://fedoramagazine.org/wp-content/uploads/2019/07/auto_start-1024x723.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/07/yakuake_config-1024x419.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/07/yakuake_config_01.png +[6]: https://fedoramagazine.org/4-cool-terminal-multiplexers/ +[7]: https://fedoramagazine.org/wp-content/uploads/2019/07/yakuake_usage.gif +[8]: https://github.com/lanoxx/tilda +[9]: https://fedoramagazine.org/wp-content/uploads/2019/07/tilda_startup.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/07/tilda_startup_alt.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/07/tilda_config.png +[12]: https://extensions.gnome.org/extension/442/drop-down-terminal/ +[13]: https://fedoramagazine.org/wp-content/uploads/2019/07/gnome-shell-install_2-1024x455.png +[14]: https://fedoramagazine.org/wp-content/uploads/2019/07/gnome-shell-install_3.png +[15]: https://fedoramagazine.org/wp-content/uploads/2019/07/gnome-shell-install_4.png diff --git a/published/201908/20190811 How to measure the health of an open source community.md b/published/201908/20190811 How to measure the health of an open source community.md new file mode 100644 index 0000000000..68f5c12299 --- /dev/null +++ b/published/201908/20190811 How to measure the health of an open source community.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11244-1.html) +[#]: subject: (How to measure the health of an open source community) +[#]: via: (https://opensource.com/article/19/8/measure-project) +[#]: author: (Jon Lawrence https://opensource.com/users/the3rdlaw) + +如何衡量一个开源社区的健康度 +====== + +> 这比较复杂。 + +![](https://img.linux.net.cn/data/attachment/album/201908/19/184719nz3xuazppzu3vwcg.jpg) + +作为一个经常管理软件开发团队的人,多年来我一直关注度量指标。一次次,我发现自己领导团队使用一个又一个的项目平台(例如 Jira、GitLab 和 Rally)生成了大量可测量的数据。从那时起,我已经及时投入了大量时间从记录平台中提取了有用的指标,并采用了一种我们可以理解的格式,然后使用这些指标对开发的许多方面做出更好的选择。 + +今年早些时候,我有幸在 [Linux 基金会][2]遇到了一个名为[开源软件社区健康分析][3]Community Health Analytics for Open Source Software(CHAOSS)的项目。该项目侧重于从各种来源收集和丰富指标,以便开源社区的利益相关者可以衡量他们项目的健康状况。 + +### CHAOSS 介绍 + +随着我对该项目的基本指标和目标越来越熟悉,一个问题在我的脑海中不断翻滚。什么是“健康”的开源项目,由谁来定义? + +特定角色的人认为健康的东西可能另一个角色的人就不会这样认为。似乎可以用 CHAOSS 收集的细粒度数据进行市场细分实验,重点关注对特定角色可能最有意义的背景问题,以及 CHAOSS 收集哪些指标可能有助于回答这些问题。 + +CHAOSS 项目创建并维护了一套开源应用程序和度量标准定义,使得这个实验具有可能性,这包括: + +* 许多基于服务器的应用程序,用于收集、聚合和丰富度量标准(例如 Augur 和 GrimoireLab)。 +* ElasticSearch、Kibana 和 Logstash(ELK)的开源版本。 +* 身份服务、数据分析服务和各种集成库。 + +在我过去的一个程序中,有六个团队从事于不同复杂程度的项目,我们找到了一个简洁的工具,它允许我们从简单(或复杂)的 JQL 语句中创建我们想要的任何类型的指标,然后针对这些指标开发计算。在我们注意到之前,我们仅从 Jira 中就提取了 400 多个指标,而且还有更多指标来自手动的来源。 + +在项目结束时,我们认定这 400 个指标中,大多数指标在*以我们的角色*做出决策时并不重要。最终,只有三个对我们非常重要:“缺陷去除效率”、“已完成的条目与承诺的条目”,以及“每个开发人员的工作进度”。这三个指标最重要,因为它们是我们对自己、客户和团队成员所做出的承诺,因此是最有意义的。 + +带着这些通过经验得到的教训和对什么是健康的开源项目的问题,我跳进了 CHAOSS 社区,开始建立一套角色,以提供一种建设性的方法,从基于角色的角度回答这个问题。 + +CHAOSS 是一个开源项目,我们尝试使用民主共识来运作。因此,我决定使用组成分子constituent这个词而不是利益相关者,因为它更符合我们作为开源贡献者的责任,以创建更具共生性的价值链。 + +虽然创建此组成模型的过程采用了特定的“目标-问题-度量”方法,但有许多方法可以进行细分。CHAOSS 贡献者已经开发了很好的模型,可以按照矢量进行细分,例如项目属性(例如,个人、公司或联盟)和“失败容忍度”。在为 CHAOSS 开发度量定义时,每个模型都会提供建设性的影响。 + +基于这一切,我开始构建一个谁可能关心 CHAOSS 指标的模型,以及每个组成分子在 CHAOSS 的四个重点领域中最关心的问题: + +* [多样性和包容性][4] +* [演化][5] +* [风险][6] +* [价值][7] + +在我们深入研究之前,重要的是要注意 CHAOSS 项目明确地将背景判断留给了实施指标的团队。什么是“有意义的”和“什么是健康的?”的答案预计会因团队和项目而异。CHAOSS 软件的现成仪表板尽可能地关注客观指标。在本文中,我们关注项目创始人、项目维护者和贡献者。 + +### 项目组成分子 + +虽然这绝不是这些组成分子可能认为重要的问题的详尽清单,但这些选择感觉是一个好的起点。以下每个“目标-问题-度量”标准部分与 CHAOSS 项目正在收集和汇总的指标直接相关。 + +现在,进入分析的第 1 部分! + +#### 项目创始人 + +作为**项目创始人**,我**最**关心: + +* 我的项目**对其他人有用吗?**通过以下测量: + * 随着时间推移有多少复刻? + * **指标:**存储库复刻数。 + * 随着时间的推移有多少贡献者? + * **指标:**贡献者数量。 + * 贡献净质量。 + * **指标:**随着时间的推移提交的错误。 + * **指标:**随着时间的回归。 + * 项目的财务状况。 + * **指标:**随着时间的推移的捐赠/收入。 + * **指标:**随着时间的推移的费用。 +* 我的项目对其它人的**可见**程度? + * 有谁知道我的项目?别人认为它很整洁吗? + * **指标:**社交媒体上的提及、分享、喜欢和订阅的数量。 + * 有影响力的人是否了解我的项目? + * **指标:**贡献者的社会影响力。 + * 人们在公共场所对项目有何评价?是正面还是负面? + * **指标:**跨社交媒体渠道的情感(关键字或 NLP)分析。 +* 我的项目**可行性**程度? + * 我们有足够的维护者吗?该数字是随着时间的推移而上升还是下降? + * **指标:**维护者数量。 + * 改变速度如何随时间变化? + * **指标:**代码随时间的变化百分比。 + * **指标:**拉取请求、代码审查和合并之间的时间。 +* 我的项目的[多样化 & 包容性][4]如何? + * 我们是否拥有有效的公开行为准则(CoC)? + * **度量标准:** 检查存储库中的 CoC 文件。 + * 与我的项目相关的活动是否积极包容? + * **指标:**关于活动的票务政策和活动包容性行为的手动报告。 + * 我们的项目在可访问性上做的好不好? + * **指标:**验证发布的文字会议纪要。 + * **指标:**验证会议期间使用的隐藏式字幕。 + * **指标:**验证在演示文稿和项目前端设计中色盲可访问的素材。 +* 我的项目代表了多少[价值][7]? + * 我如何帮助组织了解使用我们的项目将节省多少时间和金钱(劳动力投资) + * **指标:**仓库的议题、提交、拉取请求的数量和估计人工费率。 + * 我如何理解项目创建的下游价值的数量,以及维护我的项目对更广泛的社区的重要性(或不重要)? + * **指标:**依赖我的项目的其他项目数。 + * 为我的项目做出贡献的人有多少机会使用他们学到的东西来找到合适的工作岗位,以及在哪些组织(即生活工资)? + * **指标:**使用或贡献此库的组织数量。 + * **指标:**使用此类项目的开发人员的平均工资。 + * **指标:**与该项目匹配的关键字的职位发布计数。 + +### 项目维护者 + +作为**项目维护者**,我**最**关心: + +* 我是**高效的**维护者吗? + * **指标:**拉取请求在代码审查之前等待的时间。 + * **指标:**代码审查和后续拉取请求之间的时间。 + * **指标:**我的代码审核中有多少被批准? + * **指标:**我的代码评论中有多少被拒绝或返工? + * **指标:**代码审查的评论的情感分析。 +* 我如何让**更多人**帮助我维护这件事? + * **指标:**项目贡献者的社交覆盖面数量。 +* 我们的**代码质量**随着时间的推移变得越来越好吗? + * **指标:**计算随着时间的推移引入的回归数量。 + * **指标:**计算随着时间推移引入的错误数量。 + * **指标:**错误归档、拉取请求、代码审查、合并和发布之间的时间。 + +### 项目开发者和贡献者 + +作为**项目开发者或贡献者**,我**最**关心: + +* 我可以从为这个项目做出贡献中获得哪些有价值的东西,以及实现这个价值需要多长时间? + * **指标:**下游价值。 + * **指标:**提交、代码审查和合并之间的时间。 +* 通过使用我在贡献中学到的东西来增加工作机是否有良好的前景? + * **指标:**生活工资。 +* 这个项目有多受欢迎? + * **指标:**社交媒体帖子、分享和收藏的数量。 +* 社区有影响力的人知道我的项目吗? + * **指标:**创始人、维护者和贡献者的社交范围。 + +通过创建这个列表,我们开始让 CHAOSS 更加丰满了,并且在今年夏天项目中首次发布该指标时,我迫不及待地想看看广泛的开源社区可能有什么其他伟大的想法,以及我们还可以从这些贡献中学到什么(并衡量!)。 + +### 其它角色 + +接下来,你需要了解有关其他角色(例如基金会、企业开源计划办公室、业务风险和法律团队、人力资源等)以及最终用户的目标问题度量集的更多信息。他们关心开源的不同事物。 + +如果你是开源贡献者或组成分子,我们邀请你[来看看这个项目][8]并参与社区活动! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/measure-project + +作者:[Jon Lawrence][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/the3rdlaw +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://www.linuxfoundation.org/ +[3]: https://chaoss.community/ +[4]: https://github.com/chaoss/wg-diversity-inclusion +[5]: https://github.com/chaoss/wg-evolution +[6]: https://github.com/chaoss/wg-risk +[7]: https://github.com/chaoss/wg-value +[8]: https://github.com/chaoss/ diff --git a/published/201908/20190812 How Hexdump works.md b/published/201908/20190812 How Hexdump works.md new file mode 100644 index 0000000000..81c499affb --- /dev/null +++ b/published/201908/20190812 How Hexdump works.md @@ -0,0 +1,228 @@ +[#]: collector: (lujun9972) +[#]: translator: (0x996) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11288-1.html) +[#]: subject: (How Hexdump works) +[#]: via: (https://opensource.com/article/19/8/dig-binary-files-hexdump) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Hexdump 如何工作 +====== + +> Hexdump 能帮助你查看二进制文件的内容。让我们来学习 Hexdump 如何工作。 + +![](https://img.linux.net.cn/data/attachment/album/201908/31/111531h9kzcqooluooqoo7.jpg) + +Hexdump 是个用十六进制、十进制、八进制数或 ASCII 码显示二进制文件内容的工具。它是个用于检查的工具,也可用于[数据恢复][2]、逆向工程和编程。 + +### 学习基本用法 + +Hexdump 让你毫不费力地得到输出结果,依你所查看文件的尺寸,输出结果可能会非常多。本文中我们会创建一个 1x1 像素的 PNG 文件。你可以用图像处理应用如 [GIMP][3] 或 [Mtpaint][4] 来创建该文件,或者也可以在终端内用 [ImageMagick][5] 创建。 + +用 ImagiMagick 生成 1x1 像素 PNG 文件的命令如下: + +``` +$ convert -size 1x1 canvas:black pixel.png +``` + +你可以用 `file` 命令确认此文件是 PNG 格式: + +``` +$ file pixel.png +pixel.png: PNG image data, 1 x 1, 1-bit grayscale, non-interlaced +``` + +你可能好奇 `file` 命令是如何判断文件是什么类型。巧的是,那正是 `hexdump` 将要揭示的原理。眼下你可以用你常用的图像查看软件来看看你的单一像素图片(它看上去就像这样:`.`),或者你可以用 `hexdump` 查看文件内部: + +``` +$ hexdump pixel.png +0000000 5089 474e 0a0d 0a1a 0000 0d00 4849 5244 +0000010 0000 0100 0000 0100 0001 0000 3700 f96e +0000020 0024 0000 6704 4d41 0041 b100 0b8f 61fc +0000030 0005 0000 6320 5248 004d 7a00 0026 8000 +0000040 0084 fa00 0000 8000 00e8 7500 0030 ea00 +0000050 0060 3a00 0098 1700 9c70 51ba 003c 0000 +0000060 6202 474b 0044 dd01 138a 00a4 0000 7407 +0000070 4d49 0745 07e3 081a 3539 a487 46b0 0000 +0000080 0a00 4449 5441 d708 6063 0000 0200 0100 +0000090 21e2 33bc 0000 2500 4574 7458 6164 6574 +00000a0 633a 6572 7461 0065 3032 3931 302d 2d37 +00000b0 3532 3254 3a30 3735 353a 2b33 3231 303a +00000c0 ac30 5dcd 00c1 0000 7425 5845 6474 7461 +00000d0 3a65 6f6d 6964 7966 3200 3130 2d39 3730 +00000e0 322d 5435 3032 353a 3a37 3335 312b 3a32 +00000f0 3030 90dd 7de5 0000 0000 4549 444e 42ae +0000100 8260 +0000102 +``` + +透过一个你以前可能从未用过的视角,你所见的是该示例 PNG 文件的内容。它和你在图像查看软件中看到的是完全一样的数据,只是用一种你或许不熟悉的方式编码。 + +### 提取熟悉的字符串 + +尽管默认的数据输出结果看上去毫无意义,那并不意味着其中没有有价值的信息。你可以用 `--canonical` 选项将输出结果,或至少是其中可翻译的部分,翻译成更加熟悉的字符集: + +``` +$ hexdump --canonical foo.png +00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR| +00000010 00 00 00 01 00 00 00 01 01 00 00 00 00 37 6e f9 |.............7n.| +00000020 24 00 00 00 04 67 41 4d 41 00 00 b1 8f 0b fc 61 |$....gAMA......a| +00000030 05 00 00 00 20 63 48 52 4d 00 00 7a 26 00 00 80 |.... cHRM..z&...| +00000040 84 00 00 fa 00 00 00 80 e8 00 00 75 30 00 00 ea |...........u0...| +00000050 60 00 00 3a 98 00 00 17 70 9c ba 51 3c 00 00 00 |`..:....p..Q<...| +00000060 02 62 4b 47 44 00 01 dd 8a 13 a4 00 00 00 07 74 |.bKGD..........t| +00000070 49 4d 45 07 e3 07 1a 08 39 35 87 a4 b0 46 00 00 |IME.....95...F..| +00000080 00 0a 49 44 41 54 08 d7 63 60 00 00 00 02 00 01 |..IDAT..c`......| +00000090 e2 21 bc 33 00 00 00 25 74 45 58 74 64 61 74 65 |.!.3...%tEXtdate| +000000a0 3a 63 72 65 61 74 65 00 32 30 31 39 2d 30 37 2d |:create.2019-07-| +000000b0 32 35 54 32 30 3a 35 37 3a 35 33 2b 31 32 3a 30 |25T20:57:53+12:0| +000000c0 30 ac cd 5d c1 00 00 00 25 74 45 58 74 64 61 74 |0..]....%tEXtdat| +000000d0 65 3a 6d 6f 64 69 66 79 00 32 30 31 39 2d 30 37 |e:modify.2019-07| +000000e0 2d 32 35 54 32 30 3a 35 37 3a 35 33 2b 31 32 3a |-25T20:57:53+12:| +000000f0 30 30 dd 90 e5 7d 00 00 00 00 49 45 4e 44 ae 42 |00...}....IEND.B| +00000100 60 82 |`.| +00000102 +``` + +在右侧的列中,你看到的是和左侧一样的数据,但是以 ASCII 码展现的。如果你仔细看,你可以从中挑选出一些有用的信息,如文件格式(PNG)以及文件创建、修改日期和时间(向文件底部寻找一下)。 + +`file` 命令通过头 8 个字节获取文件类型。程序员会参考 [libpng 规范][6] 来知晓需要查看什么。具体而言,那就是你能在该图像文件的头 8 个字节中看到的字符串 `PNG`。这个事实显而易见,因为它揭示了 `file` 命令是如何知道要报告的文件类型。 + +你也可以控制 `hexdump` 显示多少字节,这在处理大于一个像素的文件时很实用: + +``` +$ hexdump --length 8 pixel.png +0000000 5089 474e 0a0d 0a1a +0000008 +``` + +`hexdump` 不只限于查看 PNG 或图像文件。你也可以用 `hexdump` 查看你日常使用的二进制文件,如 [ls][7]、[rsync][8],或你想检查的任何二进制文件。 + +### 用 hexdump 实现 cat 命令 + +阅读 PNG 规范的时候你可能会注意到头 8 个字节中的数据与 `hexdump` 提供的结果看上去不一样。实际上,那是一样的数据,但以一种不同的转换方式展现出来。所以 `hexdump` 的输出是正确的,但取决于你在寻找的信息,其输出结果对你而言不总是直接了当的。出于这个原因,`hexdump` 有一些选项可供用于定义格式和转化其转储的原始数据。 + +转换选项可以很复杂,所以用无关紧要的东西练习会比较实用。下面这个简易的介绍,通过重新实现 [cat][9] 命令来演示如何格式化 `hexdump` 的输出。首先,对一个文本文件运行 `hexdump` 来查看其原始数据。通常你可以在硬盘上某处找到 [GNU 通用许可证][10]GNU General Public License(GPL)的一份拷贝,也可以用你手头的任何文本文件。你的输出结果可能不同,但下面是如何在你的系统中找到一份 GPL(或至少其部分)的拷贝: + +``` +$ find /usr/share/doc/ -type f -name "COPYING" | tail -1 +/usr/share/doc/libblkid-devel/COPYING +``` + +对其运行 `hexdump`: + +``` +$ hexdump /usr/share/doc/libblkid-devel/COPYING +0000000 6854 7369 6c20 6269 6172 7972 6920 2073 +0000010 7266 6565 7320 666f 7774 7261 3b65 7920 +0000020 756f 6320 6e61 7220 6465 7369 7274 6269 +0000030 7475 2065 7469 6120 646e 6f2f 0a72 6f6d +0000040 6964 7966 6920 2074 6e75 6564 2072 6874 +0000050 2065 6574 6d72 2073 666f 7420 6568 4720 +0000060 554e 4c20 7365 6573 2072 6547 656e 6172 +0000070 206c 7550 6c62 6369 4c0a 6369 6e65 6573 +0000080 6120 2073 7570 6c62 7369 6568 2064 7962 +[...] +``` + +如果该文件输出结果很长,用 `--length`(或短选项 `-n`)来控制输出长度使其易于管理。 + +原始数据对你而言可能没什么意义,但你已经知道如何将其转换为 ASCII 码: + +``` +hexdump --canonical /usr/share/doc/libblkid-devel/COPYING +00000000  54 68 69 73 20 6c 69 62  72 61 72 79 20 69 73 20  |This library is | +00000010  66 72 65 65 20 73 6f 66  74 77 61 72 65 3b 20 79  |free software; y| +00000020  6f 75 20 63 61 6e 20 72  65 64 69 73 74 72 69 62  |ou can redistrib| +00000030  75 74 65 20 69 74 20 61  6e 64 2f 6f 72 0a 6d 6f  |ute it and/or.mo| +00000040  64 69 66 79 20 69 74 20  75 6e 64 65 72 20 74 68  |dify it under th| +00000050  65 20 74 65 72 6d 73 20  6f 66 20 74 68 65 20 47  |e terms of the G| +00000060  4e 55 20 4c 65 73 73 65  72 20 47 65 6e 65 72 61  |NU Lesser Genera| +00000070  6c 20 50 75 62 6c 69 63  0a 4c 69 63 65 6e 73 65  |l Public.License| +[...] +``` + +这个输出结果有帮助但太累赘且难于阅读。要将 `hexdump` 的输出结果转换为其选项不支持的其他格式,可组合使用 `--format`(或 `-e`)和专门的格式代码。用来自定义格式的代码和 `printf` 命令使用的类似,所以如果你熟悉 `printf` 语句,你可能会觉得 `hexdump` 自定义格式不难学会。 + +在 `hexdump` 中,字符串 `%_p` 告诉 `hexdump` 用你系统的默认字符集输出字符。`--format` 选项的所有格式符号必须以*单引号*包括起来: + +``` +$ hexdump -e'"%_p"' /usr/share/doc/libblkid-devel/COPYING +This library is fre* + software; you can redistribute it and/or.modify it under the terms of the GNU Les* +er General Public.License as published by the Fre* + Software Foundation; either.version 2.1 of the License, or (at your option) any later.version..* +The complete text of the license is available in the..* +/Documentation/licenses/COPYING.LGPL-2.1-or-later file.. +``` + +这次的输出好些了,但依然不方便阅读。传统上 UNIX 文本文件假定 80 个字符的输出宽度(因为很久以前显示器一行只能显示 80 个字符)。 + +尽管这个输出结果未被自定义格式限制输出宽度,你可以用附加选项强制 `hexdump` 一次处理 80 字节。具体而言,通过 80 除以 1 这种形式,你可以告诉 `hexdump` 将 80 字节作为一个单元对待: + +``` +$ hexdump -e'80/1 "%_p"' /usr/share/doc/libblkid-devel/COPYING +This library is free software; you can redistribute it and/or.modify it under the terms of the GNU Lesser General Public.License as published by the Free Software Foundation; either.version 2.1 of the License, or (at your option) any later.version...The complete text of the license is available in the.../Documentation/licenses/COPYING.LGPL-2.1-or-later file.. +``` + +现在该文件被分割成 80 字节的块处理,但没有任何换行。你可以用 `\n` 字符自行添加换行,在 UNIX 中它代表换行: + +``` +$ hexdump -e'80/1 "%_p""\n"' +This library is free software; you can redistribute it and/or.modify it under th +e terms of the GNU Lesser General Public.License as published by the Free Softwa +re Foundation; either.version 2.1 of the License, or (at your option) any later. +version...The complete text of the license is available in the.../Documentation/ +licenses/COPYING.LGPL-2.1-or-later file.. +``` + +现在你已经(大致上)用 `hexdump` 自定义格式实现了 `cat` 命令。 + +### 控制输出结果 + +实际上自定义格式是让 `hexdump` 变得有用的方法。现在你已经(至少是原则上)熟悉 `hexdump` 自定义格式,你可以让 `hexdump -n 8` 的输出结果跟 `libpng` 官方规范中描述的 PNG 文件头相匹配了。 + +首先,你知道你希望 `hexdump` 以 8 字节的块来处理 PNG 文件。此外,你可能通过识别这些整数从而知道 PNG 格式规范是以十进制数表述的,根据 `hexdump` 文档,十进制用 `%d` 来表示: + +``` +$ hexdump -n8 -e'8/1 "%d""\n"' pixel.png +13780787113102610 +``` + +你可以在每个整数后面加个空格使输出结果变得完美: + +``` +$ hexdump -n8 -e'8/1 "%d ""\n"' pixel.png +137 80 78 71 13 10 26 10 +``` + +现在输出结果跟 PNG 规范完美匹配了。 + +### 好玩又有用 + +Hexdump 是个迷人的工具,不仅让你更多地领会计算机如何处理和转换信息,而且让你了解文件格式和编译的二进制文件如何工作。日常工作时你可以随机地试着对不同文件运行 `hexdump`。你永远不知道你会发现什么样的信息,或是什么时候具有这种洞察力会很实用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/dig-binary-files-hexdump + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[0x996](https://github.com/0x996) +校对:[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/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://www.redhat.com/sysadmin/find-lost-files-scalpel +[3]: http://gimp.org +[4]: https://opensource.com/article/17/2/mtpaint-pixel-art-animated-gifs +[5]: https://opensource.com/article/17/8/imagemagick +[6]: http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html +[7]: https://opensource.com/article/19/7/master-ls-command +[8]: https://opensource.com/article/19/5/advanced-rsync +[9]: https://opensource.com/article/19/2/getting-started-cat-command +[10]: https://en.wikipedia.org/wiki/GNU_General_Public_License diff --git a/published/201908/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md b/published/201908/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md new file mode 100644 index 0000000000..ac09fa3ab2 --- /dev/null +++ b/published/201908/20190812 How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11236-1.html) +[#]: subject: (How to Get Linux Kernel 5.0 in Ubuntu 18.04 LTS) +[#]: via: (https://itsfoss.com/ubuntu-hwe-kernel/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 18.04 LTS 中获取 Linux 5.0 内核 +====== + +> 最近发布的 Ubuntu 18.04.3 包括 Linux 5.0 内核中的几个新功能和改进,但默认情况下没有安装。本教程演示了如何在 Ubuntu 18.04 LTS 中获取 Linux 5 内核。 + +![](https://img.linux.net.cn/data/attachment/album/201908/17/101052xday1jyrszbddsfc.jpg) + +[Ubuntu 18.04 的第三个“点发布版”已经发布][2],它带来了新的稳定版本的 GNOME 组件、livepatch 桌面集成和内核 5.0。 + +可是等等!什么是“小数点版本point release”?让我先解释一下。 + +### Ubuntu LTS 小数点版本 + +Ubuntu 18.04 于 2018 年 4 月发布,由于它是一个长期支持 (LTS) 版本,它将一直支持到 2023 年。从那时起,已经有许多 bug 修复、安全更新和软件升级。如果你今天下载 Ubuntu 18.04,你需要在[在安装 Ubuntu 后首先安装这些更新][3]。 + +当然,这不是一种理想情况。这就是 Ubuntu 提供这些“小数点版本”的原因。点发布版包含所有功能和安全更新以及自 LTS 版本首次发布以来添加的 bug 修复。如果你今天下载 Ubuntu,你会得到 Ubuntu 18.04.3 而不是 Ubuntu 18.04。这节省了在新安装的 Ubuntu 系统上下载和安装数百个更新的麻烦。 + +好了!现在你知道“小数点版本”的概念了。你如何升级到这些小数点版本?答案很简单。只需要像平时一样[更新你的 Ubuntu 系统][4],这样你将在最新的小数点版本上了。 + +你可以[查看 Ubuntu 版本][5]来了解正在使用的版本。我检查了一下,因为我用的是 Ubuntu 18.04.3,我以为我的内核会是 5。当我[查看 Linux 内核版本][6]时,它仍然是基本内核 4.15。 + +![Ubuntu Version And Linux Kernel Version Check][7] + +这是为什么?如果 Ubuntu 18.04.3 有 Linux 5.0 内核,为什么它仍然使用 Linux 4.15 内核?这是因为你必须通过选择 LTS 支持栈Enablement Stack(通常称为 HWE)手动请求在 Ubuntu LTS 中安装新内核。 + +### 使用 HWE 在Ubuntu 18.04 中获取 Linux 5.0 内核 + +默认情况下,Ubuntu LTS 将保持在最初发布的 Linux 内核上。[硬件支持栈][9]hardware enablement stack(HWE)为现有的 Ubuntu LTS 版本提供了更新的内核和 xorg 支持。 + +最近发生了一些变化。如果你下载了 Ubuntu 18.04.2 或更新的桌面版本,那么就会为你启用 HWE,默认情况下你将获得新内核以及常规更新。 + +对于服务器版本以及下载了 18.04 和 18.04.1 的人员,你需要安装 HWE 内核。完成后,你将获得 Ubuntu 提供的更新的 LTS 版本内核。 + +要在 Ubuntu 桌面上安装 HWE 内核以及更新的 xorg,你可以在终端中使用此命令: + +``` +sudo apt install --install-recommends linux-generic-hwe-18.04 xserver-xorg-hwe-18.04 +``` + +如果你使用的是 Ubuntu 服务器版,那么就不会有 xorg 选项。所以只需在 Ubutnu 服务器版中安装 HWE 内核: + +``` +sudo apt-get install --install-recommends linux-generic-hwe-18.04 +``` + +完成 HWE 内核的安装后,重启系统。现在你应该拥有更新的 Linux 内核了。 + +### 你在 Ubuntu 18.04 中获取 5.0 内核了么? + +请注意,下载并安装了 Ubuntu 18.04.2 的用户已经启用了 HWE。所以这些用户将能轻松获取 5.0 内核。 + +在 Ubuntu 中启用 HWE 内核遇到困难了么?这完全取决于你。[Linux 5.0 内核][10]有几项性能改进和更好的硬件支持。你将从新内核获益。 + +你怎么看?你会安装 5.0 内核还是宁愿留在 4.15 内核上? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-hwe-kernel/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/channel/UCEU9D6KIShdLeTRyH3IdSvw +[2]: https://ubuntu.com/blog/enhanced-livepatch-desktop-integration-available-with-ubuntu-18-04-3-lts +[3]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ +[4]: https://itsfoss.com/update-ubuntu/ +[5]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[6]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/ubuntu-version-and-kernel-version-check.png?resize=800%2C300&ssl=1 +[9]: https://wiki.ubuntu.com/Kernel/LTSEnablementStack +[10]: https://itsfoss.com/linux-kernel-5/ diff --git a/published/201908/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md b/published/201908/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md new file mode 100644 index 0000000000..62cd5beb4d --- /dev/null +++ b/published/201908/20190814 How to Reinstall Ubuntu in Dual Boot or Single Boot Mode.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11262-1.html) +[#]: subject: (How to Reinstall Ubuntu in Dual Boot or Single Boot Mode) +[#]: via: (https://itsfoss.com/reinstall-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在双启动或单启动模式下重新安装 Ubuntu +====== + +如果你弄坏了你的 Ubuntu 系统,并尝试了很多方法来修复,你最终放弃并采取简单的方法:重新安装 Ubuntu。 + +我们一直遇到这样一种情况,重新安装 Linux 似乎比找出问题并解决来得更好。排查 Linux 故障能教你很多,但你不会总是花费更多时间来修复损坏的系统。 + +据我所知,Ubuntu 中没有像 Windows 那样的系统恢复分区。那么,问题出现了:如何重新安装 Ubuntu?让我告诉你如何重新安装 Ubuntu。 + +**警告!** + +> **磁盘分区始终是一项危险的任务。我强烈建议你在外部磁盘上备份数据。** + +### 如何重新安装 Ubuntu Linux + +![][1] + +以下是重新安装 Ubuntu 的步骤。 + +#### 步骤 1:创建一个 live USB + +首先,在网站上下载 Ubuntu。你可以下载[任何需要的 Ubuntu 版本][2]。 + +- [下载 Ubuntu][3] + +获得 ISO 镜像后,就可以创建 live USB 了。如果 Ubuntu 系统仍然可以使用,那么可以使用 Ubuntu 提供的启动盘创建工具创建它。 + +如果无法使用你的 Ubuntu,那么你可以使用其他系统。你可以参考这篇文章来学习[如何在 Windows 中创建 Ubuntu 的 live USB][4]。 + +#### 步骤 2:重新安装 Ubuntu + +有了 Ubuntu 的 live USB 之后将其插入 USB 端口。重新启动系统。在启动时,按下 `F2`/`F10`/`F12` 之类的键进入 BIOS 设置,并确保已设置 “Boot from Removable Devices/USB”。保存并退出 BIOS。这将启动进入 live USB。 + +进入 live USB 后,选择安装 Ubuntu。你将看到选择语言和键盘布局这些常用选项。你还可以选择下载更新等。 + +![Go ahead with regular installation option][5] + +现在是重要的步骤。你应该看到一个“安装类型Installation Type”页面。你在屏幕上看到的内容在很大程度上取决于 Ubuntu 如何处理系统上的磁盘分区和安装的操作系统。 + +在此步骤中仔细阅读选项及它的细节。注意每个选项的说明。屏幕上的选项可能在不同的系统中看上去不同。 + +![Reinstall Ubuntu option in dual boot mode][7] + +在这里,它发现我的系统上安装了 Ubuntu 18.04.2 和 Windows,它给了我一些选项。 + +第一个选项是擦除 Ubuntu 18.04.2 并重新安装它。它告诉我它将删除我的个人数据,但它没有说删除所有操作系统(即 Windows)。 + +如果你非常幸运或处于单一启动模式,你可能会看到一个“重新安装 UbuntuReinstall Ubuntu”的选项。此选项将保留现有数据,甚至尝试保留已安装的软件。如果你看到这个选项,那么就用它吧。 + +**双启动系统注意** + +> **如果你是双启动 Ubuntu 和 Windows,并且在重新安装中,你的 Ubuntu 系统看不到 Windows,你必须选择 “Something else” 选项并从那里安装 Ubuntu。我已经在[在双启动下安装 Linux 的过程][8]这篇文章中说明了。** + +对我来说,没有重新安装并保留数据的选项,因此我选择了“擦除 Ubuntu 并重新安装Erase Ubuntu and reinstall”。该选项即使在 Windows 的双启动模式下,也将重新安装 Ubuntu。 + +我建议为 `/` 和 `/home` 使用单独分区就是为了重新安装。这样,即使重新安装 Linux,也可以保证 `/home` 分区中的数据安全。我已在此视频中演示过: + +选择重新安装 Ubuntu 后,剩下就是单击下一步。选择你的位置、创建用户账户。 + +![Just go on with the installation options][9] + +以上完成后,你就完成重装 Ubuntu 了。 + +在本教程中,我假设你已经知道我说的东西,因为你之前已经安装过 Ubuntu。如果需要澄清任何一个步骤,请随时在评论栏询问。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/reinstall-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/Reinstall-Ubuntu.png?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/which-ubuntu-install/ +[3]: https://ubuntu.com/download/desktop +[4]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/reinstall-ubuntu-1.jpg?resize=800%2C473&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/reinstall-ubuntu-dual-boot.jpg?ssl=1 +[8]: https://itsfoss.com/replace-linux-from-dual-boot/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/reinstall-ubuntu-3.jpg?ssl=1 diff --git a/published/201908/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md b/published/201908/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md new file mode 100644 index 0000000000..3c5a6ef900 --- /dev/null +++ b/published/201908/20190815 Fix ‘E- The package cache file is corrupted, it has the wrong hash- Error In Ubuntu.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11254-1.html) +[#]: subject: (Fix ‘E: The package cache file is corrupted, it has the wrong hash’ Error In Ubuntu) +[#]: via: (https://www.ostechnix.com/fix-e-the-package-cache-file-is-corrupted-it-has-the-wrong-hash-error-in-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +修复 Ubuntu 中 “E: The package cache file is corrupted, it has the wrong hash” 错误 +====== + +今天,我尝试更新我的 Ubuntu 18.04 LTS 的仓库列表,但收到了一条错误消息:“**E: The package cache file is corrupted, it has the wrong hash**”。这是我在终端运行的命令以及输出: + +``` +$ sudo apt update +``` + +示例输出: + +``` +Hit:1 http://it-mirrors.evowise.com/ubuntu bionic InRelease +Hit:2 http://it-mirrors.evowise.com/ubuntu bionic-updates InRelease +Hit:3 http://it-mirrors.evowise.com/ubuntu bionic-backports InRelease +Hit:4 http://it-mirrors.evowise.com/ubuntu bionic-security InRelease +Hit:5 http://ppa.launchpad.net/alessandro-strada/ppa/ubuntu bionic InRelease +Hit:7 http://ppa.launchpad.net/leaeasy/dde/ubuntu bionic InRelease +Hit:8 http://ppa.launchpad.net/rvm/smplayer/ubuntu bionic InRelease +Ign:6 https://dl.bintray.com/etcher/debian stable InRelease +Get:9 https://dl.bintray.com/etcher/debian stable Release [3,674 B] +Fetched 3,674 B in 3s (1,196 B/s) +Reading package lists... Done +E: The package cache file is corrupted, it has the wrong hash +``` + +![][2] + +*Ubuntu 中的 “The package cache file is corrupted, it has the wrong hash” 错误* + +经过一番谷歌搜索,我找到了解决此错误的方法。 + +如果你遇到过这个错误,不要惊慌。只需运行下面的命令修复。 + +在运行命令之前,**请再次确认你在最后加入了 `*`**。在命令最后加上 `*` 很重要。如果你没有添加,它会删除 `/var/lib/apt/lists/`*目录,而且无法恢复。我提醒过你了! + +``` +$ sudo rm -rf /var/lib/apt/lists/* +``` + +现在我再次使用下面的命令更新系统: + +``` +$ sudo apt update +``` + +![][3] + +现在好了!希望它有帮助。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/fix-e-the-package-cache-file-is-corrupted-it-has-the-wrong-hash-error-in-ubuntu/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[2]: https://www.ostechnix.com/wp-content/uploads/2019/08/The-package-cache-file-is-corrupted.png +[3]: https://www.ostechnix.com/wp-content/uploads/2019/08/apt-update-command-output-in-Ubuntu.png diff --git a/published/201908/20190815 How To Change Linux Console Font Type And Size.md b/published/201908/20190815 How To Change Linux Console Font Type And Size.md new file mode 100644 index 0000000000..0a92a2ebd8 --- /dev/null +++ b/published/201908/20190815 How To Change Linux Console Font Type And Size.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11258-1.html) +[#]: subject: (How To Change Linux Console Font Type And Size) +[#]: via: (https://www.ostechnix.com/how-to-change-linux-console-font-type-and-size/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +如何更改 Linux 控制台字体类型和大小 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/23/041741x6qiajjijupjyjsp.jpg) + +如果你有图形桌面环境,那么就很容易更改文本的字体以及大小。但你如何在没有图形环境的 Ubuntu 无头服务器中做到?别担心!本指南介绍了如何更改 Linux 控制台的字体和大小。这对于那些不喜欢默认字体类型/大小或者喜欢不同字体的人来说非常有用。 + +### 更改 Linux 控制台字体类型和大小 + +如果你还不知道,这就是无头 Ubuntu Linux 服务器控制台的样子。 + +![][2] + +*Ubuntu Linux 控制台* + +据我所知,我们可以[列出已安装的字体][3],但是没有办法可以像在 Linux 桌面终端仿真器中那样更改 Linux 控制台字体类型或大小。 + +但这并不意味着我们无法改变它。我们仍然可以更改控制台字体。 + +如果你正在使用 Debian、Ubuntu 和其他基于 DEB 的系统,你可以使用 `console-setup` 配置文件来设置 `setupcon`,它用于配置控制台的字体和键盘布局。该控制台设置的配置文件位于 `/etc/default/console-setup`。 + +现在,运行以下命令来设置 Linux 控制台的字体。 + +``` +$ sudo dpkg-reconfigure console-setup +``` + +选择要在 Linux 控制台上使用的编码。只需保留默认值,选择 “OK” 并按回车继续。 + +![][4] + +*选择要在 Ubuntu 控制台上设置的编码* + +接下来,在列表中选择受支持的字符集。默认情况下,它是最后一个选项,即在我的系统中 **Guess optimal character set**(猜测最佳字符集)。只需保留默认值,然后按回车键。 + +![][5] + +*在 Ubuntu 中选择字符集* + +接下来选择控制台的字体,然后按回车键。我这里选择 “TerminusBold”。 + +![][6] + +*选择 Linux 控制台的字体* + +这里,我们为 Linux 控制台选择所需的字体大小。 + +![][7] + +*选择 Linux 控制台的字体大小* + +几秒钟后,所选的字体及大小将应用于你的 Linux 控制台。 + +这是在更改字体类型和大小之前,我的 Ubuntu 18.04 LTS 服务器中控制台字体的样子。 + +![][8] + +这是更改之后。 + +![][9] + +如你所见,文本更大、更好,字体类型也不同于默认。 + +你也可以直接编辑 `/etc/default/console-setup`,并根据需要设置字体类型和大小。根据以下示例,我的 Linux 控制台字体类型为 “Terminus Bold”,字体大小为 32。 + +``` +ACTIVE_CONSOLES="/dev/tty[1-6]" +CHARMAP="UTF-8" +CODESET="guess" +FONTFACE="TerminusBold" +FONTSIZE="16x32" +``` + +### 附录:显示控制台字体 + +要显示你的控制台字体,只需输入: + +``` +$ showconsolefont +``` + +此命令将显示字体的字形或字母表。 + +![][11] + +*显示控制台字体* + +如果你的 Linux 发行版没有 `console-setup`,你可以从[这里][12]获取它。 + +在使用 Systemd 的 Linux 发行版上,你可以通过编辑 `/etc/vconsole.conf` 来更改控制台字体。 + +以下是德语键盘的示例配置。 + +``` +$ vi /etc/vconsole.conf + +KEYMAP=de-latin1 +FONT=Lat2-Terminus16 +``` + +希望这篇文章对你有用! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-change-linux-console-font-type-and-size/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[2]: https://www.ostechnix.com/wp-content/uploads/2019/08/Ubuntu-Linux-console.png +[3]: https://www.ostechnix.com/find-installed-fonts-commandline-linux/ +[4]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-encoding-to-set-on-the-console.png +[5]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-character-set-in-Ubuntu.png +[6]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-font-for-Linux-console.png +[7]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-font-size-for-Linux-console.png +[8]: https://www.ostechnix.com/wp-content/uploads/2019/08/Linux-console-tty-ubuntu-1.png +[9]: https://www.ostechnix.com/wp-content/uploads/2019/08/Ubuntu-Linux-TTY-console.png +[10]: https://www.ostechnix.com/how-to-switch-between-ttys-without-using-function-keys-in-linux/ +[11]: https://www.ostechnix.com/wp-content/uploads/2019/08/show-console-fonts.png +[12]: https://software.opensuse.org/package/console-setup diff --git a/published/201908/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md b/published/201908/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md new file mode 100644 index 0000000000..0abdba8e6d --- /dev/null +++ b/published/201908/20190815 How To Fix -Kernel driver not installed (rc--1908)- VirtualBox Error In Ubuntu.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11283-1.html) +[#]: subject: (How To Fix “Kernel driver not installed (rc=-1908)” VirtualBox Error In Ubuntu) +[#]: via: (https://www.ostechnix.com/how-to-fix-kernel-driver-not-installed-rc-1908-virtualbox-error-in-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 中修复 VirtualBox 的 “Kernel driver not installed (rc=-1908)” 错误 +====== + +我使用 Oracle VirtualBox 来测试各种 Linux 和 Unix 发行版。到目前为止,我已经在 VirtualBox 中测试了上百个虚拟机。今天,我在我的 Ubuntu 18.04 桌面上启动了 Ubuntu 18.04 服务器版虚拟机,我收到了以下错误。 + +``` +Kernel driver not installed (rc=-1908) + +The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall virtualbox-dkms package and load the kernel module by executing + +'modprobe vboxdrv' + +as root. + +where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT. +``` + +![][2] + +*Ubuntu 中的 “Kernel driver not installed (rc=-1908)” 错误* + +我点击了 OK 关闭消息框,然后在后台看到了另一条消息。 + +``` +Failed to open a session for the virtual machine Ubuntu 18.04 LTS Server. + +The virtual machine 'Ubuntu 18.04 LTS Server' has terminated unexpectedly during startup with exit code 1 (0x1). + +Result Code: +NS_ERROR_FAILURE (0x80004005) +Component: +MachineWrap +Interface: +IMachine {85cd948e-a71f-4289-281e-0ca7ad48cd89} +``` + +![][3] + +*启动期间虚拟机意外终止,退出代码为 1(0x1)* + +我不知道该先做什么。我运行以下命令来检查是否有用。 + +``` +$ sudo modprobe vboxdrv +``` + +我收到了这个错误: + +``` +modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/5.0.0-23-generic +``` + +仔细阅读这两个错误消息后,我意识到我应该更新 Virtualbox 程序。 + +如果你在 Ubuntu 及其衍生版(如 Linux Mint)中遇到此错误,你只需使用以下命令重新安装或更新 `virtualbox-dkms` 包: + +``` +$ sudo apt install virtualbox-dkms +``` + +或者,最好更新整个系统: + +``` +$ sudo apt upgrade +``` + +错误消失了,我可以正常在 VirtualBox 中启动虚拟机了。 + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-fix-kernel-driver-not-installed-rc-1908-virtualbox-error-in-ubuntu/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[2]: https://www.ostechnix.com/wp-content/uploads/2019/08/Kernel-driver-not-installed-virtualbox-ubuntu.png +[3]: https://www.ostechnix.com/wp-content/uploads/2019/08/The-virtual-machine-has-terminated-unexpectedly-during-startup-with-exit-code-1-0x1.png +[4]: https://www.ostechnix.com/solve-result-code-ns_error_failure-0x80004005-virtualbox-error-arch-linux/ diff --git a/published/201908/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md b/published/201908/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md new file mode 100644 index 0000000000..486767a090 --- /dev/null +++ b/published/201908/20190815 How To Set up Automatic Security Update (Unattended Upgrades) on Debian-Ubuntu.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (tomjlw) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11252-1.html) +[#]: subject: (How To Set up Automatic Security Update (Unattended Upgrades) on Debian/Ubuntu?) +[#]: via: (https://www.2daygeek.com/automatic-security-update-unattended-upgrades-ubuntu-debian/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Debian/Ubuntu 上设置自动安全更新(无人值守更新) +====== + +对于 Linux 管理员来说重要的任务之一是让系统保持最新状态,这可以使得你的系统更加稳健并且可以避免不想要的访问与攻击。 + +在 Linux 上安装软件包是小菜一碟,用相似的方法我们也可以更新安全补丁。 + +这是一个向你展示如何配置系统接收自动安全更新的简单教程。当你运行自动安全包更新而不经审查会给你带来一定风险,但是也有一些好处。 + +如果你不想错过安全补丁,且想要与最新的安全补丁保持同步,那你应该借助无人值守更新机制设置自动安全更新。 + +如果你不想要自动安全更新的话,你可以[在 Debian/Ubuntu 系统上手动安装安全更新][1]。 + +我们有许多可以自动化更新的办法,然而我们将先采用官方的方法之后我们会介绍其它方法。 + +### 如何在 Debian/Ubuntu 上安装无人值守更新包 + +无人值守更新包默认应该已经装在你的系统上。但万一它没被安装,就用下面的命令来安装。 + +使用 [APT-GET 命令][2]和 [APT 命令][3]来安装 `unattended-upgrades` 软件包。 + +``` +$ sudo apt-get install unattended-upgrades +``` + +下方两个文件可以使你自定义该机制: + +``` +/etc/apt/apt.conf.d/50unattended-upgrades +/etc/apt/apt.conf.d/20auto-upgrades +``` + +### 在 50unattended-upgrades 文件中做出必要修改 + +默认情况下只有安全更新需要的最必要的选项被启用。但并不限于此,你可以配置其中的许多选项以使得这个机制更加有用。 + +我修改了一下文件并仅加上被启用的行以方便阐述: + +``` +# vi /etc/apt/apt.conf.d/50unattended-upgrades + +Unattended-Upgrade::Allowed-Origins { + "${distro_id}:${distro_codename}"; + "${distro_id}:${distro_codename}-security"; + "${distro_id}ESM:${distro_codename}"; + }; +Unattended-Upgrade::DevRelease "false"; +``` + +有三个源被启用,细节如下: + + * `${distro_id}:${distro_codename}`:这是必须的,因为安全更新可能会从非安全来源拉取依赖。 + * `${distro_id}:${distro_codename}-security`:这用来从来源得到安全更新。 + * `${distro_id}ESM:${distro_codename}`:这是用来从 ESM(扩展安全维护)获得安全更新。 + +**启用邮件通知:** 如果你想要在每次安全更新后收到邮件通知,那么就修改以下行段(取消其注释并加上你的 email 账号)。 + +从: + +``` +//Unattended-Upgrade::Mail "root"; +``` + +修改为: + +``` +Unattended-Upgrade::Mail "2daygeek@gmail.com"; +``` + +**自动移除不用的依赖:** 你可能需要在每次更新后运行 `sudo apt autoremove` 命令来从系统中移除不用的依赖。 + +我们可以通过修改以下行来自动化这项任务(取消注释并将 `false` 改成 `true`)。 + +从: + +``` +//Unattended-Upgrade::Remove-Unused-Dependencies "false"; +``` + +修改为: + +``` +Unattended-Upgrade::Remove-Unused-Dependencies "true"; +``` + +**启用自动重启:** 你可能需要在安全更新安装至内核后重启你的系统。你可以在以下行做出修改: + +从: + +``` +//Unattended-Upgrade::Automatic-Reboot "false"; +``` + +到:取消注释并将 `false` 改成 `true`以启用自动重启。 + +``` +Unattended-Upgrade::Automatic-Reboot "true"; +``` + +**启用特定时段的自动重启:** 如果自动重启已启用,且你想要在特定时段进行重启,那么做出以下修改。 + +从: + +``` +//Unattended-Upgrade::Automatic-Reboot-Time "02:00"; +``` + +到:取消注释并将时间改成你需要的时间。我将重启设置在早上 5 点。 + +``` +Unattended-Upgrade::Automatic-Reboot-Time "05:00"; +``` + +### 如何启用自动化安全更新? + +现在我们已经配置好了必须的选项,一旦配置好,打开以下文件并确认是否这两个值都已设置好?值不应为0。(1=启用,0=禁止)。 + +``` +# vi /etc/apt/apt.conf.d/20auto-upgrades + +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "1"; +``` + +**详情:** + + * 第一行使 `apt` 每天自动运行 `apt-get update`。 + * 第一行使 `apt` 每天自动安装安全更新。 + + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/automatic-security-update-unattended-upgrades-ubuntu-debian/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[tomjlw](https://github.com/tomjlw) +校对:[wxy](https://github.com/wxy) + +本文由 [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/manually-install-security-updates-ubuntu-debian/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ diff --git a/published/201908/20190815 How To Setup Multilingual Input Method On Ubuntu.md b/published/201908/20190815 How To Setup Multilingual Input Method On Ubuntu.md new file mode 100644 index 0000000000..d2795355ee --- /dev/null +++ b/published/201908/20190815 How To Setup Multilingual Input Method On Ubuntu.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: (tomjlw) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11255-1.html) +[#]: subject: (How To Setup Multilingual Input Method On Ubuntu) +[#]: via: (https://www.ostechnix.com/how-to-setup-multilingual-input-method-on-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 上设置多语言输入法 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/21/231916g3gxbhybq0zv0q1h.jpg) + +或许你不知道,在印度有数以百计的语言被使用,其中 22 种被印度机构列为官方语言。我的母语不是英语,因此当我需要从英语输入或者翻译到我的母语泰米尔语时我经常使用**谷歌翻译**。嗯,我估计我不再需要依靠谷歌翻译了。我刚发现在 Ubuntu 上输入印度语的好办法。这篇教程解释了如何配置多语言输入法的方法。这个是为 Ubuntu 18.04 LTS 特别打造的,但是它可以在其它类 Ubuntu 系统例如 Linux mint、Elementary OS 上使用。 + +### 在 Ubuntu Linux 上设置多语言输入法 + +通过 **IBus** 的帮助,我们可以轻松在 Ubuntu 及其衍生物上配置多语言输入法。Ibus,代表 **I** ntelligent **I** nput **Bus**(智能输入总线),是一种针对类 Unix 操作系统下多语言输入的输入法框架。它使得我们可以在大多数 GUI 应用例如 LibreOffice 下输入母语。 + +### 在 Ubuntu 上安装 IBus + +在 Ubuntu 上 安装 IBus 包,运行: + +``` +$ sudo apt install ibus-m17n +``` + +Ibus-m17n 包提供了许多印度语和其它国家语言包括阿姆哈拉语,阿拉伯语,阿美尼亚语,阿萨姆语,阿萨巴斯卡语,白俄罗斯语,孟加拉语,缅甸语,中高棉语,占文,**汉语**,克里语,克罗地亚语,捷克语,丹麦语,迪维希语,马尔代夫语,世界语,法语,格鲁吉亚语,古/现代希腊语,古吉拉特语,希伯来语,因纽特语,日语,卡纳达语,克什米尔语,哈萨克语,韩语,老挝语,马来语,马拉地语,尼泊尔语,欧吉布威语,欧瑞亚语,旁遮普语,波斯语,普什图语,俄语,梵语,塞尔维亚语,四川彝文,彝文,西格西卡语,信德语,僧伽罗语,斯洛伐克语,瑞典语,泰语,泰米尔语,泰卢固语,藏语,维吾尔语,乌都语,乌兹别克语,越语及意第绪语。 + +##### 添加输入语言 + +我们可以在系统里的**设置**部分添加语言。点击你的 Ubuntu 桌面右上角的下拉箭头选择底部左下角的设置图标。 + +![][2] + +*从顶部面板启动系统设置* + +从设置部分,点击左侧面板的**区域及语言**选项。再点击右侧**输入来源**标签下的**+**(加号)按钮。 + +![][3] + +*设置部分的区域及语言选项* + +在下个窗口,点击**三个垂直的点**按钮。 + +![][4] + +*在 Ubuntu 里添加输入来源* + +搜寻并选择你想从列表中添加的输入语言。 + +![][5] + +*添加输入语言* + +在本篇教程中,我将加入**泰米尔**语。在选择语言后,点击**添加**按钮。 + +![][6] + +*添加输入来源* + +现在你会看到选中的输入来源已经被添加了。你会在输入来源标签下的区域及语言选项中看到它。 + +![][7] + +*Ubuntu 里的输入来源选项* + +点击输入来源标签下的“管理安装的语言”按钮 + +![][8] + +*在 Ubuntu 里管理安装的语言* + +接下来你会被询问是否想要为选定语言安装翻译包。如果你想的话你可以安装它们。或者仅仅选择“稍后提醒我”按钮。你下次打开的时候会收到统治。 + +![][9] + +*语言支持没完全安装好* + +一旦翻译包安装好,点击**安装/移除语言**按钮。同时确保 IBus 在键盘输入法系统中被选中。 + +![][10] + +*在 Ubuntu 中安装/移除语言* + +从列表中选择你想要的语言并点击采用按钮。 + +![][11] + +*选择输入语言* + +到此为止了。我们已成功在 Ubuntu 18.04 桌面上配置好多语输入方法。同样的,你可以添加尽可能多的输入语言。 + +在添加完所有语言来源后,登出再登陆回去。 + +### 用印度语或者你喜欢的语言输入 + +一旦你添加完所有语言后,你就会从你的 Ubuntu 桌面上的顶端菜单下载栏看到它们。 + +![][12] + +*从 Ubuntu 桌面的顶端栏选择输入语言。* + +你也可以使用键盘上的**徽标键+空格键**在不同语言中切换。 + +![][13] + +*在 Ubuntu 里用**徽标键+空格键**选择输入语言* + +打开任何 GUI 文本编辑器/应用开始打字吧! + +![][14] + +*在 Ubuntu 中用印度语输入* + +### 将 IBus 加入启动应用 + +我们需要让 IBus 在每次重启后自动打开,这样每次你想要用自己喜欢的语言输入的时候就无须手动打开。 + +为此仅须在面板中输入“开机应用”点开开机应用选项。 + +![][15] + +在下个窗口,点击添加,在名字栏输入“Ibus”并在命令栏输入“ibus-daemon”点击添加按钮。 + +![][16] + +*在 Ubuntu 中将 Ibus 添加进开机启动项* + +从现在起 IBus 将在系统启动后自动开始。 + +现在到你的回合了。在什么应用/工具中你用当地的印度语输入?在下方评论区让我们知道它们。 + +参考: + + * [IBus – Ubuntu 社区百科][20] + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-setup-multilingual-input-method-on-ubuntu/ + +作者:[sk][a] +选题:[lujun9972][b] +译者:[tomjlw](https://github.com/tomjlw) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[2]: https://www.ostechnix.com/wp-content/uploads/2019/07/Ubuntu-system-settings.png +[3]: https://www.ostechnix.com/wp-content/uploads/2019/08/Region-language-in-Settings-ubuntu.png +[4]: https://www.ostechnix.com/wp-content/uploads/2019/08/Add-input-source-in-Ubuntu.png +[5]: https://www.ostechnix.com/wp-content/uploads/2019/08/Add-input-language.png +[6]: https://www.ostechnix.com/wp-content/uploads/2019/08/Add-Input-Source-Ubuntu.png +[7]: https://www.ostechnix.com/wp-content/uploads/2019/08/Input-sources-Ubuntu.png +[8]: https://www.ostechnix.com/wp-content/uploads/2019/08/Manage-Installed-Languages.png +[9]: https://www.ostechnix.com/wp-content/uploads/2019/08/The-language-support-is-not-installed-completely.png +[10]: https://www.ostechnix.com/wp-content/uploads/2019/08/Install-Remove-languages.png +[11]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-language.png +[12]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-input-language-from-top-bar-in-Ubuntu.png +[13]: https://www.ostechnix.com/wp-content/uploads/2019/08/Choose-input-language-using-SuperSpace-keys.png +[14]: https://www.ostechnix.com/wp-content/uploads/2019/08/Setup-Multilingual-Input-Method-On-Ubuntu.png +[15]: https://www.ostechnix.com/wp-content/uploads/2019/08/Launch-startup-applications-in-ubuntu.png +[16]: https://www.ostechnix.com/wp-content/uploads/2019/08/Add-Ibus-to-startup-applications-on-Ubuntu.png +[17]: https://www.ostechnix.com/use-google-translate-commandline-linux/ +[18]: https://www.ostechnix.com/type-indian-rupee-sign-%e2%82%b9-linux/ +[19]: https://www.ostechnix.com/setup-japanese-language-environment-arch-linux/ +[20]: https://help.ubuntu.com/community/ibus diff --git a/published/201908/20190815 SSLH - Share A Same Port For HTTPS And SSH.md b/published/201908/20190815 SSLH - Share A Same Port For HTTPS And SSH.md new file mode 100644 index 0000000000..88bbbfc21a --- /dev/null +++ b/published/201908/20190815 SSLH - Share A Same Port For HTTPS And SSH.md @@ -0,0 +1,205 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11247-1.html) +[#]: subject: (SSLH – Share A Same Port For HTTPS And SSH) +[#]: via: (https://www.ostechnix.com/sslh-share-port-https-ssh/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +SSLH:让 HTTPS 和 SSH 共享同一个端口 +====== + +![SSLH - Share A Same Port For HTTPS And SSH][1] + +一些 ISP 和公司可能已经阻止了大多数端口,并且只允许少数特定端口(如端口 80 和 443)访问来加强其安全性。在这种情况下,我们别无选择,但同一个端口可以用于多个程序,比如 HTTPS 端口 443,很少被阻止。通过 SSL/SSH 多路复用器 SSLH 的帮助,它可以侦听端口 443 上的传入连接。更简单地说,SSLH 允许我们在 Linux 系统上的端口 443 上运行多个程序/服务。因此,你可以同时通过同一个端口同时使用 SSL 和 SSH。如果你遇到大多数端口被防火墙阻止的情况,你可以使用 SSLH 访问远程服务器。这个简短的教程描述了如何在类 Unix 操作系统中使用 SSLH 让 https、ssh 共享相同的端口。 + +### SSLH:让 HTTPS、SSH 共享端口 + +#### 安装 SSLH + +大多数 Linux 发行版上 SSLH 都有软件包,因此你可以使用默认包管理器进行安装。 + +在 Debian、Ubuntu 及其衍生品上运行: + +``` +$ sudo apt-get install sslh +``` + +安装 SSLH 时,将提示你是要将 sslh 作为从 inetd 运行的服务,还是作为独立服务器运行。每种选择都有其自身的优点。如果每天只有少量连接,最好从 inetd 运行 sslh 以节省资源。另一方面,如果有很多连接,sslh 应作为独立服务器运行,以避免为每个传入连接生成新进程。 + +![][2] + +*安装 sslh* + +在 Arch Linux 和 Antergos、Manjaro Linux 等衍生品上,使用 Pacman 进行安装,如下所示: + +``` +$ sudo pacman -S sslh +``` + +在 RHEL、CentOS 上,你需要添加 EPEL 存储库,然后安装 SSLH,如下所示: + +``` +$ sudo yum install epel-release +$ sudo yum install sslh +``` + +在 Fedora: + +``` +$ sudo dnf install sslh +``` + +如果它在默认存储库中不可用,你可以如[这里][3]所述手动编译和安装 SSLH。 + +#### 配置 Apache 或 Nginx Web 服务器 + +如你所知,Apache 和 Nginx Web 服务器默认会监听所有网络接口(即 `0.0.0.0:443`)。我们需要更改此设置以告知 Web 服务器仅侦听 `localhost` 接口(即 `127.0.0.1:443` 或 `localhost:443`)。 + +为此,请编辑 Web 服务器(nginx 或 apache)配置文件并找到以下行: + +``` +listen 443 ssl; +``` + +将其修改为: + +``` +listen 127.0.0.1:443 ssl; +``` + +如果你在 Apache 中使用虚拟主机,请确保你也修改了它。 + +``` +VirtualHost 127.0.0.1:443 +``` + +保存并关闭配置文件。不要重新启动该服务。我们还没有完成。 + +#### 配置 SSLH + +使 Web 服务器仅在本地接口上侦听后,编辑 SSLH 配置文件: + +``` +$ sudo vi /etc/default/sslh +``` + +找到下列行: + +``` +Run=no +``` + +将其修改为: + +``` +Run=yes +``` + +然后,向下滚动一点并修改以下行以允许 SSLH 在所有可用接口上侦听端口 443(例如 `0.0.0.0:443`)。 + +``` +DAEMON_OPTS="--user sslh --listen 0.0.0.0:443 --ssh 127.0.0.1:22 --ssl 127.0.0.1:443 --pidfile /var/run/sslh/sslh.pid" +``` + +这里, + + * `–user sslh`:要求在这个特定的用户身份下运行。 + * `–listen 0.0.0.0:443`:SSLH 监听于所有可用接口的 443 端口。 + * `–sshs 127.0.0.1:22` : 将 SSH 流量路由到本地的 22 端口。 + * `–ssl 127.0.0.1:443` : 将 HTTPS/SSL 流量路由到本地的 443 端口。 + +保存并关闭文件。 + +最后,启用并启动 `sslh` 服务以更新更改。 + +``` +$ sudo systemctl enable sslh +$ sudo systemctl start sslh +``` + +#### 测试 + +检查 SSLH 守护程序是否正在监听 443。 + +``` +$ ps -ef | grep sslh +sslh 2746 1 0 15:51 ? 00:00:00 /usr/sbin/sslh --foreground --user sslh --listen 0.0.0.0 443 --ssh 127.0.0.1 22 --ssl 127.0.0.1 443 --pidfile /var/run/sslh/sslh.pid +sslh 2747 2746 0 15:51 ? 00:00:00 /usr/sbin/sslh --foreground --user sslh --listen 0.0.0.0 443 --ssh 127.0.0.1 22 --ssl 127.0.0.1 443 --pidfile /var/run/sslh/sslh.pid +sk 2754 1432 0 15:51 pts/0 00:00:00 grep --color=auto sslh +``` + +现在,你可以使用端口 443 通过 SSH 访问远程服务器: + +``` +$ ssh -p 443 [email protected] +``` + +示例输出: + +``` +[email protected]'s password: +Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-55-generic x86_64) + +* Documentation: https://help.ubuntu.com +* Management: https://landscape.canonical.com +* Support: https://ubuntu.com/advantage + +System information as of Wed Aug 14 13:11:04 IST 2019 + +System load: 0.23 Processes: 101 +Usage of /: 53.5% of 19.56GB Users logged in: 0 +Memory usage: 9% IP address for enp0s3: 192.168.225.50 +Swap usage: 0% IP address for enp0s8: 192.168.225.51 + +* Keen to learn Istio? It's included in the single-package MicroK8s. + +https://snapcraft.io/microk8s + +61 packages can be updated. +22 updates are security updates. + + +Last login: Wed Aug 14 13:10:33 2019 from 127.0.0.1 +``` + +![][4] + +*通过 SSH 使用 443 端口访问远程系统* + +看见了吗?即使默认的 SSH 端口 22 被阻止,我现在也可以通过 SSH 访问远程服务器。正如你在上面的示例中所看到的,我使用 https 端口 443 进行 SSH 连接。 + +我在我的 Ubuntu 18.04 LTS 服务器上测试了 SSLH,它如上所述工作得很好。我在受保护的局域网中测试了 SSLH,所以我不知道是否有安全问题。如果你在生产环境中使用它,请在下面的评论部分中告诉我们使用 SSLH 的优缺点。 + +有关更多详细信息,请查看下面给出的官方 GitHub 页面。 + +资源: + +* [SSLH GitHub 仓库][12] + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/sslh-share-port-https-ssh/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2017/08/SSLH-Share-A-Same-Port-For-HTTPS-And-SSH-1-720x340.jpg +[2]: https://www.ostechnix.com/wp-content/uploads/2017/08/install-sslh.png +[3]: https://github.com/yrutschle/sslh/blob/master/doc/INSTALL.md +[4]: https://www.ostechnix.com/wp-content/uploads/2017/08/Access-remote-systems-via-SSH-using-port-443.png +[5]: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ +[6]: https://www.ostechnix.com/how-to-create-ssh-alias-in-linux/ +[7]: https://www.ostechnix.com/configure-ssh-key-based-authentication-linux/ +[8]: https://www.ostechnix.com/how-to-stop-ssh-session-from-disconnecting-in-linux/ +[9]: https://www.ostechnix.com/allow-deny-ssh-access-particular-user-group-linux/ +[10]: https://www.ostechnix.com/4-ways-keep-command-running-log-ssh-session/ +[11]: https://www.ostechnix.com/scanssh-fast-ssh-server-open-proxy-scanner/ +[12]: https://github.com/yrutschle/sslh diff --git a/published/201908/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md b/published/201908/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md new file mode 100644 index 0000000000..b0093ff375 --- /dev/null +++ b/published/201908/20190817 GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11241-1.html) +[#]: subject: (GNOME and KDE team up on the Linux desktop, docs for Nvidia GPUs open up, a powerful new way to scan for firmware vulnerabilities, and more news) +[#]: via: (https://opensource.com/article/19/8/news-august-17) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +开源新闻综述:GNOME 和 KDE 达成合作、Nvidia 开源 GPU 文档 +====== + +> 不要错过两周以来最大的开源头条新闻。 + +![Weekly news roundup with TV][1] + +在本期开源新闻综述中,我们将介绍两种新的强大数据可视化工具、Nvidia 开源其 GPU 文档、激动人心的新工具、确保自动驾驶汽车的固件安全等等! + +### GNOME 和 KDE 在 Linux 桌面上达成合作伙伴 + +Linux 在桌面计算机上一直处于分裂状态。在最近的一篇[公告][2]中称,“两个主要的 Linux 桌面竞争对手,[GNOME 基金会][3] 和 [KDE][4] 已经同意合作。” + +这两个组织将成为今年 11 月在巴塞罗那举办的 [Linux App Summit(LAS)2019][5] 的赞助商。这一举措在某种程度上似乎是对桌面计算不再是争夺支配地位的最佳场所的回应。无论是什么原因,Linux 桌面的粉丝们都有新的理由希望未来出现一个标准化的 GUI 环境。 + +### 新的开源数据可视化工具 + +这个世界上很少有不是由数据驱动的。除非数据以人们可以互动的形式出现,否则它并不是很好使用。最近开源的两个数据可视化项目正在尝试使数据更有用。 + +第一个工具名为 **Neuroglancer**,由 [Google 的研究团队][6]创建。它“使神经科医生能够在交互式可视化中建立大脑神经通路的 3D 模型。”Neuroglancer 通过使用神经网络追踪大脑中的神经元路径并构建完整的可视化来实现这一点。科学家已经使用了 Neuroglancer(你可以[从 GitHub 取得][7])通过扫描果蝇的大脑来建立一个交互式地图。 + +第二个工具来自一个不太能想到的的来源:澳大利亚信号理事会。这是该国家类似 NSA 的机构,它“开源了[内部数据可视化和分析工具][8]之一。”这个被称为 **[Constellation][9]** 的工具可以“识别复杂数据集中的趋势和模式,并且能够扩展到‘数十亿输入’。”该机构总干事迈克•伯吉斯表示,他希望“这一工具将有助于产生有利于所有澳大利亚人的科学和其他方面的突破。”鉴于它是开源的,它可以使整个世界受益。 + +### Nvidia 开始发布 GPU 文档 + +多年来,图形处理单元(GPU)制造商 Nvidia 并没有做出什么让开源项目轻松开发其产品的驱动程序的努力。现在,该公司通过[发布 GPU 硬件文档][10]向这些项目迈出了一大步。 + +该公司根据 MIT 许可证发布的文档[可在 GitHub 上获取][11]。它涵盖了几个关键领域,如设备初始化、内存时钟/调整和电源状态。据硬件新闻网站 Phoronix 称,开发了 Nvidia GPU 的开源驱动程序的 Nouveau 项目将是率先使用该文档来推动其开发工作的项目之一。 + +### 用于保护固件的新工具 + +似乎每周都有的消息称,移动设备或连接互联网的小设备中出现新漏洞。通常,这些漏洞存在于控制设备的固件中。自动驾驶汽车服务 Cruise [发布了一个开源工具][12],用于在这些漏洞成为问题之前捕获这些漏洞。 + +该工具被称为 [FwAnalzyer][13]。它检查固件代码中是否存在许多潜在问题,包括“识别潜在危险的可执行文件”,并查明“任何错误遗留的调试代码”。Cruise 的工程师 Collin Mulliner 曾帮助开发该工具,他说通过在代码上运行 FwAnalyzer,固件开发人员“现在能够检测并防止各种安全问题。” + +### 其它新闻 + +* [为什么洛杉矶决定将未来寄予开源][14] +* [麻省理工学院出版社发布了关于开源出版软件的综合报告][15] +* [华为推出鸿蒙操作系统,不会放弃 Android 智能手机][16] + +*一如既往地感谢 Opensource.com 的工作人员和主持人本周的帮助。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/news-august-17 + +作者:[Scott Nesbitt][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/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://www.zdnet.com/article/gnome-and-kde-work-together-on-the-linux-desktop/ +[3]: https://www.gnome.org/ +[4]: https://kde.org/ +[5]: https://linuxappsummit.org/ +[6]: https://www.cbronline.com/news/brain-mapping-google-ai +[7]: https://github.com/google/neuroglancer +[8]: https://www.computerworld.com.au/article/665286/australian-signals-directorate-open-sources-data-analysis-tool/ +[9]: https://www.constellation-app.com/ +[10]: https://www.phoronix.com/scan.php?page=news_item&px=NVIDIA-Open-GPU-Docs +[11]: https://github.com/nvidia/open-gpu-doc +[12]: https://arstechnica.com/information-technology/2019/08/self-driving-car-service-open-sources-new-tool-for-securing-firmware/ +[13]: https://github.com/cruise-automation/fwanalyzer +[14]: https://www.techrepublic.com/article/why-la-decided-to-open-source-its-future/ +[15]: https://news.mit.edu/2019/mit-press-report-open-source-publishing-software-0808 +[16]: https://www.itnews.com.au/news/huawei-unveils-harmony-operating-system-wont-ditch-android-for-smartphones-529432 diff --git a/published/201908/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md b/published/201908/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md new file mode 100644 index 0000000000..309a394d97 --- /dev/null +++ b/published/201908/20190817 LiVES Video Editor 3.0 is Here With Significant Improvements.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (scvoet) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11266-1.html) +[#]: subject: (LiVES Video Editor 3.0 is Here With Significant Improvements) +[#]: via: (https://itsfoss.com/lives-video-editor/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LiVES 视频编辑器 3.0 有了显著的改善 +====== + +我们最近列出了一个[最佳开源视频编辑器][1]的清单。LiVES 是这些开源视频编辑器之一,可以免费使用。 + +即使许多用户还在等待 Windows 版本的发行,但在刚刚发行的 LiVES 视频编辑器 Linux 版本中(最新版本 v3.0.1)进行了一个重大更新,包括了一些新的功能和改进。 + +在这篇文章里,我将会列出新版本中的重要改进,并且我将会提到在 Linux 上安装的步骤。 + +### LiVES 视频编辑器 3.0:新的改进 + +![Zorin OS 中正在加载的 LiVES 视频编辑器][2] + +总的来说,在这次重大更新中 LiVES 视频编辑器旨在提供更加平滑的回放、防止意外崩溃、优化视频录制,以及让在线视频下载器更加实用。 + +下面列出了变化: + +* 如果需要渲染的话,可以静默渲染直到到视频播放完毕。 +* 改进回放插件为 openGL,提供更加平滑的回放。 +* 重新启用了 openGL 回放插件的高级选项。 +* 在所有帧的 VJ/预解码中允许“Enough” +* 重构了在回放时的时基计算的代码(a/v 同步更好)。 +* 彻底修复了外部音频和音频,提高了准确性并减少了 CPU 占用。 +* 进入多音轨模式时自动切换至内部音频。 +* 重新显示效果映射器窗口时,将会正常展示效果状态(on/off)。 +* 解决了音频和视频线程之间的冲突。 +* 现在可以对在线视频下载器,可以对剪辑大小和格式进行修改并添加了更新选项。 +* 对实时效果实例实现了引用计数。 +* 大量重写了主界面,清理代码并改进许多视觉效果。 +* 优化了视频播放器运行时的录制功能。 +* 改进了 projectM 过滤器封装,包括对 SDL2 的支持。 +* 添加了一个选项来逆转多轨合成器中的 Z-order(后层现在可以覆盖上层了)。 +* 增加了对 musl libc 的支持 +* 更新了乌克兰语的翻译 + +如果你不是一位高级视频编辑师,也许会对上面列出的重要更新提不起太大的兴趣。但正是因为这些更新,才使得“LiVES 视频编辑器”成为了最好的开源视频编辑软件。 + +[][3] + +### 在 Linux 上安装 LiVES 视频编辑器 + +LiVES 几乎可以在所有主要的 Linux 发行版中使用。但是,你可能并不能在软件中心找到它的最新版本。所以,如果你想通过这种方式安装,那你就不得不耐心等待了。 + +如果你想要手动安装,可以从它的下载页面获取 Fedora/Open SUSE 的 RPM 安装包。它也适用于其他 Linux 发行版。 + +- [下载 LiVES 视频编辑器][4] + +如果你使用的是 Ubuntu(或其他基于 Ubuntu 的发行版),可以安装由 [Ubuntuhandbook][6] 维护的[非官方 PPA][5]。 + +下面由我来告诉你,你该做些什么: + +1、启动终端后输入以下命令: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/lives +``` + +系统将提示你输入密码用于确认添加 PPA。 + +2、完成后,你现在可以轻松地更新软件包列表并安装 LiVES 视频编辑器。以下是需要你输入的命令段: + +``` +sudo apt update +sudo apt install life-plugins +``` + +3、现在,它开始下载并安装这个视频编辑器,等待大约一分钟即可完成。 + +### 总结 + +Linux 上有许多[视频编辑器][7]。但它们通常被认为不能用于专业编辑。而我并不是一名专业人士,所以像 LiVES 这样免费的视频编辑器就足以进行简单的编辑了。 + +你认为怎么样呢?你在 Linux 上使用 LiVES 或其他视频编辑器的体验还好吗?在下面的评论中告诉我们你的感觉吧。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lives-video-editor/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[Scvoet](https://github.com/scvoet) +校对:[wxy](https://github.com/wxy) + +本文由 [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/open-source-video-editors/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/lives-video-editor-loading.jpg?ssl=1 +[3]: https://itsfoss.com/vidcutter-video-editor-linux/ +[4]: http://lives-video.com/index.php?do=downloads#binaries +[5]: https://itsfoss.com/ppa-guide/ +[6]: http://ubuntuhandbook.org/index.php/2019/08/lives-video-editor-3-0-released-install-ubuntu/ +[7]: https://itsfoss.com/best-video-editing-software-linux/ diff --git a/published/201908/20190820 A guided tour of Linux file system types.md b/published/201908/20190820 A guided tour of Linux file system types.md new file mode 100644 index 0000000000..0914e3b7d1 --- /dev/null +++ b/published/201908/20190820 A guided tour of Linux file system types.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11274-1.html) +[#]: subject: (A guided tour of Linux file system types) +[#]: via: (https://www.networkworld.com/article/3432990/a-guided-tour-of-linux-file-system-types.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 文件系统类型导览 +====== + +> Linux 文件系统多年来在不断发展,让我们来看一下文件系统类型。 + +![](https://img.linux.net.cn/data/attachment/album/201908/27/175516vzrp4j4zevcqr66c.jpg) + +虽然对于普通用户来说可能并不明显,但在过去十年左右的时间里,Linux 文件系统已经发生了显著的变化,这使它们能够更好对抗损坏和性能问题。 + +如今大多数 Linux 系统使用名为 ext4 的文件系统。 “ext” 代表“扩展extended”,“4” 表示这是此文件系统的第 4 代。随着时间的推移添加的功能包括:能够提供越来越大的文件系统(目前大到 1,000,000 TiB)和更大的文件(高达 16 TiB),更抗系统崩溃,更少碎片(将单个文件分散为存在多个位置的块)以提高性能。 + +ext4 文件系统还带来了对性能、可伸缩性和容量的其他改进。实现了元数据和日志校验和以增强可靠性。时间戳现在可以跟踪纳秒级变化,以便更好地对文件打戳(例如,文件创建和最后更新时间)。并且,在时间戳字段中增加了两个位,2038 年的问题(存储日期/时间的字段将从最大值翻转到零)已被推迟到了 400 多年之后(到 2446)。 + +### 文件系统类型 + +要确定 Linux 系统上文件系统的类型,请使用 `df` 命令。下面显示的命令中的 `-T` 选项显示文件系统类型。 `-h` 显示“易读的”磁盘大小。换句话说,调整报告的单位(如 M 和 G),使人们更好地理解。 + +``` +$ df -hT | head -10 +Filesystem Type Size Used Avail Use% Mounted on +udev devtmpfs 2.9G 0 2.9G 0% /dev +tmpfs tmpfs 596M 1.5M 595M 1% /run +/dev/sda1 ext4 110G 50G 55G 48% / +/dev/sdb2 ext4 457G 642M 434G 1% /apps +tmpfs tmpfs 3.0G 0 3.0G 0% /dev/shm +tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock +tmpfs tmpfs 3.0G 0 3.0G 0% /sys/fs/cgroup +/dev/loop0 squashfs 89M 89M 0 100% /snap/core/7270 +/dev/loop2 squashfs 142M 142M 0 100% /snap/hexchat/42 +``` + +请注意,`/`(根)和 `/apps` 的文件系统都是 ext4,而 `/dev` 是 devtmpfs 文件系统(一个由内核填充的自动化设备节点)。其他的文件系统显示为 tmpfs(驻留在内存和/或交换分区中的临时文件系统)和 squashfs(只读压缩文件系统的文件系统,用于快照包)。 + +还有 proc 文件系统,用于存储正在运行的进程的信息。 + +``` +$ df -T /proc +Filesystem Type 1K-blocks Used Available Use% Mounted on +proc proc 0 0 0 - /proc +``` + +当你在整个文件系统中游览时,可能会遇到许多其他文件系统类型。例如,当你移动到目录中并想了解它的文件系统时,可以运行以下命令: + +``` +$ cd /dev/mqueue; df -T . +Filesystem Type 1K-blocks Used Available Use% Mounted on +mqueue mqueue 0 0 0 - /dev/mqueue +$ cd /sys; df -T . +Filesystem Type 1K-blocks Used Available Use% Mounted on +sysfs sysfs 0 0 0 - /sys +$ cd /sys/kernel/security; df -T . +Filesystem Type 1K-blocks Used Available Use% Mounted on +securityfs securityfs 0 0 0 - /sys/kernel/security +``` + +与其他 Linux 命令一样,这里的 `.` 代表整个文件系统的当前位置。 + +这些和其他独特的文件系统提供了一些特殊功能。例如,securityfs 提供支持安全模块的文件系统。 + +Linux 文件系统需要能够抵抗损坏,能够承受系统崩溃并提供快速、可靠的性能。由几代 ext 文件系统和新一代专用文件系统提供的改进使 Linux 系统更易于管理和更可靠。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3432990/a-guided-tour-of-linux-file-system-types.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/08/guided-tour-on-the-flaker_people-in-horse-drawn-carriage_germany-by-andreas-lehner-flickr-100808681-large.jpg +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/201908/20190823 How to Delete Lines from a File Using the sed Command.md b/published/201908/20190823 How to Delete Lines from a File Using the sed Command.md new file mode 100644 index 0000000000..e37d9dd215 --- /dev/null +++ b/published/201908/20190823 How to Delete Lines from a File Using the sed Command.md @@ -0,0 +1,404 @@ +[#]: collector: (lujun9972) +[#]: translator: (hello-wn) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11276-1.html) +[#]: subject: (How to Delete Lines from a File Using the sed Command) +[#]: via: (https://www.2daygeek.com/linux-remove-delete-lines-in-file-sed-command/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 sed 命令删除文件中的行 +====== + +![](https://img.linux.net.cn/data/attachment/album/201908/28/100204ei6v98sa69hdf3zf.jpg) + +Sed 代表流编辑器Stream Editor,常用于 Linux 中基本的文本处理。`sed` 命令是 Linux 中的重要命令之一,在文件处理方面有着重要作用。可用于删除或移动与给定模式匹配的特定行。 + +它还可以删除文件中的特定行,它能够从文件中删除表达式,文件可以通过指定分隔符(例如逗号、制表符或空格)进行标识。 + +本文列出了 15 个使用范例,它们可以帮助你掌握 `sed` 命令。 + +如果你能理解并且记住这些命令,在你需要使用 `sed` 时,这些命令就能派上用场,帮你节约很多时间。 + +注意:为了方便演示,我在执行 `sed` 命令时,不使用 `-i` 选项(因为这个选项会直接修改文件内容),被移除了行的文件内容将打印到 Linux 终端。 + +但是,如果你想在实际环境中从源文件中删除行,请在 `sed` 命令中使用 `-i` 选项。 + +演示之前,我创建了 `sed-demo.txt` 文件,并添加了以下内容和相应行号以便更好地理解。 + +``` +# cat sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 1) 如何删除文件的第一行? + +使用以下语法删除文件首行。 + +`N` 表示文件中的第 N 行,`d` 选项在 `sed` 命令中用于删除一行。 + +语法: + +``` +sed 'Nd' file +``` + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的第一行。 + +``` +# sed '1d' sed-demo.txt + +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 2) 如何删除文件的最后一行? + +使用以下语法删除文件最后一行。 + +`$` 符号表示文件的最后一行。 + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的最后一行。 + +``` +# sed '$d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +``` + +### 3) 如何删除指定行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的第 3 行。 + +``` +# sed '3d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 4) 如何删除指定范围内的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的第 5 到 7 行。 + +``` +# sed '5,7d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 5) 如何删除多行内容? + +`sed` 命令能够删除给定行的集合。 + +本例中,下面的 `sed` 命令删除了第 1 行、第 5 行、第 9 行和最后一行。 + +``` +# sed '1d;5d;9d;$d' sed-demo.txt + +2 Unix Operating System +3 RHEL +4 Red Hat +6 Arch Linux +7 CentOS +8 Debian +``` + +### 5a) 如何删除指定范围以外的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中第 3 到 6 行范围以外的所有行。 + +``` +# sed '3,6!d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +``` + +### 6) 如何删除空行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中的空行。 + +``` +# sed '/^$/d' sed-demo.txt + +1 Linux Operating System +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 7) 如何删除包含某个模式的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中匹配到 `System` 模式的行。 + +``` +# sed '/System/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 8) 如何删除包含字符串集合中某个字符串的行? + +使用以下 `sed` 命令删除 `sed-demo.txt` 中匹配到 `System` 或 `Linux` 表达式的行。 + +``` +# sed '/System\|Linux/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 9) 如何删除以指定字符开头的行? + +为了测试,我创建了 `sed-demo-1.txt` 文件,并添加了以下内容。 + +``` +# cat sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +Arch Linux - 1 +2 - Manjaro +3 4 5 6 +``` + +使用以下 `sed` 命令删除以 `R` 字符开头的所有行。 + +``` +# sed '/^R/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +Fedora +debian +ubuntu +Arch Linux - 1 +2 - Manjaro +3 4 5 6 +``` + +使用以下 `sed` 命令删除 `R` 或者 `F` 字符开头的所有行。 + +``` +# sed '/^[RF]/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +debian +ubuntu +Arch Linux - 1 +2 - Manjaro +3 4 5 6 +``` + +### 10) 如何删除以指定字符结尾的行? + +使用以下 `sed` 命令删除 `m` 字符结尾的所有行。 + +``` +# sed '/m$/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +使用以下 `sed` 命令删除 `x` 或者 `m` 字符结尾的所有行。 + +``` +# sed '/[xm]$/d' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 11) 如何删除所有大写字母开头的行? + +使用以下 `sed` 命令删除所有大写字母开头的行。 + +``` +# sed '/^[A-Z]/d' sed-demo-1.txt + +debian +ubuntu +2 - Manjaro +3 4 5 6 +``` + +### 12) 如何删除指定范围内匹配模式的行? + +使用以下 `sed` 命令删除第 1 到 6 行中包含 `Linux` 表达式的行。 + +``` +# sed '1,6{/Linux/d;}' sed-demo.txt + +2 Unix Operating System +3 RHEL +4 Red Hat +5 Fedora +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 13) 如何删除匹配模式的行及其下一行? + +使用以下 `sed` 命令删除包含 `System` 表达式的行以及它的下一行。 + +``` +# sed '/System/{N;d;}' sed-demo.txt + +3 RHEL +4 Red Hat +5 Fedora +6 Arch Linux +7 CentOS +8 Debian +9 Ubuntu +10 openSUSE +``` + +### 14) 如何删除包含数字的行? + +使用以下 `sed` 命令删除所有包含数字的行。 + +``` +# sed '/[0-9]/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +``` + +使用以下 `sed` 命令删除所有以数字开头的行。 + +``` +# sed '/^[0-9]/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +Arch Linux - 1 +``` + +使用以下 `sed` 命令删除所有以数字结尾的行。 + +``` +# sed '/[0-9]$/d' sed-demo-1.txt + +Linux Operating System +Unix Operating System +RHEL +Red Hat +Fedora +debian +ubuntu +2 - Manjaro +``` + +### 15) 如何删除包含字母的行? + +使用以下 `sed` 命令删除所有包含字母的行。 + +``` +# sed '/[A-Za-z]/d' sed-demo-1.txt + +3 4 5 6 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-remove-delete-lines-in-file-sed-command/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[hello-wn](https://github.com/hello-wn) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 diff --git a/published/201908/20190823 Managing credentials with KeePassXC.md b/published/201908/20190823 Managing credentials with KeePassXC.md new file mode 100644 index 0000000000..93c6826b7e --- /dev/null +++ b/published/201908/20190823 Managing credentials with KeePassXC.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11278-1.html) +[#]: subject: (Managing credentials with KeePassXC) +[#]: via: (https://fedoramagazine.org/managing-credentials-with-keepassxc/) +[#]: author: (Marco Sarti https://fedoramagazine.org/author/msarti/) + +使用 KeePassXC 管理凭据 +====== + +![][1] + +[上一篇文章][2]我们讨论了使用服务器端技术的密码管理工具。这些工具非常有趣而且适合云安装。在本文中,我们将讨论 KeePassXC,这是一个简单的多平台开源软件,它使用本地文件作为数据库。 + +这种密码管理软件的主要优点是简单。无需服务器端技术专业知识,因此可供任何类型的用户使用。 + +### 介绍 KeePassXC + +KeePassXC 是一个开源的跨平台密码管理器:它是作为 KeePassX 的一个分支开始开发的,这是个不错的产品,但开发不是非常活跃。它使用 256 位密钥的 AES 算法将密钥保存在加密数据库中,这使得在云端设备(如 pCloud 或 Dropbox)中保存数据库相当安全。 + +除了密码,KeePassXC 还允许你在加密皮夹中保存各种信息和附件。它还有一个有效的密码生成器,可以帮助用户正确地管理他的凭据。 + +### 安装 + +这个程序在标准的 Fedora 仓库和 Flathub 仓库中都有。不幸的是,在沙箱中运行的程序无法使用浏览器集成,所以我建议通过 dnf 安装程序: + +``` +sudo dnf install keepassxc +``` + +### 创建你的皮夹 + +要创建新数据库,有两个重要步骤: + +* 选择加密设置:默认设置相当安全,增加转换轮次也会增加解密时间。 +* 选择主密钥和额外保护:主密钥必须易于记忆(如果丢失它,你的皮夹就会丢失!)而足够强大,一个至少有 4 个随机单词的密码可能是一个不错的选择。作为额外保护,你可以选择密钥文件(请记住:你必须始终都有它,否则无法打开皮夹)和/或 YubiKey 硬件密钥。 + +![][3] + +![][4] + +数据库文件将保存到文件系统。如果你想与其他计算机/设备共享,可以将它保存在 U 盘或 pCloud 或 Dropbox 等云存储中。当然,如果你选择云存储,建议使用特别强大的主密码,如果有额外保护则更好。 + +### 创建你的第一个条目 + +创建数据库后,你可以开始创建第一个条目。对于 Web 登录,请在“条目”选项卡中输入用户名、密码和 URL。你可以根据个人策略指定凭据的到期日期,也可以通过按右侧的按钮下载网站的 favicon 并将其关联为条目的图标,这是一个很好的功能。 + +![][5] + +![][6] + +KeePassXC 还提供了一个很好的密码/口令生成器,你可以选择长度和复杂度,并检查对暴力攻击的抵抗程度: + +![][7] + +### 浏览器集成 + +KeePassXC 有一个适用于所有主流浏览器的扩展。该扩展允许你填写所有已指定 URL 条目的登录信息。 + +必须在 KeePassXC(工具菜单 -> 设置)上启用浏览器集成,指定你要使用的浏览器: + +![][8] + +安装扩展后,必须与数据库建立连接。要执行此操作,请按扩展按钮,然后按“连接”按钮:如果数据库已打开并解锁,那么扩展程序将创建关联密钥并将其保存在数据库中,该密钥对于浏览器是唯一的,因此我建议对它适当命名: + +![][9] + +当你打开 URL 字段中的登录页并且数据库是解锁的,那么这个扩展程序将为你提供与该页面关联的所有凭据: + +![][10] + +通过这种方式,你可以通过 KeePassXC 获取互联网凭据,而无需将其保存在浏览器中。 + +### SSH 代理集成 + +KeePassXC 的另一个有趣功能是与 SSH 集成。如果你使用 ssh 代理,KeePassXC 能够与之交互并添加你上传的 ssh 密钥到条目中。 + +首先,在常规设置(工具菜单 -> 设置)中,你必须启用 ssh 代理并重启程序: + +![][11] + +此时,你需要以附件方式上传你的 ssh 密钥对到条目中。然后在 “SSH 代理” 选项卡中选择附件下拉列表中的私钥,此时会自动填充公钥。不要忘记选择上面的两个复选框,以便在数据库打开/解锁时将密钥添加到代理,并在数据库关闭/锁定时删除: + +![][12] + +现在打开和解锁数据库,你可以使用皮夹中保存的密钥登录 ssh。 + +唯一的限制是可以添加到代理的最大密钥数:ssh 服务器默认不接受超过 5 次登录尝试,出于安全原因,建议不要增加此值。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-credentials-with-keepassxc/ + +作者:[Marco Sarti][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://fedoramagazine.org/author/msarti/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/keepassxc-816x345.png +[2]: https://linux.cn/article-11181-1.html +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-33-27.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-07-48-21.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-30-07.png +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-43-11.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-08-49-22.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-48-09.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-05-57.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-13-29.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-47-21.png +[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/Screenshot-from-2019-08-17-09-46-35.png diff --git a/published/201908/20190825 Happy birthday to the Linux kernel- What-s your favorite release.md b/published/201908/20190825 Happy birthday to the Linux kernel- What-s your favorite release.md new file mode 100644 index 0000000000..b8ce475557 --- /dev/null +++ b/published/201908/20190825 Happy birthday to the Linux kernel- What-s your favorite release.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11271-1.html) +[#]: subject: (Happy birthday to the Linux kernel: What's your favorite release?) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-favorite-release) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +Linux 内核生日快乐 —— 那么你喜欢哪个版本? +====== + +> 自从第一个 Linux 内核发布已经过去 28 年了。自 1991 年以来发布了几十个 Linux 内核版本,你喜欢的是哪个?投个票吧! + +![][1] + +让我们回到 1991 年 8 月,那个创造历史的时间。科技界经历过许多关键时刻,这些时刻仍在影响着我们。在那个 8 月,Tim Berners-Lee 宣布了一个名为万维网World Wide Web的有趣项目,并推出了第一个网站;超级任天堂在美国发布,为所有年龄段的孩子们开启了新的游戏篇章;在赫尔辛基大学,一位名叫 Linus Torvalds 的学生向同好们询问(1991 年 8 月 25 日)了他作为[业余爱好][3]开发的新免费操作系统的反馈。那时 Linux 内核诞生了。 + +如今,我们可以浏览超过 15 亿个网站,在我们的电视机上玩另外五种任天堂游戏机,并维护着六个长期 Linux 内核。以下是我们的一些作者对他们最喜欢的 Linux 内核版本所说的话。 + +“引入模块的那个版本(1.2 吧?)。这是 Linux 迈向成功的未来的重要一步。” - Milan Zamazal + +“2.6.9,因为它是我 2006 年加入 Red Hat 时的版本(在 RHEL4 中)。但我也更钟爱 2.6.18(RHEL5)一点,因为它在大规模部署的、我们最大客户(Telco, FSI)的关键任务工作负载中使用。它还带来了我们最大的技术变革之一:虚拟化(Xen 然后是 KVM)。” - Herve Lemaitre + +“4.10。(虽然我不知道如何衡量这一点)。” - Ivan Bazulic + +“Fedora 30 附带的新内核修复了我的 Thinkpad Yoga 笔记本电脑的挂起问题;挂起功能现在可以完美运行。我是一个笨人,只是忍受这个问题而从未试着提交错误报告,所以我特别感谢这项工作,我知道一定会解决这个问题。” - MáirínDuffy + +“2.6.16 版本将永远在我的心中占有特殊的位置。这是我负责将其转换为在 hertz neverlost gps 系统上运行的第一个内核。我负责这项为那个设备构建内核和根文件系统的工作,对我来说这真的是一个奇迹时刻。我们在初次发布后多次更新了内核,但我想我必须还是推选那个最初版本,不过,我对于它的热爱没有任何技术原因,这纯属感性选择 =)” - Michael McCune + +“我最喜欢的 Linux 内核版本是 2.4.0 系列,它集成了对 USB、LVM 和 ext3 的支持。ext3 是第一个具有日志支持的主流 Linux 文件系统,其从 2.4.15 内核可用。我使用的第一个内核版本是 2.2.13。” - Sean Nelson + +“也许是 2.2.14,因为它是在我安装的第一个 Linux 上运行的版本(Mandrake Linux 7.0,在 2000 IIRC)。它也是我第一个需要重新编译以让我的视频卡或我的调制解调器(记不清了)工作的版本。” - GermánPulido + +“我认为最新的一个!但我有段时间使用实时内核扩展来进行音频制作。” - Mario Torre + +*在 Linux 内核超过 [52 个的版本][2]当中,你最喜欢哪一个?参加我们的调查并在评论中告诉我们原因。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-favorite-release + +作者:[Lauren Pritchett][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/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/luis-ibanezhttps://opensource.com/users/mhayden +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_anniversary_celebreate_tux.jpg?itok=JOE-yXus +[2]: http://phb-crystal-ball.org/ +[3]: http://lkml.iu.edu/hypermail/linux/kernel/1908.3/00457.html diff --git a/published/201908/20190825 How to Install Ansible (Automation Tool) on Debian 10 (Buster).md b/published/201908/20190825 How to Install Ansible (Automation Tool) on Debian 10 (Buster).md new file mode 100644 index 0000000000..be4bbb0a36 --- /dev/null +++ b/published/201908/20190825 How to Install Ansible (Automation Tool) on Debian 10 (Buster).md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11286-1.html) +[#]: subject: (How to Install Ansible (Automation Tool) on Debian 10 (Buster)) +[#]: via: (https://www.linuxtechi.com/install-ansible-automation-tool-debian10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Debian 10 上安装 Ansible +====== + +在如今的 IT 领域,自动化一个是热门话题,每个组织都开始采用自动化工具,像 Puppet、Ansible、Chef、CFEngine、Foreman 和 Katello。在这些工具中,Ansible 是几乎所有 IT 组织中管理 UNIX 和 Linux 系统的首选。在本文中,我们将演示如何在 Debian 10 Sever 上安装和使用 Ansible。 + +![Ansible-Install-Debian10][2] + +我的实验室环境: + +* Debian 10 – Ansible 服务器/ 控制节点 – 192.168.1.14 +* CentOS 7 – Ansible 主机 (Web 服务器)– 192.168.1.15 +* CentOS 7 – Ansible 主机(DB 服务器)– 192.169.1.17 + +我们还将演示如何使用 Ansible 服务器管理 Linux 服务器 + +### 在 Debian 10 Server 上安装 Ansible + +我假设你的 Debian 10 中有一个拥有 root 或 sudo 权限的用户。在我这里,我有一个名为 `pkumar` 的本地用户,它拥有 sudo 权限。 + +Ansible 2.7 包存在于 Debian 10 的默认仓库中,在命令行中运行以下命令安装 Ansible, + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install ansible -y +``` + +运行以下命令验证 Ansible 版本, + +``` +root@linuxtechi:~$ sudo ansible --version +``` + +![ansible-version](https://www.linuxtechi.com/wp-content/uploads/2019/08/ansible-version.jpg) + +要安装最新版本的 Ansible 2.8,首先我们必须设置 Ansible 仓库。 + +一个接一个地执行以下命令, + +``` +root@linuxtechi:~$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" | sudo tee -a /etc/apt/sources.list +root@linuxtechi:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install ansible -y +root@linuxtechi:~$ sudo ansible --version +``` + +![latest-ansible-version](https://www.linuxtechi.com/wp-content/uploads/2019/08/latest-ansible-version.jpg) + +### 使用 Ansible 管理 Linux 服务器 + +请参考以下步骤,使用 Ansible 控制器节点管理 Linux 类的服务器, + +#### 步骤 1:在 Ansible 服务器及其主机之间交换 SSH 密钥 + +在 Ansible 服务器生成 ssh 密钥并在 Ansible 主机之间共享密钥。 + +``` +root@linuxtechi:~$ sudo -i +root@linuxtechi:~# ssh-keygen +root@linuxtechi:~# ssh-copy-id root@linuxtechi +root@linuxtechi:~# ssh-copy-id root@linuxtechi +``` + +#### 步骤 2:创建 Ansible 主机清单 + +安装 Ansible 后会自动创建 `/etc/ansible/hosts`,在此文件中我们可以编辑 Ansible 主机或其客户端。我们还可以在家目录中创建自己的 Ansible 主机清单, + +运行以下命令在我们的家目录中创建 Ansible 主机清单。 + +``` +root@linuxtechi:~$ vi $HOME/hosts +[Web] +192.168.1.15 + +[DB] +192.168.1.17 +``` + +保存并退出文件。 + +注意:在上面的主机文件中,我们也可以使用主机名或 FQDN,但为此我们必须确保 Ansible 主机可以通过主机名或者 FQDN 访问。 + +#### 步骤 3:测试和使用默认的 Ansible 模块 + +Ansible 附带了许多可在 `ansible` 命令中使用的默认模块,示例如下所示。 + +语法: + +``` +# ansible -i -m +``` + +这里: + + * `-i ~/hosts`:包含 Ansible 主机列表 + * `-m`:在之后指定 Ansible 模块,如 ping 和 shell + * ``:我们要运行 Ansible 模块的 Ansible 主机 + +使用 Ansible ping 模块验证 ping 连接, + +``` +root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping all +root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping Web +root@linuxtechi:~$ sudo ansible -i ~/hosts -m ping DB +``` + +命令输出如下所示: + +![Ansible-ping-module-examples](https://www.linuxtechi.com/wp-content/uploads/2019/08/Ansible-ping-module-examples.jpg) + +使用 shell 模块在 Ansible 主机上运行 shell 命令 + +语法: + +``` +ansible -i -m shell -a +``` + +例子: + +``` +root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime" all +192.168.1.17 | CHANGED | rc=0 >> + 01:48:34 up 1:07, 3 users, load average: 0.00, 0.01, 0.05 + +192.168.1.15 | CHANGED | rc=0 >> + 01:48:39 up 1:07, 3 users, load average: 0.00, 0.01, 0.04 + +root@linuxtechi:~$ +root@linuxtechi:~$ sudo ansible -i ~/hosts -m shell -a "uptime ; df -Th / ; uname -r" Web +192.168.1.15 | CHANGED | rc=0 >> + 01:52:03 up 1:11, 3 users, load average: 0.12, 0.07, 0.06 +Filesystem Type Size Used Avail Use% Mounted on +/dev/mapper/centos-root xfs 13G 1017M 12G 8% / +3.10.0-327.el7.x86_64 + +root@linuxtechi:~$ +``` + +上面的命令输出表明我们已成功设置 Ansible 控制器节点。 + +让我们创建一个安装 nginx 的示例剧本,下面的剧本将在所有服务器上安装 nginx,这些服务器是 Web 主机组的一部分,但在这里,我的主机组下只有一台 centos 7 机器。 + +``` +root@linuxtechi:~$ vi nginx.yaml +--- +- hosts: Web + tasks: + - name: Install latest version of nginx on CentOS 7 Server + yum: name=nginx state=latest + - name: start nginx + service: + name: nginx + state: started +``` + +现在使用以下命令执行剧本。 + +``` +root@linuxtechi:~$ sudo ansible-playbook -i ~/hosts nginx.yaml +``` + +上面命令的输出类似下面这样, + +![nginx-installation-playbook-debian10](https://www.linuxtechi.com/wp-content/uploads/2019/08/nginx-installation-playbook-debian10.jpg) + +这表明 Ansible 剧本成功执行了。 + +本文就是这些了,请分享你的反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-ansible-automation-tool-debian10/ + +作者:[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]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Ansible-Install-Debian10.jpg diff --git a/published/201908/20190827 A dozen ways to learn Python.md b/published/201908/20190827 A dozen ways to learn Python.md new file mode 100644 index 0000000000..b2fbfb4f5c --- /dev/null +++ b/published/201908/20190827 A dozen ways to learn Python.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11280-1.html) +[#]: subject: (A dozen ways to learn Python) +[#]: via: (https://opensource.com/article/19/8/dozen-ways-learn-python) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +学习 Python 的 12 个方式 +====== + +> 这些资源将帮助你入门并熟练掌握 Python。 + +![](https://img.linux.net.cn/data/attachment/album/201908/29/083446r00gdsohb7lwxdxy.jpg) + +Python 是世界上[最受欢迎的][2]编程语言之一,它受到了全世界各地的开发者和创客的欢迎。大多数 Linux 和 MacOS 计算机都预装了某个版本的 Python,现在甚至一些 Windows 计算机供应商也开始安装 Python 了。 + +也许你尚未学会它,想学习但又不知道在哪里入门。这里的 12 个资源将帮助你入门并熟练掌握 Python。 + +### 课程、书籍、文章和文档 + +1、[Python 软件基金会][3]提供了出色的信息和文档,可帮助你迈上编码之旅。请务必查看 [Python 入门指南][4]。它将帮助你得到最新版本的 Python,并提供有关编辑器和开发环境的有用提示。该组织还有可以来进一步指导你的[优秀文档][5]。 + +2、我的 Python 旅程始于[海龟模块][6]。我首先在 Bryson Payne 的《[教你的孩子编码][7]》中找到了关于 Python 和海龟的内容。这本书是一个很好的资源,购买这本书可以让你看到几十个示例程序,这将激发你的编程好奇心。Payne 博士还在 [Udemy][8] 上以相同的名称开设了一门便宜的课程。 + +3、Payne 博士的书激起了我的好奇心,我渴望了解更多。这时我发现了 Al Sweigart 的《[用 Python 自动化无聊的东西][9]》。你可以购买这本书,也可以使用它的在线版本,它与印刷版完全相同且可根据知识共享许可免费获得和分享。Al 的这本书让我学习到了 Python 的基础知识、函数、列表、字典和如何操作字符串等等。这是一本很棒的书,我已经购买了许多本捐赠给了当地图书馆。Al 还提供 [Udemy][10] 课程;使用他的网站上的优惠券代码,只需 10 美元即可参加。 + +4、Eric Matthes 撰写了《[Python 速成][11]》,这是由 No Starch Press 出版的 Python 的逐步介绍(如同上面的两本书)。Matthes 还有一个很棒的[伴侣网站][12],其中包括了如何在你的计算机上设置 Python 以及一个用以简化学习曲线的[速查表][13]。 + +5、[Python for Everybody][14] 是另一个很棒的 Python 学习资源。该网站可以免费访问 [Charles Severance][15] 的 Coursera 和 edX 认证课程的资料。该网站分为入门、课程和素材等部分,其中 17 个课程按从安装到数据可视化的主题进行分类组织。Severance([@drchuck on Twitter][16]),是密歇根大学信息学院的临床教授。 + +6、[Seth Kenlon][17],我们 Opensource.com 的 Python 大师,撰写了大量关于 Python 的文章。Seth 有很多很棒的文章,包括“[用 JSON 保存和加载 Python 数据][18]”,“[用 Python 学习面向对象编程][19]”,“[在 Python 游戏中用 Pygame 放置平台][20]”,等等。 + +### 在设备上使用 Python + +7、最近我对 [Circuit Playground Express][21] 非常感兴趣,这是一个运行 [CircuitPython][22] 的设备,CircuitPython 是为微控制器设计的 Python 编程语言的子集。我发现 Circuit Playground Express 和 CircuitPython 是向学生介绍 Python(以及一般编程)的好方法。它的制造商 Adafruit 有一个很好的[系列教程][23],可以让你快速掌握 CircuitPython。 + +8、[BBC:Microbit][24] 是另一种入门 Python 的好方法。你可以学习如何使用 [MicroPython][25] 对其进行编程,这是另一种用于编程微控制器的 Python 实现。 + +9、学习 Python 的文章如果没有提到[树莓派][26]单板计算机那是不完整的。一旦你有了[舒适][27]而强大的树莓派,你就可以在 Opensource.com 上找到[成吨的][28]使用它的灵感,包括“[7 个值得探索的树莓派项目][29]”,“[在树莓派上复活 Amiga][30]”,和“[如何使用树莓派作为 VPN 服务器][31]”。 + +10、许多学校为学生提供了 iOS 设备以支持他们的教育。在尝试帮助这些学校的老师和学生学习用 Python 编写代码时,我发现了 [Trinket.io][32]。Trinket 允许你在浏览器中编写和执行 Python 3 代码。 Trinket 的 [Python 入门][33]教程将向你展示如何在 iOS 设备上使用 Python。 +   +### 播客 + +11、我喜欢在开车的时候听播客,我在 Kelly Paredes 和 Sean Tibor 的 [Teaching Python][34] 播客上找到了大量的信息。他们的内容很适合教育领域。 + +12、如果你正在寻找一些更通用的东西,我推荐 Michael Kennedy 的 [Talk Python to Me][35] 播客。它提供了有关 Python 及相关技术的最佳信息。 + +你学习 Python 最喜欢的资源是什么?请在评论中分享。 + +计算机编程可能是一个有趣的爱好,正如我以前在 Apple II 计算机上编程时所学到的…… + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/dozen-ways-learn-python + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_screen_display.jpg?itok=2HMTzqz0 (Code on a screen) +[2]: https://insights.stackoverflow.com/survey/2019#most-popular-technologies +[3]: https://www.python.org/ +[4]: https://www.python.org/about/gettingstarted/ +[5]: https://docs.python.org/3/ +[6]: https://opensource.com/life/15/8/python-turtle-graphics +[7]: https://opensource.com/education/15/9/review-bryson-payne-teach-your-kids-code +[8]: https://www.udemy.com/teach-your-kids-to-code/ +[9]: https://automatetheboringstuff.com/ +[10]: https://www.udemy.com/automate/?couponCode=PAY_10_DOLLARS +[11]: https://nostarch.com/pythoncrashcourse2e +[12]: https://ehmatthes.github.io/pcc/ +[13]: https://ehmatthes.github.io/pcc/cheatsheets/README.html +[14]: https://www.py4e.com/ +[15]: http://www.dr-chuck.com/dr-chuck/resume/bio.htm +[16]: https://twitter.com/drchuck/ +[17]: https://opensource.com/users/seth +[18]: https://linux.cn/article-11133-1.html +[19]: https://opensource.com/article/19/7/get-modular-python-classes +[20]: https://linux.cn/article-10902-1.html +[21]: https://opensource.com/article/19/7/circuit-playground-express +[22]: https://circuitpython.org/ +[23]: https://learn.adafruit.com/welcome-to-circuitpython +[24]: https://opensource.com/article/19/8/getting-started-bbc-microbit +[25]: https://micropython.org/ +[26]: https://www.raspberrypi.org/ +[27]: https://projects.raspberrypi.org/en/pathways/getting-started-with-raspberry-pi +[28]: https://opensource.com/sitewide-search?search_api_views_fulltext=Raspberry%20Pi +[29]: https://opensource.com/article/19/3/raspberry-pi-projects +[30]: https://opensource.com/article/19/3/amiga-raspberry-pi +[31]: https://opensource.com/article/19/6/raspberry-pi-vpn-server +[32]: https://trinket.io/ +[33]: https://docs.trinket.io/getting-started-with-python#/welcome/where-we-ll-go +[34]: https://www.teachingpython.fm/ +[35]: https://talkpython.fm/ diff --git a/published/201908/20190830 11 surprising ways you use Linux every day.md b/published/201908/20190830 11 surprising ways you use Linux every day.md new file mode 100644 index 0000000000..df3bfb043b --- /dev/null +++ b/published/201908/20190830 11 surprising ways you use Linux every day.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11289-1.html) +[#]: subject: (11 surprising ways you use Linux every day) +[#]: via: (https://opensource.com/article/19/8/everyday-tech-runs-linux) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +你可能意识不到的使用 Linux 的 11 种方式 +====== + +> 什么技术运行在 Linux 上?你可能会惊讶于日常生活中使用 Linux 的频率。 + +![](https://img.linux.net.cn/data/attachment/album/201909/01/000003dsqf45rbavr5vzja.jpg) + +现在 Linux 几乎可以运行每样东西,但很多人都没有意识到这一点。有些人可能知道 Linux,可能听说过超级计算机运行着这个操作系统。根据 [Top500][2],Linux 现在驱动着世界上最快的 500 台计算机。你可以转到他们的网站并[搜索“Linux”][3]自己查看一下结果。 + +### NASA 运行在 Linux 之上 + +你可能不知道 Linux 为 NASA(美国国家航空航天局)提供支持。NASA 的 [Pleiades][4] 超级计算机运行着 Linux。由于操作系统的可靠性,国际空间站六年前[从 Windows 切换到了 Linux][5]。NASA 甚至最近给国际空间站部署了三台[运行着 Linux][6] 的“Astrobee”机器人。 + +### 电子书运行在 Linux 之上 + +我读了很多书,我的首选设备是亚马逊 Kindle Paperwhite,它运行 Linux(虽然大多数人完全没有意识到这一点)。如果你使用亚马逊的任何服务,从[亚马逊弹性计算云(Amazon EC2)][7] 到 Fire TV,你就是在 Linux 上运行。当你问 Alexa 现在是什么时候,或者你最喜欢的运动队得分时,你也在使用 Linux,因为 Alexa 由 [Fire OS][8](基于 Android 的操作系统)提供支持。实际上,[Android][9] 是由谷歌开发的用于移动手持设备的 Linux,而且占据了当今移动电话的[76% 的市场][10]。 + +### 电视运行在 Linux 之上 + +如果你有一台 [TiVo][11],那么你也在运行 Linux。如果你是 Roku 用户,那么你也在使用 Linux。[Roku OS][12] 是专为 Roku 设备定制的 Linux 版本。你可以选择使用在 Linux 上运行的 Chromecast 看流媒体。不过,Linux 不只是为机顶盒和流媒体设备提供支持。它也可能运行着你的智能电视。LG 使用 webOS,它是基于 Linux 内核的。Panasonic 使用 Firefox OS,它也是基于 Linux 内核的。三星、菲利普斯以及更多厂商都使用基于 Linux 的操作系统支持其设备。 + +### 智能手表和平板电脑运行在 Linux 之上 + +如果你拥有智能手表,它可能正在运行 Linux。世界各地的学校系统一直在实施[一对一系统][13],让每个孩子都有自己的笔记本电脑。越来越多的机构为学生配备了 Chromebook。这些轻巧的笔记本电脑使用 [Chrome OS][14],它基于 Linux。 + +### 汽车运行在 Linux 之上 + +你驾驶的汽车可能正在运行 Linux。 [汽车级 Linux(AGL)][15] 是一个将 Linux 视为汽车标准代码库的项目,它列入了丰田、马自达、梅赛德斯-奔驰和大众等汽车制造商。你的[车载信息娱乐(IVI)][16]系统也可能运行 Linux。[GENIVI 联盟][17]在其网站称,它开发了“用于集成在集中连接的车辆驾驶舱中的操作系统和中间件的标准方法”。 + +### 游戏运行在 Linux 之上 + +如果你是游戏玩家,那么你可能正在使用 [SteamOS][18],这是一个基于 Linux 的操作系统。此外,如果你使用 Google 的众多服务,那么你也运行在 Linux上。 + +### 社交媒体运行在 Linux 之上 + +当你刷屏和评论时,你可能会意识到这些平台正在做的很多工作。也许 Instagram、Facebook、YouTube 和 Twitter 都在 Linux 上运行并不令人惊讶。 + +此外,社交媒体的新浪潮,去中心化的联合社区的联盟节点,如 [Mastodon][19]、[GNU Social][20]、[Nextcloud][21](类似 Twitter 的微博平台)、[Pixelfed][22](分布式照片共享)和[Peertube][23](分布式视频共享)至少默认情况下在 Linux 上运行。由于开源,它们可以在任何平台上运行,这本身就是一个强大的优先级。 + +### 商业和政务运行在 Linux 之上 + +与五角大楼一样,纽约证券交易所也在 Linux 上运行。美国联邦航空管理局每年处理超过 1600 万次航班,他们在 Linux 上运营。美国国会图书馆、众议院、参议院和白宫都使用 Linux。 + +### 零售运行在 Linux 之上 + +最新航班座位上的娱乐系统很可能在 Linux 上运行。你最喜欢的商店的 POS 机可能正运行在 Linux 上。基于 Linux 的 [Tizen OS][24] 为智能家居和其他智能设备提供支持。许多公共图书馆现在在 [Evergreen][25] 和 [Koha][26] 上托管他们的综合图书馆系统。这两个系统都在 Linux 上运行。 + +### Apple 运行在 Linux 之上 + +如果你是使用 [iCloud][27] 的 iOS 用户,那么你也在使用运行在 Linux 上的系统。Apple 公司的网站在 Linux 上运行。如果你想知道在 Linux 上运行的其他网站,请务必使用 [Netcraft][28] 并检查“该网站运行在什么之上?”的结果。 + +### 路由器运行在 Linux 之上 + +在你家里将你连接到互联网的路由器可能正运行在 Linux 上。如果你当前的路由器没有运行 Linux 而你想改变它,那么这里有一个[优秀的方法][29]。 + +如你所见,Linux 从许多方面为今天的世界提供动力。还有什么运行在 Linux 之上的东西是人们还没有意识到的?请让我们在评论中知道。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/everyday-tech-runs-linux + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/truck_steering_wheel_drive_car_kubernetes.jpg?itok=0TOzve80 (Truck steering wheel and dash) +[2]: https://www.top500.org/ +[3]: https://www.top500.org/statistics/sublist/ +[4]: https://www.nas.nasa.gov/hecc/resources/pleiades.html +[5]: https://www.extremetech.com/extreme/155392-international-space-station-switches-from-windows-to-linux-for-improved-reliability +[6]: https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20180003515.pdf +[7]: https://aws.amazon.com/amazon-linux-ami/ +[8]: https://en.wikipedia.org/wiki/Fire_OS +[9]: https://en.wikipedia.org/wiki/Android_(operating_system) +[10]: https://gs.statcounter.com/os-market-share/mobile/worldwide/ +[11]: https://tivo.pactsafe.io/legal.html#open-source-software +[12]: https://en.wikipedia.org/wiki/Roku +[13]: https://en.wikipedia.org/wiki/One-to-one_computing +[14]: https://en.wikipedia.org/wiki/Chrome_OS +[15]: https://opensource.com/life/16/8/agl-provides-common-open-code-base +[16]: https://opensource.com/business/16/5/interview-alison-chaiken-steven-crumb +[17]: https://www.genivi.org/faq +[18]: https://store.steampowered.com/steamos/ +[19]: https://opensource.com/article/17/4/guide-to-mastodon +[20]: https://www.gnu.org/software/social/ +[21]: https://apps.nextcloud.com/apps/social +[22]: https://pixelfed.org/ +[23]: https://joinpeertube.org/en/ +[24]: https://wiki.tizen.org/Devices +[25]: https://evergreen-ils.org/ +[26]: https://koha-community.org/ +[27]: https://toolbar.netcraft.com/site_report?url=https://www.icloud.com/ +[28]: https://www.netcraft.com/ +[29]: https://opensource.com/life/16/6/why-i-built-my-own-linux-router diff --git a/published/20190805 Is your enterprise software committing security malpractice.md b/published/20190805 Is your enterprise software committing security malpractice.md new file mode 100644 index 0000000000..8418098906 --- /dev/null +++ b/published/20190805 Is your enterprise software committing security malpractice.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11305-1.html) +[#]: subject: (Is your enterprise software committing security malpractice?) +[#]: via: (https://www.networkworld.com/article/3429559/is-your-enterprise-software-committing-security-malpractice.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +你的企业安全软件是否在背后偷传数据? +====== + +> ExtraHop 发现一些企业安全和分析软件正在“私下回拨”,悄悄地将信息上传到客户网络外的服务器上。 + +![Getty Images][1] + +当这个博客专注于微软的一切事情时,我常常抱怨、反对 Windows 10 的间谍活动方面。嗯,显然,这些跟企业安全、分析和硬件管理工具所做的相比,都不算什么。 + +一家叫做 ExtraHop 的分析公司检查了其客户的网络,并发现客户的安全和分析软件悄悄地将信息上传到客户网络外的服务器上。这家公司上周发布了一份[报告来进行警示][2]。 + +ExtraHop 特意选择不对这四个例子中的企业安全工具进行点名,这些工具在没有警告用户或使用者的情况发送了数据。这家公司的一位发言人通过电子邮件告诉我,“ExtraHop 希望关注报告的这个趋势,我们已经多次观察到了这种令人担心的情况。这个严重的问题需要企业的更多关注,而只是关注几个特定的软件会削弱这个严重的问题需要得到更多关注的观点。” + +### 产品在安全提交传输方面玩忽职守,并且偷偷地传输数据到异地 + +[ExtraHop 的报告][6]中称发现了一系列的产品在偷偷地传输数据回自己的服务器上,包括终端安全软件、医院设备管理软件、监控摄像头、金融机构使用的安全分析软件等。报告中同样指出,这些应用涉嫌违反了欧洲的[通用数据隐私法规(GDPR)][7]。 + +在每个案例里,ExtraHop 都提供了这些软件传输数据到异地的证据,在其中一个案例中,一家公司注意到,大约每隔 30 分钟,一台连接了网络的设备就会发送 UDP 数据包给一个已知的恶意 IP 地址。有问题的是一台某国制造的安全摄像头,这个摄像头正在偷偷联系一个和某国有联系的已知的恶意 IP 地址。 + +该摄像头很可能由其办公室的一名员工出于其个人安全的用途独自设置的,这显示出影子 IT 的缺陷。 + +而对于医院设备的管理工具和金融公司的分析工具,这些工具违反了数据安全法,公司面临着法律风险——即使公司不知道这个事。 + +该医院的医疗设备管理产品应该只使用医院的 WiFi 网络,以此来确保患者的数据隐私和 HIPAA 合规。ExtraHop 注意到管理初始设备部署的工作站正在打开加密的 ssl:443 来连接到供应商自己的云存储服务器,这是一个重要的 HIPAA 违规。 + +ExtraHop 指出,尽管这些例子中可能没有任何恶意活动。但它仍然违反了法律规定,管理员需要密切关注他们的网络,以此来监视异常活动的流量。 + +“要明确的是,我们不知道供应商为什么要把数据偷偷传回自己的服务器。这些公司都是受人尊敬的安全和 IT 供应商,并且很有可能,这些数据是由他们的程序框架设计用于合法目的的,或者是错误配置的结果”,报告中说。 + +### 如何减轻数据外传的安全风险 + +为了解决这种安全方面玩忽职守的问题,ExtraHop 建议公司做下面这五件事: + +* 监视供应商的活动:在你的网络上密切注意供应商的非正常活动,无论他们是活跃供应商、以前的供应商,还是评估后的供应商。 +* 监控出口流量:了解出口流量,尤其是来自域控制器等敏感资产的出口流量。当检测到出口流量时,始终将其与核准的应用程序和服务进行匹配。 +* 跟踪部署:在评估过程中,跟踪软件代理的部署。 +* 理解监管方面的考量因素:了解数据跨越政治、地理边界的监管和合规考量因素。 +* 理解合同协议:跟踪数据的使用是否符合供应商合同上的协议。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3429559/is-your-enterprise-software-committing-security-malpractice.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[wxy](https://github.com/wxy) + +本文由 [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://images.idgesg.net/images/article/2018/03/cybersecurity_eye-with-binary_face-recognition_abstract-eye-100751589-large.jpg +[2]: https://www.extrahop.com/company/press-releases/2019/extrahop-issues-warning-about-phoning-home/ +[3]: https://www.networkworld.com/article/3254185/internet-of-things/tips-for-securing-iot-on-your-network.html#nww-fsb +[4]: https://www.networkworld.com/article/3269184/10-best-practices-to-minimize-iot-security-vulnerabilities#nww-fsb +[5]: https://www.networkworld.com/newsletters/signup.html#nww-fsb +[6]: https://www.extrahop.com/resources/whitepapers/eh-security-advisory-calling-home-success/ +[7]: https://www.csoonline.com/article/3202771/general-data-protection-regulation-gdpr-requirements-deadlines-and-facts.html +[8]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[9]: https://www.networkworld.com/article/3269165/internet-of-things/a-corporate-guide-to-addressing-iot-security-concerns.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/published/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md b/published/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md new file mode 100644 index 0000000000..20ea79975d --- /dev/null +++ b/published/20190810 How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina).md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11298-1.html) +[#]: subject: (How to Upgrade Linux Mint 19.1 (Tessa) to Linux Mint 19.2 (Tina)?) +[#]: via: (https://www.2daygeek.com/upgrade-linux-mint-19-1-tessa-to-linux-mint-19-2-tina/) +[#]: author: (2daygeek http://www.2daygeek.com/author/2daygeek/) + +如何升级 Linux Mint 19.1 为 Linux Mint 19.2 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/02/231523na40npunm88z68ka.jpg) + +Linux Mint 19.2 “Tina” 在 2019 年 8 月 2 日发布,它是一个基于 Ubuntu 18.04 LTS (Bionic Beaver) 的长期支持版本。它将被支持到 2023 年。它带来更新的软件和精细的改进和很多新的特色来使你的桌面使用地更舒适。 + +Linux Mint 19.2 特色有 Cinnamon 4.2 、Linux 内核 4.15 和 Ubuntu 18.04 基础软件包。 + +**注意:** 不要忘记备份你的重要数据。如果一些东西出错,在最新的安装后,你可以从备份中恢复数据。 + +备份可以通过 rsnapshot 或 timeshift 完成。 + +Linux Mint 19.2 “Tina” 发布日志可以在下面的链接中找到。 + +* [Linux Mint 19.2 (Tina) 发布日志][1] + +这里有三种方法,能让我们升级为 Linux Mint 19.2 “Tina”。 + + * 使用本地方法升级 Linux Mint 19.2 (Tina) + * 使用 Mintupgrade 实用程序方法升级 Linux Mint 19.2 (Tina) + * 使用 GUI 升级 Linux Mint 19.2 (Tina) + +### 如何从 Linux Mint 19.1 (Tessa) 升级为 Linux Mint 19.2 (Tina)? + +升级 Linux Mint 系统是一项简单轻松的任务。有三种方法可以完成。 + +### 方法-1:使用本地方法升级 Linux Mint 19.2 (Tina) + +这是执行升级 Linux Mint 系统的本地和标准的方法之一。为做到这点,遵循下面的程序步骤。 + +确保你当前 Linux Mint 系统是最新的。使用下面的命令来更新你现在的软件为最新可用版本。 + +#### 步骤-1: + +通过运行下面的命令来刷新存储库索引。 + +``` +$ sudo apt update +``` + +运行下面的命令来在系统上安装可用的更新。 + +``` +$ sudo apt upgrade +``` + +运行下面的命令来在版本中执行可用的次要更新。 + +``` +$ sudo apt full-upgrade +``` + +默认情况下,它将通过上面的命令来移除过时的软件包。但是,我建议你运行下面的命令。 + +``` +$ sudo apt autoremove +$ sudo apt clean +``` + +如果安装一个新的内核,你可能需要重启系统。如果是这样,运行下面的命令。 + +``` +$ sudo shutdown -r now +``` + +最后检查当前安装的版本。 + +``` +$ lsb_release -a + +No LSB modules are available. +Distributor ID: Linux Mint +Description: Linux Mint 19.1 (Tessa) +Release: 19.1 +Codename: Tessa +``` + +#### 步骤-2:更新/修改 /etc/apt/sources.list 文件 + +在重启后,修改 `sources.list` 文件,并从 Linux Mint 19.1 (Tessa) 指向 Linux Mint 19.2 (Tina)。 + +首先,使用 `cp` 命令备份下面的配置文件。 + +``` +$ sudo cp /etc/apt/sources.list /root +$ sudo cp -r /etc/apt/sources.list.d/ /root +``` + +修改 `sources.list` 文件,并指向 Linux Mint 19.2 (Tina)。 + +``` +$ sudo sed -i 's/tessa/tina/g' /etc/apt/sources.list +$ sudo sed -i 's/tessa/tina/g' /etc/apt/sources.list.d/* +``` + +通过运行下面的命令来刷新存储库索引。 + +``` +$ sudo apt update +``` + +运行下面的命令来在系统上安装可用的更新。在升级过程中,你可用需要确认服务重启和配置文件替换,因此,只需遵循屏幕上的指令。 + +升级可能花费一些时间,具体依赖于更新的数量和你的网络速度。 + +``` +$ sudo apt upgrade +``` + +运行下面的命令来执行一次完整的系统升级。 + +``` +$ sudo apt full-upgrade +``` + +默认情况下,上面的命令将移除过时的软件包。但是,我建议你再次运行下面的命令。 + +``` +$ sudo apt autoremove +$ sudo apt clean +``` + +最后重启系统来启动 Linux Mint 19.2 (Tina)。 + +``` +$ sudo shutdown -r now +``` + +升级后的 Linux Mint 版本可以通过运行下面的命令验证。 + +``` +$ lsb_release -a + +No LSB modules are available. +Distributor ID: Linux Mint +Description: Linux Mint 19.2 (Tina) +Release: 19.2 +Codename: Tina +``` + +### 方法-2:使用 Mintupgrade 实用程序升级 Linux Mint 19.2 (Tina) + +这是 Mint 官方实用程序,它允许我们对 Linux Mint 系统执行平滑升级。 + +使用下面的命令来安装 mintupgrade 软件包。 + +``` +$ sudo apt install mintupgrade +``` + +确保你已经安装 mintupgrade 软件包的最新版本。 + +``` +$ apt version mintupgrade +``` + +以一个普通用户来运行下面的命令以模拟一次升级,遵循屏幕上的指令。 + +``` +$ mintupgrade check +``` + +使用下面的命令来下载需要的软件包来升级为 Linux Mint 19.2 (Tina) ,遵循屏幕上的指令。 + +``` +$ mintupgrade download +``` + +运行下面的命令来运用升级,最新屏幕上的指令。 + +``` +$ mintupgrade upgrade +``` + +在成功升级后,重启系统,并检查升级后的版本。 + +``` +$ lsb_release -a + +No LSB modules are available. +Distributor ID: Linux Mint +Description: Linux Mint 19.2 (Tina) +Release: 19.2 +Codename: Tina +``` + +### 方法-3:使用 GUI 升级 Linux Mint 19.2 (Tina) + +或者,我们可以通过 GUI 执行升级。 + +#### 步骤-1: + +通过 Timeshift 创建一个系统快照。如果一些东西出错,你可以简单地恢复你的操作系统到它先前状态。 + +#### 步骤-2: + +打开更新管理器,单击刷新按钮来检查 mintupdate 和 mint-upgrade-info 的任何新版本。如果有这些软件包的更新,应用它们。 + +通过单击 “编辑-> 升级到 Linux Mint 19.2 Tina”来启动系统升级。 + +![][3] + +遵循屏幕上的指令。如果被询问是否保留或替换配置文件,选择替换它们。 + +![][4] + +#### 步骤-3: + +在升级完成后,重启你的电脑。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/upgrade-linux-mint-19-1-tessa-to-linux-mint-19-2-tina/ + +作者:[2daygeek][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.2daygeek.com/author/2daygeek/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechnews.com/linux-mint-19-2-tina-released-check-what-is-new-feature/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/08/linux-mint-19-2-tina-mintupgrade.png +[4]: https://www.2daygeek.com/wp-content/uploads/2019/08/linux-mint-19-2-tina-mintupgrade-1.png diff --git a/published/20190812 Why const Doesn-t Make C Code Faster.md b/published/20190812 Why const Doesn-t Make C Code Faster.md new file mode 100644 index 0000000000..852b62f0c7 --- /dev/null +++ b/published/20190812 Why const Doesn-t Make C Code Faster.md @@ -0,0 +1,404 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11339-1.html) +[#]: subject: (Why const Doesn't Make C Code Faster) +[#]: via: (https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +为什么 const 无法让 C 代码跑得更快? +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/14/181535lsrt9t93k1c1n0mt.jpg) + +在几个月前的一篇文章里,我曾说过“[有个一个流行的传言,`const` 有助于编译器优化 C 和 C++ 代码][1]”。我觉得我需要解释一下,尤其是曾经我自己也以为这是显然对的。我将会用一些理论并构造一些例子来论证,然后在一个真实的代码库 `Sqlite` 上做一些实验和基准测试。 + +### 一个简单的测试 + +让我们从一个最简单、最明显的例子开始,以前认为这是一个 `const` 让 C 代码跑得更快的例子。首先,假设我们有如下两个函数声明: + +``` +void func(int *x); +void constFunc(const int *x); +``` + +然后假设我们如下两份代码: + +``` +void byArg(int *x) +{ + printf("%d\n", *x); + func(x); + printf("%d\n", *x); +} + +void constByArg(const int *x) +{ + printf("%d\n", *x); + constFunc(x); + printf("%d\n", *x); +} +``` + +调用 `printf()` 时,CPU 会通过指针从 RAM 中取得 `*x` 的值。很显然,`constByArg()` 会稍微快一点,因为编译器知道 `*x` 是常量,因此不需要在调用 `constFunc()` 之后再次获取它的值。它仅是打印相同的东西。没问题吧?让我们来看下 GCC 在如下编译选项下生成的汇编代码: + +``` +$ gcc -S -Wall -O3 test.c +$ view test.s +``` + +以下是函数 `byArg()` 的完整汇编代码: + +``` +byArg: +.LFB23: + .cfi_startproc + pushq %rbx + .cfi_def_cfa_offset 16 + .cfi_offset 3, -16 + movl (%rdi), %edx + movq %rdi, %rbx + leaq .LC0(%rip), %rsi + movl $1, %edi + xorl %eax, %eax + call __printf_chk@PLT + movq %rbx, %rdi + call func@PLT # constFoo 中唯一不同的指令 + movl (%rbx), %edx + leaq .LC0(%rip), %rsi + xorl %eax, %eax + movl $1, %edi + popq %rbx + .cfi_def_cfa_offset 8 + jmp __printf_chk@PLT + .cfi_endproc +``` + +函数 `byArg()` 和函数 `constByArg()` 生成的汇编代码中唯一的不同之处是 `constByArg()` 有一句汇编代码 `call constFunc@PLT`,这正是源代码中的调用。关键字 `const` 本身并没有造成任何字面上的不同。 + +好了,这是 GCC 的结果。或许我们需要一个更聪明的编译器。Clang 会有更好的表现吗? + +``` +$ clang -S -Wall -O3 -emit-llvm test.c +$ view test.ll +``` + +这是 `IR` 代码(LCTT 译注:LLVM 的中间语言)。它比汇编代码更加紧凑,所以我可以把两个函数都导出来,让你可以看清楚我所说的“除了调用外,没有任何字面上的不同”是什么意思: + +``` +; Function Attrs: nounwind uwtable +define dso_local void @byArg(i32*) local_unnamed_addr #0 { + %2 = load i32, i32* %0, align 4, !tbaa !2 + %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2) + tail call void @func(i32* %0) #4 + %4 = load i32, i32* %0, align 4, !tbaa !2 + %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) + ret void +} + +; Function Attrs: nounwind uwtable +define dso_local void @constByArg(i32*) local_unnamed_addr #0 { + %2 = load i32, i32* %0, align 4, !tbaa !2 + %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2) + tail call void @constFunc(i32* %0) #4 + %4 = load i32, i32* %0, align 4, !tbaa !2 + %5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) + ret void +} +``` + +### 某些有作用的东西 + +接下来是一组 `const` 能够真正产生作用的代码: + +``` +void localVar() +{ + int x = 42; + printf("%d\n", x); + constFunc(&x); + printf("%d\n", x); +} + +void constLocalVar() +{ + const int x = 42; // 对本地变量使用 const + printf("%d\n", x); + constFunc(&x); + printf("%d\n", x); +} +``` + +下面是 `localVar()` 的汇编代码,其中有两条指令在 `constLocalVar()` 中会被优化掉: + +``` +localVar: +.LFB25: + .cfi_startproc + subq $24, %rsp + .cfi_def_cfa_offset 32 + movl $42, %edx + movl $1, %edi + movq %fs:40, %rax + movq %rax, 8(%rsp) + xorl %eax, %eax + leaq .LC0(%rip), %rsi + movl $42, 4(%rsp) + call __printf_chk@PLT + leaq 4(%rsp), %rdi + call constFunc@PLT + movl 4(%rsp), %edx # 在 constLocalVar() 中没有 + xorl %eax, %eax + movl $1, %edi + leaq .LC0(%rip), %rsi # 在 constLocalVar() 中没有 + call __printf_chk@PLT + movq 8(%rsp), %rax + xorq %fs:40, %rax + jne .L9 + addq $24, %rsp + .cfi_remember_state + .cfi_def_cfa_offset 8 + ret +.L9: + .cfi_restore_state + call __stack_chk_fail@PLT + .cfi_endproc +``` + +在 LLVM 生成的 `IR` 代码中更明显一点。在 `constLocalVar()` 中,第二次调用 `printf()` 之前的 `load` 会被优化掉: + +``` +; Function Attrs: nounwind uwtable +define dso_local void @localVar() local_unnamed_addr #0 { + %1 = alloca i32, align 4 + %2 = bitcast i32* %1 to i8* + call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2) #4 + store i32 42, i32* %1, align 4, !tbaa !2 + %3 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 42) + call void @constFunc(i32* nonnull %1) #4 + %4 = load i32, i32* %1, align 4, !tbaa !2 + %5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4) + call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2) #4 + ret void +} +``` + +好吧,现在,`constLocalVar()` 成功的省略了对 `*x` 的重新读取,但是可能你已经注意到一些问题:`localVar()` 和 `constLocalVar()` 在函数体中做了同样的 `constFunc()` 调用。如果编译器能够推断出 `constFunc()` 没有修改 `constLocalVar()` 中的 `*x`,那为什么不能推断出完全一样的函数调用也没有修改 `localVar()` 中的 `*x`? + +这个解释更贴近于为什么 C 语言的 `const` 不能作为优化手段的核心原因。C 语言的 `const` 有两个有效的含义:它可以表示这个变量是某个可能是常数也可能不是常数的数据的一个只读别名,或者它可以表示该变量是真正的常量。如果你移除了一个指向常量的指针的 `const` 属性并写入数据,那结果将是一个未定义行为。另一方面,如果是一个指向非常量值的 `const` 指针,将就没问题。 + +这份 `constFunc()` 的可能实现揭示了这意味着什么: + +``` +// x 是一个指向某个可能是常数也可能不是常数的数据的只读指针 +void constFunc(const int *x) +{ + // local_var 是一个真正的常数 + const int local_var = 42; + + // C 语言规定的未定义行为 + doubleIt((int*)&local_var); + // 谁知道这是不是一个未定义行为呢? + doubleIt((int*)x); +} + +void doubleIt(int *x) +{ + *x *= 2; +} +``` + +`localVar()` 传递给 `constFunc()` 一个指向非 `const` 变量的 `const` 指针。因为这个变量并非常量,`constFunc()` 可以撒个谎并强行修改它而不触发未定义行为。所以,编译器不能断定变量在调用 `constFunc()` 后仍是同样的值。在 `constLocalVar()` 中的变量是真正的常量,因此,编译器可以断定它不会改变 —— 因为在 `constFunc()` 去除变量的 `const` 属性并写入它*将*会是一个未定义行为。 + +第一个例子中的函数 `byArg()` 和 `constByArg()` 是没有可能优化的,因为编译器没有任何方法能知道 `*x` 是否真的是 `const` 常量。 + +> 补充(和题外话):相当多的读者已经正确地指出,使用 `const int *x`,该指针本身不是限定的常量,只是该数据被加个了别名,而 `const int * const extra_const` 是一个“双向”限定为常量的指针。但是因为指针本身的常量与别名数据的常量无关,所以结果是相同的。仅在 `extra_const` 指向使用 `const` 定义的对象时,`*(int*const)extra_const = 0` 才是未定义行为。(实际上,`*(int*)extra_const = 0` 也不会更糟。)因为它们之间的区别可以一句话说明白,一个是完全的 `const` 指针,另外一个可能是也可能不是常量本身的指针,而是一个可能是也可能不是常量的对象的只读别名,我将继续不严谨地引用“常量指针”。(题外话结束) + +但是为什么不一致呢?如果编译器能够推断出 `constLocalVar()` 中调用的 `constFunc()` 不会修改它的参数,那么肯定也能继续在其他 `constFunc()` 的调用上实施相同的优化,是吗?并不。编译器不能假设 `constLocalVar()` 根本没有运行。如果不是这样(例如,它只是代码生成器或者宏的一些未使用的额外输出),`constFunc()` 就能偷偷地修改数据而不触发未定义行为。 + +你可能需要重复阅读几次上述说明和示例,但不要担心,它听起来很荒谬,它确实是正确的。不幸的是,对 `const` 变量进行写入是最糟糕的未定义行为:大多数情况下,编译器无法知道它是否将会是未定义行为。所以,大多数情况下,编译器看见 `const` 时必须假设它未来可能会被移除掉,这意味着编译器不能使用它进行优化。这在实践中是正确的,因为真实的 C 代码会在“深思熟虑”后移除 `const`。 + +简而言之,很多事情都可以阻止编译器使用 `const` 进行优化,包括使用指针从另一内存空间接受数据,或者在堆空间上分配数据。更糟糕的是,在大部分编译器能够使用 `const` 进行优化的情况,它都不是必须的。例如,任何像样的编译器都能推断出下面代码中的 `x` 是一个常量,甚至都不需要 `const`: + +``` +int x = 42, y = 0; +printf("%d %d\n", x, y); +y += x; +printf("%d %d\n", x, y); +``` + +总结,`const` 对优化而言几乎无用,因为: + +1. 除了特殊情况,编译器需要忽略它,因为其他代码可能合法地移除它 +2. 在 #1 以外的大多数例外中,编译器无论如何都能推断出该变量是常量 + +### C++ + +如果你在使用 C++ 那么有另外一个方法让 `const` 能够影响到代码的生成:函数重载。你可以用 `const` 和非 `const` 的参数重载同一个函数,而非 `const` 版本的代码可能可以被优化(由程序员优化而不是编译器),减少某些拷贝或者其他事情。 + +``` +void foo(int *p) +{ + // 需要做更多的数据拷贝 +} + +void foo(const int *p) +{ + // 不需要保护性的拷贝副本 +} + +int main() +{ + const int x = 42; + // const 影响被调用的是哪一个版本的重载函数 + foo(&x); + return 0; +} +``` + +一方面,我不认为这会在实际的 C++ 代码中大量使用。另一方面,为了导致差异,程序员需要假设编译器无法做出,因为它们不受语言保护。 + +### 用 Sqlite3 进行实验 + +有了足够的理论和例子。那么 `const` 在一个真正的代码库中有多大的影响呢?我将会在代码库 `Sqlite`(版本:3.30.0)上做一个测试,因为: + +* 它真正地使用了 `const` +* 它不是一个简单的代码库(超过 20 万行代码) +* 作为一个数据库,它包括了字符串处理、数学计算、日期处理等一系列内容 +* 它能够在绑定 CPU 的情况下进行负载测试 + +此外,作者和贡献者们已经进行了多年的性能优化工作,因此我能确定他们没有错过任何有显著效果的优化。 + +#### 配置 + +我做了两份[源码][2]拷贝,并且正常编译其中一份。而对于另一份拷贝,我插入了这个特殊的预处理代码段,将 `const` 变成一个空操作: + +``` +#define const +``` + +(GNU) `sed` 可以将一些东西添加到每个文件的顶端,比如 `sed -i '1i#define const' *.c *.h`。 + +在编译期间使用脚本生成 `Sqlite` 代码稍微有点复杂。幸运的是当 `const` 代码和非 `const` 代码混合时,编译器会产生了大量的提醒,因此很容易发现它并调整脚本来包含我的反 `const` 代码段。 + +直接比较编译结果毫无意义,因为任意微小的改变就会影响整个内存布局,这可能会改变整个代码中的指针和函数调用。因此,我用每个指令的二进制大小和汇编代码作为识别码(`objdump -d libsqlite3.so.0.8.6`)。举个例子,这个函数: + +``` +000000000005d570 : + 5d570: 4c 8d 05 59 a2 ff ff lea -0x5da7(%rip),%r8 # 577d0 + 5d577: e9 04 fe ff ff jmpq 5d380 + 5d57c: 0f 1f 40 00 nopl 0x0(%rax) +``` + +将会变成这样: + +``` +sqlite3_blob_read 7lea 5jmpq 4nopl +``` + +在编译时,我保留了所有 `Sqlite` 的编译设置。 + +#### 分析编译结果 + +`const` 版本的 `libsqlite3.so` 的大小是 4,740,704 字节,大约比 4,736,712 字节的非 `const` 版本大了 0.1% 。在全部 1374 个导出函数(不包括类似 PLT 里的底层辅助函数)中,一共有 13 个函数的识别码不一致。 + +其中的一些改变是由于插入的预处理代码。举个例子,这里有一个发生了更改的函数(已经删去一些 `Sqlite` 特有的定义): + +``` +#define LARGEST_INT64 (0xffffffff|(((int64_t)0x7fffffff)<<32)) +#define SMALLEST_INT64 (((int64_t)-1) - LARGEST_INT64) + +static int64_t doubleToInt64(double r){ + /* + ** Many compilers we encounter do not define constants for the + ** minimum and maximum 64-bit integers, or they define them + ** inconsistently. And many do not understand the "LL" notation. + ** So we define our own static constants here using nothing + ** larger than a 32-bit integer constant. + */ + static const int64_t maxInt = LARGEST_INT64; + static const int64_t minInt = SMALLEST_INT64; + + if( r<=(double)minInt ){ + return minInt; + }else if( r>=(double)maxInt ){ + return maxInt; + }else{ + return (int64_t)r; + } +} +``` + +删去 `const` 使得这些常量变成了 `static` 变量。我不明白为什么会有不了解 `const` 的人让这些变量加上 `static`。同时删去 `static` 和 `const` 会让 GCC 再次认为它们是常量,而我们将得到同样的编译输出。由于类似这样的局部的 `static const` 变量,使得 13 个函数中有 3 个函数产生假的变化,但我一个都不打算修复它们。 + +`Sqlite` 使用了很多全局变量,而这正是大多数真正的 `const` 优化产生的地方。通常情况下,它们类似于将一个变量比较代替成一个常量比较,或者一个循环在部分展开的一步。([Radare toolkit][3] 可以很方便的找出这些优化措施。)一些变化则令人失望。`sqlite3ParseUri()` 有 487 个指令,但 `const` 产生的唯一区别是进行了这个比较: + +``` +test %al, %al +je +cmp $0x23, %al +je +``` + +并交换了它们的顺序: + +``` +cmp $0x23, %al +je +test %al, %al +je +``` + +#### 基准测试 + +`Sqlite` 自带了一个性能回归测试,因此我尝试每个版本的代码执行一百次,仍然使用默认的 `Sqlite` 编译设置。以秒为单位的测试结果如下: + +| | const | 非 const +---|---|--- +最小值 | 10.658s | 10.803s +中间值 | 11.571s | 11.519s +最大值 | 11.832s | 11.658s +平均值 | 11.531s | 11.492s + +就我个人看来,我没有发现足够的证据来说明这个差异值得关注。我是说,我从整个程序中删去 `const`,所以如果它有明显的差别,那么我希望它是显而易见的。但也许你关心任何微小的差异,因为你正在做一些绝对性能非常重要的事。那让我们试一下统计分析。 + +我喜欢使用类似 Mann-Whitney U 检验这样的东西。它类似于更著名的 T 检验,但对你在机器上计时时产生的复杂随机变量(由于不可预测的上下文切换、页错误等)更加健壮。以下是结果: + +|| const | 非 const| +---|---|--- +N | 100 | 100 +Mean rank | 121.38 | 79.62 + +||| +---|--- +Mann-Whitney U | 2912 +Z | -5.10 +2-sided p value | <10-6 +HL median difference | -0.056s +95% confidence interval | -0.077s – -0.038s + +U 检验已经发现统计意义上具有显著的性能差异。但是,令人惊讶的是,实际上是非 `const` 版本更快——大约 60ms,0.5%。似乎 `const` 启用的少量“优化”不值得额外代码的开销。这不像是 `const` 启用了任何类似于自动矢量化的重要的优化。当然,你的结果可能因为编译器配置、编译器版本或者代码库等等而有所不同,但是我觉得这已经说明了 `const` 是否能够有效地提高 `C` 的性能,我们现在已经看到答案了。 + +### 那么,const 有什么用呢? + +尽管存在缺陷,C/C++ 的 `const` 仍有助于类型安全。特别是,结合 C++ 的移动语义和 `std::unique_pointer`,`const` 可以使指针所有权显式化。在超过十万行代码的 C++ 旧代码库里,指针所有权模糊是一个大难题,我对此深有感触。 + +但是,我以前常常使用 `const` 来实现有意义的类型安全。我曾听说过基于性能上的原因,最好是尽可能多地使用 `const`。我曾听说过当性能很重要时,重构代码并添加更多的 `const` 非常重要,即使以降低代码可读性的方式。**当时觉得这没问题,但后来我才知道这并不对。** + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/08/12/c_const_isnt_for_performance.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://theartofmachinery.com/2019/04/05/d_as_c_replacement.html#const-and-immutable +[2]: https://sqlite.org/src/doc/trunk/README.md +[3]: https://rada.re/r/ diff --git a/published/20190819 Moving files on Linux without mv.md b/published/20190819 Moving files on Linux without mv.md new file mode 100644 index 0000000000..2483018835 --- /dev/null +++ b/published/20190819 Moving files on Linux without mv.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11321-1.html) +[#]: subject: (Moving files on Linux without mv) +[#]: via: (https://opensource.com/article/19/8/moving-files-linux-without-mv) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/seth) + +在不使用 mv 命令的情况下移动文件 +====== + +> 有时当你需要移动一个文件时,mv 命令似乎不是最佳选项,那么你会如何做呢? + +![](https://img.linux.net.cn/data/attachment/album/201909/09/064313e02mvq28he8fk0mu.jpg) + +不起眼的 `mv` 命令是在你见过的每个 POSIX 系统中都能找到的有用工具之一。它的作用是明确定义的,并且做得很好:将文件从文件系统中的一个位置移动到另一个位置。但是 Linux 非常灵活,还有其他移动文件的办法。使用不同的工具可以完美匹配一些特殊用例,这算一个小优势。 + +在远离 `mv` 之前,先看看这个命令的默认结果。首先,创建一个目录并生成一些权限为 777 的文件: + +``` +$ mkdir example +$ touch example/{foo,bar,baz} +$ for i in example/*; do ls /bin > "${i}"; done +$ chmod 777 example/* +``` + +你可能不会这么认为,但是文件在一个[文件系统][2]中作为条目存在,称为索引节点(通常称为 inode),你可以使用 [ls 命令][3]及其 `--inode` 选项查看一个文件占用的 inode: + +``` +$ ls --inode example/foo +7476868 example/foo +``` + +作为测试,将文件从示例目录移动到当前目录,然后查看文件的属性: + +``` +$ mv example/foo . +$ ls -l -G -g --inode +7476868 -rwxrwxrwx. 1 29545 Aug  2 07:28 foo +``` + +如你所见,原始文件及权限已经被“移动”,但它的 inode 没有变化。 + +这就是 `mv` 工具用来移动的方式:保持 inode 不变(除非文件被移动到不同的文件系统),并保留其所有权和权限。 + +其他工具提供了不同的选项。 + +### 复制和删除 + +在某些系统上,移动操作是真的在做移动:比特从文件系统中的某个位置删除并重新分配给另一个位置。这种行为在很大程度上已经失宠。现在,移动操作要么是属性重新分配(inode 现在指向文件组织中的不同位置),要么是复制和删除操作的组合。这种设计的哲学意图是确保在移动失败时,文件不会碎片化。 + +与 `mv` 不同,`cp` 命令会在文件系统中创建一个全新的数据对象,它有一个新的 inode 位置,并取决于 umask。你可以使用 `cp` 和 `rm`(如果有的话,或者 [trash][4] —— LCTT 译注:它是一个命令行回收站工具)命令来模仿 `mv` 命令。 + +``` +$ cp example/foo . +$ ls -l -G -g --inode +7476869 -rwxrwxr-x. 29545 Aug  2 11:58 foo +$ trash example/foo +``` + +示例中的新 `foo` 文件获得了 755 权限,因为此处的 umask 明确排除了写入权限。 + +``` +$ umask +0002 +``` + +有关 umask 的更多信息,阅读 Alex Juarez 这篇关于[文件权限][5]的文章。 + +### 查看和删除 + +与复制和删除类似,使用 [cat][6](或 `tac`)命令在创建“移动”文件时分配不同的权限。假设当前目录中是一个没有 `foo` 的新测试环境: + +``` +$ cat example/foo > foo +$ ls -l -G -g --inode +7476869 -rw-rw-r--. 29545 Aug 8 12:21 foo +$ trash example/foo +``` + +这次,创建了一个没有事先设置权限的新文件,所以文件最终权限完全取决于 umask 设置,它不会阻止用户和组的权限位(无论 umask 是什么,都不会为新文件授予可执行权限),但它会阻止其他人的写入(值为 2)。所以结果是一个权限是 664 的文件。 + +### Rsync + +`rsync` 命令是一个强大的多功能工具,用于在主机和文件系统位置之间发送文件。此命令有许多可用选项,包括使其目标镜像成为源。 + +你可以使用带有 `--remove-source-files` 选项的 `rsync` 复制,然后删除文件,并可以带上你选择执行同步的任何其他选项(常见的通用选项是 `--archive`): + +``` +$ rsync --archive --remove-source-files example/foo . +$ ls example +bar  baz +$ ls -lGgi +7476870 -rwxrwxrwx. 1 seth users 29545 Aug 8 12:23 foo +``` + +在这里,你可以看到保留了文件权限和所有权,只是更新了时间戳,并删除了源文件。 + +警告:不要将此选项与 `--delete` 混淆,后者会从*目标*目录中删除(源目录中不存在的)文件。误用 `--delete` 会清除很多数据,建议你不要使用此选项,除非是在测试环境中。 + +你可以覆盖其中一些默认值,更改权限和修改设置: + +``` +$ rsync --chmod=666 --times \ + --remove-source-files example/foo . +$ ls example +bar  baz +$ ls -lGgi +7476871 -rw-rw-r--. 1 seth users 29545 Aug 8 12:55 foo +``` + +这里,目标的 umask 会生效,因此 `--chmod=666` 选项会产生一个权限为 644 的文件。 + +好处不仅仅是权限,与简单的 `mv` 命令相比,`rsync` 命令有[很多][7]有用的[选项][8](其中最重要的是 `--exclude` 选项,这样你可以在一个大型移动操作中排除某些项目),这使它成为一个更强大的工具。例如,要在移动文件集合时排除所有备份文件: + +``` +$ rsync --chmod=666 --times \ + --exclude '*~' \ + --remove-source-files example/foo . +``` + +### 使用 install 设置权限 + +`install` 命令是一个专门面向开发人员的复制命令,主要是作为软件编译安装例程的一部分调用。它并不为用户所知(我经常想知道为什么它有这么一个直观的名字,而剩下的包管理器却只能使用缩写和昵称),但是 `install` 实际上是一种将文件放在你想要地方的有用方法。 + +`install` 命令有很多选项,包括 `--backup` 和 `--compare` 命令(以避免*更新*文件的新副本)。 + +与 `cp` 和 `cat` 命令不同,但与 `mv` 完全相同,`install` 命令可以在复制文件的同时而保留其时间戳: + +``` +$ install --preserve-timestamp example/foo . +$ ls -l -G -g --inode +7476869 -rwxr-xr-x. 1 29545 Aug  2 07:28 foo +$ trash example/foo +``` + +在这里,文件被复制到一个新的 inode,但它的 mtime(修改时间)没有改变。但权限被设置为 `install` 的默认值 `755`。 + +你可以使用 `install` 来设置文件的权限,所有者和组: + +``` +$ install --preserve-timestamp \ + --owner=skenlon \ + --group=dialout \ + --mode=666 example/foo . +$ ls -li +7476869 -rw-rw-rw-. 1 skenlon dialout 29545 Aug  2 07:28 foo +$ trash example/foo +``` + +### 移动、复制和删除 + +文件包含数据,而真正重要的文件包含*你的*数据。学会聪明地管理它们是很重要的,现在你有了确保以你想要的方式来处理数据的工具包。 + +你是否有不同的数据管理方式?在评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/moving-files-linux-without-mv + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sethhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/18/11/partition-format-drive-linux#what-is-a-filesystem +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://gitlab.com/trashy +[5]: https://opensource.com/article/19/8/linux-permissions-101#umask +[6]: https://opensource.com/article/19/2/getting-started-cat-command +[7]: https://opensource.com/article/19/5/advanced-rsync +[8]: https://opensource.com/article/17/1/rsync-backup-linux diff --git a/published/20190821 Getting Started with Go on Fedora.md b/published/20190821 Getting Started with Go on Fedora.md new file mode 100644 index 0000000000..25cff871be --- /dev/null +++ b/published/20190821 Getting Started with Go on Fedora.md @@ -0,0 +1,120 @@ +[#]: collector: "lujun9972" +[#]: translator: "hello-wn" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11293-1.html" +[#]: subject: "Getting Started with Go on Fedora" +[#]: via: "https://fedoramagazine.org/getting-started-with-go-on-fedora/" +[#]: author: "Clément Verna https://fedoramagazine.org/author/cverna/" + +在 Fefora 上开启 Go 语言之旅 +====== + +![][1] + +[Go][2] 编程语言于 2009 年首次公开发布,此后被广泛使用。特别是,Go 已经成为云基础设施领域的一种代表性语言,例如 [Kubernetes][3]、[OpenShift][4] 或 [Terraform][5] 等大型项目都使用了 Go。 + +Go 越来越受欢迎的原因是性能好、易于编写高并发的程序、语法简单和编译快。 + +让我们来看看如何在 Fedora 上开始 Go 语言编程吧。 + +### 在 Fedora 上安装 Go + +Fedora 可以通过官方库简单快速地安装 Go 语言。 + +``` +$ sudo dnf install -y golang +$ go version +go version go1.12.7 linux/amd64 +``` + +既然装好了 Go ,让我们来写个简单的程序,编译并运行。 + +### 第一个 Go 程序 + +让我们来用 Go 语言写一波 “Hello, World!”。首先创建 `main.go` 文件,然后输入或者拷贝以下内容。 + +``` +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +} +``` + +运行这个程序很简单。 + +``` +$ go run main.go +Hello, World! +``` + +Go 会在临时目录将 `main.go` 编译成二进制文件并执行,然后删除临时目录。这个命令非常适合在开发过程中快速运行程序,它还凸显了 Go 的编译速度。 + +编译一个可执行程序就像运行它一样简单。 + +``` +$ go build main.go +$ ./main +Hello, World! +``` + +### 使用 Go 的模块 + +Go 1.11 和 1.12 引入了对模块的初步支持。模块可用于管理应用程序的各种依赖包。Go 通过 `go.mod` 和 `go.sum` 这两个文件,显式地定义依赖包的版本。 + +为了演示如何使用模块,让我们为 `hello world` 程序添加一个依赖。 + +在更改代码之前,需要初始化模块。 + +``` +$ go mod init helloworld +go: creating new go.mod: module helloworld +$ ls +go.mod main main.go +``` + +然后按照以下内容修改 `main.go` 文件。 + +``` +package main + +import "github.com/fatih/color" + +func main () { + color.Blue("Hello, World!") +} +``` + +在修改后的 `main.go` 中,不再使用标准库 `fmt` 来打印 “Hello, World!” ,而是使用第三方库打印出有色字体。 + +让我们来跑一下新版的程序吧。 + +``` +$ go run main.go +Hello, World! +``` + +因为程序依赖于 `github.com/fatih/color` 库,它需要在编译前下载所有依赖包。 然后把依赖包都添加到 `go.mod` 中,并将它们的版本号和哈希值记录在 `go.sum` 中。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/getting-started-with-go-on-fedora/ + +作者:[Clément Verna][a] +选题:[lujun9972][b] +译者:[hello-wn](https://github.com/hello-wn) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/cverna/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/go-article-816x345.jpg +[2]: https://golang.org/ +[3]: https://kubernetes.io/ +[4]: https://www.openshift.com/ +[5]: https://www.terraform.io/ + diff --git a/published/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md b/published/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md new file mode 100644 index 0000000000..33084aaa52 --- /dev/null +++ b/published/20190823 How To Check Your IP Address in Ubuntu -Beginner-s Tip.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11308-1.html) +[#]: subject: (How To Check Your IP Address in Ubuntu [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/check-ip-address-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 中检查你的 IP 地址 +====== + +不知道你的 IP 地址是什么?以下是在 Ubuntu 和其他 Linux 发行版中检查 IP 地址的几种方法。 + +![][1] + +### 什么是 IP 地址? + +**互联网协议地址**(通常称为 **IP 地址**)是分配给连接到计算机网络的每个设备(使用互联网协议)的数字标签。IP 地址用于识别和定位机器。 + +**IP 地址**在网络中是*唯一的*,使得所有连接设备能够通信。 + +你还应该知道有两种**类型的 IP 地址**:**公有**和**私有**。**公有 IP 地址**是用于互联网通信的地址,这与你用于邮件的物理地址相同。但是,在本地网络(例如使用路由器的家庭)的环境中,会为每个设备分配在该子网内唯一的**私有 IP 地址**。这在本地网络中使用,而不直接暴露公有 IP(路由器用它与互联网通信)。 + +另外还有区分 **IPv4** 和 **IPv6** 协议。**IPv4** 是经典的 IP 格式,它由基本的 4 部分结构组成,四个字节用点分隔(例如 127.0.0.1)。但是,随着设备数量的增加,IPv4 很快就无法提供足够的地址。这就是 **IPv6** 被发明的原因,它使用 **128 位地址**的格式(与 **IPv4** 使用的 **32 位地址**相比)。 + +### 在 Ubuntu 中检查你的 IP 地址(终端方式) + +检查 IP 地址的最快和最简单的方法是使用 `ip` 命令。你可以按以下方式使用此命令: + +``` +ip addr show +``` + +它将同时显示 IPv4 和 IPv6 地址: + +![Display IP Address in Ubuntu Linux][2] + +实际上,你可以进一步缩短这个命令 `ip a`。它会给你完全相同的结果。 + +``` +ip a +``` + +如果你希望获得最少的细节,也可以使用 `hostname`: + +``` +hostname -I +``` + +还有一些[在 Linux 中检查 IP 地址的方法][3],但是这两个命令足以满足这个目的。 + +`ifconfig` 如何? + +老用户可能会想要使用 `ifconfig`(net-tools 软件包的一部分),但该程序已被弃用。一些较新的 Linux 发行版不再包含此软件包,如果你尝试运行它,你将看到 ifconfig 命令未找到的错误。 + +### 在 Ubuntu 中检查你的 IP 地址(GUI 方式) + +如果你对命令行不熟悉,你还可以使用图形方式检查 IP 地址。 + +打开 Ubuntu 应用菜单(在屏幕左下角**显示应用**)并搜索**Settings**,然后单击图标: + +![Applications Menu Settings][5] + +这应该会打开**设置菜单**。进入**网络**: + +![Network Settings Ubuntu][6] + +按下连接旁边的**齿轮图标**会打开一个窗口,其中包含更多设置和有关你网络链接的信息,其中包括你的 IP 地址: + +![IP Address GUI Ubuntu][7] + +### 额外提示:检查你的公共 IP 地址(适用于台式计算机) + +首先,要检查你的**公有 IP 地址**(用于与服务器通信),你可以[使用 curl 命令][8]。打开终端并输入以下命令: + +``` +curl ifconfig.me +``` + +这应该只会返回你的 IP 地址而没有其他多余信息。我建议在分享这个地址时要小心,因为这相当于公布你的个人地址。 + +**注意:** 如果 `curl` 没有安装,只需使用 `sudo apt install curl -y` 来解决问题,然后再试一次。 + +另一种可以查看公共 IP 地址的简单方法是在 Google 中搜索 “ip address”。 + +### 总结 + +在本文中,我介绍了在 Uuntu Linux 中找到 IP 地址的不同方法,并向你概述了 IP 地址的用途以及它们对我们如此重要的原因。 + +我希望你喜欢这篇文章。如果你觉得文章有用,请在评论栏告诉我们! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-ip-address-ubuntu/ + +作者:[Sergiu][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://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/checking-ip-address-ubuntu.png?resize=800%2C450&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/ip_addr_show.png?fit=800%2C493&ssl=1 +[3]: https://linuxhandbook.com/find-ip-address/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?fit=800%2C309&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/network_settings_ubuntu.jpg?fit=800%2C591&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/ip_address_gui_ubuntu.png?fit=800%2C510&ssl=1 +[8]: https://linuxhandbook.com/curl-command-examples/ diff --git a/published/20190823 The Linux kernel- Top 5 innovations.md b/published/20190823 The Linux kernel- Top 5 innovations.md new file mode 100644 index 0000000000..486270ccfd --- /dev/null +++ b/published/20190823 The Linux kernel- Top 5 innovations.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11368-1.html) +[#]: subject: (The Linux kernel: Top 5 innovations) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-top-5-innovations) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 内核的五大创新 +====== + +> 想知道什么是 Linux 内核上真正的(不是那种时髦的)创新吗? + +![](https://img.linux.net.cn/data/attachment/album/201909/21/093858no01oh78v111r3zt.jpg) + +在科技行业,*创新*这个词几乎和*革命*一样到处泛滥,所以很难将那些夸张的东西与真正令人振奋的东西区分开来。Linux 内核被称为创新,但它又被称为现代计算中最大的奇迹,一个微观世界中的庞然大物。 + +撇开营销和模式不谈,Linux 可以说是开源世界中最受欢迎的内核,它在近 30 年的生命时光当中引入了一些真正的规则改变者。 + +### Cgroups(2.6.24) + +早在 2007 年,Paul Menage 和 Rohit Seth 就在内核中添加了深奥的[控制组(cgroups)][2]功能(cgroups 的当前实现是由 Tejun Heo 重写的)。这种新技术最初被用作一种方法,从本质上来说,是为了确保一组特定任务的服务质量。 + +例如,你可以为与你的 WEB 服务相关联的所有任务创建一个控制组定义(cgroup),为例行备份创建另一个 cgroup ,再为一般操作系统需求创建另一个 cgroup。然后,你可以控制每个组的资源百分比,这样你的操作系统和 WEB 服务就可以获得大部分系统资源,而你的备份进程可以访问剩余的资源。 + +然而,cgroups 如今变得这么著名是因其作为驱动云技术的角色:容器。事实上,cgroups 最初被命名为[进程容器][3]。当它们被 [LXC][4]、[CoreOS][5] 和 Docker 等项目采用时,这并不奇怪。 + +就像闸门打开后一样,“容器” 一词就像成为了 Linux 的同义词一样,微服务风格的基于云的“应用”概念很快成为了规范。如今,已经很难摆脱 cgroups 了,它们是如此普遍。每一个大规模的基础设施(如果你运行 Linux 的话,可能还有你的笔记本电脑)都以一种合理的方式使用了 cgroups,这使得你的计算体验比以往任何时候都更加易于管理和灵活。 + +例如,你可能已经在电脑上安装了 [Flathub][6] 或 [Flatpak][7],或者你已经在工作中使用 [Kubernetes][8] 和/或 [OpenShift][9]。不管怎样,如果“容器”这个术语对你来说仍然模糊不清,则可以 [通过 Linux 容器从背后][10]获得对容器的实际理解。 + +### LKMM(4.17) + +2018 年,Jade Alglave、Alan Stern、Andrea Parri、Luc Maranget、Paul McKenney 以及其他几个人的辛勤工作的成果被合并到主线 Linux 内核中,以提供正式的内存模型。Linux 内核内存[一致性]模型(LKMM)子系统是一套描述 Linux 内存一致性模型的工具,同时也产生用于测试的用例(特别命名为 klitmus)。 + +随着系统在物理设计上变得越来越复杂(增加了更多的中央处理器内核,高速缓存和内存增长,等等),它们就越难知道哪个中央处理器需要哪个地址空间,以及何时需要。例如,如果 CPU0 需要将数据写入内存中的共享变量,并且 CPU1 需要读取该值,那么 CPU0 必须在 CPU1 尝试读取之前写入。类似地,如果值是以一种顺序方式写入内存的,那么期望它们也以同样的顺序被读取,而不管哪个或哪些 CPU 正在读取。 + +即使在单个处理器上,内存管理也需要特定的任务顺序。像 `x = y` 这样的简单操作需要处理器从内存中加载 `y` 的值,然后将该值存储在 `x` 中。在处理器从内存中读取值之前,是不能将存储在 `y` 中的值放入 `x` 变量的。此外还有地址依赖:`x[n] = 6` 要求在处理器能够存储值 `6` 之前加载 `n`。 + +LKMM 可以帮助识别和跟踪代码中的这些内存模式。它部分是通过一个名为 `herd` 的工具来实现的,该工具(以逻辑公式的形式)定义了内存模型施加的约束,然后列举了与这些约束一致性的所有可能的结果。 + +### 低延迟补丁(2.6.38) + +很久以前,在 2011 年之前,如果你想[在 Linux 上进行多媒体工作][11],你必须得有一个低延迟内核。这主要适用于[录音][12]时添加了许多实时效果(如对着麦克风唱歌和添加混音,以及在耳机中无延迟地听到你的声音)。有些发行版,如 [Ubuntu Studio][13],可靠地提供了这样一个内核,所以实际上这没有什么障碍,这只不过是当艺术家选择发行版时的一个重要提醒。 + +然而,如果你没有使用 Ubuntu Studio,或者你需要在你的发行版提供之前更新你的内核,你必须跳转到 rt-patches 网页,下载内核补丁,将它们应用到你的内核源代码,编译,然后手动安装。 + +后来,随着内核版本 2.6.38 的发布,这个过程结束了。Linux 内核突然像变魔术一样默认内置了低延迟代码(根据基准测试,延迟至少降低了 10 倍)。不再需要下载补丁,不用编译。一切都很顺利,这都是因为 Mike Galbraith 编写了一个 200 行的小补丁。 + +对于全世界的开源多媒体艺术家来说,这是一个规则改变者。从 2011 年开始事情变得如此美好,到 2016 年我自己做了一个挑战,[在树莓派 v1(型号 B)上建造一个数字音频工作站(DAW)][14],结果发现它运行得出奇地好。 + +### RCU(2.5) + +RCU,即读-拷贝-更新Read-Copy-Update,是计算机科学中定义的一个系统,它允许多个处理器线程从共享内存中读取数据。它通过延迟更新但也将它们标记为已更新来做到这一点,以确保数据读取为最新内容。实际上,这意味着读取与更新同时发生。 + +典型的 RCU 循环有点像这样: + +1. 删除指向数据的指针,以防止其他读操作引用它。 +2. 等待读操作完成它们的关键处理。 +3. 回收内存空间。 + +将更新阶段划分为删除和回收阶段意味着更新程序会立即执行删除,同时推迟回收直到所有活动读取完成(通过阻止它们或注册一个回调以便在完成时调用)。 + +虽然 RCU 的概念不是为 Linux 内核发明的,但它在 Linux 中的实现是该技术的一个定义性的例子。 + +### 合作(0.01) + +对于 Linux 内核创新的问题的最终答案永远是协作。你可以说这是一个好时机,也可以称之为技术优势,称之为黑客能力,或者仅仅称之为开源,但 Linux 内核及其支持的许多项目是协作与合作的光辉范例。 + +它远远超出了内核范畴。各行各业的人都对开源做出了贡献,可以说都是因为 Linux 内核。Linux 曾经是,现在仍然是[自由软件][15]的主要力量,激励人们把他们的代码、艺术、想法或者仅仅是他们自己带到一个全球化的、有生产力的、多样化的人类社区中。 + +### 你最喜欢的创新是什么? + +这个列表偏向于我自己的兴趣:容器、非统一内存访问(NUMA)和多媒体。无疑,列表中肯定缺少你最喜欢的内核创新。在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-top-5-innovations + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[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/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://en.wikipedia.org/wiki/Cgroups +[3]: https://lkml.org/lkml/2006/10/20/251 +[4]: https://linuxcontainers.org +[5]: https://coreos.com/ +[6]: http://flathub.org +[7]: http://flatpak.org +[8]: http://kubernetes.io +[9]: https://www.redhat.com/sysadmin/learn-openshift-minishift +[10]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[11]: http://slackermedia.info +[12]: https://opensource.com/article/17/6/qtractor-audio +[13]: http://ubuntustudio.org +[14]: https://opensource.com/life/16/3/make-music-raspberry-pi-milkytracker +[15]: http://fsf.org diff --git a/published/20190825 Top 5 IoT networking security mistakes.md b/published/20190825 Top 5 IoT networking security mistakes.md new file mode 100644 index 0000000000..237d81b266 --- /dev/null +++ b/published/20190825 Top 5 IoT networking security mistakes.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11299-1.html) +[#]: subject: (Top 5 IoT networking security mistakes) +[#]: via: (https://www.networkworld.com/article/3433476/top-5-iot-networking-security-mistakes.html) +[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) + +五大物联网网络安全错误 +====== + +> IT 供应商兄弟国际公司分享了五种最常见的物联网安全错误,这是从它们的打印机和多功能设备买家中看到的。 + +![Getty Images][1] + +尽管[兄弟国际公司][2]是许多 IT 产品的供应商,从[机床][3]到[头戴式显示器][4]再到[工业缝纫机][5],但它最知名的产品是打印机。在当今世界,这些打印机不再是独立的设备,而是物联网的组成部分。 + +这也是我为什么对罗伯特•伯内特提供的这份列表感兴趣的原因。伯内特是兄弟公司的总监,负责 B2B 产品和提供解决方案。基本上是该公司负责大客户实施的关键人物。所以他对打印机相关的物联网安全错误非常关注,并且分享了兄弟国际公司对于处理这五大错误的建议。 + +### #5:不控制访问和授权 + +伯内特说:“过去,成本控制是管理谁可以使用机器、何时结束工作背后的推动力。”当然,这在今天也仍然很重要,但他指出安全性正迅速成为管理控制打印和扫描设备的关键因素。这不仅适用于大型企业,也适用于各种规模的企业。 + +### #4:无法定期更新固件 + +让我们来面对这一现实,大多数 IT 专业人员都忙于保持服务器和其他网络基础设施设备的更新,确保其基础设施尽可能的安全高效。“在这日常的流程中,像打印机这样的设备经常被忽视。”但过时的固件可能会使基础设施面临新的威胁。 + +### #3:设备意识不足 + +伯内特说:“正确理解谁在使用什么设备,以及整套设备中所有连接设备的功能是什么,这是至关重要的。使用端口扫描技术、协议分析和其他检测技术检查这些设备应作为你的网络基础设施整体安全审查中的一部分。 他常常提醒人们说:“处理打印设备的方法是:如果没有损坏,就不要修理!”但即使是可靠运行多年的设备也应该成为安全审查的一部分。这是因为旧设备可能无法提供更强大的安全设置,或者可能需要更新其配置才能满足当今更高的安全要求,这其中包括设备的监控/报告功能。 + +### #2:用户培训不足 + +“应该把培训团队在工作过程中管理文档的最佳实践作为强有力的安全计划中的一部分。”伯内特说道,“然而,事实却是,无论你如何努力地去保护物联网设备,人为因素通常是一家企业在保护重要和敏感信息方面最薄弱的环节。像这些简单的事情,如无意中将重要文件留在打印机上供任何人查看,或者将文件扫描到错误的目的地,不仅会给企业带来经济损失和巨大的负面影响,还会影响企业的知识产权、声誉,引起合规性/监管问题。” + +### #1:使用默认密码 + +“只是因为它很方便并不意味着它不重要!”伯内特说,“保护打印机和多功能设备免受未经授权的管理员访问不仅有助于保护敏感的机器配置设置和报告信息,还可以防止访问个人信息,例如,像可能用于网络钓鱼攻击的用户名。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3433476/top-5-iot-networking-security-mistakes.html + +作者:[Fredric Paul][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://www.networkworld.com/author/Fredric-Paul/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/02/iot_security_tablet_conference_digital-100787102-large.jpg +[2]: https://www.brother-usa.com/business +[3]: https://www.brother-usa.com/machinetool/default?src=default +[4]: https://www.brother-usa.com/business/hmd#sort=%40productcatalogsku%20ascending +[5]: https://www.brother-usa.com/business/industrial-sewing +[6]: https://www.networkworld.com/article/2855207/internet-of-things/5-ways-to-prepare-for-internet-of-things-security-threats.html#tk.nww-infsb +[7]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/published/20190826 5 ops tasks to do with Ansible.md b/published/20190826 5 ops tasks to do with Ansible.md new file mode 100644 index 0000000000..de7916b81d --- /dev/null +++ b/published/20190826 5 ops tasks to do with Ansible.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11312-1.html) +[#]: subject: (5 ops tasks to do with Ansible) +[#]: via: (https://opensource.com/article/19/8/ops-tasks-ansible) +[#]: author: (Mark Phillips https://opensource.com/users/markphttps://opensource.com/users/adminhttps://opensource.com/users/alsweigarthttps://opensource.com/users/belljennifer43) + +5 个 Ansible 运维任务 +====== + +> 让 DevOps 少一点,OpsDev 多一点。 + +![gears and lightbulb to represent innovation][1] + +在这个 DevOps 世界中,看起来开发(Dev)这一半成为了关注的焦点,而运维(Ops)则是这个关系中被遗忘的另一半。这几乎就好像是领头的开发告诉尾随的运维做什么,几乎所有的“运维”都是开发说要做的。因此,运维被抛到后面,降级到了替补席上。 + +我想看到更多的 OpsDev。因此,让我们来看看 Ansible 在日常的运维中可以帮助你什么。 + +![Job templates][2] + +我选择在 [Ansible Tower][3] 中展示这些方案,因为我认为用户界面 (UI) 可以增色大多数的任务。如果你想模拟测试,你可以在 Tower 的上游开源版本 [AWX][4] 中测试它。 + +### 管理用户 + +在大规模环境中,你的用户将集中在活动目录或 LDAP 等系统中。但我敢打赌,仍然存在许多包含大量的静态用户的全负荷环境。Ansible 可以帮助你将这些分散的环境集中到一起。*社区*已为我们解决了这个问题。看看 [Ansible Galaxy][5] 中的 [users][6] 角色。 + +这个角色的聪明之处在于它允许我们通过*数据*管理用户,而无需更改运行逻辑。 + +![User data][7] + +通过简单的数据结构,我们可以在系统上添加、删除和修改静态用户。这很有用。 + +### 管理 sudo + +提权有[多种形式][8],但最流行的是 [sudo][9]。通过每个 `user`、`group` 等离散文件来管理 sudo 相对容易。但一些人对给予特权感到紧张,并倾向于有时限地给予提权。因此[下面是一种方案][10],它使用简单的 `at` 命令对授权访问设置时间限制。 + +![Managing sudo][11] + +### 管理服务 + +给入门级运维团队提供[菜单][12]以便他们可以重启某些服务不是很好吗?看下面! + +![Managing services][13] + +### 管理磁盘空间 + +这有[一个简单的角色][14],可在特定目录中查找字节大于某个大小的文件。在 Tower 中这么做时,启用[回调][15]有额外的好处。想象一下,你的监控方案发现文件系统已超过 X% 并触发 Tower 中的任务以找出是什么文件导致的。 + +![Managing disk space][16] + +### 调试系统性能问题 + +[这个角色][17]相当简单:它运行一些命令并打印输出。细节在最后输出,让你 —— 系统管理员快速浏览一眼。另外可以使用 [正则表达式][18] 在输出中找到某些条件(比如说 CPU 占用率超过 80%)。 + +![Debugging system performance][19] + +### 总结 + +我已经录制了这五个任务的简短视频。你也可以在 Github 上找到[所有代码][20]! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/ops-tasks-ansible + +作者:[Mark Phillips][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/markphttps://opensource.com/users/adminhttps://opensource.com/users/alsweigarthttps://opensource.com/users/belljennifer43 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://opensource.com/sites/default/files/uploads/00_templates.png (Job templates) +[3]: https://www.ansible.com/products/tower +[4]: https://github.com/ansible/awx +[5]: https://galaxy.ansible.com +[6]: https://galaxy.ansible.com/singleplatform-eng/users +[7]: https://opensource.com/sites/default/files/uploads/01_users_data.png (User data) +[8]: https://docs.ansible.com/ansible/latest/plugins/become.html +[9]: https://www.sudo.ws/intro.html +[10]: https://github.com/phips/ansible-demos/tree/master/roles/sudo +[11]: https://opensource.com/sites/default/files/uploads/02_sudo.png (Managing sudo) +[12]: https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#surveys +[13]: https://opensource.com/sites/default/files/uploads/03_services.png (Managing services) +[14]: https://github.com/phips/ansible-demos/tree/master/roles/disk +[15]: https://docs.ansible.com/ansible-tower/latest/html/userguide/job_templates.html#provisioning-callbacks +[16]: https://opensource.com/sites/default/files/uploads/04_diskspace.png (Managing disk space) +[17]: https://github.com/phips/ansible-demos/tree/master/roles/gather_debug +[18]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#regular-expression-filters +[19]: https://opensource.com/sites/default/files/uploads/05_debug.png (Debugging system performance) +[20]: https://github.com/phips/ansible-demos diff --git a/published/20190826 How to rename a group of files on Linux.md b/published/20190826 How to rename a group of files on Linux.md new file mode 100644 index 0000000000..e80d1bc31d --- /dev/null +++ b/published/20190826 How to rename a group of files on Linux.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11300-1.html) +[#]: subject: (How to rename a group of files on Linux) +[#]: via: (https://www.networkworld.com/article/3433865/how-to-rename-a-group-of-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 上重命名一组文件 +====== + +> 要用单个命令重命名一组文件,请使用 rename 命令。它需要使用正则表达式,并且可以在开始前告诉你会有什么更改。 + +![](https://img.linux.net.cn/data/attachment/album/201909/03/005333hfm8yf90m2gm800g.jpg) + +几十年来,Linux 用户一直使用 `mv` 命令重命名文件。它很简单,并且能做到你要做的。但有时你需要重命名一大组文件。在这种情况下,`rename` 命令可以使这个任务更容易。它只需要一些正则表达式的技巧。 + +与 `mv` 命令不同,`rename` 不允许你简单地指定旧名称和新名称。相反,它使用类似于 Perl 中的正则表达式。在下面的例子中,`s` 指定我们将第一个字符串替换为第二个字符串(旧的),从而将 `this.new` 变为 `this.old`。 + +``` +$ rename 's/new/old/' this.new +$ ls this* +this.old +``` + +使用 `mv this.new this.old` 可以更容易地进行更改一个,但是将字符串 `this` 变成通配符 `*`,你可以用一条命令将所有的 `*.new` 文件重命名为 `*.old`: + +``` +$ ls *.new +report.new schedule.new stats.new this.new +$ rename 's/new/old/' *.new +$ ls *.old +report.old schedule.old stats.old this.old +``` + +正如你所料,`rename` 命令不限于更改文件扩展名。如果你需要将名为 `report.*` 的文件更改为 `review.*`,那么可以使用以下命令做到: + +``` +$ rename 's/report/review/' * +``` + +正则表达式中的字符串可以更改文件名的任何部分,无论是文件名还是扩展名。 + +``` +$ rename 's/123/124/' * +$ ls *124* +status.124 report124.txt +``` + +如果你在 `rename` 命令中添加 `-v` 选项,那么该命令将提供一些反馈,以便你可以看到所做的更改,或许会包含你没注意的。这让你注意到并按需还原更改。 + +``` +$ rename -v 's/123/124/' * +status.123 renamed as status.124 +report123.txt renamed as report124.txt +``` + +另一方面,使用 `-n`(或 `--nono`)选项会使 `rename` 命令告诉你将要做的但不会实际做的更改。这可以让你免于执行不不想要的操作,然后再还原更改。 + +``` +$ rename -n 's/old/save/' * +rename(logger.man-old, logger.man-save) +rename(lyrics.txt-old, lyrics.txt-save) +rename(olderfile-, saveerfile-) +rename(oldfile, savefile) +rename(review.old, review.save) +rename(schedule.old, schedule.save) +rename(stats.old, stats.save) +rename(this.old, this.save) +``` + +如果你对这些更改满意,那么就可以运行不带 `-n` 选项的命令来更改文件名。 + +但请注意,正则表达式中的 `.` **不会**被视为句点,而是作为匹配任何字符的通配符。上面和下面的示例中的一些更改可能不是输入命令的人希望的。 + +``` +$ rename -n 's/.old/.save/' * +rename(logger.man-old, logger.man.save) +rename(lyrics.txt-old, lyrics.txt.save) +rename(review.old, review.save) +rename(schedule.old, schedule.save) +rename(stats.old, stats.save) +rename(this.old, this.save) +``` + +为确保句点按照字面意思执行,请在它的前面加一个反斜杠。这将使其不被解释为通配符并匹配任何字符。请注意,进行此更改时,仅选择了 `.old` 文件。 + +``` +$ rename -n 's/\.old/.save/' * +rename(review.old, review.save) +rename(schedule.old, schedule.save) +rename(stats.old, stats.save) +rename(this.old, this.save) +``` + +下面的命令会将文件名中的所有大写字母更改为小写,除了使用 `-n` 选项来确保我们在命令执行之前检查将做的修改。注意在正则表达式中使用了 `y`,这是改变大小写所必需的。 + +``` +$ rename -n 'y/A-Z/a-z/' W* +rename(WARNING_SIGN.pdf, warning_sign.pdf) +rename(Will_Gardner_buttons.pdf, will_gardner_buttons.pdf) +rename(Wingding_Invites.pdf, wingding_invites.pdf) +rename(WOW-buttons.pdf, wow-buttons.pdf) +``` + +在上面的例子中,我们将所有大写字母更改为了小写,但这仅对以大写字母 `W` 开头的文件名。 + +### 总结 + +当你需要重命名大量文件时,`rename` 命令非常有用。请注意不要做比预期更多的更改。请记住,`-n`(或者 `--nono`)选项可以帮助你避免耗时的错误。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3433865/how-to-rename-a-group-of-files-on-linux.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/08/card-catalog-machester_city_library-100809242-large.jpg +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/20190828 Managing Ansible environments on MacOS with Conda.md b/published/20190828 Managing Ansible environments on MacOS with Conda.md new file mode 100644 index 0000000000..24e8d65fa0 --- /dev/null +++ b/published/20190828 Managing Ansible environments on MacOS with Conda.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11356-1.html) +[#]: subject: (Managing Ansible environments on MacOS with Conda) +[#]: via: (https://opensource.com/article/19/8/using-conda-ansible-administration-macos) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + + +使用 Conda 管理 MacOS 上的 Ansible 环境 +===== + +> Conda 将 Ansible 所需的一切都收集到虚拟环境中并将其与其他项目分开。 + +![](https://img.linux.net.cn/data/attachment/album/201909/18/123838m1bcmke570kl6kzm.jpg) + +如果你是一名使用 MacOS 并涉及到 Ansible 管理的 Python 开发人员,你可能希望使用 Conda 包管理器将 Ansible 的工作内容与核心操作系统和其他本地项目分开。 + +Ansible 基于 Python。要让 Ansible 在 MacOS 上工作,Conda 并不是必须要的,但是它确实让你管理 Python 版本和包依赖变得更加容易。这允许你在 MacOS 上使用升级的 Python 版本,并在你的系统中、Ansible 和其他编程项目之间保持 Python 包的依赖性相互独立。 + +在 MacOS 上安装 Ansible 还有其他方法。你可以使用 [Homebrew][2],但是如果你对 Python 开发(或 Ansible 开发)感兴趣,你可能会发现在一个独立 Python 虚拟环境中管理 Ansible 可以减少一些混乱。我觉得这更简单;与其试图将 Python 版本和依赖项加载到系统或 `/usr/local` 目录中 ,还不如使用 Conda 帮助我将 Ansible 所需的一切都收集到一个虚拟环境中,并将其与其他项目完全分开。 + +本文着重于使用 Conda 作为 Python 项目来管理 Ansible,以保持它的干净并与其他项目分开。请继续阅读,并了解如何安装 Conda、创建新的虚拟环境、安装 Ansible 并对其进行测试。 + +### 序幕 + +最近,我想学习 [Ansible][3],所以我需要找到安装它的最佳方法。 + +我通常对在我的日常工作站上安装东西很谨慎。我尤其不喜欢对供应商的默认操作系统安装应用手动更新(这是我多年作为 Unix 系统管理的习惯)。我真的很想使用 Python 3.7,但是 MacOS 的 Python 包是旧的 2.7,我不会安装任何可能干扰核心 MacOS 系统的全局 Python 包。 + +所以,我使用本地 Ubuntu 18.04 虚拟机上开始了我的 Ansible 工作。这提供了真正意义上的的安全隔离,但我很快发现管理它是非常乏味的。所以我着手研究如何在本机 MacOS 上获得一个灵活但独立的 Ansible 系统。 + +由于 Ansible 基于 Python,Conda 似乎是理想的解决方案。 + +### 安装 Conda + +Conda 是一个开源软件,它提供方便的包和环境管理功能。它可以帮助你管理多个版本的 Python、安装软件包依赖关系、执行升级和维护项目隔离。如果你手动管理 Python 虚拟环境,Conda 将有助于简化和管理你的工作。浏览 [Conda 文档][4]可以了解更多细节。 + +我选择了 [Miniconda][5] Python 3.7 安装在我的工作站中,因为我想要最新的 Python 版本。无论选择哪个版本,你都可以使用其他版本的 Python 安装新的虚拟环境。 + +要安装 Conda,请下载 PKG 格式的文件,进行通常的双击,并选择 “Install for me only” 选项。安装在我的系统上占用了大约 158 兆的空间。 + +安装完成后,调出一个终端来查看你有什么了。你应该看到: + + * 在你的家目录中的 `miniconda3` 目录 + * shell 提示符被修改为 `(base)` + * `.bash_profile` 文件更新了一些 Conda 特有的设置内容 + +现在基础已经安装好了,你有了第一个 Python 虚拟环境。运行 Python 版本检查可以证明这一点,你的 `PATH` 将指向新的位置: + +``` +(base) $ which python +/Users/jfarrell/miniconda3/bin/python +(base) $ python --version +Python 3.7.1 +``` + +现在安装了 Conda,下一步是建立一个虚拟环境,然后安装 Ansible 并运行。 + +### 为 Ansible 创建虚拟环境 + +我想将 Ansible 与我的其他 Python 项目分开,所以我创建了一个新的虚拟环境并切换到它: + +``` +(base) $ conda create --name ansible-env --clone base +(base) $ conda activate ansible-env +(ansible-env) $ conda env list +``` + +第一个命令将 Conda 库克隆到一个名为 `ansible-env` 的新虚拟环境中。克隆引入了 Python 3.7 版本和一系列默认的 Python 模块,你可以根据需要添加、删除或升级这些模块。 + +第二个命令将 shell 上下文更改为这个新的环境。它为 Python 及其包含的模块设置了正确的路径。请注意,在 `conda activate ansible-env` 命令后,你的 shell 提示符会发生变化。 + +第三个命令不是必须的;它列出了安装了哪些 Python 模块及其版本和其他数据。 + +你可以随时使用 Conda 的 `activate` 命令切换到另一个虚拟环境。这将带你回到基本环境:`conda base`。 + +### 安装 Ansible + +安装 Ansible 有多种方法,但是使用 Conda 可以将 Ansible 版本和所有需要的依赖项打包在一个地方。Conda 提供了灵活性,既可以将所有内容分开,又可以根据需要添加其他新环境(我将在后面演示)。 + +要安装 Ansible 的相对较新版本,请使用: + +``` +(base) $ conda activate ansible-env +(ansible-env) $ conda install -c conda-forge ansible +``` + +由于 Ansible 不是 Conda 默认通道的一部分,因此 `-c` 用于从备用通道搜索和安装。Ansible 现已安装到 `ansible-env` 虚拟环境中,可以使用了。 + +### 使用 Ansible + +既然你已经安装了 Conda 虚拟环境,就可以使用它了。首先,确保要控制的节点已将工作站的 SSH 密钥安装到正确的用户帐户。 + +调出一个新的 shell 并运行一些基本的 Ansible 命令: + +``` +(base) $ conda activate ansible-env +(ansible-env) $ ansible --version +ansible 2.8.1 + config file = None + configured module search path = ['/Users/jfarrell/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] + ansible python module location = /Users/jfarrell/miniconda3/envs/ansibleTest/lib/python3.7/site-packages/ansible + executable location = /Users/jfarrell/miniconda3/envs/ansibleTest/bin/ansible + python version = 3.7.1 (default, Dec 14 2018, 13:28:58) [Clang 4.0.1 (tags/RELEASE_401/final)] +(ansible-env) $ ansible all -m ping -u ansible +192.168.99.200 | SUCCESS => { + "ansible_facts": { + "discovered_interpreter_python": "/usr/bin/python" + }, + "changed": false, + "ping": "pong" +} +``` + +现在 Ansible 工作了,你可以在控制台中抽身,并从你的 MacOS 工作站中使用它们。 + +### 克隆新的 Ansible 进行 Ansible 开发 + +这部分完全是可选的;只有当你想要额外的虚拟环境来修改 Ansible 或者安全地使用有问题的 Python 模块时,才需要它。你可以通过以下方式将主 Ansible 环境克隆到开发副本中: + +``` +(ansible-env) $ conda create --name ansible-dev --clone ansible-env +(ansible-env) $ conda activte ansible-dev +(ansible-dev) $ +``` + +### 需要注意的问题 + +偶尔你可能遇到使用 Conda 的麻烦。你通常可以通过以下方式删除不良环境: + +``` +$ conda activate base +$ conda remove --name ansible-dev --all +``` + +如果出现无法解决的错误,通常可以通过在 `~/miniconda3/envs` 中找到该环境并删除整个目录来直接删除环境。如果基础环境损坏了,你可以删除整个 `~/miniconda3`,然后从 PKG 文件中重新安装。只要确保保留 `~/miniconda3/envs` ,或使用 Conda 工具导出环境配置并在以后重新创建即可。 + +MacOS 上不包括 `sshpass` 程序。只有当你的 Ansible 工作要求你向 Ansible 提供 SSH 登录密码时,才需要它。你可以在 SourceForge 上找到当前的 [sshpass 源代码][6]。 + +最后,基础的 Conda Python 模块列表可能缺少你工作所需的一些 Python 模块。如果你需要安装一个模块,首选命令是 `conda install package`,但是需要的话也可以使用 `pip`,Conda 会识别安装的模块。 + +### 结论 + +Ansible 是一个强大的自动化工具,值得我们去学习。Conda 是一个简单有效的 Python 虚拟环境管理工具。 + +在你的 MacOS 环境中保持软件安装分离是保持日常工作环境的稳定性和健全性的谨慎方法。Conda 尤其有助于升级你的 Python 版本,将 Ansible 从其他项目中分离出来,并安全地使用 Ansible。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/using-conda-ansible-administration-macos + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc (CICD with gears) +[2]: https://brew.sh/ +[3]: https://docs.ansible.com/?extIdCarryOver=true&sc_cid=701f2000001OH6uAAG +[4]: https://conda.io/projects/conda/en/latest/index.html +[5]: https://docs.conda.io/en/latest/miniconda.html +[6]: https://sourceforge.net/projects/sshpass/ diff --git a/published/20190829 Getting started with HTTPie for API testing.md b/published/20190829 Getting started with HTTPie for API testing.md new file mode 100644 index 0000000000..c85c165df5 --- /dev/null +++ b/published/20190829 Getting started with HTTPie for API testing.md @@ -0,0 +1,334 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11333-1.html) +[#]: subject: (Getting started with HTTPie for API testing) +[#]: via: (https://opensource.com/article/19/8/getting-started-httpie) +[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/jamesf) + +使用 HTTPie 进行 API 测试 +====== + +> 使用 HTTPie 调试 API,这是一个用 Python 写的易用的命令行工具。 + +![](https://img.linux.net.cn/data/attachment/album/201909/12/102919ry1ute1y9h991ftz.jpg) + +[HTTPie][2] 是一个非常易用、易于升级的 HTTP 客户端。它的发音为 “aitch-tee-tee-pie” 并以 `http` 命令运行,它是一个用 Python 编写的来用于访问 Web 的命令行工具。 + +由于这是一篇关于 HTTP 客户端的指导文章,因此你需要一个 HTTP 服务器来试用它。在这里,访问 [httpbin.org][3],它是一个简单的开源 HTTP 请求和响应服务。httpbin.org 网站是一种测试 Web API 的强大方式,并能仔细管理并显示请求和响应内容,不过现在让我们专注于 HTTPie 的强大功能。 + +### Wget 和 cURL 的替代品 + +你可能听说过古老的 [Wget][4] 或稍微新一些的 [cURL][5] 工具,它们允许你从命令行访问 Web。它们是为访问网站而编写的,而 HTTPie 则用于访问 Web API。 + +网站请求发生在计算机和正在阅读并响应它所看到的内容的最终用户之间,这并不太依赖于结构化的响应。但是,API 请求会在两台计算机之间进行*结构化*调用,人并不是该流程内的一部分,像 HTTPie 这样的命令行工具的参数可以有效地处理这个问题。 + +### 安装 HTTPie + +有几种方法可以安装 HTTPie。你可以通过包管理器安装,无论你使用的是 `brew`、`apt`、`yum` 还是 `dnf`。但是,如果你已配置 [virtualenvwrapper][6],那么你可以用自己的方式安装: + + +``` +$ mkvirtualenv httpie +... +(httpie) $ pip install httpie +... +(httpie) $ deactivate +$ alias http=~/.virtualenvs/httpie/bin/http +$ http -b GET https://httpbin.org/get +{ + "args": {}, + "headers": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2" + }, + "origin": "104.220.242.210, 104.220.242.210", + "url": "https://httpbin.org/get" +} +``` + +通过将 `http` 别名指向为虚拟环境中的命令,即使虚拟环境在非活动状态,你也可以运行它。你可以将 `alias` 命令放在 `.bash_profile` 或 `.bashrc` 中,这样你就可以使用以下命令升级 HTTPie: + + +``` +$ ~/.virtualenvs/httpie/bin/pip install -U pip +``` + +### 使用 HTTPie 查询网站 + +HTTPie 可以简化查询和测试 API。上面使用了一个选项,`-b`(即 `--body`)。没有它,HTTPie 将默认打印整个响应,包括响应头: + +``` +$ http GET https://httpbin.org/get +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Encoding: gzip +Content-Length: 177 +Content-Type: application/json +Date: Fri, 09 Aug 2019 20:19:47 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + +{ + "args": {}, + "headers": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2" + }, + "origin": "104.220.242.210, 104.220.242.210", + "url": "https://httpbin.org/get" +} +``` + +这在调试 API 服务时非常重要,因为大量信息在响应头中发送。例如,查看发送的 cookie 通常很重要。httpbin.org 提供了通过 URL 路径设置 cookie(用于测试目的)的方式。以下设置一个标题为 `opensource`, 值为 `awesome` 的 cookie: + +``` +$ http GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 302 FOUND +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Length: 223 +Content-Type: text/html; charset=utf-8 +Date: Fri, 09 Aug 2019 20:22:39 GMT +Location: /cookies +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +Set-Cookie: opensource=awesome; Path=/ +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + + +Redirecting... +

Redirecting...

+

You should be redirected automatically to target URL: +/cookies. If not click the link. +``` + +注意 `Set-Cookie: opensource=awesome; Path=/` 的响应头。这表明你预期设置的 cookie 已正确设置,路径为 `/`。另请注意,即使你得到了 `302` 重定向,`http` 也不会遵循它。如果你想要遵循重定向,则需要明确使用 `--follow` 标志请求: + +``` +$ http --follow GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Encoding: gzip +Content-Length: 66 +Content-Type: application/json +Date: Sat, 10 Aug 2019 01:33:34 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + +{ + "cookies": { + "opensource": "awesome" + } +} +``` + +但此时你无法看到原来的 `Set-Cookie` 头。为了看到中间响应,你需要使用 `--all`: + + +``` +$ http --headers --all --follow GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 302 FOUND +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Type: text/html; charset=utf-8 +Date: Sat, 10 Aug 2019 01:38:40 GMT +Location: /cookies +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +Set-Cookie: opensource=awesome; Path=/ +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 223 +Connection: keep-alive + +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Encoding: gzip +Content-Type: application/json +Date: Sat, 10 Aug 2019 01:38:41 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 66 +Connection: keep-alive +``` + +打印响应体并不有趣,因为你大多数时候只关心 cookie。如果你想看到中间请求的响应头,而不是最终请求中的响应体,你可以使用: + +``` +$ http --print hb --history-print h --all --follow GET https://httpbin.org/cookies/set/opensource/awesome +HTTP/1.1 302 FOUND +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Type: text/html; charset=utf-8 +Date: Sat, 10 Aug 2019 01:40:56 GMT +Location: /cookies +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +Set-Cookie: opensource=awesome; Path=/ +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 223 +Connection: keep-alive + +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Content-Encoding: gzip +Content-Type: application/json +Date: Sat, 10 Aug 2019 01:40:56 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block +Content-Length: 66 +Connection: keep-alive + +{ + "cookies": { + "opensource": "awesome" + } +} +``` + +你可以使用 `--print` 精确控制打印的内容(`h`:响应头;`b`:响应体),并使用 `--history-print` 覆盖中间请求的打印内容设置。 + +### 使用 HTTPie 下载二进制文件 + +有时响应体并不是文本形式,它需要发送到可被不同应用打开的文件: + +``` +$ http GET https://httpbin.org/image/jpeg +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Length: 35588 +Content-Type: image/jpeg +Date: Fri, 09 Aug 2019 20:25:49 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + + ++-----------------------------------------+ +| NOTE: binary data not shown in terminal | ++-----------------------------------------+ +``` + +要得到正确的图片,你需要保存到文件: + +``` +$ http --download GET https://httpbin.org/image/jpeg +HTTP/1.1 200 OK +Access-Control-Allow-Credentials: true +Access-Control-Allow-Origin: * +Connection: keep-alive +Content-Length: 35588 +Content-Type: image/jpeg +Date: Fri, 09 Aug 2019 20:28:13 GMT +Referrer-Policy: no-referrer-when-downgrade +Server: nginx +X-Content-Type-Options: nosniff +X-Frame-Options: DENY +X-XSS-Protection: 1; mode=block + +Downloading 34.75 kB to "jpeg.jpe" +Done. 34.75 kB in 0.00068s (50.05 MB/s) +``` + +试一下!图片很可爱。 + +### 使用 HTTPie 发送自定义请求 + +你可以发送指定的请求头。这对于需要非标准头的自定义 Web API 很有用: + +``` +$ http GET https://httpbin.org/headers X-Open-Source-Com:Awesome +{ + "headers": { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2", + "X-Open-Source-Com": "Awesome" + } +} +``` + +最后,如果要发送 JSON 字段(尽管可以指定确切的内容),对于许多嵌套较少的输入,你可以使用快捷方式: + + +``` +$ http --body PUT https://httpbin.org/anything open-source=awesome author=moshez +{ + "args": {}, + "data": "{\"open-source\": \"awesome\", \"author\": \"moshez\"}", + "files": {}, + "form": {}, + "headers": { + "Accept": "application/json, */*", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "46", + "Content-Type": "application/json", + "Host": "httpbin.org", + "User-Agent": "HTTPie/1.0.2" + }, + "json": { + "author": "moshez", + "open-source": "awesome" + }, + "method": "PUT", + "origin": "73.162.254.113, 73.162.254.113", + "url": "https://httpbin.org/anything" +} +``` + +下次在调试 Web API 时,无论是你自己的还是别人的,记得放下 cURL,试试 HTTPie 这个命令行工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/getting-started-httpie + +作者:[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/moshezhttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pie-raspberry-bake-make-food.png?itok=QRV_R8Fa (Raspberry pie with slice missing) +[2]: https://httpie.org/ +[3]: https://github.com/postmanlabs/httpbin +[4]: https://en.wikipedia.org/wiki/Wget +[5]: https://en.wikipedia.org/wiki/CURL +[6]: https://opensource.com/article/19/6/virtual-environments-python-macos diff --git a/published/20190829 Three Ways to Exclude Specific-Certain Packages from Yum Update.md b/published/20190829 Three Ways to Exclude Specific-Certain Packages from Yum Update.md new file mode 100644 index 0000000000..f0d1ba9087 --- /dev/null +++ b/published/20190829 Three Ways to Exclude Specific-Certain Packages from Yum Update.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11315-1.html) +[#]: subject: (Three Ways to Exclude Specific/Certain Packages from Yum Update) +[#]: via: (https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +从 Yum 更新中排除特定/某些包的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/07/145817rj7khqkbqwqx7sb9.jpg) + +作为系统更新的一部分,你也许需要在基于 Red Hat 系统中由于应用依赖排除一些软件包。 + +如果是,如何排除?可以采取多少种方式?有三种方式可以做到,我们会在本篇中教你这三种方法。 + +包管理器是一组工具,它允许用户在 Linux 系统中轻松管理包。它能让用户在 Linux 系统中安装、更新/升级、删除、查询、重新安装和搜索软件包。 + +对于基于 Red Hat 的系统,我们使用 [yum 包管理器][1] 和 [rpm 包管理器][2] 进行包管理。 + +### 什么是 yum? + +yum 代表 “Yellowdog Updater, Modified”。Yum 是用于 rpm 系统的自动更新程序和包安装/卸载器。 + +它在安装包时自动解决依赖关系。 + +### 什么是 rpm? + +rpm 代表 “Red Hat Package Manager”,它是一款用于 Red Hat 系统的功能强大的包管理工具。 + +RPM 指的是 `.rpm` 文件格式,它包含已编译的软件和必要的库。 + +你可能有兴趣阅读以下与本主题相关的文章。如果是的话,请进入相应的链接。 + + * [如何检查 Red Hat(RHEL)和 CentOS 系统上的可用安全更新][3] + * [在 Red Hat(RHEL)和 CentOS 系统上安装安全更新的四种方法][4] + * [在 Redhat(RHEL)和 CentOS 系统上检查或列出已安装的安全更新的两种方法][5] + +### 方法 1:手动或临时用 yum 命令排除包 + +我们可以在 yum 中使用 `--exclude` 或 `-x` 开关来阻止 yum 命令获取特定包的更新。 + +我可以说,这是一种临时方法或按需方法。如果你只想将特定包排除一次,那么我们可以使用此方法。 + +以下命令将更新除 kernel 之外的所有软件包。 + +要排除单个包: + +``` +# yum update --exclude=kernel +或者 +# yum update -x 'kernel' +``` + +要排除多个包。以下命令将更新除 kernel 和 php 之外的所有软件包。 + +``` +# yum update --exclude=kernel* --exclude=php* +或者 +# yum update --exclude httpd,php +``` + +### 方法 2:在 yum 命令中永久排除软件包 + +这是永久性方法,如果你经常执行修补程序更新,那么可以使用此方法。 + +为此,请在 `/etc/yum.conf` 中添加相应的软件包以永久禁用软件包更新。 + +添加后,每次运行 `yum update` 命令时都不需要指定这些包。此外,这可以防止任何意外更新这些包。 + +``` +# vi /etc/yum.conf + +[main] +cachedir=/var/cache/yum/$basearch/$releasever +keepcache=0 +debuglevel=2 +logfile=/var/log/yum.log +exactarch=1 +obsoletes=1 +gpgcheck=1 +plugins=1 +installonly_limit=3 +exclude=kernel* php* +``` + +### 方法 3:使用 Yum versionlock 插件排除包 + +这也是与上面类似的永久方法。Yum versionlock 插件允许用户通过 `yum` 命令锁定指定包的更新。 + +为此,请运行以下命令。以下命令将从 `yum update` 中排除 freetype 包。 + +或者,你可以直接在 `/etc/yum/pluginconf.d/versionlock.list` 中添加条目。 + +``` +# yum versionlock add freetype + +Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock +Adding versionlock on: 0:freetype-2.8-12.el7 +versionlock added: 1 +``` + +运行以下命令来检查被 versionlock 插件锁定的软件包列表。 + +``` +# yum versionlock list + +Loaded plugins: changelog, package_upload, product-id, search-disabled-repos, subscription-manager, verify, versionlock +0:freetype-2.8-12.el7.* +versionlock list done +``` + +运行以下命令清空该列表。 + +``` +# yum versionlock clear +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/rpm-command-examples/ +[3]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/ +[4]: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/ +[5]: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/ diff --git a/published/20190830 Change your Linux terminal color theme.md b/published/20190830 Change your Linux terminal color theme.md new file mode 100644 index 0000000000..321dc40997 --- /dev/null +++ b/published/20190830 Change your Linux terminal color theme.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11310-1.html) +[#]: subject: (Change your Linux terminal color theme) +[#]: via: (https://opensource.com/article/19/8/add-color-linux-terminal) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何更改 Linux 终端颜色主题 +====== + +> 你可以用丰富的选项来定义你的终端主题。 + +![](https://img.linux.net.cn/data/attachment/album/201909/06/070600ztd434ppd99df99d.jpg) + +如果你大部分时间都盯着终端,那么你很自然地希望它看起来能赏心悦目。美与不美,全在观者,自 CRT 串口控制台以来,终端已经经历了很多变迁。因此,你的软件终端窗口有丰富的选项,可以用来定义你看到的主题,不管你如何定义美,这总是件好事。 + +### 设置 + +包括 GNOME、KDE 和 Xfce 在内的流行的软件终端应用,它们都提供了更改其颜色主题的选项。调整主题就像调整应用首选项一样简单。Fedora、RHEL 和 Ubuntu 默认使用 GNOME,因此本文使用该终端作为示例,但对 Konsole、Xfce 终端和许多其他终端的设置流程类似。 + +首先,进入到应用的“首选项”或“设置”面板。在 GNOME 终端中,你可以通过屏幕顶部或窗口右上角的“应用”菜单访问它。 + +在“首选项”中,单击“配置文件” 旁边的加号(“+”)来创建新的主题配置文件。在新配置文件中,单击“颜色”选项卡。 + +![GNOME Terminal preferences][2] + +在“颜色”选项卡中,取消选择“使用系统主题中的颜色”选项,以使窗口的其余部分变为可选状态。最开始,你可以选择内置的颜色方案。这些包括浅色主题,它有明亮的背景和深色的前景文字;还有深色主题,它有深色背景和浅色前景文字。 + +当没有其他设置(例如 `dircolors` 命令的设置)覆盖它们时,“默认颜色”色板将同时定义前景色和背景色。“调色板”设置 `dircolors` 命令定义的颜色。这些颜色由终端以 `LS_COLORS` 环境变量的形式使用,以在 [ls][3] 命令的输出中添加颜色。如果这些颜色不吸引你,请在此更改它们。 + +如果对主题感到满意,请关闭“首选项”窗口。 + +要将终端更改为新的配置文件,请单击“应用”菜单,然后选择“配置文件”。选择新的配置文件,接着享受自定义主题。 + +![GNOME Terminal profile selection][4] + +### 命令选项 + +如果你的终端没有合适的设置窗口,它仍然可以在启动命令中提供颜色选项。xterm 和 rxvt 终端(旧的和启用 Unicode 的变体,有时称为 urxvt 或 rxvt-unicode)都提供了这样的选项,因此即使没有桌面环境和大型 GUI 框架,你仍然可以设置终端模拟器的主题。 + +两个明显的选项是前景色和背景色,分别用 `-fg` 和 `-bg` 定义。每个选项的参数是*颜色名*而不是它的 ANSI 编号。例如: + +``` +$ urxvt -bg black -fg green +``` + +这些会设置默认的前景和背景。如果有任何其他规则会控制特定文件或设备类型的颜色,那么就使用这些颜色。有关如何设置它们的信息,请参阅 [dircolors][5] 命令。 + +你还可以使用 `-cr` 设置文本光标(而不是鼠标光标)的颜色: + +``` +$ urxvt -bg black -fg green -cr teal +``` + +![Setting color in urxvt][6] + +你的终端模拟器可能还有更多选项,如边框颜色(rxvt 中的 `-bd`)、光标闪烁(urxvt 中的 `-bc` 和 `+bc`),甚至背景透明度。请参阅终端的手册页,了解更多的功能。 + +要使用你选择的颜色启动终端,你可以将选项添加到用于启动终端的命令或菜单中(例如,在你的 Fluxbox 菜单文件、`$HOME/.local/share/applications` 目录中的 `.desktop` 或者类似的)。或者,你可以使用 [xrdb][7] 工具来管理与 X 相关的资源(但这超出了本文的范围)。 + +### 家是可定制的地方 + +自定义 Linux 机器并不意味着你需要学习如何编程。你可以而且应该进行小而有意义的更改,来使你的数字家庭感觉更舒适。而且没有比终端更好的起点了! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/add-color-linux-terminal + +作者:[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/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://opensource.com/sites/default/files/uploads/gnome-terminal-preferences.jpg (GNOME Terminal preferences) +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://opensource.com/sites/default/files/uploads/gnome-terminal-profile-select.jpg (GNOME Terminal profile selection) +[5]: http://man7.org/linux/man-pages/man1/dircolors.1.html +[6]: https://opensource.com/sites/default/files/uploads/urxvt-color.jpg (Setting color in urxvt) +[7]: https://www.x.org/releases/X11R7.7/doc/man/man1/xrdb.1.xhtml diff --git a/published/20190830 How to Create and Use Swap File on Linux.md b/published/20190830 How to Create and Use Swap File on Linux.md new file mode 100644 index 0000000000..d8db4b5623 --- /dev/null +++ b/published/20190830 How to Create and Use Swap File on Linux.md @@ -0,0 +1,254 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11341-1.html) +[#]: subject: (How to Create and Use Swap File on Linux) +[#]: via: (https://itsfoss.com/create-swap-file-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 上创建和使用交换文件 +====== + +本教程讨论了 Linux 中交换文件的概念,为什么使用它以及它相对于传统交换分区的优势。你将学习如何创建交换文件和调整其大小。 + +### 什么是 Linux 的交换文件? + +交换文件允许 Linux 将磁盘空间模拟为内存。当你的系统开始耗尽内存时,它会使用交换空间将内存的一些内容交换到磁盘空间上。这样释放了内存,为更重要的进程服务。当内存再次空闲时,它会从磁盘交换回数据。我建议[阅读这篇文章,了解 Linux 上的交换空间的更多内容][1]。 + +传统上,交换空间是磁盘上的一个独立分区。安装 Linux 时,只需创建一个单独的分区进行交换。但是这种趋势在最近几年发生了变化。 + +使用交换文件,你不再需要单独的分区。你会根目录下创建一个文件,并告诉你的系统将其用作交换空间就行了。 + +使用专用的交换分区,在许多情况下,调整交换空间的大小是一个可怕而不可能的任务。但是有了交换文件,你可以随意调整它们的大小。 + +最新版本的 Ubuntu 和其他一些 Linux 发行版已经开始 [默认使用交换文件][2]。甚至如果你没有创建交换分区,Ubuntu 也会自己创建一个 1GB 左右的交换文件。 + +让我们看看交换文件的更多信息。 + +![](https://img.linux.net.cn/data/attachment/album/201909/14/190637uggjgsjoogxg3vh0.jpg) + +### 检查 Linux 的交换空间 + +在你开始添加交换空间之前,最好检查一下你的系统中是否已经有了交换空间。 + +你可以用[Linux 上的 free 命令][4]检查它。就我而言,我的[戴尔 XPS][5]有 14GB 的交换容量。 + +``` +free -h + total used free shared buff/cache available +Mem: 7.5G 4.1G 267M 971M 3.1G 2.2G +Swap: 14G 0B 14G +``` + +`free` 命令给出了交换空间的大小,但它并没有告诉你它是真实的交换分区还是交换文件。`swapon` 命令在这方面会更好。 + +``` +swapon --show +NAME TYPE SIZE USED PRIO +/dev/nvme0n1p4 partition 14.9G 0B -2 +``` + +如你所见,我有 14.9GB 的交换空间,它在一个单独的分区上。如果是交换文件,类型应该是 `file` 而不是 `partition`。 + +``` +swapon --show +NAME TYPE SIZE USED PRIO +/swapfile file 2G 0B -2 +``` + +如果你的系统上没有交换空间,它应该显示如下内容: + +``` +free -h + total used free shared buff/cache available +Mem: 7.5G 4.1G 267M 971M 3.1G 2.2G +Swap: 0B 0B 0B +``` + +而 `swapon` 命令不会显示任何输出。 + + +### 在 Linux 上创建交换文件 + +如果你的系统没有交换空间,或者你认为交换空间不足,你可以在 Linux 上创建交换文件。你也可以创建多个交换文件。 + +让我们看看如何在 Linux 上创建交换文件。我在本教程中使用 Ubuntu 18.04,但它也应该适用于其他 Linux 发行版本。 + +#### 步骤 1:创建一个新的交换文件 + +首先,创建一个具有所需交换空间大小的文件。假设我想给我的系统增加 1GB 的交换空间。使用`fallocate` 命令创建大小为 1GB 的文件。 + +``` +sudo fallocate -l 1G /swapfile +``` + +建议只允许 `root` 用户读写该交换文件。当你尝试将此文件用于交换区域时,你甚至会看到类似“不安全权限 0644,建议 0600”的警告。 + +``` +sudo chmod 600 /swapfile +``` + +请注意,交换文件的名称可以是任意的。如果你需要多个交换空间,你可以给它任何合适的名称,如 `swap_file_1`、`swap_file_2` 等。它们只是一个预定义大小的文件。 + +#### 步骤 2:将新文件标记为交换空间 + +你需要告诉 Linux 系统该文件将被用作交换空间。你可以用 [mkswap][7] 工具做到这一点。 + +``` +sudo mkswap /swapfile +``` + +你应该会看到这样的输出: + +``` +Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes) +no label, UUID=7e1faacb-ea93-4c49-a53d-fb40f3ce016a +``` + +#### 步骤 3:启用交换文件 + +现在,你的系统知道文件 `swapfile` 可以用作交换空间。但是还没有完成。你需要启用该交换文件,以便系统可以开始使用该文件作为交换。 + +``` +sudo swapon /swapfile +``` + +现在,如果你检查交换空间,你应该会看到你的 Linux 系统会识别并使用它作为交换空间: + +``` +swapon --show +NAME TYPE SIZE USED PRIO +/swapfile file 1024M 0B -2 +``` + +#### 步骤 4:让改变持久化 + +迄今为止你所做的一切都是暂时的。重新启动系统,所有更改都将消失。 + +你可以通过将新创建的交换文件添加到 `/etc/fstab` 文件来使更改持久化。 + +对 `/etc/fstab` 文件进行任何更改之前,最好先进行备份。 + +``` +sudo cp /etc/fstab /etc/fstab.back +``` + +现在将以下行添加到 `/etc/fstab` 文件的末尾: + +``` +/swapfile none swap sw 0 0 +``` + +你可以使用[命令行文本编辑器][8]手动操作,或者使用以下命令: + +``` +echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab +``` + +现在一切都准备好了。即使在重新启动你的 Linux 系统后,你的交换文件也会被使用。 + +### 调整 swappiness 参数 + +`swappiness` 参数决定了交换空间的使用频率。`swappiness` 值的范围从 0 到 100。较高的值意味着交换空间将被更频繁地使用。 + +Ubuntu 桌面的默认的 `swappiness` 是 60,而服务器的默认 `swappiness` 是 1。你可以使用以下命令检查 `swappiness`: + +``` +cat /proc/sys/vm/swappiness +``` + +为什么服务器应该使用低的 `swappiness` 值?因为交换空间比内存慢,为了获得更好的性能,应该尽可能多地使用内存。在服务器上,性能因素至关重要,因此 `swappiness` 应该尽可能低。 + +你可以使用以下系统命令动态更改 `swappiness`: + +``` +sudo sysctl vm.swappiness=25 +``` + +这种改变只是暂时的。如果要使其永久化,可以编辑 `/etc/sysctl.conf` 文件,并在文件末尾添加`swappiness` 值: + +``` +vm.swappiness=25 +``` + +### 在 Linux 上调整交换空间的大小 + +在 Linux 上有几种方法可以调整交换空间的大小。但是在你看到这一点之前,你应该了解一些关于它的事情。 + +当你要求系统停止将交换文件用于交换空间时,它会将所有数据(确切地说是内存页)传输回内存。所以你应该有足够的空闲内存,然后再停止交换。 + +这就是为什么创建和启用另一个临时交换文件是一个好的做法的原因。这样,当你关闭原来的交换空间时,你的系统将使用临时交换文件。现在你可以调整原来的交换空间的大小。你可以手动删除临时交换文件或留在那里,下次启动时会自动删除(LCTT 译注:存疑?)。 + +如果你有足够的可用内存或者创建了临时交换空间,那就关闭你原来的交换文件。 + +``` +sudo swapoff /swapfile +``` + +现在你可以使用 `fallocate` 命令来更改文件的大小。比方说,你将其大小更改为 2GB: + +``` +sudo fallocate -l 2G /swapfile +``` + +现在再次将文件标记为交换空间: + +``` +sudo mkswap /swapfile +``` + +并再次启用交换文件: + +``` +sudo swapon /swapfile +``` + +你也可以选择同时拥有多个交换文件。 + +### 删除 Linux 中的交换文件 + +你可能有不在 Linux 上使用交换文件的原因。如果你想删除它,该过程类似于你刚才看到的调整交换大小的过程。 + +首先,确保你有足够的空闲内存。现在关闭交换文件: + +``` +sudo swapoff /swapfile +``` + +下一步是从 `/etc/fstab` 文件中删除相应的条目。 + +最后,你可以删除该文件来释放空间: + +``` +sudo rm /swapfile +``` + +### 你用了交换空间了吗? + +我想你现在已经很好地理解了 Linux 中的交换文件概念。现在,你可以根据需要轻松创建交换文件或调整它们的大小。 + +如果你对这个话题有什么要补充的或者有任何疑问,请在下面留下评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/create-swap-file-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/swap-size/ +[2]: https://help.ubuntu.com/community/SwapFaq +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/swap-file-linux.png?resize=800%2C450&ssl=1 +[4]: https://linuxhandbook.com/free-command/ +[5]: https://itsfoss.com/dell-xps-13-ubuntu-review/ +[6]: https://itsfoss.com/fix-missing-system-settings-ubuntu-1404-quick-tip/ +[7]: http://man7.org/linux/man-pages/man8/mkswap.8.html +[8]: https://itsfoss.com/command-line-text-editors-linux/ +[9]: https://itsfoss.com/replace-linux-from-dual-boot/ diff --git a/published/20190831 Google opens Android speech transcription and gesture tracking, Twitter-s telemetry tooling, Blender-s growing adoption, and more news.md b/published/20190831 Google opens Android speech transcription and gesture tracking, Twitter-s telemetry tooling, Blender-s growing adoption, and more news.md new file mode 100644 index 0000000000..c6370eb975 --- /dev/null +++ b/published/20190831 Google opens Android speech transcription and gesture tracking, Twitter-s telemetry tooling, Blender-s growing adoption, and more news.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11292-1.html) +[#]: subject: (Google opens Android speech transcription and gesture tracking, Twitter's telemetry tooling, Blender's growing adoption, and more news) +[#]: via: (https://opensource.com/19/8/news-august-31) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +开源新闻综述:谷歌开源 Android 语音转录和手势追踪、Twitter 的遥测工具 +====== + +> 不要错过两周以来最大的开源头条新闻。 + +![Weekly news roundup with TV][1] + +在本期的开源新闻综述中,我们来看看谷歌发布的两个开源软件、Twitter 的最新可观测性工具、动漫工作室对 Blender 的采用在增多等等新闻! + +### 谷歌的开源双响炮 + +搜索引擎巨头谷歌的开发人员最近一直忙于开源。在过去的两周里,他们以开源的方式发布了两个截然不同的软件。 + +第一个是 Android 的语音识别和转录工具 Live Transcribe 的[语音引擎][2],它可以“在移动设备上使用机器学习算法将音频变成实时字幕”。谷歌的声明称,它正在开源 Live Transcribe 以“让所有开发人员可以为长篇对话提供字幕”。你可以[在 GitHub 上][3]浏览或下载 Live Transcribe 的源代码。 + +谷歌还为 Android 和 iOS 开源了[手势跟踪软件][4],它建立在其 [MediaPipe][5] 机器学习框架之上。该软件结合了三种人工智能组件:手掌探测器、“返回 3D 手点”的模型和手势识别器。据谷歌研究人员称,其目标是改善“跨各种技术领域和平台的用户体验”。该软件的源代码和文档[可在 GitHub 上获得][6]。 + +### Twitter 开源 Rezolus 遥测工具 + +当想到网络中断时,我们想到的是影响站点或服务性能的大崩溃或减速。让我们感到惊讶的是性能慢慢被吃掉的小尖峰的重要性。为了更容易地检测这些尖峰,Twitter 开发了一个名为 Rezolus 的工具,该公司[已将其开源][7]。 + +> 我们现有的按分钟采样的遥测技术未能反映出这些异常现象。这是因为相对于该异常发生的长度,较低的采样率掩盖了这些持续时间大约为 10 秒的异常。这使得很难理解正在发生的事情并调整系统以获得更高的性能。 + +Rezolus 旨在检测“非常短暂但有时显著的性能异常”——仅持续几秒钟。Twitter 已经运行了 Rezolus 大约一年,并且一直在使用它收集的内容“与后端服务日志来确定峰值的来源”。 + +如果你对将 Rezolus 添加到可观测性堆栈中的结果感到好奇,请查看 Twitter 的 [GitHub 存储库][8]中的源代码。 + +### 日本的 Khara 动画工作室采用 Blender + +Blender 被认为是开源的动画和视觉效果软件的黄金标准。它被几家制作公司采用,其中最新的是[日本动漫工作室 Khara][9]。 + +Khara 正在使用 Blender 开发 Evangelion: 3.0+1.0,这是基于流行动漫系列《Neon Genesis Evangelion》的电影系列的最新版本。虽然该电影的工作不能在 Blender 中全部完成,但 Khara 的员工“将从 2020 年 6 月开始使用 Blender 进行大部分工作”。为了强调其对 Blender 和开源的承诺,“Khara 宣布它将作为企业会员加入 Blender 基金会的发展基金。“ + +### NSA 分享其固件安全工具 + +继澳大利亚同行[共享他们的一个工具][10]之后,美国国家安全局(NSA)正在[提供][11]的一个项目的成果“可以更好地保护机器免受固件攻击“。这个最新的软件以及其他保护固件的开源工作可以在 [Coreboot Gerrit 存储库][12]下找到。 + +这个名为“具有受保护执行的 SMI 传输监视器”(STM-PE)的软件“将与运行 Coreboot 的 x86 处理器配合使用”以防止固件攻击。根据 NSA 高级网络安全实验室的 Eugene Meyers 的说法,STM-PE 采用低级操作系统代码“并将其置于一个盒子中,以便它只能访问它需要访问的设备系统”。这有助于防止篡改,Meyers 说,“这将提高系统的安全性。” + +### 其它新闻 + +* [Linux 内核中的 exFAT?是的!][13] +* [瓦伦西亚继续支持 Linux 学校发行版][14] +* [西班牙首个开源卫星][15] +* [Western Digital 从开放标准到开源芯片的长途旅行][16] +* [用于自动驾驶汽车多模传感器的 Waymo 开源数据集][17] + +一如既往地感谢 Opensource.com 的工作人员和主持人本周的帮助。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/19/8/news-august-31 + +作者:[Scott Nesbitt][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/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/08/16/google-open-sources-live-transcribes-speech-engine/ +[3]: https://github.com/google/live-transcribe-speech-engine +[4]: https://venturebeat.com/2019/08/19/google-open-sources-gesture-tracking-ai-for-mobile-devices/ +[5]: https://github.com/google/mediapipe +[6]: https://github.com/google/mediapipe/blob/master/mediapipe/docs/hand_tracking_mobile_gpu.md +[7]: https://blog.twitter.com/engineering/en_us/topics/open-source/2019/introducing-rezolus.html +[8]: https://github.com/twitter/rezolus +[9]: https://www.neowin.net/news/anime-studio-khara-is-planning-to-use-open-source-blender-software/ +[10]: https://linux.cn/article-11241-1.html +[11]: https://www.cyberscoop.com/nsa-firmware-open-source-coreboot-stm-pe-eugene-myers/ +[12]: https://review.coreboot.org/admin/repos +[13]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[14]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/120000-lliurex-desktops +[15]: https://hackaday.com/2019/08/15/spains-first-open-source-satellite/ +[16]: https://www.datacenterknowledge.com/open-source/western-digitals-long-trip-open-standards-open-source-chips +[17]: https://venturebeat.com/2019/08/21/waymo-open-sources-data-set-for-autonomous-vehicle-multimodal-sensors/ diff --git a/published/20190902 Why I use Java.md b/published/20190902 Why I use Java.md new file mode 100644 index 0000000000..d4ec8d6570 --- /dev/null +++ b/published/20190902 Why I use Java.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11337-1.html) +[#]: subject: (Why I use Java) +[#]: via: (https://opensource.com/article/19/9/why-i-use-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +我为什么使用 Java +====== + +> 根据你的工作需要,可能有比 Java 更好的语言,但是我还没有看到任何能把我拉走的语言。 + +![](https://img.linux.net.cn/data/attachment/album/201909/13/171223bf7noo4bbnkxbkdk.jpg) + +我记得我是从 1997 年开始使用 Java 的,就在 [Java 1.1 刚刚发布][2]不久之后。从那时起,总的来说,我非常喜欢用 Java 编程;虽然我得承认,这些日子我经常像在 Java 中编写“严肃的代码”一样编写 [Groovy][3] 脚本。 + +来自 [FORTRAN][4]、[PL/1][5]、[Pascal][6] 以及最后的 [C 语言][7] 背景,我发现了许多让我喜欢 Java 的东西。Java 是我[面向对象编程][8]的第一次重要实践经验。到那时,我已经编程了大约 20 年,而且可以说我对什么重要、什么不重要有了一些看法。 + +### 调试是一个关键的语言特性 + +我真的很讨厌浪费时间追踪由我的代码不小心迭代到数组末尾而导致的模糊错误,特别是在 IBM 大型机上的 FORTRAN 编程时代。另一个不时出现的隐晦问题是调用一个子程序时,该子程序带有一个四字节整数参数,而预期有两个字节;在小端架构上,这通常是一个良性的错误,但在大端机器上,前两个字节的值通常并不总是为零。 + +在那种批处理环境中进行调试也非常不便,通过核心转储或插入打印语句进行调试,这些语句本身会移动错误的位置甚至使它们消失。 + +所以我使用 Pascal 的早期体验,先是在 [MTS][9] 上,然后是在 [IBM OS/VS1][10] 上使用相同的 MTS 编译器,让我的生活变得更加轻松。Pascal 的[强类型和静态类型][11]是取得这种胜利的重要组成部分,我使用的每个 Pascal 编译器都会在数组的边界和范围上插入运行时检查,因此错误可以在发生时检测到。当我们在 20 世纪 80 年代早期将大部分工作转移到 Unix 系统时,移植 Pascal 代码是一项简单的任务。 + +### 适量的语法 + +但是对于我所喜欢的 Pascal 来说,我的代码很冗长,而且语法似乎要比代码还要多;例如,使用: + +``` +if ... then begin ... end else ... end +``` + +而不是 C 或类似语言中的: + +``` +if (...) { ... } else { ... } +``` + +另外,有些事情在 Pascal 中很难完成,在 C 中更容易。但是,当我开始越来越多地使用 C 时,我发现自己遇到了我曾经在 FORTRAN 中遇到的同样类型的错误,例如,超出数组边界。在原始的错误点未检测到数组结束,而仅在程序执行后期才会检测到它们的不利影响。幸运的是,我不再生活在那种批处理环境中,并且手头有很好的调试工具。不过,C 对于我来说有点太灵活了。 + +当我遇到 [awk][12] 时,我发现它与 C 相比又是另外一种样子。那时,我的很多工作都涉及转换字段数据并创建报告。我发现用 `awk` 加上其他 Unix 命令行工具,如 `sort`、`sed`、`cut`、`join`、`paste`、`comm` 等等,可以做到事情令人吃惊。从本质上讲,这些工具给了我一个像是基于文本文件的关系数据库管理器,这种文本文件具有列式结构,是我们很多字段数据的保存方式。或者,即便不是这种格式,大部分时候也可以从关系数据库或某种二进制格式导出到列式结构中。 + +`awk` 支持的字符串处理、[正则表达式][13]和[关联数组][14],以及 `awk` 的基本特性(它实际上是一个数据转换管道),非常符合我的需求。当面对二进制数据文件、复杂的数据结构和关键性能需求时,我仍然会转回到 C;但随着我越来越多地使用 `awk`,我发现 C 的非常基础的字符串支持越来越令人沮丧。随着时间的推移,更多的时候我只会在必须时才使用 C,并且在其余的时候里大量使用 `awk`。 + +### Java 的抽象层级合适 + +然后是 Java。它看起来相当不错 —— 相对简洁的语法,让人联想到 C,或者这种相似性至少要比 Pascal 或其他任何早期的语言更为明显。它是强类型的,因此很多编程错误会在编译时被捕获。它似乎并不需要过多的面向对象的知识就能起步,这是一件好事,因为我当时对 [OOP 设计模式][15]毫不熟悉。但即使在刚刚开始,我也喜欢它的简化[继承模型][16]背后的思想。(Java 允许使用提供的接口进行单继承,以在某种程度上丰富范例。) + +它似乎带有丰富的功能库(即“自备电池”的概念),在适当的水平上直接满足了我的需求。最后,我发现自己很快就会想到将数据和行为在对象中组合在一起的想法。这似乎是明确控制数据之间交互的好方法 —— 比大量的参数列表或对全局变量的不受控制的访问要好得多。 + +从那以后,Java 在我的编程工具箱中成为了 Helvetic 军刀。我仍然偶尔会在 `awk` 中编写程序,或者使用 Linux 命令行实用程序(如 `cut`、`sort` 或 `sed`),因为它们显然是解决手头问题的直接方法。我怀疑过去 20 年我可能没写过 50 行的 C 语言代码;Java 完全满足了我的需求。 + +此外,Java 一直在不断改进。首先,它变得更加高效。并且它添加了一些非常有用的功能,例如[可以用 try 来测试资源][17],它可以很好地清理在文件 I/O 期间冗长而有点混乱的错误处理代码;或 [lambda][18],它提供了声明函数并将其作为参数传递的能力,而旧方法需要创建类或接口来“托管”这些函数;或[流][19],它在函数中封装了迭代行为,可以创建以链式函数调用形式实现的高效数据转换管道。 + +### Java 越来越好 + +许多语言设计者研究了从根本上改善 Java 体验的方法。对我来说,其中大部分没有引起我的太多兴趣;再次,这更多地反映了我的典型工作流程,并且(更多地)减少了这些语言带来的功能。但其中一个演化步骤已经成为我的编程工具中不可或缺的一部分:[Groovy][20]。当我遇到一个小问题,需要一个简单的解决方案时,Groovy 已经成为了我的首选。而且,它与 Java 高度兼容。对我来说,Groovy 填补了 Python 为许多其他人所提供的相同用处 —— 它紧凑、DRY(不要重复自己)和具有表达性(列表和词典有完整的语言支持)。我还使用了 [Grails][21],它使用 Groovy 为非常高性能和有用的 Java Web 应用程序提供简化的 Web 框架。 + +### Java 仍然开源吗? + +最近,对 [OpenJDK][22] 越来越多的支持进一步提高了我对 Java 的舒适度。许多公司以各种方式支持 OpenJDK,包括 [AdoptOpenJDK、Amazon 和 Red Hat][23]。在我的一个更大、更长期的项目中,我们使用 AdoptOpenJDK [来在几个桌面平台上生成自定义的运行时环境][24]。 + +有没有比 Java 更好的语言?我确信有,这取决于你的工作需要。但我一直对 Java 非常满意,我还没有遇到任何可能会让我失望的东西。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/why-i-use-java + +作者:[Chris Hermansen][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/clhermansen +[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://en.wikipedia.org/wiki/Java_version_history +[3]: https://en.wikipedia.org/wiki/Apache_Groovy +[4]: https://en.wikipedia.org/wiki/Fortran +[5]: https://en.wikipedia.org/wiki/PL/I +[6]: https://en.wikipedia.org/wiki/Pascal_(programming_language) +[7]: https://en.wikipedia.org/wiki/C_(programming_language) +[8]: https://en.wikipedia.org/wiki/Object-oriented_programming +[9]: https://en.wikipedia.org/wiki/Michigan_Terminal_System +[10]: https://en.wikipedia.org/wiki/OS/VS1 +[11]: https://stackoverflow.com/questions/11889602/difference-between-strong-vs-static-typing-and-weak-vs-dynamic-typing +[12]: https://en.wikipedia.org/wiki/AWK +[13]: https://en.wikipedia.org/wiki/Regular_expression +[14]: https://en.wikipedia.org/wiki/Associative_array +[15]: https://opensource.com/article/19/7/understanding-software-design-patterns +[16]: https://www.w3schools.com/java/java_inheritance.asp +[17]: https://www.baeldung.com/java-try-with-resources +[18]: https://www.baeldung.com/java-8-lambda-expressions-tips +[19]: https://www.tutorialspoint.com/java8/java8_streams +[20]: https://groovy-lang.org/ +[21]: https://grails.org/ +[22]: https://openjdk.java.net/ +[23]: https://en.wikipedia.org/wiki/OpenJDK +[24]: https://opensource.com/article/19/4/java-se-11-removing-jnlp diff --git a/published/20190903 5 open source speed-reading applications.md b/published/20190903 5 open source speed-reading applications.md new file mode 100644 index 0000000000..ef922bf1e8 --- /dev/null +++ b/published/20190903 5 open source speed-reading applications.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11316-1.html) +[#]: subject: (5 open source speed-reading applications) +[#]: via: (https://opensource.com/article/19/8/speed-reading-open-source) +[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari) + +5 个开源的速读应用 +====== + +> 使用这五个应用训练自己更快地阅读文本。 + +![](https://img.linux.net.cn/data/attachment/album/201909/07/151320r39o26onsp3sq1qo.jpg) + +英国散文家和政治家 [Joseph Addison][2] 曾经说过,“读书益智,运动益体。”如今,我们大多数人(如果不是全部)都是通过计算机显示器、电视屏幕、移动设备、街道标志、报纸、杂志上阅读,以及在工作场所和学校阅读论文来训练我们的大脑。 + +鉴于我们每天都会收到大量的书面信息,通过做一些挑战我们经典的阅读习惯并教会我们吸收更多内容和数据的特定练习,来训练我们的大脑以便更快地阅读似乎是有利的。学习这些技能的目的不仅仅是浏览文本,因为没有理解的阅读就是浪费精力。目标是提高你的阅读速度,同时仍然达到高水平的理解。 + +### 阅读和处理输入 + +在深入探讨速读之前,让我们来看看阅读过程。根据法国眼科医生 Louis Emile Javal 的说法,阅读分为三个步骤: + + 1. 固定 + 2. 处理 + 3. [扫视][3]saccade + +在第一步,我们确定文本中的固定点,称为最佳识别点。在第二步中,我们在眼睛固定的同时引入(处理)新信息。最后,我们改变注视点的位置,这是一种称为扫视的操作,此时未获取任何新信息。 + +在实践中,阅读更快的读者之间的主要差异是固定时间短于平均值,更长距离扫视,重读更少。 + +### 阅读练习 + +阅读不是人类的自然过程,因为它是人类生存跨度中一个相当新的发展。第一个书写系统是在大约 5000 年前创建的,它不足以让人们发展成为阅读机器。因此,我们必须运用我们的阅读技巧,在这项沟通的基本任务中变得更加娴熟和高效。 + +第一项练习包括减少默读,也被称为无声语音,这是一种在阅读时内部发音的习惯。它是一个减慢阅读速度的自然过程,因为阅读速度限于语速。减少默读的关键是只说出一些阅读的单词。一种方法是用其他任务来占据内部声音,例如用口香糖。 + +第二个练习包括减少回归,或称为重读。回归是一种懒惰的机制,因为我们的大脑可以随时重读任何材料,从而降低注意力。 + +### 5 个开源应用来训练你的大脑 + +有几个有趣的开源应用可用于锻炼你的阅读速度。 + +一个是 [Gritz][4],它是一个开源文件阅读器,它一次一个地弹出单词,以减少回归。它适用于 Linux、Windows 和 MacOS,并在 GPL 许可证下发布,因此你可以随意使用它。 + +其他选择包括 [Spray Speed-Reader][5],一个用 JavaScript 编写的开源速读应用,以及 [Sprits-it!][6],一个开源 Web 应用,可以快速阅读网页。 + +对于 Android 用户,[Comfort Reader][7] 是一个开源的速读应用。它可以在 [F-droid][8] 和 [Google Play][9] 应用商店中找到。 + +我最喜欢的应用是 [Speedread][10],它是一个简单的终端程序,它可以在最佳阅读点逐字显示文本。要安装它,请在你的设备上克隆 Github 仓库,然后输入相应的命令来选择以喜好的每分钟字数 (WPM)来阅读文档。默认速率为 250 WPM。例如,要以 400 WPM 阅读 `your_text_file.txt`,你应该输入: + +``` +`cat your_text_file.txt | ./speedread -w 400` +``` + +下面是该程序的运行界面: + +![Speedread demo][11] + +由于你可能不会只阅读[纯文本][12],因此可以使用 [Pandoc][13] 将文件从标记格式转换为文本格式。你还可以使用 Android 终端模拟器 [Termux][14] 在 Android 设备上运行 Speedread。 + +### 其他方案 + +对于开源社区来说,构建一个解决方案是一个有趣的项目,它仅为了通过使用特定练习来提高阅读速度,以此改进如默读和重读。我相信这个项目会非常有益,因为在当今信息丰富的环境中,提高阅读速度非常有价值。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/speed-reading-open-source + +作者:[Jaouhari Youssef][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/jaouhari +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_stack_library_reading.jpg?itok=uulcS8Sw (stack of books) +[2]: https://en.wikipedia.org/wiki/Joseph_Addison +[3]: https://en.wikipedia.org/wiki/Saccade +[4]: https://github.com/jeffkowalski/gritz +[5]: https://github.com/chaimpeck/spray +[6]: https://github.com/the-happy-hippo/sprits-it +[7]: https://github.com/mschlauch/comfortreader +[8]: https://f-droid.org/packages/com.mschlauch.comfortreader/ +[9]: https://play.google.com/store/apps/details?id=com.mschlauch.comfortreader +[10]: https://github.com/pasky/speedread +[11]: https://opensource.com/sites/default/files/uploads/speedread_demo.gif (Speedread demo) +[12]: https://plaintextproject.online/ +[13]: https://opensource.com/article/18/9/intro-pandoc +[14]: https://termux.com/ diff --git a/published/20190903 An introduction to Hyperledger Fabric.md b/published/20190903 An introduction to Hyperledger Fabric.md new file mode 100644 index 0000000000..3bd8f72221 --- /dev/null +++ b/published/20190903 An introduction to Hyperledger Fabric.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11328-1.html) +[#]: subject: (An introduction to Hyperledger Fabric) +[#]: via: (https://opensource.com/article/19/9/introduction-hyperledger-fabric) +[#]: author: (Matt Zand https://opensource.com/users/mattzandhttps://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/wonderchook) + +Hyperledger Fabric 介绍 +====== + +> Hyperledger (超级账本)是一组开源工具,旨在构建一个强大的、业务驱动的区块链框架。 + +![](https://img.linux.net.cn/data/attachment/album/201909/11/105935hm606vso3fclzso6.jpg) + +[Hyperledger][2] (超级账本)是区块链行业中最大的项目之一,它由一组开源工具和多个子项目组成。该项目是由 Linux 基金会主办的一个全球协作项目,其中包括一些不同领域的领导者们,这些领导者们的目标是建立一个强大的、业务驱动的区块链框架。 + +区块链网络主要有三种类型:公共区块链、联盟或联合区块链,以及私有区块链。Hyperledger 是一个区块链框架,旨在帮助公司建立私人或联盟许可的区块链网络,在该网络中,多个组织可以共享控制和操作网络内节点的权限。 + +因为区块链是一个透明的,基于不可变模式的安全的去中心化系统,所以它被认为是传统的供应链行业改变游戏规则的一种解决方案。它可以通过以下方式支持有效的供应链系统: + +* 跟踪整个区块链中的产品 +* 校验和验证区块链中的产品 +* 在供应链参与者之间共享整个区块链的信息 +* 提供可审核性 + +本文通过食品供应链的例子来解释 Hyperledger 区块链是如何改变传统供应链系统的。 + +### 食品行业供应链 + +传统供应链效率低下的主要原因是由于缺乏透明度而导致报告不可靠和竞争上的劣势。 + +在传统的供应链模式中,有关实体的信息对该区块链中的其他人来说并不完全透明,这就导致了不准确的报告和缺乏互操作性问题。电子邮件和印刷文档提供了一些信息,但它们不可能包含完整详细的可见性数据,因为很难在整个供应链中去追踪产品。这也使消费者几乎不可能知道产品的真正价值和来源。 + +食品行业的供应链环境复杂,多个参与者需要协作将货物运送到最终目的地 —— 客户手中。下图显示了食品供应链(多级)网络中的主要参与者。 + +![典型的食品供应链][3] + +该区块链的每个阶段都会引入潜在的安全问题、整合问题和其他低效问题。目前食品供应链中的主要威胁仍然是假冒食品和食品欺诈。 + +基于 Hyperledger 区块链的食品跟踪系统可实现对食品信息全面的可视性和和可追溯性。更重要的是,它以一种不变但可行的方式来记录产品细节,确保食品信息的真实性。最终用户通过在不可变框架上共享产品的详细信息,可以自我验证产品的真实性。 + +### Hyperledger Fabric + +Hyperledger Fabric 是 Hyperledger 项目的基石。它是基于许可的区块链,或者更准确地说是一种分布式分类帐技术(DLT),该技术最初由 IBM 公司和 Digital Asset 创建。分布式分类帐技术被设计为具有不同组件的模块化框架(概述如下)。它也是提供可插入的共识模型的一种灵活的解决方案,尽管它目前仅提供基于投票的许可共识(假设今天的 Hyperledger 网络在部分可信赖的环境中运行)。 + +鉴于此,无需匿名矿工来验证交易,也无需用作激励措施的相关货币。所有的参与者必须经过身份验证才能参与到该区块链进行交易。与以太坊一样,Hyperledger Fabric 支持智能合约,在 Hyperledger 中称为 Chaincodes链码,这些合约描述并执行系统的应用程序逻辑。 + +然而,与以太坊不同,Hyperledger Fabric 不需要昂贵的挖矿计算来提交交易,因此它有助于构建可以在更短的延迟内进行扩展的区块链。 + +Hyperledger Fabric 不同于以太坊或比特币这样的区块链,不仅在于它们类型不同,或者说是它与货币无关,而且它们在内部机制方面也不同。以下是典型的 Hyperledger 网络的关键要素: + +* 账本Ledgers:存储了一系列块,这些块保留了所有状态交易的所有不可变历史记录。 +* 节点Nodes:区块链的逻辑实体。它有三种类型: + * 客户端Clients:是代表用户向网络提交事务的应用程序。 + * 对等体Peers:是提交交易并维护分类帐状态的实体。 + * 排序者Orderers 在客户端和对等体之间创建共享通信渠道,还将区块链交易打包成块发送给遵从的对等体节点。 + +除了这些要素,Hyperledger Fabric 还有以下关键设计功能: + +* 链码Chaincode:类似于其它诸如以太坊的网络中的智能合约。它是用一种更高级的语言编写的程序,在针对分类帐当前状态的数据库执行。 +* 通道Channels:用于在多个网络成员之间共享机密信息的专用通信子网。每笔交易都在一个只有经过身份验证和授权的各方可见的通道上执行。 +* 背书人Endorsers 验证交易,调用链码,并将背书的交易结果返回给调用应用程序。 +* 成员服务提供商Membership Services Providers(MSP)通过颁发和验证证书来提供身份验证和身份验证过程。MSP 确定信任哪些证书颁发机构(CA)去定义信任域的成员,并确定成员可能扮演的特定角色(成员、管理员等)。 + +### 如何验证交易 + +探究一笔交易是如何通过验证的是理解 Hyperledger Fabric 在底层如何工作的好方法。此图显示了在典型的 Hyperledger 网络中处理交易的端到端系统流程: + +![Hyperledger 交易验证流程][4] + +首先,客户端通过向基于 Hyperledger Fabric 的应用程序客户端发送请求来启动交易,该客户端将交易提议提交给背书对等体。这些对等体通过执行由交易指定的链码(使用该状态的本地副本)来模拟该交易,并将结果发送回应用程序。此时,应用程序将交易与背书相结合,并将其广播给排序服务Ordering Service。排序服务检查背书并为每个通道创建一个交易块,然后将其广播给通道中的其它节点,对的体验证该交易并进行提交。 + +Hyperledger Fabric 区块链可以通过透明的、不变的和共享的食品来源数据记录、处理数据,及运输细节等信息将食品供应链中的参与者们连接起来。链码由食品供应链中的授权参与者来调用。所有执行的交易记录都永久保存在分类帐中,所有参与者都可以查看此信息。 + +### Hyperledger Composer + +除了 Fabric 或 Iroha 等区块链框架外,Hyperledger 项目还提供了 Composer、Explorer 和 Cello 等工具。 Hyperledger Composer 提供了一个工具集,可帮助你更轻松地构建区块链应用程序。 它包括: + +* CTO,一种建模语言 +* Playground,一种基于浏览器的开发工具,用于快速测试和部署 +* 命令行界面(CLI)工具 + +Composer 支持 Hyperledger Fabric 的运行时和基础架构,在内部,Composer 的 API 使用底层 Fabric 的 API。Composer 在 Fabric 上运行,这意味着 Composer 生成的业务网络可以部署到 Hyperledger Fabric 执行。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-hyperledger-fabric + +作者:[Matt Zand][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://opensource.com/users/mattzandhttps://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/wonderchook +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chain.png?itok=sgAjswFf (Chain image) +[2]: https://www.hyperledger.org/ +[3]: https://opensource.com/sites/default/files/uploads/foodindustrysupplychain.png (Typical food supply chain) +[4]: https://opensource.com/sites/default/files/uploads/hyperledger-fabric-transaction-flow.png (Hyperledger transaction validation flow) +[5]: https://coding-bootcamps.com/ultimate-guide-for-building-a-blockchain-supply-chain-using-hyperledger-fabric-and-composer.html diff --git a/published/20190903 The birth of the Bash shell.md b/published/20190903 The birth of the Bash shell.md new file mode 100644 index 0000000000..8102b01097 --- /dev/null +++ b/published/20190903 The birth of the Bash shell.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11314-1.html) +[#]: subject: (The birth of the Bash shell) +[#]: via: (https://opensource.com/19/9/command-line-heroes-bash) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg) + +Bash shell 的诞生 +====== + +> 本周的《代码英雄》播客深入研究了最广泛使用的、已经成为事实标准的脚本语言,它来自于自由软件基金会及其作者的早期灵感。 + +![Listen to the Command Line Heroes Podcast][1] + +对于任何从事于系统管理员方面的人来说,Shell 脚本编程是一门必不可少的技能,而如今人们编写脚本的主要 shell 是 Bash。Bash 是几乎所有的 Linux 发行版和现代 MacOS 版本的默认配置,也很快就会成为 [Windows 终端][2]的原生部分。你可以说 Bash 无处不在。 + +那么它是如何做到这一点的呢?本周的《[代码英雄][3]》播客将通过询问编写那些代码的人来深入研究这个问题。 + +### 肇始于 Unix + +像所有编程方面的东西一样,我们必须追溯到 Unix。shell 的简短历史是这样的:1971 年,Ken Thompson 发布了第一个 Unix shell:Thompson shell。但是,脚本用户所能做的存在严重限制,这意味着严重制约了自动化以及整个 IT 运营领域。 + +这个[奇妙的研究][4]概述了早期尝试脚本的挑战: + +> 类似于它在 Multics 中的前身,这个 shell(`/bin/sh`)是一个在内核外执行的独立用户程序。诸如通配(参数扩展的模式匹配,例如 `*.txt`)之类的概念是在一个名为 `glob` 的单独的实用程序中实现的,就像用于计算条件表达式的 `if` 命令一样。这种分离使 shell 变得更小,才不到 900 行的 C 源代码。 +> +> shell 引入了紧凑的重定向(`<`、`>` 和 `>>`)和管道(`|` 或 `^`)语法,它们已经存在于现代 shell 中。你还可以找到对调用顺序命令(`;`)和异步命令(`&`)的支持。 +> +> Thompson shell 缺少的是编写脚本的能力。它的唯一目的是作为一个交互式 shell(命令解释器)来调用命令和查看结果。 + +随着对终端使用的增长,对自动化的兴趣随之增长。 + +### Bourne shell 前进一步 + +在 Thompson 发布 shell 六年后,1977 年,Stephen Bourne 发布了 Bourne shell,旨在解决Thompson shell 中的脚本限制。(Chet Ramey 是自 1990 年以来 Bash 语言的主要维护者,在这一集的《代码英雄》中讨论了它)。作为 Unix 系统的一部分,这是这个来自贝尔实验室的技术的自然演变。 + +Bourne 打算做什么不同的事情?[研究员 M. Jones][4] 很好地概述了它: + +> Bourne shell 有两个主要目标:作为命令解释器以交互方式执行操作系统的命令,和用于脚本编程(编写可通过 shell 调用的可重用脚本)。除了替换 Thompson shell,Bourne shell 还提供了几个优于其前辈的优势。Bourne 将控制流、循环和变量引入脚本,提供了更具功能性的语言来(以交互式和非交互式)与操作系统交互。该 shell 还允许你使用 shell 脚本作为过滤器,为处理信号提供集成支持,但它缺乏定义函数的能力。最后,它结合了我们今天使用的许多功能,包括命令替换(使用后引号)和 HERE 文档(以在脚本中嵌入保留的字符串文字)。 + +Bourne 在[之前的一篇采访中][5]这样描述它: + +> 最初的 shell (编程语言)不是一种真正的语言;它是一种记录 —— 一种从文件中线性执行命令序列的方法,唯一的控制流的原语是 `GOTO` 到一个标签。Ken Thompson 所编写的这个最初的 shell 的这些限制非常重要。例如,你无法简单地将命令脚本用作过滤器,因为命令文件本身是标准输入。而在过滤器中,标准输入是你从父进程继承的,不是命令文件。 +> +> 最初的 shell 很简单,但随着人们开始使用 Unix 进行应用程序开发和脚本编写,它就太有限了。它没有变量、它没有控制流,而且它的引用能力非常不足。 + +对于脚本编写者来说,这个新 shell 是一个巨大的进步,但前提是你可以使用它。 + +### 以自由软件来重新构思 Bourne Shell + +在此之前,这个占主导地位的 shell 是由贝尔实验室拥有和管理的专有软件。幸运的话,你的大学可能有权访问 Unix shell。但这种限制性访问远非自由软件基金会(FSF)想要实现的世界。 + +Richard Stallman 和一群志同道合的开发人员那时正在编写所有的 Unix 功能,其带有可以在 GNU 许可证下免费获得的许可。其中一个开发人员的任务是制作一个 shell,那位开发人员是 Brian Fox。他对他的任务的讲述十分吸引我。正如他在播客上所说: + +> 它之所以如此具有挑战性,是因为我们必须忠实地模仿 Bourne shell 的所有行为,同时允许扩展它以使其成为一个供人们使用的更好工具。 + +而那时也恰逢人们在讨论 shell 标准是什么的时候。在这一历史背景和将来的竞争前景下,流行的 Bourne shell 被重新构想,并再次重生。 + +### 重新打造 Bourne Shell + +自由软件的使命和竞争这两个催化剂使重制的 Bourne shell(Bash)具有了生命。和之前不同的是,Fox 并没有把 shell 放到自己的名字之后命名,他专注于从 Unix 到自由软件的演变。(虽然 Fox Shell 这个名字看起来要比 Fish shell 更适合作为 fsh 命令 #missedopportunity)。这个命名选择似乎符合他的个性。正如 Fox 在剧集中所说,他甚至对个人的荣耀也不感兴趣;他只是试图帮助编程文化发展。然而,他并不是一个优秀的双关语。 + +而 Bourne 也并没有因为他命名 shell 的文字游戏而感到被轻视。Bourne 讲述了一个故事,有人走到他面前,并在会议上给了他一件 Bash T 恤,而那个人是 Brian Fox。 + +Shell | 发布于 | 创造者 +---|---|--- +Thompson Shell | 1971 | Ken Thompson +Bourne Shell | 1977 | Stephen Bourne +Bourne-Again Shell | 1989 | Brian Fox + +随着时间的推移,Bash 逐渐成长。其他工程师开始使用它并对其设计进行改进。事实上,多年后,Fox 坚定地认为学会放弃控制 Bash 是他一生中最重要的事情之一。随着 Unix 让位于 Linux 和开源软件运动,Bash 成为开源世界的至关重要的脚本语言。这个伟大的项目似乎超出了单一一个人的愿景范围。 + +### 我们能从 shell 中学到什么? + +shell 是一项技术,它是笔记本电脑日常使用中的一个组成部分,你很容易忘记它也需要发明出来。从 Thompson 到 Bourne 再到 Bash,shell 的故事为我们描绘了一些熟悉的结论: + +* 有动力的人可以在正确的使命中取得重大进展。 +* 我们今天所依赖的大部分内容都建立在我们行业中仍然活着的那些传奇人物打下的基础之上。 +* 能够生存下来的软件超越了其原始创作者的愿景。 +   +代码英雄在全部的第三季中讲述了编程语言,并且正在接近它的尾声。[请务必订阅,来了解你想知道的有关编程语言起源的各种内容][3],我很乐意在下面的评论中听到你的 shell 故事。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/19/9/command-line-heroes-bash + +作者:[Matthew Broberg][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/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/commnad_line_hereoes_ep6_blog-header-292x521.png?itok=Bs1RlwoW (Listen to the Command Line Heroes Podcast) +[2]: https://devblogs.microsoft.com/commandline/introducing-windows-terminal/ +[3]: https://www.redhat.com/en/command-line-heroes +[4]: https://developer.ibm.com/tutorials/l-linux-shells/ +[5]: https://www.computerworld.com.au/article/279011/-z_programming_languages_bourne_shell_sh diff --git a/published/20190904 How to build Fedora container images.md b/published/20190904 How to build Fedora container images.md new file mode 100644 index 0000000000..0ab7ed8684 --- /dev/null +++ b/published/20190904 How to build Fedora container images.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11327-1.html) +[#]: subject: (How to build Fedora container images) +[#]: via: (https://fedoramagazine.org/how-to-build-fedora-container-images/) +[#]: author: (Clément Verna https://fedoramagazine.org/author/cverna/) + +如何构建 Fedora 容器镜像 +====== + +![][1] + +随着容器和容器技术的兴起,现在所有主流的 Linux 发行版都提供了容器基础镜像。本文介绍了 Fedora 项目如何构建其基本镜像。同时还展示了如何使用它来创建分层图像。 + +### 基础和分层镜像 + +在看如何构建 Fedora 容器基础镜像base image之前,让我们定义基础镜像和分层镜像layered image。定义基础镜像的简单方法是没有父镜像层的镜像。但这具体意味着什么呢?这意味着基础镜像通常只包含操作系统的根文件系统基础镜像(rootfs)。基础镜像通常提供安装软件以创建分层镜像所需的工具。 + +分层镜像在基础镜像上添加了一组层,以便安装、配置和运行应用。分层镜像在 Dockerfile 中使用 `FROM` 指令引用基础镜像: + +``` +FROM fedora:latest +``` + +### 如何构建基础镜像 + +Fedora 有一整套用于构建容器镜像的工具。[其中包括 podman][2],它不需要以 root 身份运行。 + +#### 构建 rootfs + +基础镜像主要由一个 [tarball][3] 构成。这个 tarball 包含一个 rootfs。有不同的方法来构建此 rootfs。Fedora 项目使用 [kickstart][4] 安装方式以及 [imagefactory][5] 来创建这些 tarball。 + +在创建 Fedora 基础镜像期间使用的 kickstart 文件可以在 Fedora 的构建系统 [Koji][6] 中找到。[Fedora-Container-Base][7] 包重新组合了所有基础镜像的构建版本。如果选择了一个构建版本,那么可以访问所有相关文件,包括 kickstart 文件。查看 [示例][8],文件末尾的 `%packages` 部分定义了要安装的所有软件包。这就是让软件放在基础镜像中的方法。 + +#### 使用 rootfs 构建基础镜像 + +rootfs 完成后,构建基础镜像就很容易了。它只需要一个包含以下指令的 Dockerfile: + +``` +FROM scratch +ADD layer.tar / +CMD ["/bin/bash"] +``` + +这里的重要部分是 `FROM scratch` 指令,它会创建一个空镜像。然后,接下来的指令将 rootfs 添加到镜像,并设置在运行镜像时要执行的默认命令。 + +让我们使用 Koji 内置的 Fedora rootfs 构建一个基础镜像: + +``` +$ curl -o fedora-rootfs.tar.xz https://kojipkgs.fedoraproject.org/packages/Fedora-Container-Base/Rawhide/20190902.n.0/images/Fedora-Container-Base-Rawhide-20190902.n.0.x86_64.tar.xz +$ tar -xJvf fedora-rootfs.tar.xz 51c14619f9dfd8bf109ab021b3113ac598aec88870219ff457ba07bc29f5e6a2/layer.tar +$ mv 51c14619f9dfd8bf109ab021b3113ac598aec88870219ff457ba07bc29f5e6a2/layer.tar layer.tar +$ printf "FROM scratch\nADD layer.tar /\nCMD [\"/bin/bash\"]" > Dockerfile +$ podman build -t my-fedora . +$ podman run -it --rm my-fedora cat /etc/os-release +``` + +需要从下载的存档中提取包含 rootfs 的 `layer.tar` 文件。这在 Fedora 生成的镜像已经可以被容器运行时使用才需要。 + +因此,使用 Fedora 生成的镜像,获得基础镜像会更容易。让我们看看它是如何工作的: + +``` +$ curl -O https://kojipkgs.fedoraproject.org/packages/Fedora-Container-Base/Rawhide/20190902.n.0/images/Fedora-Container-Base-Rawhide-20190902.n.0.x86_64.tar.xz +$ podman load --input Fedora-Container-Base-Rawhide-20190902.n.0.x86_64.tar.xz +$ podman run -it --rm localhost/fedora-container-base-rawhide-20190902.n.0.x86_64:latest cat /etc/os-release +``` + +### 构建分层镜像 + +要构建使用 Fedora 基础镜像的分层镜像,只需在 `FROM` 行指令中指定 `fedora`: + +``` +FROM fedora:latest +``` + +`latest` 标记引用了最新的 Fedora 版本(编写本文时是 Fedora 30)。但是可以使用镜像的标签来使用其他版本。例如,`FROM fedora:31` 将使用 Fedora 31 基础镜像。 + +Fedora 支持将软件作为容器来构建并发布。这意味着你可以维护 Dockerfile 来使其他人可以使用你的软件。关于在 Fedora 中成为容器镜像维护者的更多信息,请查看 [Fedora 容器指南][9]。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-fedora-container-images/ + +作者:[Clément Verna][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://fedoramagazine.org/author/cverna/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/fedoracontainers-816x345.jpg +[2]: https://linux.cn/article-10156-1.html +[3]: https://en.wikipedia.org/wiki/Tar_(computing) +[4]: https://en.wikipedia.org/wiki/Kickstart_(Linux) +[5]: http://imgfac.org/ +[6]: https://koji.fedoraproject.org/koji/ +[7]: https://koji.fedoraproject.org/koji/packageinfo?packageID=26387 +[8]: https://kojipkgs.fedoraproject.org//packages/Fedora-Container-Base/30/20190902.0/images/koji-f30-build-37420478-base.ks +[9]: https://docs.fedoraproject.org/en-US/containers/guidelines/guidelines/ diff --git a/published/20190905 How to Change Themes in Linux Mint.md b/published/20190905 How to Change Themes in Linux Mint.md new file mode 100644 index 0000000000..dd2f69b044 --- /dev/null +++ b/published/20190905 How to Change Themes in Linux Mint.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11359-1.html) +[#]: subject: (How to Change Themes in Linux Mint) +[#]: via: (https://itsfoss.com/install-themes-linux-mint/) +[#]: author: (It's FOSS Community https://itsfoss.com/author/itsfoss/) + +如何在 Linux Mint 中更换主题 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/19/100317ixxp3y1l7lljl47a.jpg) + +一直以来,使用 Cinnamon 桌面环境的 Linux Mint 都是一种卓越的体验。这也是[为何我喜爱 Linux Mint][1]的主要原因之一。 + +自从 Mint 的开发团队[开始更为严肃的对待设计][2], “桌面主题” 应用便成为了更换新主题、图标、按钮样式、窗口边框以及鼠标指针的重要方式,当然你也可以直接通过它安装新的主题。感兴趣么?让我们开始吧。 + +### 如何在 Linux Mint 中更换主题 + +在菜单中搜索主题并打开主题应用。 + +![Theme Applet provides an easy way of installing and changing themes][3] + +在应用中有一个“添加/删除”按钮,非常简单吧。点击它,我们可以看到按流行程度排序的 Cinnamon Spices(Cinnamon 的官方插件库)的主题。 + +![Installing new themes in Linux Mint Cinnamon][4] + +要安装主题,你所要做的就是点击你喜欢的主题,然后等待它下载。之后,主题将在应用第一页的“Desktop”选项中显示可用。只需双击已安装的主题之一就可以开始使用它。 + +![Changing themes in Linux Mint Cinnamon][5] + +下面是默认的 Linux Mint 外观: + +![Linux Mint Default Theme][6] + +这是在我更换主题之后: + +![Linux Mint with Carta Theme][7] + +所有的主题都可以在 Cinnamon Spices 网站上获得更多的信息和更大的截图,这样你就可以更好地了解你的系统的外观。 + +- [浏览 Cinnamon 主题][8] + +### 在 Linux Mint 中安装第三方主题 + +> “我在另一个网站上看到了这个优异的主题,但 Cinnamon Spices 网站上没有……” + +Cinnamon Spices 集成了许多优秀的主题,但你仍然会发现,你看到的主题并没有被 Cinnamon Spices 官方网站收录。 + +这时你可能会想:如果有别的办法就好了,对么?你可能会认为有(我的意思是……当然啦)。首先,我们可以在其他网站上找到一些很酷的主题。 + +我推荐你去 Cinnamon Look 浏览一下那儿的主题。如果你喜欢什么,就下载吧。 + +- [在 Cinnamon Look 中获取更多主题][9] + +下载了首选主题之后,你现在将得到一个压缩文件,其中包含安装所需的所有内容。提取它并保存到 `~/.themes`。迷糊么? `~` 代表了你的家目录的对应路径:`/home/{YOURUSER}/.themes`。 + +然后跳转到你的家目录。按 `Ctrl+H` 来[显示 Linux 中的隐藏文件][11]。如果没有看到 `.themes` 文件夹,创建一个新文件夹并命名为 `.themes`。记住,文件夹名称开头的点很重要。 + +将提取的主题文件夹从下载目录复制到你的家目录中的 `.themes` 文件夹中。 + +最后,在上面提到的应用中查找已安装的主题。 + +> 注记 +> +> 请记住,主题必须是 Cinnamon 相对应的,即使它是一个从 GNOME 复刻的系统也不行,并不是所有的 GNOME 主题都适用于 Cinnamon。 + +改变主题是 Cinnamon 定制工作的一部分。你还可以[通过更改图标来更改 Linux Mint 的外观][12]。 + +我希望你现在已经知道如何在 Linux Mint 中更改主题了。快去选取你喜欢的主题吧。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-themes-linux-mint/ + +作者:[It's FOSS][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/tiny-features-linux-mint-cinnamon/ +[2]: https://itsfoss.com/linux-mint-new-design/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/install-theme-linux-mint-1.jpg?resize=800%2C625&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/install-theme-linux-mint-2.jpg?resize=800%2C625&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/install-theme-linux-mint-3.jpg?resize=800%2C450&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-mint-default-theme.jpg?resize=800%2C450&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-mint-carta-theme.jpg?resize=800%2C450&ssl=1 +[8]: https://cinnamon-spices.linuxmint.com/themes +[9]: https://www.cinnamon-look.org/ +[10]: https://itsfoss.com/failed-to-start-session-ubuntu-14-04/ +[11]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[12]: https://itsfoss.com/install-icon-linux-mint/ diff --git a/published/20190905 How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script.md b/published/20190905 How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script.md new file mode 100644 index 0000000000..87c0308360 --- /dev/null +++ b/published/20190905 How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script.md @@ -0,0 +1,207 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11352-1.html) +[#]: subject: (How to Get Average CPU and Memory Usage from SAR Reports Using the Bash Script) +[#]: via: (https://www.2daygeek.com/linux-get-average-cpu-memory-utilization-from-sar-data-report/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 Bash 脚本从 SAR 报告中获取 CPU 和内存使用情况 +====== + +大多数 Linux 管理员使用 [SAR 报告][1]监控系统性能,因为它会收集一周的性能数据。但是,你可以通过更改 `/etc/sysconfig/sysstat` 文件轻松地将其延长到四周。同样,这段时间可以延长一个月以上。如果超过 28,那么日志文件将放在多个目录中,每月一个。 + +要将覆盖期延长至 28 天,请对 `/etc/sysconfig/sysstat` 文件做以下更改。 + +编辑 `sysstat` 文件并将 `HISTORY=7` 更改为 `HISTORY=28`。 + +在本文中,我们添加了三个 bash 脚本,它们可以帮助你在一个地方轻松查看每个数据文件的平均值。 + +我们过去加过许多有用的 shell 脚本。如果你想查看它们,请进入下面的链接。 + +* [如何使用 shell 脚本自动化日常操作][2] + +这些脚本简单明了。出于测试目的,我们仅包括两个性能指标,即 CPU 和内存。你可以修改脚本中的其他性能指标以满足你的需求。 + +### 脚本 1:从 SAR 报告中获取平均 CPU 利用率的 Bash 脚本 + +该 bash 脚本从每个数据文件中收集 CPU 平均值并将其显示在一个页面上。 + +由于是月末,它显示了 2019 年 8 月的 28 天数据。 + +``` +# vi /opt/scripts/sar-cpu-avg.sh + +#!/bin/sh + +echo "+----------------------------------------------------------------------------------+" +echo "|Average: CPU %user %nice %system %iowait %steal %idle |" +echo "+----------------------------------------------------------------------------------+" + +for file in `ls -tr /var/log/sa/sa* | grep -v sar` +do + dat=`sar -f $file | head -n 1 | awk '{print $4}'` + echo -n $dat + sar -f $file | grep -i Average | sed "s/Average://" +done + +echo "+----------------------------------------------------------------------------------+" +``` + +运行脚本后,你将看到如下输出。 + +``` +# sh /opt/scripts/sar-cpu-avg.sh + ++----------------------------------------------------------------------------------+ +|Average: CPU %user %nice %system %iowait %steal %idle | ++----------------------------------------------------------------------------------+ +08/01/2019 all 0.70 0.00 1.19 0.00 0.00 98.10 +08/02/2019 all 1.73 0.00 3.16 0.01 0.00 95.10 +08/03/2019 all 1.73 0.00 3.16 0.01 0.00 95.11 +08/04/2019 all 1.02 0.00 1.80 0.00 0.00 97.18 +08/05/2019 all 0.68 0.00 1.08 0.01 0.00 98.24 +08/06/2019 all 0.71 0.00 1.17 0.00 0.00 98.12 +08/07/2019 all 1.79 0.00 3.17 0.01 0.00 95.03 +08/08/2019 all 1.78 0.00 3.14 0.01 0.00 95.08 +08/09/2019 all 1.07 0.00 1.82 0.00 0.00 97.10 +08/10/2019 all 0.38 0.00 0.50 0.00 0.00 99.12 +. +. +. +08/29/2019 all 1.50 0.00 2.33 0.00 0.00 96.17 +08/30/2019 all 2.32 0.00 3.47 0.01 0.00 94.20 ++----------------------------------------------------------------------------------+ +``` + +### 脚本 2:从 SAR 报告中获取平均内存利用率的 Bash 脚本 + +该 bash 脚本从每个数据文件中收集内存平均值并将其显示在一个页面上。 + +由于是月末,它显示了 2019 年 8 月的 28 天数据。 + +``` +# vi /opt/scripts/sar-memory-avg.sh + +#!/bin/sh + +echo "+-------------------------------------------------------------------------------------------------------------------+" +echo "|Average: kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty |" +echo "+-------------------------------------------------------------------------------------------------------------------+" + +for file in `ls -tr /var/log/sa/sa* | grep -v sar` +do + dat=`sar -f $file | head -n 1 | awk '{print $4}'` + echo -n $dat + sar -r -f $file | grep -i Average | sed "s/Average://" +done + +echo "+-------------------------------------------------------------------------------------------------------------------+" +``` + +运行脚本后,你将看到如下输出。 + +``` +# sh /opt/scripts/sar-memory-avg.sh + ++--------------------------------------------------------------------------------------------------------------------+ +|Average: kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty | ++--------------------------------------------------------------------------------------------------------------------+ +08/01/2019 1492331 2388461 61.55 29888 1152142 1560615 12.72 1693031 380472 6 +08/02/2019 1493126 2387666 61.53 29888 1147811 1569624 12.79 1696387 373346 3 +08/03/2019 1489582 2391210 61.62 29888 1147076 1581711 12.89 1701480 370325 3 +08/04/2019 1490403 2390389 61.60 29888 1148206 1569671 12.79 1697654 373484 4 +08/05/2019 1484506 2396286 61.75 29888 1152409 1563804 12.75 1702424 374628 4 +08/06/2019 1473593 2407199 62.03 29888 1151137 1577491 12.86 1715426 371000 8 +08/07/2019 1467150 2413642 62.19 29888 1155639 1596653 13.01 1716900 372574 13 +08/08/2019 1451366 2429426 62.60 29888 1162253 1604672 13.08 1725931 376998 5 +08/09/2019 1451191 2429601 62.61 29888 1158696 1582192 12.90 1728819 371025 4 +08/10/2019 1450050 2430742 62.64 29888 1160916 1579888 12.88 1729975 370844 5 +. +. +. +08/29/2019 1365699 2515093 64.81 29888 1198832 1593567 12.99 1781733 376157 15 +08/30/2019 1361920 2518872 64.91 29888 1200785 1595105 13.00 1784556 375641 8 ++-------------------------------------------------------------------------------------------------------------------+ +``` + +### 脚本 3:从 SAR 报告中获取 CPU 和内存平均利用率的 Bash 脚本 + +该 bash 脚本从每个数据文件中收集 CPU 和内存平均值并将其显示在一个页面上。 + +该脚本与上面相比稍微不同。它在同一位置同时显示两者(CPU 和内存)平均值,而不是其他数据。 + +``` +# vi /opt/scripts/sar-cpu-mem-avg.sh + +#!/bin/bash + +for file in `ls -tr /var/log/sa/sa* | grep -v sar` +do + sar -f $file | head -n 1 | awk '{print $4}' + echo "-----------" + sar -u -f $file | awk '/Average:/{printf("CPU Average: %.2f%\n"), 100 - $8}' + sar -r -f $file | awk '/Average:/{printf("Memory Average: %.2f%\n"),(($3-$5-$6)/($2+$3)) * 100 }' + printf "\n" +done +``` + +运行脚本后,你将看到如下输出。 + +``` +# sh /opt/scripts/sar-cpu-mem-avg.sh + +08/01/2019 +----------- +CPU Average: 1.90% +Memory Average: 31.09% + +08/02/2019 +----------- +CPU Average: 4.90% +Memory Average: 31.18% + +08/03/2019 +----------- +CPU Average: 4.89% +Memory Average: 31.29% + +08/04/2019 +----------- +CPU Average: 2.82% +Memory Average: 31.24% + +08/05/2019 +----------- +CPU Average: 1.76% +Memory Average: 31.28% +. +. +. +08/29/2019 +----------- +CPU Average: 3.83% +Memory Average: 33.15% + +08/30/2019 +----------- +CPU Average: 5.80% +Memory Average: 33.19% +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-get-average-cpu-memory-utilization-from-sar-data-report/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/sar-system-performance-monitoring-command-tool-linux/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/20190905 USB4 gets final approval, offers Ethernet-like speed.md b/published/20190905 USB4 gets final approval, offers Ethernet-like speed.md new file mode 100644 index 0000000000..ade65f4a5e --- /dev/null +++ b/published/20190905 USB4 gets final approval, offers Ethernet-like speed.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11330-1.html) +[#]: subject: (USB4 gets final approval, offers Ethernet-like speed) +[#]: via: (https://www.networkworld.com/article/3435113/usb4-gets-final-approval-offers-ethernet-like-speed.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +USB4 规范获得最终批准,像以太网一样快! +====== + +> USB4 会是一个统一的接口,可以淘汰笨重的电缆和超大的插头,并提供满足从笔记本电脑用户到服务器管理员的每个人的吞吐量。 + +![](https://images.idgesg.net/images/article/2019/03/thunderbolt-3_intel-v2-100790083-large.jpg) + +USB 开发者论坛USB Implementers Forum(USB-IF)是通用串行总线(USB)规范开发背后的行业协会,上周宣布了它已经完成了下一代 USB4 的技术规范。 + +USB4 最重要的一个方面(它们在此版本中省略了首字母缩略词和版本号之间的空格)是它将 USB 与 Intel 设计的接口 Thunderbolt 3 融合在了一起。Thunderbolt 尽管有潜力,但在除了笔记本之外并未真正流行起来。出于这个原因,Intel 向 USB 联盟提供了 Thunderbolt 规范。 + +不幸的是,Thunderbolt 3 被列为 USB4 设备的一个可选项,因此有些设备会有,有些则不会。这无疑会让人头疼,希望所有设备制造商都会包括 Thunderbolt 3。 + +USB4 将使用与 USB type-C 相同的外形尺寸,这个小型插头用在所有现代 Android 手机和 Thunderbolt 3 中。它将向后兼容 USB 3.2、USB 2.0 以及 Thunderbolt。因此,几乎任何现有的USB type-C 设备都可以连接到具有 USB4 总线的机器,但将以连接电缆的额定速度运行。 + +### USB4:体积更小,速度更快 + +因为它支持 Thunderbolt 3,所以这种新连接将同时支持数据和显示协议,因此这可能意味着小型 USB-C 端口将取代显示器上庞大的 DVI 端口,而显示器则带有多个 USB4 端口来作为集线器。 + +新标准的主要内容:它提供双通道 40Gbps 传输速度,是当前 USB 3.2 规格的两倍,是 USB 3 的八倍。这是以太网的速度,应该足够给你的高清显示器以及其他数据传输提供充足带宽。 + +USB4 也为视频提供了更好的资源分配,因此如果你使用 USB4 端口同时传输视频和数据,端口将相应地分配带宽。这将允许计算机同时使用外部独立的 GPU(因为有 Thunderbolt 3,它已经上市 )和外部 SSD。 + +这可能会启发各种新的服务器设计,因为大型、笨重的设备,如 GPU 或其他不易放入 1U 或 2U 机箱的卡板,现在可以外部连接并以与内部设备相当的速度运行。 + +当然,我们看到配备了 USB4 端口的电脑还需要一段时间,更别说服务器了。将 USB 3 用于 PC 花费了数年时间,而 USB-C 的采用速度非常缓慢。USB 2 的 U 盘仍然是这些设备的主要市场,并且主板仍然带有 USB 2 端口。 + +尽管如此,USB4 还是有可能成为一个统一的接口,可以摆脱拥有超大插头的笨重电缆,并提供满足从笔记本电脑用户到服务器管理员的每个人的吞吐量。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3435113/usb4-gets-final-approval-offers-ethernet-like-speed.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/20190906 Great News- Firefox 69 Blocks Third-Party Cookies, Autoplay Videos - Cryptominers by Default.md b/published/20190906 Great News- Firefox 69 Blocks Third-Party Cookies, Autoplay Videos - Cryptominers by Default.md new file mode 100644 index 0000000000..9118ebe1ef --- /dev/null +++ b/published/20190906 Great News- Firefox 69 Blocks Third-Party Cookies, Autoplay Videos - Cryptominers by Default.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11346-1.html) +[#]: subject: (Great News! Firefox 69 Blocks Third-Party Cookies, Autoplay Videos & Cryptominers by Default) +[#]: via: (https://itsfoss.com/firefox-69/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Firefox 69 默认阻拦第三方 Cookie、自动播放的视频和加密矿工 +====== + +如果你使用的是 [Mozilla Firefox][1] 并且尚未更新到最新版本,那么你将错过许多新的重要功能。 + +### Firefox 69 版本中的一些新功能 + +首先,Mozilla Firefox 69 会默认强制执行更强大的安全和隐私选项。以下是新版本的一些主要亮点。 + +#### Firefox 69 阻拦视频自动播放 + +![][2] + +现在很多网站都提供了自动播放视频。无论是弹出视频还是嵌入在文章中设置为自动播放的视频,默认情况下,Firefox 69 都会阻止它(或者可能会提示你)。 + +这个[阻拦自动播放][3]功能可让用户自动阻止任何视频播放。 + +#### 禁止第三方跟踪 cookie + +默认情况下,作为增强型跟踪保护Enhanced Tracking Protection功能的一部分,它现在将阻止第三方跟踪 Cookie 和加密矿工。这是 Mozilla Firefox 的增强隐私保护功能的非常有用的改变。 + +Cookie 有两种:第一方的和第三方的。第一方 cookie 由网站本身拥有。这些是“好的 cookie”,可以让你保持登录、记住你的密码或输入字段等来改善浏览体验。第三方 cookie 由你访问的网站以外的域所有。广告服务器使用这些 Cookie 来跟踪你,并在你访问的所有网站上跟踪广告。Firefox 69 旨在阻止这些。 + +当它发挥作用时,你将在地址栏中看到盾牌图标。你可以选择为特定网站禁用它。 + +![Firefox Blocking Tracking][4] + +#### 禁止加密矿工消耗你的 CPU + +![][5] + +对加密货币的欲望一直困扰着这个世界。GPU 的价格已经高企,因为专业的加密矿工们使用它们来挖掘加密货币。 + +人们使用工作场所的计算机秘密挖掘加密货币。当我说工作场所时,我不一定是指 IT 公司。就在今年,[人们在乌克兰的一家核电站抓住了偷挖加密货币的活动][6]。 + +不仅如此。如果你访问某些网站,他们会运行脚本并使用你的计算机的 CPU 来挖掘加密货币。这在 IT 术语中被称为 [挖矿攻击][7]cryptojacking。 + +好消息是 Firefox 69 会自动阻止这些加密矿工脚本。因此,网站不再能利用你的系统资源进行挖矿攻击了。 + +#### Firefox 69 带来的更强隐私保护 + +![][8] + +如果你把隐私保护设置得更严格,那么它也会阻止指纹。因此,当你在 Firefox 69 中选择严格的隐私设置时,你不必担心通过[指纹][9]共享计算机的配置信息。 + +在[关于这次发布的官方博客文章][10]中,Mozilla 提到,在此版本中,他们希望默认情况下为 100% 的用户提供保护。 + +#### 性能改进 + +尽管在更新日志中没有提及 Linux,但它提到了在 Windows 10/mac OS 上运行性能、UI 和电池寿命有所改进。如果你发现任何性能改进,请在评论中提及。 + +### 总结 + +除了所有这些之外,还有很多底层的改进。你可以查看[发行说明][11]中的详细信息。 + +Firefox 69 对于关注其隐私的用户来说是一个令人印象深刻的更新。与我们最近对某些[安全电子邮件服务][12]的建议类似,我们建议你更新浏览器以充分受益。新版本已在大多数 Linux 发行版中提供,你只需要更新你的系统即可。 + +如果你对阻止广告和跟踪 Cookie 的浏览器感兴趣,请尝试[开源的 Brave 浏览器][13],他们甚至给你提供了加密货币以让你使用他们的浏览器,你可以使用这些加密货币来奖励你最喜爱的发布商。 + +你觉得这个版本怎么样?请在下面的评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/firefox-69/ + +作者:[Ankush Das][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/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-firefox/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/auto-block-firefox.png?ssl=1 +[3]: https://support.mozilla.org/en-US/kb/block-autoplay +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/firefox-blocking-tracking.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/firefox-shield.png?ssl=1 +[6]: https://thenextweb.com/hardfork/2019/08/22/ukrainian-nuclear-powerplant-mine-cryptocurrency-state-secrets/ +[7]: https://hackernoon.com/cryptojacking-in-2019-is-not-dead-its-evolving-984b97346d16 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/firefox-secure.jpg?ssl=1 +[9]: https://clearcode.cc/blog/device-fingerprinting/ +[10]: https://blog.mozilla.org/blog/2019/09/03/todays-firefox-blocks-third-party-tracking-cookies-and-cryptomining-by-default/ +[11]: https://www.mozilla.org/en-US/firefox/69.0/releasenotes/ +[12]: https://itsfoss.com/secure-private-email-services/ +[13]: https://itsfoss.com/brave-web-browser/ diff --git a/published/20190906 How to change the color of your Linux terminal.md b/published/20190906 How to change the color of your Linux terminal.md new file mode 100644 index 0000000000..df5bd052bd --- /dev/null +++ b/published/20190906 How to change the color of your Linux terminal.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11324-1.html) +[#]: subject: (How to change the color of your Linux terminal) +[#]: via: (https://opensource.com/article/19/9/linux-terminal-colors) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何改变你的终端颜色 +====== + +> 使 Linux 变得丰富多彩(或单色)。 + +![](https://img.linux.net.cn/data/attachment/album/201909/10/111118bnvvcy6sntcs1s3t.jpg) + +你可以使用特殊的 ANSI 编码设置为 Linux 终端添加颜色,可以在终端命令或配置文件中动态添加,也可以在终端仿真器中使用现成的主题。无论哪种方式,你都可以黑色屏幕上找回怀旧的绿色或琥珀色文本。本文演示了如何使 Linux 变得丰富多彩(或单色)的方法。 + +### 终端的功能特性 + +现代系统的终端的颜色配置通常默认至少是 xterm-256color,但如果你尝试为终端添加颜色但未成功,则应检查你的 `TERM` 设置。 + +从历史上看,Unix 终端从字面上讲是:用户可以输入命令的共享计算机系统上实际的物理端点(终点)。它们专指通常用于远程发出命令的电传打字机(这也是我们今天在 Linux 中仍然使用 `/dev/tty` 设备的原因)。终端内置了 CRT 显示器,因此用户可以坐在办公室的终端上直接与大型机进行交互。CRT 显示器价格昂贵 —— 无论是制造还是使用控制;比担心抗锯齿和现代计算机专家理所当然认为的漂亮信息,让计算机吐出原始 ASCII 文本更容易。然而,即使在那时,技术的发展也很快,很快人们就会发现,随着新的视频显示终端的设计,他们需要新的功能特性来提供可选功能。 + +例如,1978 年发布的花哨的新 VT100 支持 ANSI 颜色,因此如果用户将终端类型识别为 vt100,则计算机可以提供彩色输出,而基本串行设备可能没有这样的选项。同样的原则适用于今天,它是由 `TERM` [环境变量][2]设定的。你可以使用 `echo` 检查你的 `TERM` 定义: + +``` +$ echo $TERM +xterm-256color +``` + +过时的(但在一些系统上仍然为了向后兼容而维护)`/etc/termcap` 文件定义了终端和打印机的功能特性。现代的版本是 `terminfo`,位于 `/etc` 或 `/usr/share` 中,具体取决于你的发行版。 这些文件列出了不同类型终端中可用的功能特性,其中许多都是由历史上的硬件定义的,如 vt100 到 vt220 的定义,以及 xterm 和 Xfce 等现代软件仿真器。大多数软件并不关心你使用的终端类型; 在极少数情况下,登录到检查兼容功能的服务器时,你可能会收到有关错误的终端类型的警告或错误。如果你的终端设置为功能特性很少的配置文件,但你知道你所使用的仿真器能够支持更多功能特性,那么你可以通过定义 `TERM` 环境变量来更改你的设置。你可以通过在 `~/.bashrc` 配置文件中导出 `TERM` 变量来完成此操作: + +``` +export TERM=xterm-256color +``` + +保存文件并重新载入设置: + +``` +$ source ~/.bashrc +``` + +### ANSI 颜色代码 + +现代终端继承了用于“元”特征的 ANSI 转义序列。这些是特殊的字符序列,终端将其解释为操作而不是字符。例如,此序列将清除屏幕,直到下一个提示符: + +``` +$ printf '\033[2J' +``` + +它不会清除你的历史信息;它只是清除终端仿真器中的屏幕,因此它是一个安全且具有示范性的 ANSI 转义序列。 + +ANSI 还具有设置终端颜色的序列。例如,键入此代码会将后续文本更改为绿色: + +``` +$ printf '\033[32m' +``` + +只要你对相同的计算机使用同一个颜色,就可以使用颜色来帮助你记住你登录的系统。例如,如果你经常通过 SSH 连接到服务器,则可以将服务器的提示符设置为绿色,以帮助你一目了然地将其与本地的提示符区分开来。 要设置绿色提示符,请在提示符前使用 ANSI 代码设置为绿色,并使用代表正常默认颜色的代码结束: + + +``` +export PS1=`printf "\033[32m$ \033[39m"` +``` + +### 前景色和背景色 + +你不仅可以设置文本的颜色。使用 ANSI 代码,你还可以控制文本的背景颜色以及做一些基本的样式。 + +例如,使用 `\033[4m`,你可以为文本加上下划线,或者使用 `\033[5m` 你可以将其设置为闪烁的文本。起初这可能看起来很愚蠢,因为你可能不会将你的终端设置为所有文本带有下划线并整天闪烁, 但它对某些功能很有用。例如,你可以将 shell 脚本生成的紧急错误设置为闪烁(作为对用户的警报),或者你可以为 URL 添加下划线。 + +作为参考,以下是前景色和背景色的代码。前景色在 30 范围内,而背景色在 40 范围内: + +颜色 | 前景色 | 背景色 +---|---|--- +黑色 | \033[30m | \033[40m +红色 | \033[31m | \033[41m +绿色 | \033[32m | \033[42m +橙色 | \033[33m | \033[43m +蓝色 | \033[34m | \033[44m +品红 | \033[35m | \033[45m +青色 | \033[36m | \033[46m +浅灰 | \033[37m | \033[47m +回退到发行版默认值 | \033[39m | \033[49m + +还有一些可用于背景的其他颜色: + +颜色 | 背景色 +---|--- +深灰 | \033[100m +浅红 | \033[101m +浅绿 | \033[102m +黄色 | \033[103m +浅蓝 | \033[104m +浅紫 | \033[105m +蓝绿 | \033[106m +白色 | \033[107m + +### 持久设置 + +在终端会话中设置颜色只是暂时的,相对无条件的。有时效果会持续几行;这是因为这种设置颜色的方法依赖于 `printf` 语句来设置一种模式,该模式仅持续到其他设置覆盖它。 + +终端仿真器通常获取使用哪种颜色的指令的方式来自于 `LS_COLORS` 环境变量的设置,该设置又由 `dircolors` 的设置填充。你可以使用 `echo` 语句查看当前设置: + +``` +$ echo $LS_COLORS +rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40; +38;5;11:so=38;5;13:do=38;5;5:bd=48;5; +232;38;5;11:cd=48;5;232;38;5;3:or=48; +5;232;38;5;9:mi=01;05;37;41:su=48;5; +196;38;5;15:sg=48;5;11;38;5;16:ca=48;5; +196;38;5;226:tw=48;5;10;38;5;16:ow=48;5; +[...] +``` + +或者你可以直接使用 `dircolors`: + +``` +$ dircolors --print-database +[...] +# image formats +.jpg 01;35 +.jpeg 01;35 +.mjpg 01;35 +.mjpeg 01;35 +.gif 01;35 +.bmp 01;35 +.pbm 01;35 +.tif 01;35 +.tiff 01;35 +[...] +``` + +这看起来很神秘。文件类型后面的第一个数字是属性代码,它有六种选择: + +* 00 无 +* 01 粗体 +* 04 下划线 +* 05 闪烁 +* 07 反白 +* 08 暗色 + +下一个数字是简化形式的颜色代码。你可以通过获取 ANSI 代码的最后一个数字来获取颜色代码(绿色前景为 32,绿色背景为 42;红色为 31 或 41,依此类推)。 + +你的发行版可能全局设置了 `LS_COLORS`,因此系统上的所有用户都会继承相同的颜色。如果你想要一组自定义的颜色,可以使用 `dircolors`。首先,生成颜色设置的本地副本: + +``` +$ dircolors --print-database > ~/.dircolors +``` + +根据需要编辑本地列表。如果你对自己的选择感到满意,请保存文件。你的颜色设置只是一个数据库,不能由 [ls][3] 直接使用,但你可以使用 `dircolors` 获取可用于设置 `LS_COLORS` 的 shellcode: + +``` +$ dircolors --bourne-shell ~/.dircolors +LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00: +pi=40;33:so=01;35:do=01;35:bd=40;33;01: +cd=40;33;01:or=40;31;01:mi=00:su=37;41: +sg=30;43:ca=30;41:tw=30;42:ow=34; +[...] +export LS_COLORS +``` + +将输出复制并粘贴到 `~/.bashrc` 文件中并重新加载。或者,你可以将该输出直接转储到 `.bashrc` 文件中并重新加载。 + +``` +$ dircolors --bourne-shell ~/.dircolors >> ~/.bashrc +$ source ~/.bashrc +``` + +你也可以在启动时使 Bash 解析 `.dircolors` 而不是手动进行转换。实际上,你可能不会经常改变颜色,所以这可能过于激进,但如果你打算改变你的配色方案,这是一个选择。在 `.bashrc` 文件中,添加以下规则: + +``` +[[ -e $HOME/.dircolors ]] && eval "`dircolors --sh $HOME/.dircolors`" +``` + +如果你的主目录中有 `.dircolors` 文件,Bash 会在启动时对其进行评估并相应地设置 `LS_COLORS`。 + +### 颜色 + +在终端中使用颜色是一种可以为你自己提供特定信息的快速视觉参考的简单方法。但是,你可能不希望过于依赖它们。毕竟,颜色不是通用的,所以如果其他人使用你的系统,他们可能不会像你那样看懂颜色代表的含义。此外,如果你使用各种工具与计算机进行交互,你可能还会发现某些终端或远程连接无法提供你期望的颜色(或根本不提供颜色)。 + +除了上述警示之外,颜色在某些工作流程中可能很有用且很有趣,因此创建一个 `.dircolor` 数据库并根据你的想法对其进行自定义吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-terminal-colors + +作者:[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/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) +[2]: https://opensource.com/article/19/8/what-are-environment-variables +[3]: https://opensource.com/article/19/7/master-ls-command diff --git a/published/20190906 How to put an HTML page on the internet.md b/published/20190906 How to put an HTML page on the internet.md new file mode 100644 index 0000000000..8e5e283364 --- /dev/null +++ b/published/20190906 How to put an HTML page on the internet.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11374-1.html) +[#]: subject: (How to put an HTML page on the internet) +[#]: via: (https://jvns.ca/blog/2019/09/06/how-to-put-an-html-page-on-the-internet/) +[#]: author: (Julia Evans https://jvns.ca/) + +如何在互联网放置 HTML 页面 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/22/234957mmzoie1imufsuwea.jpg) + +我喜欢互联网的一点是在互联网放置静态页面是如此简单。今天有人问我该怎么做,所以我想我会快速地写下来! + +### 只是一个 HTML 页面 + +我的所有网站都只是静态 HTML 和 CSS。我的网页设计技巧相对不高( 是我自己开发的最复杂的网站),因此保持我所有的网站相对简单意味着我可以做一些改变/修复,而不会花费大量时间。 + +因此,我们将在此文章中采用尽可能简单的方式 —— 只需一个 HTML 页面。 + +### HTML 页面 + +我们要放在互联网上的网站只是一个名为 `index.html` 的文件。你可以在 找到它,它是一个 Github 仓库,其中只包含一个文件。 + +HTML 文件中包含一些 CSS,使其看起来不那么无聊,部分复制自 。 + +### 如何将 HTML 页面放在互联网上 + +有以下几步: + + 1. 注册 [Neocities][1] 帐户 + 2. 将 index.html 复制到你自己 neocities 站点的 index.html 中 + 3. 完成 + +上面的 `index.html` 页面位于 [julia-example-website.neocities.com][2] 中,如果你查看源代码,你将看到它与 github 仓库中的 HTML 相同。 + +我认为这可能是将 HTML 页面放在互联网上的最简单的方法(这是一次回归 Geocities,它是我在 2003 年制作我的第一个网站的方式):)。我也喜欢 Neocities (像 [glitch][3],我也喜欢)它能实验、学习,并有乐趣。 + +### 其他选择 + +这绝不是唯一简单的方式,在你推送 Git 仓库时,Github pages 和 Gitlab pages 以及 Netlify 都将会自动发布站点,并且它们都非常易于使用(只需将它们连接到你的 GitHub 仓库即可)。我个人使用 Git 仓库的方式,因为 Git 不会让我感到紧张,我想知道我实际推送的页面发生了什么更改。但我想你如果第一次只想将 HTML/CSS 制作的站点放到互联网上,那么 Neocities 就是一个非常好的方法。 + +如果你不只是玩,而是要将网站用于真实用途,那么你或许会需要买一个域名,以便你将来可以更改托管服务提供商,但这有点不那么简单。 + +### 这是学习 HTML 的一个很好的起点 + +如果你熟悉在 Git 中编辑文件,同时想练习 HTML/CSS 的话,我认为将它放在网站中是一个有趣的方式!我真的很喜欢它的简单性 —— 实际上这只有一个文件,所以没有其他花哨的东西需要去理解。 + +还有很多方法可以复杂化/扩展它,比如这个博客实际上是用 [Hugo][4] 生成的,它生成了一堆 HTML 文件并放在网络中,但从基础开始总是不错的。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/09/06/how-to-put-an-html-page-on-the-internet/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://neocities.org/ +[2]: https://julia-example-website.neocities.org/ +[3]: https://glitch.com +[4]: https://gohugo.io/ diff --git a/published/20190909 Firefox 69 available in Fedora.md b/published/20190909 Firefox 69 available in Fedora.md new file mode 100644 index 0000000000..79249a373f --- /dev/null +++ b/published/20190909 Firefox 69 available in Fedora.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11354-1.html) +[#]: subject: (Firefox 69 available in Fedora) +[#]: via: (https://fedoramagazine.org/firefox-69-available-in-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Firefox 69 已可在 Fedora 中获取 +====== + +![][1] + +当你安装 Fedora Workstation 时,你会发现它包括了世界知名的 Firefox 浏览器。 Mozilla 基金会以开发 Firefox 以及其他促进开放、安全和隐私的互联网项目为己任。Firefox 有快速的浏览引擎和大量的隐私功能。 + +开发者社区不断改进和增强 Firefox。最新版本 Firefox 69 于最近发布,你可在稳定版 Fedora 系统(30 及更高版本)中获取它。继续阅读以获得更多详情。 + +### Firefox 69 中的新功能 + +最新版本的 Firefox 包括[增强跟踪保护][2]Enhanced Tracking Protection(ETP)。当你使用带有新(或重置)配置文件的 Firefox 69 时,浏览器会使网站更难以跟踪你的信息或滥用你的计算机资源。 + +例如,不太正直的网站使用脚本让你的系统进行大量计算来产生加密货币,这称为[加密挖矿][3]cryptomining。加密挖矿在你不知情或未经许可的情况下发生,因此是对你的系统的滥用。Firefox 69 中的新标准设置可防止网站遭受此类滥用。 + +Firefox 69 还有其他设置,可防止识别或记录你的浏览器指纹,以供日后使用。这些改进为你提供了额外的保护,免于你的活动被在线追踪。 + +另一个常见的烦恼是在没有提示的情况下播放视频。视频播放也会占用更多的 CPU,你可能不希望未经许可就在你的笔记本上发生这种情况。Firefox 使用[阻止自动播放][4]Block Autoplay这个功能阻止了这种情况的发生。而 Firefox 69 还允许你停止静默开始播放的视频。此功能可防止不必要的突然的噪音。它还解决了更多真正的问题 —— 未经许可使用计算机资源。 + +新版本中还有许多其他新功能。在 [Firefox 发行说明][5]中阅读有关它们的更多信息。 + +### 如何获得更新 + +Firefox 69 存在于稳定版 Fedora 30、预发布版 Fedora 31 和 Rawhide 仓库中。该更新由 Fedora 的 Firefox 包维护者提供。维护人员还确保更新了 Mozilla 的网络安全服务(nss 包)。我们感谢 Mozilla 项目和 Firefox 社区在提供此新版本方面的辛勤工作。 + +如果你使用的是 Fedora 30 或更高版本,请在 Fedora Workstation 上使用*软件中心*,或在任何 Fedora 系统上运行以下命令: + +``` +$ sudo dnf --refresh upgrade firefox +``` + +如果你使用的是 Fedora 29,请[帮助测试更新][6],这样它可以变得稳定,让所有用户可以轻松使用。 + +Firefox 可能会提示你升级个人设置以使用新设置。要使用新功能,你应该这样做。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/firefox-69-available-in-fedora/ + +作者:[Paul W. Frields][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://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/firefox-v69-816x345.jpg +[2]: https://blog.mozilla.org/blog/2019/09/03/todays-firefox-blocks-third-party-tracking-cookies-and-cryptomining-by-default/ +[3]: https://www.webopedia.com/TERM/C/cryptocurrency-mining.html +[4]: https://support.mozilla.org/kb/block-autoplay +[5]: https://www.mozilla.org/en-US/firefox/69.0/releasenotes/ +[6]: https://bodhi.fedoraproject.org/updates/FEDORA-2019-89ae5bb576 diff --git a/published/20190909 How to Install Shutter Screenshot Tool in Ubuntu 19.04.md b/published/20190909 How to Install Shutter Screenshot Tool in Ubuntu 19.04.md new file mode 100644 index 0000000000..fd526ef267 --- /dev/null +++ b/published/20190909 How to Install Shutter Screenshot Tool in Ubuntu 19.04.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11335-1.html) +[#]: subject: (How to Install Shutter Screenshot Tool in Ubuntu 19.04) +[#]: via: (https://itsfoss.com/install-shutter-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 19.04 中安装 Shutter 截图工具 +====== + +Shutter 是我在 [Linux 中最喜欢的截图工具][1]。你可以使用它截图,还可以用它编辑截图或其他图像。它是一个在图像上添加箭头和文本的不错的工具。你也可以使用它在 Ubuntu 或其它你使用的发行版中[调整图像大小][2]。FOSS 上大多数截图教程都使用 Shutter 编辑。 + +![Install Shutter Ubuntu][8] + + +虽然 [Shutter][4] 一直是一款很棒的工具,但它的开发却停滞了。这几年来一直没有新版本的 Shutter。甚至像 [Shutter 中编辑模式被禁用][5]这样的简单 bug 也没有修复。根本没有开发者的消息。 + +也许这就是为什么新版本的 Ubuntu 放弃它的原因。在 Ubuntu 18.04 LTS 之前,你可以在软件中心,或者[启用 universe 仓库][7]来[使用 apt-get 命令][6]安装它。但是从 Ubuntu 18.10 及更高版本开始,你就不能再这样做了。 + +抛开这些缺点,Shutter 是一个很好的工具,我想继续使用它。也许你也是像我这样的 Shutter 粉丝,并且想要使用它。好的方面是你仍然可以在 Ubuntu 19.04 中安装 Shutter,这要归功于非官方 PPA。 + +### 在 Ubuntu 19.04 上安装 Shutter + +![][3] + +我希望你了解 PPA 的概念。如果不了解,我强烈建议阅读我的指南,以了解更多关于[什么是 PPA 以及如何使用它][9]。 + +现在,打开终端并使用以下命令添加新仓库: + +``` +sudo add-apt-repository -y ppa:linuxuprising/shutter +``` + +不需要再使用 `apt update`,因为从 Ubuntu 18.04 开始,仓库会在添加新条目后自动更新。 + +现在使用 `apt` 命令安装 Shutter: + +``` +sudo apt install shutter +``` + +完成。你应该已经安装 Shutter 截图工具。你可从菜单搜索并启动它。 + +### 删除通过非官方 PPA 安装的 Shutter + +最后我以卸载 Shutter 以及删除添加的仓库来结束教程。 + +首先,从系统中删除 Shutter: + +``` +sudo apt remove shutter +``` + +接下来,从你的仓库列表中删除 PPA: + +``` +sudo add-apt-repository --remove ppa:linuxuprising/shutter +``` + +你或许还想了解 [Y PPA Manager][11],这是一款 PPA 图形管理工具。 + +Shutter 是一个很好的工具,我希望它能被积极开发。我希望它的开发人员没问题,他/她可以找一些时间来处理它。或者是时候让其他人分叉并继续让它变得更棒。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-shutter-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/take-screenshot-linux/ +[2]: https://itsfoss.com/resize-images-with-right-click/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/shutter-screenshot.jpg?ssl=1 +[4]: http://shutter-project.org/ +[5]: https://itsfoss.com/shutter-edit-button-disabled/ +[6]: https://itsfoss.com/apt-get-linux-guide/ +[7]: https://itsfoss.com/ubuntu-repositories/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/Install-Shutter-ubuntu.jpg?resize=800%2C450&ssl=1 +[9]: https://itsfoss.com/ppa-guide/ +[11]: https://itsfoss.com/y-ppa-manager/ diff --git a/published/20190911 How to set up a TFTP server on Fedora.md b/published/20190911 How to set up a TFTP server on Fedora.md new file mode 100644 index 0000000000..bdd7ab6f0d --- /dev/null +++ b/published/20190911 How to set up a TFTP server on Fedora.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11371-1.html) +[#]: subject: (How to set up a TFTP server on Fedora) +[#]: via: (https://fedoramagazine.org/how-to-set-up-a-tftp-server-on-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +如何在 Fedora 上建立一个 TFTP 服务器 +====== + +![][1] + +TFTP 即简单文本传输协议Trivial File Transfer Protocol,允许用户通过 [UDP][2] 协议在系统之间传输文件。默认情况下,协议使用的是 UDP 的 69 号端口。TFTP 协议广泛用于无盘设备的远程启动。因此,在你的本地网络建立一个 TFTP 服务器,这样你就可以对 [安装好的 Fedora][3] 和其他无盘设备做一些操作,这将非常有趣。 + +TFTP 仅仅能够从远端系统读取数据或者向远端系统写入数据,而没有列出远端服务器上文件的能力。它也没提供用户身份验证。由于安全隐患和缺乏高级功能,TFTP 通常仅用于局域网内部(LAN)。 + +### 安装 TFTP 服务器 + +首先你要做的事就是安装 TFTP 客户端和 TFTP 服务器: + +``` +dnf install tftp-server tftp -y +``` + +上述的这条命令会在 `/usr/lib/systemd/system` 目录下为 [systemd][4] 创建 `tftp.service` 和 `tftp.socket` 文件。 + +``` +/usr/lib/systemd/system/tftp.service +/usr/lib/systemd/system/tftp.socket +``` + +接下来,将这两个文件复制到 `/etc/systemd/system` 目录下,并重新命名。 + +``` +cp /usr/lib/systemd/system/tftp.service /etc/systemd/system/tftp-server.service +cp /usr/lib/systemd/system/tftp.socket /etc/systemd/system/tftp-server.socket +``` + +### 修改文件 + +当你把这些文件复制和重命名后,你就可以去添加一些额外的参数,下面是 `tftp-server.service` 刚开始的样子: + +``` +[Unit] +Description=Tftp Server +Requires=tftp.socket +Documentation=man:in.tftpd + +[Service] +ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot +StandardInput=socket + +[Install] +Also=tftp.socket +``` + +在 `[Unit]` 部分添加如下内容: + +``` +Requires=tftp-server.socket +``` + +修改 `[ExecStart]` 行: + +``` +ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot +``` + +下面是这些选项的意思: + + * `-c` 选项允许创建新的文件 + * `-p` 选项用于指明在正常系统提供的权限检查之上没有其他额外的权限检查 + * `-s` 建议使用该选项以确保安全性以及与某些引导 ROM 的兼容性,这些引导 ROM 在其请求中不容易包含目录名。 + +默认的上传和下载位置位于 `/var/lib/tftpboot`。 + +下一步,修改 `[Install]` 部分的内容 + +``` +[Install] +WantedBy=multi-user.target +Also=tftp-server.socket +``` + +不要忘记保存你的修改。 + +下面是 `/etc/systemd/system/tftp-server.service` 文件的完整内容: + +``` +[Unit] +Description=Tftp Server +Requires=tftp-server.socket +Documentation=man:in.tftpd + +[Service] +ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot +StandardInput=socket + +[Install] +WantedBy=multi-user.target +Also=tftp-server.socket +``` + +### 启动 TFTP 服务器 + +重新启动 systemd 守护进程: + +``` +systemctl daemon-reload +``` + +启动服务器: + +``` +systemctl enable --now tftp-server +``` + +要更改 TFTP 服务器允许上传和下载的权限,请使用此命令。注意 TFTP 是一种固有的不安全协议,因此不建议你在与其他人共享的网络上这样做。 + +``` +chmod 777 /var/lib/tftpboot +``` + +配置防火墙让 TFTP 能够使用: + +``` +firewall-cmd --add-service=tftp --perm +firewall-cmd --reload +``` + +### 客户端配置 + +安装 TFTP 客户端 + +``` +yum install tftp -y +``` + +运行 `tftp` 命令连接服务器。下面是一个启用详细信息选项的例子: + +``` +[client@thinclient:~ ]$ tftp 192.168.1.164 +tftp> verbose +Verbose mode on. +tftp> get server.logs +getting from 192.168.1.164:server.logs to server.logs [netascii] +Received 7 bytes in 0.0 seconds [inf bits/sec] +tftp> quit +[client@thinclient:~ ]$ +``` + +记住,因为 TFTP 没有列出服务器上文件的能力,因此,在你使用 `get` 命令之前需要知道文件的具体名称。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-set-up-a-tftp-server-on-fedora/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/tftp-server-816x345.jpg +[2]: https://en.wikipedia.org/wiki/User_Datagram_Protocol +[3]: https://docs.fedoraproject.org/en-US/fedora/f30/install-guide/advanced/Network_based_Installations/ +[4]: https://fedoramagazine.org/systemd-getting-a-grip-on-units/ +[5]: https://unsplash.com/@laikanotebooks?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[6]: https://unsplash.com/search/photos/file-folders?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/20190912 Bash Script to Send a Mail About New User Account Creation.md b/published/20190912 Bash Script to Send a Mail About New User Account Creation.md new file mode 100644 index 0000000000..849d7c5597 --- /dev/null +++ b/published/20190912 Bash Script to Send a Mail About New User Account Creation.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11362-1.html) +[#]: subject: (Bash Script to Send a Mail About New User Account Creation) +[#]: via: (https://www.2daygeek.com/linux-shell-script-to-monitor-user-creation-send-email/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +用 Bash 脚本发送新用户帐户创建的邮件 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/20/093308a615tcuiopctvp5t.jpg) + +出于某些原因,你可能需要跟踪 Linux 上的新用户创建信息。同时,你可能需要通过邮件发送详细信息。这或许是审计目标的一部分,或者安全团队出于跟踪目的可能希望对此进行监控。 + +我们可以通过其他方式进行此操作,正如我们在上一篇文章中已经描述的那样。 + +* [在系统中创建新用户帐户时发送邮件的 Bash 脚本][1] + +Linux 有许多开源监控工具可以使用。但我不认为他们有办法跟踪新用户创建过程,并在发生时提醒管理员。 + +那么我们怎样才能做到这一点? + +我们可以编写自己的 Bash 脚本来实现这一目标。我们过去写过许多有用的 shell 脚本。如果你想了解,请进入下面的链接。 + +* [如何使用 shell 脚本自动化日常活动?][2] + +### 这个脚本做了什么? + +这将每天两次(一天的开始和结束)备份 `/etc/passwd` 文件,这将使你能够获取指定日期的新用户创建详细信息。 + +我们需要添加以下两个 cron 任务来复制 `/etc/passwd` 文件。 + +``` +# crontab -e + +1 0 * * * cp /etc/passwd /opt/scripts/passwd-start-$(date +"%Y-%m-%d") +59 23 * * * cp /etc/passwd /opt/scripts/passwd-end-$(date +"%Y-%m-%d") +``` + +它使用 `diff` 命令来检测文件之间的差异,如果发现与昨日有任何差异,脚本将向指定 email 发送新用户详细信息。 + +我们不用经常运行此脚本,因为用户创建不经常发生。但是,我们计划每天运行一次此脚本。 + +这样,你可以获得有关新用户创建的综合报告。 + +**注意:**我们在脚本中使用了我们的电子邮件地址进行演示。因此,我们要求你用自己的电子邮件地址。 + +``` +# vi /opt/scripts/new-user-detail.sh + +#!/bin/bash +mv /opt/scripts/passwd-start-$(date --date='yesterday' '+%Y-%m-%d') /opt/scripts/passwd-start +mv /opt/scripts/passwd-end-$(date --date='yesterday' '+%Y-%m-%d') /opt/scripts/passwd-end +ucount=$(diff /opt/scripts/passwd-start /opt/scripts/passwd-end | grep ">" | cut -d":" -f6 | cut -d"/" -f3 | wc -l) +if [ $ucount -gt 0 ] +then + SUBJECT="ATTENTION: New User Account is created on server : `date --date='yesterday' '+%b %e'`" + MESSAGE="/tmp/new-user-logs.txt" + TO="2daygeek@gmail.com" + echo "Hostname: `hostname`" >> $MESSAGE + echo -e "\n" >> $MESSAGE + echo "The New User Details are below." >> $MESSAGE + echo "+------------------------------+" >> $MESSAGE + diff /opt/scripts/passwd-start /opt/scripts/passwd-end | grep ">" | cut -d":" -f6 | cut -d"/" -f3 >> $MESSAGE + echo "+------------------------------+" >> $MESSAGE + mail -s "$SUBJECT" "$TO" < $MESSAGE + rm $MESSAGE +fi +``` + +给 `new-user-detail.sh` 文件添加可执行权限。 + +``` +$ chmod +x /opt/scripts/new-user-detail.sh +``` + +最后添加一个 cron 任务来自动执行此操作。它在每天早上 7 点运行。 + +``` +# crontab -e + +0 7 * * * /bin/bash /opt/scripts/new-user.sh +``` + +**注意:**你会在每天早上 7 点都会收到一封关于昨日详情的邮件提醒。 + +**输出:**输出与下面的输出相同。 + +``` +# cat /tmp/new-user-logs.txt + +Hostname: CentOS.2daygeek.com + +The New User Details are below. ++------------------------------+ +tuser3 ++------------------------------+ +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-shell-script-to-monitor-user-creation-send-email/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-bash-script-to-monitor-user-creation-send-email/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/20190913 An introduction to Virtual Machine Manager.md b/published/20190913 An introduction to Virtual Machine Manager.md new file mode 100644 index 0000000000..aa452f418a --- /dev/null +++ b/published/20190913 An introduction to Virtual Machine Manager.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11364-1.html) +[#]: subject: (An introduction to Virtual Machine Manager) +[#]: via: (https://opensource.com/article/19/9/introduction-virtual-machine-manager) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +虚拟机管理器(Virtual Machine Manager)简介 +====== + +> virt-manager 为 Linux 虚拟化提供了全方位的选择。 + +![](https://img.linux.net.cn/data/attachment/album/201909/20/113434dxbbp3ttmxbhmnnm.jpg) + +在我关于 [GNOME Boxes][3] 的[系列文章][2]中,我已经解释了 Linux 用户如何能够在他们的桌面上快速启动虚拟机。当你只需要简单的配置时,Box 可以轻而易举地创建虚拟机。 + +但是,如果你需要在虚拟机中配置更多详细信息,那么你就需要一个工具,为磁盘、网卡(NIC)和其他硬件提供全面的选项。这时就需要 [虚拟机管理器(Virtual Machine Manager)][4](virt-manager)了。如果在应用菜单中没有看到它,你可以从包管理器或命令行安装它: + +* 在 Fedora 上:`sudo dnf install virt-manager` +* 在 Ubuntu 上:`sudo apt install virt-manager` + +安装完成后,你可以从应用菜单或在命令行中输入 `virt-manager` 启动。 + +![Virtual Machine Manager's main screen][5] + +为了演示如何使用 virt-manager 创建虚拟机,我将设置一个 Red Hat Enterprise Linux 8 虚拟机。 + +首先,单击 “文件File” 然后点击 “新建虚拟机New Virtual Machine”。Virt-manager 的开发者已经标记好了每一步(例如,“第 1 步,共 5 步Step 1 of 5”)来使其变得简单。单击 “本地安装介质Local install media” 和 “下一步Forward”。 + +![Step 1 virtual machine creation][6] + +在下个页面中,选择要安装的操作系统的 ISO 文件。(RHEL 8 镜像位于我的下载目录中。)Virt-manager 自动检测操作系统。 + +![Step 2 Choose the ISO File][7] + +在步骤 3 中,你可以指定虚拟机的内存和 CPU。默认值为内存 1,024MB 和一个 CPU。 + +![Step 3 Set CPU and Memory][8] + +我想给 RHEL 充足的配置来运行,我使用的硬件配置也充足,所以我将它们(分别)增加到 4,096MB 和两个 CPU。 + +下一步为虚拟机配置存储。默认设置是 10GB 硬盘。(我保留此设置,但你可以根据需要进行调整。)你还可以选择现有磁盘镜像或在自定义位置创建一个磁盘镜像。 + +![Step 4 Configure VM Storage][9] + +步骤 5 是命名虚拟机并单击“完成Finish”。这相当于创建了一台虚拟机,也就是 GNOME Boxes 中的一个 Box。虽然技术上讲是最后一步,但你有几个选择(如下面的截图所示)。由于 virt-manager 的优点是能够自定义虚拟机,因此在单击“完成Finish”之前,我将选中“在安装前定制配置Customize configuration before install”的复选框。 + +因为我选择了自定义配置,virt-manager 打开了一个有一组设备和设置的页面。这里是重点! + +这里你也可以命名该虚拟机。在左侧列表中,你可以查看各个方面的详细信息,例如 CPU、内存、磁盘、控制器和许多其他项目。例如,我可以单击 “CPU” 来验证我在步骤 3 中所做的更改。 + +![Changing the CPU count][10] + +我也可以确认我设置的内存量。 + +当虚拟机作为服务器运行时,我通常会禁用或删除声卡。为此,请选择 “声卡Sound” 并单击 “移除Remove” 或右键单击 “声卡Sound” 并选择 “移除硬件Remove Hardware”。 + +你还可以使用底部的 “添加硬件Add Hardware” 按钮添加硬件。这会打开 “添加新的虚拟硬件Add New Virtual Hardware” 页面,你可以在其中添加其他存储设备、内存、声卡等。这就像可以访问一个库存充足的(虚拟)计算机硬件仓库。 + +![The Add New Hardware screen][11] + +对 VM 配置感到满意后,单击 “开始安装Begin Installation”,系统将启动并开始从 ISO 安装指定的操作系统。 + +![Begin installing the OS][12] + +完成后,它会重新启动,你的新虚拟机就可以使用了。 + +![Red Hat Enterprise Linux 8 running in VMM][13] + +Virtual Machine Manager 是桌面 Linux 用户的强大工具。它是开源的,是专有和封闭虚拟化产品的绝佳替代品。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-virtual-machine-manager + +作者:[Alan Formy-Duval][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/alanfdoss +[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]: https://opensource.com/sitewide-search?search_api_views_fulltext=GNOME%20Box +[3]: https://wiki.gnome.org/Apps/Boxes +[4]: https://virt-manager.org/ +[5]: https://opensource.com/sites/default/files/1-vmm_main_0.png (Virtual Machine Manager's main screen) +[6]: https://opensource.com/sites/default/files/2-vmm_step1_0.png (Step 1 virtual machine creation) +[7]: https://opensource.com/sites/default/files/3-vmm_step2.png (Step 2 Choose the ISO File) +[8]: https://opensource.com/sites/default/files/4-vmm_step3default.png (Step 3 Set CPU and Memory) +[9]: https://opensource.com/sites/default/files/6-vmm_step4.png (Step 4 Configure VM Storage) +[10]: https://opensource.com/sites/default/files/9-vmm_customizecpu.png (Changing the CPU count) +[11]: https://opensource.com/sites/default/files/11-vmm_addnewhardware.png (The Add New Hardware screen) +[12]: https://opensource.com/sites/default/files/12-vmm_rhelbegininstall.png +[13]: https://opensource.com/sites/default/files/13-vmm_rhelinstalled_0.png (Red Hat Enterprise Linux 8 running in VMM) diff --git a/published/20190913 How to Find and Replace a String in File Using the sed Command in Linux.md b/published/20190913 How to Find and Replace a String in File Using the sed Command in Linux.md new file mode 100644 index 0000000000..d49a5146b9 --- /dev/null +++ b/published/20190913 How to Find and Replace a String in File Using the sed Command in Linux.md @@ -0,0 +1,346 @@ +[#]: collector: (lujun9972) +[#]: translator: (asche910) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11367-1.html) +[#]: subject: (How to Find and Replace a String in File Using the sed Command in Linux) +[#]: via: (https://www.2daygeek.com/linux-sed-to-find-and-replace-string-in-files/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +使用 sed 命令查找和替换文件中的字符串的 16 个示例 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/20/210723xf884pafyzf9zf4a.jpg) + +当你在使用文本文件时,很可能需要查找和替换文件中的字符串。`sed` 命令主要用于替换一个文件中的文本。在 Linux 中这可以通过使用 `sed` 命令和 `awk` 命令来完成。 + +在本教程中,我们将告诉你使用 `sed` 命令如何做到这一点,然后讨论讨论 `awk` 命令相关的。 + +### sed 命令是什么 + +`sed` 命令表示 Stream Editor(流编辑器),用来在 Linux 上执行基本的文本操作。它可以执行各种功能,如搜索、查找、修改、插入或删除文件。 + +此外,它也可以执行复杂的正则表达式匹配。 + +它可用于以下目的: + +* 查找和替换匹配给定的格式的内容。 +* 在指定行查找和替换匹配给定的格式的内容。 +* 在所有行查找和替换匹配给定的格式的内容。 +* 搜索并同时替换两种不同的模式。 + +本文列出的十五个例子可以帮助你掌握 `sed` 命令。 + +如果要使用 `sed` 命令删除文件中的行,去下面的文章。 + +注意:由于这是一篇演示文章,我们使用不带 `-i` 选项的 `sed` 命令,该选项会在 Linux 终端中删除行并打印文件内容。 + +但是,在实际环境中如果你想删除源文件中的行,使用带 `-i` 选项的 `sed` 命令。 + +常见的 `sed` 替换字符串的语法。 + +``` +sed -i 's/Search_String/Replacement_String/g' Input_File +``` + +首先我们需要了解 `sed` 语法来做到这一点。请参阅有关的细节。 + +* `sed`:这是一个 Linux 命令。 +* `-i`:这是 `sed` 命令的一个选项,它有什么作用?默认情况下,`sed` 打印结果到标准输出。当你使用 `sed` 添加这个选项时,那么它会在适当的位置修改文件。当你添加一个后缀(比如,`-i.bak`)时,就会创建原始文件的备份。 +* `s`:字母 `s` 是一个替换命令。 +* `Search_String`:搜索一个给定的字符串或正则表达式。 +* `Replacement_String`:替换的字符串。 +* `g`:全局替换标志。默认情况下,`sed` 命令替换每一行第一次出现的模式,它不会替换行中的其他的匹配结果。但是,提供了该替换标志时,所有匹配都将被替换。 +* `/`:分界符。 +* `Input_File`:要执行操作的文件名。 + +让我们来看看文件中用sed命令来搜索和转换文本的一些常用例子。 + +我们已经创建了用于演示的以下文件。 + +``` +# cat sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 1) 如何查找和替换一行中“第一次”模式匹配 + +下面的 `sed` 命令用 `linux` 替换文件中的 `unix`。这仅仅改变了每一行模式的第一个实例。 + +``` +# sed 's/unix/linux/' sed-test.txt + +1 Unix linux unix 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 2) 如何查找和替换每一行中“第 N 次”出现的模式 + +在行中使用`/1`、`/2`……`/n` 等标志来代替相应的匹配。 + +下面的 `sed` 命令在一行中用 `linux` 来替换 `unix` 模式的第二个实例。 + +``` +# sed 's/unix/linux/2' sed-test.txt + +1 Unix unix linux 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 3) 如何搜索和替换一行中所有的模式实例 + +下面的 `sed` 命令用 `linux` 替换 `unix` 格式的所有实例,因为 `g` 是一个全局替换标志。 + +``` +# sed 's/unix/linux/g' sed-test.txt + +1 Unix linux linux 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 4) 如何查找和替换一行中从“第 N 个”开始的所有匹配的模式实例 + +下面的 `sed` 命令在一行中替换从模式的“第 N 个”开始的匹配实例。 + +``` +# sed 's/unix/linux/2g' sed-test.txt + +1 Unix unix linux 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 5) 在特定的行号搜索和替换模式 + +你可以替换特定行号中的字符串。下面的 `sed` 命令用 `linux` 仅替换第三行的 `unix` 模式。 + +``` +# sed '3 s/unix/linux/' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 6) 在特定范围行号间搜索和替换模式 + +你可以指定行号的范围,以替换字符串。 + +下面的 `sed` 命令在 1 到 3 行间用 `linux` 替换 `Unix` 模式。 + +``` +# sed '1,3 s/unix/linux/' sed-test.txt + +1 Unix linux unix 23 +2 linux Linux 34 +3 linuxlinux UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 7) 如何查找和修改最后一行的模式 + +下面的 sed 命令允许你只在最后一行替换匹配的字符串。 + +下面的 `sed` 命令只在最后一行用 `Unix` 替换 `Linux` 模式。 + +``` +# sed '$ s/Linux/Unix/' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Unix is free and opensource operating system +``` + +### 8) 在一行中如何只查找和替换正确的模式匹配 + +你可能已经注意到,子串 `linuxunix` 被替换为在第 6 个示例中的 `linuxlinux`。如果你只想更改正确的匹配词,在搜索串的两端用这个边界符 `\b`。 + +``` +# sed '1,3 s/\bunix\b/linux/' sed-test.txt + +1 Unix linux unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 9) 如何以不区分大小写来搜索与替换模式 + +大家都知道,Linux 是区分大小写的。为了与不区分大小写的模式匹配,使用 `I` 标志。 + +``` +# sed 's/unix/linux/gI' sed-test.txt + +1 linux linux linux 23 +2 linux Linux 34 +3 linuxlinux linuxLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 10) 如何查找和替换包含分隔符的字符串 + +当你搜索和替换含分隔符的字符串时,我们需要用反斜杠 `\` 来取消转义。 + +在这个例子中,我们将用 `/usr/bin/fish` 来替换 `/bin/bash`。 + +``` +# sed 's/\/bin\/bash/\/usr\/bin\/fish/g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /usr/bin/fish CentOS Linux OS +Linux is free and opensource operating system +``` + +上述 `sed` 命令按预期工作,但它看起来来很糟糕。 为了简化,大部分的人会用竖线 `|` 作为正则表达式的定位符。 所以,我建议你用它。 + +``` +# sed 's|/bin/bash|/usr/bin/fish/|g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /usr/bin/fish/ CentOS Linux OS +Linux is free and opensource operating system +``` + +### 11) 如何以给定的模式来查找和替换数字 + +类似地,数字可以用模式来代替。下面的 `sed` 命令以 `[0-9]` 替换所有数字为 `number`。 + +``` +# sed 's/[0-9]/number/g' sed-test.txt + +number Unix unix unix numbernumber +number linux Linux numbernumber +number linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 12) 如何用模式仅查找和替换两个数字 + +如果你想用模式来代替两位数字,使用下面的 `sed` 命令。 + +``` +# sed 's/\b[0-9]\{2\}\b/number/g' sed-test.txt + +1 Unix unix unix number +2 linux Linux number +3 linuxunix UnixLinux +linux /bin/bash CentOS Linux OS +Linux is free and opensource operating system +``` + +### 13) 如何用 sed 命令仅打印被替换的行 + +如果你想显示仅更改的行,使用下面的 `sed` 命令。 + +* `p` - 它在终端上输出替换的行两次。 +* `-n` - 它抑制由 `p` 标志所产生的重复行。 + +``` +# sed -n 's/Unix/Linux/p' sed-test.txt + +1 Linux unix unix 23 +3 linuxunix LinuxLinux +``` + +### 14) 如何同时运行多个 sed 命令 + +以下 `sed` 命令同时检测和置换两个不同的模式。 + +下面的 `sed` 命令搜索 `linuxunix` 和 `CentOS` 模式,用 `LINUXUNIX` 和 `RHEL8` 一次性更换它们。 + +``` +# sed -e 's/linuxunix/LINUXUNIX/g' -e 's/CentOS/RHEL8/g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 LINUXUNIX UnixLinux +linux /bin/bash RHEL8 Linux OS +Linux is free and opensource operating system +``` + +下面的 `sed` 命令搜索替换两个不同的模式,并一次性替换为一个字符串。 + +以下 `sed` 的命令搜索 `linuxunix` 和 `CentOS` 模式,用 `Fedora30` 替换它们。 + +``` +# sed -e 's/\(linuxunix\|CentOS\)/Fedora30/g' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 Fedora30 UnixLinux +linux /bin/bash Fedora30 Linux OS +Linux is free and opensource operating system +``` + +### 15) 如果给定的模式匹配,如何查找和替换整个行 + +如果模式匹配,可以使用 `sed` 命令用新行来代替整行。这可以通过使用 `c` 标志来完成。 + +``` +# sed '/OS/ c\ +New Line +' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +New Line +Linux is free and opensource operating system +``` + +### 16) 如何搜索和替换相匹配的模式行 + +在 `sed` 命令中你可以为行指定适合的模式。在匹配该模式的情况下,`sed` 命令搜索要被替换的字符串。 + +下面的 `sed` 命令首先查找具有 `OS` 模式的行,然后用 `ArchLinux` 替换单词 `Linux`。 + +``` +# sed '/OS/ s/Linux/ArchLinux/' sed-test.txt + +1 Unix unix unix 23 +2 linux Linux 34 +3 linuxunix UnixLinux +linux /bin/bash CentOS ArchLinux OS +Linux is free and opensource operating system +``` +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-sed-to-find-and-replace-string-in-files/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[Asche910](https://github.com/asche910) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 diff --git a/published/20190914 GNOME 3.34 Released With New Features - Performance Improvements.md b/published/20190914 GNOME 3.34 Released With New Features - Performance Improvements.md new file mode 100644 index 0000000000..69911195d2 --- /dev/null +++ b/published/20190914 GNOME 3.34 Released With New Features - Performance Improvements.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11345-1.html) +[#]: subject: (GNOME 3.34 Released With New Features & Performance Improvements) +[#]: via: (https://itsfoss.com/gnome-3-34-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME 3.34 发布 +====== + +![](https://img.linux.net.cn/data/attachment/album/201909/15/113154i3bcp9p3md3mc3bk.jpg) + +最新版本的 GNOME 代号为“塞萨洛尼基Thessaloniki”。考虑到这个版本经过了 6 个月的开发,这应该是对 [GNOME 3.32][1] 的一次令人印象深刻的升级。 + +在此版本中,有许多新功能和显著的性能改进。除了新功能外,可定制的程度也得到了提升。 + +以下是新的变化: + +### GNOME 3.34 的关键改进 + +你可以观看此视频,了解 GNOME 3.34 中的新功能: + +- [视频](https://img.linux.net.cn/static/video/_-qAjPRr5SGoY.mp4) + +#### 拖放图标到文件夹 + +新的 shell 主题允许你拖放应用程序抽屉中的图标以重新排列它们,或将它们组合到一个文件夹中。你可能已经在 Android 或 iOS 智能手机中使用过此类功能。 + +![You can now drag and drop icons into a folder][2] + +#### 改进的日历管理器 + +改进的日历管理器可以轻松地与第三方服务集成,使你能够直接从 Linux 系统管理日程安排,而无需单独使用其他应用程序。 + +![GNOME Calendar Improvements][3] + +#### 背景选择的设置 + +现在,更容易为主屏幕和锁定屏幕选择自定义背景,因为它在同一屏幕中显示所有可用背景。为你节省至少一次鼠标点击。 + +![It’s easier to select backgrounds now][4] + +#### 重新排列搜索选项 + +搜索选项和结果可以手动重新排列。因此,当你要搜索某些内容时,可以决定哪些内容先出现。 + +#### 响应式设计的“设置”应用 + +设置菜单 UI 现在具有响应性,因此无论你使用何种类型(或尺寸)的设备,都可以轻松访问所有选项。这肯定对 [Linux 智能手机(如 Librem 5)][5] 上的 GNOME 有所帮助。 + +除了所有这些之外,[官方公告][6]还提到到开发人员的有用补充(增加了系统分析器和虚拟化改进): + +> 对于开发人员,GNOME 3.34 在 Sysprof 中包含更多数据源,使应用程序的性能分析更加容易。对 Builder 的多项改进中包括集成的 D-Bus 检查器。 + +![Improved Sysprof tool in GNOME 3.34][7] + +### 如何获得GNOME 3.34? + +虽然新版本已经发布,但它还没有进入 Linux 发行版的官方存储库。所以,我们建议等待它,并在它作为更新包提供时进行升级。不管怎么说,如果你想构建它,你都可以在这里找到[源代码][8]。 + +嗯,就是这样。如果你感兴趣,可以查看[完整版本说明][10]以了解技术细节。 + +你如何看待新的 GNOME 3.34? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-3-34-release/ + +作者:[Ankush Das][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/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnome.org/news/2019/03/gnome-3-32-released/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/icon-grid-drag-gnome.png?ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/gnome-calendar-improvements.jpg?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/background-panel-GNOME.png?resize=800%2C555&ssl=1 +[5]: https://itsfoss.com/librem-linux-phone/ +[6]: https://www.gnome.org/press/2019/09/gnome-3-34-released/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/sysprof-gnome.jpg?resize=800%2C493&ssl=1 +[8]: https://download.gnome.org/ +[9]: https://itsfoss.com/fedora-26-release/ +[10]: https://help.gnome.org/misc/release-notes/3.34/ diff --git a/published/20190914 Manjaro Linux Graduates From A Hobby Project To A Professional Project.md b/published/20190914 Manjaro Linux Graduates From A Hobby Project To A Professional Project.md new file mode 100644 index 0000000000..0f5ce59599 --- /dev/null +++ b/published/20190914 Manjaro Linux Graduates From A Hobby Project To A Professional Project.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11349-1.html) +[#]: subject: (Manjaro Linux Graduates From A Hobby Project To A Professional Project) +[#]: via: (https://itsfoss.com/manjaro-linux-business-formation/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Manjaro Linux 从业余爱好项目成长为专业项目 +====== + +> Manjaro 正在走专业化路线。虽然 Manjaro 社区将负责项目的开发和其他相关活动,但该团队已成立了一家公司作为其法人实体处理商业协议和专业服务。 + +Manjaro 是一个相当流行的 Linux 发行版,而它只是由三个人(Bernhard、Jonathan 和 Phili)于 2011 年激情之下创建的项目。现在,它是目前[最好的 Linux 发行版][1]之一,所以它不能真的一直还只是个业余爱好项目了,对吧。 + +嗯,现在有个好消息:Manjaro 已经建立了一家新公司“[Manjaro GmbH & Co. KG]”,以 [Blue Systems][2] 为顾问,以便能够全职雇佣维护人员,并探索未来的商业机会。 + +![][3] + +### 具体有什么变化? + +根据[官方公告][4],Manjaro 项目将保持不变。但是,成立了一家新公司来保护该项目,以允许他们制定法律合同、官方协议和进行其他潜在的商业活动。因此,这使得这个“业余爱好项目”成为了一项专业工作。 + +除此之外,捐赠资金将转给非营利性的[财政托管][5]([CommunityBridge][6] 和 [OpenCollective][7]),让他们来代表项目接受和管理资金。请注意,这些捐赠没有被用于创建这个公司,因此,将资金转移给非营利的财务托管将在确保捐赠的同时也确保透明度。 + +### 这会有何改善? + +随着这个公司的成立,(如开发者所述)新结构将以下列方式帮助 Manjaro: + +* 使开发人员能够全职投入 Manjaro 及其相关项目; +* 在 Linux 相关的比赛和活动中与其他开发人员进行互动; +* 保护 Manjaro 作为一个社区驱动项目的独立性,并保护其品牌; +* 提供更快的安全更新,更有效地响应用户需求; +* 提供在专业层面上作为公司行事的手段。 + +Manjaro 团队还阐明了它将如何继续致力于社区: + +> Manjaro 的使命和目标将与以前一样 —— 支持 Manjaro 的协作开发及其广泛使用。这项工作将继续通过捐赠和赞助来支持,这些捐赠和赞助在任何情况下都不会被这个成立的公司使用。 + +### 关于 Manjaro 公司的更多信息 + +尽管他们提到该项目将独立于公司,但并非所有人都清楚当有了一家具有商业利益的公司时 Manjaro 与“社区”的关系。因此,该团队还在公告中澄清了他们作为一家公司的计划。 + +> Manjaro GmbH & Co.KG 的成立旨在有效地参与商业协议、建立合作伙伴关系并提供专业服务。有了这个,Manjaro 开发者 Bernhard 和 Philip 现在可以全职工作投入到 Manjaro,而 Blue Systems 将担任顾问。 + +> 公司将能够正式签署合同并承担职责和保障,而社区不能承担或承担责任。 + +### 总结 + +因此,通过这一举措以及商业机会,他们计划全职工作并聘请贡献者。 + +当然,现在他们的意思是“业务”(我希望不是作为坏人)。对此公告的大多数反应都是积极的,我们都祝他们好运。虽然有些人可能对具有“商业”利益的“社区”项目持怀疑态度(还记得 [FreeOffice 和 Manjaro 的挫败][9]吗?),但我认为这是一个有趣的举措。 + +你怎么看?请在下面的评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/manjaro-linux-business-formation/ + +作者:[Ankush Das][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/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-distributions/ +[2]: https://www.blue-systems.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/manjaro-gmbh.jpg?ssl=1 +[4]: https://forum.manjaro.org/t/manjaro-is-taking-the-next-step/102105 +[5]: https://en.wikipedia.org/wiki/Fiscal_sponsorship +[6]: https://communitybridge.org/ +[7]: https://opencollective.com/ +[8]: https://itsfoss.com/linux-mint-hacked/ +[9]: https://itsfoss.com/libreoffice-freeoffice-manjaro-linux/ diff --git a/published/20190915 Sandboxie-s path to-open source, update on the Pentagon-s open source initiative, open source in Hollywood,-and more.md b/published/20190915 Sandboxie-s path to-open source, update on the Pentagon-s open source initiative, open source in Hollywood,-and more.md new file mode 100644 index 0000000000..e70c9f8832 --- /dev/null +++ b/published/20190915 Sandboxie-s path to-open source, update on the Pentagon-s open source initiative, open source in Hollywood,-and more.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11351-1.html) +[#]: subject: (Sandboxie's path to open source, update on the Pentagon's open source initiative, open source in Hollywood, and more) +[#]: via: (https://opensource.com/article/19/9/news-september-15) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +开源新闻综述:五角大楼、好莱坞和 Sandboxie 的开源 +====== + +> 不要错过两周以来最大的开源头条新闻。 + +![Weekly news roundup with TV][1] + +在本期我们的开源新闻综述中有 Sandboxie 的开源之路、五角大楼开源计划的进一步变化、好莱坞开源等等! + +### 五角大楼不符合白宫对开源软件的要求 + +2016 年,美国白宫要求每个美国政府机构必须在三年内开放至少 20% 的定制软件。2017 年有一篇关于这一倡议的[有趣文章][5],其中列出了一些令人激动的事情和面临的挑战。 + +根据美国政府问责局(GAO)的说法,[美国五角大楼做的还远远不足][6]。 + +在一篇关于 Nextgov 的文章中,Jack Corrigan 写道,截至 2019 年 7 月,美国五角大楼仅发布了 10% 的代码为开源代码。他们还没有实施的其它白宫任务包括要求制定开源软件政策和定制代码的清单。 + +根据该报告,一些美国政府官员告诉 GAO,他们担心美国政府部门间共享代码的安全风险。他们还承认没有创建衡量开源工作成功的指标。美国五角大楼的首席技术官将五角大楼的规模列为不执行白宫的开源任务的原因。在周二发布的一份报告中,GAO 表示,“在(美国国防部)完全实施其试点计划并确定完成行政管理和预算局(OMB)要求的里程碑之前,该部门将无法达成显著的成本节约和效率的目的。” + +### Sandboxie 在开源的过程中变成了免费软件 + +一家英国安全公司 Sophos Group plc 发布了[其流行的 Sandboxie 工具的免费版本][2],它用作Windows 的隔离操作环境([可在此下载][2])。 + +Sophos 表示,由于 Sandboxie 不是其业务的核心,因此更容易做出的决定就是关闭它。但 Sandboxie 因为无需让用户的操作系统冒风险就可以在安全的环境中运行未知软件而[广受赞誉][3],因此该团队正在投入额外的工作将其作为开源软件发布。这个免费但非开源的中间阶段似乎与当前的系统设计有关,因为它需要激活密钥: + +> Sandboxie 目前使用许可证密钥来激活和授予仅针对付费客户开放的高级功能的访问权限(与使用免费版本的用户相比)。我们修改了代码,并发布了一个不限制任何功能的免费版本的更新版。换句话说,新的免费许可证将可以访问之前仅供付费客户使用的所有功能。 + +受此工具的社区影响,Sophos 的高级领导人宣布发布 Sandboxie 版本 5.31.4,这个不受限制的程序版本将保持免费,直到该工具完全开源。 + +> “Sandboxie 用户群代表了一些最热情、前瞻性和知识渊博的安全社区成员,我们不想让你失望,”[Sophos 的博文说到][4]。“经过深思熟虑后,我们认为让 Sandboxie 走下去的最佳方式是将其交还给用户,将其转换为开源工具。” + +### 志愿者团队致力于查找和数字化无版权书籍 + +1924 年以前在美国出版的所有书籍都是[公有的、可以自由使用/复制的][7]。1964 年及之后出版的图书在出版日期后将保留 95 年的版权。但由于版权漏洞,1923 年至 1964 年间出版的书籍中有高达 75% 可以免费阅读和复制。现在只需要耗时确认那些书是什么。 + +因此,一些图书馆、志愿者和档案管理员们联合起来了解哪些图书没有版权,然后将其数字化并上传到互联网。由于版权续约记录已经数字化,因此很容易判断 1923 年至 1964 年间出版的书籍是否更新了其版权。但是,由于试图提供的是反证,因此寻找缺乏版权更新的难度要大得多。 + +参与者包括纽约公共图书馆(NYPL),它[最近解释了][8]为什么这个耗时的项目是值得的。为了帮助更快地找到更多书籍,NYPL 将许多记录转换为 XML 格式。这样可以更轻松地自动执行查找可以将哪些书籍添加到公共域的过程。 + +### 好莱坞的学院软件基金会获得新成员 + +微软和苹果公司宣布计划以学院软件基金会Academy Software Foundation(ASWF)的高级会员做出贡献。他们将加入[创始董事会成员][9],其它成员还包括 Netflix、Google Cloud、Disney Studios 和 Sony Pictures。 + +学院软件基金会于 2018 年作为[电影艺术与科学学院][10]和[Linux 基金会][11]的联合项目而启动。 + +> 学院软件基金会(ASWF)的使命是提高贡献到内容创作行业的开源软件库的质量和数量;提供一个中立的论坛来协调跨项目的工作;提供通用的构建和测试基础架构;并为个人和组织提供参与推进我们的开源生态系统的明确途径。 + +在第一年内,该基金会构建了 [OpenTimelineIO][12],这是一种开源 API 和交换格式,可帮助工作室团队跨部门协作。OpenTImelineIO 被该[基金会技术咨询委员会][13]去年 7 月正式接受为第五个托管项目。他们现在将它与 [OpenColorIO][14]、[OpenCue][15]、[OpenEXR][16] 和 [OpenVDB] [17] 并列维护。 + +### 其它新闻 + +* [Comcast 将开源网络软件投入生产环境][18] +* [SD Times 本周开源项目:Ballerina][19] +* [美国国防部努力实施开源计划][20] +* [Kong 开源通用服务网格 Kuma][21] +* [Eclipse 推出 Jakarta EE 8][22] + +一如既往地感谢 Opensource.com 的工作人员和主持人本周的帮助。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/news-september-15 + +作者:[Lauren Maffeo][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/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://www.sandboxie.com/DownloadSandboxie +[3]: https://betanews.com/2019/09/13/sandboxie-free-open-source/ +[4]: https://community.sophos.com/products/sandboxie/f/forum/115109/major-sandboxie-news-sandboxie-is-now-a-free-tool-with-plans-to-transition-it-to-an-open-source-tool/414522 +[5]: https://medium.com/@DefenseDigitalService/code-mil-an-open-source-initiative-at-the-pentagon-5ae4986b79bc +[6]: https://www.nextgov.com/analytics-data/2019/09/pentagon-needs-make-more-software-open-source-watchdog-says/159832/ +[7]: https://www.vice.com/en_us/article/a3534j/libraries-and-archivists-are-scanning-and-uploading-books-that-are-secretly-in-the-public-domain +[8]: https://www.nypl.org/blog/2019/09/01/historical-copyright-records-transparency +[9]: https://variety.com/2019/digital/news/microsoft-apple-academy-software-foundation-1203334675/ +[10]: https://www.oscars.org/ +[11]: http://www.linuxfoundation.org/ +[12]: https://github.com/PixarAnimationStudios/OpenTimelineIO +[13]: https://www.linuxfoundation.org/press-release/2019/07/opentimelineio-joins-aswf/ +[14]: https://opencolorio.org/ +[15]: https://www.opencue.io/ +[16]: https://www.openexr.com/ +[17]: https://www.openvdb.org/ +[18]: https://www.fiercetelecom.com/operators/comcast-puts-open-source-networking-software-into-production +[19]: https://sdtimes.com/os/sd-times-open-source-project-of-the-week-ballerina/ +[20]: https://www.fedscoop.com/open-source-software-dod-struggles/ +[21]: https://sdtimes.com/micro/kong-open-sources-universal-service-mesh-kuma/ +[22]: https://devclass.com/2019/09/11/hey-were-open-source-again-eclipse-unveils-jakarta-ee-8/ diff --git a/published/20190916 Linux Plumbers, Appwrite, and more industry trends.md b/published/20190916 Linux Plumbers, Appwrite, and more industry trends.md new file mode 100644 index 0000000000..8ca1e16da6 --- /dev/null +++ b/published/20190916 Linux Plumbers, Appwrite, and more industry trends.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11355-1.html) +[#]: subject: (Linux Plumbers, Appwrite, and more industry trends) +[#]: via: (https://opensource.com/article/19/9/conferences-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + + +每周开源点评:Linux Plumbers、Appwrite +====== + +> 了解每周的开源社区和行业趋势。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +作为采用开源开发模式的企业软件公司的高级产品营销经理,这是我为产品营销人员、经理和其他相关人员发布的有关开源社区、市场和行业趋势的定期更新。以下是本次更新中我最喜欢的五篇文章。 + +### 《在 Linux Plumbers 会议上解决 Linux 具体细节》 + +- [文章地址][2] + +> Linux 的创建者 Linus Torvalds 告诉我,内核维护者峰会Kernel Maintainers Summit是顶级 Linux 内核开发人员的邀请制聚会。但是,虽然你可能认为这是关于规划 Linux 内核的未来的会议,但事实并非如此。“这个维护者峰会真的与众不同,因为它甚至不谈论技术问题。”相反,“全都谈的是关于创建和维护 Linux 内核的过程。” + +**影响**:这就像技术版的 Bilderberg 会议:你们举办的都是各种华丽的流行语会议,而在这里我们做出的才是真正的决定。不过我觉得,可能不太会涉及到私人飞机吧。(LCTT 译注:有关 Bilderberg 请自行搜索) + +### 《微软主办第一个 WSL 会议》 + +- [文章地址][3] + +> [Whitewater Foundry][4] 是一家专注于 [Windows 的 Linux 子系统(WSL)][5]的创业公司,它的创始人 Hayden Barnes [宣布举办 WSLconf 1][6],这是 WSL 的第一次社区会议。该活动将于 2020 年 3 月 10 日至 11 日在华盛顿州雷德蒙市的微软总部 20 号楼举行。会议是合办的。我们已经知道将有来自[Pengwin(Whitewater 的 Linux for Windows)][7]、微软 WSL 和 Canonical 的 Ubuntu on WSL 开发人员的演讲和研讨会。 + +**影响**:微软正在培育社区成长的种子,围绕它越来越多地采用开源软件并作出贡献。这足以让我眼前一亮。 + +### 《Appwrite 简介:面向移动和 Web 开发人员的开源后端服务器》 + +- [文章链接][10] + +> [Appwrite][11] 是一个新的[开源软件][12],用于前端和移动开发人员的端到端的后端服务器,可以让你更快地构建应用程序。[Appwrite][13] 的目标是抽象和简化 REST API 和工具背后的常见开发任务,以帮助开发人员更快地构建高级应用程序。 +> +> 在这篇文章中,我将简要介绍一些主要的 [Appwrite][14] 服务,并解释它们的主要功能以及它们的设计方式,相比从头开始编写所有后端 API,这可以帮助你更快地构建下一个项目。 + +**影响**:随着更多开源中间件变得更易于使用,软件开发越来越容易。Appwrite 声称可将开发时间和成本降低 70%。想象一下这对小型移动开发机构或个人开发者意味着什么。我很好奇他们将如何通过这种方式赚钱。 + +### 《“不只是 IT”:开源技术专家说协作文化是政府转型的关键》 + +- [文章链接][15] + +> AGL(敏捷的政府领导agile government leadership)正在为那些帮助政府更好地为公众工作的人们提供价值支持网络。该组织专注于我非常热衷的事情:DevOps、数字化转型、开源以及许多政府 IT 领导者首选的类似主题。AGL 为我提供了一个社区,可以了解当今最优秀和最聪明的人所做的事情,并与整个行业的同行分享这些知识。 + +**影响**:不管你的政治信仰如何,对政府都很容易愤世嫉俗。我发现令人耳目一新的是,政府也是由一个个实际的人组成的,他们大多在尽力将相关技术应用于公益事业。特别是当该技术是开源的! + +### 《彭博社如何通过 Kubernetes 实现接近 90-95% 的硬件利用率》 + +- [文章链接][16] + +> 2016 年,彭博社采用了 Kubernetes(当时仍处于 alpha 阶段中),自使用该项目的上游代码以来,取得了显著成果。Rybka 说:“借助 Kubernetes,我们能够非常高效地使用我们的硬件,使利用率接近 90% 到 95%。”Kubernetes 中的自动缩放使系统能够更快地满足需求。此外,Kubernetes “为我们提供了标准化我们构建和管理服务的方法的能力,这意味着我们可以花费更多时间专注于实际使用我们支持的开源工具,”数据和分析基础架构主管 Steven Bower 说,“如果我们想要在世界的另一个位置建立一个新的集群,那么这样做真的非常简单。一切都只是代码。配置就是代码。” + +**影响**:没有什么能像利用率统计那样穿过营销的迷雾。我听说过关于 Kube 的一件事是,当人们运行它时,他们不知道用它做什么。像这样的用例可以给他们(和你)一些想要的东西。 + +*我希望你喜欢这个上周重要内容的清单,请下周回来了解有关开源社区、市场和行业趋势的更多信息。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/conferences-industry-trends + +作者:[Tim Hildred][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/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/working-on-linuxs-nuts-and-bolts-at-linux-plumbers/ +[3]: https://www.zdnet.com/article/microsoft-hosts-first-windows-subsystem-for-linux-conference/ +[4]: https://github.com/WhitewaterFoundry +[5]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[6]: https://www.linkedin.com/feed/update/urn:li:activity:6574754435518599168/ +[7]: https://www.zdnet.com/article/pengwin-a-linux-specifically-for-windows-subsystem-for-linux/ +[8]: https://canonical.com/ +[9]: https://ubuntu.com/ +[10]: https://medium.com/@eldadfux/introducing-appwrite-an-open-source-backend-server-for-mobile-web-developers-4be70731575d +[11]: https://appwrite.io +[12]: https://github.com/appwrite/appwrite +[13]: https://medium.com/@eldadfux/introducing-appwrite-an-open-source-backend-server-for-mobile-web-developers-4be70731575d?source=friends_link&sk=b6a2be384aafd1fa5b1b6ff12906082c +[14]: https://appwrite.io/ +[15]: https://medium.com/agile-government-leadership/more-than-just-it-open-source-technologist-says-collaborative-culture-is-key-to-government-c46d1489f822 +[16]: https://www.cncf.io/blog/2019/09/12/how-bloomberg-achieves-close-to-90-95-hardware-utilization-with-kubernetes/ diff --git a/published/20190917 How to Check Linux Mint Version Number - Codename.md b/published/20190917 How to Check Linux Mint Version Number - Codename.md new file mode 100644 index 0000000000..5f102dfa89 --- /dev/null +++ b/published/20190917 How to Check Linux Mint Version Number - Codename.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11360-1.html) +[#]: subject: (How to Check Linux Mint Version Number & Codename) +[#]: via: (https://itsfoss.com/check-linux-mint-version/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何查看 Linux Mint 版本号和代号 +====== + +Linux Mint 每两年发布一次主版本(如 Mint 19),每六个月左右发布一次次版本(如 Mint 19.1、19.2 等)。 你可以自己升级 Linux Mint 版本,而次版本也会自动更新。 + +在所有这些版本中,你可能想知道你正在使用的是哪个版本。了解 Linux Mint 版本号可以帮助你确定某个特定软件是否适用于你的系统,或者检查你的系统是否已达到使用寿命。 + +你可能需要 Linux Mint 版本号有多种原因,你也有多种方法可以获取此信息。让我向你展示用图形和命令行的方式获取 Mint 版本信息。 + +* [使用命令行查看 Linux Mint 版本信息][1] +* [使用 GUI(图形用户界面)查看 Linux Mint 版本信息][2] + +### 使用终端查看 Linux Mint 版本号的方法 + +![][3] + +我将介绍几种使用非常简单的命令查看 Linux Mint 版本号和代号的方法。 你可以从 “菜单” 中打开终端,或按 `CTRL+ALT+T`(默认热键)打开。 + +本文中的最后两个命令还会输出你当前的 Linux Mint 版本所基于的 Ubuntu 版本。 + +#### 1、/etc/issue + +从最简单的 CLI 方法开始,你可以打印出 `/etc/issue` 的内容来检查你的版本号和代号: + +``` +[email protected]:~$ cat /etc/issue +Linux Mint 19.2 Tina \n \l +``` + +#### 2、hostnamectl + +![hostnamectl][4] + +这一个命令(`hostnamectl`)打印的信息几乎与“系统信息”中的信息相同。 你可以看到你的操作系统(带有版本号)以及你的内核版本。 + +#### 3、lsb_release + +`lsb_release` 是一个非常简单的 Linux 实用程序,用于查看有关你的发行版本的基本信息: + +``` +[email protected]:~$ lsb_release -a +No LSB modules are available. +Distributor ID: LinuxMint +Description: Linux Mint 19.2 Tina +Release: 19.2 +Codename: tina +``` + +**注:** 我使用 `–a` 标签打印所有参数, 但你也可以使用 `-s` 作为简写格式,`-d` 用于描述等 (用 `man lsb_release` 查看所有选项) + +#### 4、/etc/linuxmint/info + +![/etc/linuxmint/info][5] + +这不是命令,而是 Linux Mint 系统上的文件。只需使用 `cat` 命令将其内容打印到终端,然后查看你的版本号和代号。 + +#### 5、使用 /etc/os-release 命令也可以获取到 Ubuntu 代号 + +![/etc/os-release][7] + +Linux Mint 基于 Ubuntu。每个 Linux Mint 版本都基于不同的 Ubuntu 版本。了解你的 Linux Mint 版本所基于的 Ubuntu 版本有助你在必须要使用 Ubuntu 版本号的情况下使用(比如你需要在 [Linux Mint 中安装最新的 Virtual Box][8]添加仓库时)。 + +`os-release` 则是另一个类似于 `info` 的文件,向你展示 Linux Mint 所基于的 Ubuntu 版本代号。 + +#### 6、使用 /etc/upstream-release/lsb-release 只获取 Ubuntu 的基本信息 + +如果你只想要查看有关 Ubuntu 的基本信息,请输出 `/etc/upstream-release/lsb-release`: + +``` +[email protected]:~$ cat /etc/upstream-release/lsb-release +DISTRIB_ID=Ubuntu +DISTRIB_RELEASE=18.04 +DISTRIB_CODENAME=bionic +DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS" +``` + +特别提示:[你可以使用 uname 命令查看 Linux 内核版本][9]。 + +``` +[email protected]:~$ uname -r +4.15.0-54-generic +``` + +**注:** `-r` 代表 release,你可以使用 `man uname` 查看其他信息。 + +### 使用 GUI 查看 Linux Mint 版本信息 + +如果你对终端和命令行不满意,可以使用图形方法。如你所料,这个非常明了。 + +打开“菜单” (左下角),然后转到“偏好设置 > 系统信息”: + +![Linux Mint 菜单][10] + +或者,在菜单中,你可以搜索“System Info”: + +![Menu Search System Info][11] + +在这里,你可以看到你的操作系统(包括版本号),内核和桌面环境的版本号: + +![System Info][12] + +### 总结 + +我已经介绍了一些不同的方法,用这些方法你可以快速查看你正在使用的 Linux Mint 的版本和代号(以及所基于的 Ubuntu 版本和内核)。我希望这个初学者教程对你有所帮助。请在评论中告诉我们你最喜欢哪个方法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-linux-mint-version/ + +作者:[Sergiu][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://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: tmp.pL5Hg3N6Qt#terminal +[2]: tmp.pL5Hg3N6Qt#GUI +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/check-linux-mint-version.png?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/hostnamectl.jpg?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/linuxmint_info.jpg?ssl=1 +[6]: https://itsfoss.com/rid-google-chrome-icons-dock-elementary-os-freya/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/os_release.jpg?ssl=1 +[8]: https://itsfoss.com/install-virtualbox-ubuntu/ +[9]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux_mint_menu.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/menu_search_system_info.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/system_info.png?ssl=1 diff --git a/published/20190918 Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President.md b/published/20190918 Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President.md new file mode 100644 index 0000000000..e8a658cebc --- /dev/null +++ b/published/20190918 Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (name1e5s) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11358-1.html) +[#]: subject: (Amid Epstein Controversy, Richard Stallman is Forced to Resign as FSF President) +[#]: via: (https://itsfoss.com/richard-stallman-controversy/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Richard Stallman 被迫辞去 FSF 主席的职务 +====== + +> Richard Stallman,自由软件基金会的创建者以及主席,已经辞去主席及董事会职务。此前,因为 Stallman 对于爱泼斯坦事件中的受害者的观点,一小撮活动家以及媒体人发起了清除 Stallman 的运动。这份声明就是在这些活动后发生的。阅读全文以获得更多信息。 + +![][1] + +### Stallman 事件的背景概述 + +如果你不知道这次事件发生的前因后果,请看本段的详细信息。 + +[Richard Stallman][2],66岁,是就职于 [MIT][3] 的计算机科学家。他最著名的成就就是在 1983 年发起了[自由软件运动][4]。他也开发了 GNU 项目旗下的部分软件,比如 GCC 和 Emacs。受自由软件运动影响选择使用 GPL 开源协议的项目不计其数。Linux 是其中最出名的项目之一。 + +[Jeffrey Epstein][5](爱泼斯坦),美国亿万富翁,金融大佬。其涉嫌为社会上流精英提供性交易服务(其中有未成年少女)而被指控成为性犯罪者。在受审期间,爱泼斯坦在监狱中自杀身亡。 + +[Marvin Lee Minsky][6],MIT 知名计算机科学家。他在 MIT 建立了人工智能实验室。2016 年,88 岁的 Minsky 逝世。在 Minsky 逝世后,一位名为 Misky 的爱泼斯坦事件受害者声称其在未成年时曾被“诱导”到爱泼斯坦的私人岛屿,与之发生性关系。 + +但是这些与 Richard Stallman 有什么关系?这要从 Stallman 发给 MIT 计算机科学与人工智能实验室(CSAIL)的学生以及附属机构就爱泼斯坦的捐款提出抗议的邮件列表的邮件说起。邮件全文翻译如下: + +> 周五事件的公告对 Marvin Minsky 来说是不公正的。 +> +> “已故的人工智能 ‘先锋’ Marvin Minsky (被控告侵害了爱泼斯坦事件的受害者之一\[2])” +> +> 不公正之处在于 “侵害assulting” 这个用语。“性侵犯sexual assault” 这个用语非常的糢糊,夸大了指控的严重性:宣称某人做了 X 但误导别人,让别人觉得这个人做了 Y,Y 远远比 X 严重。 +> +> 上面引用的指控显然就是夸大。报导声称 Minksy 与爱泼斯坦的女眷harem之一发生了性关系(详见 )。我们假设这是真的(我找不到理由不相信)。 +> +> “侵害assulting” 这个词,意味着他使用了某种暴力。但那篇报道并没有提到这个,只说了他们发生了性关系。 +> +> 我们可以想像很多种情况,但最合理的情况是,她在 Marvin 面前表现的像是完全自愿的。假设她是被爱泼斯坦强迫的,那爱泼斯坦有充足的理由让她对大多数人守口如瓶。 +> +> 从各种的指控夸大事例中,我总结出,在指控时使用“性侵犯sexual assault”是绝对错误的。 +> +> 无论你想要批判什么行为,你都应该使用特定的词汇来描述,以此避免批判的本质的道德模糊性。 + +### “清除 Stallman” 的呼吁 + +‘爱泼斯坦’在美国是颇具争议的‘话题’。Stallman 对该敏感事件做出如此鲁莽的 “知识陈述” 不会有好结果,事实也是如此。 + +一位机器人学工程师从她的朋友那里收到了转发的邮件并发起了一个[清除 Stallman 的活动][7]。她要的不是澄清或者道歉,她只想要清除斯托曼,就算这意味着 “将 MIT 夷为平地” 也在所不惜。 + +> 是,至少 Stallman 没有被控强奸任何人。但这就是我们的最高标准吗?这所声望极高的学院坚持的标准就是这样的吗?如果这是麻省理工学院想要捍卫的、想要代表的标准的话,还不如把这破学校夷为平地… +> +> 如果有必要的话,就把所有人都清除出去,之后从废墟中建立出更好的秩序。 +> +> —— Salem,发起“清除 Stallman“运动的机器人学专业学生 + +Salem 的声讨最初没有被主流媒体重视。但它还是被反对软件行业内的精英崇拜以及性别偏见的积极分子发现了。 + +> [#epstein][8] [#MIT][9] 嗨 记者没有回复我我很生气就自己写了这么个故事。作为 MIT 的校友我还真是高兴啊🙃 +> +> — SZJG (@selamjie) [September 12, 2019][10] + +. + +> 是不是对于性侵儿童的 “杰出混蛋” 我们也可以辩护说 “万一这是你情我愿的” +> +> — Tracy Chou 👩🏻‍💻 (@triketora) [September 13, 2019][11] + +. + +> 多年来我就一直发推说 Richard "RMS" Stallman 这人有多恶心 —— 恋童癖、厌女症、还残障歧视 +> +> 不可避免的是,每次我这样做,都会有老哥检查我的数据来源,然后说 “这都是几年前的事了!他现在变了!” +> +> 变个屁。 +> +> — Sarah Mei (@sarahmei) [September 12, 2019][12] + +下面是 Sage Sharp 开头的一篇关于 Stallman 的行为如何对科技人员产生负面影响的帖子: + +> 👇大家说下 Richard Stallman 对科技从业者的影响吧,尤其是女性。 [例如: 强奸、乱伦、残障歧视、性交易] +> +> [@fsf][13] 有必要永久禁止 Richard Stallman 担任自由软件基金会董事会主席。 +> +> — Sage Sharp (@\_sagesharp\_) [September 16, 2019][14] + +Stallman 一直以来也不是一个圣人。他粗暴,不合时宜、多年来一直在开带有性别歧视的笑话。你可以在[这里][15]和[这里][16]读到。 + +很快这个消息就被 [The Vice][17]、[每日野兽][18],[未来主义][19]等大媒体采访。他们把 Stallman 描绘成爱泼斯坦的捍卫者。在强烈的抗议声中,[GNOME 执行董事威胁要结束 GNOME 和 FSF 之间的关系][20]。 + +最后,Stallman 先是从 MIT 辞职,现在又从 [自由软件基金会][21] 辞职。 + +![][22] + +### 危险的特权? + +我们见识到了,把一个人从他创建并为之工作了三十多年的组织中驱逐出去仅仅需要五天。这甚至还是在 Stallman 没有参与性交易丑闻的情况下。 + +其中一些 “活动家” 过去也曾[针对过 Linux 的作者 Linus Torvalds][23]。Linux 基金会背后的管理层预见到了科技行业激进主义的增长趋势,因此他们制定了[适用于 Linux 内核开发的行为准则][24]并[强制 Torvalds 接受培训以改善他的行为][25]。如果他们没有采取纠正措施,可能 Torvalds 也已经被批倒批臭了。 + +忽视技术支持者的鲁莽行为和性别歧视是不可接受的,但是对于那些遇到不同意某种流行观点的人就进行声讨,施以私刑也是不道德的做法。我不支持 Stallman 和他过去的言论,但我也不能接受他以这种方式(被迫?)辞职。 + +Techrights 对此有一些有趣的评论,你可以在[这里][26]和[这里][27]看到。 + +*你对此事有何看法?请文明分享你的观点和意见。过激评论将不会公布。* + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/richard-stallman-controversy/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[name1e5s](https://github.com/name1e5s) +校对:[wxy](https://github.com/wxy) + +本文由 [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/09/stallman-conroversy.png?w=800&ssl=1 +[2]: https://en.wikipedia.org/wiki/Richard_Stallman +[3]: https://en.wikipedia.org/wiki/Massachusetts_Institute_of_Technology +[4]: https://en.wikipedia.org/wiki/Free_software_movement +[5]: https://en.wikipedia.org/wiki/Jeffrey_Epstein +[6]: https://en.wikipedia.org/wiki/Marvin_Minsky +[7]: https://medium.com/@selamie/remove-richard-stallman-fec6ec210794 +[8]: https://twitter.com/hashtag/epstein?src=hash&ref_src=twsrc%5Etfw +[9]: https://twitter.com/hashtag/MIT?src=hash&ref_src=twsrc%5Etfw +[10]: https://twitter.com/selamjie/status/1172244207978897408?ref_src=twsrc%5Etfw +[11]: https://twitter.com/triketora/status/1172443389536555009?ref_src=twsrc%5Etfw +[12]: https://twitter.com/sarahmei/status/1172283772428906496?ref_src=twsrc%5Etfw +[13]: https://twitter.com/fsf?ref_src=twsrc%5Etfw +[14]: https://twitter.com/_sagesharp_/status/1173637138413318144?ref_src=twsrc%5Etfw +[15]: https://geekfeminism.wikia.org/wiki/Richard_Stallman +[16]: https://medium.com/@selamie/remove-richard-stallman-appendix-a-a7e41e784f88 +[17]: https://www.vice.com/en_us/article/9ke3ke/famed-computer-scientist-richard-stallman-described-epstein-victims-as-entirely-willing +[18]: https://www.thedailybeast.com/famed-mit-computer-scientist-richard-stallman-defends-epstein-victims-were-entirely-willing +[19]: https://futurism.com/richard-stallman-epstein-scandal +[20]: https://blog.halon.org.uk/2019/09/gnome-foundation-relationship-gnu-fsf/ +[21]: https://www.fsf.org/news/richard-m-stallman-resigns +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/richard-stallman.png?resize=800%2C94&ssl=1 +[23]: https://www.newyorker.com/science/elements/after-years-of-abusive-e-mails-the-creator-of-linux-steps-aside +[24]: https://itsfoss.com/linux-code-of-conduct/ +[25]: https://itsfoss.com/torvalds-takes-a-break-from-linux/ +[26]: http://techrights.org/2019/09/15/media-attention-has-been-shifted/ +[27]: http://techrights.org/2019/09/16/stallman-removed/ diff --git a/published/20190918 Oracle Unleashes World-s Fastest Database Machine ‘Exadata X8M.md b/published/20190918 Oracle Unleashes World-s Fastest Database Machine ‘Exadata X8M.md new file mode 100644 index 0000000000..8721fea8c8 --- /dev/null +++ b/published/20190918 Oracle Unleashes World-s Fastest Database Machine ‘Exadata X8M.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11366-1.html) +[#]: subject: (Oracle Unleashes World’s Fastest Database Machine ‘Exadata X8M’) +[#]: via: (https://opensourceforu.com/2019/09/oracle-unleashes-worlds-fastest-database-machine-exadata-x8m/) +[#]: author: (Longjam Dineshwori https://opensourceforu.com/author/dineshwori-longjam/) + +Oracle 发布全球最快的数据库机器 Exadata X8M +====== + +> Exadata X8M 是第一台具有集成持久内存和 RoCE 的数据库机器。Oracle 还宣布推出 Oracle 零数据丢失恢复设备 X8M(ZDLRA)。 + +![](https://img.linux.net.cn/data/attachment/album/201909/20/191530qiyvvxl8qqcov8xq.jpg) + +Oracle 发布了新的 Exadata 数据库机器 X8M,旨在为数据库基础架构市场树立新的标杆。 + +Exadata X8M 结合了英特尔 Optane DC 持久存储器和通过融合以太网(RoCE)的 100 千兆的远程直接内存访问(RDMA)来消除存储瓶颈,并显著提高性能,其适用于最苛刻的工作负载,如在线事务处理(OLTP)、分析、物联网、欺诈检测和高频交易。 + +“借助 Exadata X8M,我们可以提供内存级的性能,同时为 OLTP 和分析提供共享存储的所有优势,”Oracle 任务关键型数据库技术执行副总裁 Juan Loaiza 说。 + +“使用对共享持久存储器的直接数据库访问将响应时间减少一个数量级,可加速每个 OLTP 应用程序,它是需要实时访问大量数据的应用程序的游戏规则改变者,例如欺诈检测和个性化购物,”官方补充。 + +### 它有什么独特之处? + +Oracle Exadata X8M 使用 RDMA 让数据库直接访问智能存储服务器中的持久内存,从而绕过整个操作系统、IO 和网络软件堆栈。这导致更低的延迟和更高的吞吐量。使用 RDMA 绕过软件堆栈还可以释放存储服务器上的 CPU 资源,以执行更多智能扫描查询来支持分析工作负载。 + +### 更少的存储瓶颈 + +“高性能 OLTP 应用需要高的每秒输入/输出操作(IOPS)和低延迟。直接数据库访问共享持久性内存可将SQL 读取的峰值性能提升至 1600 万 IOPS,比行业领先的 Exadata X8 高出 2.5 倍,“Oracle 在一份声明中表示。 + +此外,Exadata X8M 通过使远程 IO 延迟低于 19 微秒,大大减少了关键数据库 IO 的延迟 —— 这比 Exadata X8 快 10 倍以上。即使对于每秒需要数百万 IO 的工作负载,也可实现这些超低延迟。 + +### 比 AWS 和 Azure 更高效 + +该公司声称,与 Oracle 最快的 Amazon RDS 存储相比,Exadata X8M 的延迟降低了 50 倍,IOPS 提高了 200 倍,容量提高了 15 倍。 + +与 Azure SQL 数据库服务存储相比,Exadata X8M 的延迟降低了 100 倍,IOPS 提高了 150 倍,容量提高了 300 倍。 + +据 Oracle 称,单机架 Exadata X8M 可提供高达 2 倍的 OLTP 读取 IOPS,3 倍的吞吐量和比具有持久性内存的共享存储系统(如 Dell EMC PowerMax 8000 的单机架)低 5 倍的延迟。 + +“通过同时支持更快的 OLTP 查询和更高的分析工作负载吞吐量,Exadata X8M 是融合混合工作负载环境以降低 IT 成本和复杂性的理想平台,”该公司说。 + +### Oracle 零数据丢失恢复设备 X8 + +Oracle 当天还宣布推出 Oracle 零数据丢失恢复设备 X8M(ZDLRA),它使用新的 100Gb RoCE,用于计算和存储服务器之间的高吞吐量内部数据传输。 + +Exadata 和 ZDLRA 客户现在可以在 RoCE 或基于 InfiniBand 的工程系统之间进行选择,以在其架构部署中实现最佳灵活性。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/oracle-unleashes-worlds-fastest-database-machine-exadata-x8m/ + +作者:[Longjam Dineshwori][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://opensourceforu.com/author/dineshwori-longjam/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/02/Oracle-Cloud.jpg?resize=350%2C212&ssl=1 diff --git a/published/20190921 Oracle Autonomous Linux- A Self Updating, Self Patching Linux Distribution for Cloud Computing.md b/published/20190921 Oracle Autonomous Linux- A Self Updating, Self Patching Linux Distribution for Cloud Computing.md new file mode 100644 index 0000000000..5390aee222 --- /dev/null +++ b/published/20190921 Oracle Autonomous Linux- A Self Updating, Self Patching Linux Distribution for Cloud Computing.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11370-1.html) +[#]: subject: (Oracle Autonomous Linux: A Self Updating, Self Patching Linux Distribution for Cloud Computing) +[#]: via: (https://itsfoss.com/oracle-autonomous-linux/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Oracle Autonomous Linux:用于云计算的自我更新、自我修补的 Linux 发行版 +====== + +自动化是 IT 行业的增长趋势,其目的是消除重复任务中的手动干扰。Oracle 通过推出 Oracle Autonomous Linux 向自动化世界迈出了又一步,这无疑将使 IoT 和云计算行业受益。 + +### Oracle Autonomous Linux:减少人工干扰,增多自动化 + +![][1] + +周一,Oracle 联合创始人拉里·埃里森Larry Ellison参加了在旧金山举行的Oracle OpenWorld 全球大会。[他宣布了][2]一个新产品:世界上第一个自治 Linux。这是 Oracle 向第二代云迈进的第二步。第一步是两年前发布的 [Autonomous Database][3]。 + +Oracle Autonomous Linux 的最大特性是降低了维护成本。根据 [Oracle 网站][4] 所述,Autonomous Linux “使用先进的机器学习和自治功能来提供前所未有的成本节省、安全性和可用性,并释放关键的 IT 资源来应对更多的战略计划”。 + +Autonomous Linux 可以无需人工干预就安装更新和补丁。这些自动更新包括 “Linux 内核和关键用户空间库”的补丁。“不需要停机,而且可以免受外部攻击和内部恶意用户的攻击。”它们也可以在系统运行时进行,以减少停机时间。Autonomous Linux 还会自动处理伸缩,以确保满足所有计算需求。 + +埃里森强调了新的自治系统将如何提高安全性。他特别提到了 [Capitol One 数据泄露][5]是由于配置错误而发生的。他说:“一个防止数据被盗的简单规则:将数据放入自治系统。没有人为错误,没有数据丢失。 那是我们与 AWS 之间的最大区别。” + +有趣的是,Oracle 还瞄准了这一新产品以与 IBM 竞争。埃里森说:“如果你付钱给 IBM,可以停了。”所有 Red Hat 应用程序都应该能够在 Autonomous Linux 上运行而无需修改。有趣的是,Oracle Linux 是从 Red Hat Enterprise Linux 的源代码中[构建][6]的。 + +看起来,Oracle Autonomous Linux 不会用于企业市场以外。 + +### 关于 Oracle Autonomous Linux 的思考 + +Oracle 是云服务市场的重要参与者。这种新的 Linux 产品将使其能够与 IBM 竞争。让人感兴趣的是 IBM 的反应会是如何,特别是当他们有来自 Red Hat 的新一批开源智能软件。 + +如果你看一下市场数字,那么对于 IBM 或 Oracle 来说情况都不好。大多数云业务由 [Amazon Web Services、Microsoft Azure 和 Google Cloud Platform][7] 所占据。IBM 和 Oracle 落后于他们。[IBM 收购 Red Hat][8] 试图获得发展。这项新的自主云计划是 Oracle 争取统治地位(或至少试图获得更大的市场份额)的举动。让人感兴趣的是,到底有多少公司因为购买了 Oracle 的系统而在互联网的狂野西部变得更加安全? + +我必须简单提一下:当我第一次阅读该公告时,我的第一反应就是“好吧,我们离天网更近了一步。”如果我们技术性地考虑一下,我们就像是要进入了机器人末日。如果你打算帮我,我计划去购买一些罐头食品。 + +你对 Oracle 的新产品感兴趣吗?你会帮助他们赢得云战争吗?在下面的评论中让我们知道。 + +如果你觉得这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][9] 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/oracle-autonomous-linux/ + +作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/oracle-autonomous-linux.png?resize=800%2C450&ssl=1 +[2]: https://www.zdnet.com/article/oracle-announces-oracle-autonomous-linux/ +[3]: https://www.oracle.com/in/database/what-is-autonomous-database.html +[4]: https://www.oracle.com/corporate/pressrelease/oow19-oracle-autonomous-linux-091619.html +[5]: https://www.zdnet.com/article/100-million-americans-and-6-million-canadians-caught-up-in-capital-one-breach/ +[6]: https://distrowatch.com/table.php?distribution=oracle +[7]: https://www.zdnet.com/article/top-cloud-providers-2019-aws-microsoft-azure-google-cloud-ibm-makes-hybrid-move-salesforce-dominates-saas/ +[8]: https://itsfoss.com/ibm-red-hat-acquisition/ +[9]: https://reddit.com/r/linuxusersgroup diff --git a/sources/news/20190619 Codethink open sources part of onboarding process.md b/sources/news/20190619 Codethink open sources part of onboarding process.md deleted file mode 100644 index 537ded948b..0000000000 --- a/sources/news/20190619 Codethink open sources part of onboarding process.md +++ /dev/null @@ -1,42 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Codethink open sources part of onboarding process) -[#]: via: (https://opensource.com/article/19/6/codethink-onboarding-process) -[#]: author: (Laurence Urhegyi https://opensource.com/users/laurence-urhegyi) - -Codethink open sources part of onboarding process -====== -In other words, how to Git going in FOSS. -![Teacher or learner?][1] - -Here at [Codethink][2], we’ve recently focused our energy into enhancing the onboarding process we use for all new starters at the company. As we grow steadily in size, it’s important that we have a well-defined approach to both welcoming new employees into the company, and introducing them to the organization’s culture. - -As part of this overall onboarding effort, we’ve created [_How to Git going in FOSS_][3]: an introductory guide to the world of free and open source software (FOSS), and some of the common technologies, practices, and principles associated with free and open source software. - -This guide was initially aimed at work experience students and summer interns. However, the document is in fact equally applicable to anyone who is new to free and open source software, no matter their prior experience in software or IT in general. _How to Git going in FOSS_ is hosted on GitLab and consists of several repositories, each designed to be a self-guided walk through. - -Our guide begins with a general introduction to FOSS, including explanations of the history of GNU/Linux, how to use [Git][4] (as well as Git hosting services such as GitLab), and how to use a text editor. The document then moves on to exercises that show the reader how to implement some of the things they’ve just learned. - -_How to Git going in FOSS_ is fully public and available for anyone to try. If you’re new to FOSS or know someone who is, then please have a read-through, and see what you think. If you have any feedback, feel free to raise an issue on GitLab. And, of course, we also welcome contributions. We’re keen to keep improving the guide however possible. One future improvement we plan to make is an additional exercise that is more complex than the existing two, such as potentially introducing the reader to [Continuous Integration][5]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/codethink-onboarding-process - -作者:[Laurence Urhegyi][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/laurence-urhegyi -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?) -[2]: https://www.codethink.co.uk/about.html -[3]: https://gitlab.com/ct-starter-guide -[4]: https://git-scm.com -[5]: https://en.wikipedia.org/wiki/Continuous_integration diff --git a/sources/news/20190622 Cloudflare-s random number generator, robotics data visualization, npm token scanning, and more news.md b/sources/news/20190622 Cloudflare-s random number generator, robotics data visualization, npm token scanning, and more news.md deleted file mode 100644 index af595d310b..0000000000 --- a/sources/news/20190622 Cloudflare-s random number generator, robotics data visualization, npm token scanning, and more news.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cloudflare's random number generator, robotics data visualization, npm token scanning, and more news) -[#]: via: (https://opensource.com/article/19/6/news-june-22) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Cloudflare's random number generator, robotics data visualization, npm token scanning, and more 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 Cloudflare's open source random number generator, more open source robotics data, new npm functionality, and more! - -### Cloudflare announces open source random number generator project - -Is there such a thing as a truly random number? Internet security and services provider Cloudflare things so. To prove it, the company has formed [The League of Entropy][2], an open source project to create a generator for random numbers. - -The League consists of Cloudflare and "five other organisations — predominantly universities and security companies." They share random numbers, using an open source tool called [Drand][3] (short for Distributed Randomness Beacon Daemon). The numbers are then "composited into one random number" on the basis that "several random numbers are more random than one random number." While the League's random number generator isn't intended "for any kind of password or cryptographic seed generation," Cloudflare's CEO Matthew Prince points out that if "you need a way of having a known random source, this is a really valuable tool." - -### Cruise open sources robotics data analysis tool - -Projects involved in creating self-driving vehicles generate petabytes of data. And with amounts of data that large comes the challenge of quickly and effectively analyzing it. To make the task easier, General Motors subsidiary Cruise has made its Webviz data visualization tool "[freely available to developers][4] in need of a modular robotics analysis solution." - -Webviz "takes as input any bag file (the message format used by the popular Robot Operating System) and outputs charts and graphs." It "contains a collection of general panels (which visualize data) applicable to most robotics developers," said Esther Weon, a software engineer at Cruise. The company also plans to "release a public API that’ll allow developers to build custom panels themselves." - -The code for Webviz is [available on GitHub][5], where you can download or contribute to the project. - -### npm provides more security - -The team behind npm, the site providing JavaScript package hosting, has a new collaboration with GitHub to automatically scan for exposed tokens that could give hackers access that doesn't belong to them. The project includes a handy automatic revoke of leaked credentials them if are still valid. This could drastically reduce vulnerabilities in the JavaScript community. For instructions on how to participate, see the [original article][6]. - -Note that this news was found via the [Changelog news][7]. - -### Better end of life tracking via open source - -A new project, [endoflife.date][8], aims to overcome the complexity of end of life (EOL) announcements for software. It's part tracker, part public announcement on what good documentation looks like for software. As the README states: "The reason this site exists is because this information is very often hidden away. If you're releasing something on a regular basis: - - 1. List only supported releases. - 2. Give EoL dates/policy if possible. - 3. Hide unsupported releases behind a few extra clicks. - 4. Mention security/active release difference if needed." - - - -Check out the [source code][9] for more information. - -### In other news - - * [Medicine needs to embrace open source][10] - * [Using geospatial data to create safer roads][11] - * [Embracing open source could be a big competitive advantage for businesses][12] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/news-june-22 - -作者:[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://thenextweb.com/dd/2019/06/17/cloudflares-new-open-source-project-helps-anyone-obtain-truly-random-numbers/ -[3]: https://github.com/dedis/drand -[4]: https://venturebeat.com/2019/06/18/cruise-open-sources-webview-a-tool-for-robotics-data-analysis/ -[5]: https://github.com/cruise-automation/webviz -[6]: https://blog.npmjs.org/post/185680936500/protecting-package-publishers-npm-token-security -[7]: https://changelog.com/news/npm-token-scanning-extending-to-github-NAoe -[8]: https://endoflife.date/ -[9]: https://github.com/captn3m0/endoflife.date -[10]: https://www.zdnet.com/article/medicine-needs-to-embrace-open-source/ -[11]: https://itbrief.co.nz/story/using-geospatial-data-to-create-safer-roads -[12]: https://www.fastcompany.com/90364152/embracing-open-source-could-be-a-big-competitive-advantage-for-businesses diff --git a/sources/talk/20120911 Doug Bolden, Dunnet (IF).md b/sources/talk/20120911 Doug Bolden, Dunnet (IF).md deleted file mode 100644 index c856dc5be0..0000000000 --- a/sources/talk/20120911 Doug Bolden, Dunnet (IF).md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Doug Bolden, Dunnet (IF)) -[#]: via: (http://www.wyrmis.com/games/if/dunnet.html) -[#]: author: (W Doug Bolden http://www.wyrmis.com) - -Doug Bolden, Dunnet (IF) -====== - -### Dunnet (IF) - -#### Review - -When I began becoming a semi-serious hobbyist of IF last year, I mostly focused on Infocom, Adventures Unlimited, other Scott Adams based games, and freeware titles. I went on to buy some from Malinche. I picked up _1893_ and _Futureboy_ and (most recnetly) _Treasures of a Slave Kingdom_. I downloaded a lot of free games from various sites. With all of my research and playing, I never once read anything that talked about a game being bundled with Emacs. - -Partially, this is because I am a Vim guy. But I used to use Emacs. Kind of a lot. For probably my first couple of years with Linux. About as long as I have been a diehard Vim fan, now. I just never explored, it seems. - -I booted up Emacs tonight, and my fonts were hosed. Still do not know exactly why. I surfed some menus to find out what was going wrong and came across a menu option called "Adventure" under Games, which I assumed (I know, I know) meant the Crowther and Woods and 1977 variety. When I clicked it tonight, thinking that it has been a few months since I chased a bird around with a cage in a mine so I can fight off giant snakes or something, I was brought up text involving ends of roads and shovels. Trees, if shaken, that kill me with a coconut. This was not the game I thought it was. - -I dug around (or, in purely technical terms, typed "help") and got directed to [this website][1]. Well, here was an IF I had never touched before. Brand spanking new to me. I had planned to play out some _ToaSK_ tonight, but figured that could wait. Besides, I was not quite in the mood for the jocular fun of S. John Ross's commerical IF outing. I needed something a little more direct, and this apparently it. - -Most of the game plays out just like the _Colossal Cave Adventure_ cousins of the oldschool (generally commercial) IF days. There are items you pick. Each does a single task (well, there could be one exception to this, I guess). You collect treasures. Winning is a combination of getting to the end and turning in the treasures. The game slightly tweaks the formula by allowing multiple drop off points for the treasures. Since there is a weight limit, though, you usually have to drop them off at a particular time to avoid getting stuck. At several times, your "item cache" is flushed, so to speak, meaning you have to go back and replay earlier portions to find out how to bring things foward. Damage to items can occur to stop you from being able to play. Replaying is pretty much unavoidable, unless you guess outcomes just right. - -It also inherits many problems from the era it came. There is a twisty maze. I'm not sure how big it is. I just cheated and looked up a walkthrough for the maze portion. I plan on going back and replaying up to the maze bit and mapping it out, though. I was just mentally and physically beat when I played and knew that I was going to have to call it quits on the game for the night or cheat through the maze. I'm glad I cheated, because there are some interesting things after the maze. - -It also has the same sort of stilted syntax and variable levels of description that the original _Adventure_ had. Looking at one item might give you "there is nothing special about that" while looking at another might give you a sentence of flavor text. Several things mentioned in the background do not exist to the parser, which some do. Part of game play is putting up with experimenting. This includes, in cases, a tendency of room descriptions to be written from the perspective of the first time you enter. I know that the Classroom found towards the end of the game does not mention the South exit, either. There are possibly other times this occured that I didn't notice. - -It's final issue, again coming out of the era it was designed, is random death syndrome. This is not too common, but there are a few places where things that have no initially apparent fatal outcome lead to one anyhow. In some ways, this "fatal outcome" is just the game reaching an unwinnable state. For an example of the former, type "shake trees" in the first room. For an example of the latter, send either the lamp, the key, or the shovel through the ftp without switching ftp modes first. At least with the former, there is a sense of exploration in finding out new ways to die. In IF, creative deaths is a form of victory in their own right. - -_Dunnet_ has a couple of differences from most IF. The former difference is minor. There are little odd descriptions throughout the game. "This room is red" or "The towel has a picture of Snoopy one it" or "There is a cliff here" that do not seem to have an immediate effect on the game. Sure, you can jump over the cliff (and die, obviously) but but it still comes off as a bright spot in the standard description matrix. Towards the end, you will be forced to bring back these details. It makes a neat little diversion of looking around and exploring things. Most of the details are cute and/or add to the surreality of the game overall. - -The other big difference, and the one that greatly increased both my annoyance with and my enjoyment of the game, revolves around the two-three computer oriented scenes in the game. You have to type commands into two different computers throughout. One is a VAX and the other is, um, something like a PC (I forget). In both cases, there are clues to be found by knowing your way around the interface. This is a game for computer folk, so most who play it will have a sense of how to type "ls" or "dir" depending on the OS. But not all, will. Beating the game requires a general sense of computer literacy. You must know what types are in ftp. You must know how to determine what type a file is. You must know how to read a text file on a DOS style prompt. You must know something about protocols and etiquette for logging into ftp servers. All this sort of thing. If you do, or are willing to learn (I looked up some of the stuff online) then you can get past this portion with no problem. But this can be like the maze to some people, requiring several replays to get things right. - -The end result is a quirky but fun game that I wish I had known about before because now I have the feeling that my computer is hiding other secrets from me. Glad to have played. Will likely play again to see how many ways I can die. - --------------------------------------------------------------------------------- - -via: http://www.wyrmis.com/games/if/dunnet.html - -作者:[W Doug Bolden][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.wyrmis.com -[b]: https://github.com/lujun9972 -[1]: http://www.driver-aces.com/ronnie.html diff --git a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md b/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md deleted file mode 100644 index 7be913c3bf..0000000000 --- a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md +++ /dev/null @@ -1,111 +0,0 @@ -My Lisp Experiences and the Development of GNU Emacs -====== - -> (Transcript of Richard Stallman's Speech, 28 Oct 2002, at the International Lisp Conference). - -Since none of my usual speeches have anything to do with Lisp, none of them were appropriate for today. So I'm going to have to wing it. Since I've done enough things in my career connected with Lisp I should be able to say something interesting. - -My first experience with Lisp was when I read the Lisp 1.5 manual in high school. That's when I had my mind blown by the idea that there could be a computer language like that. The first time I had a chance to do anything with Lisp was when I was a freshman at Harvard and I wrote a Lisp interpreter for the PDP-11. It was a very small machine — it had something like 8k of memory — and I managed to write the interpreter in a thousand instructions. This gave me some room for a little bit of data. That was before I got to see what real software was like, that did real system jobs. - -I began doing work on a real Lisp implementation with JonL White once I started working at MIT. I got hired at the Artificial Intelligence Lab not by JonL, but by Russ Noftsker, which was most ironic considering what was to come — he must have really regretted that day. - -During the 1970s, before my life became politicized by horrible events, I was just going along making one extension after another for various programs, and most of them did not have anything to do with Lisp. But, along the way, I wrote a text editor, Emacs. The interesting idea about Emacs was that it had a programming language, and the user's editing commands would be written in that interpreted programming language, so that you could load new commands into your editor while you were editing. You could edit the programs you were using and then go on editing with them. So, we had a system that was useful for things other than programming, and yet you could program it while you were using it. I don't know if it was the first one of those, but it certainly was the first editor like that. - -This spirit of building up gigantic, complicated programs to use in your own editing, and then exchanging them with other people, fueled the spirit of free-wheeling cooperation that we had at the AI Lab then. The idea was that you could give a copy of any program you had to someone who wanted a copy of it. We shared programs to whomever wanted to use them, they were human knowledge. So even though there was no organized political thought relating the way we shared software to the design of Emacs, I'm convinced that there was a connection between them, an unconscious connection perhaps. I think that it's the nature of the way we lived at the AI Lab that led to Emacs and made it what it was. - -The original Emacs did not have Lisp in it. The lower level language, the non-interpreted language — was PDP-10 Assembler. The interpreter we wrote in that actually wasn't written for Emacs, it was written for TECO. It was our text editor, and was an extremely ugly programming language, as ugly as could possibly be. The reason was that it wasn't designed to be a programming language, it was designed to be an editor and command language. There were commands like ‘5l’, meaning ‘move five lines’, or ‘i’ and then a string and then an ESC to insert that string. You would type a string that was a series of commands, which was called a command string. You would end it with ESC ESC, and it would get executed. - -Well, people wanted to extend this language with programming facilities, so they added some. For instance, one of the first was a looping construct, which was < >. You would put those around things and it would loop. There were other cryptic commands that could be used to conditionally exit the loop. To make Emacs, we (1) added facilities to have subroutines with names. Before that, it was sort of like Basic, and the subroutines could only have single letters as their names. That was hard to program big programs with, so we added code so they could have longer names. Actually, there were some rather sophisticated facilities; I think that Lisp got its unwind-protect facility from TECO. - -We started putting in rather sophisticated facilities, all with the ugliest syntax you could ever think of, and it worked — people were able to write large programs in it anyway. The obvious lesson was that a language like TECO, which wasn't designed to be a programming language, was the wrong way to go. The language that you build your extensions on shouldn't be thought of as a programming language in afterthought; it should be designed as a programming language. In fact, we discovered that the best programming language for that purpose was Lisp. - -It was Bernie Greenberg, who discovered that it was (2). He wrote a version of Emacs in Multics MacLisp, and he wrote his commands in MacLisp in a straightforward fashion. The editor itself was written entirely in Lisp. Multics Emacs proved to be a great success — programming new editing commands was so convenient that even the secretaries in his office started learning how to use it. They used a manual someone had written which showed how to extend Emacs, but didn't say it was a programming. So the secretaries, who believed they couldn't do programming, weren't scared off. They read the manual, discovered they could do useful things and they learned to program. - -So Bernie saw that an application — a program that does something useful for you — which has Lisp inside it and which you could extend by rewriting the Lisp programs, is actually a very good way for people to learn programming. It gives them a chance to write small programs that are useful for them, which in most arenas you can't possibly do. They can get encouragement for their own practical use — at the stage where it's the hardest — where they don't believe they can program, until they get to the point where they are programmers. - -At that point, people began to wonder how they could get something like this on a platform where they didn't have full service Lisp implementation. Multics MacLisp had a compiler as well as an interpreter — it was a full-fledged Lisp system — but people wanted to implement something like that on other systems where they had not already written a Lisp compiler. Well, if you didn't have the Lisp compiler you couldn't write the whole editor in Lisp — it would be too slow, especially redisplay, if it had to run interpreted Lisp. So we developed a hybrid technique. The idea was to write a Lisp interpreter and the lower level parts of the editor together, so that parts of the editor were built-in Lisp facilities. Those would be whatever parts we felt we had to optimize. This was a technique that we had already consciously practiced in the original Emacs, because there were certain fairly high level features which we re-implemented in machine language, making them into TECO primitives. For instance, there was a TECO primitive to fill a paragraph (actually, to do most of the work of filling a paragraph, because some of the less time-consuming parts of the job would be done at the higher level by a TECO program). You could do the whole job by writing a TECO program, but that was too slow, so we optimized it by putting part of it in machine language. We used the same idea here (in the hybrid technique), that most of the editor would be written in Lisp, but certain parts of it that had to run particularly fast would be written at a lower level. - -Therefore, when I wrote my second implementation of Emacs, I followed the same kind of design. The low level language was not machine language anymore, it was C. C was a good, efficient language for portable programs to run in a Unix-like operating system. There was a Lisp interpreter, but I implemented facilities for special purpose editing jobs directly in C — manipulating editor buffers, inserting leading text, reading and writing files, redisplaying the buffer on the screen, managing editor windows. - -Now, this was not the first Emacs that was written in C and ran on Unix. The first was written by James Gosling, and was referred to as GosMacs. A strange thing happened with him. In the beginning, he seemed to be influenced by the same spirit of sharing and cooperation of the original Emacs. I first released the original Emacs to people at MIT. Someone wanted to port it to run on Twenex — it originally only ran on the Incompatible Timesharing System we used at MIT. They ported it to Twenex, which meant that there were a few hundred installations around the world that could potentially use it. We started distributing it to them, with the rule that “you had to send back all of your improvements” so we could all benefit. No one ever tried to enforce that, but as far as I know people did cooperate. - -Gosling did, at first, seem to participate in this spirit. He wrote in a manual that he called the program Emacs hoping that others in the community would improve it until it was worthy of that name. That's the right approach to take towards a community — to ask them to join in and make the program better. But after that he seemed to change the spirit, and sold it to a company. - -At that time I was working on the GNU system (a free software Unix-like operating system that many people erroneously call “Linux”). There was no free software Emacs editor that ran on Unix. I did, however, have a friend who had participated in developing Gosling's Emacs. Gosling had given him, by email, permission to distribute his own version. He proposed to me that I use that version. Then I discovered that Gosling's Emacs did not have a real Lisp. It had a programming language that was known as ‘mocklisp’, which looks syntactically like Lisp, but didn't have the data structures of Lisp. So programs were not data, and vital elements of Lisp were missing. Its data structures were strings, numbers and a few other specialized things. - -I concluded I couldn't use it and had to replace it all, the first step of which was to write an actual Lisp interpreter. I gradually adapted every part of the editor based on real Lisp data structures, rather than ad hoc data structures, making the data structures of the internals of the editor exposable and manipulable by the user's Lisp programs. - -The one exception was redisplay. For a long time, redisplay was sort of an alternate world. The editor would enter the world of redisplay and things would go on with very special data structures that were not safe for garbage collection, not safe for interruption, and you couldn't run any Lisp programs during that. We've changed that since — it's now possible to run Lisp code during redisplay. It's quite a convenient thing. - -This second Emacs program was ‘free software’ in the modern sense of the term — it was part of an explicit political campaign to make software free. The essence of this campaign was that everybody should be free to do the things we did in the old days at MIT, working together on software and working with whomever wanted to work with us. That is the basis for the free software movement — the experience I had, the life that I've lived at the MIT AI lab — to be working on human knowledge, and not be standing in the way of anybody's further using and further disseminating human knowledge. - -At the time, you could make a computer that was about the same price range as other computers that weren't meant for Lisp, except that it would run Lisp much faster than they would, and with full type checking in every operation as well. Ordinary computers typically forced you to choose between execution speed and good typechecking. So yes, you could have a Lisp compiler and run your programs fast, but when they tried to take `car` of a number, it got nonsensical results and eventually crashed at some point. - -The Lisp machine was able to execute instructions about as fast as those other machines, but each instruction — a car instruction would do data typechecking — so when you tried to get the car of a number in a compiled program, it would give you an immediate error. We built the machine and had a Lisp operating system for it. It was written almost entirely in Lisp, the only exceptions being parts written in the microcode. People became interested in manufacturing them, which meant they should start a company. - -There were two different ideas about what this company should be like. Greenblatt wanted to start what he called a “hacker” company. This meant it would be a company run by hackers and would operate in a way conducive to hackers. Another goal was to maintain the AI Lab culture (3). Unfortunately, Greenblatt didn't have any business experience, so other people in the Lisp machine group said they doubted whether he could succeed. They thought that his plan to avoid outside investment wouldn't work. - -Why did he want to avoid outside investment? Because when a company has outside investors, they take control and they don't let you have any scruples. And eventually, if you have any scruples, they also replace you as the manager. - -So Greenblatt had the idea that he would find a customer who would pay in advance to buy the parts. They would build machines and deliver them; with profits from those parts, they would then be able to buy parts for a few more machines, sell those and then buy parts for a larger number of machines, and so on. The other people in the group thought that this couldn't possibly work. - -Greenblatt then recruited Russell Noftsker, the man who had hired me, who had subsequently left the AI Lab and created a successful company. Russell was believed to have an aptitude for business. He demonstrated this aptitude for business by saying to the other people in the group, “Let's ditch Greenblatt, forget his ideas, and we'll make another company.” Stabbing in the back, clearly a real businessman. Those people decided they would form a company called Symbolics. They would get outside investment, not have scruples, and do everything possible to win. - -But Greenblatt didn't give up. He and the few people loyal to him decided to start Lisp Machines Inc. anyway and go ahead with their plans. And what do you know, they succeeded! They got the first customer and were paid in advance. They built machines and sold them, and built more machines and more machines. They actually succeeded even though they didn't have the help of most of the people in the group. Symbolics also got off to a successful start, so you had two competing Lisp machine companies. When Symbolics saw that LMI was not going to fall flat on its face, they started looking for ways to destroy it. - -Thus, the abandonment of our lab was followed by “war” in our lab. The abandonment happened when Symbolics hired away all the hackers, except me and the few who worked at LMI part-time. Then they invoked a rule and eliminated people who worked part-time for MIT, so they had to leave entirely, which left only me. The AI lab was now helpless. And MIT had made a very foolish arrangement with these two companies. It was a three-way contract where both companies licensed the use of Lisp machine system sources. These companies were required to let MIT use their changes. But it didn't say in the contract that MIT was entitled to put them into the MIT Lisp machine systems that both companies had licensed. Nobody had envisioned that the AI lab's hacker group would be wiped out, but it was. - -So Symbolics came up with a plan (4). They said to the lab, “We will continue making our changes to the system available for you to use, but you can't put it into the MIT Lisp machine system. Instead, we'll give you access to Symbolics' Lisp machine system, and you can run it, but that's all you can do.” - -This, in effect, meant that they demanded that we had to choose a side, and use either the MIT version of the system or the Symbolics version. Whichever choice we made determined which system our improvements went to. If we worked on and improved the Symbolics version, we would be supporting Symbolics alone. If we used and improved the MIT version of the system, we would be doing work available to both companies, but Symbolics saw that we would be supporting LMI because we would be helping them continue to exist. So we were not allowed to be neutral anymore. - -Up until that point, I hadn't taken the side of either company, although it made me miserable to see what had happened to our community and the software. But now, Symbolics had forced the issue. So, in an effort to help keep Lisp Machines Inc. going (5) — I began duplicating all of the improvements Symbolics had made to the Lisp machine system. I wrote the equivalent improvements again myself (i.e., the code was my own). - -After a while (6), I came to the conclusion that it would be best if I didn't even look at their code. When they made a beta announcement that gave the release notes, I would see what the features were and then implement them. By the time they had a real release, I did too. - -In this way, for two years, I prevented them from wiping out Lisp Machines Incorporated, and the two companies went on. But, I didn't want to spend years and years punishing someone, just thwarting an evil deed. I figured they had been punished pretty thoroughly because they were stuck with competition that was not leaving or going to disappear (7). Meanwhile, it was time to start building a new community to replace the one that their actions and others had wiped out. - -The Lisp community in the 70s was not limited to the MIT AI Lab, and the hackers were not all at MIT. The war that Symbolics started was what wiped out MIT, but there were other events going on then. There were people giving up on cooperation, and together this wiped out the community and there wasn't much left. - -Once I stopped punishing Symbolics, I had to figure out what to do next. I had to make a free operating system, that was clear — the only way that people could work together and share was with a free operating system. - -At first, I thought of making a Lisp-based system, but I realized that wouldn't be a good idea technically. To have something like the Lisp machine system, you needed special purpose microcode. That's what made it possible to run programs as fast as other computers would run their programs and still get the benefit of typechecking. Without that, you would be reduced to something like the Lisp compilers for other machines. The programs would be faster, but unstable. Now that's okay if you're running one program on a timesharing system — if one program crashes, that's not a disaster, that's something your program occasionally does. But that didn't make it good for writing the operating system in, so I rejected the idea of making a system like the Lisp machine. - -I decided instead to make a Unix-like operating system that would have Lisp implementations to run as user programs. The kernel wouldn't be written in Lisp, but we'd have Lisp. So the development of that operating system, the GNU operating system, is what led me to write the GNU Emacs. In doing this, I aimed to make the absolute minimal possible Lisp implementation. The size of the programs was a tremendous concern. - -There were people in those days, in 1985, who had one-megabyte machines without virtual memory. They wanted to be able to use GNU Emacs. This meant I had to keep the program as small as possible. - -For instance, at the time the only looping construct was ‘while’, which was extremely simple. There was no way to break out of the ‘while’ statement, you just had to do a catch and a throw, or test a variable that ran the loop. That shows how far I was pushing to keep things small. We didn't have ‘caar’ and ‘cadr’ and so on; “squeeze out everything possible” was the spirit of GNU Emacs, the spirit of Emacs Lisp, from the beginning. - -Obviously, machines are bigger now, and we don't do it that way any more. We put in ‘caar’ and ‘cadr’ and so on, and we might put in another looping construct one of these days. We're willing to extend it some now, but we don't want to extend it to the level of common Lisp. I implemented Common Lisp once on the Lisp machine, and I'm not all that happy with it. One thing I don't like terribly much is keyword arguments (8). They don't seem quite Lispy to me; I'll do it sometimes but I minimize the times when I do that. - -That was not the end of the GNU projects involved with Lisp. Later on around 1995, we were looking into starting a graphical desktop project. It was clear that for the programs on the desktop, we wanted a programming language to write a lot of it in to make it easily extensible, like the editor. The question was what it should be. - -At the time, TCL was being pushed heavily for this purpose. I had a very low opinion of TCL, basically because it wasn't Lisp. It looks a tiny bit like Lisp, but semantically it isn't, and it's not as clean. Then someone showed me an ad where Sun was trying to hire somebody to work on TCL to make it the “de-facto standard extension language” of the world. And I thought, “We've got to stop that from happening.” So we started to make Scheme the standard extensibility language for GNU. Not Common Lisp, because it was too large. The idea was that we would have a Scheme interpreter designed to be linked into applications in the same way TCL was linked into applications. We would then recommend that as the preferred extensibility package for all GNU programs. - -There's an interesting benefit you can get from using such a powerful language as a version of Lisp as your primary extensibility language. You can implement other languages by translating them into your primary language. If your primary language is TCL, you can't very easily implement Lisp by translating it into TCL. But if your primary language is Lisp, it's not that hard to implement other things by translating them. Our idea was that if each extensible application supported Scheme, you could write an implementation of TCL or Python or Perl in Scheme that translates that program into Scheme. Then you could load that into any application and customize it in your favorite language and it would work with other customizations as well. - -As long as the extensibility languages are weak, the users have to use only the language you provided them. Which means that people who love any given language have to compete for the choice of the developers of applications — saying “Please, application developer, put my language into your application, not his language.” Then the users get no choices at all — whichever application they're using comes with one language and they're stuck with [that language]. But when you have a powerful language that can implement others by translating into it, then you give the user a choice of language and we don't have to have a language war anymore. That's what we're hoping ‘Guile’, our scheme interpreter, will do. We had a person working last summer finishing up a translator from Python to Scheme. I don't know if it's entirely finished yet, but for anyone interested in this project, please get in touch. So that's the plan we have for the future. - -I haven't been speaking about free software, but let me briefly tell you a little bit about what that means. Free software does not refer to price; it doesn't mean that you get it for free. (You may have paid for a copy, or gotten a copy gratis.) It means that you have freedom as a user. The crucial thing is that you are free to run the program, free to study what it does, free to change it to suit your needs, free to redistribute the copies of others and free to publish improved, extended versions. This is what free software means. If you are using a non-free program, you have lost crucial freedom, so don't ever do that. - -The purpose of the GNU project is to make it easier for people to reject freedom-trampling, user-dominating, non-free software by providing free software to replace it. For those who don't have the moral courage to reject the non-free software, when that means some practical inconvenience, what we try to do is give a free alternative so that you can move to freedom with less of a mess and less of a sacrifice in practical terms. The less sacrifice the better. We want to make it easier for you to live in freedom, to cooperate. - -This is a matter of the freedom to cooperate. We're used to thinking of freedom and cooperation with society as if they are opposites. But here they're on the same side. With free software you are free to cooperate with other people as well as free to help yourself. With non-free software, somebody is dominating you and keeping people divided. You're not allowed to share with them, you're not free to cooperate or help society, anymore than you're free to help yourself. Divided and helpless is the state of users using non-free software. - -We've produced a tremendous range of free software. We've done what people said we could never do; we have two operating systems of free software. We have many applications and we obviously have a lot farther to go. So we need your help. I would like to ask you to volunteer for the GNU project; help us develop free software for more jobs. Take a look at [http://www.gnu.org/help][1] to find suggestions for how to help. If you want to order things, there's a link to that from the home page. If you want to read about philosophical issues, look in /philosophy. If you're looking for free software to use, look in /directory, which lists about 1900 packages now (which is a fraction of all the free software out there). Please write more and contribute to us. My book of essays, “Free Software and Free Society”, is on sale and can be purchased at [www.gnu.org][2]. Happy hacking! - --------------------------------------------------------------------------------- - -via: https://www.gnu.org/gnu/rms-lisp.html - -作者:[Richard Stallman][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.gnu.org -[1]:https://www.gnu.org/help/ -[2]:http://www.gnu.org/ diff --git a/sources/talk/20170320 An Ubuntu User-s Review Of Dell XPS 13 Ubuntu Edition.md b/sources/talk/20170320 An Ubuntu User-s Review Of Dell XPS 13 Ubuntu Edition.md deleted file mode 100644 index 61a4c4993c..0000000000 --- a/sources/talk/20170320 An Ubuntu User-s Review Of Dell XPS 13 Ubuntu Edition.md +++ /dev/null @@ -1,199 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An Ubuntu User’s Review Of Dell XPS 13 Ubuntu Edition) -[#]: via: (https://itsfoss.com/dell-xps-13-ubuntu-review) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -An Ubuntu User’s Review Of Dell XPS 13 Ubuntu Edition -====== - -_**Brief: Sharing my feel and experience about Dell XPS 13 Kaby Lake Ubuntu edition after using it for over three months.**_ - -During Black Friday sale last year, I took the bullet and ordered myself a [Dell XPS 13][1] with the new [Intel Kaby Lake processor][2]. It got delivered in the second week of December and if you [follow It’s FOSS on Facebook][3], you might have seen the [live unboxing][4]. - -Though I was tempted to do the review of Dell XPS 13 Ubuntu edition almost at the same time, I knew it won’t be fair. A brand new system will, of course, feel good and work smooth. - -But that’s not the real experience. The real experience of any system comes after weeks, if not months, of use. That’s the reason I hold myself back and waited three months to review Dell XPS Kobylake Ubuntu edition. - -### Dell XPS 13 Ubuntu Edition Review - -Before we saw what’s hot and what’s not in the latest version of Dell XPS 13, I should tell you that I was using an Acer R13 ultrabook book before this. So I may compare the new Dell system with the older Acer one. - -![Dell XPS 13 Ubuntu Edition System Settings][5]![Dell XPS 13 Ubuntu Edition System Settings][5] - -Dell XPS 13 has several versions based on processor. The one I am reviewing is Dell XPS13 MLK (9360). It has i5-7200U 7th generation processor. Since I hardly used the touch screen in Acer Aspire R13, I chose to go with the non-touch version of XPS. This decision also saved me a couple of hundreds of Euro. - -It has 8 GB of LPDDR3 1866MHz RAM and 256 GB SSD PCIe. Graphics is Intel HD. On connectivity side, it’s got Killer 1535 Wi-Fi 802.11ac 2×2 and Bluetooth 4.1. Screen is InfinityEdge Full HD (1 920 x 1080). - -Now, you know what kind of hardware we’ve got here, let’s see what works and what sucks. - -#### Look and feel - -![Dell XPS 13 Kaby Lake Ubuntu Edition][6]![Dell XPS 13 Kaby Lake Ubuntu Edition][6] - -At 13.3″, Dell XPS 13 looks even smaller than a regular 13.3″ laptop, thanks to its non-existent bezel which is the specialty of the infinite display. It is light as a feather with weight just under 1.23 Kg. - -The outer surface is metallic, not very shiny but a decent aluminum look. On the interior, the palm rest is made of carbon fiber which is very comfortable at the rest. Unlike the MacBook Air that uses metallic palm rests, the carbon fiber ones are more friendly, especially in winters. - -It is almost centimeter and a half high at it’s thickest part (around hinges). This also adds a plus point to the elegance of XPS 13. - -Overall, Dell XPS 13 has a compact body and an elegant body. - -#### Keyboard and touchpad - -The keyboard and touchpad mix well with the carbon fiber interiors. The keys are smooth with springs in the back (perhaps) and give a rich feel while typing. All of the important keys are present and are not tiny in size, something you might be worried of, considering the overall tiny size of XPS13. - -Oh! the keyboards have backlit support. Which adds to the rich feel of this expensive laptop. - -While the keyboard is a great experience, the same cannot be said about the touchpad. In fact, the touchpad is the weakest part which mars the overall good experience of XPS 13. - -The touchpad has a cheap feeling because it makes an irritating sound while tapping on the right side as if it’s hollow underneath. This is [something that has been noticed in the earlier versions of XPS 13][7] but hasn’t been given enough consideration to fix it. This is something you do not expect from a product at such a price. - -Also, the touchpad scroll on websites is hideous. It is also not suitable for pixel works because of difficulty in moving little adjustments. - -#### Ports - -Dell XPS 13 has two USB 3.0 ports, one of them with PowerShare. If you did not know, [USB 3.0 PowerShare][8] ports allow you to charge external devices even when your system is turned off. - -![Dell XPS 13 Kaby Lake Ubuntu edition ports][9]![Dell XPS 13 Kaby Lake Ubuntu edition ports][9] - -It also has a [Thunderbolt][10] (doubles up as [USB Type-C port][11]). It doesn’t have HDMI port, Ethernet port or VGA port. However, all of these three can be used via the Thunderbolt port and external adapters (sold separately). - -![Dell XPS 13 Kaby Lake Ubuntu edition ports][12]![Dell XPS 13 Kaby Lake Ubuntu edition ports][12] - -It also has an SD card reader and a headphone jack. In addition to all these, there is an [anti-theft slot][13] (a common security practice in enterprises). - -#### Display - -The model I have packs 1920x1080px. It’s full HD and display quality is at par. It perfectly displays the high definition pictures and 1080p video files. - -I cannot compare it with the [qHD model][14] as I never used it. But considering that there are not enough 4K contents for now, full HD display should be sufficient for next few years. - -#### Sound - -Compared to Acer R13, XPS 13 has better audio quality. Even the max volume is louder than that of Acer R13. The dual speakers give a nice stereo effect. - -#### Webcam - -The weirdest part of Dell XPS 13 review comes now. We all have been accustomed of seeing the webcam at the top-middle position on any laptop. But this is not the case here. - -XPS 13 puts the webcam on the bottom left corner of the laptop. This is done to keep the bezel as thin as possible. But this creates a problem. - -![Image captured with laptop screen at 90 degree][15] - -When you video chat with someone, it is natural to look straight up. With the top-middle webcam, your face is in direct line with the camera. But with the bottom left position of web cam, it looks like those weird accidental selfies you take with the front camera of your smartphone. Heck, people on the other side might see inside of your nostrils. - -#### Battery - -Battery life is the strongest point of Dell XPS 13. While Dell claims an astounding 21-hour battery life, but in my experience, it smoothly gives a battery life of 8-10 hours. This is when I watch movies, browse the internet and other regular stuff. - -There is one strange thing that I noticed, though. It charges pretty quick until 90% but the charging slows down afterward. And it almost never goes beyond 98%. - -The battery indicator turns red when the battery status falls below 30% and it starts displaying notifications if the battery goes below 10%. There is small light indicator under the touchpad that turns yellow when the battery is low and it turns white when the charger is plugged in. - -#### Overheating - -I have previously written about ways to [reduce laptop overheating in Linux][16]. Thankfully, so far, I didn’t need to employ those tricks. - -Dell XPS 13 remains surprisingly cool when you are using it on battery, even in long runs. The bottom does get heated a little when you use it while charging. - -Overall, XPS 13 manages overheating very well. - -#### The Ubuntu experience with Dell XPS 13 - -So far we have seen pretty generic things about the Dell XPS 13. Let’s talk about how good a Linux laptop it is. - -Until now, I used to manually [install Linux on Windows laptop][17]. This is the first Linux laptop I ever bought. I would also like to mention the awesome first boot animation of Dell’s Ubuntu laptop. Here’s a YouTube video of the same: - -One thing I would like to mention here is that Dell never displays Ubuntu laptops on its website. You’ll have to search the website with Ubuntu then you’ll see the Ubuntu editions. Also, Ubuntu edition is cheaper just by 50 Euro in comparison to its Windows counterpart whereas I was expecting it to be at least 100 Euro less than that of Windows. - -Despite being an Ubuntu preloaded laptop, the super key still comes with Windows logo on it. It’s trivial but I would have loved to see the Ubuntu logo on it. - -Now talking about Ubuntu experience, the first thing I noticed was that there was no hardware issue. Even the function and media keys work perfectly in Ubuntu, which is a pleasant surprise. - -Dell has also added its own repository in the software sources to provide for some Dell specific tools. You can see the footprints of Dell in the entire system. - -You might be interested to see how Dell partitioned the 256Gb of disk space. Let me show that to you. - -![Default disk partition by Dell][18] - -As you can see, there is 524MB reserved for [EFI][19]. Then there is 3.2 GB of factory restore image perhaps. - -Dell is using 17Gb of Swap partition, which is more than double of the RAM size. It seems Dell didn’t put enough thought here because this is simply waste of disk space, in my opinion. I would have used not [more than 11 GB of Swap partition][20] here. - -As I mentioned before, Dell adds a “restore to factory settings” option in the Grub menu. This is a nice little feature to have. - -One thing which I don’t like in the XPS 13 Ubuntu edition is the long boot time. It takes entire 23 seconds to reach the login screen after pressing the power button. I would expect it to be faster considering that it uses SSD PCIe. - -If it interests you, the XPS 13 had Chromium and Google Chrome browsers installed by default instead of Firefox. - -As far my experience goes, I am fairly impressed with Dell XPS 13 Ubuntu edition. It gives a smooth Ubuntu experience. The laptop seems to be a part of Ubuntu. Though it is an expensive laptop, I would say it is definitely worth the money. - -To summarize, let’s see the good, the bad and the ugly of Dell XPS 13 Ubuntu edition. - -#### The Good - - * Ultralight weight - * Compact - * Keyboard - * Carbon fiber palm rest - * Full hardware support for Ubuntu - * Factory restore option for Ubuntu - * Nice display and sound quality - * Good battery life - - - -#### The bad - - * Poor touchpad - * A little pricey - * Long boot time for SSD powered laptop - * Windows key still present :P - - - -#### The ugly - - * Weird webcam placement - - - -How did you like the **Dell XPS 13 Ubuntu edition review** from an Ubuntu user’s point of view? Do you find it good enough to spend over a thousand bucks? Do share your views in the comment below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/dell-xps-13-ubuntu-review - -作者:[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://amzn.to/2ImVkCV -[2]: http://www.techradar.com/news/computing-components/processors/kaby-lake-intel-core-processor-7th-gen-cpu-news-rumors-and-release-date-1325782 -[3]: https://www.facebook.com/itsfoss/ -[4]: https://www.facebook.com/itsfoss/videos/810293905778045/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/Dell-XPS-13-Ubuntu-Edition-spec.jpg?resize=540%2C337&ssl=1 -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-XPS-13-Ubuntu-review.jpeg?resize=800%2C600&ssl=1 -[7]: https://www.youtube.com/watch?v=Yt5SkI0c3lM -[8]: http://www.dell.com/support/article/fr/fr/frbsdt1/SLN155147/usb-powershare-feature?lang=EN -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-Ubuntu-XPS-13-Kaby-Lake-ports-1.jpg?resize=800%2C435&ssl=1 -[10]: https://en.wikipedia.org/wiki/Thunderbolt_(interface) -[11]: https://en.wikipedia.org/wiki/USB-C -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-Ubuntu-XPS-13-Kaby-Lake-ports-2.jpg?resize=800%2C325&ssl=1 -[13]: http://accessories.euro.dell.com/sna/productdetail.aspx?c=ie&l=en&s=dhs&cs=iedhs1&sku=461-10169 -[14]: https://recombu.com/mobile/article/quad-hd-vs-qhd-vs-4k-ultra-hd-what-does-it-all-mean_M20472.html -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-XPS-13-webcam-issue.jpg?resize=800%2C450&ssl=1 -[16]: https://itsfoss.com/reduce-overheating-laptops-linux/ -[17]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ -[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/03/Dell-XPS-13-Ubuntu-Edition-disk-partition.jpeg?resize=800%2C448&ssl=1 -[19]: https://en.wikipedia.org/wiki/EFI_system_partition -[20]: https://itsfoss.com/swap-size/ diff --git a/sources/talk/20170908 Betting on the Web.md b/sources/talk/20170908 Betting on the Web.md deleted file mode 100644 index 84d70e164f..0000000000 --- a/sources/talk/20170908 Betting on the Web.md +++ /dev/null @@ -1,467 +0,0 @@ -[Betting on the Web][27] -============================================================ - -![](https://static.joreteg.com/large_background.jpg) - - _Note: I just spoke at [Coldfront 2017][12] about why I’m such a big proponent of the Web. What follows is essentially that talk as a blog post (I’ll add a link to the video once it is published)._ - - _Also: the Starbucks PWA mentioned in the talk has shipped! 🎉_ - -I’m  _not_  going to tell you what to do. Instead, I’m going to explain why I’ve chosen to bet my whole career on this crazy Web thing. "Betting" sounds a bit haphazard, it’s more calculated than that. It would probably be better described as "investing." - -Investing what? Our time and attention. - -Many of us only have maybe 6 or so  _really_  productive hours per day when we’re capable of being super focused and doing our absolute best work. So how we chose to invest that very limited time is kind of a big deal. Even though I really enjoy programming I rarely do it aimlessly just for the pure joy of it. Ultimately, I’m investing that productive time expecting to get  _some kind of return_  even if it’s just mastering something or solving a difficult problem. - - [### "So what, what’s your point?"][28] - -> > More than most of us realize we are  _constantly_  investing - -Sure, someone may be paying for our time directly but there’s more to it than just trading hours for money. In the long run, what we chose to invest our professional efforts into has other effects: - -**1\. Building Expertise:** We learn as we work and gain valuable experience in the technologies and platform we’re investing in. That expertise impacts our future earning potential and what types of products we’re capable of building. - -**2\. Building Equity:** Hopefully we’re generating equity and adding value to whatever product we’re building. - -**3\. Shaping tomorrow’s job market:** We’re building tomorrow’s legacy code today™. Today’s new hotness is tomorrow’s maintenance burden. In many cases the people that initially build a product or service are not the ones that ultimately maintain it. This means the technology choices we make when building a new product or service, determine whether or not there will be jobs later that require expertise in that particular platform/technology. So, those tech choices  _literally shape tomorrow’s job market!_ - -**4\. Body of knowledge:** As developers, we’re pretty good at sharing what we learn. We blog, we "Stack-Overflow", etc. These things all contribute to the corpus of knowledge available about that given platform which adds significant value by making it easier/faster for others to build things using these tools. - -**5\. Open Source:** We solve problems and share our work. When lots of developers do this it adds  _tremendous value_  to the technologies and platforms these tools are for. The sheer volume of work that we  _don’t have to do_  because we can use someone else’s library that already does it is mind-boggling. Millions and millions of hours of development work are available to us for free with a simple `npm install`. - -**6\. Building apps for users on that platform:** Last but not least, without apps there is no platform. By making more software available to end users, we’re contributing significant value to the platforms that run our apps. - -Looking at that list, the last four items are not about  _us_  at all. They represent other significant long-term impacts. - -> > We often have a broader impact than we realize - -We’re not just investing time into a job, we're also shaping the platform, community, and technologies we use. - -We’re going to come back to this, but hopefully, recognizing that greater impact can help us make better investments. - - [### With all investing comes  _risk_][29] - -We can’t talk about investing without talking about risk. So what are some of the potential risks? - - [### Are we building for the right platform?][30] - -Platform stability is indeed A Thing™. Just ask a Flash developer, Windows Phone developer, or Blackberry developer. Platforms  _can_  go away. - -If we look at those three platforms, what do they have in common? They’re  _closed_  platforms. What I mean is there’s a single controlling interest. When you build for them, you’re building for a specific operating system and coding against a particular implementation as opposed to coding against a set of  _open standards_ . You could argue, that at least to some degree, Flash died because of its "closed-ness". Regardless, one thing is clear from a risk mitigation perspective: open is better than closed. - -the Web is  _incredibly_  open. It would be quite difficult for any one entity to kill it off. - -Now, for Windows Phone/Blackberry it failed due to a lack of interested users... or was it lack of interested developers?? - -![](https://d33wubrfki0l68.cloudfront.net/9c118bc64747a753804bf88f16237bfe1c71905e/8d334/images/2/ballmer.jpg) - -Maybe if Ballmer ☝️ has just yelled "developers"  _one more time_  we’d all have Windows Phones in our pockets right now 😜. - -From a risk mitigation perspective, two things are clear with regard to platform stability: - -1. Having  _many users_  is better than having few users - -2. Having  _more developers_  building for the platform is better than having few developers - -> > There is no bigger more popular open platform than the Web - - [### Are we building the right software?][31] - -Many of us are building apps. Well, we used to build "applications" but that wasn’t nearly cool enough. So now we build "apps" instead 😎. - -What does "app" mean to a user? This is important because I think it’s changed a bit over the years. To a user, I would suggest it basically means: "a thing I put on my phone." - -But for our purposes I want to get a bit more specific. I’d propose that an app is really: - -1. An "ad hoc" user interface - -2. That is local(ish) to the device - -The term "ad hoc" is Latin and translates to **"for this"**. This actually matches pretty closely with what Apple’s marketing campaigns have been teaching the masses: - -> There’s an app **for that** -> -> – Apple - -The point is it helps you  _do_  something. The emphasis is on action. I happen to think this is largely the difference between a "site" and an "app". A news site for example has articles that are resources in and of themselves. Where a news app is software that runs on the device that helps you consume news articles. - -Another way to put it would be that site is more like a book, while an app is a tool. - - [### Should we be building apps at all?!][32] - -Remember when chatbots were supposed to take over the world? Or perhaps we’ll all be walking around with augmented reality glasses and that’s how we’ll interact with the world? - -I’ve heard it said that "the future app is  _no_  app" and virtual assistants will take over everything. - -![](https://d33wubrfki0l68.cloudfront.net/447b9cdc5e549f874d40fcccbdc6a4225d898677/b3dce/images/2/echo.png) - -I’ve had one of these sitting in my living room for a couple of years, but I find it all but useless. It’s just a nice bluetooth speaker that I can yell at to play me music. - -But I find it very interesting that: - -> > Even Alexa has an app! - -Why? Because there’s no screen! As it turns out these "ad hoc visual interfaces" are extremely efficient. - -Sure, I can yell out "Alexa, what’s the weather going to be like today" and I’ll hear a reply with high and low and whether it’s cloudy, rainy, or sunny. But in that same amount of time, I can pull my phone out tap the weather app and before Alexa can finish telling me those 3 pieces of data, I can visually scan the entire week’s worth of data, air quality, sunrise/sunset times, etc. It’s just  _so much more_  efficient as a mechanism for consuming this type of data. - -As a result of that natural efficiency, I believe that having a visual interface is going to continue to be useful for all sorts of things for a long time to come. - -That’s  _not_  to say virtual assistants aren’t useful! Google Assistant on my Pixel is quite useful in part because it can show me answers and can tolerate vagueness in a way that an app with a fixed set of buttons never could. - -But, as is so often the case with new useful tech, rarely does it complete replace everything that came before it, instead, it augments what we already have. - - [### If apps are so great why are we so "apped out"?][33] - -How do we explain that supposed efficiency when there’s data like this? - -* [65% of smartphone users download zero apps per month][13] - -* [More than 75% of app downloads open an app once and never come back][14] - -I think to answer that we have to really look at what isn’t working well. - - [### What sucks about apps?][34] - -1. **Downloading them certainly sucks.** No one wants to open an app store, search for the app they’re trying to find, then wait to download the huge file. These days a 50mb app is pretty small. Facebook for iOS 346MB, Twitter iOS 212MB. - -2. **Updating them sucks.** Every night I plug in my phone I download a whole slew of app updates that I, as a user, **could not possibly care less about**. In addition, many of these apps are things I installed  _once_ and will **never open again, ever!**. I’d love to know the global stats on how much bandwidth has been wasted on app updates for apps that were never opened again. - -3. **Managing them sucks.** Sure, when I first got an iPhone ages ago and could first download apps my home screen was impeccable. Then when we got folders!! Wow... what an amazing development! Now I could finally put all those pesky uninstallable Apple apps in a folder called "💩" and pretend they didn’t exist. But now, my home screen is a bit of a disaster. Sitting there dragging apps around is not my idea of a good time. So eventually things get all cluttered up again. - -The thing I’ve come to realize, is this: - -> > We don’t care how they got there. We only care that they’re  _there_  when we need them. - -For example, I love to go mountain biking and I enjoy tracking my rides with an app called Strava. I get all geared up for my ride, get on my bike and then go, "Oh right, gotta start Strava." So I pull out my phone  _with my gloves on_  and go: "Ok Google, open Strava". - -I  _could not care less_  about where that app was or where it came from when I said that. - -I don’t care if it was already installed, I don’t care if it never existed on my home screen, or if it was generated out of thin air on the spot. - -> > Context is  _everything_ ! - -If I’m at a parking meter, I want the app  _for that_ . If I’m visiting Portland, I want their public transit app. - -But I certainly  _do not_  want it as soon as I’ve left. - -If I’m at a conference, I might want a conference app to see the schedule, post questions to speakers, or whatnot. But wow, talk about something that quickly becomes worthless as soon as that conference is over! - -As it turns out the more "ad hoc" these things are, the better! The more  _disposable_  and  _re-inflatable_  the better! - -Which also reminds me of something that I feel like we often forget. We always assume people want our shiny apps and we measure things like "engagement" and "time spent in the app" when really, and there certainly are exceptions to this such as apps that are essentially entertainment, but often... - -> > People don’t want to use your app. They want  _to be done_  using your app. - - [### Enter PWAs][35] - -I’ve been contracting with Starbucks for the past 18 months. They’ve taken on the ambitious project of essentially re-building a lot of their web stuff in Node.js and React. One of the things I’ve helped them with (and pushed hard for) was to build a PWA (Progressive Web App) that could provide similar functionality as their native apps. Coincidentally it was launched today: [https://preview.starbucks.com][18]! - - - -This gives is a nice real world example: - -* Starbucks iOS: 146MB - -* Starbucks PWA: ~600KB - -The point is there’s a  _tremendous_  size difference. - -It’s 0.4% of the size. To put it differently, I could download the PWA **243 times**in the same amount of time it would take to download the iOS app. Then, of course on iOS it then also still has to install and boot up! - -Personally, I’d have loved it if the app ended up even smaller and there are plans to shrink it further. But even still, they’re  _not even on the same planet_  in terms of file-size! - -Market forces are  _strongly_  aligned with PWAs here: - -* Few app downloads - -* User acquisition is  _hard_ - -* User acquisition is  _expensive_ - -If the goal is to get people to sign up for the rewards program, that type of size difference could very well make the difference of getting someone signed up and using the app experience (via PWA) by the time they reach the front of the line at Starbucks or not. - -User acquisition is hard enough already, the more time and barriers that can be removed from that process, the better. - - [### Quick PWA primer][36] - -As mentioned, PWA stands for "Progressive Web Apps" or, as I like to call them: "Web Apps" 😄 - -Personally I’ve been trying to build what a user would define as an "app" with web technology for  _years_ . But until PWAs came along, as hard as we tried, you couldn’t quite build a  _real app_  with just web tech. Honestly, I kinda hate myself for saying that, but in terms of something that a user would understand as an "app" I’m afraid that statement has probably true until very recently. - -So what’s a PWA? As one of its primary contributors put it: - -> It’s just a website that took all the right vitamins. -> -> – Alex Russell - -It involves a few specific technologies, namely: - -* Service Worker. Which enable true reliability on the web. What I mean by that is I can build an app that as long as you loaded it while you were online, from then on it will  _always_  open, even if you’re not. This puts it on equal footing with other apps. - -* HTTPS. Requires encrypted connections - -* Web App Manifest. A simple JSON file that describes your application. What icons to use is someone adds it to their home screen, what its name is, etc. - -There are plenty of other resources about PWAs on the web. The point for my purposes is: - -> > It is now possible to build PWAs that are  _indistinguishable_  from their native counter parts - -They can be up and running in a fraction of the time whether or not they were already "installed" and unlike "apps" can be saved as an app on the device  _at the user’s discretion!_ - -Essentially they’re really great for creating "ad hoc" experiences that can be "cold started" on a whim nearly as fast as if it were already installed. - -I’ve said it before and I’ll say it again: - -> PWAs are the biggest thing to happen to the mobile web since the iPhone. -> -> – Um... that was me - - [### Let’s talk Internet of things][37] - -I happen to think that PWAs + IoT = ✨ MAGIC ✨. As several smart folks have pointed out. - -The one-app-per-device approach to smart devices probably isn’t particularly smart. - -It doesn’t scale well and it completely fails in terms of "ad hoc"-ness. Sure, if I have a Nest thermostat and Phillips Hue lightbulbs, it’s reasonable to have two apps installed. But even that sucks as soon as I want someone else to be able to use control them. If  _I just let you into my house_ , trust me... I’m perfectly happy to let you flip a light switch, you’re in my house, after all. But for the vast majority of these things there’s no concept of "nearby apps" and, it’s silly for my guest (or a house-sitter) to download an app they don’t actually want, just so I can let them control my lights. - -The whole "nearby apps" thing has so many uses: - -* thermostat - -* lights - -* locks - -* garage doors - -* parking meter - -* setting refrigerator temp - -* conference apps - -Today there are lots of new capabilities being added to the web to enable web apps to interact with physical devices in the real world. Things like WebUSB, WebBluetooth, WebNFC, and efforts like [Physical Web][19]. Even for things like Augmented (and Virtual) reality, the idea of the items we want to interact with having URLs makes so much sense and I can’t imagine a better, more flexible use of those URLs than for them to point to a PWA that lets you interact with that device! - - [### Forward looking statements...][38] - -I’ve been talking about all this in terms of investing. If you’ve ever read any company statement that discusses the future you always see this line explaining that things that are about to be discussed contains "forward looking statements" that may or may not ultimately happen. - -So, here are  _my_  forward looking statements. - - [### 1\. PWA-only startups][39] - -Given the cost (and challenge) of user-acquisition and the quality of app you can build with PWAs these days, I feel like this is inevitable. If you’re trying to get something off the ground, it just isn’t very efficient to spin up  _three whole teams_  to build for iOS, Android, and the Web. - - [### 2\. PWAs listed in App Stores][40] - -So, there’s a problem with "web only" which is that for the good part of a decade we’ve been training users to look for apps in the app store for their given platform. So if you’re already a recognized brand, especially if you already have a native app that you’re trying to replace, it simply isn’t smart for you  _not to exist_  in the app stores. - -So, some of this isn’t all that "forward looking" as it turns out [Microsoft has already committed to listing PWAs in the Windows Store][20], more than once! - -**They haven’t even finished implementing Service Worker in Edge yet!** But they’re already committing hard to PWAs. In addition to post linked above, one of their lead Developer Relations folks, Aaron Gustafson just [wrote an article for A List Apart][21] telling everyone to build PWAs. - -But if you think about it from their perspective, of course they should do that! As I said earlier they’ve struggled to attract developer to build for their mobile phones. In fact, they’ve at times  _paid_  companies to write apps for them simply to make sure apps exist so that users will be able to have apps they want when using a Windows Phone. Remember how I said developer time is a scarce resource and without apps, the platform is worthless? So  _of course_  they should add first class support for PWAs. If you build a PWA like a lot of folks are doing then TADA!!! 🎉 You just made a Windows/Windows Phone app! - -I’m of the opinion that the writing is on the wall for Google to do the same thing. It’s pure speculation, but it certainly seems like they are taking steps that suggest they may be planning on listing PWAs too. Namely that the Chrome folks recently shipped a feature referred to as "WebAPKs" for Chrome stable on Android (yep, everyone). In the past I’ve [explained in more detail][22] why I think this is a big deal. But a shorted version would be that before this change, sure you could save a PWA to your home screen...  _But_ , in reality it was actually a glorified bookmark. That’s what changes with WebAPKs. Instead, when you add a PWA to your home screen it generates and "side loads" an actual `.apk`file on the fly. This allows that PWA to enjoy some privileges that were simply impossible until the operating system recognized it as "an app." For example: - -* You can now mute push notifications for a specific PWA without muting it for all of Chrome. - -* The PWA is listed in the "app tray" that shows all installed apps (previously it was just the home screen). - -* You can see power usage, and permissions granted to the PWA just like any other app. - -* The app developer can now update the icon for the app by publishing an update to the app manifest. Before, there was no way to updated the icon once it had been added. - -* And a slew of other similar benefits... - -If you’ve ever installed an Android app from a source other than the Play Store (or carriers/OEMs store) you know that you have to flip a switch in settings to allow installs from "untrusted sources". So, how then, you might ask, can they generate and install an actual `.apk` file for a PWA without requiring that you change that setting? As it turns out the answer is quite simple: Use a trusted source! - -> > As it turns out WebAPKs are managed through Google Play Services! - -I’m no rocket scientist, but based on their natural business alignment with the web, their promotion of PWAs, the lengths they’ve gone to to grant PWAs equal status on the operating system as native apps, it only seems natural that they’d eventually  _list them in the store_ . - -Additionally, if Google did start listing PWAs in the Play Store both them and Microsoft would be doing it  _leaving Apple sticking out like a sore thumb and looking like the laggard_ . Essentially, app developers would be able to target a  _massive_  number of users on a range of platforms with a single well-built PWA. But, just like developers grew to despise IE for not keeping up with the times and forcing them to jump through extra hoops to support it, the same thing would happen here. Apple does  _not_  want to be the next IE and I’ve already seen many prominent developers suggesting they already are. - -Which bring us to another forward-looking statement: - - [### 3\. PWAs on iOS][41] - -Just a few weeks ago the Safari folks announced that Service Worker is now [officially under development][23]. - - [### 4\. PWAs everywhere][42] - -I really think we’ll start seeing them everywhere: - -* Inside VR/AR/MR experiences - -* Inside chat bots (again, pulling up an ad-hoc interface is so much more efficient). - -* Inside Xbox?! - -As it turns out, if you look at Microsoft’s status page for Edge about Service Worker you see this: - -![](https://d33wubrfki0l68.cloudfront.net/6e28110b29d042e6472c3512748ecb9f541dcb67/a2b7d/images/2/edge.png) - -I hinted at this already, but I also think PWAs pair very nicely with virtual assistants being able to pull up an PWA on a whim without requiring it to already be installed would add tremendous power to the virtual assistant. Incidentally, this also becomes easier if there’s a known "registered" name of a PWA listed in an app store. - -Some other fun use cases: - -* Apparently the new digital menu displays in McDonald’s Restaurants (at least in the U.S.) are actually a web app built with Polymer ([source][15]). I don’t know if there’s a Service Worker or not, but it would make sense for there to be. - -* Sports score boards!? I’m a [independent consultant][16], and someone approached me about potentially using a set of TVs and web apps to build a score keeping system at an arena. Point is, there are so many cool examples! - -The web really is the universal platform! - - [### For those who think PWAs are just a Google thing][43] - -First off, I’m pretty sure Microsoft, Opera, Firefox, and Samsung folks would want to punch you for that. It [simply isn’t true][24] and increasingly we’re seeing a lot more compatibility efforts between browser vendors. - -For example: check out the [Web Platform Tests][25] which is essentially Continuous Integration for web features that are run against new releases of major browsers. Some folks will recall that when Apple first claimed they implemented IndexedDb in Safari, the version they shipped was essentially unusable because it had major shortcomings and bugs. - -Now, with the WPTs, you can drill into these features (to quite some detail) and see whether a given browser passes or fails. No more claiming "we shipped!" but not actually shipping. - - [### What about feature "x" on platform "y" that we need?][44] - -It could well be that you have a need that isn’t yet covered by the web platform. In reality, that list is getting shorter and shorter, also... HAVE YOU ASKED?! Despite what it may feel like, browser vendors eagerly want to know what you’re trying to do that you can’t. If there are missing features, be loud, be nice, but from my experience it’s worth making your desires known. - -Also, it doesn’t take much to wrap a web view and add hooks into the native OS that your JavaScript can call to do things that aren’t  _quite_  possible yet. - -But that also brings me to another point, in terms of investing, as the world’s greatest hockey player said: - -> Skate to where the puck is going, not where it has been. -> -> – Wayne Gretzky - -Based on what I’ve outlined thus far, it could be more risky to building an entire application for a whole other platform that you ultimately may not need than to at least exhaust your options seeing what you can do with the Web first. - -So to line ’em up in terms of PWA support: - -* Chrome: yup - -* Firefox: yup - -* Opera: yup - -* Samsung Internet ([the 3rd largest browser surprise!][17]): yup - -* Microsoft: huge public commitment - -* Safari: at least implementing Service Worker - - [### Ask them add your feature!][45] - -Sure, it may not happen, it may take a long time but  _at least_  try. Remember, developers have a lot more influence over platforms than we typically realize. Make. your. voice. heard. - - [### Side note about React-Native/Expo][46] - -These projects are run by awesome people, the tech is incredibly impressive. If you’re Facebook and you’re trying to consolidate your development efforts, for the same basic reasons as why it makes sense for them to create their on [VM for running PHP][26]. They have realities to deal with at a scale that most of us will never have to deal with. Personally, I’m not Facebook. - -As a side note, I find it interesting that building native apps and having as many people do that as possible, plays nicely into their advertising competition with Google. - -It just so happens that Google is well positioned to capitalize off of people using the Web. Inversely, I’m fairly certain Facebook wouldn’t mind that ad revenue  _not_  going Google. Facebook, seemingly would much rather  _be_  your web, that be part of the Web. - -Anyway, all that aside, for me it’s also about investing well. - -By building a native app you’re volunteering for a 30% app-store tax. Plus, like we covered earlier odds are that no one wants to go download your app. Also, though it seems incredibly unlikely, I feel compelled to point out that in terms of "openness" Apple’s App Store is very clearly  _anything_  but that. Apple could decide one day that they really don’t like how it’s possible to essentially circumvent their normal update/review process when you use Expo. One day they could just decide to reject all React Native apps. I really don’t think they would because of the uproar it would cause. I’m simply pointing out that it’s  _their_  platform and they would have  _every_  right to do so. - - [### So is it all about investing for your own gain?][47] - -So far, I’ve presented all this from kind of a cold, heartless investor perspective: getting the most for your time. - -But, that’s not the whole story is it? - -Life isn’t all about me. Life isn’t all about us. - -I want to invest in platforms that increase opportunities **for others**. Personally, I really hope the next friggin’ Mark Zuckerburg isn’t an ivy-league dude. Wouldn’t it be amazing if instead the next huge success was, I don’t know, perhaps a young woman in Nairobi or something? The thing is, if owning an iPhone is a prerequisite for building apps, it  _dramatically_  decreases the odds of something like that happening. I feel like the Web really is the closest thing we have to a level playing field. - -**I want to invest in and improve  _that_  platform!** - -This quote really struck me and has stayed with me when thinking about these things: - -> If you’re the kind of person who tends to succeed in what you start, -> -> changing what you start could be  _the most extraordinary thing_  you could do. -> -> – Anand Giridharadas - -Thanks for your valuable attention ❤️. I’ve presented the facts as I see them and I’ve done my best not to "should on you." - -Ultimately though, no matter how prepared we are or how much research we’ve done; investing is always a bit of a gamble. - -So I guess the only thing left to say is: - -> > I’m all in. - --------------------------------------------------------------------------------- - -via: https://joreteg.com/blog/betting-on-the-web - -作者:[Joreteg][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://joreteg.com/ -[1]:https://twitter.com/davidbrunelle -[2]:https://twitter.com/intent/tweet?in_reply_to=905931990444244995 -[3]:https://twitter.com/intent/retweet?tweet_id=905931990444244995 -[4]:https://twitter.com/intent/like?tweet_id=905931990444244995 -[5]:https://twitter.com/davidbrunelle/status/905931990444244995/photo/1 -[6]:https://twitter.com/davidbrunelle -[7]:https://twitter.com/Starbucks -[8]:https://t.co/tEUXM8BLgP -[9]:https://twitter.com/davidbrunelle/status/905931990444244995 -[10]:https://twitter.com/davidbrunelle/status/905931990444244995/photo/1 -[11]:https://support.twitter.com/articles/20175256 -[12]:https://2017.coldfront.co/ -[13]:https://qz.com/253618/most-smartphone-users-download-zero-apps-per-month/ -[14]:http://fortune.com/2016/05/19/app-economy/ -[15]:https://twitter.com/AJStacy06/status/857628546507968512 -[16]:http://consulting.joreteg.com/ -[17]:https://medium.com/samsung-internet-dev/think-you-know-the-top-web-browsers-458a0a070175 -[18]:https://preview.starbucks.com/ -[19]:https://google.github.io/physical-web/ -[20]:https://blogs.windows.com/msedgedev/2016/07/08/the-progress-of-web-apps/ -[21]:https://alistapart.com/article/yes-that-web-project-should-be-a-pwa -[22]:https://joreteg.com/blog/installing-web-apps-for-real -[23]:https://webkit.org/status/#specification-service-workers -[24]:https://jakearchibald.github.io/isserviceworkerready/ -[25]:http://wpt.fyi/ -[26]:http://hhvm.com/ -[27]:https://joreteg.com/blog/betting-on-the-web -[28]:https://joreteg.com/blog/betting-on-the-web#quotso-what-whats-your-pointquot -[29]:https://joreteg.com/blog/betting-on-the-web#with-all-investing-comes -[30]:https://joreteg.com/blog/betting-on-the-web#are-we-building-for-the-right-platform -[31]:https://joreteg.com/blog/betting-on-the-web#are-we-building-the-right-software -[32]:https://joreteg.com/blog/betting-on-the-web#should-we-be-building-apps-at-all -[33]:https://joreteg.com/blog/betting-on-the-web#if-apps-are-so-great-why-are-we-so-quotapped-outquot -[34]:https://joreteg.com/blog/betting-on-the-web#what-sucks-about-apps -[35]:https://joreteg.com/blog/betting-on-the-web#enter-pwas -[36]:https://joreteg.com/blog/betting-on-the-web#quick-pwa-primer -[37]:https://joreteg.com/blog/betting-on-the-web#lets-talk-internet-of-things -[38]:https://joreteg.com/blog/betting-on-the-web#forward-looking-statements -[39]:https://joreteg.com/blog/betting-on-the-web#1-pwa-only-startups -[40]:https://joreteg.com/blog/betting-on-the-web#2-pwas-listed-in-app-stores -[41]:https://joreteg.com/blog/betting-on-the-web#3-pwas-on-ios -[42]:https://joreteg.com/blog/betting-on-the-web#4-pwas-everywhere -[43]:https://joreteg.com/blog/betting-on-the-web#for-those-who-think-pwas-are-just-a-google-thing -[44]:https://joreteg.com/blog/betting-on-the-web#what-about-feature-quotxquot-on-platform-quotyquot-that-we-need -[45]:https://joreteg.com/blog/betting-on-the-web#ask-them-add-your-feature -[46]:https://joreteg.com/blog/betting-on-the-web#side-note-about-react-nativeexpo -[47]:https://joreteg.com/blog/betting-on-the-web#so-is-it-all-about-investing-for-your-own-gain diff --git a/sources/talk/20171129 Inside AGL Familiar Open Source Components Ease Learning Curve.md b/sources/talk/20171129 Inside AGL Familiar Open Source Components Ease Learning Curve.md deleted file mode 100644 index 9eee39888a..0000000000 --- a/sources/talk/20171129 Inside AGL Familiar Open Source Components Ease Learning Curve.md +++ /dev/null @@ -1,70 +0,0 @@ -Inside AGL: Familiar Open Source Components Ease Learning Curve -============================================================ - -![Matt Porter](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/porter-elce-agl.png?itok=E-5xG98S "Matt Porter") -Konsulko’s Matt Porter (pictured) and Scott Murray ran through the major components of the AGL’s Unified Code Base at Embedded Linux Conference Europe.[The Linux Foundation][1] - -Among the sessions at the recent [Embedded Linux Conference Europe (ELCE)][5] — 57 of which are [available on YouTube][2] -- are several reports on the Linux Foundation’s [Automotive Grade Linux project][6]. These include [an overview from AGL Community Manager Walt Miner ][3]showing how AGL’s Unified Code Base (UCB) Linux distribution is expanding from in-vehicle infotainment (IVI) to ADAS. There was even a presentation on using AGL to build a remote-controlled robot (see links below). - -Here we look at the “State of AGL: Plumbing and Services,” from Konsulko Group’s CTO Matt Porter and senior staff software engineer Scott Murray. Porter and Murray ran through the components of the current [UCB 4.0 “Daring Dab”][7] and detailed major upstream components and API bindings, many of which will be appear in the Electric Eel release due in Jan. 2018. - -Despite the automotive focus of the AGL stack, most of the components are already familiar to Linux developers. “It looks a lot like a desktop distro,” Porter told the ELCE attendees in Prague. “All these familiar friends.” - -Some of those friends include the underlying Yocto Project “Poky” with OpenEmbedded foundation, which is topped with layers like oe-core, meta-openembedded, and metanetworking. Other components are based on familiar open source software like systemd (application control), Wayland and Weston (graphics), BlueZ (Bluetooth), oFono (telephony), PulseAudio and ALSA (audio), gpsd (location), ConnMan (Internet), and wpa-supplicant (WiFi), among others. - -UCB’s application framework is controlled through a WebSocket interface to the API bindings, thereby enabling apps to talk to each other. There’s also a new W3C widget for an alternative application packaging scheme, as well as support for SmartDeviceLink, a technology developed at Ford that automatically syncs up IVI systems with mobile phones.  - -AGL UCB’s Wayland/Weston graphics layer is augmented with an “IVI shell” that works with the layer manager. “One of the unique requirements of automotive is the ability to separate aspects of the application in the layers,” said Porter. “For example, in a navigation app, the graphics rendering for the map may be completely different than the engine used for the UI decorations. One engine layers to a surface in Wayland to expose the map while the decorations and controls are handled by another layer.” - -For audio, ALSA and PulseAudio are joined by GENIVI AudioManager, which works together with PulseAudio. “We use AudioManager for policy driven audio routing,” explained Porter. “It allows you to write a very complex XML-based policy using a rules engine with audio routing.” - -UCB leans primarily on the well-known [Smack Project][8] for security, and also incorporates Tizen’s [Cynara][9] safe policy-checker service. A Cynara-enabled D-Bus daemon is used to control Cynara security policies. - -Porter and Murray went on to explain AGL’s API binding mechanism, which according to Murray “abstracts the UI from its back-end logic so you can replace it with your own custom UI.” You can re-use application logic with different UI implementations, such as moving from the default Qt to HTML5 or a native toolkit. Application binding requests and responses use JSON via HTTP or WebSocket. Binding calls can be made from applications or from other bindings, thereby enabling “stacking” of bindings. - -Porter and Murray concluded with a detailed description of each binding. These include upstream bindings currently in various stages of development. The first is a Master binding that manages the application lifecycle, including tasks such as install, uninstall, start, and terminate. Other upstream bindings include the WiFi binding and the BlueZ-based Bluetooth binding, which in the future will be upgraded with Bluetooth [PBAP][10] (Phone Book Access Profile). PBAP can connect with contacts databases on your phone, and links to the Telephony binding to replicate caller ID. - -The oFono-based Telephony binding also makes calls to the Bluetooth binding for Bluetooth Hands-Free-Profile (HFP) support. In the future, Telephony binding will add support for sent dial tones, call waiting, call forwarding, and voice modem support. - -Support for AM/FM radio is not well developed in the Linux world, so for its Radio binding, AGL started by supporting [RTL-SDR][11] code for low-end radio dongles. Future plans call for supporting specific automotive tuner devices. - -The MediaPlayer binding is in very early development, and is currently limited to GStreamer based audio playback and control. Future plans call for adding playlist controls, as well as one of the most actively sought features among manufacturers: video playback support. - -Location bindings include the [gpsd][12] based GPS binding, as well as GeoClue and GeoFence. GeoClue, which is built around the [GeoClue][13] D-Bus geolocation service, “overlaps a little with GPS, which uses the same location data,” says Porter. GeoClue also gathers location data from WiFi AP databases, 3G/4G tower info, and the GeoIP database — sources that are useful “if you’re inside or don’t have a good fix,” he added. - -GeoFence depends on the GPS binding, as well. It lets you establish a bounding box, and then track ingress and egress events. GeoFence also tracks “dwell” status, which is determined by arriving at home and staying for 10 minutes. “It then triggers some behavior based on a timeout,” said Porter. Future plans call for a customizable dwell transition time. - -While most of these Upstream bindings are well established, there are also Work in Progress (WIP) bindings that are still in the early stages, including CAN, HomeScreen, and WindowManager bindings. Farther out, there are plans to add speech recognition and text-to-speech bindings, as well as a WWAN modem binding. - -In conclusion, Porter noted: “Like any open source project, we desperately need more developers.” The Automotive Grade Linux project may seem peripheral to some developers, but it offers a nice mix of familiarity — grounded in many widely used open source projects -- along with the excitement of expanding into a new and potentially game changing computing form factor: your automobile. AGL has also demonstrated success — you can now [check out AGL in action in the 2018 Toyota Camry][14], followed in the coming month by most Toyota and Lexus vehicles sold in North America. - -Watch the complete video below: - -[视频][15] - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/event/elce/2017/11/inside-agl-familiar-open-source-components-ease-learning-curve - -作者:[ ERIC BROWN][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/ericstephenbrown -[1]:https://www.linux.com/licenses/category/linux-foundation -[2]:https://www.youtube.com/playlist?list=PLbzoR-pLrL6pISWAq-1cXP4_UZAyRtesk -[3]:https://www.youtube.com/watch?v=kfwEmjSjAzM&index=14&list=PLbzoR-pLrL6pISWAq-1cXP4_UZAyRtesk -[4]:https://www.linux.com/files/images/porter-elce-aglpng -[5]:http://events.linuxfoundation.org/events/embedded-linux-conference-europe -[6]:https://www.automotivelinux.org/ -[7]:https://www.linux.com/blog/2017/8/automotive-grade-linux-moves-ucb-40-launches-virtualization-workgroup -[8]:http://schaufler-ca.com/ -[9]:https://wiki.tizen.org/Security:Cynara -[10]:https://wiki.maemo.org/Bluetooth_PBAP -[11]:https://www.rtl-sdr.com/about-rtl-sdr/ -[12]:http://www.catb.org/gpsd/ -[13]:https://www.freedesktop.org/wiki/Software/GeoClue/ -[14]:https://www.linux.com/blog/event/automotive-linux-summit/2017/6/linux-rolls-out-toyota-and-lexus-vehicles -[15]:https://youtu.be/RgI-g5h1t8I diff --git a/sources/talk/20180104 How allowing myself to be vulnerable made me a better leader.md b/sources/talk/20180104 How allowing myself to be vulnerable made me a better leader.md deleted file mode 100644 index 1cd6a22162..0000000000 --- a/sources/talk/20180104 How allowing myself to be vulnerable made me a better leader.md +++ /dev/null @@ -1,64 +0,0 @@ -How allowing myself to be vulnerable made me a better leader -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/leaderscatalysts.jpg?itok=f8CwHiKm) - -Conventional wisdom suggests that leadership is strong, bold, decisive. In my experience, leadership does feel like that some days. - -Some days leadership feels more vulnerable. Doubts creep in: Am I making good decisions? Am I the right person for this job? Am I focusing on the most important things? - -The trick with these moments is to talk about these moments. When we keep them secret, our insecurity only grows. Being an open leader means pushing our vulnerability into the spotlight. Only then can we seek comfort from others who have experienced similar moments. - -To demonstrate how this works, I'll share a story. - -### A nagging question - -If you work in the tech industry, you'll note an obvious focus on creating [an organization that's inclusive][1]--a place for diversity to flourish. Long story short: I thought I was a "diversity hire," someone hired because of my gender, not my ability. Even after more than 15 years in the industry, with all of the focus on diversity in hiring, that possibility got under my skin. Along came the doubts: Was I hired because I was the best person for the job--or because I was a woman? After years of knowing I was hired because I was the best person, the fact that I was female suddenly seemed like it was more interesting to potential employers. - -I rationalized that it didn't matter why I was hired; I knew I was the best person for the job and would prove it. I worked hard, delivered results, made mistakes, learned, and did everything an employer would want from an employee. - -And yet the "diversity hire" question nagged. I couldn't shake it. I avoided the subject like the plague and realized that not talking about it was a signal that I had no choice but to deal with it. If I continued to avoid the subject, it was going to affect my work. And that's the last thing I wanted. - -### Speaking up - -Talking about diversity and inclusion can be awkward. So many factors enter into the decision to open up: - - * Can we trust our co-workers with a vulnerable moment? - * Can a leader of a team be too vulnerable? - * What if I overstep? Do I damage my career? - - - -In my case, I ended up at a lunch Q&A session with an executive who's a leader in many areas of the organization--especially candid conversations. A coworker asked the "Was I a diversity hire?" question. He stopped and spent a significant amount of time talking about this question to a room full of women. I'm not going to recount the entire discussion here; I will share the most salient point: If you know you're qualified for the job and you know the interview went well, don't doubt the outcome. Anyone who questions whether you're a diversity hire has their own questions to answer. You don't have to go on their journey. - -Mic drop. - -I wish I could say that I stopped thinking about this topic. I didn't. The question lingered: What if I am the exception to the rule? What if I was the one diversity hire? I realized that I couldn't avoid the nagging question. - -Because I had the courage to be vulnerable--to go there with my question--I had the burden of my secret question lifted. - -A few weeks later I had a one-on-one with the executive. At the end of conversation, I mentioned that, as a woman, I appreciate his candid conversations about diversity and inclusion. It's easier to talk about these topics when a recognized leader is willing to have the conversation. I also returned to the "Was I a diversity hire? question. He didn't hesitate: We talked. At the end of the conversation, I realized that I was hungry to talk about these things that require bravery; I only needed a nudge and someone who cared enough to talk and listen. - -Because I had the courage to be vulnerable--to go there with my question--I had the burden of my secret question lifted. Feeling physically lighter, I started to have constructive conversations around the questions of implicit bias, what we can do to be inclusive, and what diversity looks like. As I've learned, every person has a different answer when I ask the diversity question. I wouldn't have gotten to have all of these amazing conversations if I'd stayed stuck with my secret. - -I had courage to talk, and I hope you will too. - -Let's talk about these things that hold us back in terms of our ability to lead so we can be more open leaders in every sense of the phrase. Has allowing yourself to be vulnerable made you a better leader? - -### About The Author - -Angela Robertson;Angela Robertson Works As A Senior Manager At Microsoft. She Works With An Amazing Team Of People Passionate About Community Contributions;Engaged In Open Organizations. Before Joining Microsoft;Angela Worked At Red Hat - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/17/12/how-allowing-myself-be-vulnerable-made-me-better-leader - -作者:[Angela Robertson][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/arobertson98 -[1]:https://opensource.com/open-organization/17/9/building-for-inclusivity diff --git a/sources/talk/20180117 How technology changes the rules for doing agile.md b/sources/talk/20180117 How technology changes the rules for doing agile.md deleted file mode 100644 index 1b67935509..0000000000 --- a/sources/talk/20180117 How technology changes the rules for doing agile.md +++ /dev/null @@ -1,95 +0,0 @@ -How technology changes the rules for doing agile -====== - -![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO%20Containers%20Ecosystem.png?itok=lDTaYXzk) - -More companies are trying agile and [DevOps][1] for a clear reason: Businesses want more speed and more experiments - which lead to innovations and competitive advantage. DevOps helps you gain that speed. But doing DevOps in a small group or startup and doing it at scale are two very different things. Any of us who've worked in a cross-functional group of 10 people, come up with a great solution to a problem, and then tried to apply the same patterns across a team of 100 people know the truth: It often doesn't work. This path has been so hard, in fact, that it has been easy for IT leaders to put off agile methodology for another year. - -But that time is over. If you've tried and stalled, it's time to jump back in. - -Until now, DevOps required customized answers for many organizations - lots of tweaks and elbow grease. But today, [Linux containers ][2]and Kubernetes are fueling standardization of DevOps tools and processes. That standardization will only accelerate. The technology we are using to practice the DevOps way of working has finally caught up with our desire to move faster. - -Linux containers and [Kubernetes][3] are changing the way teams interact. Moreover, on the Kubernetes platform, you can run any application you now run on Linux. What does that mean? You can run a tremendous number of enterprise apps (and handle even previously vexing coordination issues between Windows and Linux.) Finally, containers and Kubernetes will handle almost all of what you'll run tomorrow. They're being future-proofed to handle machine learning, AI, and analytics workloads - the next wave of problem-solving tools. - -**[ See our related article,[4 container adoption patterns: What you need to know. ] ][4]** - -Think about machine learning, for example. Today, people still find the patterns in much of an enterprise's data. When machines find the patterns (think machine learning), your people will be able to act on them faster. With the addition of AI, machines can not only find but also act on patterns. Today, with people doing everything, three weeks is an aggressive software development sprint cycle. With AI, machines can change code multiple times per second. Startups will use that capability - to disrupt you. - -Consider how fast you have to be to compete. If you can't make a leap of faith now to DevOps and a one week cycle, think of what will happen when that startup points its AI-fueled process at you. It's time to move to the DevOps way of working now, or get left behind as your competitors do. - -### How are containers changing how teams work? - -DevOps has frustrated many groups trying to scale this way of working to a bigger group. Many IT (and business) people are suspicious of agile: They've heard it all before - languages, frameworks, and now models (like DevOps), all promising to revolutionize application development and IT process. - -**[ Want DevOps advice from other CIOs? See our comprehensive resource, [DevOps: The IT Leader's Guide][5]. ]** - -It's not easy to "sell" quick development sprints to your stakeholders, either. Imagine if you bought a house this way. You're not going to pay a fixed amount to your builder anymore. Instead, you get something like: "We'll pour the foundation in 4 weeks and it will cost x. Then we'll frame. Then we'll do electrical. But we only know the timing on the foundation right now." People are used to buying homes with a price up front and a schedule. - -The challenge is that building software is not like building a house. The same builder builds thousands of houses that are all the same. Software projects are never the same. This is your first hurdle to get past. - -Dev and operations teams really do work differently: I know because I've worked on both sides. We incent them differently. Developers are rewarded for changing and creating, while operations pros are rewarded for reducing cost and ensuring security. We put them in different groups and generally minimize interaction. And the roles typically attract technical people who think quite differently. This situation sets IT up to fail. You have to be willing to break down these barriers. - -Think of what has traditionally happened. You throw pieces over the wall, then the business throws requirements over the wall because they are operating in "house-buying" mode: "We'll see you in 9 months." Developers build to those requirements and make changes as needed for technical constraints. Then they throw it over the wall to operations to "figure out how to run this." Operations then works diligently to make a slew of changes to align the software with their infrastructure. And what's the end result? - -More often than not, the end result isn't even recognizable to the business when they see it in its final glory. We've watched this pattern play out time and time again in our industry for the better part of two decades. It's time for a change. - -It's Linux containers that truly crack the problem - because containers close the gap between development and operations. They allow both teams to understand and design to all of the critical requirements, but still uniquely fulfill their team's responsibilities. Basically, we take out the telephone game between developers and operations. With containers, we can have smaller operations teams, even teams responsible for millions of applications, but development teams that can change software as quickly as needed. (In larger organizations, the desired pace may be faster than humans can respond on the operations side.) - -With containers, you're separating what is delivered from where it runs. Your operations teams are responsible for the host that will run the containers and the security footprint, and that's all. What does this mean? - -First, it means you can get going on DevOps now, with the team you have. That's right. Keep teams focused on the expertise they already have: With containers, just teach them the bare minimum of the required integration dependencies. - -If you try and retrain everyone, no one will be that good at anything. Containers let teams interact, but alongside a strong boundary, built around each team's strengths. Your devs know what needs to be consumed, but don't need to know how to make it run at scale. Ops teams know the core infrastructure, but don't need to know the minutiae of the app. Also, Ops teams can update apps to address new security implications, before you become the next trending data breach story. - -Teaching a large IT organization of say 30,000 people both ops and devs skills? It would take you a decade. You don't have that kind of time. - -When people talk about "building new, cloud-native apps will get us out of this problem," think critically. You can build cloud-native apps in 10-person teams, but that doesn't scale for a Fortune 1000 company. You can't just build new microservices one by one until you're somehow not reliant on your existing team: You'll end up with a siloed organization. It's an alluring idea, but you can't count on these apps to redefine your business. I haven't met a company that could fund parallel development at this scale and succeed. IT budgets are already constrained; doubling or tripling them for an extended period of time just isn't realistic. - -### When the remarkable happens: Hello, velocity - -Linux containers were made to scale. Once you start to do so, [orchestration tools like Kubernetes come into play][6] - because you'll need to run thousands of containers. Applications won't consist of just a single container, they will depend on many different pieces, all running on containers, all running as a unit. If they don't, your apps won't run well in production. - -Think of how many small gears and levers come together to run your business: The same is true for any application. Developers are responsible for all the pulleys and levers in the application. (You could have an integration nightmare if developers don't own those pieces.) At the same time, your operations team is responsible for all the pulleys and levers that make up your infrastructure, whether on-premises or in the cloud. With Kubernetes as an abstraction, your operations team can give the application the fuel it needs to run - without being experts on all those pieces. - -Developers get to experiment. The operations team keeps infrastructure secure and reliable. This combination opens up the business to take small risks that lead to innovation. Instead of having to make only a couple of bet-the-farm size bets, real experimentation happens inside the company, incrementally and quickly. - -In my experience, this is where the remarkable happens inside organizations: Because people say "How do we change planning to actually take advantage of this ability to experiment?" It forces agile planning. - -For example, KeyBank, which uses a DevOps model, containers, and Kubernetes, now deploys code every day. (Watch this [video][7] in which John Rzeszotarski, director of Continuous Delivery and Feedback at KeyBank, explains the change.) Similarly, Macquarie Bank uses DevOps and containers to put something in production every day. - -Once you push software every day, it changes every aspect of how you plan - and [accelerates the rate of change to the business][8]. "An idea can get to a customer in a day," says Luis Uguina, CDO of Macquarie's banking and financial services group. (See this [case study][9] on Red Hat's work with Macquarie Bank). - -### The right time to build something great - -The Macquarie example demonstrates the power of velocity. How would that change your approach to your business? Remember, Macquarie is not a startup. This is the type of disruptive power that CIOs face, not only from new market entrants but also from established peers. - -The developer freedom also changes the talent equation for CIOs running agile shops. Suddenly, individuals within huge companies (even those not in the hottest industries or geographies) can have great impact. Macquarie uses this dynamic as a recruiting tool, promising developers that all new hires will push something live within the first week. - -At the same time, in this day of cloud-based compute and storage power, we have more infrastructure available than ever. That's fortunate, considering the [leaps that machine learning and AI tools will soon enable][10]. - -This all adds up to this being the right time to build something great. Given the pace of innovation in the market, you need to keep building great things to keep customers loyal. So if you've been waiting to place your bet on DevOps, now is the right time. Containers and Kubernetes have changed the rules - in your favor. - -**Want more wisdom like this, IT leaders? [Sign up for our weekly email newsletter][11].** - --------------------------------------------------------------------------------- - -via: https://enterprisersproject.com/article/2018/1/how-technology-changes-rules-doing-agile - -作者:[Matt Hicks][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://enterprisersproject.com/user/matt-hicks -[1]:https://enterprisersproject.com/tags/devops -[2]:https://www.redhat.com/en/topics/containers?intcmp=701f2000000tjyaAAA -[3]:https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA -[4]:https://enterprisersproject.com/article/2017/8/4-container-adoption-patterns-what-you-need-know?sc_cid=70160000000h0aXAAQ -[5]:https://enterprisersproject.com/devops?sc_cid=70160000000h0aXAAQ -[6]:https://enterprisersproject.com/article/2017/11/how-enterprise-it-uses-kubernetes-tame-container-complexity -[7]:https://www.redhat.com/en/about/videos/john-rzeszotarski-keybank-red-hat-summit-2017?intcmp=701f2000000tjyaAAA -[8]:https://enterprisersproject.com/article/2017/11/dear-cios-stop-beating-yourselves-being-behind-transformation -[9]:https://www.redhat.com/en/resources/macquarie-bank-case-study?intcmp=701f2000000tjyaAAA -[10]:https://enterprisersproject.com/article/2018/1/4-ai-trends-watch -[11]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ diff --git a/sources/talk/20180604 10 principles of resilience for women in tech.md b/sources/talk/20180604 10 principles of resilience for women in tech.md index e5d6b09401..be1960d0c9 100644 --- a/sources/talk/20180604 10 principles of resilience for women in tech.md +++ b/sources/talk/20180604 10 principles of resilience for women in tech.md @@ -1,4 +1,3 @@ -XYenChi is translating 10 principles of resilience for women in tech ====== diff --git a/sources/talk/20180629 Reflecting on the GPLv3 license for its 11th anniversary.md b/sources/talk/20180629 Reflecting on the GPLv3 license for its 11th anniversary.md deleted file mode 100644 index af352aefe1..0000000000 --- a/sources/talk/20180629 Reflecting on the GPLv3 license for its 11th anniversary.md +++ /dev/null @@ -1,65 +0,0 @@ -Reflecting on the GPLv3 license for its 11th anniversary -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_vaguepatent_520x292.png?itok=_zuxUwyt) - -Last year, I missed the opportunity to write about the 10th anniversary of [GPLv3][1], the third version of the GNU General Public License. GPLv3 was officially released by the Free Software Foundation (FSF) on June 29, 2007—better known in technology history as the date Apple launched the iPhone. Now, one year later, I feel some retrospection on GPLv3 is due. For me, much of what is interesting about GPLv3 goes back somewhat further than 11 years, to the public drafting process in which I was an active participant. - -In 2005, following nearly a decade of enthusiastic self-immersion in free software, yet having had little open source legal experience to speak of, I was hired by Eben Moglen to join the Software Freedom Law Center as counsel. SFLC was then outside counsel to the FSF, and my role was conceived as focusing on the incipient public phase of the GPLv3 drafting process. This opportunity rescued me from a previous career turn that I had found rather dissatisfying. Free and open source software (FOSS) legal matters would come to be my new specialty, one that I found fascinating, gratifying, and intellectually rewarding. My work at SFLC, and particularly the trial by fire that was my work on GPLv3, served as my on-the-job training. - -GPLv3 must be understood as the product of an earlier era of FOSS, the contours of which may be difficult for some to imagine today. By the beginning of the public drafting process in 2006, Linux and open source were no longer practically synonymous, as they might have been for casual observers several years earlier, but the connection was much closer than it is now. - -Reflecting the profound impact that Linux was already having on the technology industry, everyone assumed GPL version 2 was the dominant open source licensing model. We were seeing the final shakeout of a Cambrian explosion of open source (and pseudo-open source) business models. A frothy business-fueled hype surrounded open source (for me most memorably typified by the Open Source Business Conference) that bears little resemblance to the present-day embrace of open source development by the software engineering profession. Microsoft, with its expanding patent portfolio and its competitive opposition to Linux, was commonly seen in the FOSS community as an existential threat, and the [SCO litigation][2] had created a cloud of legal risk around Linux and the GPL that had not quite dissipated. - -That environment necessarily made the drafting of GPLv3 a high-stakes affair, unprecedented in free software history. Lawyers at major technology companies and top law firms scrambled for influence over the license, convinced that GPLv3 was bound to take over and thoroughly reshape open source and all its massive associated business investment. - -A similar mindset existed within the technical community; it can be detected in the fears expressed in the final paragraph of the Linux kernel developers' momentous September 2006 [denunciation][3] of GPLv3. Those of us close to the FSF knew a little better, but I think we assumed the new license would be either an overwhelming success or a resounding failure—where "success" meant something approximating an upgrade of the existing GPLv2 project ecosystem to GPLv3, though perhaps without the kernel. The actual outcome was something in the middle. - -I have no confidence in attempts to measure open source license adoption, which have in recent years typically been used to demonstrate a loss of competitive advantage for copyleft licensing. My own experience, which is admittedly distorted by proximity to Linux and my work at Red Hat, suggests that GPLv3 has enjoyed moderate popularity as a license choice for projects launched since 2007, though most GPLv2 projects that existed before 2007, along with their post-2007 offshoots, remained on the old license. (GPLv3's sibling licenses LGPLv3 and AGPLv3 never gained comparable popularity.) Most of the existing GPLv2 projects (with a few notable exceptions like the kernel and Busybox) were licensed as "GPLv2 or any later version." The technical community decided early on that "GPLv2 or later" was a politically neutral license choice that embraced both GPLv2 and GPLv3; this goes some way to explain why adoption of GPLv3 was somewhat gradual and limited, especially within the Linux community. - -During the GPLv3 drafting process, some expressed concerns about a "balkanized" Linux ecosystem, whether because of the overhead of users having to understand two different, strong copyleft licenses or because of GPLv2/GPLv3 incompatibility. These fears turned out to be entirely unfounded. Within mainstream server and workstation Linux stacks, the two licenses have peacefully coexisted for a decade now. This is partly because such stacks are made up of separate units of strong copyleft scope (see my discussion of [related issues in the container setting][4]). As for incompatibility inside units of strong copyleft scope, here, too, the prevalence of "GPLv2 or later" was seen by the technical community as neatly resolving the theoretical problem, despite the fact that nominal license upgrading of GPLv2-or-later to GPLv3 hardly ever occurred. - -I have alluded to the handwringing that some of us FOSS license geeks have brought to the topic of supposed copyleft decline. GPLv3 has taken its share of abuse from critics as far back as the beginning of the public drafting process, and some, predictably, have drawn a link between GPLv3 in particular and GPL or copyleft disfavor in general. - -I have viewed it somewhat differently: Largely because of its complexity and baroqueness, GPLv3 was a lost opportunity to create a strong copyleft license that would appeal very broadly to modern individual software authors and corporate licensors. I believe individual developers today tend to prefer short, simple, easy to understand, minimalist licenses, the most obvious example of which is the [MIT License][5]. - -Some corporate decisionmakers around open source license selection may naturally share that view, while others may associate some parts of GPLv3, such as the patent provisions or the anti-lockdown requirements, as too risky or incompatible with their business models. The great irony is that the characteristics of GPLv3 that fail to attract these groups are there in part because of conscious attempts to make the license appeal to these same sorts of interests. - -How did GPLv3 come to be so baroque? As I have said, GPLv3 was the product of an earlier time, in which FOSS licenses were viewed as the primary instruments of project governance. (Today, we tend to associate governance with other kinds of legal or quasi-legal tools, such as structuring of nonprofit organizations, rules around project decision making, codes of conduct, and contributor agreements.) - -GPLv3, in its drafting, was the high point of an optimistic view of FOSS licenses as ambitious means of private regulation. This was already true of GPLv2, but GPLv3 took things further by addressing in detail a number of new policy problems—software patents, anti-circumvention laws, device lockdown. That was bound to make the license longer and more complex than GPLv2, as the FSF and SFLC noted apologetically in the first GPLv3 [rationale document][6]. - -But a number of other factors at play in the drafting of GPLv3 unintentionally caused the complexity of the license to grow. Lawyers representing vendors' and commercial users' interests provided useful suggestions for improvements from a legal and commercial perspective, but these often took the form of making simply worded provisions more verbose, arguably without net increases in clarity. Responses to feedback from the technical community, typically identifying loopholes in license provisions, had a similar effect. - -The GPLv3 drafters also famously got entangled in a short-term political crisis—the controversial [Microsoft/Novell deal][7] of 2006—resulting in the permanent addition of new and unusual conditions in the patent section of the license, which arguably served little purpose after 2007 other than to make license compliance harder for conscientious patent-holding vendors. Of course, some of the complexity in GPLv3 was simply the product of well-intended attempts to make compliance easier, especially for community project developers, or to codify FSF interpretive practice. Finally, one can take issue with the style of language used in GPLv3, much of which had a quality of playful parody or mockery of conventional software license legalese; a simpler, straightforward form of phrasing would in many cases have been an improvement. - -The complexity of GPLv3 and the movement towards preferring brevity and simplicity in license drafting and unambitious license policy objectives meant that the substantive text of GPLv3 would have little direct influence on later FOSS legal drafting. But, as I noted with surprise and [delight][8] back in 2012, MPL 2.0 adapted two parts of GPLv3: the 30-day cure and 60-day repose language from the GPLv3 termination provision, and the assurance that downstream upgrading to a later license version adds no new obligations on upstream licensors. - -The GPLv3 cure language has come to have a major impact, particularly over the past year. Following the Software Freedom Conservancy's promulgation, with the FSF's support, of the [Principles of Community-Oriented GPL Enforcement][9], which calls for extending GPLv3 cure opportunities to GPLv2 violations, the Linux Foundation Technical Advisory Board published a [statement][10], endorsed by over a hundred Linux kernel developers, which incorporates verbatim the cure language of GPLv3. This in turn was followed by a Red Hat-led series of [corporate commitments][11] to extend the GPLv3 cure provisions to GPLv2 and LGPLv2.x noncompliance, a campaign to get individual open source developers to extend the same commitment, and an announcement by Red Hat that henceforth GPLv2 and LGPLv2.x projects it leads will use the commitment language directly in project repositories. I discussed these developments in a recent [blog post][12]. - -One lasting contribution of GPLv3 concerns changed expectations for how revisions of widely-used FOSS licenses are done. It is no longer acceptable for such licenses to be revised entirely in private, without opportunity for comment from the community and without efforts to consult key stakeholders. The drafting of MPL 2.0 and, more recently, EPL 2.0 reflects this new norm. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/gplv3-anniversary - -作者:[Richard Fontana][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/fontana -[1]:https://www.gnu.org/licenses/gpl-3.0.en.html -[2]:https://en.wikipedia.org/wiki/SCO%E2%80%93Linux_disputes -[3]:https://lwn.net/Articles/200422/ -[4]:https://opensource.com/article/18/1/containers-gpl-and-copyleft -[5]:https://opensource.org/licenses/MIT -[6]:http://gplv3.fsf.org/gpl-rationale-2006-01-16.html -[7]:https://en.wikipedia.org/wiki/Novell#Agreement_with_Microsoft -[8]:https://opensource.com/law/12/1/the-new-mpl -[9]:https://sfconservancy.org/copyleft-compliance/principles.html -[10]:https://www.kernel.org/doc/html/v4.16/process/kernel-enforcement-statement.html -[11]:https://www.redhat.com/en/about/press-releases/technology-industry-leaders-join-forces-increase-predictability-open-source-licensing -[12]:https://www.redhat.com/en/blog/gpl-cooperation-commitment-and-red-hat-projects?source=author&term=26851 diff --git a/sources/talk/20180720 A brief history of text-based games and open source.md b/sources/talk/20180720 A brief history of text-based games and open source.md deleted file mode 100644 index 2b8728fb39..0000000000 --- a/sources/talk/20180720 A brief history of text-based games and open source.md +++ /dev/null @@ -1,142 +0,0 @@ -A brief history of text-based games and open source -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/compass_map_explore_adventure.jpg?itok=ecCoVTrZ) - -The [Interactive Fiction Technology Foundation][1] (IFTF) is a non-profit organization dedicated to the preservation and improvement of technologies enabling the digital art form we call interactive fiction. When a Community Moderator for Opensource.com suggested an article about IFTF, the technologies and services it supports, and how it all intersects with open source, I found it a novel angle to the decades-long story I’ve so often told. The history of IF is longer than—but quite enmeshed with—the modern FOSS movement. I hope you’ll enjoy my sharing it here. - -### Definitions and history - -To me, the term interactive fiction includes any video game or digital artwork whose audience interacts with it primarily through text. The term originated in the 1980s when parser-driven text adventure games—epitomized in the United States by [Zork][2], [The Hitchhiker’s Guide to the Galaxy][3], and the rest of [Infocom][4]’s canon—defined home-computer entertainment. Its mainstream commercial viability had guttered by the 1990s, but online hobbyist communities carried on the tradition, releasing both games and game-creation tools. - -After a quarter century, interactive fiction now comprises a broad and sparkling variety of work, from puzzle-laden text adventures to sprawling and introspective hypertexts. Regular online competitions and festivals provide a great place to peruse and play new work: The English-language IF world enjoys annual events including [Spring Thing][5] and [IFComp][6], the latter a centerpiece of modern IF since 1995—which also makes it the longest-lived continually running game showcase event of its kind in any genre. [IFComp’s crop of judged-and-ranked entries from 2017][7] shows the amazing diversity in form, style, and subject matter that text-based games boast today. - -(I specify "English-language" above because IF communities tend to self-segregate by language, perhaps due to the technology's focus on writing. There are also annual IF events in [French][8] and [Italian][9], for example, and I've heard of at least one Chinese IF festival. Happily, these borders are porous; during the four years I managed IFComp, it has welcomed English-translated work from all international communities.) - -![counterfeit monkey game screenshot][11] - -Starting a new game of Emily Short's "Counterfeit Monkey," running on the interpreter Lectrote (both open source software). - -Also due to its focus on text, IF presents some of the most accessible platforms for both play and authorship. Almost anyone who can read digital text—including users of assistive technology such as text-to-speech software—can play most IF works. Likewise, IF creation is open to all writers willing to learn and work with its tools and techniques. - -This brings us to IF’s long relationship with open source, which has helped enable the art form’s availability since its commercial heyday. I'll provide an overview of contemporary open-source IF creation tools, and then discuss the ancient and sometimes curious tradition of IF works that share their source code. - -### The world of open source IF tools - -A number of development platforms, most of which are open source, are available to create traditional parser-driven IF in which the user types commands—for example, `go north,` `get lamp`, `pet the cat`, or `ask Zoe about quantum mechanics`—to interact with the game’s world. The early 1990s saw the emergence of several hacker-friendly parser-game development kits; those still in use today include [TADS][12], [Alan][13], and [Quest][14]—all open, with the latter two bearing FOSS licenses. - -But by far the most prominent of these is [Inform][15], first released by Graham Nelson in 1993 and now maintained by a team Nelson still leads. Inform source is semi-open, in an unusual fashion: Inform 6, the previous major version, [makes its source available through the Artistic License][16]. This has more immediate relevance than may be obvious, since the otherwise proprietary Inform 7 holds Inform 6 at its core, translating its [remarkable natural-language syntax][17] into its predecessor’s more C-like code before letting it compile the work down into machine code. - -![inform 7 IDE screenshot][19] - -The Inform 7 IDE, loaded up with documentation and a sample project. - -Inform games run on a virtual machine, a relic of the Infocom era when that publisher targeted a VM so that it could write a single game that would run on Apple II, Commodore 64, Atari 800, and other flavors of the "[home computer][20]." Fewer popular operating systems exist today, but Inform’s virtual machines—the relatively modern [Glulx][21] or the charmingly antique [Z-machine][22], a reverse-engineered clone of Infocom’s historical VM—let Inform-created work run on any computer with an Inform interpreter. Currently, popular cross-platform interpreters include desktop programs like [Lectrote][23] and [Gargoyle][24] or browser-based ones like [Quixe][25] and [Parchment][26]. All are open source. - -If the pace of Inform’s development has slowed in its maturity, it remains vital through an active and transparent ecosystem—just like any other popular open source project. In Inform’s case, this includes the aforementioned interpreters, [a collection of language extensions][27] (usually written in a mix of Inform 6 and 7), and of course, all the work created with it and shared with the world, sometimes with source included (I’ll return to that topic later in this article). - -IF creation tools invented in the 21st century tend to explore player interactions outside of the traditional parser, generating hypertext-driven work that any modern web browser can load. Chief among these is [Twine][28], originally developed by Chris Klimas in 2009 and under active development by many contributors today as [a GNU-licensed open source project][29]. (In fact, [Twine][30] can trace its OSS lineage back to [TiddlyWiki][31], the project from which Klimas initially derived it.) - -Twine represents a sort of maximally [open and accessible approach][30] to IF development: Beyond its own FOSS nature, it renders its output as self-contained websites, relying not on machine code requiring further specialized interpretation but the open and well-exercised standards of HTML, CSS, and JavaScript. As a creative tool, Twine can match its own exposed complexity to the creator’s skill level. Users with little or no programming knowledge can create simple but playable IF work, while those with more coding and design skills—including those developing these skills by making Twine games—can develop more sophisticated projects. Little wonder that Twine’s visibility and popularity in educational contexts has grown quite a bit in recent years. - -Other noteworthy open source IF development projects include the MIT-licensed [Undum][32] by Ian Millington, and [ChoiceScript][33] by Dan Fabulich and the [Choice of Games][34] team—both of which also target the web browser as the gameplay platform. Looking beyond strict development systems like these, web-based IF gives us a rich and ever-churning ecosystem of open source work, such as furkle’s [collection of Twine-extending tools][35] and Liza Daly’s [Windrift][36], a JavaScript framework purpose-built for her own IF games. - -### Programs, games, and game-programs - -Twine benefits from [a standing IFTF program dedicated to its support][37], allowing the public to help fund its maintenance and development. IFTF also directly supports two long-time public services, IFComp and the IF Archive, both of which depend upon and contribute back into open software and technologies. - -![Harmonia opening screen shot][39] - -The opening of Liza Daly's "Harmonia," created with the Windrift open source IF-creation framework. - -The Perl- and JavaScript-based application that runs the IFComp’s website has been [a shared-source project][40] since 2014, and it reflects [the stew of FOSS licenses used by its IF-specific sub-components][41], including the various code libraries that allow parser-driven competition entries to run in a web browser. [The IF Archive][42]—online since 1992 and [an IFTF project since 2017][43]—is a set of mirrored repositories based entirely on ancient and stable internet standards, with [a little open source Python script][44] to handle indexing. - -### At last, the fun part: Let's talk about open source text games - -The bulk of the archive [comprises games][45], of course—years and years of games, reflecting decades of evolving game-design trends and IF tool development. - -Lots of IF work shares its source code, and the community’s quick-start solution for finding it is simple: [Search the IFDB for the tag "source available"][46]. (The IFDB is yet another long-running IF community service, run privately by TADS creator Mike Roberts.) Users who are comfortable with a more bare-bones interface may also wish to browse [the `/games/source` directory][47] of the IF Archive, which groups content by development platform and written language (there's also a lot of work either too miscellaneous or too ancient to categorize floating at the top). - -A little bit of random sampling of these code-sharing games reveals an interesting dilemma: Unlike the wider world of open source software, the IF community lacks a generally agreed-upon way of licensing all the code that it generates. Unlike a software tool—including all the tools we use to build IF—an interactive fiction game is a work of art in the most literal sense, meaning that an open source license intended for software would fit it no better than it would any other work of prose or poetry. But then again, an IF game is also a piece of software, and it exhibits source-code patterns and techniques that its creator may legitimately wish to share with the world. What is an open source-aware IF creator to do? - -Some games address this by passing their code into the public domain, either through explicit license or—as in the case of [the original 42-year-old Adventure by Crowther and Woods][48]—through community fiat. Some try to split the difference, rolling their own license that allows for free re-use of a game’s exposed business logic but prohibits the creation of work derived specifically from its prose. This is the tack I took when I opened up the source of my own game, [The Warbler’s Nest][49]. Lord knows how well that’d stand up in court, but I didn’t have any better ideas at the time. - -Naturally, you can find work that simply puts everything under a single common license and never mind the naysayers. A prominent example is [Emily Short’s epic Counterfeit Monkey][50], released in its entirety under a Creative Commons 4.0 license. [CC frowns at its application to code][51], but you could argue that [the strangely prose-like nature of Inform 7 source][52] makes it at least a little more compatible with a CC license than a more traditional software project would be. - -### What now, adventurer? - -If you are eager to start exploring the world of interactive fiction, here are a few links to check out: - - -+ As mentioned above, IFDB and the IF Archive both present browsable interfaces to more than 40 years worth of collected interactive fiction work. Much of this is playable in a web browser, but some require additional interpreter programs. IFDB can help you find and install these. - - IFComp’s annual results pages provide another view into the best of this free and archive-available work. - -+ The Interactive Fiction Technology Foundation is a charitable non-profit organization that helps support Twine, IFComp, and the IF Archive, as well as improve the accessibility of IF, explore IF’s use in education, and more. Join its mailing list to receive IFTF’s monthly newsletter, peruse its blog, and browse some thematic merchandise. - -+ John Paul Wohlscheid wrote this article about open-source IF tools earlier this year. It covers some platforms not mentioned here, so if you’re still hungry for more, have a look. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/interactive-fiction-tools - -作者:[Jason Mclntosh][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/jmac -[1]:http://iftechfoundation.org/ -[2]:https://en.wikipedia.org/wiki/Zork -[3]:https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy_(video_game) -[4]:https://en.wikipedia.org/wiki/Infocom -[5]:http://www.springthing.net/ -[6]:http://ifcomp.org/ -[7]:https://ifcomp.org/comp/2017 -[8]:http://www.fiction-interactive.fr/ -[9]:http://www.oldgamesitalia.net/content/marmellata-davventura-2018 -[10]:/file/403396 -[11]:https://opensource.com/sites/default/files/uploads/monkey.png (counterfeit monkey game screenshot) -[12]:http://tads.org/ -[13]:https://www.alanif.se/ -[14]:http://textadventures.co.uk/quest/ -[15]:http://inform7.com/ -[16]:https://github.com/DavidKinder/Inform6 -[17]:http://inform7.com/learn/man/RB_4_1.html#e307 -[18]:/file/403386 -[19]:https://opensource.com/sites/default/files/uploads/inform.png (inform 7 IDE screenshot) -[20]:https://www.youtube.com/watch?v=bu55q_3YtOY -[21]:http://ifwiki.org/index.php/Glulx -[22]:http://ifwiki.org/index.php/Z-machine -[23]:https://github.com/erkyrath/lectrote -[24]:https://github.com/garglk/garglk/ -[25]:http://eblong.com/zarf/glulx/quixe/ -[26]:https://github.com/curiousdannii/parchment -[27]:https://github.com/i7/extensions -[28]:http://twinery.org/ -[29]:https://github.com/klembot/twinejs -[30]:/article/18/7/twine-vs-renpy-interactive-fiction -[31]:https://tiddlywiki.com/ -[32]:https://github.com/idmillington/undum -[33]:https://github.com/dfabulich/choicescript -[34]:https://www.choiceofgames.com/ -[35]:https://github.com/furkle -[36]:https://github.com/lizadaly/windrift -[37]:http://iftechfoundation.org/committees/twine/ -[38]:/file/403391 -[39]:https://opensource.com/sites/default/files/uploads/harmonia.png (Harmonia opening screen shot) -[40]:https://github.com/iftechfoundation/ifcomp -[41]:https://github.com/iftechfoundation/ifcomp/blob/master/LICENSE.md -[42]:https://www.ifarchive.org/ -[43]:http://blog.iftechfoundation.org/2017-06-30-iftf-is-adopting-the-if-archive.html -[44]:https://github.com/iftechfoundation/ifarchive-ifmap-py -[45]:https://www.ifarchive.org/indexes/if-archiveXgames -[46]:http://ifdb.tads.org/search?sortby=ratu&searchfor=%22source+available%22 -[47]:https://www.ifarchive.org/indexes/if-archiveXgamesXsource.html -[48]:http://ifdb.tads.org/viewgame?id=fft6pu91j85y4acv -[49]:https://github.com/jmacdotorg/warblers-nest/ -[50]:https://github.com/i7/counterfeit-monkey -[51]:https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software -[52]:https://github.com/i7/counterfeit-monkey/blob/master/Counterfeit%20Monkey.materials/Extensions/Counterfeit%20Monkey/Liquids.i7x diff --git a/sources/talk/20180818 What Did Ada Lovelace-s Program Actually Do.md b/sources/talk/20180818 What Did Ada Lovelace-s Program Actually Do.md index fc669a1a3c..8bbb651cfd 100644 --- a/sources/talk/20180818 What Did Ada Lovelace-s Program Actually Do.md +++ b/sources/talk/20180818 What Did Ada Lovelace-s Program Actually Do.md @@ -1,5 +1,3 @@ -Northurland Translating - What Did Ada Lovelace's Program Actually Do? ====== The story of Microsoft’s founding is one of the most famous episodes in computing history. In 1975, Paul Allen flew out to Albuquerque to demonstrate the BASIC interpreter that he and Bill Gates had written for the Altair microcomputer. Because neither of them had a working Altair, Allen and Gates tested their interpreter using an emulator that they wrote and ran on Harvard’s computer system. The emulator was based on nothing more than the published specifications for the Intel 8080 processor. When Allen finally ran their interpreter on a real Altair—in front of the person he and Gates hoped would buy their software—he had no idea if it would work. But it did. The next month, Allen and Gates officially founded their new company. diff --git a/sources/talk/20180904 How blockchain can complement open source.md b/sources/talk/20180904 How blockchain can complement open source.md deleted file mode 100644 index 7712539f3f..0000000000 --- a/sources/talk/20180904 How blockchain can complement open source.md +++ /dev/null @@ -1,95 +0,0 @@ -How blockchain can complement open source -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/block-quilt-chain.png?itok=mECoDbrc) - -[The Cathedral and The Bazaar][1] is a classic open source story, written 20 years ago by Eric Steven Raymond. In the story, Eric describes a new revolutionary software development model where complex software projects are built without (or with a very little) central management. This new model is open source. - -Eric's story compares two models: - - * The classic model (represented by the cathedral), in which software is crafted by a small group of individuals in a closed and controlled environment through slow and stable releases. - * And the new model (represented by the bazaar), in which software is crafted in an open environment where individuals can participate freely but still produce a stable and coherent system. - - - -Some of the reasons open source is so successful can be traced back to the founding principles Eric describes. Releasing early, releasing often, and accepting the fact that many heads are inevitably better than one allows open source projects to tap into the world’s pool of talent (and few companies can match that using the closed source model). - -Two decades after Eric's reflective analysis of the hacker community, we see open source becoming dominant. It is no longer a model only for scratching a developer’s personal itch, but instead, the place where innovation happens. Even the world's [largest][2] software companies are transitioning to this model in order to continue dominating. - -### A barter system - -If we look closely at how the open source model works in practice, we realize that it is a closed system, exclusive only to open source developers and techies. The only way to influence the direction of a project is by joining the open source community, understanding the written and the unwritten rules, learning how to contribute, the coding standards, etc., and doing it yourself. - -This is how the bazaar works, and it is where the barter system analogy comes from. A barter system is a method of exchanging services and goods in return for other services and goods. In the bazaar—where the software is built—that means in order to take something, you must also be a producer yourself and give something back in return. And that is by exchanging your time and knowledge for getting something done. A bazaar is a place where open source developers interact with other open source developers and produce open source software the open source way. - -The barter system is a great step forward and an evolution from the state of self-sufficiency where everybody must be a jack of all trades. The bazaar (open source model) using the barter system allows people with common interests and different skills to gather, collaborate, and create something that no individual can create on their own. The barter system is simple and lacks complex problems of the modern monetary systems, but it also has some limitations, such as: - - * Lack of divisibility: In the absence of a common medium of exchange, a large indivisible commodity/value cannot be exchanged for a smaller commodity/value. For example, if you want to do even a small change in an open source project, you may sometimes still need to go through a high entry barrier. - * Storing value: If a project is important to your company, you may want to have a large investment/commitment in it. But since it is a barter system among open source developers, the only way to have a strong say is by employing many open source committers, and that is not always possible. - * Transferring value: If you have invested in a project (trained employees, hired open source developers) and want to move focus to another project, it is not possible to transfer expertise, reputation, and influence quickly. - * Temporal decoupling: The barter system does not provide a good mechanism for deferred or advance commitments. In the open source world, that means a user cannot express commitment or interest in a project in a measurable way in advance, or continuously for future periods. - - - -Below, we will explore how to address these limitations using the back door to the bazaar. - -### A currency system - -People are hanging at the bazaar for different reasons: Some are there to learn, some are there to scratch a personal developer's itch, and some work for large software farms. Because the only way to have a say in the bazaar is to become part of the open source community and join the barter system, in order to gain credibility in the open source world, many large software companies employ these developers and pay them in monetary value. This represents the use of a currency system to influence the bazaar. Open source is no longer only for scratching the personal developer itch. It also accounts for a significant part of the overall software production worldwide, and there are many who want to have an influence. - -Open source sets the guiding principles through which developers interact and build a coherent system in a distributed way. It dictates how a project is governed, how software is built, and how the output distributed to users. It is an open consensus model for decentralized entities for building quality software together. But the open source model does not cover how open source is subsidized. Whether it is sponsored, directly or indirectly, through intrinsic or extrinsic motivators is irrelevant to the bazaar. - -![](https://opensource.com/sites/default/files/uploads/tokenomics_-_page_4.png) - -Currently, there is no equivalent of the decentralized open source development model for subsidization purposes. The majority of open source subsidization is centralized, where typically one company dominates a project by employing the majority of the open source developers of that project. And to be honest, this is currently the best-case scenario, as it guarantees that the developers will be paid for a long period and the project will continue to flourish. - -There are also exceptions for the project monopoly scenario: For example, some Cloud Native Computing Foundation projects are developed by a large number of competing companies. Also, the Apache Software Foundation aims for their projects not to be dominated by a single vendor by encouraging diverse contributors, but most of the popular projects, in reality, are still single-vendor projects. - -What we are missing is an open and decentralized model that works like the bazaar without a central coordination and ownership, where consumers (open source users) and producers (open source developers) interact with each other, driven by market forces and open source value. In order to complement open source, such a model must also be open and decentralized, and this is why I think the blockchain technology would [fit best here][3]. - -Most of the existing blockchain (and non-blockchain) platforms that aim to subsidize open source development are targeting primarily bug bounties, small and piecemeal tasks. A few also focus on funding new open source projects. But not many aim to provide mechanisms for sustaining continued development of open source projects—basically, a system that would emulate the behavior of an open source service provider company, or open core, open source-based SaaS product company: ensuring developers get continued and predictable incentives and guiding the project development based on the priorities of the incentivizers; i.e., the users. Such a model would address the limitations of the barter system listed above: - - * Allow divisibility: If you want something small fixed, you can pay a small amount rather than the full premium of becoming an open source developer for a project. - * Storing value: You can invest a large amount into a project and ensure both its continued development and that your voice is heard. - * Transferring value: At any point, you can stop investing in the project and move funds into other projects. - * Temporal decoupling: Allow regular recurring payments and subscriptions. - - - -There would be also other benefits, purely from the fact that such a blockchain-based system is transparent and decentralized: to quantify a project’s value/usefulness based on its users’ commitment, open roadmap commitment, decentralized decision making, etc. - -### Conclusion - -On the one hand, we see large companies hiring open source developers and acquiring open source startups and even foundational platforms (such as Microsoft buying GitHub). Many, if not most, long-running successful open source projects are centralized around a single vendor. The significance of open source and its centralization is a fact. - -On the other hand, the challenges around [sustaining open source][4] software are becoming more apparent, and many are investigating this space and its foundational issues more deeply. There are a few projects with high visibility and a large number of contributors, but there are also many other still-important projects that lack enough contributors and maintainers. - -There are [many efforts][3] trying to address the challenges of open source through blockchain. These projects should improve the transparency, decentralization, and subsidization and establish a direct link between open source users and developers. This space is still very young, but it is progressing quickly, and with time, the bazaar is going to have a cryptocurrency system. - -Given enough time and adequate technology, decentralization is happening at many levels: - - * The internet is a decentralized medium that has unlocked the world’s potential for sharing and acquiring knowledge. - * Open source is a decentralized collaboration model that has unlocked the world’s potential for innovation. - * Similarly, blockchain can complement open source and become the decentralized open source subsidization model. - - - -Follow me on [Twitter][5] for other posts in this space. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/barter-currency-system - -作者:[Bilgin lbryam][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/bibryam -[1]: http://catb.org/ -[2]: http://oss.cash/ -[3]: https://opensource.com/article/18/8/open-source-tokenomics -[4]: https://www.youtube.com/watch?v=VS6IpvTWwkQ -[5]: http://twitter.com/bibryam diff --git a/sources/talk/20180916 The Rise and Demise of RSS (Old Version).md b/sources/talk/20180916 The Rise and Demise of RSS (Old Version).md new file mode 100644 index 0000000000..b6e1a4fdd9 --- /dev/null +++ b/sources/talk/20180916 The Rise and Demise of RSS (Old Version).md @@ -0,0 +1,278 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Rise and Demise of RSS (Old Version)) +[#]: via: (https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +The Rise and Demise of RSS (Old Version) +====== + +_A newer version of this post was published on [December 18th, 2018][1]._ + +There are two stories here. The first is a story about a vision of the web’s future that never quite came to fruition. The second is a story about how a collaborative effort to improve a popular standard devolved into one of the most contentious forks in the history of open-source software development. + +In the late 1990s, in the go-go years between Netscape’s IPO and the Dot-com crash, everyone could see that the web was going to be an even bigger deal than it already was, even if they didn’t know exactly how it was going to get there. One theory was that the web was about to be revolutionized by syndication. The web, originally built to enable a simple transaction between two parties—a client fetching a document from a single host server—would be broken open by new standards that could be used to repackage and redistribute entire websites through a variety of channels. Kevin Werbach, writing for _Release 1.0_, a newsletter influential among investors in the 1990s, predicted that syndication “would evolve into the core model for the Internet economy, allowing businesses and individuals to retain control over their online personae while enjoying the benefits of massive scale and scope.”[1][2] He invited his readers to imagine a future in which fencing aficionados, rather than going directly to an “online sporting goods site” or “fencing equipment retailer,” could buy a new épée directly through e-commerce widgets embedded into their favorite website about fencing.[2][3] Just like in the television world, where big networks syndicate their shows to smaller local stations, syndication on the web would allow businesses and publications to reach consumers through a multitude of intermediary sites. This would mean, as a corollary, that consumers would gain significant control over where and how they interacted with any given business or publication on the web. + +RSS was one of the standards that promised to deliver this syndicated future. To Werbach, RSS was “the leading example of a lightweight syndication protocol.”[3][4] Another contemporaneous article called RSS the first protocol to realize the potential of XML.[4][5] It was going to be a way for both users and content aggregators to create their own customized channels out of everything the web had to offer. And yet, two decades later, RSS [appears to be a dying technology][6], now used chiefly by podcasters and programmers with tech blogs. Moreover, among that latter group, RSS is perhaps used as much for its political symbolism as its actual utility. Though of course some people really do have RSS readers, stubbornly adding an RSS feed to your blog, even in 2018, is a reactionary statement. That little tangerine bubble has become a wistful symbol of defiance against a centralized web increasingly controlled by a handful of corporations, a web that hardly resembles the syndicated web of Werbach’s imagining. + +The future once looked so bright for RSS. What happened? Was its downfall inevitable, or was it precipitated by the bitter infighting that thwarted the development of a single RSS standard? + +### Muddied Water + +RSS was invented twice. This meant it never had an obvious owner, a state of affairs that spawned endless debate and acrimony. But it also suggests that RSS was an important idea whose time had come. + +In 1998, Netscape was struggling to envision a future for itself. Its flagship product, the Netscape Navigator web browser—once preferred by 80% of web users—was quickly losing ground to Internet Explorer. So Netscape decided to compete in a new arena. In May, a team was brought together to start work on what was known internally as “Project 60.”[5][7] Two months later, Netscape announced “My Netscape,” a web portal that would fight it out with other portals like Yahoo, MSN, and Excite. + +The following year, in March, Netscape announced an addition to the My Netscape portal called the “My Netscape Network.” My Netscape users could now customize their My Netscape page so that it contained “channels” featuring the most recent headlines from sites around the web. As long as your favorite website published a special file in a format dictated by Netscape, you could add that website to your My Netscape page, typically by clicking an “Add Channel” button that participating websites were supposed to add to their interfaces. A little box containing a list of linked headlines would then appear. + +![A My Netscape Network Channel][8] + +The special file that participating websites had to publish was an RSS file. In the My Netscape Network announcement, Netscape explained that RSS stood for “RDF Site Summary.”[6][9] This was somewhat of a misnomer. RDF, or the Resource Description Framework, is basically a grammar for describing certain properties of arbitrary resources. (See [my article about the Semantic Web][10] if that sounds really exciting to you.) In 1999, a draft specification for RDF was being considered by the W3C. Though RSS was supposed to be based on RDF, the example RSS document Netscape actually released didn’t use any RDF tags at all, even if it declared the RDF XML namespace. In a document that accompanied the Netscape RSS specification, Dan Libby, one of the specification’s authors, explained that “in this release of MNN, Netscape has intentionally limited the complexity of the RSS format.”[7][11] The specification was given the 0.90 version number, the idea being that subsequent versions would bring RSS more in line with the W3C’s XML specification and the evolving draft of the RDF specification. + +RSS had been cooked up by Libby and another Netscape employee, Ramanathan Guha. Guha previously worked for Apple, where he came up with something called the Meta Content Framework. MCF was a format for representing metadata about anything from web pages to local files. Guha demonstrated its power by developing an application called [HotSauce][12] that visualized relationships between files as a network of nodes suspended in 3D space. After leaving Apple for Netscape, Guha worked with a Netscape consultant named Tim Bray to produce an XML-based version of MCF, which in turn became the foundation for the W3C’s RDF draft.[8][13] It’s no surprise, then, that Guha and Libby were keen to incorporate RDF into RSS. But Libby later wrote that the original vision for an RDF-based RSS was pared back because of time constraints and the perception that RDF was “‘too complex’ for the ‘average user.’”[9][14] + +While Netscape was trying to win eyeballs in what became known as the “portal wars,” elsewhere on the web a new phenomenon known as “weblogging” was being pioneered.[10][15] One of these pioneers was Dave Winer, CEO of a company called UserLand Software, which developed early content management systems that made blogging accessible to people without deep technical fluency. Winer ran his own blog, [Scripting News][16], which today is one of the oldest blogs on the internet. More than a year before Netscape announced My Netscape Network, on December 15th, 1997, Winer published a post announcing that the blog would now be available in XML as well as HTML.[11][17] + +Dave Winer’s XML format became known as the Scripting News format. It was supposedly similar to Microsoft’s Channel Definition Format (a “push technology” standard submitted to the W3C in March, 1997), but I haven’t been able to find a file in the original format to verify that claim.[12][18] Like Netscape’s RSS, it structured the content of Winer’s blog so that it could be understood by other software applications. When Netscape released RSS 0.90, Winer and UserLand Software began to support both formats. But Winer believed that Netscape’s format was “woefully inadequate” and “missing the key thing web writers and readers need.”[13][19] It could only represent a list of links, whereas the Scripting News format could represent a series of paragraphs, each containing one or more links. + +In June, 1999, two months after Netscape’s My Netscape Network announcement, Winer introduced a new version of the Scripting News format, called ScriptingNews 2.0b1. Winer claimed that he decided to move ahead with his own format only after trying but failing to get anyone at Netscape to care about RSS 0.90’s deficiencies.[14][20] The new version of the Scripting News format added several items to the `

` element that brought the Scripting News format to parity with RSS. But the two formats continued to differ in that the Scripting News format, which Winer nicknamed the “fat” syndication format, could include entire paragraphs and not just links. + +Netscape got around to releasing RSS 0.91 the very next month. The updated specification was a major about-face. RSS no longer stood for “RDF Site Summary”; it now stood for “Rich Site Summary.” All the RDF—and there was almost none anyway—was stripped out. Many of the Scripting News tags were incorporated. In the text of the new specification, Libby explained: + +> RDF references removed. RSS was originally conceived as a metadata format providing a summary of a website. Two things have become clear: the first is that providers want more of a syndication format than a metadata format. The structure of an RDF file is very precise and must conform to the RDF data model in order to be valid. This is not easily human-understandable and can make it difficult to create useful RDF files. The second is that few tools are available for RDF generation, validation and processing. For these reasons, we have decided to go with a standard XML approach.[15][21] + +Winer was enormously pleased with RSS 0.91, calling it “even better than I thought it would be.”[16][22] UserLand Software adopted it as a replacement for the existing ScriptingNews 2.0b1 format. For a while, it seemed that RSS finally had a single authoritative specification. + +### The Great Fork + +A year later, the RSS 0.91 specification had become woefully inadequate. There were all sorts of things people were trying to do with RSS that the specification did not address. There were other parts of the specification that seemed unnecessarily constraining—each RSS channel could only contain a maximum of 15 items, for example. + +By that point, RSS had been adopted by several more organizations. Other than Netscape, which seemed to have lost interest after RSS 0.91, the big players were Dave Winer’s UserLand Software; O’Reilly Net, which ran an RSS aggregator called Meerkat; and Moreover.com, which also ran an RSS aggregator focused on news.[17][23] Via mailing list, representatives from these organizations and others regularly discussed how to improve on RSS 0.91. But there were deep disagreements about what those improvements should look like. + +The mailing list in which most of the discussion occurred was called the Syndication mailing list. [An archive of the Syndication mailing list][24] is still available. It is an amazing historical resource. It provides a moment-by-moment account of how those deep disagreements eventually led to a political rupture of the RSS community. + +On one side of the coming rupture was Winer. Winer was impatient to evolve RSS, but he wanted to change it only in relatively conservative ways. In June, 2000, he published his own RSS 0.91 specification on the UserLand website, meant to be a starting point for further development of RSS. It made no significant changes to the 0.91 specification published by Netscape. Winer claimed in a blog post that accompanied his specification that it was only a “cleanup” documenting how RSS was actually being used in the wild, which was needed because the Netscape specification was no longer being maintained.[18][25] In the same post, he argued that RSS had succeeded so far because it was simple, and that by adding namespaces or RDF back to the format—some had suggested this be done in the Syndication mailing list—it “would become vastly more complex, and IMHO, at the content provider level, would buy us almost nothing for the added complexity.” In a message to the Syndication mailing list sent around the same time, Winer suggested that these issues were important enough that they might lead him to create a fork: + +> I’m still pondering how to move RSS forward. I definitely want ICE-like stuff in RSS2, publish and subscribe is at the top of my list, but I am going to fight tooth and nail for simplicity. I love optional elements. I don’t want to go down the namespaces and schema road, or try to make it a dialect of RDF. I understand other people want to do this, and therefore I guess we’re going to get a fork. I have my own opinion about where the other fork will lead, but I’ll keep those to myself for the moment at least.[19][26] + +Arrayed against Winer were several other people, including Rael Dornfest of O’Reilly, Ian Davis (responsible for a search startup called Calaba), and a precocious, 14-year-old Aaron Swartz, who all thought that RSS needed namespaces in order to accommodate the many different things everyone wanted to do with it. On another mailing list hosted by O’Reilly, Davis proposed a namespace-based module system, writing that such a system would “make RSS as extensible as we like rather than packing in new features that over-complicate the spec.”[20][27] The “namespace camp” believed that RSS would soon be used for much more than the syndication of blog posts, so namespaces, rather than being a complication, were the only way to keep RSS from becoming unmanageable as it supported more and more use cases. + +At the root of this disagreement about namespaces was a deeper disagreement about what RSS was even for. Winer had invented his Scripting News format to syndicate the posts he wrote for his blog. Guha and Libby at Netscape had designed RSS and called it “RDF Site Summary” because in their minds it was a way of recreating a site in miniature within Netscape’s online portal. Davis, writing to the Syndication mailing list, explained his view that RSS was “originally conceived as a way of building mini sitemaps,” and that now he and others wanted to expand RSS “to encompass more types of information than simple news headlines and to cater for the new uses of RSS that have emerged over the last 12 months.”[21][28] Winer wrote a prickly reply, stating that his Scripting News format was in fact the original RSS and that it had been meant for a different purpose. Given that the people most involved in the development of RSS disagreed about why RSS had even been created, a fork seems to have been inevitable. + +The fork happened after Dornfest announced a proposed RSS 1.0 specification and formed the RSS-DEV Working Group—which would include Davis, Swartz, and several others but not Winer—to get it ready for publication. In the proposed specification, RSS once again stood for “RDF Site Summary,” because RDF had had been added back in to represent metadata properties of certain RSS elements. The specification acknowledged Winer by name, giving him credit for popularizing RSS through his “evangelism.”[22][29] But it also argued that just adding more elements to RSS without providing for extensibility with a module system—that is, what Winer was suggesting—”sacrifices scalability.” The specification went on to define a module system for RSS based on XML namespaces. + +Winer was furious that the RSS-DEV Working Group had arrogated the “RSS 1.0” name for themselves.[23][30] In another mailing list about decentralization, he described what the RSS-DEV Working Group had done as theft.[24][31] Other members of the Syndication mailing list also felt that the RSS-DEV Working Group should not have used the name “RSS” without unanimous agreement from the community on how to move RSS forward. But the Working Group stuck with the name. Dan Brickley, another member of the RSS-DEV Working Group, defended this decision by arguing that “RSS 1.0 as proposed is solidly grounded in the original RSS vision, which itself had a long heritage going back to MCF (an RDF precursor) and related specs (CDF etc).”[25][32] He essentially felt that the RSS 1.0 effort had a better claim to the RSS name than Winer did, since RDF had originally been a part of RSS. The RSS-DEV Working Group published a final version of their specification in December. That same month, Winer published his own improvement to RSS 0.91, which he called RSS 0.92, on UserLand’s website. RSS 0.92 made several small optional improvements to RSS, among which was the addition of the `` tag soon used by podcasters everywhere. RSS had officially forked. + +It’s not clear to me why a better effort was not made to involve Winer in the RSS-DEV Working Group. He was a prominent contributor to the Syndication mailing list and obviously responsible for much of RSS’ popularity, as the members of the Working Group themselves acknowledged. But Tim O’Reilly, founder and CEO of O’Reilly, explained in a UserLand discussion group that Winer more or less refused to participate: + +> A group of people involved in RSS got together to start thinking about its future evolution. Dave was part of the group. When the consensus of the group turned in a direction he didn’t like, Dave stopped participating, and characterized it as a plot by O’Reilly to take over RSS from him, despite the fact that Rael Dornfest of O’Reilly was only one of about a dozen authors of the proposed RSS 1.0 spec, and that many of those who were part of its development had at least as long a history with RSS as Dave had.[26][33] + +To this, Winer said: + +> I met with Dale [Dougherty] two weeks before the announcement, and he didn’t say anything about it being called RSS 1.0. I spoke on the phone with Rael the Friday before it was announced, again he didn’t say that they were calling it RSS 1.0. The first I found out about it was when it was publicly announced. +> +> Let me ask you a straight question. If it turns out that the plan to call the new spec “RSS 1.0” was done in private, without any heads-up or consultation, or for a chance for the Syndication list members to agree or disagree, not just me, what are you going to do? +> +> UserLand did a lot of work to create and popularize and support RSS. We walked away from that, and let your guys have the name. That’s the top level. If I want to do any further work in Web syndication, I have to use a different name. Why and how did that happen Tim?[27][34] + +I have not been able to find a discussion in the Syndication mailing list about using the RSS 1.0 name prior to the announcement of the RSS 1.0 proposal. + +RSS would fork again in 2003, when several developers frustrated with the bickering in the RSS community sought to create an entirely new format. These developers created Atom, a format that did away with RDF but embraced XML namespaces. Atom would eventually be specified by [a proposed IETF standard][35]. After the introduction of Atom, there were three competing versions of RSS: Winer’s RSS 0.92 (updated to RSS 2.0 in 2002 and renamed “Really Simple Syndication”), the RSS-DEV Working Group’s RSS 1.0, and Atom. + +### Decline + +The proliferation of competing RSS specifications may have hampered RSS in other ways that I’ll discuss shortly. But it did not stop RSS from becoming enormously popular during the 2000s. By 2004, the New York Times had started offering its headlines in RSS and had written an article explaining to the layperson what RSS was and how to use it.[28][36] Google Reader, an RSS aggregator ultimately used by millions, was launched in 2005. By 2013, RSS seemed popular enough that the New York Times, in its obituary for Aaron Swartz, called the technology “ubiquitous.”[29][37] For a while, before a third of the planet had signed up for Facebook, RSS was simply how many people stayed abreast of news on the internet. + +The New York Times published Swartz’ obituary in January, 2013. By that point, though, RSS had actually turned a corner and was well on its way to becoming an obscure technology. Google Reader was shutdown in July, 2013, ostensibly because user numbers had been falling “over the years.”[30][38] This prompted several articles from various outlets declaring that RSS was dead. But people had been declaring that RSS was dead for years, even before Google Reader’s shuttering. Steve Gillmor, writing for TechCrunch in May, 2009, advised that “it’s time to get completely off RSS and switch to Twitter” because “RSS just doesn’t cut it anymore.”[31][39] He pointed out that Twitter was basically a better RSS feed, since it could show you what people thought about an article in addition to the article itself. It allowed you to follow people and not just channels. Gillmor told his readers that it was time to let RSS recede into the background. He ended his article with a verse from Bob Dylan’s “Forever Young.” + +Today, RSS is not dead. But neither is it anywhere near as popular as it once was. Lots of people have offered explanations for why RSS lost its broad appeal. Perhaps the most persuasive explanation is exactly the one offered by Gillmor in 2009. Social networks, just like RSS, provide a feed featuring all the latest news on the internet. Social networks took over from RSS because they were simply better feeds. They also provide more benefits to the companies that own them. Some people have accused Google, for example, of shutting down Google Reader in order to encourage people to use Google+. Google might have been able to monetize Google+ in a way that it could never have monetized Google Reader. Marco Arment, the creator of Instapaper, wrote on his blog in 2013: + +> Google Reader is just the latest casualty of the war that Facebook started, seemingly accidentally: the battle to own everything. While Google did technically “own” Reader and could make some use of the huge amount of news and attention data flowing through it, it conflicted with their far more important Google+ strategy: they need everyone reading and sharing everything through Google+ so they can compete with Facebook for ad-targeting data, ad dollars, growth, and relevance.[32][40] + +So both users and technology companies realized that they got more out of using social networks than they did out of RSS. + +Another theory is that RSS was always too geeky for regular people. Even the New York Times, which seems to have been eager to adopt RSS and promote it to its audience, complained in 2006 that RSS is a “not particularly user friendly” acronym coined by “computer geeks.”[33][41] Before the RSS icon was designed in 2004, websites like the New York Times linked to their RSS feeds using little orange boxes labeled “XML,” which can only have been intimidating.[34][42] The label was perfectly accurate though, because back then clicking the link would take a hapless user to a page full of XML. [This great tweet][43] captures the essence of this explanation for RSS’ demise. Regular people never felt comfortable using RSS; it hadn’t really been designed as a consumer-facing technology and involved too many hurdles; people jumped ship as soon as something better came along. + +RSS might have been able to overcome some of these limitations if it had been further developed. Maybe RSS could have been extended somehow so that friends subscribed to the same channel could syndicate their thoughts about an article to each other. But whereas a company like Facebook was able to “move fast and break things,” the RSS developer community was stuck trying to achieve consensus. The Great RSS Fork only demonstrates how difficult it was to do that. So if we are asking ourselves why RSS is no longer popular, a good first-order explanation is that social networks supplanted it. If we ask ourselves why social networks were able to supplant it, then the answer may be that the people trying to make RSS succeed faced a problem much harder than, say, building Facebook. As Dornfest wrote to the Syndication mailing list at one point, “currently it’s the politics far more than the serialization that’s far from simple.”[35][44] + +So today we are left with centralized silos of information. In a way, we _do_ have the syndicated internet that Kevin Werbach foresaw in 1999. After all, _The Onion_ is a publication that relies on syndication through Facebook and Twitter the same way that Seinfeld relied on syndication to rake in millions after the end of its original run. But syndication on the web only happens through one of a very small number of channels, meaning that none of us “retain control over our online personae” the way that Werbach thought we would. One reason this happened is garden-variety corporate rapaciousness—RSS, an open format, didn’t give technology companies the control over data and eyeballs that they needed to sell ads, so they did not support it. But the more mundane reason is that centralized silos are just easier to design than common standards. Consensus is difficult to achieve and it takes time, but without consensus spurned developers will go off and create competing standards. The lesson here may be that if we want to see a better, more open web, we have to get better at not screwing each other over. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][45] on Twitter or subscribe to the [RSS feed][46] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> New post: This week we're traveling back in time in our DeLorean to see what it was like learning to program on early home computers. +> +> — TwoBitHistory (@TwoBitHistory) [September 2, 2018][47] + + 1. Kevin Werbach, “The Web Goes into Syndication,” Release 1.0, July 22, 1999, 1, accessed September 14, 2018, . [↩︎][48] + + 2. ibid. [↩︎][49] + + 3. Werbach, 8. [↩︎][50] + + 4. Peter Wiggin, “RSS Delivers the XML Promise,” Web Review, October 29, 1999, accessed September 14, 2018, . [↩︎][51] + + 5. Ben Hammersley, RSS and Atom (O’Reilly), 8, accessed September 14, 2018, . [↩︎][52] + + 6. “RSS 0.90 Specification,” RSS Advisory Board, accessed September 14, 2018, . [↩︎][53] + + 7. “My Netscape Network Future Directions,” RSS Advisory Board, accessed September 14, 2018, . [↩︎][54] + + 8. Tim Bray, “The RDF.net Challenge,” Ongoing by Tim Bray, May 21, 2003, accessed September 14, 2018, . [↩︎][55] + + 9. Dan Libby, “RSS: Introducing Myself,” August 24, 2000, RSS-DEV Mailing List, accessed September 14, 2018, . [↩︎][56] + + 10. Alexandra Krasne, “Browser Wars May Become Portal Wars,” CNN, accessed September 14, 2018, . [↩︎][57] + + 11. Dave Winer, “Scripting News in XML,” Scripting News, December 15, 1997, accessed September 14, 2018, . [↩︎][58] + + 12. Joseph Reagle, “RSS History,” 2004, accessed September 14, 2018, . [↩︎][59] + + 13. Dave Winer, “A Faceoff with Netscape,” Scripting News, June 16, 1999, accessed September 14, 2018, . [↩︎][60] + + 14. ibid. [↩︎][61] + + 15. Dan Libby, “RSS 0.91 Specification (Netscape),” RSS Advisory Board, accessed September 14, 2018, . [↩︎][62] + + 16. Dave Winer, “Scripting News: 7/28/1999,” Scripting News, July 28, 1999, accessed September 14, 2018, . [↩︎][63] + + 17. Oliver Willis, “RSS Aggregators?” June 19, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][64] + + 18. Dave Winer, “Scripting News: 07/07/2000,” Scripting News, July 07, 2000, accessed September 14, 2018, . [↩︎][65] + + 19. Dave Winer, “Re: RSS 0.91 Restarted,” June 9, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][66] + + 20. Leigh Dodds, “RSS Modularization,” XML.com, July 5, 2000, accessed September 14, 2018, . [↩︎][67] + + 21. Ian Davis, “Re: [syndication] RSS Modularization Demonstration,” June 28, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][68] + + 22. “RDF Site Summary (RSS) 1.0,” December 09, 2000, accessed September 14, 2018, . [↩︎][69] + + 23. Dave Winer, “Re: [syndication] Re: Thoughts, Questions, and Issues,” August 16, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][70] + + 24. Mark Pilgrim, “History of the RSS Fork,” Dive into Mark, September 5, 2002, accessed September 14, 2018, . [↩︎][71] + + 25. Dan Brickley, “RSS-Classic, RSS 1.0 and a Historical Debt,” November 7, 2000, Syndication Mailing List, accessed September 14, 2018, . [↩︎][72] + + 26. Tim O’Reilly, “Re: Asking Tim,” UserLand, September 20, 2000, accessed September 14, 2018, . [↩︎][73] + + 27. Dave Winer, “Re: Asking Tim,” UserLand, September 20, 2000, accessed September 14, 2018, . [↩︎][74] + + 28. John Quain, “BASICS; Fine-Tuning Your Filter for Online Information,” The New York Times, 2004, accessed September 14, 2018, . [↩︎][75] + + 29. John Schwartz, “Aaron Swartz, Internet Activist, Dies at 26,” The New York Times, January 12, 2013, accessed September 14, 2018, . [↩︎][76] + + 30. “A Second Spring of Cleaning,” Official Google Blog, March 13, 2013, accessed September 14, 2018, . [↩︎][77] + + 31. Steve Gillmor, “Rest in Peace, RSS,” TechCrunch, May 5, 2009, accessed September 14, 2018, . [↩︎][78] + + 32. Marco Arment, “Lockdown,” Marco.org, July 3, 2013, accessed September 14, 2018, . [↩︎][79] + + 33. Bob Tedeschi, “There’s a Popular New Code for Deals: RSS,” The New York Times, January 29, 2006, accessed September 14, 2018, . [↩︎][80] + + 34. “NYTimes.com RSS Feeds,” The New York Times, accessed September 14, 2018, . [↩︎][81] + + 35. Rael Dornfest, “RE: Re: [syndication] RE: RFC: Clearing Confusion for RSS, Agreement for Forward Motion,” May 31, 2001, Syndication Mailing List, accessed September 14, 2018, . [↩︎][82] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html + +作者:[Two-Bit History][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://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://twobithistory.org/2018/12/18/rss.html +[2]: tmp.F599d8dnXW#fn:3 +[3]: tmp.F599d8dnXW#fn:4 +[4]: tmp.F599d8dnXW#fn:5 +[5]: tmp.F599d8dnXW#fn:6 +[6]: https://trends.google.com/trends/explore?date=all&geo=US&q=rss +[7]: tmp.F599d8dnXW#fn:7 +[8]: https://twobithistory.org/images/mnn-channel.gif +[9]: tmp.F599d8dnXW#fn:8 +[10]: https://twobithistory.org/2018/05/27/semantic-web.html +[11]: tmp.F599d8dnXW#fn:9 +[12]: http://web.archive.org/web/19970703020212/http://mcf.research.apple.com:80/hs/screen_shot.html +[13]: tmp.F599d8dnXW#fn:10 +[14]: tmp.F599d8dnXW#fn:11 +[15]: tmp.F599d8dnXW#fn:12 +[16]: http://scripting.com/ +[17]: tmp.F599d8dnXW#fn:13 +[18]: tmp.F599d8dnXW#fn:14 +[19]: tmp.F599d8dnXW#fn:15 +[20]: tmp.F599d8dnXW#fn:16 +[21]: tmp.F599d8dnXW#fn:17 +[22]: tmp.F599d8dnXW#fn:18 +[23]: tmp.F599d8dnXW#fn:19 +[24]: https://groups.yahoo.com/neo/groups/syndication/info +[25]: tmp.F599d8dnXW#fn:20 +[26]: tmp.F599d8dnXW#fn:21 +[27]: tmp.F599d8dnXW#fn:22 +[28]: tmp.F599d8dnXW#fn:23 +[29]: tmp.F599d8dnXW#fn:24 +[30]: tmp.F599d8dnXW#fn:25 +[31]: tmp.F599d8dnXW#fn:26 +[32]: tmp.F599d8dnXW#fn:27 +[33]: tmp.F599d8dnXW#fn:28 +[34]: tmp.F599d8dnXW#fn:29 +[35]: https://tools.ietf.org/html/rfc4287 +[36]: tmp.F599d8dnXW#fn:30 +[37]: tmp.F599d8dnXW#fn:31 +[38]: tmp.F599d8dnXW#fn:32 +[39]: tmp.F599d8dnXW#fn:33 +[40]: tmp.F599d8dnXW#fn:34 +[41]: tmp.F599d8dnXW#fn:35 +[42]: tmp.F599d8dnXW#fn:36 +[43]: https://twitter.com/mgsiegler/status/311992206716203008 +[44]: tmp.F599d8dnXW#fn:37 +[45]: https://twitter.com/TwoBitHistory +[46]: https://twobithistory.org/feed.xml +[47]: https://twitter.com/TwoBitHistory/status/1036295112375115778?ref_src=twsrc%5Etfw +[48]: tmp.F599d8dnXW#fnref:3 +[49]: tmp.F599d8dnXW#fnref:4 +[50]: tmp.F599d8dnXW#fnref:5 +[51]: tmp.F599d8dnXW#fnref:6 +[52]: tmp.F599d8dnXW#fnref:7 +[53]: tmp.F599d8dnXW#fnref:8 +[54]: tmp.F599d8dnXW#fnref:9 +[55]: tmp.F599d8dnXW#fnref:10 +[56]: tmp.F599d8dnXW#fnref:11 +[57]: tmp.F599d8dnXW#fnref:12 +[58]: tmp.F599d8dnXW#fnref:13 +[59]: tmp.F599d8dnXW#fnref:14 +[60]: tmp.F599d8dnXW#fnref:15 +[61]: tmp.F599d8dnXW#fnref:16 +[62]: tmp.F599d8dnXW#fnref:17 +[63]: tmp.F599d8dnXW#fnref:18 +[64]: tmp.F599d8dnXW#fnref:19 +[65]: tmp.F599d8dnXW#fnref:20 +[66]: tmp.F599d8dnXW#fnref:21 +[67]: tmp.F599d8dnXW#fnref:22 +[68]: tmp.F599d8dnXW#fnref:23 +[69]: tmp.F599d8dnXW#fnref:24 +[70]: tmp.F599d8dnXW#fnref:25 +[71]: tmp.F599d8dnXW#fnref:26 +[72]: tmp.F599d8dnXW#fnref:27 +[73]: tmp.F599d8dnXW#fnref:28 +[74]: tmp.F599d8dnXW#fnref:29 +[75]: tmp.F599d8dnXW#fnref:30 +[76]: tmp.F599d8dnXW#fnref:31 +[77]: tmp.F599d8dnXW#fnref:32 +[78]: tmp.F599d8dnXW#fnref:33 +[79]: tmp.F599d8dnXW#fnref:34 +[80]: tmp.F599d8dnXW#fnref:35 +[81]: tmp.F599d8dnXW#fnref:36 +[82]: tmp.F599d8dnXW#fnref:37 diff --git a/sources/talk/20180916 The Rise and Demise of RSS.md b/sources/talk/20180916 The Rise and Demise of RSS.md deleted file mode 100644 index 8511d220d9..0000000000 --- a/sources/talk/20180916 The Rise and Demise of RSS.md +++ /dev/null @@ -1,122 +0,0 @@ -The Rise and Demise of RSS -====== -There are two stories here. The first is a story about a vision of the web’s future that never quite came to fruition. The second is a story about how a collaborative effort to improve a popular standard devolved into one of the most contentious forks in the history of open-source software development. - -In the late 1990s, in the go-go years between Netscape’s IPO and the Dot-com crash, everyone could see that the web was going to be an even bigger deal than it already was, even if they didn’t know exactly how it was going to get there. One theory was that the web was about to be revolutionized by syndication. The web, originally built to enable a simple transaction between two parties—a client fetching a document from a single host server—would be broken open by new standards that could be used to repackage and redistribute entire websites through a variety of channels. Kevin Werbach, writing for Release 1.0, a newsletter influential among investors in the 1990s, predicted that syndication “would evolve into the core model for the Internet economy, allowing businesses and individuals to retain control over their online personae while enjoying the benefits of massive scale and scope.” He invited his readers to imagine a future in which fencing aficionados, rather than going directly to an “online sporting goods site” or “fencing equipment retailer,” could buy a new épée directly through e-commerce widgets embedded into their favorite website about fencing. Just like in the television world, where big networks syndicate their shows to smaller local stations, syndication on the web would allow businesses and publications to reach consumers through a multitude of intermediary sites. This would mean, as a corollary, that consumers would gain significant control over where and how they interacted with any given business or publication on the web. - -RSS was one of the standards that promised to deliver this syndicated future. To Werbach, RSS was “the leading example of a lightweight syndication protocol.” Another contemporaneous article called RSS the first protocol to realize the potential of XML. It was going to be a way for both users and content aggregators to create their own customized channels out of everything the web had to offer. And yet, two decades later, RSS [appears to be a dying technology][1], now used chiefly by podcasters and programmers with tech blogs. Moreover, among that latter group, RSS is perhaps used as much for its political symbolism as its actual utility. Though of course some people really do have RSS readers, stubbornly adding an RSS feed to your blog, even in 2018, is a reactionary statement. That little tangerine bubble has become a wistful symbol of defiance against a centralized web increasingly controlled by a handful of corporations, a web that hardly resembles the syndicated web of Werbach’s imagining. - -The future once looked so bright for RSS. What happened? Was its downfall inevitable, or was it precipitated by the bitter infighting that thwarted the development of a single RSS standard? - -### Muddied Water - -RSS was invented twice. This meant it never had an obvious owner, a state of affairs that spawned endless debate and acrimony. But it also suggests that RSS was an important idea whose time had come. - -In 1998, Netscape was struggling to envision a future for itself. Its flagship product, the Netscape Navigator web browser—once preferred by 80% of web users—was quickly losing ground to Internet Explorer. So Netscape decided to compete in a new arena. In May, a team was brought together to start work on what was known internally as “Project 60.” Two months later, Netscape announced “My Netscape,” a web portal that would fight it out with other portals like Yahoo, MSN, and Excite. - -The following year, in March, Netscape announced an addition to the My Netscape portal called the “My Netscape Network.” My Netscape users could now customize their My Netscape page so that it contained “channels” featuring the most recent headlines from sites around the web. As long as your favorite website published a special file in a format dictated by Netscape, you could add that website to your My Netscape page, typically by clicking an “Add Channel” button that participating websites were supposed to add to their interfaces. A little box containing a list of linked headlines would then appear. - -![A My Netscape Network Channel][2] - -The special file that participating websites had to publish was an RSS file. In the My Netscape Network announcement, Netscape explained that RSS stood for “RDF Site Summary.” This was somewhat of a misnomer. RDF, or the Resource Description Framework, is basically a grammar for describing certain properties of arbitrary resources. (See [my article about the Semantic Web][3] if that sounds really exciting to you.) In 1999, a draft specification for RDF was being considered by the W3C. Though RSS was supposed to be based on RDF, the example RSS document Netscape actually released didn’t use any RDF tags at all, even if it declared the RDF XML namespace. In a document that accompanied the Netscape RSS specification, Dan Libby, one of the specification’s authors, explained that “in this release of MNN, Netscape has intentionally limited the complexity of the RSS format.” The specification was given the 0.90 version number, the idea being that subsequent versions would bring RSS more in line with the W3C’s XML specification and the evolving draft of the RDF specification. - -RSS had been cooked up by Libby and another Netscape employee, Ramanathan Guha. Guha previously worked for Apple, where he came up with something called the Meta Content Framework. MCF was a format for representing metadata about anything from web pages to local files. Guha demonstrated its power by developing an application called [HotSauce][4] that visualized relationships between files as a network of nodes suspended in 3D space. After leaving Apple for Netscape, Guha worked with a Netscape consultant named Tim Bray to produce an XML-based version of MCF, which in turn became the foundation for the W3C’s RDF draft. It’s no surprise, then, that Guha and Libby were keen to incorporate RDF into RSS. But Libby later wrote that the original vision for an RDF-based RSS was pared back because of time constraints and the perception that RDF was “‘too complex’ for the ‘average user.’” - -While Netscape was trying to win eyeballs in what became known as the “portal wars,” elsewhere on the web a new phenomenon known as “weblogging” was being pioneered. One of these pioneers was Dave Winer, CEO of a company called UserLand Software, which developed early content management systems that made blogging accessible to people without deep technical fluency. Winer ran his own blog, [Scripting News][5], which today is one of the oldest blogs on the internet. More than a year before Netscape announced My Netscape Network, on December 15th, 1997, Winer published a post announcing that the blog would now be available in XML as well as HTML. - -Dave Winer’s XML format became known as the Scripting News format. It was supposedly similar to Microsoft’s Channel Definition Format (a “push technology” standard submitted to the W3C in March, 1997), but I haven’t been able to find a file in the original format to verify that claim. Like Netscape’s RSS, it structured the content of Winer’s blog so that it could be understood by other software applications. When Netscape released RSS 0.90, Winer and UserLand Software began to support both formats. But Winer believed that Netscape’s format was “woefully inadequate” and “missing the key thing web writers and readers need.” It could only represent a list of links, whereas the Scripting News format could represent a series of paragraphs, each containing one or more links. - -In June, 1999, two months after Netscape’s My Netscape Network announcement, Winer introduced a new version of the Scripting News format, called ScriptingNews 2.0b1. Winer claimed that he decided to move ahead with his own format only after trying but failing to get anyone at Netscape to care about RSS 0.90’s deficiencies. The new version of the Scripting News format added several items to the `
` element that brought the Scripting News format to parity with RSS. But the two formats continued to differ in that the Scripting News format, which Winer nicknamed the “fat” syndication format, could include entire paragraphs and not just links. - -Netscape got around to releasing RSS 0.91 the very next month. The updated specification was a major about-face. RSS no longer stood for “RDF Site Summary”; it now stood for “Rich Site Summary.” All the RDF—and there was almost none anyway—was stripped out. Many of the Scripting News tags were incorporated. In the text of the new specification, Libby explained: - -> RDF references removed. RSS was originally conceived as a metadata format providing a summary of a website. Two things have become clear: the first is that providers want more of a syndication format than a metadata format. The structure of an RDF file is very precise and must conform to the RDF data model in order to be valid. This is not easily human-understandable and can make it difficult to create useful RDF files. The second is that few tools are available for RDF generation, validation and processing. For these reasons, we have decided to go with a standard XML approach. - -Winer was enormously pleased with RSS 0.91, calling it “even better than I thought it would be.” UserLand Software adopted it as a replacement for the existing ScriptingNews 2.0b1 format. For a while, it seemed that RSS finally had a single authoritative specification. - -### The Great Fork - -A year later, the RSS 0.91 specification had become woefully inadequate. There were all sorts of things people were trying to do with RSS that the specification did not address. There were other parts of the specification that seemed unnecessarily constraining—each RSS channel could only contain a maximum of 15 items, for example. - -By that point, RSS had been adopted by several more organizations. Other than Netscape, which seemed to have lost interest after RSS 0.91, the big players were Dave Winer’s UserLand Software; O’Reilly Net, which ran an RSS aggregator called Meerkat; and Moreover.com, which also ran an RSS aggregator focused on news. Via mailing list, representatives from these organizations and others regularly discussed how to improve on RSS 0.91. But there were deep disagreements about what those improvements should look like. - -The mailing list in which most of the discussion occurred was called the Syndication mailing list. [An archive of the Syndication mailing list][6] is still available. It is an amazing historical resource. It provides a moment-by-moment account of how those deep disagreements eventually led to a political rupture of the RSS community. - -On one side of the coming rupture was Winer. Winer was impatient to evolve RSS, but he wanted to change it only in relatively conservative ways. In June, 2000, he published his own RSS 0.91 specification on the UserLand website, meant to be a starting point for further development of RSS. It made no significant changes to the 0.91 specification published by Netscape. Winer claimed in a blog post that accompanied his specification that it was only a “cleanup” documenting how RSS was actually being used in the wild, which was needed because the Netscape specification was no longer being maintained. In the same post, he argued that RSS had succeeded so far because it was simple, and that by adding namespaces or RDF back to the format—some had suggested this be done in the Syndication mailing list—it “would become vastly more complex, and IMHO, at the content provider level, would buy us almost nothing for the added complexity.” In a message to the Syndication mailing list sent around the same time, Winer suggested that these issues were important enough that they might lead him to create a fork: - -> I’m still pondering how to move RSS forward. I definitely want ICE-like stuff in RSS2, publish and subscribe is at the top of my list, but I am going to fight tooth and nail for simplicity. I love optional elements. I don’t want to go down the namespaces and schema road, or try to make it a dialect of RDF. I understand other people want to do this, and therefore I guess we’re going to get a fork. I have my own opinion about where the other fork will lead, but I’ll keep those to myself for the moment at least. - -Arrayed against Winer were several other people, including Rael Dornfest of O’Reilly, Ian Davis (responsible for a search startup called Calaba), and a precocious, 14-year-old Aaron Swartz, who all thought that RSS needed namespaces in order to accommodate the many different things everyone wanted to do with it. On another mailing list hosted by O’Reilly, Davis proposed a namespace-based module system, writing that such a system would “make RSS as extensible as we like rather than packing in new features that over-complicate the spec.” The “namespace camp” believed that RSS would soon be used for much more than the syndication of blog posts, so namespaces, rather than being a complication, were the only way to keep RSS from becoming unmanageable as it supported more and more use cases. - -At the root of this disagreement about namespaces was a deeper disagreement about what RSS was even for. Winer had invented his Scripting News format to syndicate the posts he wrote for his blog. Guha and Libby at Netscape had designed RSS and called it “RDF Site Summary” because in their minds it was a way of recreating a site in miniature within Netscape’s online portal. Davis, writing to the Syndication mailing list, explained his view that RSS was “originally conceived as a way of building mini sitemaps,” and that now he and others wanted to expand RSS “to encompass more types of information than simple news headlines and to cater for the new uses of RSS that have emerged over the last 12 months.” Winer wrote a prickly reply, stating that his Scripting News format was in fact the original RSS and that it had been meant for a different purpose. Given that the people most involved in the development of RSS disagreed about why RSS had even been created, a fork seems to have been inevitable. - -The fork happened after Dornfest announced a proposed RSS 1.0 specification and formed the RSS-DEV Working Group—which would include Davis, Swartz, and several others but not Winer—to get it ready for publication. In the proposed specification, RSS once again stood for “RDF Site Summary,” because RDF had had been added back in to represent metadata properties of certain RSS elements. The specification acknowledged Winer by name, giving him credit for popularizing RSS through his “evangelism.” But it also argued that just adding more elements to RSS without providing for extensibility with a module system—that is, what Winer was suggesting—”sacrifices scalability.” The specification went on to define a module system for RSS based on XML namespaces. - -Winer was furious that the RSS-DEV Working Group had arrogated the “RSS 1.0” name for themselves. In another mailing list about decentralization, he described what the RSS-DEV Working Group had done as theft. Other members of the Syndication mailing list also felt that the RSS-DEV Working Group should not have used the name “RSS” without unanimous agreement from the community on how to move RSS forward. But the Working Group stuck with the name. Dan Brickley, another member of the RSS-DEV Working Group, defended this decision by arguing that “RSS 1.0 as proposed is solidly grounded in the original RSS vision, which itself had a long heritage going back to MCF (an RDF precursor) and related specs (CDF etc).” He essentially felt that the RSS 1.0 effort had a better claim to the RSS name than Winer did, since RDF had originally been a part of RSS. The RSS-DEV Working Group published a final version of their specification in December. That same month, Winer published his own improvement to RSS 0.91, which he called RSS 0.92, on UserLand’s website. RSS 0.92 made several small optional improvements to RSS, among which was the addition of the `` tag soon used by podcasters everywhere. RSS had officially forked. - -It’s not clear to me why a better effort was not made to involve Winer in the RSS-DEV Working Group. He was a prominent contributor to the Syndication mailing list and obviously responsible for much of RSS’ popularity, as the members of the Working Group themselves acknowledged. But Tim O’Reilly, founder and CEO of O’Reilly, explained in a UserLand discussion group that Winer more or less refused to participate: - -> A group of people involved in RSS got together to start thinking about its future evolution. Dave was part of the group. When the consensus of the group turned in a direction he didn’t like, Dave stopped participating, and characterized it as a plot by O’Reilly to take over RSS from him, despite the fact that Rael Dornfest of O’Reilly was only one of about a dozen authors of the proposed RSS 1.0 spec, and that many of those who were part of its development had at least as long a history with RSS as Dave had. - -To this, Winer said: - -> I met with Dale [Dougherty] two weeks before the announcement, and he didn’t say anything about it being called RSS 1.0. I spoke on the phone with Rael the Friday before it was announced, again he didn’t say that they were calling it RSS 1.0. The first I found out about it was when it was publicly announced. -> -> Let me ask you a straight question. If it turns out that the plan to call the new spec “RSS 1.0” was done in private, without any heads-up or consultation, or for a chance for the Syndication list members to agree or disagree, not just me, what are you going to do? -> -> UserLand did a lot of work to create and popularize and support RSS. We walked away from that, and let your guys have the name. That’s the top level. If I want to do any further work in Web syndication, I have to use a different name. Why and how did that happen Tim? - -I have not been able to find a discussion in the Syndication mailing list about using the RSS 1.0 name prior to the announcement of the RSS 1.0 proposal. - -RSS would fork again in 2003, when several developers frustrated with the bickering in the RSS community sought to create an entirely new format. These developers created Atom, a format that did away with RDF but embraced XML namespaces. Atom would eventually be specified by [a proposed IETF standard][7]. After the introduction of Atom, there were three competing versions of RSS: Winer’s RSS 0.92 (updated to RSS 2.0 in 2002 and renamed “Really Simple Syndication”), the RSS-DEV Working Group’s RSS 1.0, and Atom. - -### Decline - -The proliferation of competing RSS specifications may have hampered RSS in other ways that I’ll discuss shortly. But it did not stop RSS from becoming enormously popular during the 2000s. By 2004, the New York Times had started offering its headlines in RSS and had written an article explaining to the layperson what RSS was and how to use it. Google Reader, an RSS aggregator ultimately used by millions, was launched in 2005. By 2013, RSS seemed popular enough that the New York Times, in its obituary for Aaron Swartz, called the technology “ubiquitous.” For a while, before a third of the planet had signed up for Facebook, RSS was simply how many people stayed abreast of news on the internet. - -The New York Times published Swartz’ obituary in January, 2013. By that point, though, RSS had actually turned a corner and was well on its way to becoming an obscure technology. Google Reader was shutdown in July, 2013, ostensibly because user numbers had been falling “over the years.” This prompted several articles from various outlets declaring that RSS was dead. But people had been declaring that RSS was dead for years, even before Google Reader’s shuttering. Steve Gillmor, writing for TechCrunch in May, 2009, advised that “it’s time to get completely off RSS and switch to Twitter” because “RSS just doesn’t cut it anymore.” He pointed out that Twitter was basically a better RSS feed, since it could show you what people thought about an article in addition to the article itself. It allowed you to follow people and not just channels. Gillmor told his readers that it was time to let RSS recede into the background. He ended his article with a verse from Bob Dylan’s “Forever Young.” - -Today, RSS is not dead. But neither is it anywhere near as popular as it once was. Lots of people have offered explanations for why RSS lost its broad appeal. Perhaps the most persuasive explanation is exactly the one offered by Gillmor in 2009. Social networks, just like RSS, provide a feed featuring all the latest news on the internet. Social networks took over from RSS because they were simply better feeds. They also provide more benefits to the companies that own them. Some people have accused Google, for example, of shutting down Google Reader in order to encourage people to use Google+. Google might have been able to monetize Google+ in a way that it could never have monetized Google Reader. Marco Arment, the creator of Instapaper, wrote on his blog in 2013: - -> Google Reader is just the latest casualty of the war that Facebook started, seemingly accidentally: the battle to own everything. While Google did technically “own” Reader and could make some use of the huge amount of news and attention data flowing through it, it conflicted with their far more important Google+ strategy: they need everyone reading and sharing everything through Google+ so they can compete with Facebook for ad-targeting data, ad dollars, growth, and relevance. - -So both users and technology companies realized that they got more out of using social networks than they did out of RSS. - -Another theory is that RSS was always too geeky for regular people. Even the New York Times, which seems to have been eager to adopt RSS and promote it to its audience, complained in 2006 that RSS is a “not particularly user friendly” acronym coined by “computer geeks.” Before the RSS icon was designed in 2004, websites like the New York Times linked to their RSS feeds using little orange boxes labeled “XML,” which can only have been intimidating. The label was perfectly accurate though, because back then clicking the link would take a hapless user to a page full of XML. [This great tweet][8] captures the essence of this explanation for RSS’ demise. Regular people never felt comfortable using RSS; it hadn’t really been designed as a consumer-facing technology and involved too many hurdles; people jumped ship as soon as something better came along. - -RSS might have been able to overcome some of these limitations if it had been further developed. Maybe RSS could have been extended somehow so that friends subscribed to the same channel could syndicate their thoughts about an article to each other. But whereas a company like Facebook was able to “move fast and break things,” the RSS developer community was stuck trying to achieve consensus. The Great RSS Fork only demonstrates how difficult it was to do that. So if we are asking ourselves why RSS is no longer popular, a good first-order explanation is that social networks supplanted it. If we ask ourselves why social networks were able to supplant it, then the answer may be that the people trying to make RSS succeed faced a problem much harder than, say, building Facebook. As Dornfest wrote to the Syndication mailing list at one point, “currently it’s the politics far more than the serialization that’s far from simple.” - -So today we are left with centralized silos of information. In a way, we do have the syndicated internet that Kevin Werbach foresaw in 1999. After all, The Onion is a publication that relies on syndication through Facebook and Twitter the same way that Seinfeld relied on syndication to rake in millions after the end of its original run. But syndication on the web only happens through one of a very small number of channels, meaning that none of us “retain control over our online personae” the way that Werbach thought we would. One reason this happened is garden-variety corporate rapaciousness—RSS, an open format, didn’t give technology companies the control over data and eyeballs that they needed to sell ads, so they did not support it. But the more mundane reason is that centralized silos are just easier to design than common standards. Consensus is difficult to achieve and it takes time, but without consensus spurned developers will go off and create competing standards. The lesson here may be that if we want to see a better, more open web, we have to get better at not screwing each other over. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][9] on Twitter or subscribe to the [RSS feed][10] to make sure you know when a new post is out. - -Previously on TwoBitHistory… - -> New post: This week we're traveling back in time in our DeLorean to see what it was like learning to program on early home computers. -> -> — TwoBitHistory (@TwoBitHistory) [September 2, 2018][11] - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2018/09/16/the-rise-and-demise-of-rss.html - -作者:[Two-Bit History][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://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://trends.google.com/trends/explore?date=all&geo=US&q=rss -[2]: https://twobithistory.org/images/mnn-channel.gif -[3]: https://twobithistory.org/2018/05/27/semantic-web.html -[4]: http://web.archive.org/web/19970703020212/http://mcf.research.apple.com:80/hs/screen_shot.html -[5]: http://scripting.com/ -[6]: https://groups.yahoo.com/neo/groups/syndication/info -[7]: https://tools.ietf.org/html/rfc4287 -[8]: https://twitter.com/mgsiegler/status/311992206716203008 -[9]: https://twitter.com/TwoBitHistory -[10]: https://twobithistory.org/feed.xml -[11]: https://twitter.com/TwoBitHistory/status/1036295112375115778?ref_src=twsrc%5Etfw diff --git a/sources/talk/20181024 Why it matters that Microsoft released old versions of MS-DOS as open source.md b/sources/talk/20181024 Why it matters that Microsoft released old versions of MS-DOS as open source.md deleted file mode 100644 index 3129e4b6f0..0000000000 --- a/sources/talk/20181024 Why it matters that Microsoft released old versions of MS-DOS as open source.md +++ /dev/null @@ -1,74 +0,0 @@ -Why it matters that Microsoft released old versions of MS-DOS as open source -====== - -Microsoft's release of MS-DOS 1.25 and 2.0 on GitHub adopts an open source license that's compatible with GNU GPL. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) - -One open source software project I work on is the FreeDOS Project. It's a complete, free, DOS-compatible operating system that you can use to play classic DOS games, run legacy business software, or develop embedded systems. Any program that works on MS-DOS should also run on FreeDOS. - -So I took notice when Microsoft recently released the source code to MS-DOS 1.25 and 2.0 via a [GitHub repository][1]. This is a huge step for Microsoft, and I’d like to briefly explain why it is significant. - -### MS-DOS as open source software - -Some open source fans may recall that this is not the first time Microsoft has officially released the MS-DOS source code. On March 25, 2014, Microsoft posted the source code to MS-DOS 1.1 and 2.0 via the [Computer History Museum][2]. Unfortunately, this source code was released under a “look but do not touch” license that limited what you could do with it. According to the license from the 2014 source code release, users were barred from re-using it in other projects and could use it “[solely for non-commercial research, experimentation, and educational purposes.][3]” - -The museum license wasn’t friendly to open source software, and as a result, the MS-DOS source code was ignored. On the FreeDOS Project, we interpreted the “look but do not touch” license as a potential risk to FreeDOS, so we decided developers who had viewed the MS-DOS source code could not contribute to FreeDOS. - -But Microsoft’s recent MS-DOS source code release represents a significant change. This MS-DOS source code uses the MIT License (also called the Expat License). Quoting Microsoft’s [LICENSE.md][4] file on GitHub: - -> ## MS-DOS v1.25 and v2.0 Source Code -> -> Copyright © Microsoft Corporation. -> -> All rights reserved. -> -> MIT License. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,TORT OR OTHERWISE, ARISING FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -If that text looks familiar to you, it is because that’s the same text as the MIT License recognized by the [Open Source Initiative][5]. It’s also the same as the Expat License recognized by the [Free Software Foundation][6]. - -The Free Software Foundation (via GNU) says the Expat License is compatible with the [GNU General Public License][7]. Specifically, GNU describes the Expat License as “a lax, permissive non-copyleft free software license, compatible with the GNU GPL. It is sometimes ambiguously referred to as the MIT License.” Also according to GNU, when they say a license is [compatible with the GNU GPL][8], “you can combine code released under the other license [MIT/Expat License] with code released under the GNU GPL in one larger program.” - -Microsoft’s use of the MIT/Expat License for the original MS-DOS source code is significant because the license is not only open source software but free software. - -### What does it mean? - -This is great, but there’s a practical side to the source code release. You might think, “If Microsoft has released the MS-DOS source code under a license compatible with the GNU GPL, will that help FreeDOS?” - -Not really. Here's why: FreeDOS started from an original source code base, independent from MS-DOS. Certain functions and behaviors of MS-DOS were identified and documented in the comprehensive [Interrupt List by Ralf Brown][9], and we provided MS-DOS compatibility in FreeDOS by referencing the Interrupt List. But many significant fundamental technical differences remain between FreeDOS and MS-DOS. For example, FreeDOS uses a completely different memory structure and memory layout. You can’t simply forklift MS-DOS source code into FreeDOS and expect it to work. The code assumptions are quite different. - -There’s also the simple matter that these are very old versions of MS-DOS. For example, MS-DOS 2.0 was the first version to support directories and redirection. But these versions of MS-DOS did not yet include more advanced features, including networking, CDROM support, and ’386 support such as EMM386. These features have been standard in FreeDOS for a long time. - -So the MS-DOS source code release is interesting, but FreeDOS would not be able to reuse this code for any modern features anyway. FreeDOS has already surpassed these versions of MS-DOS in functionality and features. - -### Congratulations - -Still, it’s important to recognize the big step that Microsoft has taken in releasing these versions of MS-DOS as open source software. The new MS-DOS source code release on GitHub does away with the restrictive license from 2014 and adopts a recognized open source software license that is compatible with the GNU GPL. Congratulations to Microsoft for releasing MS-DOS 1.25 and 2.0 under an open source license! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/10/microsoft-open-source-old-versions-ms-dos - -作者:[Jim Hall][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/jim-hall -[b]: https://github.com/lujun9972 -[1]: https://github.com/Microsoft/MS-DOS -[2]: http://www.computerhistory.org/press/ms-source-code.html -[3]: http://www.computerhistory.org/atchm/microsoft-research-license-agreement-msdos-v1-1-v2-0/ -[4]: https://github.com/Microsoft/MS-DOS/blob/master/LICENSE.md -[5]: https://opensource.org/licenses/MIT -[6]: https://directory.fsf.org/wiki/License:Expat -[7]: https://www.gnu.org/licenses/license-list.en.html#Expat -[8]: https://www.gnu.org/licenses/gpl-faq.html#WhatDoesCompatMean -[9]: http://www.cs.cmu.edu/~ralf/files.html diff --git a/sources/talk/20181218 The Rise and Demise of RSS.md b/sources/talk/20181218 The Rise and Demise of RSS.md index e260070c5c..2dfea2074c 100644 --- a/sources/talk/20181218 The Rise and Demise of RSS.md +++ b/sources/talk/20181218 The Rise and Demise of RSS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md b/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md deleted file mode 100644 index 78922f9525..0000000000 --- a/sources/talk/20190108 NSA to Open Source its Reverse Engineering Tool GHIDRA.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (NSA to Open Source its Reverse Engineering Tool GHIDRA) -[#]: via: (https://itsfoss.com/nsa-ghidra-open-source) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -NSA to Open Source its Reverse Engineering Tool GHIDRA -====== - -GHIDRA – NSA’s reverse engineering tool is getting ready for a free public release this March at the [RSA Conference 2019][1] to be held in San Francisco. - -The National Security Agency (NSA) did not officially announce this – however – a senior NSA advisor, Robert Joyce’s [session description][2] on the official RSA conference website revealed about it before any official statement or announcement. - -Here’s what it mentioned: - -![][3] -Image Credits: [Twitter][4] - -In case the text in the image isn’t properly visible, let me quote the description here: - -> NSA has developed a software reverse engineering framework known as GHIDRA, which will be demonstrated for the first time at RSAC 2019. An interactive GUI capability enables reverse engineers to leverage an integrated set of features that run on a variety of platforms including Windows, Mac OS, and Linux and supports a variety of processor instruction sets. The GHISDRA platform includes all the features expected in high-end commercial tools, with new and expanded functionality NSA uniquely developed. and will be released for free public use at RSA. - -### What is GHIDRA? - -GHIDRA is a software reverse engineering framework developed by [NSA][5] that is in use by the agency for more than a decade. - -Basically, a software reverse engineering tool helps to dig up the source code of a proprietary program which further gives you the ability to detect virus threats or potential bugs. You should read how [reverse engineering][6] works to know more. - -The tool is is written in Java and quite a few people compared it to high-end commercial reverse engineering tools available like [IDA][7]. - -A [Reddit thread][8] involves more detailed discussion where you will find some ex-employees giving good amount of details before the availability of the tool. - -![NSA open source][9] - -### GHIDRA was a secret tool, how do we know about it? - -The existence of the tool was uncovered in a series of leaks by [WikiLeaks][10] as part of [Vault 7 documents of CIA][11]. - -### Is it going to be open source? - -We do think that the reverse engineering tool to be released could be made open source. Even though there is no official confirmation mentioning “open source” – but a lot of people do believe that NSA is definitely targeting the open source community to help improve their tool while also reducing their effort to maintain this tool. - -This way the tool can remain free and the open source community can help improve GHIDRA as well. - -You can also check out the existing [Vault 7 document at WikiLeaks][12] to come up with your prediction. - -### Is NSA doing a good job here? - -The reverse engineering tool is going to be available for Windows, Linux, and Mac OS for free. - -Of course, we care about the Linux platform here – which could be a very good option for people who do not want to or cannot afford a thousand dollar license for a reverse engineering tool with the best-in-class features. - -### Wrapping Up - -If GHIDRA becomes open source and is available for free, it would definitely help a lot of researchers and students and on the other side – the competitors will be forced to adjust their pricing. - -What are your thoughts about it? Is it a good thing? What do you think about the tool going open sources Let us know what you think in the comments below. - -![][13] - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/nsa-ghidra-open-source - -作者:[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.rsaconference.com/events/us19 -[2]: https://www.rsaconference.com/events/us19/agenda/sessions/16608-come-get-your-free-nsa-reverse-engineering-tool -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/come-get-your-free-nsa.jpg?fit=800%2C337&ssl=1 -[4]: https://twitter.com/0xffff0800/status/1080909700701405184 -[5]: http://nsa.gov -[6]: https://en.wikipedia.org/wiki/Reverse_engineering -[7]: https://en.wikipedia.org/wiki/Interactive_Disassembler -[8]: https://www.reddit.com/r/ReverseEngineering/comments/ace2m3/come_get_your_free_nsa_reverse_engineering_tool/ -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/nsa-open-source.jpeg?resize=800%2C450&ssl=1 -[10]: https://www.wikileaks.org/ -[11]: https://en.wikipedia.org/wiki/Vault_7 -[12]: https://wikileaks.org/ciav7p1/cms/page_9536070.html -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/nsa-open-source.jpeg?fit=800%2C450&ssl=1 diff --git a/sources/talk/20190115 The Art of Unix Programming, reformatted.md b/sources/talk/20190115 The Art of Unix Programming, reformatted.md deleted file mode 100644 index 73ffb4c955..0000000000 --- a/sources/talk/20190115 The Art of Unix Programming, reformatted.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Art of Unix Programming, reformatted) -[#]: via: (https://arp242.net/weblog/the-art-of-unix-programming.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -The Art of Unix Programming, reformatted -====== - -tl;dr: I reformatted Eric S. Raymond’s The Art of Unix Programming for readability; [read it here][1]. - -I recently wanted to look up a quote for an article I was writing, and I was fairly sure I had read it in The Art of Unix Programming. Eric S. Raymond (esr) has [kindly published it online][2], but it’s difficult to search as it’s distributed over many different pages, and the formatting is not exactly conducive for readability. - -I `wget --mirror`’d it to my drive, and started out with a simple [script][3] to join everything to a single page, but eventually ended up rewriting a lot of the HTML from crappy 2003 docbook-generated tagsoup to more modern standards, and I slapped on some CSS to make it more readable. - -The results are fairly nice, and it should work well in any version of any browser (I haven’t tested Internet Explorer and Edge, lacking access to a Windows computer, but I’m reasonably confident it should work without issues; if not, see the bottom of this page on how to get in touch). - -The HTML could be simplified further (so rms can read it too), but dealing with 360k lines of ill-formatted HTML is not exactly my idea of fun, so this will have to do for now. - -The entire page is self-contained. You can save it to your laptop or mobile phone and read it on a plane or whatnot. - -Why spend so much work on an IT book from 2003? I think a substantial part of the book still applies very much today, for all programmers (not just Unix programmers). For example the [Basics of the Unix Philosophy][4] was good advice in 1972, is still good advice in 2019, and will continue to be good advice well in to the future. - -Other parts have aged less gracefully; for example “since 2000, practice has been moving toward use of XML-DocBook as a documentation interchange format” doesn’t really represent the current state of things, and the [Data File Metaformats][5] section mentions XML and INI, but not JSON or YAML (as they weren’t invented until after the book was written) - -I find this adds, rather than detracts. It makes for an interesting window in to past. The downside is that the uninitiated will have a bit of a hard time distinguishing between the good and outdated parts; as a rule of thumb: if it talks about abstract concepts, it probably still applies today. If it talks about specific software, it may be outdated. - -I toyed with the idea of updating or annotating the text, but the license doesn’t allow derivative works, so that’s not going to happen. Perhaps I’ll email esr and ask nicely. Another project, for another weekend :-) - -You can mail me at [martin@arp242.net][6] or [create a GitHub issue][7] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/the-art-of-unix-programming.html - -作者:[Martin Tournoij][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://arp242.net/ -[b]: https://github.com/lujun9972 -[1]: https://arp242.net/the-art-of-unix-programming/ -[2]: http://catb.org/~esr/writings/taoup/html/ -[3]: https://arp242.net/the-art-of-unix-programming/fix-taoup.py -[4]: https://arp242.net/the-art-of-unix-programming#ch01s06 -[5]: https://arp242.net/the-art-of-unix-programming/#ch05s02 -[6]: mailto:martin@arp242.net -[7]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/sources/talk/20190131 OOP Before OOP with Simula.md b/sources/talk/20190131 OOP Before OOP with Simula.md index aca160ad2d..cae9d9bd3a 100644 --- a/sources/talk/20190131 OOP Before OOP with Simula.md +++ b/sources/talk/20190131 OOP Before OOP with Simula.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (warmfrog) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md b/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md deleted file mode 100644 index bb7dd14943..0000000000 --- a/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (No! Ubuntu is NOT Replacing Apt with Snap) -[#]: via: (https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -No! Ubuntu is NOT Replacing Apt with Snap -====== - -Stop believing the rumors that Ubuntu is planning to replace Apt with Snap in the [Ubuntu 19.04 release][1]. These are only rumors. - -![Snap replacing apt rumors][2] - -Don’t get what I am talking about? Let me give you some context. - -There is a ‘blueprint’ on Ubuntu’s launchpad website, titled ‘Replace APT with snap as default package manager’. It talks about replacing Apt (package manager at the heart of Debian) with Snap ( a new packaging system by Ubuntu). - -> Thanks to Snap, the need for APT is disappearing, fast… why don’t we use snap at the system level? - -The post further says “Imagine, for example, being able to run “sudo snap install cosmic” to upgrade to the current release, “sudo snap install –beta disco” (in March) to upgrade to a beta release, or, for that matter, “sudo snap install –edge disco” to upgrade to a pre-beta release. It would make the whole process much easier, and updates could simply be delivered as updates to the corresponding snap, which could then just be pushed to the repositories and there it is. This way, instead of having a separate release updater, it would be possible to A, run all system updates completely and silently in the background to avoid nagging the user (a la Chrome OS), and B, offer release upgrades in the GNOME software store, Mac-style, as banners, so the user can install them easily. It would make the user experience both more consistent and even more user-friendly than it currently is.” - -It might sound good and promising and if you take a look at [this link][3], even you might start believing the rumor. Why? Because at the bottom of the blueprint information, it lists Ubuntu-founder Mark Shuttleworth as the approver. - -![Apt being replaced with Snap blueprint rumor][4]Mark Shuttleworth’s name adds to the confusion - -The rumor got fanned when the Switch to Linux YouTube channel covered it. You can watch the video from around 11:30. - - - -When this ‘news’ was brought to my attention, I reached out to Alan Pope of Canonical and asked him if he or his colleagues at Canonical (Ubuntu’s parent company) could confirm it. - -Alan clarified that the so called blueprint was not associated with official Ubuntu team. It was created as a proposal by some community member not affiliated with Ubuntu. - -> That’s not anything official. Some random community person made it. Anyone can write a blueprint. -> -> Alan Pope, Canonical - -Alan further elaborated that anyone can create such blueprints and tag Mark Shuttleworth or other Ubuntu members in it. Just because Mark’s name was listed as the approver, it doesn’t mean he already approved the idea. - -Canonical has no such plans to replace Apt with Snap. It’s not as simple as the blueprint in question suggests. - -After talking with Alan, I decided to not write about this topic because I don’t want to fan baseless rumors and confuse people. - -Unfortunately, the ‘replace Apt with Snap’ blueprint is still being shared on various Ubuntu and Linux related groups and forums. Alan had to publicly dismiss these rumors in a series of tweets: - -> Seen this [#Ubuntu][5] blueprint being shared around the internet. It's not official, not a thing we're doing. Just because someone made a blueprint, doesn't make it fact. -> -> — Alan Pope 🇪🇺🇬🇧 (@popey) [February 23, 2019][6] - -I don’t want you, the It’s FOSS reader, to fell for such silly rumors so I quickly penned this article. - -If you come across ‘apt being replaced with snap’ discussion, you may tell people that it’s not true and provide them this link as a reference. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/ubuntu-19-04-release-features/ -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/snap-replacing-apt.png?resize=800%2C450&ssl=1 -[3]: https://blueprints.launchpad.net/ubuntu/+spec/package-management-default-snap -[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-snap-blueprint.jpg?ssl=1 -[5]: https://twitter.com/hashtag/Ubuntu?src=hash&ref_src=twsrc%5Etfw -[6]: https://twitter.com/popey/status/1099238146393468931?ref_src=twsrc%5Etfw diff --git a/sources/talk/20190331 Codecademy vs. The BBC Micro.md b/sources/talk/20190331 Codecademy vs. The BBC Micro.md deleted file mode 100644 index e4720315cc..0000000000 --- a/sources/talk/20190331 Codecademy vs. The BBC Micro.md +++ /dev/null @@ -1,129 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Codecademy vs. The BBC Micro) -[#]: via: (https://twobithistory.org/2019/03/31/bbc-micro.html) -[#]: author: (Two-Bit History https://twobithistory.org) - -Codecademy vs. The BBC Micro -====== - -In the late 1970s, the computer, which for decades had been a mysterious, hulking machine that only did the bidding of corporate overlords, suddenly became something the average person could buy and take home. An enthusiastic minority saw how great this was and rushed to get a computer of their own. For many more people, the arrival of the microcomputer triggered helpless anxiety about the future. An ad from a magazine at the time promised that a home computer would “give your child an unfair advantage in school.” It showed a boy in a smart blazer and tie eagerly raising his hand to answer a question, while behind him his dim-witted classmates look on sullenly. The ad and others like it implied that the world was changing quickly and, if you did not immediately learn how to use one of these intimidating new devices, you and your family would be left behind. - -In the UK, this anxiety metastasized into concern at the highest levels of government about the competitiveness of the nation. The 1970s had been, on the whole, an underwhelming decade for Great Britain. Both inflation and unemployment had been high. Meanwhile, a series of strikes put London through blackout after blackout. A government report from 1979 fretted that a failure to keep up with trends in computing technology would “add another factor to our poor industrial performance.”1 The country already seemed to be behind in the computing arena—all the great computer companies were American, while integrated circuits were being assembled in Japan and Taiwan. - -In an audacious move, the BBC, a public service broadcaster funded by the government, decided that it would solve Britain’s national competitiveness problems by helping Britons everywhere overcome their aversion to computers. It launched the _Computer Literacy Project_ , a multi-pronged educational effort that involved several TV series, a few books, a network of support groups, and a specially built microcomputer known as the BBC Micro. The project was so successful that, by 1983, an editor for BYTE Magazine wrote, “compared to the US, proportionally more of Britain’s population is interested in microcomputers.”2 The editor marveled that there were more people at the Fifth Personal Computer World Show in the UK than had been to that year’s West Coast Computer Faire. Over a sixth of Great Britain watched an episode in the first series produced for the _Computer Literacy Project_ and 1.5 million BBC Micros were ultimately sold.3 - -[An archive][1] containing every TV series produced and all the materials published for the _Computer Literacy Project_ was put on the web last year. I’ve had a huge amount of fun watching the TV series and trying to imagine what it would have been like to learn about computing in the early 1980s. But what’s turned out to be more interesting is how computing was _taught_. Today, we still worry about technology leaving people behind. Wealthy tech entrepreneurs and governments spend lots of money trying to teach kids “to code.” We have websites like Codecademy that make use of new technologies to teach coding interactively. One would assume that this approach is more effective than a goofy ’80s TV series. But is it? - -### The Computer Literacy Project - -The microcomputer revolution began in 1975 with the release of [the Altair 8800][2]. Only two years later, the Apple II, TRS-80, and Commodore PET had all been released. Sales of the new computers exploded. In 1978, the BBC explored the dramatic societal changes these new machines were sure to bring in a documentary called “Now the Chips Are Down.” - -The documentary was alarming. Within the first five minutes, the narrator explains that microelectronics will “totally revolutionize our way of life.” As eerie synthesizer music plays, and green pulses of electricity dance around a magnified microprocessor on screen, the narrator argues that the new chips are why “Japan is abandoning its ship building, and why our children will grow up without jobs to go to.” The documentary goes on to explore how robots are being used to automate car assembly and how the European watch industry has lost out to digital watch manufacturers in the United States. It castigates the British government for not doing more to prepare the country for a future of mass unemployment. - -The documentary was supposedly shown to the British Cabinet.4 Several government agencies, including the Department of Industry and the Manpower Services Commission, became interested in trying to raise awareness about computers among the British public. The Manpower Services Commission provided funds for a team from the BBC’s education division to travel to Japan, the United States, and other countries on a fact-finding trip. This research team produced a report that cataloged the ways in which microelectronics would indeed mean major changes for industrial manufacturing, labor relations, and office work. In late 1979, it was decided that the BBC should make a ten-part TV series that would help regular Britons “learn how to use and control computers and not feel dominated by them.”5 The project eventually became a multimedia endeavor similar to the _Adult Literacy Project_ , an earlier BBC undertaking involving both a TV series and supplemental courses that helped two million people improve their reading. - -The producers behind the _Computer Literacy Project_ were keen for the TV series to feature “hands-on” examples that viewers could try on their own if they had a microcomputer at home. These examples would have to be in BASIC, since that was the language (really the entire shell) used on almost all microcomputers. But the producers faced a thorny problem: Microcomputer manufacturers all had their own dialects of BASIC, so no matter which dialect they picked, they would inevitably alienate some large fraction of their audience. The only real solution was to create a new BASIC—BBC BASIC—and a microcomputer to go along with it. Members of the British public would be able to buy the new microcomputer and follow along without worrying about differences in software or hardware. - -The TV producers and presenters at the BBC were not capable of building a microcomputer on their own. So they put together a specification for the computer they had in mind and invited British microcomputer companies to propose a new machine that met the requirements. The specification called for a relatively powerful computer because the BBC producers felt that the machine should be able to run real, useful applications. Technical consultants for the _Computer Literacy Project_ also suggested that, if it had to be a BASIC dialect that was going to be taught to the entire nation, then it had better be a good one. (They may not have phrased it exactly that way, but I bet that’s what they were thinking.) BBC BASIC would make up for some of BASIC’s usual shortcomings by allowing for recursion and local variables.6 - -The BBC eventually decided that a Cambridge-based company called Acorn Computers would make the BBC Micro. In choosing Acorn, the BBC passed over a proposal from Clive Sinclair, who ran a company called Sinclair Research. Sinclair Research had brought mass-market microcomputing to the UK in 1980 with the Sinclair ZX80. Sinclair’s new computer, the ZX81, was cheap but not powerful enough for the BBC’s purposes. Acorn’s new prototype computer, known internally as the Proton, would be more expensive but more powerful and expandable. The BBC was impressed. The Proton was never marketed or sold as the Proton because it was instead released in December 1981 as the BBC Micro, also affectionately called “The Beeb.” You could get a 16k version for £235 and a 32k version for £335. - -In 1980, Acorn was an underdog in the British computing industry. But the BBC Micro helped establish the company’s legacy. Today, the world’s most popular microprocessor instruction set is the ARM architecture. “ARM” now stands for “Advanced RISC Machine,” but originally it stood for “Acorn RISC Machine.” ARM Holdings, the company behind the architecture, was spun out from Acorn in 1990. - -![Picture of the BBC Micro.][3] _A bad picture of a BBC Micro, taken by me at the Computer History Museum -in Mountain View, California._ - -### The Computer Programme - -A dozen different TV series were eventually produced as part of the _Computer Literacy Project_ , but the first of them was a ten-part series known as _The Computer Programme_. The series was broadcast over ten weeks at the beginning of 1982. A million people watched each week-night broadcast of the show; a quarter million watched the reruns on Sunday and Monday afternoon. - -The show was hosted by two presenters, Chris Serle and Ian McNaught-Davis. Serle plays the neophyte while McNaught-Davis, who had professional experience programming mainframe computers, plays the expert. This was an inspired setup. It made for [awkward transitions][4]—Serle often goes directly from a conversation with McNaught-Davis to a bit of walk-and-talk narration delivered to the camera, and you can’t help but wonder whether McNaught-Davis is still standing there out of frame or what. But it meant that Serle could voice the concerns that the audience would surely have. He can look intimidated by a screenful of BASIC and can ask questions like, “What do all these dollar signs mean?” At several points during the show, Serle and McNaught-Davis sit down in front of a computer and essentially pair program, with McNaught-Davis providing hints here and there while Serle tries to figure it out. It would have been much less relatable if the show had been presented by a single, all-knowing narrator. - -The show also made an effort to demonstrate the many practical applications of computing in the lives of regular people. By the early 1980s, the home computer had already begun to be associated with young boys and video games. The producers behind _The Computer Programme_ sought to avoid interviewing “impressively competent youngsters,” as that was likely “to increase the anxieties of older viewers,” a demographic that the show was trying to attract to computing.7 In the first episode of the series, Gill Nevill, the show’s “on location” reporter, interviews a woman that has bought a Commodore PET to help manage her sweet shop. The woman (her name is Phyllis) looks to be 60-something years old, yet she has no trouble using the computer to do her accounting and has even started using her PET to do computer work for other businesses, which sounds like the beginning of a promising freelance career. Phyllis says that she wouldn’t mind if the computer work grew to replace her sweet shop business since she enjoys the computer work more. This interview could instead have been an interview with a teenager about how he had modified _Breakout_ to be faster and more challenging. But that would have been encouraging to almost nobody. On the other hand, if Phyllis, of all people, can use a computer, then surely you can too. - -While the show features lots of BASIC programming, what it really wants to teach its audience is how computing works in general. The show explains these general principles with analogies. In the second episode, there is an extended discussion of the Jacquard loom, which accomplishes two things. First, it illustrates that computers are not based only on magical technology invented yesterday—some of the foundational principles of computing go back two hundred years and are about as simple as the idea that you can punch holes in card to control a weaving machine. Second, the interlacing of warp and weft threads is used to demonstrate how a binary choice (does the weft thread go above or below the warp thread?) is enough, when repeated over and over, to produce enormous variation. This segues, of course, into a discussion of how information can be stored using binary digits. - -Later in the show there is a section about a steam organ that plays music encoded in a long, segmented roll of punched card. This time the analogy is used to explain subroutines in BASIC. Serle and McNaught-Davis lay out the whole roll of punched card on the floor in the studio, then point out the segments where it looks like a refrain is being repeated. McNaught-Davis explains that a subroutine is what you would get if you cut out those repeated segments of card and somehow added an instruction to go back to the original segment that played the refrain for the first time. This is a brilliant explanation and probably one that stuck around in people’s minds for a long time afterward. - -I’ve picked out only a few examples, but I think in general the show excels at demystifying computers by explaining the principles that computers rely on to function. The show could instead have focused on teaching BASIC, but it did not. This, it turns out, was very much a conscious choice. In a retrospective written in 1983, John Radcliffe, the executive producer of the _Computer Literacy Project_ , wrote the following: - -> If computers were going to be as important as we believed, some genuine understanding of this new subject would be important for everyone, almost as important perhaps as the capacity to read and write. Early ideas, both here and in America, had concentrated on programming as the main route to computer literacy. However, as our thinking progressed, although we recognized the value of “hands-on” experience on personal micros, we began to place less emphasis on programming and more on wider understanding, on relating micros to larger machines, encouraging people to gain experience with a range of applications programs and high-level languages, and relating these to experience in the real world of industry and commerce…. Our belief was that once people had grasped these principles, at their simplest, they would be able to move further forward into the subject. - -Later, Radcliffe writes, in a similar vein: - -> There had been much debate about the main explanatory thrust of the series. One school of thought had argued that it was particularly important for the programmes to give advice on the practical details of learning to use a micro. But we had concluded that if the series was to have any sustained educational value, it had to be a way into the real world of computing, through an explanation of computing principles. This would need to be achieved by a combination of studio demonstration on micros, explanation of principles by analogy, and illustration on film of real-life examples of practical applications. Not only micros, but mini computers and mainframes would be shown. - -I love this, particularly the part about mini-computers and mainframes. The producers behind _The Computer Programme_ aimed to help Britons get situated: Where had computing been, and where was it going? What can computers do now, and what might they do in the future? Learning some BASIC was part of answering those questions, but knowing BASIC alone was not seen as enough to make someone computer literate. - -### Computer Literacy Today - -If you google “learn to code,” the first result you see is a link to Codecademy’s website. If there is a modern equivalent to the _Computer Literacy Project_ , something with the same reach and similar aims, then it is Codecademy. - -“Learn to code” is Codecademy’s tagline. I don’t think I’m the first person to point this out—in fact, I probably read this somewhere and I’m now ripping it off—but there’s something revealing about using the word “code” instead of “program.” It suggests that the important thing you are learning is how to decode the code, how to look at a screen’s worth of Python and not have your eyes glaze over. I can understand why to the average person this seems like the main hurdle to becoming a professional programmer. Professional programmers spend all day looking at computer monitors covered in gobbledygook, so, if I want to become a professional programmer, I better make sure I can decipher the gobbledygook. But dealing with syntax is not the most challenging part of being a programmer, and it quickly becomes almost irrelevant in the face of much bigger obstacles. Also, armed only with knowledge of a programming language’s syntax, you may be able to _read_ code but you won’t be able to _write_ code to solve a novel problem. - -I recently went through Codecademy’s “Code Foundations” course, which is the course that the site recommends you take if you are interested in programming (as opposed to web development or data science) and have never done any programming before. There are a few lessons in there about the history of computer science, but they are perfunctory and poorly researched. (Thank heavens for [this noble internet vigilante][5], who pointed out a particularly egregious error.) The main focus of the course is teaching you about the common structural elements of programming languages: variables, functions, control flow, loops. In other words, the course focuses on what you would need to know to start seeing patterns in the gobbledygook. - -To be fair to Codecademy, they offer other courses that look meatier. But even courses such as their “Computer Science Path” course focus almost exclusively on programming and concepts that can be represented in programs. One might argue that this is the whole point—Codecademy’s main feature is that it gives you little interactive programming lessons with automated feedback. There also just isn’t enough room to cover more because there is only so much you can stuff into somebody’s brain in a little automated lesson. But the producers at the BBC tasked with kicking off the _Computer Literacy Project_ also had this problem; they recognized that they were limited by their medium and that “the amount of learning that would take place as a result of the television programmes themselves would be limited.”8 With similar constraints on the volume of information they could convey, they chose to emphasize general principles over learning BASIC. Couldn’t Codecademy replace a lesson or two with an interactive visualization of a Jacquard loom weaving together warp and weft threads? - -I’m banging the drum for “general principles” loudly now, so let me just explain what I think they are and why they are important. There’s a book by J. Clark Scott about computers called _But How Do It Know?_ The title comes from the anecdote that opens the book. A salesman is explaining to a group of people that a thermos can keep hot food hot and cold food cold. A member of the audience, astounded by this new invention, asks, “But how do it know?” The joke of course is that the thermos is not perceiving the temperature of the food and then making a decision—the thermos is just constructed so that cold food inevitably stays cold and hot food inevitably stays hot. People anthropomorphize computers in the same way, believing that computers are digital brains that somehow “choose” to do one thing or another based on the code they are fed. But learning a few things about how computers work, even at a rudimentary level, takes the homunculus out of the machine. That’s why the Jacquard loom is such a good go-to illustration. It may at first seem like an incredible device. It reads punch cards and somehow “knows” to weave the right pattern! The reality is mundane: Each row of holes corresponds to a thread, and where there is a hole in that row the corresponding thread gets lifted. Understanding this may not help you do anything new with computers, but it will give you the confidence that you are not dealing with something magical. We should impart this sense of confidence to beginners as soon as we can. - -Alas, it’s possible that the real problem is that nobody wants to learn about the Jacquard loom. Judging by how Codecademy emphasizes the professional applications of what it teaches, many people probably start using Codecademy because they believe it will help them “level up” their careers. They believe, not unreasonably, that the primary challenge will be understanding the gobbledygook, so they want to “learn to code.” And they want to do it as quickly as possible, in the hour or two they have each night between dinner and collapsing into bed. Codecademy, which after all is a business, gives these people what they are looking for—not some roundabout explanation involving a machine invented in the 18th century. - -The _Computer Literacy Project_ , on the other hand, is what a bunch of producers and civil servants at the BBC thought would be the best way to educate the nation about computing. I admit that it is a bit elitist to suggest we should laud this group of people for teaching the masses what they were incapable of seeking out on their own. But I can’t help but think they got it right. Lots of people first learned about computing using a BBC Micro, and many of these people went on to become successful software developers or game designers. [As I’ve written before][6], I suspect learning about computing at a time when computers were relatively simple was a huge advantage. But perhaps another advantage these people had is shows like _The Computer Programme_ , which strove to teach not just programming but also how and why computers can run programs at all. After watching _The Computer Programme_ , you may not understand all the gobbledygook on a computer screen, but you don’t really need to because you know that, whatever the “code” looks like, the computer is always doing the same basic thing. After a course or two on Codecademy, you understand some flavors of gobbledygook, but to you a computer is just a magical machine that somehow turns gobbledygook into running software. That isn’t computer literacy. - -_If you enjoyed this post, more like it come out every four weeks! Follow[@TwoBitHistory][7] on Twitter or subscribe to the [RSS feed][8] to make sure you know when a new post is out._ - -_Previously on TwoBitHistory…_ - -> FINALLY some new damn content, amirite? -> -> Wanted to write an article about how Simula bought us object-oriented programming. It did that, but early Simula also flirted with a different vision for how OOP would work. Wrote about that instead! -> -> — TwoBitHistory (@TwoBitHistory) [February 1, 2019][9] - - 1. Robert Albury and David Allen, Microelectronics, report (1979). ↩ - - 2. Gregg Williams, “Microcomputing, British Style”, Byte Magazine, 40, January 1983, accessed on March 31, 2019, . ↩ - - 3. John Radcliffe, “Toward Computer Literacy,” Computer Literacy Project Achive, 42, accessed March 31, 2019, [https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards Computer Literacy.pdf][10]. ↩ - - 4. David Allen, “About the Computer Literacy Project,” Computer Literacy Project Archive, accessed March 31, 2019, . ↩ - - 5. ibid. ↩ - - 6. Williams, 51. ↩ - - 7. Radcliffe, 11. ↩ - - 8. Radcliffe, 5. ↩ - - - - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2019/03/31/bbc-micro.html - -作者:[Two-Bit History][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://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/ -[2]: /2018/07/22/dawn-of-the-microcomputer.html -[3]: /images/beeb.jpg -[4]: https://twitter.com/TwoBitHistory/status/1112372000742404098 -[5]: https://twitter.com/TwoBitHistory/status/1111305774939234304 -[6]: /2018/09/02/learning-basic.html -[7]: https://twitter.com/TwoBitHistory -[8]: https://twobithistory.org/feed.xml -[9]: https://twitter.com/TwoBitHistory/status/1091148050221944832?ref_src=twsrc%5Etfw -[10]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf diff --git a/sources/talk/20190412 Gov-t warns on VPN security bug in Cisco, Palo Alto, F5, Pulse software.md b/sources/talk/20190412 Gov-t warns on VPN security bug in Cisco, Palo Alto, F5, Pulse software.md deleted file mode 100644 index b5d5c21ee6..0000000000 --- a/sources/talk/20190412 Gov-t warns on VPN security bug in Cisco, Palo Alto, F5, Pulse software.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Gov’t warns on VPN security bug in Cisco, Palo Alto, F5, Pulse software) -[#]: via: (https://www.networkworld.com/article/3388646/gov-t-warns-on-vpn-security-bug-in-cisco-palo-alto-f5-pulse-software.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Gov’t warns on VPN security bug in Cisco, Palo Alto, F5, Pulse software -====== -VPN packages from Cisco, Palo Alto, F5 and Pusle may improperly secure tokens and cookies -![Getty Images][1] - -The Department of Homeland Security has issued a warning that some [VPN][2] packages from Cisco, Palo Alto, F5 and Pusle may improperly secure tokens and cookies, allowing nefarious actors an opening to invade and take control over an end user’s system. - -The DHS’s Cybersecurity and Infrastructure Security Agency (CISA) [warning][3] comes on the heels of a notice from Carnegie Mellon's CERT that multiple VPN applications store the authentication and/or session cookies insecurely in memory and/or log files. - -**[Also see:[What to consider when deploying a next generation firewall][4]. Get regularly scheduled insights by [signing up for Network World newsletters][5]]** - -“If an attacker has persistent access to a VPN user's endpoint or exfiltrates the cookie using other methods, they can replay the session and bypass other authentication methods,” [CERT wrote][6]. “An attacker would then have access to the same applications that the user does through their VPN session.” - -According to the CERT warning, the following products and versions store the cookie insecurely in log files: - - * Palo Alto Networks GlobalProtect Agent 4.1.0 for Windows and GlobalProtect Agent 4.1.10 and earlier for macOS0 ([CVE-2019-1573][7]) - * Pulse Secure Connect Secure prior to 8.1R14, 8.2, 8.3R6, and 9.0R2. - - - -The following products and versions store the cookie insecurely in memory: - - * Palo Alto Networks GlobalProtect Agent 4.1.0 for Windows and GlobalProtect Agent 4.1.10 and earlier for macOS0. - * Pulse Secure Connect Secure prior to 8.1R14, 8.2, 8.3R6, and 9.0R2. - * Cisco AnyConnect 4.7.x and prior. - - - -CERT says that Palo Alto Networks GlobalProtect version 4.1.1 [patches][8] this vulnerability. - -In the CERT warning F5 stated it has been aware of the insecure memory storage since 2013 and has not yet been patched. More information can be found [here][9]. F5 also stated it has been aware of the insecure log storage since 2017 and fixed it in version 12.1.3 and 13.1.0 and onwards. More information can be found [here][10]. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][11] ]** - -CERT said it is unaware of any patches at the time of publishing for Cisco AnyConnect and Pulse Secure Connect Secure. - -CERT credited the [National Defense ISAC Remote Access Working Group][12] for reporting the vulnerability. - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3388646/gov-t-warns-on-vpn-security-bug-in-cisco-palo-alto-f5-pulse-software.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/10/broken-chain_metal_link_breach_security-100777433-large.jpg -[2]: https://www.networkworld.com/article/3268744/understanding-virtual-private-networks-and-why-vpns-are-important-to-sd-wan.html -[3]: https://www.us-cert.gov/ncas/current-activity/2019/04/12/Vulnerability-Multiple-VPN-Applications -[4]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html -[5]: https://www.networkworld.com/newsletters/signup.html -[6]: https://www.kb.cert.org/vuls/id/192371/ -[7]: https://nvd.nist.gov/vuln/detail/CVE-2019-1573 -[8]: https://securityadvisories.paloaltonetworks.com/Home/Detail/146 -[9]: https://support.f5.com/csp/article/K14969 -[10]: https://support.f5.com/csp/article/K45432295 -[11]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[12]: https://ndisac.org/workinggroups/ -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190417 Cisco Talos details exceptionally dangerous DNS hijacking attack.md b/sources/talk/20190417 Cisco Talos details exceptionally dangerous DNS hijacking attack.md deleted file mode 100644 index db534e4457..0000000000 --- a/sources/talk/20190417 Cisco Talos details exceptionally dangerous DNS hijacking attack.md +++ /dev/null @@ -1,130 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco Talos details exceptionally dangerous DNS hijacking attack) -[#]: via: (https://www.networkworld.com/article/3389747/cisco-talos-details-exceptionally-dangerous-dns-hijacking-attack.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco Talos details exceptionally dangerous DNS hijacking attack -====== -Cisco Talos says state-sponsored attackers are battering DNS to gain access to sensitive networks and systems -![Peshkova / Getty][1] - -Security experts at Cisco Talos have released a [report detailing][2] what it calls the “first known case of a domain name registry organization that was compromised for cyber espionage operations.” - -Talos calls ongoing cyber threat campaign “Sea Turtle” and said that state-sponsored attackers are abusing DNS to harvest credentials to gain access to sensitive networks and systems in a way that victims are unable to detect, which displays unique knowledge on how to manipulate DNS, Talos stated. - -**More about DNS:** - - * [DNS in the cloud: Why and why not][3] - * [DNS over HTTPS seeks to make internet use more private][4] - * [How to protect your infrastructure from DNS cache poisoning][5] - * [ICANN housecleaning revokes old DNS security key][6] - - - -By obtaining control of victims’ DNS, the attackers can change or falsify any data on the Internet, illicitly modify DNS name records to point users to actor-controlled servers; users visiting those sites would never know, Talos reported. - -DNS, routinely known as the Internet’s phonebook, is part of the global internet infrastructure that translates between familiar names and the numbers computers need to access a website or send an email. - -### Threat to DNS could spread - -At this point Talos says Sea Turtle isn't compromising organizations in the U.S. - -“While this incident is limited to targeting primarily national security organizations in the Middle East and North Africa, and we do not want to overstate the consequences of this specific campaign, we are concerned that the success of this operation will lead to actors more broadly attacking the global DNS system,” Talos stated. - -Talos reports that the ongoing operation likely began as early as January 2017 and has continued through the first quarter of 2019. “Our investigation revealed that approximately 40 different organizations across 13 different countries were compromised during this campaign,” Talos stated. “We assess with high confidence that this activity is being carried out by an advanced, state-sponsored actor that seeks to obtain persistent access to sensitive networks and systems.” - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][7] ]** - -Talos says the attackers directing the Sea Turtle campaign show signs of being highly sophisticated and have continued their attacks despite public reports of their activities. In most cases, threat actors typically stop or slow down their activities once their campaigns are publicly revealed suggesting the Sea Turtle actors are unusually brazen and may be difficult to deter going forward, Talos stated. - -In January the Department of Homeland Security (DHS) [issued an alert][8] about this activity, warning that an attacker could redirect user traffic and obtain valid encryption certificates for an organization’s domain names. - -At that time the DHS’s [Cybersecurity and Infrastructure Security Agency][9] said in its [Emergency Directive][9] that it was tracking a series of incidents targeting DNS infrastructure. CISA wrote that it “is aware of multiple executive branch agency domains that were impacted by the tampering campaign and has notified the agencies that maintain them.” - -### DNS hijacking - -CISA said that attackers have managed to intercept and redirect web and mail traffic and could target other networked services. The agency said the attacks start with compromising user credentials of an account that can make changes to DNS records. Then the attacker alters DNS records, like Address, Mail Exchanger, or Name Server records, replacing the legitimate address of the services with an address the attacker controls. - -To achieve their nefarious goals, Talos stated the Sea Turtle accomplices: - - * Use DNS hijacking through the use of actor-controlled name servers. - * Are aggressive in their pursuit targeting DNS registries and a number of registrars, including those that manage country-code top-level domains (ccTLD). - - - * Use Let’s Encrypts, Comodo, Sectigo, and self-signed certificates in their man-in-the-middle (MitM) servers to gain the initial round of credentials. - - - * Steal victim organization’s legitimate SSL certificate and use it on actor-controlled servers. - - - -Such actions also distinguish Sea Turtle from an earlier DNS exploit known as DNSpionage, which [Talos ​reported][10]​ on in November 2018. - -Talos noted “with high confidence” that these operations are distinctly different and independent from the operations performed by [DNSpionage.][11] - -In that report, Talos said a DNSpionage campaign utilized two fake, malicious websites containing job postings that were used to compromise targets via malicious Microsoft Office documents with embedded macros. The malware supported HTTP and DNS communication with the attackers. - -In a separate DNSpionage campaign, the attackers used the same IP address to redirect the DNS of legitimate .gov and private company domains. During each DNS compromise, the actor carefully generated Let's Encrypt certificates for the redirected domains. These certificates provide X.509 certificates for [Transport Layer Security (TLS)][12] free of charge to the user, Talos said. - -The Sea Turtle campaign gained initial access either by exploiting known vulnerabilities or by sending spear-phishing emails. Talos said it believes the attackers have exploited multiple known common vulnerabilities and exposures (CVEs) to either gain initial access or to move laterally within an affected organization. Talos research further shows the following known exploits of Sea Turtle include: - - * CVE-2009-1151​: PHP code injection vulnerability affecting phpMyAdmin - * CVE-2014-6271​: RCE affecting GNU bash system, specifically the SMTP (this was part of the ​Shellshock​ CVEs) - * CVE-2017-3881​: RCE by unauthenticated user with elevated privileges Cisco switches - * CVE-2017-6736​: Remote Code Exploit (RCE) for Cisco integrated Service Router 2811 - * CVE-2017-12617​: RCE affecting Apache web servers running Tomcat - * CVE-2018-0296​: ​Directory​ traversal allowing unauthorized access to Cisco Adaptive Security Appliances (ASAs) and firewalls - * CVE-2018-7600​: RCE for Website built with Drupal, aka “Drupalgeddon” - - - -“As with any initial access involving a sophisticated actor, we believe this list of CVEs to be incomplete,” Talos stated. “The actor in question can leverage known vulnerabilities as they encounter a new threat surface. This list only represents the observed behavior of the actor, not their complete capabilities.” - -Talos says that the Sea Turtle campaign continues to be highly successful for several reasons. “First, the actors employ a unique approach to gain access to the targeted networks. Most traditional security products such as IDS and IPS systems are not designed to monitor and log DNS requests,” Talos stated. “The threat actors were able to achieve this level of success because the DNS domain space system added security into the equation as an afterthought. Had more ccTLDs implemented security features such as registrar locks, attackers would be unable to redirect the targeted domains.” - -Talos said the attackers also used previously undisclosed techniques such as certificate impersonation. “This technique was successful in part because the SSL certificates were created to provide confidentiality, not integrity. The attackers stole organizations’ SSL certificates associated with security appliances such as [Cisco's Adaptive Security Appliance] to obtain VPN credentials, allowing the actors to gain access to the targeted network, and have long-term persistent access, Talos stated. - -### Cisco Talos DNS attack mitigation strategy - -To protect against Sea Turtle, Cisco recommends: - - * Use a registry lock service, which will require an out-of-band message before any changes can occur to an organization's DNS record. - * If your registrar does not offer a registry-lock service, Talos recommends implementing multi-factor authentication, such as ​DUO​, to access your organization's DNS records. - * If you suspect you were targeted by this type of intrusion, Talos recommends instituting a network-wide password reset, preferably from a computer on a trusted network. - * Apply patches, especially on internet-facing machines. Network administrators can monitor passive DNS records on their domains to check for abnormalities. - - - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3389747/cisco-talos-details-exceptionally-dangerous-dns-hijacking-attack.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/02/man-in-boat-surrounded-by-sharks_risk_fear_decision_attack_threat_by-peshkova-getty-100786972-large.jpg -[2]: https://blog.talosintelligence.com/2019/04/seaturtle.html -[3]: https://www.networkworld.com/article/3273891/hybrid-cloud/dns-in-the-cloud-why-and-why-not.html -[4]: https://www.networkworld.com/article/3322023/internet/dns-over-https-seeks-to-make-internet-use-more-private.html -[5]: https://www.networkworld.com/article/3298160/internet/how-to-protect-your-infrastructure-from-dns-cache-poisoning.html -[6]: https://www.networkworld.com/article/3331606/security/icann-housecleaning-revokes-old-dns-security-key.html -[7]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[8]: https://www.networkworld.com/article/3336201/batten-down-the-dns-hatches-as-attackers-strike-feds.html -[9]: https://cyber.dhs.gov/ed/19-01/ -[10]: https://blog.talosintelligence.com/2018/11/dnspionage-campaign-targets-middle-east.html -[11]: https://krebsonsecurity.com/tag/dnspionage/ -[12]: https://www.networkworld.com/article/2303073/lan-wan-what-is-transport-layer-security-protocol.html -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190424 Cisco- DNSpionage attack adds new tools, morphs tactics.md b/sources/talk/20190424 Cisco- DNSpionage attack adds new tools, morphs tactics.md deleted file mode 100644 index e202384558..0000000000 --- a/sources/talk/20190424 Cisco- DNSpionage attack adds new tools, morphs tactics.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco: DNSpionage attack adds new tools, morphs tactics) -[#]: via: (https://www.networkworld.com/article/3390666/cisco-dnspionage-attack-adds-new-tools-morphs-tactics.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco: DNSpionage attack adds new tools, morphs tactics -====== -Cisco's Talos security group says DNSpionage tools have been upgraded to be more stealthy -![Calvin Dexter / Getty Images][1] - -The group behind the Domain Name System attacks known as DNSpionage have upped their dark actions with new tools and malware to focus their attacks and better hide their activities. - -Cisco Talos security researchers, who discovered [DNSpionage][2] in November, this week warned of new exploits and capabilities of the nefarious campaign. - -**More about DNS:** - - * [DNS in the cloud: Why and why not][3] - * [DNS over HTTPS seeks to make internet use more private][4] - * [How to protect your infrastructure from DNS cache poisoning][5] - * [ICANN housecleaning revokes old DNS security key][6] - - - -“The threat actor's ongoing development of DNSpionage malware shows that the attacker continues to find new ways to avoid detection. DNS tunneling is a popular method of exfiltration for some actors and recent examples of DNSpionage show that we must ensure DNS is monitored as closely as an organization's normal proxy or weblogs,” [Talos wrote][7]. “DNS is essentially the phonebook of the internet, and when it is tampered with, it becomes difficult for anyone to discern whether what they are seeing online is legitimate.” - -In Talos’ initial report, researchers said a DNSpionage campaign targeted various businesses in the Middle East as well as United Arab Emirates government domains. It also utilized two malicious websites containing job postings that were used to compromise targets via crafted Microsoft Office documents with embedded macros. The malware supported HTTP and DNS communication with the attackers. - -In a separate DNSpionage campaign, the attackers used the same IP address to redirect the DNS of legitimate .gov and private company domains. During each DNS compromise, the actor carefully generated “Let's Encrypt” certificates for the redirected domains. These certificates provide X.509 certificates for [Transport Layer Security (TLS)][8] free of charge to the user, Talos said. - -This week Cisco said DNSpionage actors have created a new remote administrative tool that supports HTTP and DNS communication with the attackers' command and control (C2). - -“In our previous post concerning DNSpionage, we showed that the malware author used malicious macros embedded in a Microsoft Word document. In the new sample from Lebanon identified at the end of February, the attacker used an Excel document with a similar macro.” - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][9] ]** - -Talos wrote: “The malware supports HTTP and DNS communication to the C2 server. The HTTP communication is hidden in the comments in the HTML code. This time, however, the C2 server mimics the GitHub platform instead of Wikipedia. While the DNS communication follows the same method we described in our previous article, the developer added some new features in this latest version and, this time, the actor removed the debug mode.” - -Talos added that the domain used for the C2 campaign is “bizarre.” - -“The previous version of DNSpionage attempted to use legitimate-looking domains in an attempt to remain undetected. However, this newer version uses the domain ‘coldfart[.]com,’ which would be easier to spot than other APT campaigns which generally try to blend in with traffic more suitable to enterprise environments. The domain was also hosted in the U.S., which is unusual for any espionage-style attack.” - -Talos researchers said they discovered that DNSpionage added a reconnaissance phase, that ensures the payload is being dropped on specific targets rather than indiscriminately downloaded on every machine. - -This level of attack also returns information about the workstation environment, including platform-specific information, the name of the domain and the local computer, and information concerning the operating system, Talos wrote. This information is key to helping the malware select the victims only and attempts to avoid researchers or sandboxes. Again, it shows the actor's improved abilities, as they now fingerprint the victim. - -This new tactic indicates an improved level of sophistication and is likely in response to the significant amount of public interest in the campaign. - -Talos noted that there have been several other public reports of DNSpionage attacks, and in January, the U.S. Department of Homeland Security issued an [alert][10] warning users about this threat activity. - -“In addition to increased reports of threat activity, we have also discovered new evidence that the threat actors behind the DNSpionage campaign continue to change their tactics, likely in an attempt to improve the efficacy of their operations,” Talos stated. - -In April, Cisco Talos identified an undocumented malware developed in .NET. On the analyzed samples, the malware author left two different internal names in plain text: "DropperBackdoor" and "Karkoff." - -“The malware is lightweight compared to other malware due to its small size and allows remote code execution from the C2 server. There is no obfuscation and the code can be easily disassembled,” Talos wrote. - -The Karkoff malware searches for two specific anti-virus platforms: Avira and Avast and will work around them. - -“The discovery of Karkoff also shows the actor is pivoting and is increasingly attempting to avoid detection while remaining very focused on the Middle Eastern region,” Talos wrote. - -Talos distinguished DNSpionage from another DNS attack method, “[Sea Turtle][11]”, it detailed this month. Sea Turtle involves state-sponsored attackers that are abusing DNS to target organizations and harvest credentials to gain access to sensitive networks and systems in a way that victims are unable to detect. This displays unique knowledge about how to manipulate DNS, Talos stated. - -By obtaining control of victims’ DNS, attackers can change or falsify any data victims receive from the Internet, illicitly modify DNS name records to point users to actor-controlled servers and users visiting those sites would never know, Talos reported. - -“While this incident is limited to targeting primarily national security organizations in the Middle East and North Africa, and we do not want to overstate the consequences of this specific campaign, we are concerned that the success of this operation will lead to actors more broadly attacking the global DNS system,” Talos stated about Sea Turtle. - -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/3390666/cisco-dnspionage-attack-adds-new-tools-morphs-tactics.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/02/cyber_attack_threat_danger_breach_hack_security_by_calvindexter_gettyimages-860363294_2400x800-100788395-large.jpg -[2]: https://blog.talosintelligence.com/2018/11/dnspionage-campaign-targets-middle-east.html -[3]: https://www.networkworld.com/article/3273891/hybrid-cloud/dns-in-the-cloud-why-and-why-not.html -[4]: https://www.networkworld.com/article/3322023/internet/dns-over-https-seeks-to-make-internet-use-more-private.html -[5]: https://www.networkworld.com/article/3298160/internet/how-to-protect-your-infrastructure-from-dns-cache-poisoning.html -[6]: https://www.networkworld.com/article/3331606/security/icann-housecleaning-revokes-old-dns-security-key.html -[7]: https://blog.talosintelligence.com/2019/04/dnspionage-brings-out-karkoff.html -[8]: https://www.networkworld.com/article/2303073/lan-wan-what-is-transport-layer-security-protocol.html -[9]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[10]: https://www.us-cert.gov/ncas/alerts/AA19-024A -[11]: https://www.networkworld.com/article/3389747/cisco-talos-details-exceptionally-dangerous-dns-hijacking-attack.html -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190429 Cisco goes all in on WiFi 6.md b/sources/talk/20190429 Cisco goes all in on WiFi 6.md deleted file mode 100644 index decd25500a..0000000000 --- a/sources/talk/20190429 Cisco goes all in on WiFi 6.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco goes all in on WiFi 6) -[#]: via: (https://www.networkworld.com/article/3391919/cisco-goes-all-in-on-wifi-6.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco goes all in on WiFi 6 -====== -Cisco rolls out Catalyst and Meraki WiFi 6-based access points, Catalyst 9000 switch -![undefined / Getty Images][1] - -Cisco has taken the wraps off a family of WiFi 6 access points, roaming technology and developer-community support all to make wireless a solid enterprise equal with the wired world. - -“Best-effort’ wireless for enterprise customers doesn’t cut it any more. There’s been a change in customer expectations that there will be an uninterrupted unplugged experience,” said Scott Harrell, senior vice president and general manager of enterprise networking at Cisco. **“ **It is now a wireless-first world.** ”** - -**More about 802.11ax (Wi-Fi 6)** - - * [Why 802.11ax is the next big thing in wireless][2] - * [FAQ: 802.11ax Wi-Fi][3] - * [Wi-Fi 6 (802.11ax) is coming to a router near you][4] - * [Wi-Fi 6 with OFDMA opens a world of new wireless possibilities][5] - * [802.11ax preview: Access points and routers that support Wi-Fi 6 are on tap][6] - - - -Bringing a wireless-first enterprise world together is one of the drivers behind a new family of WiFi 6-based access points (AP) for Cisco’s Catalyst and Meraki portfolios. WiFi 6 (802.11ax) is designed for high-density public or private environments. But it also will be beneficial in internet of things (IoT) deployments, and in offices that use bandwidth-hogging applications like videoconferencing. - -The Cisco Catalyst 9100 family and Meraki [MR 45/55][7] WiFi-6 access points are built on Cisco silicon and communicate via pre-802.1ax protocols. The silicon in these access points now acts a rich sensor providing IT with insights about what is going on the wireless network in real-time, and that enables faster reactions to problems and security concerns, Harrell said. - -Aside from WiFi 6, the boxes include support for visibility and communications with Zigbee, BLE and Thread protocols. The Catalyst APs support uplink speeds of 2.5 Gbps, in addition to 100 Mbps and 1 Gbps. All speeds are supported on Category 5e cabling for an industry first, as well as 10GBASE-T (IEEE 802.3bz) cabling, Cisco said. - -Wireless traffic aggregates to wired networks so and the wired network must also evolve. Technology like multi-gigabit Ethernet must be driven into the access layer, which in turn drives higher bandwidth needs at the aggregation and core layers, [Harrell said][8]. - -Handling this influx of wireless traffic was part of the reason Cisco also upgraded its iconic Catalyst 6000 with the [Catalyst 9600 this week][9]. The 9600 brings with it support for Cat 6000 features such as support for MPLS, virtual switching and IPv6, while adding or bolstering support for wireless netowrks as well as Intent-based networking (IBN) and security segmentation. The 9600 helps fill out the company’s revamped lineup which includes the 9200 family of access switches, the 9500 aggregation switch and 9800 wireless controller. - -“WiFi doesn’t exist in a vacuum – how it connects to the enterprise and the data center or the Internet is key and in Cisco’s case that key is now the 9600 which has been built to handle the increased traffic,” said Lee Doyle, principal analyst with Doyle Research. - -The new 9600 ties in with the recently [released Catalyst 9800][10], which features 40Gbps to 100Gbps performance, depending on the model, hot-patching to simplify updates and eliminate update-related downtime, Encrypted Traffic Analytics (ETA), policy-based micro- and macro-segmentation and Trustworthy solutions to detect malware on wired or wireless connected devices, Cisco said. - -All Catalyst 9000 family members support other Cisco products such as [DNA Center][11] , which controls automation capabilities, assurance setting, fabric provisioning and policy-based segmentation for enterprise wired and wireless networks. - -The new APs are pre-standard, but other vendors including Aruba, NetGear and others are also selling pre-standard 802.11ax devices. Cisco getting into the market solidifies the validity of this strategy, said Brandon Butler, a senior research analyst with IDC. - -Many experts [expect the standard][12] to be ratified late this year. - -“We expect to see volume shipments of WiFi 6 products by early next year and it being the de facto WiFi standard by 2022.” - -On top of the APs and 9600 switch, Cisco extended its software development community – [DevNet][13] – to offer WiFi 6 learning labs, sandboxes and developer resources. - -The Cisco Catalyst and Meraki access platforms are open and programmable all the way down to the chipset level, allowing applications to take advantage of network programmability, Cisco said. - -Cisco also said it had added more vendors to now include Apple, Samsung, Boingo, Presidio and Intel for its ongoing [OpenRoaming][14] project. OpenRoaming, which is in beta promises to let users move seamlessly between wireless networks and LTE without interruption. - -Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3391919/cisco-goes-all-in-on-wifi-6.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/04/cisco_catalyst_wifi_coffee-cup_coffee-beans_-100794990-large.jpg -[2]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html -[3]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html -[4]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html -[5]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html -[6]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html -[7]: https://meraki.cisco.com/lib/pdf/meraki_datasheet_MR55.pdf -[8]: https://blogs.cisco.com/news/unplugged-and-uninterrupted -[9]: https://www.networkworld.com/article/3391580/venerable-cisco-catalyst-6000-switches-ousted-by-new-catalyst-9600.html -[10]: https://www.networkworld.com/article/3321000/cisco-links-wireless-wired-worlds-with-new-catalyst-9000-switches.html -[11]: https://www.networkworld.com/article/3280988/cisco/cisco-opens-dna-center-network-control-and-management-software-to-the-devops-masses.html -[12]: https://www.networkworld.com/article/3336263/is-jumping-ahead-to-wi-fi-6-the-right-move.html -[13]: https://developer.cisco.com/wireless/?utm_campaign=colaunch-wireless19&utm_source=pressrelease&utm_medium=ciscopress-wireless-main -[14]: https://www.cisco.com/c/en/us/solutions/enterprise-networks/802-11ax-solution/openroaming.html -[15]: https://www.facebook.com/NetworkWorld/ -[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190501 Vapor IO provides direct, high-speed connections from the edge to AWS.md b/sources/talk/20190501 Vapor IO provides direct, high-speed connections from the edge to AWS.md deleted file mode 100644 index 0ddef36770..0000000000 --- a/sources/talk/20190501 Vapor IO provides direct, high-speed connections from the edge to AWS.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Vapor IO provides direct, high-speed connections from the edge to AWS) -[#]: via: (https://www.networkworld.com/article/3391922/vapor-io-provides-direct-high-speed-connections-from-the-edge-to-aws.html#tk.rss_all) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Vapor IO provides direct, high-speed connections from the edge to AWS -====== -With a direct fiber line, latency between the edge and the cloud can be dramatically reduced. -![Vapor IO][1] - -Edge computing startup Vapor IO now offers a direct connection between its edge containers to Amazon Web Services (AWS) via a high-speed fiber network link. - -The company said that connection between its Kinetic Edge containers and AWS will be provided by Crown Castle's Cloud Connect fiber network, which uses Amazon Direct Connect Services. This would help reduce network latency by essentially drawing a straight fiber line from Vapor IO's edge computing data centers to Amazon's cloud computing data centers. - -“When combined with Crown Castle’s high-speed Cloud Connect fiber, the Kinetic Edge lets AWS developers build applications that span the entire continuum from core to edge. By enabling new classes of applications at the edge, we make it possible for any AWS developer to unlock the next generation of real-time, innovative use cases,” wrote Matt Trifiro, chief marketing officer of Vapor IO, in a [blog post][2]. - -**[ Read also:[What is edge computing and how it’s changing the network][3] ]** - -Vapor IO clams that the connection will lower latency by as much as 75%. “Connecting workloads and data at the Kinetic Edge with workloads and data in centralized AWS data centers makes it possible to build edge applications that leverage the full power of AWS,” wrote Trifiro. - -Developers building applications at the Kinetic Edge will have access to the full suite of AWS cloud computing services, including Amazon Simple Storage Service (Amazon S3), Amazon Elastic Cloud Compute (Amazon EC2), Amazon Virtual Private Cloud (Amazon VPC), and Amazon Relational Database Service (Amazon RDS). - -Crown Castle is the largest provider of shared communications infrastructure in the U.S., with 40,000 cell towers and 60,000 miles of fiber, offering 1Gbps to 10Gbps private fiber connectivity between the Kinetic Edge and AWS. - -AWS Direct Connect is a essentially a private connection between Amazon's AWS customers and their the AWS data centers, so customers don’t have to rout their traffic over the public internet and compete with Netflix and YouTube, for example, for bandwidth. - -### How edge computing works - -The structure of [edge computing][3] is the reverse of the standard internet design. Rather than sending all the data up to central servers, as much processing as possible is done at the edge. This is to reduce the sheer volume of data coming upstream and thus reduce latency. - -With things like smart cars, even if 95% of data is eliminated that remaining, 5% can still be a lot, so moving it fast is essential. Vapor IO said it will shuttle workloads to Amazon’s USEAST and USWEST data centers, depending on location. - -This shows how the edge is up-ending the traditional internet design and moving more computing outside the traditional data center, although a connection upstream is still important because it allows for rapid movement of necessary data from the edge to the cloud, where it can be stored or processed. - -**More about edge networking:** - - * [How edge networking and IoT will reshape data centers][4] - * [Edge computing best practices][5] - * [How edge computing can help secure the IoT][6] - - - -Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3391922/vapor-io-provides-direct-high-speed-connections-from-the-edge-to-aws.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/09/vapor-io-kinetic-edge-data-center-100771510-large.jpg -[2]: https://www.vapor.io/powering-amazon-web-services-at-the-kinetic-edge/ -[3]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html -[4]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html -[5]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html -[6]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html -[7]: https://www.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190506 Cisco boosts SD-WAN with multicloud-to-branch access system.md b/sources/talk/20190506 Cisco boosts SD-WAN with multicloud-to-branch access system.md deleted file mode 100644 index c676e5effb..0000000000 --- a/sources/talk/20190506 Cisco boosts SD-WAN with multicloud-to-branch access system.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco boosts SD-WAN with multicloud-to-branch access system) -[#]: via: (https://www.networkworld.com/article/3393232/cisco-boosts-sd-wan-with-multicloud-to-branch-access-system.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco boosts SD-WAN with multicloud-to-branch access system -====== -Cisco's SD-WAN Cloud onRamp for CoLocation can tie branch offices to private data centers in regional corporate headquarters via colocation facilities for shorter, faster, possibly more secure connections. -![istock][1] - -Cisco is looking to give traditional or legacy wide-area network users another reason to move to the [software-defined WAN world][2]. - -The company has rolled out an integrated hardware/software package called SD-WAN Cloud onRamp for CoLocation that lets customers tie distributed multicloud applications back to a local branch office or local private data center. The idea is that a cloud-to-branch link would be shorter, faster and possibly more secure that tying cloud-based applications directly all the way to the data center. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -“With Cisco SD-WAN Cloud onRamp for CoLocation operating regionally, connections from colocation facilities to branches are set up and configured according to traffic loads (such as video vs web browsing vs email) SLAs (requirements for low latency/jitter), and Quality of Experience for optimizing cloud application performance,” wrote Anand Oswal, senior vice president of engineering, in Cisco’s Enterprise Networking Business in a [blog about the new service][7]. - -According to Oswal, each branch or private data center is equipped with a network interface that provides a secure tunnel to the regional colocation facility. In turn, the Cloud onRamp for CoLocation establishes secure tunnels to SaaS application platforms, multi-cloud platform services, and enterprise data centers, he stated. - -Traffic is securely routed through the Cloud onRamp for CoLocation stack which includes security features such as application-aware firewalls, URL-filtering, intrusion detection/prevention, DNS-layer security, and Advanced Malware Protection (AMP) Threat Grid, as well as other network services such as load-balancing and Wide Area Application Services, Oswal wrote. - -A typical use case for the package is an enterprise that has dozens of distributed branch offices, clustered around major cities, spread over several countries. The goal is to tie each branch to enterprise data center databases, SaaS applications, and multi-cloud services while meeting service level agreements and application quality of experience, Oswal stated. - -“With virtualized Cisco SD-WAN running on regional colocation centers, the branch workforce has access to applications and data residing in AWS, Azure, and Google cloud platforms as well as SaaS providers such as Microsoft 365 and Salesforce—transparently and securely,” Oswal said. “Distributing SD-WAN features over a regional architecture also brings processing power closer to where data is being generated—at the cloud edge.” - -The idea is that paths to designated SaaS applications will be monitored continuously for performance, and the application traffic will be dynamically routed to the best-performing path, without requiring human intervention, Oswal stated. - -For a typical configuration, a region covering a target city uses a colocation IaaS provider that hosts the Cisco Cloud onRamp for CoLocation, which includes: - - * Cisco vManage software that lets customers manage applications and provision, monitor and troubleshooting the WAN. - * [Cisco Cloud Services Platform (CSP) 5000][8] The systems are x86 Linux Kernel-based Virtual Machine (KVM) software and hardware platforms for the data center, regional hub, and colocation Network Functions Virtualization (NFV). The platforms let enterprise IT teams or service providers deploy any Cisco or third-party network virtual service with Cisco’s [Network Services Orchestrator (NSO)][9] or any other northbound management and orchestration system. - * The Cisco [Catalyst 9500 Series][10] aggregation switches. Based on an x86 CPU, the Catalyst 9500 Series is Cisco’s lead purpose-built fixed core and aggregation enterprise switching platform, built for security, IoT, and cloud. The switches come with a 4-core x86, 2.4-GHz CPU, 16-GB DDR4 memory, and 16-GB internal storage. - - - -If the features of the package sound familiar, that’s because the [Cloud onRamp for CoLocation][11] package is the second generation of a similar SD-WAN package offered by Viptela which Cisco [bought in 2017][12]. - -SD-WAN's driving principle is to simplify the way big companies turn up new links to branch offices, better manage the way those links are utilized – for data, voice or video – and potentially save money in the process. - -It's a profoundly hot market with tons of players including [Cisco][13], VMware, Silver Peak, Riverbed, Aryaka, Fortinet, Nokia and Versa. IDC says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40% yearly clip between now and then. - -[SD-WAN][14] lets networks route traffic based on centrally managed roles and rules, no matter what the entry and exit points of the traffic are, and with full security. For example, if a user in a branch office is working in Office365, SD-WAN can route their traffic directly to the closest cloud data center for that app, improving network responsiveness for the user and lowering bandwidth costs for the business. - -"SD-WAN has been a promised technology for years, but in 2019 it will be a major driver in how networks are built and re-built," Oswal said a Network World [article][15] earlier this year. - -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/3393232/cisco-boosts-sd-wan-with-multicloud-to-branch-access-system.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/02/istock-578801262-100750453-large.jpg -[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://blogs.cisco.com/enterprise/cisco-sd-wan-cloud-onramp-for-colocation-multicloud -[8]: https://www.cisco.com/c/en/us/products/collateral/switches/cloud-services-platform-5000/nb-06-csp-5k-data-sheet-cte-en.html#ProductOverview -[9]: https://www.cisco.com/go/nso -[10]: https://www.cisco.com/c/en/us/products/collateral/switches/catalyst-9500-series-switches/data_sheet-c78-738978.html -[11]: https://www.networkworld.com/article/3207751/viptela-cloud-onramp-optimizes-cloud-access.html -[12]: https://www.networkworld.com/article/3193784/cisco-grabs-up-sd-wan-player-viptela-for-610m.html?nsdr=true -[13]: https://www.networkworld.com/article/3322937/what-will-be-hot-for-cisco-in-2019.html -[14]: https://www.networkworld.com/article/3031279/sd-wan/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html -[15]: https://www.networkworld.com/article/3332027/cisco-touts-5-technologies-that-will-change-networking-in-2019.html -[16]: https://www.facebook.com/NetworkWorld/ -[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190507 Server shipments to pick up in the second half of 2019.md b/sources/talk/20190507 Server shipments to pick up in the second half of 2019.md deleted file mode 100644 index 8169c594ef..0000000000 --- a/sources/talk/20190507 Server shipments to pick up in the second half of 2019.md +++ /dev/null @@ -1,56 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Server shipments to pick up in the second half of 2019) -[#]: via: (https://www.networkworld.com/article/3393167/server-shipments-to-pick-up-in-the-second-half-of-2019.html#tk.rss_all) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Server shipments to pick up in the second half of 2019 -====== -Server sales slowed in anticipation of the new Intel Xeon processors, but they are expected to start up again before the end of the year. -![Thinkstock][1] - -Global server shipments are not expected to return to growth momentum until the third quarter or even the fourth quarter of 2019, according to Taiwan-based tech news site DigiTimes, which cited unnamed server supply chain sources. The one bright spot remains cloud providers like Amazon, Google, and Facebook, which continue their buying binge. - -Normally I’d be reluctant to cite such a questionable source, but given most of the OEMs and ODMs are based in Taiwan and DigiTimes (the article is behind a paywall so I cannot link) has shown it has connections to them, I’m inclined to believe them. - -Quanta Computer chairman Barry Lam told the publication that Quanta's shipments of cloud servers have risen steadily, compared to sharp declines in shipments of enterprise servers. Lam continued that enterprise servers command only 1-2% of the firm's total server shipments. - -**[ Also read:[Gartner: IT spending to drop due to falling equipment prices][2] ]** - -[Server shipments began to slow down in the first quarter][3] thanks in part to the impending arrival of second-generation Xeon Scalable processors from Intel. And since it takes a while to get parts and qualify them, this quarter won’t be much better. - -In its latest quarterly earnings, Intel's data center group (DCG) said sales declined 6% year over year, the first decline of its kind since the first quarter of 2012 and reversing an average growth of over 20% in the past. - -[The Osbourne Effect][4] wasn’t the sole reason. An economic slowdown in China and the trade war, which will add significant tariffs to Chinese-made products, are also hampering sales. - -DigiTimes says Inventec, Intel's largest server motherboard supplier, expects shipments of enterprise server motherboards to further lose steams for the rest of the year, while sales of data center servers are expected to grow 10-15% on year in 2019. - -**[[Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][5] ]** - -It went on to say server shipments may concentrate in the second half or even the fourth quarter of the year, while cloud-based data center servers for the cloud giants will remain positive as demand for edge computing, new artificial intelligence (AI) applications, and the proliferation of 5G applications begin in 2020. - -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/3393167/server-shipments-to-pick-up-in-the-second-half-of-2019.html#tk.rss_all - -作者:[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://images.techhive.com/images/article/2017/04/2_data_center_servers-100718306-large.jpg -[2]: https://www.networkworld.com/article/3391062/it-spending-to-drop-due-to-falling-equipment-prices-gartner-predicts.html -[3]: https://www.networkworld.com/article/3332144/server-sales-projected-to-slow-while-memory-prices-drop.html -[4]: https://en.wikipedia.org/wiki/Osborne_effect -[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190509 Cisco adds AMP to SD-WAN for ISR-ASR routers.md b/sources/talk/20190509 Cisco adds AMP to SD-WAN for ISR-ASR routers.md deleted file mode 100644 index a5ec6212d8..0000000000 --- a/sources/talk/20190509 Cisco adds AMP to SD-WAN for ISR-ASR routers.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco adds AMP to SD-WAN for ISR/ASR routers) -[#]: via: (https://www.networkworld.com/article/3394597/cisco-adds-amp-to-sd-wan-for-israsr-routers.html#tk.rss_all) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco adds AMP to SD-WAN for ISR/ASR routers -====== -Cisco SD-WAN now sports Advanced Malware Protection on its popular edge routers, adding to their routing, segmentation, security, policy and orchestration capabilities. -![vuk8691 / Getty Images][1] - -Cisco has added support for Advanced Malware Protection (AMP) to its million-plus ISR/ASR edge routers, in an effort to [reinforce branch and core network malware protection][2] at across the SD-WAN. - -Cisco last year added its Viptela SD-WAN technology to the IOS XE version 16.9.1 software that runs its core ISR/ASR routers such as the ISR models 1000, 4000 and ASR 5000, in use by organizations worldwide. Cisco bought Viptela in 2017. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -The release of Cisco IOS XE offered an instant upgrade path for creating cloud-controlled SD-WAN fabrics to connect distributed offices, people, devices and applications operating on the installed base, Cisco said. At the time Cisco said that Cisco SD-WAN on edge routers builds a secure virtual IP fabric by combining routing, segmentation, security, policy and orchestration. - -With the recent release of [IOS-XE SD-WAN 16.11][7], Cisco has brought AMP and other enhancements to its SD-WAN. - -“Together with Cisco Talos [Cisco’s security-intelligence arm], AMP imbues your SD-WAN branch, core and campuses locations with threat intelligence from millions of worldwide users, honeypots, sandboxes, and extensive industry partnerships,” wrote Cisco’s Patrick Vitalone a product marketing manager in a [blog][8] about the security portion of the new software. “In total, AMP identifies more than 1.1 million unique malware samples a day." When AMP in Cisco SD-WAN spots malicious behavior it automatically blocks it, he wrote. - -The idea is to use integrated preventative engines, exploit prevention and intelligent signature-based antivirus to stop malicious attachments and fileless malware before they execute, Vitalone wrote. - -AMP support is added to a menu of security features already included in the SD-WAN software including support for URL filtering, [Cisco Umbrella][9] DNS security, Snort Intrusion Prevention, the ability to segment users across the WAN and embedded platform security, including the [Cisco Trust Anchor][10] module. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][11] ]** - -The software also supports [SD-WAN Cloud onRamp for CoLocation][12], which lets customers tie distributed multicloud applications back to a local branch office or local private data center. That way a cloud-to-branch link would be shorter, faster and possibly more secure that tying cloud-based applications directly to the data center. - -“The idea that this kind of security technology is now integrated into Cisco’s SD-WAN offering is a critical for Cisco and customers looking to evaluate SD-WAN offerings,” said Lee Doyle, principal analyst at Doyle Research. - -IOS-XE SD-WAN 16.11 is available now. - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394597/cisco-adds-amp-to-sd-wan-for-israsr-routers.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2018/09/shimizu_island_el_nido_palawan_philippines_by_vuk8691_gettyimages-155385042_1200x800-100773533-large.jpg -[2]: https://www.networkworld.com/article/3285728/what-are-the-options-for-securing-sd-wan.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://www.cisco.com/c/en/us/td/docs/routers/sdwan/release/notes/xe-16-11/sd-wan-rel-notes-19-1.html -[8]: https://blogs.cisco.com/enterprise/enabling-amp-in-cisco-sd-wan -[9]: https://www.networkworld.com/article/3167837/cisco-umbrella-cloud-service-shapes-security-for-cloud-mobile-resources.html -[10]: https://www.cisco.com/c/dam/en_us/about/doing_business/trust-center/docs/trustworthy-technologies-datasheet.pdf -[11]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[12]: https://www.networkworld.com/article/3393232/cisco-boosts-sd-wan-with-multicloud-to-branch-access-system.html -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190510 Supermicro moves production from China.md b/sources/talk/20190510 Supermicro moves production from China.md deleted file mode 100644 index 21739fa416..0000000000 --- a/sources/talk/20190510 Supermicro moves production from China.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Supermicro moves production from China) -[#]: via: (https://www.networkworld.com/article/3394404/supermicro-moves-production-from-china.html#tk.rss_all) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Supermicro moves production from China -====== -Supermicro was cleared of any activity related to the Chinese government and secret chips in its motherboards, but it is taking no chances and is moving its facilities. -![Frank Schwichtenberg \(CC BY 4.0\)][1] - -Server maker Supermicro, based in Fremont, California, is reportedly moving production out of China over customer concerns that the Chinese government had secretly inserted chips for spying into its motherboards. - -The claims were made by Bloomberg late last year in a story that cited more than 100 sources in government and private industry, including Apple and Amazon Web Services (AWS). However, Apple CEO Tim Cook and AWS CEO Andy Jassy denied the claims and called for Bloomberg to retract the article. And a few months later, the third-party investigations firm Nardello & Co examined the claims and [cleared Supermicro][2] of any surreptitious activity. - -At first it seemed like Supermicro was weathering the storm, but the story did have a negative impact. Server sales have fallen since the Bloomberg story, and the company is forecasting a near 10% decline in total revenues for the March quarter compared to the previous three months. - -**[ Also read:[Who's developing quantum computers][3] ]** - -And now, Nikkei Asian Review reports that despite the strong rebuttals, some customers remain cautious about the company's products. To address those concerns, Nikkei says Supermicro has told suppliers to [move production out of China][4], citing industry sources familiar with the matter. - -It also has the side benefit of mitigating against the U.S.-China trade war, which is only getting worse. Since the tariffs are on the dollar amount of the product, that can quickly add up even for a low-end system, as Serve The Home noted in [this analysis][5]. - -Supermicro is the world's third-largest server maker by shipments, selling primarily to cloud providers like Amazon and Facebook. It does its own assembly in its Fremont facility but outsources motherboard production to numerous suppliers, mostly China and Taiwan. - -"We have to be more self-reliant [to build in-house manufacturing] without depending only on those outsourcing partners whose production previously has mostly been in China," an executive told Nikkei. - -Nikkei notes that roughly 90% of the motherboards shipped worldwide in 2017 were made in China, but that percentage dropped to less than 50% in 2018, according to Digitimes Research, a tech supply chain specialist based in Taiwan. - -Supermicro just held a groundbreaking ceremony in Taiwan for a 800,000 square foot manufacturing plant in Taiwan and is expanding its San Jose, California, plant as well. So, they must be anxious to be free of China if they are willing to expand in one of the most expensive real estate markets in the world. - -A Supermicro spokesperson said via email, “We have been expanding our manufacturing capacity for many years to meet increasing customer demand. We are currently constructing a new Green Computing Park building in Silicon Valley, where we are the only Tier 1 solutions vendor manufacturing in Silicon Valley, and we proudly broke ground this week on a new manufacturing facility in Taiwan. To support our continued global growth, we look forward to expanding in Europe as well.” - -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/3394404/supermicro-moves-production-from-china.html#tk.rss_all - -作者:[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://images.idgesg.net/images/article/2019/05/supermicro_-_x11sae__cebit_2016_01-100796121-large.jpg -[2]: https://www.networkworld.com/article/3326828/investigator-finds-no-evidence-of-spy-chips-on-super-micro-motherboards.html -[3]: https://www.networkworld.com/article/3275385/who-s-developing-quantum-computers.html -[4]: https://asia.nikkei.com/Economy/Trade-war/Server-maker-Super-Micro-to-ditch-made-in-China-parts-on-spy-fears -[5]: https://www.servethehome.com/how-tariffs-hurt-intel-xeon-d-atom-and-amd-epyc-3000/ -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190513 HPE-s CEO lays out his technology vision.md b/sources/talk/20190513 HPE-s CEO lays out his technology vision.md deleted file mode 100644 index c9a8de9c8a..0000000000 --- a/sources/talk/20190513 HPE-s CEO lays out his technology vision.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HPE’s CEO lays out his technology vision) -[#]: via: (https://www.networkworld.com/article/3394879/hpe-s-ceo-lays-out-his-technology-vision.html) -[#]: author: (Eric Knorr ) - -HPE’s CEO lays out his technology vision -====== -In an exclusive interview, HPE CEO Antonio Neri unpacks his portfolio of technology initiatives, from edge computing to tomorrow’s memory-driven architecture. -![HPE][1] - -Like Microsoft's Satya Nadella, HPE CEO Antonio Neri is a technologist with a long history of leading initiatives in his company. Meg Whitman, his former boss at HPE, showed her appreciation of Neri’s acumen by promoting him to HPE Executive Vice President in 2015 – and gave him the green light to acquire [Aruba][2], [SimpliVity][3], [Nimble Storage][4], and [Plexxi][5], all of which added key items to HPE’s portfolio. - -Neri succeeded Whitman as CEO just 16 months ago. In a recent interview with Network World, Neri’s engineering background was on full display as he explained HPE’s technology roadmap. First and foremost, he sees a huge opportunity in [edge computing][6], into which HPE is investing $4 billion over four years to further develop edge “connectivity, security, and obviously cloud and analytics.” - -**More about edge networking** - - * [How edge networking and IoT will reshape data centers][7] - * [Edge computing best practices][8] - * [How edge computing can help secure the IoT][9] - - - -Although his company abandoned its public cloud efforts in 2015, Neri is also bullish on the self-service “cloud experience,” which he asserts HPE is already implementing on-prem today in a software-defined, consumption-driven model. More fundamentally, he believes we are on the brink of a memory-driven computing revolution, where storage and memory become one and, depending on the use case, various compute engines are brought to bear on zettabytes of data. - -This interview, conducted by Network World Editor-in-Chief Eric Knorr and edited for length and clarity, digs into Neri’s technology vision. [A companion interview on CIO][10] centers on Neri’s views of innovation, management, and company culture. - -**Eric Knorr: ** Your biggest and highest profile investment so far has been in edge computing. My understanding of edge computing is that we’re really talking about mini-data centers, defined by IDC as less than 100 square feet in size. What’s the need for a $4 billion investment in that? - -**Antonio Neri:** It’s twofold. We focus first on connectivity. Think about Aruba as a platform company, a cloud-enabled company. Now we offer branch solutions and edge data center solutions that include [wireless][11], LAN, [WAN][12] connectivity and soon [5G][13]. We give you a control plane so that that connectivity experience can be seen consistently the same way. All the policy management, the provisioning and the security aspects of it. - -**Knorr:** Is 5G a big focus? - -**[[Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][14] ]** - -**Neri:** It’s a big focus for us. What customers are telling us is that it’s hard to get 5G inside the building. How you do hand off between 5G and Wi-Fi and give them the same experience? Because the problem is that we have LAN, wireless, and WAN already fully integrated into the control plane, but 5G sits over here. If you are an enterprise, you have to manage these two pipes independently. - -With the new spectrum, though, they are kind of comingling anyway. [Customers ask] why don’t you give me [a unified] experience on top of that, with all this policy management and cloud-enablement, so I can provision the right connectivity for the right use case? A sensor can use a lower radio access or [Bluetooth][15] or other type of connectivity because you don’t need persistent connectivity and you don’t have the power to do it. - -In some cases, you just put a SIM on it, and you have 5G, but in another one it’s just wireless connectivity. Wi-Fi connectivity is significantly lower cost than 5G. The use cases will dictate what type of connectivity you need, but the reality is they all want one experience. And we can do that because we have a great platform and a great partnership with MSPs, telcos, and providers. - -**Knorr:** So it sounds like much of your investment is going into that integration. - -**Neri:** The other part is how we provide the ability to provision the right cloud computing at the edge for the right use cases. Think about, for example, a manufacturing floor. We can converge the OT and IT worlds through a converged infrastructure aspect that digitizes the analog process into a digital process. We bring the cloud compute in there, which is fully virtualized and containerized, we integrate Wi-Fi connectivity or LAN connectivity, and we eliminate all these analog processes that are multi-failure touchpoints because you have multiple things that have to come together. - -That’s a great example of a cloud at the edge. And maybe that small cloud is connected to a big cloud which could be in the large data center, which the customer owns – or it can be one of the largest public cloud providers. - -**Knorr:** It’s difficult to talk about the software-defined data center and private cloud without talking about [VMware][16]. Where do your software-defined solutions leave off and where does VMware begin? - -**Neri:** Where we stop is everything below the hypervisor, including the software-defined storage and things like SimpliVity. That has been the advantage we’ve had with [HPE OneView][17], so we can provision and manage the infrastructure-life-cycle and software-defined aspects at the infrastructure level. And let’s not forget security, because we’ve integrated [silicon root of trust][18] into our systems, which is a good advantage for us in the government space. - -Then above that we continue to develop capabilities. Customers want choice. That’s why [the partnership with Nutanix][19] was important. We offer an alternative to vSphere and vCloud Foundation with Nutanix Prism and Acropolis. - -**Knorr:** VMware has become the default for the private cloud, though. - -**Neri:** Obviously, VMware owns 60 percent of the on-prem virtualized environment, but more and more, containers are becoming the way to go in a cloud-native approach. For us, we own the full container stack, because we base our solution on Kubernetes. We deploy that. That’s why the partnership with Nutanix is important. With Nutanix, we offer KVM and the Prism stack and then we’re fully integrated with HPE OneView for the rest of the infrastructure. - -**Knorr:** You also offer GKE [Google [Kubernetes][20] Engine] on-prem. - -**Neri:** Correct. We’re working with Google on the next version of that. - -**Knorr:** How long do you think it will be before you start seeing Kubernetes and containers on bare metal? - -**Neri:** It’s an interesting question. Many customers tell us it’s like going back to the future. It’s like we’re paying this tax on the virtualization layer. - -**Knorr:** Exactly. - -**Neri:** I can go bare metal and containers and be way more efficient. It is a little bit back to the future. But it’s a different future. - -**Knorr:** And it makes the promise of [hybrid cloud][21] a little more real. I know HPE has been very bullish on hybrid. - -**Neri:** We have been the one to say the world would be hybrid. - -**Knorr:** But today, how hybrid is hybrid really? I mean, you have workloads in the public cloud, you have workloads in a [private cloud][22]. Can you really rope it all together into hybrid? - -**Neri:** I think you have to have portability eventually. - -**Knorr:** Eventually. It’s not really true now, though. - -**Neri:** No, not true now. If you look at it from the software brokering perspective that makes hybrid very small. We know this eventually has to be all connected, but it’s not there yet. More and more of these workloads have to go back and forth. - -If you ask me what the CIO role of the future will look like, it would be a service provider. I wake up in the morning, have a screen that says – oh, you know what? Today it’s cheaper to run that app here. I just slice it there and then it just moves. Whatever attributes on the data I want to manage and so forth – oh, today I have capacity here and by the way, why are you not using it? Slide it back here. That’s the hybrid world. - -Many people, when they started with the cloud, thought, “I’ll just virtualize everything,” but that’s not the cloud. You’re [virtualizing][23], but you have to make it self-service. Obviously, cloud-native applications have developed that are different today. That’s why containers are definitely a much more efficient way, and that’s why I agree that the bare-metal piece of this is coming back. - -**Knorr:** Do you worry about public cloud incursions into the [data center][24]? - -**Neri:** It’s happening. Of course I’m worried. But what at least gives me comfort is twofold. One is that the customer wants choice. They don’t want to be locked in. Service is important. It’s one thing to say: Here’s the system. The other is: Who’s going to maintain it for me? Who is going to run it for me? And even though you have all the automation tools in the world, somebody has to watch this thing. Our job is to bring the public-cloud experience on prem, so that the customer has that choice. - -**Knorr:** Part of that is economics. - -**Neri:** When you look at economics it’s no longer just the cost of compute anymore. What we see more and more is the cost of the data bandwidth back and forth. That’s why the first question a customer asks is: Where should I put my data? And that dictates a lot of things, because today the data transfer bill is way higher than the cost of renting a VM. - -The other thing is that when you go on the public cloud you can spin up a VM, but the problem is if you don’t shut it off, the bill keeps going. We brought, in the context of [composability][25], the ability to shut it off automatically. That’s why composability is important, because we can run, first of all, multi-workloads in the same infrastructure – whether it’s bare metal, virtualized or containerized. It’s called composable because the software layers of intelligence compose the right solutions from compute, storage, fabric and memory to that workload. When it doesn’t need it, it gives it back. - -**Knorr:** Is there any opportunity left at the hardware level to innovate? - -**Neri:** That’s why we think about memory-driven computing. Today we have a very CPU-centric approach. This is a limiting factor, and the reality is, if you believe data is the core of the architecture going forward, then the CPU can’t be the core of the architecture anymore. - -You have a bunch of inefficiency by moving data back and forth across the system, which also creates energy waste and so forth. What we are doing is basically rearchitecting this for once in 70 years. We take memory and storage and collapse the two into one, so this becomes one central pool, which is nonvolatile and becomes the core. And then we bring the right computing capability to the data. - -In an AI use case, you don’t move the data. You bring accelerators or GPUs to the data. For general purpose, you may use an X86, and maybe in video transcoding, you use an ARM-based architecture. The magic is this: You can do this on zettabytes of data and the benefit is there is no waste, very little power to keep it alive, and it’s persistent. - -We call this the Generation Z fabric, which is based on a data fabric and silicon photonics. Now we go from copper, which is generating a lot of waste and a lot of heat and energy, to silicon photonics. So we not only scale this to zettabytes, we can do massive amounts of computation by bringing the right compute at the speed that’s needed to the data – and we solve a cost and scale problem too, because copper today costs a significant amount of money, and gold-plated connectors are hundreds of dollars. - -We’re going to actually implement this capability in silicon photonics in our current architectures by the end of the year. In Synergy, for example, which is a composable blade system, at the back of the rack you can swap from Ethernet to silicon photonics. It was designed that way. We already prototyped this in a simple 2U chassis with 160 TB of memory and 2000 cores. We were able to process a billion-record database with 55 million combinations of algorithms in less than a minute. - -**Knorr:** So you’re not just focusing on the edge, but the core, too. - -**Neri:** As you go down from the cloud to the edge, that architecture actually scales to the smallest things. You can do it on a massive scale or you can do it on a small scale. We will deploy these technologies in our systems architectures now. Once the whole ecosystem is developed, because we also need an ISV ecosystem that can code applications in this new world or you’re not taking advantage of it. Also, the current Linux kernel can only handle so much memory, so you have to rewrite the kernel. We are working with two universities to do that. - -The hardware will continue to evolve and develop, but there still is a lot of innovation that has to happen. What’s holding us back, honestly, is the software. - -**Knorr:** And that’s where a lot of your investment is going? - -**Neri:** Correct. Exactly right. Systems software, not application software. It’s the system software that makes this infrastructure solution-oriented, workload-optimized, autonomous and efficient. - -Join the Network World communities on [Facebook][26] and [LinkedIn][27] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394879/hpe-s-ceo-lays-out-his-technology-vision.html - -作者:[Eric Knorr][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://images.idgesg.net/images/article/2019/05/antonio-neri_hpe_new-100796112-large.jpg -[2]: https://www.networkworld.com/article/2891130/aruba-networks-is-different-than-hps-failed-wireless-acquisitions.html -[3]: https://www.networkworld.com/article/3158784/hpe-buying-simplivity-for-650-million-to-boost-hyperconvergence.html -[4]: https://www.networkworld.com/article/3177376/hpe-to-pay-1-billion-for-nimble-storage-after-cutting-emc-ties.html -[5]: https://www.networkworld.com/article/3273113/hpe-snaps-up-hyperconverged-network-hcn-vendor-plexxi.html -[6]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html -[7]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html -[8]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html -[9]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html -[10]: https://www.cio.com/article/3394598/hpe-ceo-antonio-neri-rearchitects-for-the-future.html -[11]: https://www.networkworld.com/article/3238664/80211-wi-fi-standards-and-speeds-explained.html -[12]: https://www.networkworld.com/article/3248989/what-is-a-wide-area-network-a-definition-examples-and-where-wans-are-headed.html -[13]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html -[14]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[15]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html -[16]: https://www.networkworld.com/article/3340259/vmware-s-transformation-takes-hold.html -[17]: https://www.networkworld.com/article/2174203/hp-expands-oneview-into-vmware-environs.html -[18]: https://www.networkworld.com/article/3199826/hpe-highlights-innovation-in-software-defined-it-security-at-discover.html -[19]: https://www.networkworld.com/article/3388297/hpe-and-nutanix-partner-for-hyperconverged-private-cloud-systems.html -[20]: https://www.infoworld.com/article/3268073/what-is-kubernetes-container-orchestration-explained.html -[21]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html -[22]: https://www.networkworld.com/article/2159885/cloud-computing-gartner-5-things-a-private-cloud-is-not.html -[23]: https://www.networkworld.com/article/3285906/whats-the-future-of-server-virtualization.html -[24]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[25]: https://www.networkworld.com/article/3266106/what-is-composable-infrastructure.html -[26]: https://www.facebook.com/NetworkWorld/ -[27]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190514 Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise.md b/sources/talk/20190514 Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise.md deleted file mode 100644 index e821405199..0000000000 --- a/sources/talk/20190514 Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise.md +++ /dev/null @@ -1,56 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise) -[#]: via: (https://www.networkworld.com/article/3394687/brillio-and-blue-planet-partner-to-bring-network-automation-to-the-enterprise.html) -[#]: author: (Rick Hamilton, Senior Vice President, Blue Planet Software ) - -Brillio and Blue Planet Partner to Bring Network Automation to the Enterprise -====== -Rick Hamilton, senior vice president of Blue Planet, a division of Ciena, explains how partnering with Brillio brings the next generation of network capabilities to enterprises—just when they need it most. -![Kritchanut][1] - -![][2] - -_Rick Hamilton, senior vice president of Blue Planet, a division of Ciena, explains how partnering with Brillio brings the next generation of network capabilities to enterprises—just when they need it most._ - -In February 2019, we announced that Blue Planet was evolving into a more independent division, helping us increase our focus on innovative intelligent automation solutions that help our enterprise and service provider customers accelerate and achieve their business transformation goals. - -Today we’re excited to make another leap forward in delivering these benefits to enterprises of all types via our partnership with digital transformation services and solutions leader Brillio. Together, we are co-creating intelligent cloud and network management solutions that increase service visibility and improve service assurance by effectively leveraging the convergence of cloud, IoT, and AI. - -**Accelerating digital transformation in the enterprise** - -Enterprises continue to look toward cloud services to create new and incremental revenue streams based on innovative solution offerings and on-demand product/solution delivery models, and to optimize their infrastructure investments. In fact, Gartner predicts that enterprise IT spending for cloud-based offerings will continue to grow faster than non-cloud IT offerings, making up 28% of spending by 2022, up from 19% in 2018. - -As enterprises adopt cloud, they realize there are many challenges associated with traditional approaches to operating and managing complex and hybrid multi-cloud environments. Our partnership with Brillio enables us to help these organizations across industries such as manufacturing, logistics, retail, and financial services meet their technical and business needs with high-impact solutions that improve customer experiences, drive operational efficiencies, and improve quality of service. - -This is achieved by combining the Blue Planet intelligent automation platform and the Brillio CLIP™services delivery excellence platform and user-centered design (UCD) lead solution framework. Together, we offer end-to-end visibility of application and infrastructure assets in a hybrid multi-cloud environment and provide service assurance and self-healing capabilities that improve network and service availability. - -**Partnering on research and development** - -Brillio will also partner with Blue Planet on longer-term R&D efforts. As one of a preferred product engineering services providers, Brillio will work closely with our engineering team to develop and deliver network intelligence and automation solutions to help enterprises build dynamic, programmable infrastructure that leverage analytics and automation to realize the Adaptive Network vision. - -Of course, a partnership like this is a two-way street, and we consider Brillio’s choice to work with us to be a testament to our expertise, vision, and execution. In the words of Brillio Chairman and CEO Raj Mamodia, “Blue Planet’s experience in end-to-end service orchestration coupled with Brillio’s expertise in cloudification, user-centered enterprise solutions design, and rapid software development delivers distinct advantages to the industry. Through integration of technologies like cloud, IoT, and AI into our combined solutions, our partnership spurs greater innovation and helps us address the large and growing enterprise networking automation market.” - -Co-creating intelligent hybrid cloud and network management solutions with Brillio is key to advancing enterprise digital transformation initiatives. Partnering with Brillio helps us address the plethora of challenges facing enterprises today on their digital journey. Our partnership enables Blue Planet to achieve faster time-to-market and greater efficiency in developing new solutions to enable enterprises to continue to thrive and grow. - -[Learn more about Blue Planet here][3] - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3394687/brillio-and-blue-planet-partner-to-bring-network-automation-to-the-enterprise.html - -作者:[Rick Hamilton, Senior Vice President, Blue Planet Software][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://images.idgesg.net/images/article/2019/05/istock-952625346-100796314-large.jpg -[2]: https://images.idgesg.net/images/article/2019/05/rick-100796315-small.jpg -[3]: https://www.blueplanet.com/?utm_campaign=X1058319&utm_source=NWW&utm_term=BPWeb_Brillio&utm_medium=sponsoredpost3Q19 diff --git a/sources/talk/20190514 Las Vegas targets transport, public safety with IoT deployments.md b/sources/talk/20190514 Las Vegas targets transport, public safety with IoT deployments.md deleted file mode 100644 index 84a563c8bc..0000000000 --- a/sources/talk/20190514 Las Vegas targets transport, public safety with IoT deployments.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Las Vegas targets transport, public safety with IoT deployments) -[#]: via: (https://www.networkworld.com/article/3395536/las-vegas-targets-transport-public-safety-with-iot-deployments.html) -[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) - -Las Vegas targets transport, public safety with IoT deployments -====== - -![Franck V. \(CC0\)][1] - -The city of Las Vegas’ pilot program with NTT and Dell, designed to crack down on wrong-way driving on municipal roads, is just part of the big plans that Sin City has for leveraging IoT tech in the future, according to the city's director of technology Michael Sherwood, who sat down with Network World at the IoT World conference in Silicon Valley this week. - -The system uses smart cameras and does most of its processing at the edge, according to Sherwood. The only information that gets sent back to the city’s private cloud is metadata – aggregated information about overall patterns, for decision-making and targeting purposes, not data about individual traffic incidents and wrong-way drivers. - -**[ Also see[What is edge computing?][2] and [How edge networking and IoT will reshape data centers][3].]** - -It’s an important public safety consideration, he said, but it’s a small part of the larger IoT-enabled framework that the city envisions for the future. - -“Our goal is to make our data open to the public, not only for transparency purposes, but to help spur development and create new applications to make Vegas a better place to live,” said Sherwood. - -[The city’s public data repository][4] already boasts a range of relevant data, some IoT-generated, some not. And efforts to make that data store more open have already begun to bear fruit, according to Sherwood. For example, one hackathon about a year ago resulted in an Alexa app that tells users how many traffic lights are out, by tracking energy usage data via the city’s portal, among other applications. - -As with IoT in general, Sherwood said that the city’s efforts have been bolstered by an influx of operational talen. Rather than additional IT staff to run the new systems, they’ve brought in experts from the traffic department to help get the most out of the framework. - -Another idea for leveraging the city’s traffic data involves tracking the status of the curb. Given the rise of Uber and Lyft and other on-demand transportation services, linking a piece of camera-generated information like “rideshares are parked along both sides of this street” directly into a navigation app could help truck drivers avoid gridlock. - -“We’re really looking to make the roads a living source of information,” Sherwood said. - -**Safer parks** - -Las Vegas is also pursuing related public safety initiatives. One pilot project aims to make public parks safer by installing infrared cameras so authorities can tell whether people are in parks after hours without incurring undue privacy concerns, given that facial recognition is very tricky in infrared. - -It’s the test-and-see method of IoT development, according to Sherwood. - -“That’s a way of starting with an IoT project: start with one park. The cost to do something like this is not astronomical, and it allows you to gauge some other information from it,” he said. - -The city has also worked to keep the costs of these projects low or even show a returnon investment, Sherwood added. Workforce development programs could train municipal workers to do simple maintenance on smart cameras in parks or along roadways, and the economic gains made from the successful use of the systems ought to outweigh deployment and operational outlay. - -“If it’s doing it’s job, those efficiencies should cover the system’s cost,” he 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/3395536/las-vegas-targets-transport-public-safety-with-iot-deployments.html - -作者:[Jon Gold][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/Jon-Gold/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/07/pedestrian-walk-sign_go_start_begin_traffic-light_by-franck-v-unsplaash-100765089-large.jpg -[2]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html -[3]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html -[4]: https://opendata.lasvegasnevada.gov/ -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190515 IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services.md b/sources/talk/20190515 IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services.md deleted file mode 100644 index b69109641d..0000000000 --- a/sources/talk/20190515 IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services) -[#]: via: (https://www.networkworld.com/article/3395776/ibm-overhauls-mainframe-software-pricing-adds-hybrid-private-cloud-services.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -IBM overhauls mainframe-software pricing, adds hybrid, private-cloud services -====== -IBM brings cloud consumption model to the mainframe, adds Docker container extensions -![Thinkstock][1] - -IBM continues to adopt new tools and practices for its mainframe customers to keep the Big Iron relevant in a cloud world. - -First of all, the company switched-up its 20-year mainframe software pricing scheme to make it more palatable to hybrid and multicloud users who might be thinking of moving workloads off the mainframe and into the cloud. - -**[ Check out[What is hybrid cloud computing][2] and learn [what you need to know about multi-cloud][3]. | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** - -Specifically IBM rolled out Tailored Fit Pricing for the IBM Z mainframe which offers two consumption-based pricing models that can help customers cope with ever-changing workload – and hence software – costs. - -Tailored Fit Pricing removes the need for complex and restrictive capping, which typically weakens responsiveness and can impact service level availability, IBM said. IBM’s standard monthly mainframe licensing model calculates costs as a “rolling four-hour average” (R4HA) which would determine cost based on a customer’s peak usage during the month. Customers would many time cap usage to keep costs down, experts said - -Systems can now be configured to support optimal response times and service level agreements, rather than artificially slowing down workloads to manage software licensing costs, IBM stated. - -Predicting demand for IT services can be a major challenge and in the era of hybrid and multicloud, everything is connected and workload patterns constantly change, wrote IBM’s Ross Mauri, General Manager, IBM Z in a [blog][5] about the new pricing and services. “In this environment, managing demand for IT services can be a major challenge. As more customers shift to an enterprise IT model that incorporates on-premises, private cloud and public we’ve developed a simple cloud pricing model to drive the transformation forward.” - -[Tailored Fit Pricing][6] for IBM Z comes in two flavors, the Enterprise Consumption Solution and the Enterprise Capacity Solution. - -IBM said the Enterprise Consumption model is a tailored usage-based pricing model, where customers pay only for what they use, removing the need for complex and restrictive capping, IBM said. - -The Enterprise Capacity model lets customers mix and match workloads to help maximize use of the full capacity of the platform. Charges are referenced to the overall size of the physical environment and are calculated based on the estimated mix of workloads running, while providing the flexibility to vary actual usage across workloads, IBM said. - -The software pricing changes should be a welcome benefit to customers, experts said. - -“By making access to Z mainframes more flexible and ‘cloud-like,’ IBM is making it less likely that customers will consider shifting Z workloads to other systems and environments. As cloud providers become increasingly able to support mission critical applications, that’s a big deal,” wrote Charles King, president and principal analyst for Pund-IT in a [blog][7] about the IBM changes. - -“A notable point about both models is that discounted growth pricing is offered on all workloads – whether they be 40-year old Assembler programs or 4-day old JavaScript apps. This is in contrast to previous models which primarily rewarded only brand-new applications with growth pricing. By thinking outside the Big Iron box, the company has substantially eased the pain for its largest clients’ biggest mainframe-related headaches,” King wrote. - -IBM’s Tailored Fit Pricing supports an increasing number of enterprises that want to continue to grow and build new services on top of this mission-critical platform, wrote [John McKenny][8] vice president of strategy for ZSolutions Optimization at BMC Software. “In not yet released results from the 2019 BMC State of the Mainframe Survey, 62% of the survey respondents reported that they are planning to expand MIPS/MSU consumption and are growing their mainframe workloads. For customers with no current plans for growth, the affordability and cost-competitiveness of the new pricing model will re-ignite interest in also using this platform as an integral part of their hybrid cloud strategies.” - -In addition to the pricing, IBM announced some new services that bring the mainframe closer to cloud workloads. - -First, IBM rolled out z/OS Container Extensions (zCX), which makes it possible to run Linux on Z applications that are packaged as Docker Container images on z/OS. Application developers can develop and data centers can operate popular open source packages, Linux applications, IBM software, and third-party software together with z/OS applications and data, IBM said. zCX will let customers use the latest open source tools, popular NoSQL databases, analytics frameworks, application servers, and so on within the z/OS environment. - -“With z/OS Container Extensions, customers will be able to access the most recent development tools and processes available in Linux on the Z ecosystem, giving developers the flexibility to build new, cloud-native containerized apps and deploy them on z/OS without requiring Linux or a Linux partition,” IBM’s Mauri stated. - -Big Blue also rolled out z/OS Cloud Broker which will let customers access and deploy z/OS resources and services on [IBM Cloud Private][9]. [IBM Cloud Private][10] is the company’s Kubernetes-based Platform as a Service (PaaS) environment for developing and managing containerized applications. IBM said z/OS Cloud Broker is designed to help cloud application developers more easily provision and deprovision apps in z/OS environments. - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3395776/ibm-overhauls-mainframe-software-pricing-adds-hybrid-private-cloud-services.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://images.techhive.com/images/article/2015/08/thinkstockphotos-520137237-100610459-large.jpg -[2]: https://www.networkworld.com/article/3233132/cloud-computing/what-is-hybrid-cloud-computing.html -[3]: https://www.networkworld.com/article/3252775/hybrid-cloud/multicloud-mania-what-to-know.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://www.ibm.com/blogs/systems/ibm-z-defines-the-future-of-hybrid-cloud/ -[6]: https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS219-014&appname=USN -[7]: https://www.pund-it.com/blog/ibm-reinvents-the-z-mainframe-again/ -[8]: https://www.bmc.com/blogs/bmc-supports-ibm-tailored-fit-pricing-ibm-z/ -[9]: https://www.ibm.com/marketplace/cloud-private-on-z-and-linuxone -[10]: https://www.networkworld.com/article/3340043/ibm-marries-on-premises-private-and-public-cloud-data.html -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190517 HPE to buy Cray, offer HPC as a service.md b/sources/talk/20190517 HPE to buy Cray, offer HPC as a service.md deleted file mode 100644 index a1dafef683..0000000000 --- a/sources/talk/20190517 HPE to buy Cray, offer HPC as a service.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HPE to buy Cray, offer HPC as a service) -[#]: via: (https://www.networkworld.com/article/3396220/hpe-to-buy-cray-offer-hpc-as-a-service.html) -[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) - -HPE to buy Cray, offer HPC as a service -====== -High-performance computing offerings from HPE plus Cray could enable things like AI, ML, high-speed financial trading, creation digital twins for entire enterprise networks. -![Cray Inc.][1] - -HPE has agreed to buy supercomputer-maker Cray for $1.3 billion, a deal that the companies say will bring their corporate customers high-performance computing as a service to help with analytics needed for artificial intelligence and machine learning, but also products supporting high-performance storage, compute and software. - -In addition to bringing HPC capabilities that can blend with and expand HPE’s current products, Cray brings with it customers in government and academia that might be interested in HPE’s existing portfolio as well. - -**[ Now read:[Who's developing quantum computers][2] ]** - -The companies say they expect to close the cash deal by the end of next April. - -The HPC-as-a-service would be offered through [HPE GreenLake][3], the company’s public-, private-, hybrid-cloud service. Such a service could address periodic enterprise need for fast computing that might otherwise be too expensive, says Tim Zimmerman, an analyst with Gartner. - -Businesses could use the service, for example, to create [digital twins][4] of their entire networks and use them to test new code to see how it will impact the network before deploying it live, Zimmerman says. - -Cray has HPC technology that HPE Labs might be exploring on its own, but that can be brought to market in a much quicker timeframe. - -HPE says that overall, buying cray give it technologies needed for massively data-intensive workloads such as AI and ML that is used for engineering services, transaction-based trading by financial firms, pharmaceutical research and academic studies into weather and genomes, for instance, Zimmerman says. - -As HPE puts it, Cray supercomputing platforms “have the ability to handle massive data sets, converged modelling, simulation, AI and analytics workloads.” - -Cray is working on [what it says will be the world’s fastest supercomputer][5] when it’s finished in 2021, cranking out 1.5 exaflops. The current fastest supercomputer is 143.5 petaflops. [Click [here][6] to see the current top 10 fastest supercomputers.] - -In general, HPE says it hopes to create a comprehensive line of products to support HPC infrastructure including “compute, high-performance storage, system interconnects, software and services.” - -Together, the talent in the two companies and their combined technologies should be able to increase innovation, HPE says. - -Earlier this month, HPE’s CEO Antonio Neri said in [an interview with _Network World_][7] that the company will be investing $4 billion over four years in a range of technology to boost “connectivity, security, and obviously cloud and analytics.” In laying out the company’s roadmap he made no specific mention of HPC. - -HPE net revenues last fiscal year were $30.9 billion. Cray’s total revenue was $456 million, with a gross profit of $130 million. - -The acquisition will pay $35 per share for Cray stock. - -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/3396220/hpe-to-buy-cray-offer-hpc-as-a-service.html - -作者:[Tim Greene][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/Tim-Greene/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/06/the_cray_xc30_piz_daint_system_at_the_swiss_national_supercomputing_centre_via_cray_inc_3x2_978x652-100762113-large.jpg -[2]: https://www.networkworld.com/article/3275385/who-s-developing-quantum-computers.html -[3]: https://www.networkworld.com/article/3280996/hpe-adds-greenlake-hybrid-cloud-to-enterprise-service-offerings.html -[4]: https://www.networkworld.com/article/3280225/what-is-digital-twin-technology-and-why-it-matters.html -[5]: https://www.networkworld.com/article/3373539/doe-plans-worlds-fastest-supercomputer.html -[6]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html -[7]: https://www.networkworld.com/article/3394879/hpe-s-ceo-lays-out-his-technology-vision.html -[8]: https://www.facebook.com/NetworkWorld/ -[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190523 Cisco ties its security-SD-WAN gear with Teridion-s cloud WAN service.md b/sources/talk/20190523 Cisco ties its security-SD-WAN gear with Teridion-s cloud WAN service.md deleted file mode 100644 index 2638987b16..0000000000 --- a/sources/talk/20190523 Cisco ties its security-SD-WAN gear with Teridion-s cloud WAN service.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco ties its security/SD-WAN gear with Teridion’s cloud WAN service) -[#]: via: (https://www.networkworld.com/article/3396628/cisco-ties-its-securitysd-wan-gear-with-teridions-cloud-wan-service.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco ties its security/SD-WAN gear with Teridion’s cloud WAN service -====== -An agreement links Cisco Meraki MX Security/SD-WAN appliances and its Auto VPN technology to Teridion’s cloud-based WAN service that claims to accelerate TCP-based applications by up to 5X. -![istock][1] - -Cisco and Teridion have tied the knot to deliver faster enterprise [software-defined WAN][2] services. - -The agreement links [Cisco Meraki][3] MX Security/SD-WAN appliances and its Auto [VPN][4] technology which lets users quickly bring up and configure secure sessions between branches and data centers with [Teridion’s cloud-based WAN service][5]. Teridion’s service promises customers better performance and control over traffic running from remote offices over the public internet to the [data center][6]. The service features what Teridion calls “Curated Routing” which fuses WAN acceleration techniques with route optimization to speed traffic. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][7] - * [How to pick an off-site data-backup method][8] - * [SD-Branch: What it is and why you’ll need it][9] - * [What are the options for security SD-WAN?][10] - - - -For example, Teridion says its WAN service can accelerate TCP-based applications like file transfers, backups and page loads, by as much as three to five times. - -“[The service] improves network performance for UDP based applications like voice, video, RDP, and VDI. Enterprises can get carrier grade performance over broadband and dedicated internet access. Depending on the locations of the sites, [customers] can expect to see a 15 to 30 percent reduction in latency. That’s the difference between a great quality video conference and an unworkable, choppy mess” Teridion [stated][11]. - -Teridion says the Meraki integration creates an IPSec connection from the Cisco Meraki MX to the Teridion edge. “Customers create locations in the Teridion portal and apply the preconfigured Meraki template to them, or just upload a csv file if you have a lot of locations. Then, from each Meraki MX, create a 3rd party IPSec tunnel to the Teridion edge IP addresses that are generated as part of the Teridion configuration.” - -The combined Cisco Meraki and Teridion offering brings SD-WAN and security capabilities at the WAN edge that are tightly integrated with a WAN service delivered over cost-effective broadband or dedicated Internet access, said Raviv Levi, director of product management at Cisco Meraki in a statement. “This brings better reliability and consistency to the enterprise WAN across multiple sites, as well as high performance access to all SaaS applications and cloud workloads.” - -Meraki’s MX family supports everything from SD-WAN and [Wi-Fi][12] features to next-generation [firewall][13] and intrusion prevention in a single package. - -Some studies show that by 2021 over 75 percent of enterprise traffic will be SaaS-oriented, so giving branch offices SD-WAN's reliable, secure transportation options will be a necessity, Cisco said when it [upgraded the Meraki][3] boxes last year. - -Cisco Meraki isn’t the only SD-WAN service Teridion supports. The company also has agreements Citrix, Silver Peak, VMware (VeloCloud). Teridion also has partnerships with over 25 cloud partners, including Google, Amazon Web Services and Microsoft Azure. - -[Teridion for Cisco Meraki][14] is available now from authorized Teridion resellers. Pricing starts at $50 per site per month. - -Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3396628/cisco-ties-its-securitysd-wan-gear-with-teridions-cloud-wan-service.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://images.idgesg.net/images/article/2018/02/istock-820219662-100749695-large.jpg -[2]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html -[3]: https://www.networkworld.com/article/3301169/cisco-meraki-amps-up-throughput-wi-fi-to-sd-wan-family.html -[4]: https://www.networkworld.com/article/3138952/5-things-you-need-to-know-about-virtual-private-networks.html -[5]: https://www.networkworld.com/article/3284285/teridion-enables-higher-performing-and-more-responsive-saas-applications.html -[6]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[7]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[8]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[9]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[10]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[11]: https://www.teridion.com/blog/teridion-announces-deep-integration-with-cisco-meraki-mx/ -[12]: https://www.networkworld.com/article/3318119/what-to-expect-from-wi-fi-6-in-2019.html -[13]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html -[14]: https://www.teridion.com/meraki -[15]: https://www.facebook.com/NetworkWorld/ -[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190528 With Cray buy, HPE rules but does not own the supercomputing market.md b/sources/talk/20190528 With Cray buy, HPE rules but does not own the supercomputing market.md deleted file mode 100644 index 07f9eea10c..0000000000 --- a/sources/talk/20190528 With Cray buy, HPE rules but does not own the supercomputing market.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (With Cray buy, HPE rules but does not own the supercomputing market) -[#]: via: (https://www.networkworld.com/article/3397087/with-cray-buy-hpe-rules-but-does-not-own-the-supercomputing-market.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -With Cray buy, HPE rules but does not own the supercomputing market -====== -In buying supercomputer vendor Cray, HPE has strengthened its high-performance-computing technology, but serious competitors remain. -![Cray Inc.][1] - -Hewlett Packard Enterprise was already the leader in the high-performance computing (HPC) sector before its announced acquisition of supercomputer maker Cray earlier this month. Now it has a commanding lead, but there are still competitors to the giant. - -The news that HPE would shell out $1.3 billion to buy the company came just as Cray had announced plans to build three of the biggest systems yet — all exascale, and all with the same deployment time of 2021. - -Sales had been slowing for HPC systems, but our government, with its endless supply of money, came to the rescue, throwing hundreds of millions at Cray for systems to be built at Lawrence Berkeley National Laboratory, Argonne National Laboratory and Oak Ridge National Laboratory. - -**[ Read also:[How to plan a software-defined data-center network][2] ]** - -And HPE sees a big revenue opportunity in HPC, a market that was $2 billion in 1990 and now nearly $30 billion, according to Steve Conway, senior vice president with Hyperion Research, which follows the HPC market. HPE thinks the HPC market will grow to $35 billion by 2021, and it hopes to earn a big chunk of that pie. - -“They were solidly in the lead without Cray. They were already in a significant lead over the No. 2 company, Dell. This adds to their lead and gives them access to very high end of market, especially government supercomputers that sell for $300 million to $600 million each,” said Conway. - -He’s not exaggerating. Earlier this month the U.S. Department of Energy announced a contract with Cray to build Frontier, an exascale supercomputer at Oak Ridge National Laboratory, sometime in 2021, with a $600 million price tag. Frontier will be powered by AMD Epyc processors and Radeon GPUs, which must have them doing backflips at AMD. - -With Cray, HPE is sitting on a lot of technology for the supercomputing and even the high-end, non-HPC market. It had the ProLiant business, the bulk of server sales (and proof the Compaq acquisition wasn’t such a bad idea), Integrity NonStop mission-critical servers, the SGI business it acquired in in 2016, plus a variety running everything from Arm to Xeon Scalable processors. - -Conway thinks all of those technologies fit in different spaces, so he doubts HPE will try to consolidate any of it. All HPE has said so far is it will keep the supercomputer products it has now under the Cray business unit. - -But the company is still getting something it didn’t have. “It takes a certain kind of technical experience [to do HPC right] and only a few companies able to play at that level. Before this deal, HPE was not one of them,” said Conway. - -And in the process, HPE takes Cray away from its many competitors: IBM, Lenovo, Dell/EMC, Huawei (well, not so much now), Super Micro, NEC, Hitachi, Fujitsu, and Atos. - -“[The acquisition] doesn’t fundamentally change things because there’s still enough competitors that buyers can have competitive bids. But it’s gotten to be a much bigger market,” said Conway. - -Cray sells a lot to government, but Conway thinks there is a new opportunity in the ever-expanding AI race. “Because HPC is indispensable at the forefront of AI, there is a new area for expanding the market,” he said. - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3397087/with-cray-buy-hpe-rules-but-does-not-own-the-supercomputing-market.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://images.idgesg.net/images/article/2018/06/the_cray_xc30_piz_daint_system_at_the_swiss_national_supercomputing_centre_via_cray_inc_3x2_978x652-100762113-large.jpg -[2]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190529 Cisco security spotlights Microsoft Office 365 e-mail phishing increase.md b/sources/talk/20190529 Cisco security spotlights Microsoft Office 365 e-mail phishing increase.md deleted file mode 100644 index c1e0493e63..0000000000 --- a/sources/talk/20190529 Cisco security spotlights Microsoft Office 365 e-mail phishing increase.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco security spotlights Microsoft Office 365 e-mail phishing increase) -[#]: via: (https://www.networkworld.com/article/3398925/cisco-security-spotlights-microsoft-office-365-e-mail-phishing-increase.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco security spotlights Microsoft Office 365 e-mail phishing increase -====== -Cisco blog follows DHS Cybersecurity and Infrastructure Security Agency (CISA) report detailing risks around Office 365 and other cloud services -![weerapatkiatdumrong / Getty Images][1] - -It’s no secret that if you have a cloud-based e-mail service, fighting off the barrage of security issues has become a maddening daily routine. - -The leading e-mail service – in [Microsoft’s Office 365][2] package – seems to be getting the most attention from those attackers hellbent on stealing enterprise data or your private information via phishing attacks. Amazon and Google see their share of phishing attempts in their cloud-based services as well. - -**[ Also see[What to consider when deploying a next generation firewall][3]. | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** - -But attackers are crafting and launching phishing campaigns targeting Office 365 users, [wrote][5] Ben Nahorney, a Threat Intelligence Analyst focused on covering the threat landscape for Cisco Security in a blog focusing on the Office 365 phishing issue. - -Nahorney wrote of research from security vendor [Agari Data][6], that found over the last few quarters, there has been a steady increase in the number of phishing emails impersonating Microsoft. While Microsoft has long been the most commonly impersonated brand, it now accounts for more than half of all brand impersonations seen in the last quarter. - -Recently cloud security firm Avanan wrote in its [annual phishing report][7], one in every 99 emails is a phishing attack, using malicious links and attachments as the main vector. “Of the phishing attacks we analyzed, 25 percent bypassed Office 365 security, a number that is likely to increase as attackers design new obfuscation methods that take advantage of zero-day vulnerabilities on the platform,” Avanan wrote. - -The attackers attempt to steal a user’s login credentials with the goal of taking over accounts. If successful, attackers can often log into the compromised accounts, and perform a wide variety of malicious activity: Spread malware, spam and phishing emails from within the internal network; carry out tailored attacks such as spear phishing and [business email compromise][8] [a long-standing business scam that uses spear-phishing, social engineering, identity theft, e-mail spoofing], and target partners and customers, Nahorney wrote. - -Nahorney wrote that at first glance, this may not seem very different than external email-based attacks. However, there is one critical distinction: The malicious emails sent are now coming from legitimate accounts. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][9] ]** - -“For the recipient, it’s often even someone that they know, eliciting trust in a way that would not necessarily be afforded to an unknown source. To make things more complicated, attackers often leverage ‘conversation hijacking,’ where they deliver their payload by replying to an email that’s already located in the compromised inbox,” Nahorney stated. - -The methods used by attackers to gain access to an Office 365 account are fairly straightforward, Nahorney wrote. - -“The phishing campaigns usually take the form of an email from Microsoft. The email contains a request to log in, claiming the user needs to reset their password, hasn’t logged in recently or that there’s a problem with the account that needs their attention. A URL is included, enticing the reader to click to remedy the issue,” Nahorney wrote. - -Once logged in, nefarious activities can go on unnoticed as the attacker has what look like authorized credentials. - -“This gives the attacker time for reconnaissance: a chance to observe and plan additional attacks. Nor will this type of attack set off a security alert in the same way something like a brute-force attack against a webmail client will, where the attacker guesses password after password until they get in or are detected,” Nahorney stated. - -Nahorney suggested the following steps customers can take to protect email: - - * Use multi-factor authentication. If a login attempt requires a secondary authorization before someone is allowed access to an inbox, this will stop many attackers, even with phished credentials. - * Deploy advanced anti-phishing technologies. Some machine-learning technologies can use local identity and relationship modeling alongside behavioral analytics to spot deception-based threats. - * Run regular phishing exercises. Regular, mandated phishing exercises across the entire organization will help to train employees to recognize phishing emails, so that they don’t click on malicious URLs, or enter their credentials into malicious website. - - - -### Homeland Security flags Office 365, other cloud email services - -The U.S. government, too, has been warning customers of Office 365 and other cloud-based email services that they should be on alert for security risks. The US Department of Homeland Security's Cybersecurity and Infrastructure Security Agency (CISA) this month [issued a report targeting][10] Office 365 and other cloud services saying: - -“Organizations that used a third party have had a mix of configurations that lowered their overall security posture (e.g., mailbox auditing disabled, unified audit log disabled, multi-factor authentication disabled on admin accounts). In addition, the majority of these organizations did not have a dedicated IT security team to focus on their security in the cloud. These security oversights have led to user and mailbox compromises and vulnerabilities.” - -The agency also posted remediation suggestions including: - - * Enable unified audit logging in the Security and Compliance Center. - * Enable mailbox auditing for each user. - * Ensure Azure AD password sync is planned for and configured correctly, prior to migrating users. - * Disable legacy email protocols, if not required, or limit their use to specific users. - - - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3398925/cisco-security-spotlights-microsoft-office-365-e-mail-phishing-increase.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://images.idgesg.net/images/article/2019/05/cso_phishing_social_engineering_security_threat_by_weerapatkiatdumrong_gettyimages-489433130_3x2_2400x1600-100796450-large.jpg -[2]: https://docs.microsoft.com/en-us/office365/securitycompliance/security-roadmap -[3]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://blogs.cisco.com/security/office-365-phishing-threat-of-the-month -[6]: https://www.agari.com/ -[7]: https://www.avanan.com/hubfs/2019-Global-Phish-Report.pdf -[8]: https://www.networkworld.com/article/3195072/fbi-ic3-vile-5b-business-e-mail-scam-continues-to-breed.html -[9]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[10]: https://www.us-cert.gov/ncas/analysis-reports/AR19-133A -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190529 Nvidia launches edge computing platform for AI processing.md b/sources/talk/20190529 Nvidia launches edge computing platform for AI processing.md deleted file mode 100644 index f608db970c..0000000000 --- a/sources/talk/20190529 Nvidia launches edge computing platform for AI processing.md +++ /dev/null @@ -1,53 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Nvidia launches edge computing platform for AI processing) -[#]: via: (https://www.networkworld.com/article/3397841/nvidia-launches-edge-computing-platform-for-ai-processing.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Nvidia launches edge computing platform for AI processing -====== -EGX platform goes to the edge to do as much processing there as possible before sending data upstream to major data centers. -![Leo Wolfert / Getty Images][1] - -Nvidia is launching a new platform called EGX Platform designed to bring real-time artificial intelligence (AI) to edge networks. The idea is to put AI computing closer to where sensors collect data before it is sent to larger data centers. - -The edge serves as a buffer to data sent to data centers. It whittles down the data collected and only sends what is relevant up to major data centers for processing. This can mean discarding more than 90% of data collected, but the trick is knowing which data to keep and which to discard. - -“AI is required in this data-driven world,” said Justin Boitano, senior director for enterprise and edge computing at Nvidia, on a press call last Friday. “We analyze data near the source, capture anomalies and report anomalies back to the mothership for analysis.” - -**[ Now read[20 hot jobs ambitious IT pros should shoot for][2]. ]** - -Boitano said we are hitting crossover where there is more compute at edge than cloud because more work needs to be done there. - -EGX comes from 14 server vendors in a range of form factors, combining AI with network, security and storage from Mellanox. Boitano said that the racks will fit in any industry-standard rack, so they will fit into edge containers from the likes of Vapor IO and Schneider Electric. - -EGX uses Nvidia’s low-power Jetson Nano processor, but also all the way up to Nvidia T4 processors that can deliver more than 10,000 trillion operations per second (TOPS) for real-time speech recognition and other real-time AI tasks. - -Nvdia is working on software stack called Nvidia Edge Stack that can be updated constantly, and the software runs in containers, so no reboots are required, just a restart of the container. EGX runs enterprise-grade Kubernetes container platforms like Red Hat Openshift. - -Edge Stack is optimized software that includes Nvidia drivers, a CUDA Kubernetes plugin, a CUDA container runtime, CUDA-X libraries and containerized AI frameworks and applications, including TensorRT, TensorRT Inference Server and DeepStream. - -The company is boasting more than 40 early adopters, including BMW Group Logistics, which uses EGX and its own Isaac robotic platforms to handle increasingly complex logistics with real-time efficiency. - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3397841/nvidia-launches-edge-computing-platform-for-ai-processing.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://images.idgesg.net/images/article/2019/02/industry_4-0_industrial_iot_smart_factory_by_leowolfert_gettyimages-689799380_2400x1600-100788464-large.jpg -[2]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190601 HPE Synergy For Dummies.md b/sources/talk/20190601 HPE Synergy For Dummies.md deleted file mode 100644 index 1b7ddbe2e7..0000000000 --- a/sources/talk/20190601 HPE Synergy For Dummies.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HPE Synergy For Dummies) -[#]: via: (https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html) -[#]: author: (HPE https://www.networkworld.com/author/Michael-Cooney/) - -HPE Synergy For Dummies -====== - -![istock/venimo][1] - -Business must move fast today to keep up with competitive forces. That means IT must provide an agile — anytime, anywhere, any workload — infrastructure that ensures growth, boosts productivity, enhances innovation, improves the customer experience, and reduces risk. - -A composable infrastructure helps organizations achieve these important objectives that are difficult — if not impossible — to achieve via traditional means, such as the ability to do the following: - - * Deploy quickly with simple flexing, scaling, and updating - * Run workloads anywhere — on physical servers, on virtual servers, or in containers - * Operate any workload upon which the business depends, without worrying about infrastructure resources or compatibility - * Ensure the infrastructure is able to provide the right service levels so the business can stay in business - - - -In other words, IT must inherently become part of the fabric of products and services that are rapidly innovated at every company, with an anytime, anywhere, any workload infrastructure. - -**The anytime paradigm** - -For organizations that seek to embrace DevOps, collaboration is the cultural norm. Development and operations staff work side‐by‐side to support software across its entire life cycle, from initial idea to production support. - -To provide DevOps groups — as well as other stakeholders — the IT infrastructure required at the rate at which it is demanded, enterprise IT must increase its speed, agility, and flexibility to enable people anytime composition and re‐composition of resources. Composable infrastructure enables this anytime paradigm. - -**The anywhere ability** - -Bare metal and virtualized workloads are just two application foundations that need to be supported in the modern data center. Today, containers are emerging as a compelling construct, providing significant benefits for certain kinds of workloads. Unfortunately, with traditional infrastructure approaches, IT needs to build out custom, unique infrastructure to support them, at least until an infrastructure is deployed that can seamlessly handle physical, virtual, and container‐based workloads. - -Each environment would need its own hardware and software and might even need its own staff members supporting it. - -Composable infrastructure provides an environment that supports the ability to run physical, virtual, or containerized workloads. - -**Support any workload** - -Do you have a legacy on‐premises application that you have to keep running? Do you have enterprise resource planning (ERP) software that currently powers your business but that will take ten years to phase out? At the same time, do you have an emerging DevOps philosophy under which you’d like to empower developers to dynamically create computing environments as a part of their development efforts? - -All these things can be accomplished simultaneously on the right kind of infrastructure. Composable infrastructure enables any workload to operate as a part of the architecture. - -**HPE Synergy** - -HPE Synergy brings to life the architectural principles of composable infrastructure. It is a single, purpose-built platform that reduces operational complexity for workloads and increases operational velocity for applications and services. - -Download a copy of the [HPE Synergy for Dummies eBook][2] to learn how to: - - * Infuse the IT architecture with the ability to enable agility, flexibility, and speed - * Apply composable infrastructure concepts to support both traditional and cloud-native applications - * Deploy HPE Synergy infrastructure to revolutionize workload support in the data center - - - -Also, you will find more information about HPE Synergy [here][3]. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html - -作者:[HPE][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://images.idgesg.net/images/article/2019/06/istock-1026657600-100798064-large.jpg -[2]: https://www.hpe.com/us/en/resources/integrated-systems/synergy-for-dummies.html -[3]: http://hpe.com/synergy diff --git a/sources/talk/20190605 Cisco will use AI-ML to boost intent-based networking.md b/sources/talk/20190605 Cisco will use AI-ML to boost intent-based networking.md deleted file mode 100644 index 29d2acd519..0000000000 --- a/sources/talk/20190605 Cisco will use AI-ML to boost intent-based networking.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco will use AI/ML to boost intent-based networking) -[#]: via: (https://www.networkworld.com/article/3400382/cisco-will-use-aiml-to-boost-intent-based-networking.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco will use AI/ML to boost intent-based networking -====== -Cisco explains how artificial intelligence and machine learning fit into a feedback loop that implements and maintain desired network conditions to optimize network performance for workloads using real-time data. -![xijian / Getty Images][1] - -Artificial Intelligence and machine learning are expected to be some of the big topics at next week’s Cisco Live event and the company is already talking about how those technologies will help drive the next generation of [Intent-Based Networking][2]. - -“Artificial intelligence will change how we manage networks, and it’s a change we need,” wrote John Apostolopoulos Cisco CTO and vice president of Enterprise Networking in a [blog][3] about how Cisco says these technologies impact the network. - -**[ Now see[7 free network tools you must have][4]. ]** - -AI is the next major step for networking capabilities, and while researchers have talked in the past about how great AI would be, now the compute power and algorithms exist to make it possible, Apostolopoulos told Network World. - -To understand how AI and ML can boost IBN, Cisco says it's necessary to understand four key factors an IBN environment needs: infrastructure, translation, activation and assurance. - -Infrastructure can be virtual or physical and include wireless access points, switches, routers, compute and storage. “To make the infrastructure do what we want, we use the translation function to convert the intent, or what we are trying to make the network accomplish, from a person or computer into the correct network and security policies. These policies then must be activated on the network,” Apostolopoulos said. - -The activation step takes the network and security polices and couples them with a deep understanding of the network infrastructure that includes both real-time and historic data about its behavior. It then activates or automates the policies across all of the network infrastructure elements, ideally optimizing for performance, reliability and security, Apostolopoulos wrote. - -Finally assurance maintains a continuous validation-and-verification loop. IBN improves on translation and assurance to form a valuable feedback loop about what’s going on in the network that wasn’t available before. ** ** - -Apostolopoulos used the example of an international company that wanted to set up a world-wide video all-hands meeting. Everyone on the call had to have high-quality, low-latency video, and also needed the capability to send high-quality video into the call when it was time for Q&A. - -“By applying machine learning and related machine reasoning, assurance can also sift through the massive amount of data related to such a global event to correctly identify if there are any problems arising. We can then get solutions to these issues – and even automatically apply solutions – more quickly and more reliably than before,” Apostolopoulos said. - -In this case, assurance could identify that the use of WAN bandwidth to certain sites is increasing at a rate that will saturate the network paths and could proactively reroute some of the WAN flows through alternative paths to prevent congestion from occurring, Apostolopoulos wrote. - -“In prior systems, this problem would typically only be recognized after the bandwidth bottleneck occurred and users experienced a drop in call quality or even lost their connection to the meeting. It would be challenging or impossible to identify the issue in real time, much less to fix it before it distracted from the experience of the meeting. Accurate and fast identification through ML and MR coupled with intelligent automation through the feedback loop is key to successful outcome.” - -Apostolopoulos said AI can accelerate the path from intent into translation and activation and then examine network and behavior data in the assurance step to make sure everything is working correctly. Activation uses the insights to drive more intelligent actions for improved performance, reliability and security, creating a cycle of network optimization. - -So what might an implementation of this look like? Applications that run on Cisco’s DNA Center may be the central component in an IBN environment. Introduced on 2017 as the heart of its IBN initiative, [Cisco DNA Center][5] features automation capabilities, assurance setting, fabric provisioning and policy-based segmentation for enterprise networks. - -“DNA Center can bring together AI and ML in a unified manner,” Apostolopoulos said. “It can store data from across the network and then customers can do AI and ML on that data.” - -Central to Cisco's push is being able to gather metadata about traffic as it passes without slowing the traffic, which is accomplished through the use of ASICs in its campus and data-center switches. - -“We have designed our networking gear from the ASIC, OS and software levels to gather key data via our IBN architecture, which provides unified data collection and performs algorithmic analysis across the entire network (wired, wireless, LAN, WAN, datacenter), Apostolopoulos said. “We have a massive collection of network data, including a database of problems and associated root causes, from being the world’s top enterprise network vendor over the past 20-plus years. And we have been investing for many years to create innovative network-data analysis and ML, MR, and other AI techniques to identify and solve key problems.” - -Machine learning and AI can then be applied to all that data to help network operators handle everything from policy setting and network control to security. - -“I also want to stress that the feedback the IT user gets from the IBN system with AI is not overwhelming telemetry data,” Apostolopoulos said. Instead it is valuable and actionable insights at scale, derived from immense data and behavioral analytics using AI. - -Managing and developing new AI/ML-based applications from enormous data sets beyond what Cisco already has is a key driver behind it’s the company’s Unified Compute System (UCS) server that wasa rolled out last September. While the new server, the UCS C480 ML, is powerful – it includes eight Nvidia Tesla V100-32G GPUs with 128GB of DDR4 RAM, 24 SATA hard drives and more – it is the ecosystem of vendors – Cloudera, HortonWorks and others that will end up being more important. - -[Earlier this year Cisco forecast][6] that [AI and ML][7] will significantly boost network management this year. - -“In 2019, companies will start to adopt Artificial Intelligence, in particular Machine Learning, to analyze the telemetry coming off networks to see these patterns, in an attempt to get ahead of issues from performance optimization, to financial efficiency, to security,” said [Anand Oswal][8], senior vice president of engineering in Cisco’s Enterprise Networking Business. The pattern-matching capabilities of ML will be used to spot anomalies in network behavior that might otherwise be missed, while also de-prioritizing alerts that otherwise nag network operators but that aren’t critical, Oswal said. - -“We will also start to use these tools to categorize and cluster device and user types, which can help us create profiles for use cases as well as spot outlier activities that could indicate security incursions,” he said. - -The first application of AI in network management will be smarter alerts that simply report on activities that break normal patterns, but as the technology advances it will react to more situations autonomously. The idea is to give customers more information so they and the systems can make better network decisions. Workable tools should appear later in 2019, Oswal said. - -Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3400382/cisco-will-use-aiml-to-boost-intent-based-networking.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://images.idgesg.net/images/article/2019/05/ai-vendor-relationship-management_bar-code_purple_artificial-intelligence_hand-on-virtual-screen-100795252-large.jpg -[2]: http://www.networkworld.com/cms/article/3202699 -[3]: https://blogs.cisco.com/enterprise/improving-networks-with-ai -[4]: https://www.networkworld.com/article/2825879/7-free-open-source-network-monitoring-tools.html -[5]: https://www.networkworld.com/article/3280988/cisco-opens-dna-center-network-control-and-management-software-to-the-devops-masses.html -[6]: https://www.networkworld.com/article/3332027/cisco-touts-5-technologies-that-will-change-networking-in-2019.html -[7]: https://www.networkworld.com/article/3320978/data-center/network-operations-a-new-role-for-ai-and-ml.html -[8]: https://blogs.cisco.com/author/anandoswal -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190606 Juniper- Security could help drive interest in SDN.md b/sources/talk/20190606 Juniper- Security could help drive interest in SDN.md deleted file mode 100644 index b140969eb5..0000000000 --- a/sources/talk/20190606 Juniper- Security could help drive interest in SDN.md +++ /dev/null @@ -1,89 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Juniper: Security could help drive interest in SDN) -[#]: via: (https://www.networkworld.com/article/3400739/juniper-sdn-snapshot-finds-security-legacy-network-tech-impacts-core-network-changes.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Juniper: Security could help drive interest in SDN -====== -Juniper finds that enterprise interest in software-defined networking (SDN) is influenced by other factors, including artificial intelligence (AI) and machine learning (ML). -![monsitj / Getty Images][1] - -Security challenges and developing artificial intelligence/maching learning (AI/ML) technologies are among the key issues driving [software-defined networking][2] (SDN) implementations, according to a new Juniper survey of 500 IT decision makers. - -And SDN interest abounds – 98% of the 500 said they were already using or considering an SDN implementation. Juniper said it had [Wakefield Research][3] poll IT decision makers of companies with 500 or more employees about their SDN strategies between May 7 and May 14, 2019. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][4] - * [How to pick an off-site data-backup method][5] - * [SD-Branch: What it is and why you’ll need it][6] - * [What are the options for security SD-WAN?][7] - - - -SDN includes technologies that separate the network control plane from the forwarding plane to enable more automated provisioning and policy-based management of network resources. - -IDC estimates that the worldwide data-center SDN market will be worth more than $12 billion in 2022, recording a CAGR of 18.5% during the 2017-2022 period. The market-generated revenue of nearly $5.15 billion in 2017 was up more than 32.2% from 2016. - -There are many ideas driving the development of SDN. For example, it promises to reduce the complexity of statically defined networks; make automating network functions much easier; and allow for simpler provisioning and management of networked resources from the data center to the campus or wide area network. - -While the evolution of SDN is ongoing, Juniper’s study pointed out an issue that was perhaps not unexpected – many users are still managing operations via the command line interface (CLI). CLI is the primary text-based user interface used for configuring, monitoring and maintaining most networked devices. - -“If SDN is as attractive as it is then why manage the network with the same legacy technology of the past?” said Michael Bushong, vice president of enterprise and cloud marketing at Juniper Networks. “If you deploy SDN and don’t adjust the operational model then it is difficult to reap all the benefits SDN can bring. It’s the difference between managing devices individually which you may have done in the past to managing fleets of devices via SDN – it simplifies and reduces operational expenses.” - -Juniper pointed to a [Gartner prediction][8] that stated “by 2020, only 30% of network operations teams will use the command line interface (CLI) as their primary interface, down from 85% at years end 2016.” Garter stated that poll results from a recent Gartner conference found some 71% still using CLI as the primary way to make network changes. - -Gartner [wrote][9] in the past that CLI has remained the primary operational tool for mainstream network operations teams for easily the past 15-20 years but that “moving away from the CLI is a good thing for the networking industry, and while it won’t disappear completely (advanced/nuanced troubleshooting for example), it will be supplanted as the main interface into networking infrastructure.” - -Juniper’s study found that 87% of businesses are still doing most or some of their network management at the device level. - -What all of this shows is that customers are obviously interested in SDN but are still grappling with the best ways to get there, Bushong said. - -The Juniper study also found users interested in SDN because of the potential for a security boost. - -SDN can empowers a variety of security benefits. A customer can split up a network connection between an end user and the data center and have different security settings for the various types of network traffic. A network could have one public-facing, low-security network that does not touch any sensitive information. Another segment could have much more fine-grained remote-access control with software-based [firewall][10] and encryption policies on it, which allow sensitive data to traverse over it. SDN users can roll out security policies across the network from the data center to the edge much more rapidly than traditional network environments. - -“Many enterprises see security—not speed—as the biggest consequence of not making this transition in the next five years, with nearly 40 percent identifying the inability to quickly address new threats as one of their main concerns,” wrote Manoj Leelanivas, chief product officer at Juniper Networks, in a blog about the survey. - -“SDN is not often associated with greater security but this makes sense when we remember this is an operational transformation. In security, the challenge lies not in identifying threats or creating solutions, but in applying these solutions to a fragmented network. Streamlining complex security operations, touching many different departments and managing multiple security solutions, is where a software-defined approach can provide the answer,” Leelanivas stated. - -Some of the other key findings from Juniper included: - - * **The future of AI** : The deployment of artificial intelligence is about changing the operational model, Bushong said. “The ability to more easily manage workflows over groups of devices and derive usable insights to help customers be more proactive rather than reactive is the direction we are moving. Everything will ultimately be AI-driven, he said. - * **Automation** : While automation is often considered a threat, Juniper said its respondents see it positively within the context of SDN, with 38% reporting it will improve security and 25% that it will enhance their jobs by streamlining manual operations. - * **Flexibility** : Agility is the #1 benefit respondents considering SDN want to gain (48%), followed by improved reliability (43%) and greater simplicity (38%). - * **SD-WAN** : The majority, 54%, have rolled out or are in the process of rolling out SD-WAN, while an additional 34% have it under current consideration. - - - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3400739/juniper-sdn-snapshot-finds-security-legacy-network-tech-impacts-core-network-changes.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://images.idgesg.net/images/article/2019/03/sdn_software-defined-network_architecture-100791938-large.jpg -[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[3]: https://www.wakefieldresearch.com/ -[4]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[5]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[6]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[7]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[8]: https://blogs.gartner.com/andrew-lerner/2018/01/04/checking-in-on-the-death-of-the-cli/ -[9]: https://blogs.gartner.com/andrew-lerner/2016/11/22/predicting-the-death-of-the-cli/ -[10]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190611 Cisco launches a developer-community cert program.md b/sources/talk/20190611 Cisco launches a developer-community cert program.md deleted file mode 100644 index 92ce486e6d..0000000000 --- a/sources/talk/20190611 Cisco launches a developer-community cert program.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco launches a developer-community cert program) -[#]: via: (https://www.networkworld.com/article/3401524/cisco-launches-a-developer-community-cert-program.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco launches a developer-community cert program -====== -Cisco has revamped some of its most critical certification and career-development programs in an effort to address the emerging software-oriented-network environment. -![Getty Images][1] - -SAN DIEGO – Cisco revamped some of its most critical certification and career-development tools in an effort to address the emerging software-oriented network environment. - -Perhaps one of the biggest additions – rolled out here at the company’s Cisco Live customer event – is the new set of professional certifications for developers utilizing Cisco’s growing DevNet developer community. - -**[ Also see[4 job skills that can boost networking salaries][2] and [20 hot jobs ambitious IT pros should shoot for][3].]** - -The Cisco Certified DevNet Associate, Specialist and Professional certifications will cover software development for applications, automation, DevOps, cloud and IoT. They will also target software developers and network engineers who develop software proficiency to develop applications and automated workflows for operational networks and infrastructure. - -“This certification evolution is the next step to reflect the critical skills network engineers must have to be at the leading edge of networked-enabled business disruption and delivering customer excellence,” said Mike Adams, vice president and general manager of Learning@Cisco. “To perform effectively in this new world, every IT professional needs skills that are broader, deeper and more agile than ever before. And they have to be comfortable working as a multidisciplinary team including infrastructure network engineers, DevOps and automation specialists, and software professionals.” - -Other Cisco Certifications changes include: - - * Streamlined certifications to validate engineering professionals with Cisco Certified Network Associate (CCNA) and Cisco Specialist certifications as well as Cisco Certified Network Professional (CCNP) and Cisco Certified Internetwork Expert (CCIE) certifications in enterprise, data center, service provider, security and collaboration. - * For more senior professionals, the CCNP will give learners a choice of five tracks, covering enterprise technologies including infrastructure and wireless, service provider, data center, security and collaboration. Candidates will be able to further specialize in a particular focus area within those technologies. - * Cisco says it will eliminate pre-requisites for certifications, meaning engineers can change career options without having to take a defined path. - * Expansion of Cisco Networking Academy offerings to train entry level network professionals and software developers. Courses prepare students to earn CCNA and Certified DevNet Associate certifications, equipping them for high-demand jobs in IT. - - - -New network technologies such as intent-based networking, multi-domain networking, and programmability fundamentally change the capabilities of the network, giving network engineers the opportunity to architect solutions that utilize the programmable network in new and exciting ways, wrote Susie Wee senior vice president and chief technology officer of DevNet. - -“DevOps practices can be applied to the network, making the network more agile and enabling automation at scale. The new network provides more than just connectivity, it can now use policy and intent to securely connect applications, users, devices and data across multiple environments – from the data center and cloud, to the campus and branch, to the edge, and to the device,” Wee wrote. - -**[[Looking to upgrade your career in tech? This comprehensive online course teaches you how.][4] ]** - -She also announced the DevNet Automation Exchange, a community that will offer shared code, best practices and technology tools for users, developers or channel partners interested in developing automation apps. - -Wee said Cisco seeded the Automation Exchange with over 50 shared code repositories. - -“It is becoming increasingly clear that network ops can be handled much more efficiently with automation, and offering the tools to develop better applications is crucial going forward,” said Zeus Kerravala, founder and principal analyst with ZK Research. - -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/3401524/cisco-launches-a-developer-community-cert-program.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://images.idgesg.net/images/article/2019/01/run_digital-vanguard_business-executive-with-briefcase_career-growth-100786736-large.jpg -[2]: https://www.networkworld.com/article/3227832/lan-wan/4-job-skills-that-can-boost-networking-salaries.html -[3]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html -[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fupgrading-your-technology-career -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190612 Cisco offers cloud-based security for SD-WAN resources.md b/sources/talk/20190612 Cisco offers cloud-based security for SD-WAN resources.md deleted file mode 100644 index a6cd0c73b4..0000000000 --- a/sources/talk/20190612 Cisco offers cloud-based security for SD-WAN resources.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco offers cloud-based security for SD-WAN resources) -[#]: via: (https://www.networkworld.com/article/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco offers cloud-based security for SD-WAN resources -====== -Cisco adds support for its cloud-based security gateway Umbrella to SD-WAN software -![Thinkstock][1] - -SAN DIEGO— As many companies look to [SD-WAN][2] technology to reduce costs, improve connectivity and streamline branch office access, one of the key requirements will be solid security technologies to protect corporate resources. - -At its Cisco Live customer event here this week, the company took aim at that need by telling customers it added support for the its cloud-based security gateway – known as Umbrella – to its SD-WAN software offerings. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -At its most basic, SD-WAN lets companies aggregate a variety of network connections – including MPLS, 4G LTE and DSL – into a branch or network-edge location and provides a management software that can turn up new sites, prioritize traffic and set security policies. SD-WAN's driving principle is to simplify the way big companies turn up new links to branch offices, better manage the way those links are utilized – for data, voice or video – and potentially save money in the process. - -According to Cisco, Umbrella can provide the first line of defense against threats on the internet. By analyzing and learning from internet activity patterns, Umbrella automatically uncovers attacker infrastructure and proactively blocks requests to malicious destinations before a connection is even established — without adding latency for users. With Umbrella, customers can stop phishing and malware infections earlier, identify already infected devices faster and prevent data exfiltration, Cisco says. - -Branch offices and roaming users are more vulnerable to attacks, and attackers are looking to exploit them, said Gee Rittenhouse, senior vice president and general manager of Cisco's Security Business Group. He pointed to Enterprise Strategy Group research that says 68 percent of branch offices and roaming users were the source of compromise in recent attacks. And as organizations move to more direct internet access, this becomes an even greater risk, Rittenhouse said. - -“Scaling security at every location often means more appliances to ship and manage, more policies to separately maintain, which translates into more money and resources needed – but Umbrella offers an alternative to all that," he said. "Umbrella provides simple deployment and management, and in a single cloud platform, it unifies multiple layers of security, ncluding DNS, secure web gateway, firewall and cloud-access security,” Rittenhouse said. - -“It also acts as your secure onramp to the internet by offering secure internet access and controlled SaaS usage across all locations and roaming users.” - -Basically users can set up Umbrella support via the SD-WAN dashboard vManage, and the system automatically creates a secure tunnel to the cloud.** ** Once the SD-WAN traffic is pointed at the cloud, firewall and other security policies can be set. Customers can then see traffic and collect information about patterns or set policies and respond to anomalies, Rittenhouse said. - -Analysts said the Umbrella offering is another important security option offered by Cisco for SD-WAN customers. - -“Since it is cloud-based, using Umbrella is a great option for customers with lots of branch or SD-WAN locations who don’t want or need to have a security gateway on premises,” said Rohit Mehra, vice president of Network Infrastructure at IDC. “One of the largest requirements for large customers going forward will be the need for all manner of security technologies for the SD-WAN environment, and Cisco has a big menu of offerings that can address those requirements.” - -IDC says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40 percent yearly clip between now and then. - -The Umbrella announcement is on top of other recent SD-WAN security enhancements the company has made. In May [Cisco added support for Advanced Malware Protection (AMP) to its million-plus ISR/ASR edge routers][7] in an effort to reinforce branch- and core-network malware protection across the SD-WAN. - -“Together with Cisco Talos [Cisco’s security-intelligence arm], AMP imbues your SD-WAN branch, core and campuses locations with threat intelligence from millions of worldwide users, honeypots, sandboxes and extensive industry partnerships,” Cisco said. - -In total, AMP identifies more than 1.1 million unique malware samples a day and when AMP in Cisco SD-WAN platform spots malicious behavior it automatically blocks it, Cisco said. - -Last year Cisco added its [Viptela SD-WAN technology to the IOS XE][8] version 16.9.1 software that runs its core ISR/ASR routers such as the ISR models 1000, 4000 and ASR 1000, in use by organizations worldwide. Cisco bought Viptela in 2017. - -The release of Cisco IOS XE offered an instant upgrade path for creating cloud-controlled SD-WAN fabrics to connect distributed offices, people, devices and applications operating on the installed base, Cisco said. At the time Cisco said that Cisco SD-WAN on edge routers builds a secure virtual IP fabric by combining routing, segmentation, security, policy and orchestration. - -With the recent release of IOS-XE SD-WAN 16.11, Cisco has brought AMP and other enhancements to its SD-WAN. - -AMP support is added to a menu of security features already included in Cisco's SD-WAN software including support for URL filtering, Snort Intrusion Prevention, the ability to segment users across the WAN and embedded platform security, including the Cisco Trust Anchor module. - -The software also supports SD-WAN Cloud onRamp for CoLocation, which lets customers tie distributed multicloud applications back to a local branch office or local private data center. That way a cloud-to-branch link would be shorter, faster and possibly more secure that tying cloud-based applications directly to the data center. - -Also in May [Cisco and Teridion][9] said they would team to deliver faster enterprise software-defined WAN services. The integration links Cisco Meraki MX Security/SD-WAN appliances and its Auto VPN technology which lets users quickly bring up and configure secure sessions between branches and data centers with Teridion’s cloud-based WAN service. Teridion’s service promises customers better performance and control over traffic running from remote offices over the public internet to the data center. - -Teridion said the Meraki integration creates an IPSec connection from the Cisco Meraki MX to the Teridion edge. Customers create locations in the Teridion portal and apply the preconfigured Meraki template to them, or just upload a csv file if they have a lot of locations. Then, from each Meraki MX, they can create a third-party IPSec tunnel to the Teridion edge IP addresses that are generated as part of the Teridion configuration, the company stated. - -The combined Cisco Meraki and Teridion offering brings SD-WAN and security capabilities at the WAN edge that are tightly integrated with a WAN service delivered over cost-effective broadband or dedicated Internet access. Meraki’s MX family supports everything from SD-WAN and [Wi-Fi][10] features to next-generation [firewall][11] and intrusion prevention in a single package. - -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/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.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://images.techhive.com/images/article/2015/10/cloud-security-ts-100622309-large.jpg -[2]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://www.networkworld.com/article/3394597/cisco-adds-amp-to-sd-wan-for-israsr-routers.html -[8]: https://www.networkworld.com/article/3296007/cisco-upgrade-enables-sd-wan-in-1m-israsr-routers.html -[9]: https://www.networkworld.com/article/3396628/cisco-ties-its-securitysd-wan-gear-with-teridions-cloud-wan-service.html -[10]: https://www.networkworld.com/article/3318119/what-to-expect-from-wi-fi-6-in-2019.html -[11]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190612 Dell and Cisco extend VxBlock integration with new features.md b/sources/talk/20190612 Dell and Cisco extend VxBlock integration with new features.md deleted file mode 100644 index 30e225de98..0000000000 --- a/sources/talk/20190612 Dell and Cisco extend VxBlock integration with new features.md +++ /dev/null @@ -1,72 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Dell and Cisco extend VxBlock integration with new features) -[#]: via: (https://www.networkworld.com/article/3402036/dell-and-cisco-extend-vxblock-integration-with-new-features.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Dell and Cisco extend VxBlock integration with new features -====== -Dell EMC and Cisco took another step in their alliance, announcing plans to expand VxBlock 1000 integration across servers, networking, storage, and data protection. -![Dell EMC][1] - -Just two months ago [Dell EMC and Cisco renewed their converged infrastructure][2] vows, and now the two have taken another step in the alliance. At this year’s at [Cisco Live][3] event taking place in San Diego, the two announced plans to expand VxBlock 1000 integration across servers, networking, storage, and data protection. - -This is done through support of NVMe over Fabrics (NVMe-oF), which allows enterprise SSDs to talk to each other directly through a high-speed fabric. NVMe is an important advance because SATA and PCI Express SSDs could never talk directly to other drives before until NVMe came along. - -To leverage NVMe-oF to its fullest extent, Dell EMC has unveiled a new integrated Cisco compute (UCS) and storage (MDS) 32G options, extending PowerMax capabilities to deliver NVMe performance across the VxBlock stack. - -**More news from Cisco Live 2019:** - - * [Cisco offers cloud-based security for SD-WAN resources][4] - * [Cisco software to make networks smarter, safer, more manageable][5] - * [Cisco launches a developer-community cert program][6] - - - -Dell EMC said this will enhance the architecture, high-performance consistency, availability, and scalability of VxBlock and provide its customers with high-performance, end-to-end mission-critical workloads that can deliver microsecond responses. - -These new compute and storage options will be available to order sometime later this month. - -### Other VxBlock news from Dell EMC - -Dell EMC also announced it is extending its factory-integrated on-premise integrated protection solutions for VxBlock to hybrid and multi-cloud environments, such as Amazon Web Services (AWS). This update will offer to help protect VMware workloads and data via the company’s Data Domain Virtual Edition and Cloud Disaster Recovery software options. This will be available in July. - -The company also plans to release VxBlock Central 2.0 software next month. VxBlock Central is designed to help customers simplify CI administration through converged awareness, automation, and analytics. - -New to version 2.0 is modular licensing that matches workflow automation, advanced analytics, and life-cycle management/upgrade options to your needs. - -VxBlock Central 2.0 has a variety of license features, including the following: - -**Base** – Free with purchase of a VxBlock, the base license allows you to manage your system and improve compliance with inventory reporting and alerting. **Workflow Automation** – Provision infrastructure on-demand using engineered workflows through vRealize Orchestrator. New workflows available with this package include Cisco UCS server expansion with Unity and XtremIO storage arrays. **Advanced Analytics** – View capacity and KPIs to discover deeper actionable insights through vRealize Operations. **Lifecycle Management** (new, available later in 2019) – Apply “guided path” software upgrades to optimize system performance. - - * Lifecycle Management includes a new multi-tenant, cloud-based database based on Cloud IQ that will collect and store the CI component inventory structured by the customer, extending the value and ease of use of the cloud-based analytics monitoring. - * This feature extends the value and ease of use of the cloud-based analytics monitoring Cloud IQ already provides for individual Dell EMC storage arrays. - - - -Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3402036/dell-and-cisco-extend-vxblock-integration-with-new-features.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://images.idgesg.net/images/article/2019/04/dell-emc-vxblock-1000-100794721-large.jpg -[2]: https://www.networkworld.com/article/3391071/dell-emc-and-cisco-renew-converged-infrastructure-alliance.html -[3]: https://www.ciscolive.com/global/ -[4]: https://www.networkworld.com/article/3402079/cisco-offers-cloud-based-security-for-sd-wan-resources.html -[5]: https://www.networkworld.com/article/3401523/cisco-software-to-make-networks-smarter-safer-more-manageable.html -[6]: https://www.networkworld.com/article/3401524/cisco-launches-a-developer-community-cert-program.html -[7]: https://www.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190613 Oracle updates Exadata at long last with AI and machine learning abilities.md b/sources/talk/20190613 Oracle updates Exadata at long last with AI and machine learning abilities.md deleted file mode 100644 index 280cfd1a4a..0000000000 --- a/sources/talk/20190613 Oracle updates Exadata at long last with AI and machine learning abilities.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Oracle updates Exadata at long last with AI and machine learning abilities) -[#]: via: (https://www.networkworld.com/article/3402559/oracle-updates-exadata-at-long-last-with-ai-and-machine-learning-abilities.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Oracle updates Exadata at long last with AI and machine learning abilities -====== -Oracle to update the Oracle Exadata Database Machine X8 server line to include artificial intelligence (AI) and machine learning capabilities, plus support for hybrid cloud. -![Magdalena Petrova][1] - -After a rather [long period of silence][2], Oracle announced an update to its server line, the Oracle Exadata Database Machine X8, which features hardware and software enhancements that include artificial intelligence (AI) and machine learning capabilities, as well as support for hybrid cloud. - -Oracle acquired a hardware business nine years ago with the purchase of Sun Microsystems. It steadily whittled down the offerings, getting out of the commodity hardware business in favor of high-end mission-critical hardware. Whereas the Exalogic line is more of a general-purpose appliance running Oracle’s own version of Linux, Exadata is a purpose-built database server, and they really made some upgrades. - -The Exadata X8 comes with the latest Intel Xeon Scalable processors and PCIe NVME flash technology to drive performance improvements, which Oracle promises a 60% increase in I/O throughput for all-Flash storage and a 25% increase in IOPS per storage server compared to Exadata X7. The X8 offers a 60% performance improvement over the previous generation for analytics with up to 560GB per second throughput. It can scan a 1TB table in under two seconds. - -**[ Also read:[What is quantum computing (and why enterprises should care)][3] ]** - -The company also enhanced the storage server to offload Oracle Database processing, and the X8 features 60% more cores and 40% higher capacity disk drives over the X7. - -But the real enhancements come on the software side. With Exadata X8, Oracle introduces new machine-learning capabilities, such as Automatic Indexing, which continuously learns and tunes the database as usage patterns change. The Indexing technology originated with the Oracle Autonomous Database, the cloud-based software designed to automate management of Oracle databases. - -And no, MySQL is not included in the stack. This is for Oracle databases only. - -“We’re taking code from Autonomous Database and making it available on prem for our customers,” said Steve Zivanic, vice president for converged infrastructure at Oracle’s Cloud Business Group. “That enables companies rather than doing manual indexing for various Oracle databases to automate it with machine learning.” - -In one test, it took a 15-year-old Netsuite database with over 9,000 indexes built up over the lifespan of the database, and in 24 hours, its AI indexer rebuilt the indexes with just 6,000, reducing storage space and greatly increasing performance of the database, since the number of indexes to search were smaller. - -### Performance improvements with Exadata - -Zivanic cited several examples of server consolidation done with Exadata but would not identify companies by name. He told of a large healthcare company that achieved a 10-fold performance improvement over IBM Power servers and consolidated 600 Power servers with 50 Exadata systems. - -A financial services company replaced 4,000 Dell servers running Red Hat Linux and VMware with 100 Exadata systems running 6,000 production Oracle databases. Not only did it reduce its power footprint, but patching was down 99%. An unnamed retailer with 28 racks of hardware from five vendors went from installing 1,400 patches per year to 16 patches on four Exadata racks. - -Because Oracle owns the entire stack, from hardware to OS to middleware and database, Exadata can roll all of its patch components – 640 in all – into a single bundle. - -“The trend we’ve noticed is you see these [IT hardware] companies who try to maintain an erector set mentality,” said Zivanic. “And you have people saying why are we trying to build pods? Why don’t we buy finished goods and focus on our core competency rather than build erector sets?” - -### Oracle Zero Data Loss Recovery Appliance X8 now available - -Oracle also announced the availability of the Oracle Zero Data Loss Recovery Appliance X8, its database backup appliance, which offers up to 10 times faster data recovery of an Oracle Database than conventional data deduplication appliances while providing sub-second recoverability of all transactions. - -The new Oracle Recovery Appliance X8 now features 30% larger capacity, nearly a petabyte in a single rack, for the same price, Oracle says. - -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/3402559/oracle-updates-exadata-at-long-last-with-ai-and-machine-learning-abilities.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://images.techhive.com/images/article/2017/03/vid-still-79-of-82-100714308-large.jpg -[2]: https://www.networkworld.com/article/3317564/is-oracles-silence-on-its-on-premises-servers-cause-for-concern.html -[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190614 Report- Mirai tries to hook its tentacles into SD-WAN.md b/sources/talk/20190614 Report- Mirai tries to hook its tentacles into SD-WAN.md deleted file mode 100644 index d4a3a9a927..0000000000 --- a/sources/talk/20190614 Report- Mirai tries to hook its tentacles into SD-WAN.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Report: Mirai tries to hook its tentacles into SD-WAN) -[#]: via: (https://www.networkworld.com/article/3403016/report-mirai-tries-to-hook-its-tentacles-into-sd-wan.html) -[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) - -Report: Mirai tries to hook its tentacles into SD-WAN -====== - -Mirai – the software that has hijacked hundreds of thousands of internet-connected devices to launch massive DDoS attacks – now goes beyond recruiting just IoT products; it also includes code that seeks to exploit a vulnerability in corporate SD-WAN gear. - -That specific equipment – VMware’s SDX line of SD-WAN appliances – now has an updated software version that fixes the vulnerability, but by targeting it Mirai’s authors show that they now look beyond enlisting security cameras and set-top boxes and seek out any vulnerable connected devices, including enterprise networking gear. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][1] - * [How to pick an off-site data-backup method][2] - * [SD-Branch: What it is and why you’ll need it][3] - * [What are the options for security SD-WAN?][4] - - - -“I assume we’re going to see Mirai just collecting as many devices as it can,” said Jen Miller-Osborn, deputy director of threat research at Palo Alto Networks’ Unit 42, which recently issued [a report][5] about Mirai. - -### Exploiting SD-WAN gear is new - -While the exploit against the SD-WAN appliances was a departure for Mirai, it doesn’t represent a sea-change in the way its authors are approaching their work, according Miller-Osborn. - -The idea, she said, is simply to add any devices to the botnet, regardless of what they are. The fact that SD-WAN devices were targeted is more about those particular devices having a vulnerability than anything to do with their SD-WAN capabilities. - -### Responsible disclosure headed off execution of exploits - -[The vulnerability][6] itself was discovered last year by independent researchers who responsibly disclosed it to VMware, which then fixed it in a later software version. But the means to exploit the weakness nevertheless is included in a recently discovered new variant of Mirai, according to the Unit 42 report. - -The authors behind Mirai periodically update the software to add new targets to the list, according to Unit 42, and the botherders’ original tactic of simply targeting devices running default credentials has given way to a strategy that also exploits vulnerabilities in a wide range of different devices. The updated variant of the malicious software includes a total of eight new-to-Mirai exploits. - -**[[Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][7] ]** - -The remediated version of the VMware SD-WAN is SD-WAN Edge 3.1.2. The vulnerability still affects SD-WAN Edge 3.1.1 and earlier, [according to a VMware security advisory][8]. After the Unit 42 report came out VMware posted [a blog][9] that says it is conducting its own investigation into the matter. - -Detecting whether a given SD-WAN implementation has been compromised depends heavily on the degree of monitoring in place on the network. Any products that give IT staff the ability to notice unusual traffic to or from an affected appliance could flag that activity. Otherwise, it could be difficult to tell if anything’s wrong, Miller-Osborne said. “You honestly might not notice it unless you start seeing a hit in performance or an outside actor notifies you about it.” - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3403016/report-mirai-tries-to-hook-its-tentacles-into-sd-wan.html - -作者:[Jon Gold][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/Jon-Gold/ -[b]: https://github.com/lujun9972 -[1]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[2]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[3]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[4]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[5]: https://unit42.paloaltonetworks.com/new-mirai-variant-adds-8-new-exploits-targets-additional-iot-devices/ -[6]: https://www.exploit-db.com/exploits/44959 -[7]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[8]: https://www.vmware.com/security/advisories/VMSA-2018-0011.html -[9]: https://blogs.vmware.com/security/2019/06/vmsa-2018-0011-revisited.html -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190614 Western Digital launches open-source zettabyte storage initiative.md b/sources/talk/20190614 Western Digital launches open-source zettabyte storage initiative.md deleted file mode 100644 index 9c31358d47..0000000000 --- a/sources/talk/20190614 Western Digital launches open-source zettabyte storage initiative.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Western Digital launches open-source zettabyte storage initiative) -[#]: via: (https://www.networkworld.com/article/3402318/western-digital-launches-open-source-zettabyte-storage-initiative.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Western Digital launches open-source zettabyte storage initiative -====== -Western Digital's Zoned Storage initiative leverages new technology to create more efficient zettabyte-scale data storage for data centers by improving how data is organized when it is stored. -![monsitj / Getty Images][1] - -Western Digital has announced a project called the Zoned Storage initiative that leverages new technology to create more efficient zettabyte-scale data storage for data centers by improving how data is organized when it is stored. - -As part of this, the company also launched a [developer site][2] that will host open-source, standards-based tools and other resources. - -The Zoned Storage architecture is designed for Western Digital hardware and its shingled magnetic recording (SMR) HDDs, which hold up to 15TB of data, as well as the emerging zoned namespaces (ZNS) standard for NVMe SSDs, designed to deliver better endurance and predictability. - -**[ Now read:[What is quantum computing (and why enterprises should care)][3] ]** - -This initiative is not being retrofitted for non-SMR drives or non-NVMe SSDs. Western Digital estimates that by 2023, half of all its HDD shipments are expected to be SMR. And that will be needed because IDC predicts data will be generated at a rate of 103 zettabytes a year by 2023. - -With this project Western Digital is targeting cloud and hyperscale providers and anyone building a large data center who has to manage a large amount of data, according to Eddie Ramirez, senior director of product marketing for Western Digital. - -Western Digital is changing how data is written and stored from the traditional random 4K block writes to large blocks of sequential data, like Big Data workloads and video streams, which are rapidly growing in size and use in the digital age. - -“We are now looking at a one-size-fits-all architecture that leaves a lot of TCO [total cost of ownership] benefits on the table if you design for a single architecture,” Ramirez said. “We are looking at workloads that don’t rely on small block randomization of data but large block sequential write in nature.” - -Because drives use 4k write blocks, that leads to overprovisioning of storage, especially around SSDs. This is true of consumer and enterprise SSDs alike. My 1TB SSD drive has only 930GB available. And that loss scales. An 8TB SSD has only 6.4TB available, according to Ramirez. SSDs also have to be built with DRAM for caching of small block random writes. You need about 1GB of DRAM per 1TB of NAND to act as a buffer, according to Ramirez. - -### The benefits of Zoned Storage - -Zoned Storage allows for 15-20% more storage on a HDD the than traditional storage mechanism. It eliminates the overprovisioning of SSDs, so you get all the NAND flash the drive has and you need far fewer DRAM chips on an SSD. Additionally, Western Digital promises you will need up to one-eighth as much DRAM to act as a cache in future SSD drives, lowering the cost. - -Ramirez also said quality of service will improve, not necessarily that peak performance is better, but it will manage latency from outliers better. - -Western Digital has not disclosed what if any pricing is associated with the project. It plans to work with the open-source community, customers, and industry players to help accelerate application development around Zoned Storage through its website. - -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/3402318/western-digital-launches-open-source-zettabyte-storage-initiative.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://images.idgesg.net/images/article/2019/02/big_data_center_server_racks_storage_binary_analytics_by_monsitj_gettyimages-951389152_3x2-100787358-large.jpg -[2]: http://ZonedStorage.io -[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190617 Use ImageGlass to quickly view JPG images as a slideshow.md b/sources/talk/20190617 Use ImageGlass to quickly view JPG images as a slideshow.md deleted file mode 100644 index 31820a380b..0000000000 --- a/sources/talk/20190617 Use ImageGlass to quickly view JPG images as a slideshow.md +++ /dev/null @@ -1,53 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use ImageGlass to quickly view JPG images as a slideshow) -[#]: via: (https://opensource.com/article/19/6/use-imageglass-view-jpg-images-slideshow-windows-10) -[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) - -Use ImageGlass to quickly view JPG images as a slideshow -====== -Want to view images from a folder one-by-one in a slideshow on Windows -10? Open source to the rescue. -![Looking back with binoculars][1] - -Welcome to today’s episode of "How Can I Make This Work?" In my case, I was trying to view a folder of JPG images as a slideshow on Windows 10. As often happens, I turned to open source to solve the issue. - -On a Mac, viewing a folder of JPG images as a slideshow is a simple matter of selecting all the images in a folder ( **Command-A** ), and then pressing **Option-Command-Y**. From there, you can advance the images with the arrow key. Of course, you can do a similar thing on Windows by selecting the first image, then clicking on the window frame's yellow **Manage** bar, then selecting **Slide Show**. There, you can control the speed, but only to a point: slow, medium, and fast. - -I wanted to advance the images in Windows the same way I do it on a Mac. Naturally, I fired up the Googler and searched for a solution. There, I found the [ImageGlass][2] open source app, [licensed GPL 3.0][3], and it did the trick perfectly. Here's what it looks like: - -![Viewing an image in ImageGlass.][4] - -### About ImageGlass - -ImageGlass was developed by Dương Diệu Pháp, a Vietnamese developer who works on the front end for Chainstack, according to his website. He collaborates with US-based [Kevin Routley][5], who "develops new features for ImageGlass." The source code is available on [GitHub][6]. - -ImageGlass supports most common image formats, including JPG, GIF, PNG, WEBP, SVG, and RAW. Users can customize this extension list easily. - -My specific problem was needing to find an image for a catalog cover. Unfortunately, it was in a folder containing dozens of photos. Navigating through the slideshow in ImageGlass, stopping on the image I wanted, and downloading it into my project folder turned out to be easy. Open source to the rescue yet again, and the app took only seconds to download and use. - -ImageGlass was featured as a Picasa alternative in Jason Baker’s article [9 open source alternatives to][7] [Picasa][7] from March 10, 2016. There are some other interesting image-related open source tools in there as well if you are in need. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/use-imageglass-view-jpg-images-slideshow-windows-10 - -作者:[Jeff Macharyas][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/jeffmacharyas -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/look-binoculars-sight-see-review.png?itok=NOw2cm39 (Looking back with binoculars) -[2]: https://imageglass.org/ -[3]: https://github.com/d2phap/ImageGlass/blob/master/LICENSE -[4]: https://opensource.com/sites/default/files/uploads/imageglass-screenshot.png (Viewing an image in ImageGlass.) -[5]: https://github.com/fire-eggs -[6]: https://github.com/d2phap/ImageGlass -[7]: https://opensource.com/alternatives/picasa diff --git a/sources/talk/20190619 Cisco connects with IBM in to simplify hybrid cloud deployment.md b/sources/talk/20190619 Cisco connects with IBM in to simplify hybrid cloud deployment.md deleted file mode 100644 index b3344c5eb2..0000000000 --- a/sources/talk/20190619 Cisco connects with IBM in to simplify hybrid cloud deployment.md +++ /dev/null @@ -1,85 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco connects with IBM in to simplify hybrid cloud deployment) -[#]: via: (https://www.networkworld.com/article/3403363/cisco-connects-with-ibm-in-to-simplify-hybrid-cloud-deployment.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco connects with IBM in to simplify hybrid cloud deployment -====== -Cisco and IBM are working todevelop a hybrid-cloud architecture that meld Cisco’s data-center, networking and analytics platforms with IBM’s cloud offerings. -![Ilze Lucero \(CC0\)][1] - -Cisco and IBM said the companies would meld their [data-center][2] and cloud technologies to help customers more easily and securely build and support on-premises and [hybrid-cloud][3] applications. - -Cisco, IBM Cloud and IBM Global Technology Services (the professional services business of IBM) said they will work to develop a hybrid-cloud architecture that melds Cisco’s data-center, networking and analytics platforms with IBM’s cloud offerings. IBM's contribution includea a heavy emphasis on Kubernetes-based offerings such as Cloud Foundry and Cloud Private as well as a catalog of [IBM enterprise software][4] such as Websphere and open source software such as Open Whisk, KNative, Istio and Prometheus. - -**[ Read also:[How to plan a software-defined data-center network][5] ]** - -Cisco said customers deploying its Virtual Application Centric Infrastructure (ACI) technologies can now extend that network fabric from on-premises to the IBM Cloud. ACI is Cisco’s [software-defined networking (SDN)][6] data-center package, but it also delivers the company’s Intent-Based Networking technology, which brings customers the ability to automatically implement network and policy changes on the fly and ensure data delivery. - -[IBM said Cisco ACI Virtual Pod][7] (vPOD) software can now run on IBM Cloud bare-metal servers. “vPOD consists of virtual spines and leafs and supports up to eight instances of ACI Virtual Edge. These elements are often deployed on VMware services on the IBM Cloud to support hybrid deployments from on-premises environments to the IBM Cloud," the company stated. - -“Through a new relationship with IBM’s Global Technology Services team, customers can implement Virtual ACI on their IBM Cloud,” Cisco’s Kaustubh Das, vice president of strategy and product development wrote in a [blog][8] about the agreement. “Virtual ACI is a software-only solution that you can deploy wherever you have at least two servers on which you can run the VMware ESXi hypervisor. In the future, the ability to deploy IBM Cloud Pak for Applications in a Cisco ACI environment will also be supported,” he stated. - -IBM’s prepackaged Cloud Paks include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers, Big Blue said. - -Additionally IBM said it would add support for its IBM Cloud Private, which manages Kubernetes and other containers, on Cisco HyperFlex and HyperFlex Edge hyperconverged infrastructure (HCI) systems. HyperFlex is Cisco's HCI that offers computing, networking and storage resources in a single system. The package can be managed via Cisco’s Intersight software-as-a-service cloud management platform that offers a central dashboard of HyperFlex operations. - -IBM said it was adding Hyperflex support to its IBM Cloud Pak for Applications as well. - -The paks include IBM Multicloud Manager which is a Kubernetes-based platform that runs on the company’s [IBM Cloud Private][9] platform and lets customers manage and integrate workloads on clouds from other providers such as Amazon, Red Hat and Microsoft. - -At the heart of the Multi-cloud Manager is a dashboard interface for managing thousands of Kubernetes applications and huge volumes of data regardless of where in the organization they are located. - -The idea is that Multi-cloud Manager lets operations and development teams get visibility of Kubernetes applications and components across the different clouds and clusters via a single control pane. - -“With IBM Multicloud Manager, enterprises can have a single place to manage multiple clusters running across multiple on-premises, public and private cloud environments, providing consistent visibility, governance and automation from on-premises to the edge, wrote IBM’s Evaristus Mainsah, general manager of IBM Cloud Private Ecosystem in a [blog][7] about the relationship. - -Distributed workloads can be pushed out and managed directly at the device at a much larger scale across multiple public clouds and on-premises locations. Visibility, compliance and governance are provided with extended MCM capabilities that will be available at the lightweight device layer, with a connection back to the central server/gateway, Mainsah stated. - -In addition, Cisco’s AppDynamics\can be tied in to monitor infrastructure and business performance, Cisco stated. Cisco recently added [AppDynamics for Kubernetes][10], which Cisco said will reduce the time it takes to identify and troubleshoot performance issues across Kubernetes clusters. - -The companies said the hybrid-cloud architecture they envision will help reduce the complexity of setting up and managing hybrid-cloud environments. - -Cisco and IBM are both aggressively pursuing cloud customers. Cisco[ ramped up][11] its own cloud presence in 2018 with all manner of support stemming from an [agreement with Amazon Web Services][12] (AWS) that will offer enterprise customers an integrated platform to help them more simply build, secure and connect [Kubernetes][13] clusters across private [data centers][14] and the AWS cloud. - -Cisco and Google in [April expanded their joint cloud-development][15] activities to help customers more easily build secure multicloud and hybrid applications everywhere from on-premises data centers to public clouds. - -IBM is waiting to close [its $34 billion Red Hat deal][16] that it expects will give it a huge presence in the hotly contested hybrid-cloud arena and increase its inroads to competitors – Google, Amazon and Microsoft among others. Gartner says that market will be worth $240 billion by next year. - -Join the Network World communities on [Facebook][17] and [LinkedIn][18] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3403363/cisco-connects-with-ibm-in-to-simplify-hybrid-cloud-deployment.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://images.idgesg.net/images/article/2018/03/cubes_blocks_squares_containers_ilze_lucero_cc0_via_unsplash_1200x800-100752172-large.jpg -[2]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[3]: https://www.networkworld.com/article/3233132/what-is-hybrid-cloud-computing.html -[4]: https://www.networkworld.com/article/3340043/ibm-marries-on-premises-private-and-public-cloud-data.html -[5]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html -[6]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[7]: https://www.ibm.com/blogs/cloud-computing/2019/06/18/ibm-cisco-collaborating-hybrid-cloud-modern-enterprise/ -[8]: https://blogs.cisco.com/datacenter/cisco-and-ibm-cloud-announce-hybrid-cloud-partnership -[9]: https://www.ibm.com/cloud/private -[10]: https://blog.appdynamics.com/product/kubernetes-monitoring-with-appdynamics/ -[11]: https://www.networkworld.com/article/3322937/lan-wan/what-will-be-hot-for-cisco-in-2019.html?nsdr=true -[12]: https://www.networkworld.com/article/3319782/cloud-computing/cisco-aws-marriage-simplifies-hybrid-cloud-app-development.html?nsdr=true -[13]: https://www.networkworld.com/article/3269848/cloud-computing/cisco-embraces-kubernetes-pushing-container-software-into-mainstream.html -[14]: https://www.networkworld.com/article/3223692/data-center/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html -[15]: https://www.networkworld.com/article/3388218/cisco-google-reenergize-multicloudhybrid-cloud-joint-development.html -[16]: https://www.networkworld.com/article/3316960/ibm-says-buying-red-hat-makes-it-the-biggest-in-hybrid-cloud.html -[17]: https://www.facebook.com/NetworkWorld/ -[18]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190619 Cisco issues critical security warnings on SD-WAN, DNA Center.md b/sources/talk/20190619 Cisco issues critical security warnings on SD-WAN, DNA Center.md deleted file mode 100644 index 187e883706..0000000000 --- a/sources/talk/20190619 Cisco issues critical security warnings on SD-WAN, DNA Center.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco issues critical security warnings on SD-WAN, DNA Center) -[#]: via: (https://www.networkworld.com/article/3403349/cisco-issues-critical-security-warnings-on-sd-wan-dna-center.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco issues critical security warnings on SD-WAN, DNA Center -====== -Vulnerabilities to Cisco's SD-WAN and DNA Center software top a list of nearly 30 security advisories issued by the company. -![zajcsik \(CC0\)][1] - -Cisco has released two critical warnings about security issues with its SD-WAN and DNA Center software packages. - -The worse, with a Common Vulnerability Scoring System rating of 9.3 out of 10, is a vulnerability in its [Digital Network Architecture][2] (DNA) Center software that could let an unauthenticated attacker connect an unauthorized network device to the subnet designated for cluster services. - -**More about SD-WAN** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][3] - * [How to pick an off-site data-backup method][4] - * [SD-Branch: What it is and why you’ll need it][5] - * [What are the options for security SD-WAN?][6] - - - -A successful exploit could let an attacker reach internal services that are not hardened for external access, Cisco [stated][7]. The vulnerability is due to insufficient access restriction on ports necessary for system operation, and the company discovered the issue during internal security testing, Cisco stated. - -Cisco DNA Center gives IT teams the ability to control access through policies using Software-Defined Access, automatically provision through Cisco DNA Automation, virtualize devices through Cisco Network Functions Virtualization (NFV), and lower security risks through segmentation and Encrypted Traffic Analysis. - -This vulnerability affects Cisco DNA Center Software releases prior to 1.3, and it is fixed in version 1.3 and releases after that. - -Cisco wrote that system updates are available from the Cisco cloud but not from the [Software Center][8] on Cisco.com. To upgrade to a fixed release of Cisco DNA Center Software, administrators can use the “System Updates” feature of the software. - -A second critical warning – with a CVVS score of 7.8 – is a weakness in the command-line interface of the Cisco SD-WAN Solution that could let an authenticated local attacker elevate lower-level privileges to the root user on an affected device. - -Cisco [wrote][9] that the vulnerability is due to insufficient authorization enforcement. An attacker could exploit this vulnerability by authenticating to the targeted device and executing commands that could lead to elevated privileges. A successful exploit could let the attacker make configuration changes to the system as the root user, the company stated. - -This vulnerability affects a range of Cisco products running a release of the Cisco SD-WAN Solution prior to Releases 18.3.6, 18.4.1, and 19.1.0 including: - - * vBond Orchestrator Software - * vEdge 100 Series Routers - * vEdge 1000 Series Routers - * vEdge 2000 Series Routers - * vEdge 5000 Series Routers - * vEdge Cloud Router Platform - * vManage Network Management Software - * vSmart Controller Software - - - -Cisco said it has released free [software updates][10] that address the vulnerability described in this advisory. Cisco wrote that it fixed this vulnerability in Release 18.4.1 of the Cisco SD-WAN Solution. - -The two critical warnings were included in a dump of [nearly 30 security advisories][11]. - -There were two other “High” impact rated warnings involving the SD-WAN software. - -One, a vulnerability in the vManage web-based UI (Web UI) of the Cisco SD-WAN Solution could let an authenticated, remote attacker gain elevated privileges on an affected vManage device, Cisco [wrote][12]. - -The vulnerability is due to a failure to properly authorize certain user actions in the device configuration. An attacker could exploit this vulnerability by logging in to the vManage Web UI and sending crafted HTTP requests to vManage. A successful exploit could let attackers gain elevated privileges and make changes to the configuration that they would not normally be authorized to make, Cisco stated. - -Another vulnerability in the vManage web-based UI could let an authenticated, remote attacker inject arbitrary commands that are executed with root privileges. - -This exposure is due to insufficient input validation, Cisco [wrote][13]. An attacker could exploit this vulnerability by authenticating to the device and submitting crafted input to the vManage Web UI. - -Both vulnerabilities affect Cisco vManage Network Management Software that is running a release of the Cisco SD-WAN Solution prior to Release 18.4.0 and Cisco has released free [software updates][10] to correct them. - -Other high-rated vulnerabilities Cisco disclosed included: - - * A [vulnerability][14] in the Cisco Discovery Protocol (CDP) implementation for the Cisco TelePresence Codec (TC) and Collaboration Endpoint (CE) Software could allow an unauthenticated, adjacent attacker to inject arbitrary shell commands that are executed by the device. - * A [weakness][15] in the internal packet-processing functionality of the Cisco StarOS operating system running on virtual platforms could allow an unauthenticated, remote attacker to cause an affected device to stop processing traffic, resulting in a denial of service (DoS) condition. - * A [vulnerability][16] in the web-based management interface of the Cisco RV110W Wireless-N VPN Firewall, Cisco RV130W Wireless-N Multifunction VPN Router, and Cisco RV215W Wireless-N VPN Router could allow an unauthenticated, remote attacker to cause a reload of an affected device, resulting in a denial of service (DoS) condition. - - - -Cisco has [released software][10] fixes for those advisories as well. - -Join the Network World communities on [Facebook][17] and [LinkedIn][18] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3403349/cisco-issues-critical-security-warnings-on-sd-wan-dna-center.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://images.idgesg.net/images/article/2018/04/lightning_storm_night_gyorgy_karoly_toth_aka_zajcsik_cc0_via_pixabay_1200x800-100754504-large.jpg -[2]: https://www.networkworld.com/article/3401523/cisco-software-to-make-networks-smarter-safer-more-manageable.html -[3]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[4]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[5]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[6]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[7]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-dnac-bypass -[8]: https://software.cisco.com/download/home -[9]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-sdwan-privesca -[10]: https://tools.cisco.com/security/center/resources/security_vulnerability_policy.html#fixes -[11]: https://tools.cisco.com/security/center/publicationListing.x?product=Cisco&sort=-day_sir&limit=50#~Vulnerabilities -[12]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-sdwan-privilescal -[13]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-sdwan-cmdinj -[14]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-tele-shell-inj -[15]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-staros-asr-dos -[16]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190619-rvrouters-dos -[17]: https://www.facebook.com/NetworkWorld/ -[18]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190625 You Can-t Afford Not to Use a Business-Driven SD-WAN.md b/sources/talk/20190625 You Can-t Afford Not to Use a Business-Driven SD-WAN.md deleted file mode 100644 index eb2dc6f18e..0000000000 --- a/sources/talk/20190625 You Can-t Afford Not to Use a Business-Driven SD-WAN.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (You Can’t Afford Not to Use a Business-Driven SD-WAN) -[#]: via: (https://www.networkworld.com/article/3404618/you-can-t-afford-not-to-use-a-business-driven-sd-wan.html) -[#]: author: (Rami Rammaha https://www.networkworld.com/author/Rami-Rammaha/) - -You Can’t Afford Not to Use a Business-Driven SD-WAN -====== - -![maxkabakov/istock][1] - -Digital transformation and cloud initiatives are changing the way IT organizations are thinking about and architecting the wide area network. It is estimated that over 70 percent of applications have already moved to the cloud. Yet, the transformational promise of the cloud is falling short as conventional networks can’t keep pace with demands of the cloud. Why? Because today’s router-centric and basic [SD-WAN][2] architectures have either hit the wall or can’t keep up with traffic pattern shifts, distributed applications and the open security perimeters inherent to the cloud. This blog will explore the limitations of today’s WAN approaches, offering a better way forward with a business-first networking model. - -### **Traditional Router-centric WAN** - -The traditional router-centric model is network-driven, where businesses are forced to conform to the constraints of the network. Enterprises struggle trying to stretch the old router-centric WAN – it’s too cumbersome and complicated and is simply unable to meet the business needs of a cloud-first enterprise. Cloud-first enterprise business requirements include: - - * Using the internet to connect users directly to cloud applications - * Delivering new applications to 1000s of sites, across multiple clouds, in 10 percent of the time - * Delivering 10x more bandwidth at the edge, for the same budget - * Protecting the business when the cloud is open, accessible and everything is connected - * Continuously delivering a WOW application performance for every business-critical application - - - -![][3] - -### **Basic SD-WAN Solutions** - -To address the requirements of cloud-first businesses, a plethora of SD-WAN solutions have emerged in the past few years. Basic SD-WAN solutions are a step in the right direction but fall well short of the goal of a fully automated business-driven network. A basic SD-WAN provides some level of automation and intelligence, but it is unable to continuously and automatically adapt to changing network conditions. A basic SD-WAN solution can’t deliver a consistent WOW experience for real-time voice and video applications, especially over broadband. Furthermore, with a basic SD-WAN, IT is unable to deliver a simplified end-to-end secure segmentation across the LAN-WAN-LAN/Data Center to minimize the attack surface.  A basic SD-WAN also won’t deliver on the promised savings in operational costs. The graphic below illustrates the short falls of a basic SD-WAN offering.  - -![][4] - -### **The Time is Now to Shift to a Business-driven SD-WAN** - -With a [business-driven SD-WAN][5], the network becomes a business enabler, not a constraint. It acts as a business accelerant with a top-down approach that starts with business intent. Business intent defines how applications should be delivered to end users. Business intent can include performance, priority, security, resiliency, routing, etc. that should be applied to different classes of applications. With a business-driven SD-WAN, network resources are matched – automatically – based on the business priority and security requirements for every application. The network continuously monitors the performance of applications and transport resources and automatically adapts to any changes to remain in compliance with application QoS and security policies. A business-driven SD-WAN delivers the highest quality of experience for users with consistent, reliable application performance – including the highest quality voice and video over broadband.  - -The highest quality of experience doesn’t stop with users. With [centralized orchestration][6], a business-driven SD-WAN minimizes human error, makes changes easier and enables faster response to business needs. A business-driven SD-WAN goes beyond the automation and templates of basic SD-WAN solutions to power a self-driving wide area network™ that learns and adapts to the changing requirements of the business to ensure the highest levels of end user and application performance. It eliminates the impact of brownouts and blackouts as monitoring and analytics detect changing conditions and trigger immediate adjustments. Built-in monitoring, alarms/alerts and reporting enables faster troubleshooting when issues occur. With a highly available, resilient, business-driven SD-WAN, IT can reclaim their weekends and sleep through the night!  A unified platform is designed as one unifying and orchestrating network functions such as SD-WAN, firewall, segmentation, routing, WAN optimization, application visibility and control based on business requirements. With service chaining, to ecosystem partners (security, cloud and service providers), existing investments can be fully leveraged with rapid deployment, interoperating with full and open APIs.     - -![][7] - -In this table, a comparison of router-centric, basic SD-WAN and business-driven SD-WAN shows that enterprises get the most value and benefits from shifting to a business-first networking model.  - -![Full Harvey Ball: Most; Empty Harvey Ball: Least][8] - -Click on the [infographic][9] for a full summary of the WAN edge architecture approaches. - -![][10] - -With an interactive ROI calculator, you can calculate savings between a business-driven SD-WAN from Silver Peak and a traditional router-centric SD-WAN. Click [here][11] to calculate your savings right now. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3404618/you-can-t-afford-not-to-use-a-business-driven-sd-wan.html - -作者:[Rami Rammaha][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/Rami-Rammaha/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/06/istock-1073941846-100800084-large.jpg -[2]: https://www.silver-peak.com/sd-wan/sd-wan-explained -[3]: https://images.idgesg.net/images/article/2019/06/illo_1-100800095-large.jpg -[4]: https://images.idgesg.net/images/article/2019/06/illo_2-100800097-large.jpg -[5]: https://www.silver-peak.com/products/unity-edge-connect -[6]: https://www.silver-peak.com/products/unity-orchestrator -[7]: https://images.idgesg.net/images/article/2019/06/illo_3-100800099-large.jpg -[8]: https://images.idgesg.net/images/article/2019/06/sd-wan-comparison-chart4-100800100-large.jpg -[9]: https://www.silver-peak.com/sites/default/files/infoctr/sd-wan-comparison-diagram-0119.pdf -[10]: https://images.idgesg.net/images/article/2019/06/acomparisonoftodayswanedgeapproaches-100800113-large.jpg -[11]: https://www.silver-peak.com/sd-wan-interactive-roi-calculator diff --git a/sources/talk/20190626 Juniper-s Mist adds WiFi 6, AI-based cloud services to enterprise edge.md b/sources/talk/20190626 Juniper-s Mist adds WiFi 6, AI-based cloud services to enterprise edge.md deleted file mode 100644 index 0548e968fe..0000000000 --- a/sources/talk/20190626 Juniper-s Mist adds WiFi 6, AI-based cloud services to enterprise edge.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Juniper’s Mist adds WiFi 6, AI-based cloud services to enterprise edge) -[#]: via: (https://www.networkworld.com/article/3405123/juniper-s-mist-adds-wifi-6-ai-based-cloud-services-to-enterprise-edge.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Juniper’s Mist adds WiFi 6, AI-based cloud services to enterprise edge -====== -Mist, a Juniper Networks company, has rolled out an artificial-intelligence, cloud-based appliance and a WIFI 6 access point aimed at helping users roll out smart, high-density wireless networks. -![Getty Images][1] - -Mist, now a Juniper Networks company, has rolled out an artificial-intelligence, cloud-based appliance and a WiFi 6 access point that together aim at helping users deploy smart, high-density wireless networks. - -Leading the rollout is the Mist Edge appliance that extends Mist’s cloud services to the branch and lets enterprises manage the distributed Wi-Fi infrastructure from a central location.  - -**More about 802.11ax (Wi-Fi 6)** - - * [Why 802.11ax is the next big thing in wireless][2] - * [FAQ: 802.11ax Wi-Fi][3] - * [Wi-Fi 6 (802.11ax) is coming to a router near you][4] - * [Wi-Fi 6 with OFDMA opens a world of new wireless possibilities][5] - * [802.11ax preview: Access points and routers that support Wi-Fi 6 are on tap][6] - - - -The Mist Edge device features the company’s artificial-intelligence engine that helps automate tasks such as adjusting Wi-Fi signal strength and troubleshooting.  According to Mist, some other potential use cases for Mist Edge include: - - * Seamless roaming for large campus networks through on-premises tunnel termination of traffic to/from access points. - * Extending virtual LANs (VLANs) to distributed branches and telecommuters to replace remote virtual private network (VPN) technology. - * Dynamic traffic segmentation for IoT devices. - * The ability to split tunneling to keep guest access and corporate traffic separate. - - - -The company says a software-only version of Mist Edge will be available in the future.  - -[Mist’s][7] strength is its AI-based wireless platform which makes Wi-Fi more predictable, reliable and measurable. Mist is also unique in how it has delivered applications via cloud microservices and containers which could be attractive to enterprise users looking to reduce wireless operational costs, experts say.  - -Mist’s cloud-based system brings patented dynamic packet capture and machine learning technology to automatically identify, adapt and fix network issues, Gartner wrote in a recent Magic Quadrant report. The Mist system is delivered and managed via cloud services. - -“Mist's AI-driven Wi-Fi provides guest access, network management, policy applications and a virtual network assistant as well as analytics, IoT segmentation, and behavioral analysis at scale,” Gartner stated.  “Mist offers a new and unique approach to high-accuracy location services through a cloud-based machine-learning engine that uses Wi-Fi and Bluetooth Low Energy (BLE)-based signals from its multielement directional-antenna access points. The same platform can be used for Real Time Location System (RTLS) usage scenarios, static or zonal applications, and engagement use cases like wayfinding and proximity notifications.” - -Juniper bought Mist in March for $405 million for this AI-based WIFI technology.  For Juniper the Mist buy was significant as it had depended on agreements with partners such as Aerohive and Aruba to deliver wireless, according to Gartner.  - -Mist, too, has partners and recently announced joint product development with VMware that integrates Mist WLAN technology and VMware’s VeloCloud-based NSX SD-WAN. - -“Mist has focused on large enterprises and has won some very well known brands,” said Chris Depuy, technology analyst with the 650 Group.  “The [Mist/Juniper] combination is a good fit because both product lines are focusing on larger enterprises and over time, we expect Mist AI will be used to benefit the entire Juniper campus portfolio.” - -The other part of the company’s rollout is a WiFi 6 (802.11ax) access point, the Mist AP43, a cloud-managed WiFi 6 access point with integrated support for Mist’s AI automation and manageability. - -“The new access point gets Juniper to 802.11ax on the same time frame as other major competitors like Cisco,” said Depuy. “Juniper could not address customers who were upgrading wireless and wired at the same time without Mist. With 802.11ax, we expect new switches to be necessary because 1 GB isn’t fast enough to support these new APs. Thus, Juniper can now upgrade customers to 802.11ax and MultiGig switches instead of bringing in another vendor. “ - -WiFi 6 is designed for high-density public or private environments. But it also will be beneficial in internet of things (IoT) deployments, and in offices that use bandwidth-hogging applications like videoconferencing. Products promising WIFI 6 support have been rolling out across the industry with [HPE][8], [Cisco][9], [Arista][10] and others recently tossing their hats into the ring. - -The enterprise WLAN is now dominated by the 802.11ac standard, which makes up 86.4% of dependent access point (AP) shipments and 93.1% of enterprise WLAN dependent AP revenues. The next iteration of the standard, 802.11ax or WiFi 6, will increase in the market throughout the rest of 2019 and into 2020. In the consumer WLAN market, the 802.11ac standard accounted for 58.0% of shipments and 79.2% of revenue in 1Q19, according to IDC’s most recent [Worldwide Quarterly WLAN Tracker][11] report. - -"The WLAN market continues to see steady, moderate growth as enterprises invest in wireless connectivity to support the continued demand for access technology," said [Brandon Butler][12], senior research analyst, Network Infrastructure at IDC in the report. "Meanwhile, the coming Wi-Fi 6 standard will be a major driver of growth in the WLAN market in the coming years, especially in the advanced enterprise segments of the market." - -The AP43 lists at $1,585. - -Mist also announced a strategic relationship with ForeScout to automate management and security control of Wi-Fi client and Internet of Things (IoT) devices.  The Juniper and Forescout mashup lets customers monitor and profile devices and mobile clients including smartphones, tablets, laptops, robots and IoT devices (HVAC systems, security devices, displays, sensors, lights) based on their network traffic patterns. Then if anomalous or threatening behavior is observed, customers can launch trouble tickets, remediate software on devices as needed or quarantine devices. - -Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3405123/juniper-s-mist-adds-wifi-6-ai-based-cloud-services-to-enterprise-edge.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://images.idgesg.net/images/article/2019/02/wifi_cloud_wireless-100787113-large.jpg -[2]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html -[3]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html -[4]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html -[5]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html -[6]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html -[7]: https://www.networkworld.com/article/3089038/why-one-cisco-shop-is-willing-to-give-wifi-startup-mist-a-shot.html -[8]: https://www.arubanetworks.com/products/networking/802-11ax/ -[9]: https://www.networkworld.com/article/3391919/cisco-goes-all-in-on-wifi-6.html -[10]: https://www.networkworld.com/article/3400905/new-switches-wi-fi-gear-to-advance-aristas-campus-architecture.html -[11]: http://www.idc.com/tracker/showproductinfo.jsp?prod_id=262 -[12]: https://www.idc.com/getdoc.jsp?containerId=PRF005027 -[13]: https://www.facebook.com/NetworkWorld/ -[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190701 Tempered Networks simplifies secure network connectivity and microsegmentation.md b/sources/talk/20190701 Tempered Networks simplifies secure network connectivity and microsegmentation.md deleted file mode 100644 index 5cf40e865d..0000000000 --- a/sources/talk/20190701 Tempered Networks simplifies secure network connectivity and microsegmentation.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tempered Networks simplifies secure network connectivity and microsegmentation) -[#]: via: (https://www.networkworld.com/article/3405853/tempered-networks-simplifies-secure-network-connectivity-and-microsegmentation.html) -[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) - -Tempered Networks simplifies secure network connectivity and microsegmentation -====== -Tempered Networks’ Identity Defined Network platform uses the Host Identity Protocol to partition and isolate the network into trusted microsegments, providing an easy and cost-effective way to secure the network. -![Thinkstock][1] - -The TCP/IP protocol is the foundation of the internet and pretty much every single network out there. The protocol was designed 45 years ago and was originally only created for connectivity. There’s nothing in the protocol for security, mobility, or trusted authentication. - -The fundamental problem with TCP/IP is that the IP address within the protocol represents both the device location and the device identity on a network. This dual functionality of the address lacks the basic mechanisms for security and mobility of devices on a network. - -This is one of the reasons networks are so complicated today. To connect to things on a network or over the internet, you need VPNs, firewalls, routers, cell modems, etc. and you have all the configurations that come with ACLs, VLANs, certificates, and so on. The nightmare grows exponentially when you factor in internet of things (IoT) device connectivity and security. It’s all unsustainable at scale. - -Clearly, we need a more efficient and effective way to take on network connectivity, mobility, and security. - -**[ Also read: [What is microsegmentation? How getting granular improves network security][2] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ]** - -The Internet Engineering Task Force (IETF) tackled this problem with the Host Identity Protocol (HIP). It provides a method of separating the endpoint identifier and the locator roles of IP addresses. It introduces a new Host Identity (HI) name space, based on public keys, from which endpoint identifiers are taken. HIP uses existing IP addressing and forwarding for locators and packet delivery.The protocol is compatible with IPv4 and IPv6 applications and utilizes a customized IPsec tunnel mode for confidentiality, authentication, and integrity of network applications. - -Ratified by IETF in 2015, HIP represents a new security networking layer within the OSI stack. Think of it as Layer 3.5. It’s a flip of the trust model where TCP/IP is inherently promiscuous and will answer to anything that wants to talk to a device on that network. In contrast, HIP is a trust protocol that will not answer to anything on the network unless that connection has been authenticated and authorized based on its cryptographic identity. It is, in effect, a form of a [software-defined perimeter][4] around specific network resources. This is also known as [microsegmentation][5]. - -![][6] - -### Tempered Networks’ IDN platform creates segmented, encrypted network - -[Tempered Networks][7] has created a platform utilizing the HIP and a variety of technologies that partitions and isolates the network into trusted microsegments. Tempered Networks’ Identity Defined Networking (IDN) platform is deployed as an overlay technology that layers on top of any IP network. The HIP was designed to be both forward and backward compatible with any IP network without having to make any changes to the underlay network. The overlay network creates a direct tunnel between the two things you want to connect. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][8] ]** - -The IDN platform uses three components to create a segmented and encrypted network: an orchestration engine called the Conductor, the HIPrelay identity-based router, and HIP Services enforcement points. - -The Conductor is a centralized orchestration and intelligence engine that connects, protects, and disconnects any resource globally through a single pane of glass. The Conductor is used to define and enforce policies for HIP Services. Policy configuration is done in a simple point-and-click manner. The Conductor is available as a physical or virtual appliance or in the Amazon Web Services (AWS) cloud. - -HIP Services provide software-based policy enforcement, enabling secure connectivity among IDN-protected devices, as well as cloaking, segmentation, identity-based routing, and IP mobility. They can be deployed on or in-line to any device or system and come in the form of HIPswitch hardware, HIPserver, HIPclient, Cloud HIPswitch, or Virtual HIPswitch. HIP Services also can be embedded in customer hardware or applications. - -Placing HIPswitches in front of any connected device renders the device HIP-enabled and immediately microsegments the traffic, isolating inbound and outbound traffic from the underlying network. HIPswitches deployed on the network automatically register with the Conductor using their cryptographic identity. - -HIPrelay works with the HIP Service-enabled endpoints to deliver peer-to-peer connectivity for any device or system across all networks and transport options. Rather than using Layer 3 or 4 rule sets or traditional routing protocols, HIPrelay routes and connects encrypted communications based on provable cryptographic identities traversing existing infrastructure. - -It sounds complicated, but it really isn’t. A use case example should demonstrate the ease and power of this solution. - -### Use case: Smart Ships - -An international cruise line recently installed Tempered Networks’ IDN solution to provide tighter security around its critical maritime systems. Prior to deployment, the systems for fuel, propulsion, navigation, ballast, weather, and incinerators were on a flat Layer 2 network, which basically allowed authorized users of the network to see everything. - -Given that vendors of the different maritime systems had access to their own system, the lack of microsegmentation allowed them to see the other systems as well. The cruise line needed a simple way to segment access to these different systems — isolating them from each other — and they wanted to do it without having to put the ships in dry dock for the network reconfiguration. - -The original configuration looked like this: - -![][9] - -The company implemented microsegmentation of the network based on the functionality of the systems. This isolated and segmented vendor access to only their own systems — everything else was hidden to them. The implementation involved installing HIPrelay identity routing in the cloud, several HIPswitch wireless devices onboard the ships, and HIPclient software on the vendors’ and crew members’ devices. The Conductor appliance that managed the entire deployment was installed in AWS. - -All of that was done without impacting the underlying network, and no dry dock time was required for the deployment. In addition, the cruise line was able to eliminate internal firewalls and VPNs that had previously been used for segmentation and remote access. The resulting configuration looks like this: - -![][10] - -The color coding of the illustration above indicates what systems are now able to directly see and communicate with their corresponding controllers and sensors. Everything else on the network is hidden from view of those systems. - -The acquisition cost of the Tempered Networks’ solution was one-tenth that of a traditional microsegmentation solution. The deployment time was 2 FTE days per ship compared to the 40 FTE days a traditional solution would have needed. No additional staffing was required to support the solution, and no changes were made to the underlying network. - -### A time-tested microsegmentation solution - -This technology came out of Boeing and was deployed for over 12 years within their manufacturing facilities until 2014, when Boeing allowed the technology to become commercialized. Tempered Networks took the HIP and developed the full platform with easy, centralized management. It was purpose-built to provide secure connectivity to networks. The solution has been successfully deployed in industrial domains such as the utilities sector, oil and gas, electricity generation, and aircraft manufacturing, as well as in enterprise domains and healthcare. - -Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3405853/tempered-networks-simplifies-secure-network-connectivity-and-microsegmentation.html - -作者:[Linda Musthaler][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/Linda-Musthaler/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/01/network_security_hacker_virus_crime-100745979-large.jpg -[2]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.networkworld.com/article/3359363/software-defined-perimeter-brings-trusted-access-to-multi-cloud-applications-network-resources.html -[5]: https://www.networkworld.com/article/3247672/what-is-microsegmentation-how-getting-granular-improves-network-security.html -[6]: https://images.idgesg.net/images/article/2019/07/hip-slide-100800735-large.jpg -[7]: https://www.temperednetworks.com/ -[8]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[9]: https://images.idgesg.net/images/article/2019/07/cruise-ship-before-100800736-large.jpg -[10]: https://images.idgesg.net/images/article/2019/07/cruise-ship-after-100800738-large.jpg -[11]: https://www.facebook.com/NetworkWorld/ -[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md b/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md index 445075b49f..fe92b389a9 100644 --- a/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md +++ b/sources/talk/20190705 Lessons in Vendor Lock-in- Google and Huawei.md @@ -1,5 +1,5 @@ [#]: collector: "lujun9972" -[#]: translator: "acyanbird " +[#]: translator: " " [#]: reviewer: " " [#]: publisher: " " [#]: url: " " diff --git a/sources/talk/20190709 Cisco goes deeper into photonic, optical technology with -2.6B Acacia buy.md b/sources/talk/20190709 Cisco goes deeper into photonic, optical technology with -2.6B Acacia buy.md deleted file mode 100644 index 96f4b055cd..0000000000 --- a/sources/talk/20190709 Cisco goes deeper into photonic, optical technology with -2.6B Acacia buy.md +++ /dev/null @@ -1,72 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco goes deeper into photonic, optical technology with $2.6B Acacia buy) -[#]: via: (https://www.networkworld.com/article/3407706/cisco-goes-deeper-into-photonic-optical-technology-with-2-6b-acacia-buy.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco goes deeper into photonic, optical technology with $2.6B Acacia buy -====== -Cisco: Optical-interconnect technologies are becoming increasingly strategic for data centers, service providers -![KTSimage / Getty Images][1] - -Looking to bulk-up its optical systems portfolio, Cisco says it intends to buy Acacia Communications for approximately $2.6 billion.  The deal is Cisco’s largest since it [laid out $3.7B for AppDynamics][2] in 2017. - -Acacia develops, manufactures and sells high-speed [coherent optical][3] interconnect products that are designed to transform networks linking data centers, cloud and service providers. Cisco is familiar with Acacia as it has been a “significant” customer of the optical firm for about five years, Cisco said. - -**[ Also see [How to plan a software-defined data-center network][4] and [Efficient container use requires data-center software networking][5].]** - -Acacia’s other customers include Nokia Oyj, Huawei and ZTE. Cisco accounts for about 18% of its revenue, [according to Bloomberg’s supply-chain analysis][6]. - -"With the explosion of bandwidth in the multi-cloud era, optical interconnect technologies are becoming increasingly strategic,” said David Goeckeler, executive vice president and general manager of Cisco's networking and security business in a statement. “The acquisition of Acacia will allow us to build on the strength of our switching, routing and optical networking portfolio to address our customers' most demanding requirements." - -For Cisco, one of the key drivers for making this deal was Acacia’s coherent technology – “a fancy term that means the ability to send optical signals over long distances,” said Bill Gartner, senior vice president of Cisco’s Optical Systems and Optics business.  “That technology today is typically delivered via a line card on a big chassis in a separate optical layer but with Acadia’s digital signal processing, ASIC and other technology we are looking to move that from a line card to a pluggable module that increases network capacity, but also reduces complexity and costs.” - -In addition, Acacia uses silicon photonics as the platform for integration of multiple photonic functions for coherent optics, Gartner wrote in a [blog][7] about the acquisition. “Leveraging the advances in silicon photonics, each new generation of coherent optics products has enabled higher data transmission rates, lower power and higher performance than the one before.” - -Recent research from [IHS Markit][8] shows that data center interconnections are the fastest growing segment for coherent transceivers. - -“Acacia’s digital signal processing and small form-factor long-distance communications technology is strong and will be very valuable to Cisco in the long and short term,” said Jimmy Yu, vice president of the Dell'Oro Group. - -The question many analysts have is the impact the sale will have on other Acacia customers Yu said.   “If wasn’t for Acacia selling to others, [such as Huawei, ZTE and Infinera] I don’t thise think vendors would have done as well as they have, and when Cisco owns Acacia it could be a different story,” Yu said. - -The Acacia buy will significantly boost Cisco’s optical portfolio for application outside the data center.  In February [Cisco closed a deal to buy optical-semiconductor firm Luxtera][9] for $660 million, bringing it the advanced optical technology customers will need for speed and throughput for future data center and webscale networks. - -The combination of Cisco’s and Luxtera’s capabilities in 100GbE/400GbE optics, silicon and process technology will help customers build future-proof networks optimized for performance, reliability and cost, Cisco stated. - -The reason Cisco snatched-up Luxtera was its silicon photonics technology that moves data among computer chips optically, which is far quicker than today's electrical transfer, Cisco said. Photonics will be the underpinning of future switches and other networking devices. - -"It seems that Cisco is going all in on being a supplier of optical components and optical pluggable: Luxtera (client side optical components and pluggable) and Acacia (line side optical components and pluggable)," Yu said. - -"Unless Cisco captures more of the optical systems market share and coherent shipment volume, I think Cisco will need to continue selling Acacia products to the broader market and other system vendors due to the high cost of product development," Yu said. - -The acquisition is expected to close during the second half of Cisco's FY2020, and upon close, Acacia employees will join Cisco's Optical Systems and Optics business within its networking and security business under Goeckeler. - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3407706/cisco-goes-deeper-into-photonic-optical-technology-with-2-6b-acacia-buy.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://images.idgesg.net/images/article/2019/02/money_currency_printing_press_us_100-dollar_bills_by_ktsimage_gettyimages-1015664778_2400x1600-100788423-large.jpg -[2]: https://www.networkworld.com/article/3184027/cisco-closes-appdynamics-deal-increases-software-weight.html -[3]: https://www.ciena.com/insights/what-is/What-Is-Coherent-Optics.html -[4]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html -[5]: https://www.networkworld.com/article/3297379/data-center/efficient-container-use-requires-data-center-software-networking.html -[6]: https://www.bloomberg.com/news/articles/2019-07-09/cisco-to-acquire-acacia-communications-for-2-6-billion-jxvs6rva?utm_source=twitter&utm_medium=social&cmpid=socialflow-twitter-business&utm_content=business&utm_campaign=socialflow-organic -[7]: https://blogs.cisco.com/news/cisco-news-announcement-07191234 -[8]: https://technology.ihs.com/ -[9]: https://www.networkworld.com/article/3339360/cisco-pushes-silicon-photonics-for-enterprise-webscale-networking.html -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190710 The Titan supercomputer is being decommissioned- a costly, time-consuming project.md b/sources/talk/20190710 The Titan supercomputer is being decommissioned- a costly, time-consuming project.md deleted file mode 100644 index 1cee0a981d..0000000000 --- a/sources/talk/20190710 The Titan supercomputer is being decommissioned- a costly, time-consuming project.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Titan supercomputer is being decommissioned: a costly, time-consuming project) -[#]: via: (https://www.networkworld.com/article/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -The Titan supercomputer is being decommissioned: a costly, time-consuming project -====== -The old gives way to new at Oak Ridge National Labs. The Titan supercomputer is being replaced by Frontier, and it's a super-sized task. -![Oak Ridge National Laboratory][1] - -A supercomputer deployed in 2012 is going into retirement after seven years of hard work, but the task of decommissioning it is not trivial. - -The Cray XK7 “Titan” supercomputer at the Department of Energy’s (DOE) Oak Ridge National Laboratory (ORNL) is scheduled to be decommissioned on August 1 and disassembled for recycling. - -At 27 petaflops, or 27 quadrillion calculations per second, Titan was at one point the fastest supercomputer in the world at its debut in 2012 and remained in the top 10 worldwide until June 2019. - -**[ Also read: [10 of the world's fastest supercomputers][2] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ]** - -But time marches on. This beast is positively ancient by computing standards. It uses 16-core AMD Opteron CPUs and Nvidia Kepler generation processors. You can buy a gaming PC with better than that today. - -“Titan has run its course,” Operations Manager Stephen McNally at ORNL said in an [article][4] published by ONRL. “The reality is, in electronic years, Titan is ancient. Think of what a cell phone was like seven years ago compared to the cell phones available today. Technology advances rapidly, including supercomputers.” - -In its seven years, Titan generated than 26 billion core hours of computing time for hundreds of research teams around the world, not just the DOE. It was one of the first to use GPUs, a groundbreaking move at the time but now commonplace. - -The Oak Ridge Leadership Computing Facility (OLCF) actually houses Titan in a 60,000-sq.-ft. facility, 20,000 of which is occupied by Titan, the Eos cluster that supports Titan and Atlas file system that holds 32 petabytes of data. - -**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][5] ]** - -June 30 was the last day users could submit jobs to Titan or Eos, another supercomputer, which is also 7 years old.  - -### Decommissioning a supercomputer is a super-sized task - -Decommissioning a computer the size of Titan is more than turning off a switch. ONRL didn’t have a dollar estimate of the cost involved, but it did discuss the scale, which should give some idea of how costly this will be. - -The decommissioning of Titan will include about 41 people, including staff from ORNL, Cray, and external subcontractors. OLCF staff are supporting users who need to complete runs, save data, or transition their projects to other resources. - -Electricians will safely shut down the 9 megawatt-capacity system, and Cray staff will disassemble and recycle Titan’s electronics and its metal components and cabinets. A separate crew will handle the cooling system. All told, 350 tons of equipment and 10,800 pounds of refrigerant are being removed from the site. - -What becomes of the old gear is unclear. Even ONRL has no idea what Cray will do with it. McNally said there is no value in Titan’s parts: “It’s simply not worth the cost to a data center or university of powering and cooling even fragments of Titan. Titan’s value lies in the system as a whole.” - -The 20,000-sq.-ft. data center that is currently home to Titan will be gutted and expanded in preparation for [Frontier][6], the an exascale system scheduled for delivery in 2021 running AMD Epyc processors and Nvidia GPUs. - -A power, cooling, and data center upgrade is already underway ahead of the Titan decommissioning to prepare for Frontier. The whole removal process will take about a month but has been in the works for several months to ensure a smooth transition for people still using the old machine. - -**[ Now read this: [10 of the world's fastest supercomputers][2] ]** - -Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.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://images.idgesg.net/images/article/2018/06/titan_supercomputer_at_ornl_oak_ridge_national_laboratory_1200x800-100762120-large.jpg -[2]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.olcf.ornl.gov/2019/06/28/farewell-titan/ -[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[6]: https://www.olcf.ornl.gov/frontier/ -[7]: https://www.facebook.com/NetworkWorld/ -[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190710 Will IBM-s acquisition be the end of Red Hat.md b/sources/talk/20190710 Will IBM-s acquisition be the end of Red Hat.md deleted file mode 100644 index a1a2e4cad5..0000000000 --- a/sources/talk/20190710 Will IBM-s acquisition be the end of Red Hat.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Will IBM’s acquisition be the end of Red Hat?) -[#]: via: (https://www.networkworld.com/article/3407746/will-ibms-acquisition-be-the-end-of-red-hat.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Will IBM’s acquisition be the end of Red Hat? -====== -IBM's acquisition of Red Hat is a big deal -- a 34 billion dollar big deal -- and many Linux professionals are wondering how it's going to change Red Hat's role in the Linux world. Here are some thoughts. -![Stephen Lawson/IDG][1] - -[IBM's acquisition of Red Hat for $34 billion][2] is now a done deal, and statements from the leadership of both companies sound extremely promising. But some in the Linux users have expressed concern. - -Questions being asked by some Linux professionals and devotees include: - - * Will Red Hat lose customer confidence now that it’s part of IBM and not an independent company? - * Will IBM continue putting funds into open source after paying such a huge price for Red Hat? Will they curtail what Red Hat is able to invest? - * Both companies’ leaders are saying all the right things now, but can they predict how their business partners and customers will react as they move forward? Will their good intentions be derailed? - - - -Part of the worry simply comes from the size of this deal. Thirty-four billion dollars is a _lot_ of money. This is probably the largest cloud computing acquisition to date. What kind of strain will that price tag put on how the new IBM functions going forward? Other worries come from the character of the acquisition – whether Red Hat will be able to continue operating independently and what will change if they cannot. In addition, a few Linux devotees hark back to Oracle’s acquisition of Sun Microsystems in 2010 and Sun’s slow death in its aftermath. - -**[ Also read: [The IBM-Red Hat deal: What it means for enterprises][3] | Get daily insights: [Sign up for Network World newsletters][4] ]** - -The good news is that this merger of IBM and Red Hat appears to offer each of the companies some significant benefits. IBM makes a strong move into cloud computing, and Red Hat gains a broader international footing. - -The other good news relates to the pace at which this acquisition occurred. Initially announced on October 28, 2018, it is now more than eight months later. It’s clear that the leadership of each company has not rushed headlong into this new relationship. Both parties to the acquisition appear to be moving ahead with trust and optimism. IBM promises to ensure Red Hat's independence and will allow it to continue to be "Red Hat" both in name and business activity. - -### The end of Red Hat highly unlikely - -Will this acquisition be the end of Red Hat? That outcome is not impossible, but it seems extremely unlikely. For one thing, both companies stand to gain significantly from the other’s strong points. IBM is likely to be revitalized in ways that allow it to be more successful, and Red Hat is starting from a very strong position. While it’s a huge gamble by some measurements, I think most of us Linux enthusiasts are cautiously optimistic at worst. - -IBM seems intent on allowing Red Hat to work independently and seems to be taking the time required to work out the kinks in their plans. - -As for the eventual demise of Sun Microsystems, the circumstances were very different. As this [coverage in Network World in 2017][5] suggests, Sun was in an altogether different position when it was acquired. The future for IBM and Red Hat appears to be considerably brighter – even to a former (decades earlier) member of the Sun User Group Board of Directors. - -The answer to the question posed by the title of this post is “probably not.” Only time will tell, but leadership seems committed to doing things the right way – preserving Red Hat's role in the Linux world and making the arrangement pay off for both organizations. And I, for one, expect good things to come from the merger – for IBM, for Red Hat and likely even for Linux enthusiasts like myself. - -**[ Now read this: [The IBM-Red Hat deal: What it means for enterprises][3] ]** - -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/3407746/will-ibms-acquisition-be-the-end-of-red-hat.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://images.techhive.com/images/article/2015/10/20151027-red-hat-logo-100625237-large.jpg -[2]: https://www.networkworld.com/article/3316960/ibm-closes-34b-red-hat-deal-vaults-into-multi-cloud.html -[3]: https://www.networkworld.com/article/3317517/the-ibm-red-hat-deal-what-it-means-for-enterprises.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://www.networkworld.com/article/3222707/the-sun-sets-on-solaris-and-sparc.html -[6]: https://www.facebook.com/NetworkWorld/ -[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190717 MPLS is hanging on in this SD-WAN world.md b/sources/talk/20190717 MPLS is hanging on in this SD-WAN world.md deleted file mode 100644 index 159c8598db..0000000000 --- a/sources/talk/20190717 MPLS is hanging on in this SD-WAN world.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (MPLS is hanging on in this SD-WAN world) -[#]: via: (https://www.networkworld.com/article/3409070/mpls-is-hanging-on-in-this-sd-wan-world.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -MPLS is hanging on in this SD-WAN world -====== -The legacy networking protocol is still viable and there is no need to replace it in certain use cases, argues one cloud provider. -![jamesteohart][1] - -The [SD-WAN networking market is booming and is expected to grow][2] to $17 billion by 2025, and no wonder. Software-defined wide-area networking eliminates the need for expensive routers and does all the network connectivity in the cloud. - -Among its advantages is the support for secure cloud connectivity, one area where multiprotocol label switching (MPLS) falls short. MPLS is a data protocol from before the internet took off and while ideal for communications within the corporate firewall, it doesn’t lend itself to cloud and outside communications well. - -You would think that would seal MPLS’s fate, but just like IPv6 is ever so slowly replacing IPv4, MPLS is hanging on and some IT pros are even increasing their investment. - -**[ Related: [MPLS explained – What you need to know about multi-protocol label switching][3] ]** - -Avant Communications, a cloud services provider that specializes in SD-WAN, recently issued a report entitled [State of Disruption][4] that found that 83% of enterprises that use or are familiar with MPLS plan to increase their MPLS network infrastructure this year, and 40% say they will “significantly increase” their use of it. - -The report did not find one protocol winning that the expense of another. Just as 83% plan to use MPLS, 78% acknowledged plans to use SD-WAN in their corporate networks by the end of the year. Although SD-WAN is on the rise, MPLS is clearly not going away anytime soon. Both SD-WAN and MPLS can live together in harmony, adding value to each other. - -“SD-WAN is the most disruptive technology in our study. It’s not surprising that adoption of new technologies is slowest among the largest companies. The wave of SD-WAN disruption has not fully hit larger companies yet, but our belief is that it is moving quickly upmarket,” the report stated. - -While SD-WAN is much better suited for the job of cloud connectivity, 50% of network traffic is still staying within the corporate firewall. So while SD-WAN can solve the connection issues, so can MPLS. And if you have it deployed, rip and replace makes no sense. - -“MPLS continues to have a strong role in modern networks, and we expect that to continue,” the report stated. “This is especially true among larger enterprises that have larger networks depending on MPLS. While you’ll find MPLS at the core for a long time to come, we expect to see a shared environment with SD-WAN at the edge, enabled by broadband Internet and other lower cost networks. “ - -And MPLS isn’t without its advantages, most notably it can [guarantee performance][5] while SD-WAN, at the mercy of the public internet, cannot. - -As broadband networks continue to improve in performance, SD-WAN will allow companies to reduce their reliance on MPLS, especially as equipment ages and is replaced. Avant expects that, for the foreseeable future, there will continue to be a very viable role for both. - -**More about SD-WAN:** - - * [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][6] - * [How to pick an off-site data-backup method][7] - * [SD-Branch: What it is and why you’ll need it][8] - * [What are the options for security SD-WAN?][9] - - - -Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3409070/mpls-is-hanging-on-in-this-sd-wan-world.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://images.idgesg.net/images/article/2019/07/the-latest-in-innovation-in-the-sd-wan-managed-services-market1400-100801684-large.jpg -[2]: https://www.prnewswire.com/news-releases/software-defined-wide-area-network-sd-wan-market-to-hit-17bn-by-2025-global-market-insights-inc-300795304.html -[3]: https://www.networkworld.com/article/2297171/sd-wan/network-security-mpls-explained.html -[4]: https://www.goavant.net/Disruption -[5]: https://www.networkworld.com/article/2297171/network-security-mpls-explained.html -[6]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html -[7]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html -[8]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html -[9]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html?nsdr=true -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190718 Smart cities offer window into the evolution of enterprise IoT technology.md b/sources/talk/20190718 Smart cities offer window into the evolution of enterprise IoT technology.md deleted file mode 100644 index 06b5726379..0000000000 --- a/sources/talk/20190718 Smart cities offer window into the evolution of enterprise IoT technology.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Smart cities offer window into the evolution of enterprise IoT technology) -[#]: via: (https://www.networkworld.com/article/3409787/smart-cities-offer-window-into-the-evolution-of-enterprise-iot-technology.html) -[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) - -Smart cities offer window into the evolution of enterprise IoT technology -====== -Smart-city technologies such as 0G networking hold clues for successful large-scale implementations of the internet of things in enterprise settings. -![Benjamin Hung modified by IDG Comm. \(CC0\)][1] - -Powering smart cities is one of the most ambitious use cases for the internet of things (IoT), combining a wide variety of IoT technologies to create coherent systems that span not just individual buildings or campuses but entire metropolises. As such, smart cities offer a window into the evolution of enterprise IoT technologies and implementations on the largest scale. - -And that’s why I connected with [Christophe Fourtet][2], CSO and co-founder of [Sigfox][3], a French global network operator, to learn more about using wireless networks to connect large numbers of low-power objects, ranging from smartwatches to electricity meters. (And I have to admit I was intrigued by the 0G network moniker, which conjured visions of weightless IoT devices floating in space, or maybe [OG-][4]style old-school authenticity. That’s not at all what it’s about, of course.) - -**[ Learns more: [Download a PDF bundle of five essential articles about IoT in the enterprise][5] ]** - -According to Fourtet, "Sigfox’s global 0G network specializes in inexpensively conveying small amounts of data over long ranges—without sacrificing quality. Whereas other networks aim to collect and transmit as much data as possible, as quickly as possible, we deliver small packets of information at regular intervals, giving customers only the critical information they need." - -The software-based wireless 0G network listens to devices without the need to establish and maintain network connection, eliminating signaling overhead. With network and computing complexity managed in the cloud, energy consumption and costs of connected devices are dramatically reduced, [the company says][6]. Just as important, the low power requirements can also dramatically cut battery requirements for IoT devices. - -Around the world, customers like Michelin, General Motors, and Airbus use the 0G networks to connect IoT devices, and the network is supported by more than 660 partner organizations, including device makers and service providers such as Urbansense and Bosch. Sigfox cited [0G-connected IoT devices enabling Danish cities][7] to monitor quality of life data, from detecting defects in buildings to tracking garbage collection. - -### 0G applications beyond smart cities - -In addition to smart cities applications, Sigfox serves several industry verticals, including manufacturing, agriculture, and retail. Common use cases include supply-chain management and asset tracking, both within factory/warehouse environments and between locations as containers/shipments move through the supply chain around the globe. The network is uniquely equipped for supply chain use cases due to its cost-efficiency, long-lasting batteries with totally predictable autonomy, and wide-range reach. - -In facilities management, the 0G network can connect IoT devices that track ambient factors such temperature, humidity, and occupancy. Doing so helps managers leverage occupancy data to adjust the amount of space a company needs to rent, reducing overhead costs. It can also help farmers optimize the planting, care, and harvesting of crops. - -Operating as a backup solution to ensure connectivity during a broadband network outage, 0G networking built into a cable box or router could allow service providers to access hardware even when the primary network is down, Fourtet said. - -“The 0G network does not promise a continuation of these services,” Fourtet noted, “but it can provide access to the necessary information to solve challenges associated with outages.” - -In a more dire example in the home and commercial building security market, sophisticated burglars could use cellular and Wi-Fi jammers to block a security system’s access to a network so even though alarms were issued, the service might never receive them, Fourtet said. But the 0G network can send an alert to the alarm system provider even if it has been jammed or blocked, he said. - -### How 0g networks are used today - -Current 0G implementations include helping [Louis Vuitton track luggage][8] for its traveling customers. Using a luggage tracker powered by by [Sigfox’s Monarch service][9], a suitcase can stay connected to the 0G network throughout a trip, automatically recognizing and adapting to local radio frequency standards. The idea is for travelers to track the location of their bags at major airports in multiple countries, Fourtet said, while low energy consumption promises a six-month battery life with a very small battery. - -At the Special Olympics World Games Abu Dhabi 2019, [iWire, LITE-ON and Sigfox worked together][10] to create a tracking solution designed to help safeguard 10,000 athletes and delegates. Sensors connected to the Sigfox 0G network and outfitted with Wi-Fi capabilities were equipped with tiny batteries designed to provide uninterrupted service throughout the weeklong event. The devices “periodically transmitted messages that helped to identify the location of athletes and delegates in case they went off course,” Fourtet said, while LITE-ON incorporated a panic button for use in case of emergencies. In fact, during the event, the system was used to locate a lost athlete and return them to the Games without incident, he said. - -French car manufacturer [Groupe PSA][11] uses the 0G network to optimize shipping container routes between suppliers and assembly plants. [Track&Trace][11] works with IBM’s cloud-based IoT technologies to track container locations and alert Groupe PSA when issues crop up, Fourtet said. - -### 0G is still growing - -“It takes time to build a new network,” Fourtet said. So while Sigfox has delivered 0G network coverage in 60 countries across five continents, covering 1 billion people  (including 51 U.S. metropolitan areas covering 30% of the population), Fourtet acknowledged, “[We] still have a ways to go to build our global network.” In the meantime, the company is expanding its Connectivity-as-a-Service (CaaS) solutions to enable coverage in areas where the 0G network does not yet exist. - -**More on IoT:** - - * [What is the IoT? How the internet of things works][12] - * [What is edge computing and how it’s changing the network][13] - * [Most powerful Internet of Things companies][14] - * [10 Hot IoT startups to watch][15] - * [The 6 ways to make money in IoT][16] - * [What is digital twin technology? [and why it matters]][17] - * [Blockchain, service-centric networking key to IoT success][18] - * [Getting grounded in IoT networking and security][5] - * [Building IoT-ready networks must become a priority][19] - * [What is the Industrial IoT? [And why the stakes are so high]][20] - - - -Join the Network World communities on [Facebook][21] and [LinkedIn][22] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3409787/smart-cities-offer-window-into-the-evolution-of-enterprise-iot-technology.html - -作者:[Fredric Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Fredric-Paul/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/07/tokyo_asia_smart-city_iot_networking_by-benjamin-hung-unsplash-100764249-large.jpg -[2]: https://www.sigfox.com/en/sigfox-story -[3]: https://www.sigfox.com/en -[4]: https://www.dictionary.com/e/slang/og/ -[5]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html -[6]: https://www.sigfox.com/en/sigfox-iot-technology-overview -[7]: https://www.youtube.com/watch?v=WXc722WGjnE&t=1s -[8]: https://www.sigfox.com/en/news/sigfox-and-louis-vuitton-partner-innovative-luggage-tracker -[9]: https://www.sigfox.com/en/solutions/sigfox-services -[10]: https://www.sigfox.com/en/news/case-study-special-olympics-2019 -[11]: https://www.sigfox.com/en/news/ibm-revolutionizes-container-tracking-groupe-psa-sigfox -[12]: https://www.networkworld.com/article/3207535/internet-of-things/what-is-the-iot-how-the-internet-of-things-works.html -[13]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html -[14]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html -[15]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html -[16]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html -[17]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html -[18]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html -[19]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html -[20]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html -[21]: https://www.facebook.com/NetworkWorld/ -[22]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190718 Worst DNS attacks and how to mitigate them.md b/sources/talk/20190718 Worst DNS attacks and how to mitigate them.md new file mode 100644 index 0000000000..b490eeeea1 --- /dev/null +++ b/sources/talk/20190718 Worst DNS attacks and how to mitigate them.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Worst DNS attacks and how to mitigate them) +[#]: via: (https://www.networkworld.com/article/3409719/worst-dns-attacks-and-how-to-mitigate-them.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Worst DNS attacks and how to mitigate them +====== +DNS threats, including DNS hijacking, tunneling, phishing, cache poisoning and DDoS attacks, are all on the rise. +![Max Bender \(CC0\)][1] + +The Domain Name System remains under constant attack, and there seems to be no end in sight as threats grow increasingly sophisticated. + +DNS, known as the internet’s phonebook, is part of the global internet infrastructure that translates between familiar names and the numbers computers need to access a website or send an email. While DNS has long been the target of assailants looking to steal all manner of corporate and private information, the threats in the [past year][2] or so indicate a worsening of the situation. + +**More about DNS:** + + * [DNS in the cloud: Why and why not][3] + * [DNS over HTTPS seeks to make internet use more private][4] + * [How to protect your infrastructure from DNS cache poisoning][5] + * [ICANN housecleaning revokes old DNS security key][6] + + + +IDC reports that 82% of companies worldwide have faced a DNS attack over the past year. The research firm recently published its fifth annual [Global DNS Threat Report][7], which is based on a survey IDC conducted on behalf of DNS security vendor EfficientIP of 904 organizations across the world during the first half of 2019. + +According to IDC's research, the average costs associated with a DNS attack rose by 49% compared to a year earlier. In the U.S., the average cost of a DNS attack tops out at more than $1.27 million. Almost half of respondents (48%) report losing more than $500,000 to a DNS attack, and nearly 10% say they lost more than $5 million on each breach. In addition, the majority of U.S. organizations say that it took more than one day to resolve a DNS attack. + +“Worryingly, both in-house and cloud applications were damaged, with growth of over 100% for in-house application downtime, making it now the most prevalent damage suffered,” IDC wrote. "DNS attacks are moving away from pure brute-force to more sophisticated attacks acting from the internal network. This will force organizations to use intelligent mitigation tools to cope with insider threats." + +### Sea Turtle DNS hijacking campaign + +An ongoing DNS hijacking campaign known as Sea Turtle is one example of what's occuring in today's DNS threat landscape. + +This month, [Cisco Talos][8] security researchers said the people behind the Sea Turtle campaign have been busy [revamping their attacks][9] with new infrastructure and going after new victims. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][10] ]** + +In April, Talos released a [report detailing][11] Sea Turtle and calling it the “first known case of a domain name registry organization that was compromised for cyber espionage operations.” Talos says the ongoing DNS threat campaign is a state-sponsored attack that abuses DNS to harvest credentials to gain access to sensitive networks and systems in a way that victims are unable to detect, which displays unique knowledge on how to manipulate DNS. + +By obtaining control of victims’ DNS, the attackers can change or falsify any data on the Internet and illicitly modify DNS name records to point users to actor-controlled servers; users visiting those sites would never know, Talos reports.  + +The hackers behind Sea Turtle appear to have regrouped after the April report from Talos and are redoubling their efforts with new infrastructure – a move Talos researchers find to be unusual: “While many actors will slow down once they are discovered, this group appears to be unusually brazen, and will be unlikely to be deterred going forward,” Talos [wrote][9] in July. + +“Additionally, we discovered a new DNS hijacking technique that we assess with moderate confidence is connected to the actors behind Sea Turtle. This new technique is similar in that the threat actors compromise the name server records and respond to DNS requests with falsified A records,” Talos stated.  + +“This new technique has only been observed in a few highly targeted operations. We also identified a new wave of victims, including a country code top-level domain (ccTLD) registry, which manages the DNS records for every domain [that] uses that particular country code; that access was used to then compromise additional government entities. Unfortunately, unless there are significant changes made to better secure DNS, these sorts of attacks are going to remain prevalent,” Talos wrote. + +### DNSpionage attack upgrades its tools + +Another newer threat to DNS comes in the form of an attack campaign called [DNSpionage][12].  + +DNSpionage initially used two malicious websites containing job postings to compromise targets via crafted Microsoft Office documents with embedded macros. The malware supported HTTP and DNS communication with the attackers. And the attackers are continuing to develop new assault techniques. + +“The threat actor's ongoing development of DNSpionage malware shows that the attacker continues to find new ways to avoid detection. DNS tunneling is a popular method of exfiltration for some actors, and recent examples of DNSpionage show that we must ensure DNS is monitored as closely as an organization's normal proxy or weblogs,” [Talos wrote][13]. “DNS is essentially the phonebook of the internet, and when it is tampered with, it becomes difficult for anyone to discern whether what they are seeing online is legitimate.” + +The DNSpionage campaign targeted various businesses in the Middle East as well as United Arab Emirates government domains. + +“One of the biggest problems with DNS attacks or the lack of protection from them is complacency,” said Craig Williams, director of Talos outreach. Companies think DNS is stable and that they don’t need to worry about it. “But what we are seeing with attacks like DNSpionage and Sea Turtle are kind of the opposite, because attackers have figured out how to use it to their advantage – how to use it to do damage to credentials in a way, in the case of Sea Turtle, that the victim never even knows it happened. And that’s a real potential problem.” + +If you know, for example, your name server has been compromised, then you can force everyone to change their passwords. But if instead they go after the registrar and the registrar points to the bad guy’s name, you never knew it happened because nothing of yours was touched – that’s why these new threats are so nefarious, Williams said. + +“Once attackers start using it publicly, successfully, other bad guys are going to look at it and say, ‘Hey, why don't I use that to harvest a bunch of credentials from the sites I am interested in,’” Williams said. + +### **The DNS IoT risk** + +Another developing risk would be the proliferation of IoT devices.  The Internet Corporation for Assigned Names and Numbers (ICANN) recently wrote a [paper on the risk that IoT brings to DNS][14].  + +“The IoT is a risk to the DNS because various measurement studies suggest that IoT devices could stress the DNS infrastructure in ways that we have not seen before,” ICANN stated.   “For example, a software update for a popular IP-enabled IoT device that causes the device to use the DNS more frequently (e.g., regularly lookup random domain names to check for network availability) could stress the DNS in individual networks when millions of devices automatically install the update at the same time.” + +While this is a programming error from the perspective of individual devices, it could result in a significant attack vector from the perspective of DNS infrastructure operators. Incidents like this have already occurred on a small scale, but they may occur more frequently in the future due to the growth of heterogeneous IoT devices from manufacturers that equip their IoT devices with controllers that use the DNS, ICANN stated. + +ICANN also suggested that IoT botnets will represent an increased threat to DNS operators. “Larger DDoS attacks, partly because IoT bots are more difficult to eradicate. Current botnet sizes are on the order of hundreds of thousands. The most well-known example is the Mirai botnet, which involved 400K (steady-state) to 600K (peak) infected IoT devices.  The Hajime botnet hovers around 400K infected IoT devices, but has not launched any DDoS attacks yet. With the growth of the IoT, these attacks may grow to involve millions of bots and as a result larger DDoS attacks. + +### **DNS security warnings grow** + +The UK's [National Cyber Security Centre (NCSC)][15] issued a warning this month about ongoing DNS attacks, particularly focusing on DNS hijacking. It cited a number of risks associated with the uptick in DNS hijacking including: + +**Creating malicious DNS records.** A malicious DNS record could be used, for example, to create a phishing website that is present within an organization’s familiar domain. This may be used to phish employees or customers. + +**Obtaining SSL certificates.** Domain-validated SSL certificates are issued based on the creation of DNS records; thus an attacker may obtain valid SSL certificates for a domain name, which could be used to create a phishing website intended to look like an authentic website, for example. + +**Transparent proxying.** One serious risk employed recently involves transparently proxying traffic to intercept data. The attacker modifies an organization’s configured domain zone entries (such as “A” or “CNAME” records) to point traffic to their own IP address, which is infrastructure they manage. + +“An organization may lose total control of their domain and often the attackers will change the domain ownership details making it harder to recover,” the NCSC wrote. + +These new threats, as well as other dangers, led the U.S. government to issue a warning earlier this year about DNS attacks on federal agencies.  + +The Department of Homeland Security’s Cybersecurity and Infrastructure Security Agency (CISA) told all federal agencies to bolt down their DNS in the face of a series of global hacking campaigns. + +CISA said in its [Emergency Directive][16] that it was tracking a series of incidents targeting DNS infrastructure. CISA wrote that it “is aware of multiple executive branch agency domains that were impacted by the tampering campaign and has notified the agencies that maintain them.” + +CISA says that attackers have managed to intercept and redirect web and mail traffic and could target other networked services. The agency said the attacks start with compromising user credentials of an account that can make changes to DNS records.  Then the attacker alters DNS records, like Address, Mail Exchanger, or Name Server records, replacing the legitimate address of the services with an address the attacker controls. + +These actions let the attacker direct user traffic to their own infrastructure for manipulation or inspection before passing it on to the legitimate service, should they choose. This creates a risk that persists beyond the period of traffic redirection, CISA stated.  + +“Because the attacker can set DNS record values, they can also obtain valid encryption certificates for an organization’s domain names. This allows the redirected traffic to be decrypted, exposing any user-submitted data. Since the certificate is valid for the domain, end users receive no error warnings,” CISA stated. + +### **Get on the DNSSEC bandwagon** + +“Enterprises that are potential targets – in particular those that capture or expose user and enterprise data through their applications – should heed this advisory by the NSCS and should pressure their DNS and registrar vendors to make DNSSEC and other domain security best practices easy to implement and standardized,” said Kris Beevers, co-founder and CEO of DNS security vendor [NS1][17]. “They can easily implement DNSSEC signing and other domain security best practices with technologies in the market today. At the very least, they should work with their vendors and security teams to audit their implementations.” + +DNSSEC was in the news earlier this year when in response to increased DNS attacks, ICANN called for an intensified community effort to install stronger DNS security technology.  + +Specifically, ICANN wants full deployment of the Domain Name System Security Extensions ([DNSSEC][18]) across all unsecured domain names. DNSSEC adds a layer of security on top of DNS. Full deployment of DNSSEC ensures end users are connecting to the actual web site or other service corresponding to a particular domain name, ICANN said. “Although this will not solve all the security problems of the Internet, it does protect a critical piece of it – the directory lookup – complementing other technologies such as SSL (https:) that protect the ‘conversation’, and provide a platform for yet-to-be-developed security improvements,” ICANN stated. + +DNSSEC technologies have been around since about 2010 but are not widely deployed, with less than 20% of the world’s DNS registrars having deployed it, according to the regional internet address registry for the Asia-Pacific region ([APNIC][19]). + +DNSSEC adoption has been lagging because it was viewed as optional and can require a tradeoff between security and functionality, said NS1's Beevers. + +### **Traditional DNS threats** + +While DNS hijacking may be the front line attack method, other more traditional threats still exist.  + +The IDC/EfficientIP study found most popular DNS threats have changed compared with last year. Phishing (47%) is now more popular than last year’s favorite, DNS-based malware (39%), followed by DDoS attacks (30%), false positive triggering (26%), and lock-up domain attacks (26%). + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3409719/worst-dns-attacks-and-how-to-mitigate-them.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://images.idgesg.net/images/article/2018/08/anonymous_faceless_hooded_mand_in_scary_halloween_mask_finger_to_lips_danger_threat_stealth_attack_hacker_hush_silence_warning_by_max_bender_cc0_via_unsplash_1200x800-100766358-large.jpg +[2]: https://www.fireeye.com/blog/threat-research/2019/01/global-dns-hijacking-campaign-dns-record-manipulation-at-scale.html +[3]: https://www.networkworld.com/article/3273891/hybrid-cloud/dns-in-the-cloud-why-and-why-not.html +[4]: https://www.networkworld.com/article/3322023/internet/dns-over-https-seeks-to-make-internet-use-more-private.html +[5]: https://www.networkworld.com/article/3298160/internet/how-to-protect-your-infrastructure-from-dns-cache-poisoning.html +[6]: https://www.networkworld.com/article/3331606/security/icann-housecleaning-revokes-old-dns-security-key.html +[7]: https://www.efficientip.com/resources/idc-dns-threat-report-2019/ +[8]: https://www.talosintelligence.com/ +[9]: https://blog.talosintelligence.com/2019/07/sea-turtle-keeps-on-swimming.html +[10]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[11]: https://blog.talosintelligence.com/2019/04/seaturtle.html +[12]: https://www.networkworld.com/article/3390666/cisco-dnspionage-attack-adds-new-tools-morphs-tactics.html +[13]: https://blog.talosintelligence.com/2019/04/dnspionage-brings-out-karkoff.html +[14]: https://www.icann.org/en/system/files/files/sac-105-en.pdf +[15]: https://www.ncsc.gov.uk/news/ongoing-dns-hijacking-and-mitigation-advice +[16]: https://cyber.dhs.gov/ed/19-01/ +[17]: https://ns1.com/ +[18]: https://www.icann.org/resources/pages/dnssec-qaa-2014-01-29-en +[19]: https://www.apnic.net/ diff --git a/sources/talk/20190724 Data centers may soon recycle heat into electricity.md b/sources/talk/20190724 Data centers may soon recycle heat into electricity.md new file mode 100644 index 0000000000..92298e1a01 --- /dev/null +++ b/sources/talk/20190724 Data centers may soon recycle heat into electricity.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data centers may soon recycle heat into electricity) +[#]: via: (https://www.networkworld.com/article/3410578/data-centers-may-soon-recycle-heat-into-electricity.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Data centers may soon recycle heat into electricity +====== +Rice University researchers are developing a system that converts waste heat into light and then that light into electricity, which could help data centers reduce computing costs. +![Gordon Mah Ung / IDG][1] + +Waste heat is the scurge of computing. In fact, much of the cost of powering a computer is from creating unwanted heat. That’s because the inefficiencies in electronic circuits, caused by resistance in the materials, generates that heat. The processors, without computing anything, are essentially converting expensively produced electrical energy into waste energy. + +It’s a fundamental problem, and one that hasn’t been going away. But what if you could convert the unwanted heat back into electricity—recycle the heat back into its original energy form? The data center heat, instead of simply disgorging into the atmosphere to be gotten rid of with dubious eco-effects, could actually run more machines. Plus, your cooling costs would be taken care of—there’s nothing to cool because you’ve already grabbed the hot air. + +**[ Read also: [How server disaggregation can boost data center efficiency][2] | Get regularly scheduled insights: [Sign up for Network World newsletters][3] ]** + +Scientists at Rice Univeristy are trying to make that a reality by developing heat scavenging and conversion solutions. + +Currently, the most efficient way to convert heat into electricity is through the use of traditional turbines. + +Turbines “can give you nearly 50% conversion efficiency,” says Chloe Doiron, a graduate student at Rice University and co-lead on the project, in a [news article][4] on the school’s website. Turbines convert the kinetic energy of moving fluids, like steam or combustion gases, into mechanical energy. The moving steam then shifts blades mounted on a shaft, which turns a generator, thus creating the power. + +Not a bad solution. The problem, though, is “those systems are not easy to implement,” the researchers explain. The issue is that turbines are full of moving parts, and they’re big, noisy, and messy. + +### Thermal emitter better than turbines for converting heat to energy + +A better option would be a solid-state, thermal device that could absorb heat at the source and simply convert it, perhaps straight into attached batteries. + +The researchers say a thermal emitter could absorb heat, jam it into tight, easy-to-capture bandwidth and then emit it as light. Cunningly, they would then simply turn the light into electricity, as we see all the time now in solar systems. + +“Thermal photons are just photons emitted from a hot body,” says Rice University professor Junichiro Kono in the article. “If you look at something hot with an infrared camera, you see it glow. The camera is capturing these thermally excited photons.” Indeed, all heated surfaces, to some extent, send out light as thermal radiation. + +The Rice team wants to use a film of aligned carbon nanotubes to do the job. The test system will be structured as an actual solar panel. That’s because solar panels, too, lose energy through heat, so are a good environment in which to work. The concept applies to other inefficient technologies, too. “Anything else that loses energy through heat [would become] far more efficient,” the researchers say. + +Around 20% of industrial energy consumption is unwanted heat, Doiron says. That's a lot of wasted energy. + +### Other heat conversion solutions + +Other heat scavenging devices are making inroads, too. Now-commercially available thermoelectric technology can convert a temperature difference into power, also with no moving parts. They function by exposing a specially made material to heat. [Electrons flow when one part is cold and one is hot][5]. And the University of Utah is working on [silicon for chips that generates electricity][6] as one of two wafers heat up. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3410578/data-centers-may-soon-recycle-heat-into-electricity.html + +作者:[Patrick Nelson][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/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/07/flir_20190711t191326-100801627-large.jpg +[2]: https://www.networkworld.com/article/3266624/how-server-disaggregation-could-make-cloud-datacenters-more-efficient.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://news.rice.edu/2019/07/12/rice-device-channels-heat-into-light/ +[5]: https://www.networkworld.com/article/2861438/how-to-convert-waste-data-center-heat-into-electricity.html +[6]: https://unews.utah.edu/beat-the-heat/ +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190724 Reports- As the IoT grows, so do its threats to DNS.md b/sources/talk/20190724 Reports- As the IoT grows, so do its threats to DNS.md new file mode 100644 index 0000000000..d9647304b9 --- /dev/null +++ b/sources/talk/20190724 Reports- As the IoT grows, so do its threats to DNS.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reports: As the IoT grows, so do its threats to DNS) +[#]: via: (https://www.networkworld.com/article/3411437/reports-as-the-iot-grows-so-do-its-threats-to-dns.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Reports: As the IoT grows, so do its threats to DNS +====== +ICANN and IBM's security researchers separately spell out how the growth of the internet of things will increase opportunities for malicious actors to attack the Domain Name System with hyperscale botnets and worm their malware into the cloud. +The internet of things is shaping up to be a more significant threat to the Domain Name System through larger IoT botnets, unintentional adverse effects of IoT-software updates and the continuing development of bot-herding software. + +The Internet Corporation for Assigned Names and Numbers (ICANN) and IBM’s X-Force security researchers have recently issued reports outlining the interplay between DNS and IoT that includes warnings about the pressure IoT botnets will put on the availability of DNS systems. + +**More about DNS:** + + * [DNS in the cloud: Why and why not][1] + * [DNS over HTTPS seeks to make internet use more private][2] + * [How to protect your infrastructure from DNS cache poisoning][3] + * [ICANN housecleaning revokes old DNS security key][4] + + + +ICANN’s Security and Stability Advisory Committee (SSAC) wrote in a [report][5] that “a significant number of IoT devices will likely be IP enabled and will use the DNS to locate the remote services they require to perform their functions. As a result, the DNS will continue to play the same crucial role for the IoT that it has for traditional applications that enable human users to interact with services and content,” ICANN stated. “The  role of  the  DNS  might  become  even  more  crucial  from  a  security  and  stability perspective with IoT devices interacting with people’s physical environment.” + +IoT represents both an opportunity and a risk to the DNS, ICANN stated. “It is an opportunity because the DNS provides functions and data that can help make the IoT more secure, stable, and transparent, which is critical given the IoT's interaction with the physical world. It is a risk because various measurement studies suggest that IoT devices may stress the DNS, for instance, because of complex DDoS attacks carried out by botnets that grow to hundreds of thousands or in the future millions of infected IoT devices within hours,” ICANN stated. + +Unintentional DDoS attacks + +One risk is that the IoT could place new burdens on the DNS. “For example, a software update for a popular IP-enabled IoT device that causes the device to use the DNS more frequently (e.g., regularly lookup random domain names to check for network availability) could stress the DNS in individual networks when millions of devices automatically install the update at the same time,” ICANN stated. + +While this is a programming error from the perspective of individual devices, it could result in a significant attack vector from the perspective of DNS infrastructure operators. Incidents like this have already occurred on a small scale, but they may occur more frequently in the future due to the growth of heterogeneous IoT devices from manufacturers that equip their IoT devices with controllers that use the DNS, ICANN stated. + +Massively larger botnets, threat to clouds + +The report also suggested that the scale of IoT botnets could grow from hundreds of thousands of devices to millions. The best known IoT botnet is Mirai, responsible for DDoS attacks involving 400,000 to 600,000 devices. The Hajime botnet hovers around 400K infected IoT devices but has not launched any DDoS attacks yet. But as the IoT grows, so will the botnets and as a result larger DDoS attacks. + +Cloud-connected IoT devices could endanger cloud resources. “IoT devices connected to cloud architecture could allow Mirai adversaries to gain access to cloud servers. They could infect a server with additional malware dropped by Mirai or expose all IoT devices connected to the server to further compromise,” wrote Charles DeBeck,  a senior cyber threat intelligence strategic analyst with [IBM X-Force Incident Response][6] in a recent report.  + + “As organizations increasingly adopt cloud architecture to scale efficiency and productivity, disruption to a cloud environment could be catastrophic.” + +For enterprises that are rapidly adopting both IoT technology and cloud architecture, insufficient security controls could expose the organization to elevated risk, calling for the security committee to conduct an up-to-date risk assessment, DeBeck stated. + +Attackers continue malware development + +“Since this activity is highly automated, there remains a strong possibility of large-scale infection of IoT devices in the future,” DeBeck stated. “Additionally, threat actors are continuing to expand their targets to include new types of IoT devices and may start looking at industrial IoT devices or connected wearables to increase their footprint and profits.” + +Botnet bad guys are also developing new Mirai variants and IoT botnet malware outside of the Mirai family to target IoT devices, DeBeck stated. + +To continue reading this article register now + +[Get Free Access][7] + +[Learn More][8]   Existing Users [Sign In][7] + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3411437/reports-as-the-iot-grows-so-do-its-threats-to-dns.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://www.networkworld.com/article/3273891/hybrid-cloud/dns-in-the-cloud-why-and-why-not.html +[2]: https://www.networkworld.com/article/3322023/internet/dns-over-https-seeks-to-make-internet-use-more-private.html +[3]: https://www.networkworld.com/article/3298160/internet/how-to-protect-your-infrastructure-from-dns-cache-poisoning.html +[4]: https://www.networkworld.com/article/3331606/security/icann-housecleaning-revokes-old-dns-security-key.html +[5]: https://www.icann.org/en/system/files/files/sac-105-en.pdf +[6]: https://securityintelligence.com/posts/i-cant-believe-mirais-tracking-the-infamous-iot-malware-2/?cm_mmc=OSocial_Twitter-_-Security_Security+Brand+and+Outcomes-_-WW_WW-_-SI+TW+blog&cm_mmca1=000034XK&cm_mmca2=10009814&linkId=70790642 +[7]: javascript:// +[8]: https://www.networkworld.com/learn-about-insider/ diff --git a/sources/talk/20190724 When it comes to the IoT, Wi-Fi has the best security.md b/sources/talk/20190724 When it comes to the IoT, Wi-Fi has the best security.md new file mode 100644 index 0000000000..2b5014dfa8 --- /dev/null +++ b/sources/talk/20190724 When it comes to the IoT, Wi-Fi has the best security.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (When it comes to the IoT, Wi-Fi has the best security) +[#]: via: (https://www.networkworld.com/article/3410563/when-it-comes-to-the-iot-wi-fi-has-the-best-security.html) +[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) + +When it comes to the IoT, Wi-Fi has the best security +====== +It’s easy to dismiss good ol’ Wi-Fi’s role in internet of things networking. But Wi-Fi has more security advantages than other IoT networking choices. +![Ralph Gaithe / Soifer / Getty Images][1] + +When it comes to connecting internet of things (IoT) devices, there is a wide variety of networks to choose from, each with its own set of capabilities, advantages and disadvantages, and ideal use cases. Good ol’ Wi-Fi is often seen as a default networking choice, available in many places, but of limited range and not particularly suited for IoT implementations. + +According to [Aerohive Networks][2], however, Wi-Fi is “evolving to help IT address security complexities and challenges associated with IoT devices.” Aerohive sells cloud-managed networking solutions and was [acquired recently by software-defined networking company Extreme Networks for some $272 million][3]. And Aerohive's director of product marketing, Mathew Edwards, told me via email that Wi-Fi brings a number of security advantages compared to other IoT networking choices. + +It’s not a trivial problem. According to Gartner, in just the last three years, [approximately one in five organizations have been subject to an IoT-based attack][4]. And as more and more IoT devices come on line, the attack surface continues to grow quickly. + +**[ Also read: [Extreme targets cloud services, SD-WAN, Wi-Fi 6 with $210M Aerohive grab][3] and [Smart cities offer window into the evolution of enterprise IoT technology][5] ]** + +### What makes Wi-Fi more secure for IoT? + +What exactly are Wi-Fi’s IoT security benefits? Some of it is simply 20 years of technological maturity, Edwards said. + +“Extending beyond the physical boundaries of organizations, Wi-Fi has always had to be on the front foot when it comes to securely onboarding and monitoring a range of corporate, guest, and BYOD devices, and is now prepared with the next round of connectivity complexities with IoT,” he said. + +Specifically, Edwards said, “Wi-Fi has evolved … to increase the visibility, security, and troubleshooting of edge devices by combining edge security with centralized cloud intelligence.” + +Just as important, though, new Wi-Fi capabilities from a variety of vendors are designed to help identify and isolate IoT devices to integrate them into the wider network while limiting the potential risks. The goal is to incorporate IoT device awareness and protection mechanisms to prevent breaches and attacks through vulnerable headless devices. Edwards cited Aerohive’s work to “securely onboard IoT devices with its PPSK (private pre-shared key) technology, an authentication and encryption method providing 802.1X-equivalent role-based access, without the equivalent management complexities.” + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][6] ]** + +### The IoT is already here—and so is Wi-Fi + +Unfortunately, enterprise IoT security is not always a carefully planned and monitored operation. + +“Much like BYOD,” Edwards said, “many organizations are dealing with IoT without them even knowing it.” On the plus side, even as “IoT devices have infiltrated many networks , ... administrators are already leveraging some of the tools to protect against IoT threats without them even realizing it.” + +He noted that customers who have already deployed PPSK to secure guest and BYOD networks can easily extend those capabilities to cover IoT devices such as “smart TVs, projectors, printers, security systems, sensors and more.” + +In addition, Edwards said, “vendors have introduced methods to assign performance and security limits through context-based profiling, which is easily extended to IoT devices once the vendor can utilize signatures to identify an IoT device.” + +Once an IoT device is identified and tagged, Wi-Fi networks can assign it to a particular VLAN, set minimum and maximum data rates, data limits, application access, firewall rules, and other protections. That way, Edwards said, “if the device is lost, stolen, or launches a DDoS attack, the Wi-Fi network can kick it off, restrict it, or quarantine it.” + +### Wi-Fi still isn’t for every IoT deployment + +All that hardly turns Wi-Fi into the perfect IoT network. Relatively high costs and limited range mean it won’t find a place in many large-scale IoT implementations. But Edwards says Wi-Fi’s mature identification and control systems can help enterprises incorporate new IoT-based systems and sensors into their networks with more confidence. + +**More about 802.11ax (Wi-Fi 6)** + + * [Why 802.11ax is the next big thing in wireless][7] + * [FAQ: 802.11ax Wi-Fi][8] + * [Wi-Fi 6 (802.11ax) is coming to a router near you][9] + * [Wi-Fi 6 with OFDMA opens a world of new wireless possibilities][10] + * [802.11ax preview: Access points and routers that support Wi-Fi 6 are on tap][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/3410563/when-it-comes-to-the-iot-wi-fi-has-the-best-security.html + +作者:[Fredric Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Fredric-Paul/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/03/hack-your-own-wi-fi_neon-wi-fi_keyboard_hacker-100791531-large.jpg +[2]: http://www.aerohive.com/ +[3]: https://www.networkworld.com/article/3405440/extreme-targets-cloud-services-sd-wan-wifi-6-with-210m-aerohive-grab.html +[4]: https://www.gartner.com/en/newsroom/press-releases/2018-03-21-gartner-says-worldwide-iot-security-spending-will-reach-1-point-5-billion-in-2018. +[5]: https://www.networkworld.com/article/3409787/smart-cities-offer-window-into-the-evolution-of-enterprise-iot-technology.html +[6]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[7]: https://www.networkworld.com/article/3215907/mobile-wireless/why-80211ax-is-the-next-big-thing-in-wi-fi.html +[8]: https://%20https//www.networkworld.com/article/3048196/mobile-wireless/faq-802-11ax-wi-fi.html +[9]: https://www.networkworld.com/article/3311921/mobile-wireless/wi-fi-6-is-coming-to-a-router-near-you.html +[10]: https://www.networkworld.com/article/3332018/wi-fi/wi-fi-6-with-ofdma-opens-a-world-of-new-wireless-possibilities.html +[11]: https://www.networkworld.com/article/3309439/mobile-wireless/80211ax-preview-access-points-and-routers-that-support-the-wi-fi-6-protocol-on-tap.html +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190725 IoT-s role in expanding drone use.md b/sources/talk/20190725 IoT-s role in expanding drone use.md new file mode 100644 index 0000000000..a9281dcf40 --- /dev/null +++ b/sources/talk/20190725 IoT-s role in expanding drone use.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IoT’s role in expanding drone use) +[#]: via: (https://www.networkworld.com/article/3410564/iots-role-in-expanding-drone-use.html) +[#]: author: (Fredric Paul https://www.networkworld.com/author/Fredric-Paul/) + +IoT’s role in expanding drone use +====== +Collision avoidance technology that uses internet of things (IoT) connectivity, AI, machine learning, and computer vision could be the key to expanding drone applications. +![Thinkstock][1] + +As faithful readers of [TechWatch][2] (love you, Mom) may know, the rollout of many companies’ ambitious drone delivery services has not gone as quickly as promised. Despite recent signs of progress in Australia and the United States—not to mention [clever ideas for burger deliveries to cars stuck in traffic][3]—drone delivery remains a long way from becoming a viable option in the vast majority of use cases. And the problem affects many areas of drone usage, not just the heavily hyped drone delivery applications. + +According to [Grace McKenzie][4], director of operations and controller at [Iris Automation][5], one key restriction to economically viable drone deliveries is that the “skies are not safe enough for many drone use cases.” + +Speaking at a recent [SF New Tech “Internet of Everything” event in San Francisco][6], McKenzie said fear of collisions with manned aircraft is the big reason why the Federal Aviation Association (FAA) and international regulators typically prohibit drones from flying beyond the line of the sight of the remote pilot. Obviously, she added, that restriction greatly constrains where and how drones can make deliveries and is working to keep the market from growing test and pilot programs into full-scale commercial adoption. + +**[ Read also: [No, drone delivery still isn’t ready for prime time][7] | Get regularly scheduled insights: [Sign up for Network World newsletters][8] ]** + +### Detect and avoid technology is critical + +Iris Automation, not surprisingly, is in the business of creating workable collision avoidance systems for drones in an attempt to solve this issue. Variously called “detect and avoid” or “sense and avoid” technologies, these automated solutions are required for “beyond visual line of sight” (BVLOS) drone operations. There are multiple issues in play. + +As explained on Iris’ website, “Drone pilots are skilled aviators, but even they struggle to see and avoid obstacles and aircraft when operating drones at extended range [and] no pilot on board means low situational awareness. This risk is huge, and the potential conflicts can be extremely dangerous.” + +As “a software company with a hardware problem,” McKenzie said, Iris’ systems use artificial intelligence (AI), machine learning, computer vision, and IoT connectivity to identify and focus on the “small group of pixels that could be a risk.” Working together, those technologies are creating an “exponential curve” in detect-and-avoid technology improvements, she added. The result? Drones that “see better than a human pilot,” she claimed. + +### Bigger market and new use cases for drones + +It’s hardly an academic issue. “Not being able to show adequate mitigation of operational risk means regulators are forced to limit drone uses and applications to closed environments,” the company says. + +Solving this problem would open up a wide range of industrial and commercial applications for drones. Far beyond delivering burritos, McKenzie said that with confidence in drone “sense and avoid” capabilities, drones could be used for all kinds of aerial data gathering, from inspecting hydro-electric dams, power lines, and railways to surveying crops to fighting forest fires and conducting search-and-rescue operations. + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3410564/iots-role-in-expanding-drone-use.html + +作者:[Fredric Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Fredric-Paul/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2018/01/drone_delivery_package_future-100745961-large.jpg +[2]: https://www.networkworld.com/blog/techwatch/ +[3]: https://www.networkworld.com/article/3396188/the-traffic-jam-whopper-project-may-be-the-coolestdumbest-iot-idea-ever.html +[4]: https://www.linkedin.com/in/withgracetoo/ +[5]: https://www.irisonboard.com/ +[6]: https://sfnewtech.com/event/iot/ +[7]: https://www.networkworld.com/article/3390677/drone-delivery-not-ready-for-prime-time.html +[8]: https://www.networkworld.com/newsletters/signup.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190725 Report- Smart-city IoT isn-t smart enough yet.md b/sources/talk/20190725 Report- Smart-city IoT isn-t smart enough yet.md new file mode 100644 index 0000000000..da6d4ee57a --- /dev/null +++ b/sources/talk/20190725 Report- Smart-city IoT isn-t smart enough yet.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Report: Smart-city IoT isn’t smart enough yet) +[#]: via: (https://www.networkworld.com/article/3411561/report-smart-city-iot-isnt-smart-enough-yet.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Report: Smart-city IoT isn’t smart enough yet +====== +A report from Forrester Research details vulnerabilities affecting smart-city internet of things (IoT) infrastructure and offers some methods of mitigation. +![Aleksandr Durnov / Getty Images][1] + +Security arrangements for smart-city IoT technology around the world are in an alarming state of disrepair, according to a report from Forrester Research that argues serious changes are needed in order to avoid widespread compromises. + +Much of what’s wrong has to do with a lack of understanding on the part of the people in charge of those systems and a failure to follow well-known security best practices, like centralized management, network visibility and limiting attack-surfaces. + +**More on IoT:** + + * [What is the IoT? How the internet of things works][2] + * [What is edge computing and how it’s changing the network][3] + * [Most powerful Internet of Things companies][4] + * [10 Hot IoT startups to watch][5] + * [The 6 ways to make money in IoT][6] + * [What is digital twin technology? [and why it matters]][7] + * [Blockchain, service-centric networking key to IoT success][8] + * [Getting grounded in IoT networking and security][9] + * [Building IoT-ready networks must become a priority][10] + * [What is the Industrial IoT? [And why the stakes are so high]][11] + + + +Those all pose stiff challenges, according to “Making Smart Cities Safe And Secure,” the Forrester report by Merritt Maxim and Salvatore Schiano. The attack surface for a smart city is, by default, enormous, given the volume of Internet-connected hardware involved. Some device, somewhere, is likely to be vulnerable, and with the devices geographically spread out it’s difficult to secure all types of access to them. + +Worse still, some legacy systems can be downright impossible to manage and update in a safe way. Older technology often contains no provision for live updates, and its vulnerabilities can be severe, according to the report. Physical access to some types of devices also remains a serious challenge. The report gives the example of wastewater treatment plants in remote locations in Australia, which were sabotaged by a contractor who accessed the SCADA systems directly. + +In addition to the risk of compromised control systems, the generalized insecurity of smart city IoT makes the vast amounts of data that it generates highly suspect. Improperly configured devices could collect more information than they’re supposed to, including personally identifiable information, which could violate privacy regulations. Also, the data collected is analyzed to glean useful information about such things as parking patterns, water flow and electricity use, and inaccurate or compromised information can badly undercut the value of smart city technology to a given user. + +“Security teams are just gaining maturity in the IT environment with the necessity for data inventory, classification, and flow mapping, together with thorough risk and privacy impact assessments, to drive appropriate protection,” the report says. “In OT environments, they’re even further behind.” + +Yet, despite the fact that IoT planning and implementation doubled between 2017 and 2018, according to Forrester’s data, comparatively little work has been done on the security front. The report lists 13 cyberattacks on smart-city technology between 2014 and 2019 that had serious consequences, including widespread electricity outages, ransomware infections on hospital computers and emergency-service interruptions. + +Still, there are ways forward, according to Forrester. Careful log monitoring can keep administrators abreast of what’s normal and what’s suspicious on their networks. Asset mapping and centralizing control-plane functionality should make it much more difficult for bad actors to insert malicious devices into a smart-city network or take control of less-secure items. And intelligent alerting – the kind that provides contextual information, differentiating between “this system just got rained on and has poor connectivity” and “someone is tampering with this system” – should help cities be more responsive to security threats when they arise. + +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/3411561/report-smart-city-iot-isnt-smart-enough-yet.html + +作者:[Jon Gold][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/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/02/smart_city_smart_cities_iot_internet_of_things_by_aleksandr_durnov_gettyimages-971455374_2400x1600-100788363-large.jpg +[2]: https://www.networkworld.com/article/3207535/internet-of-things/what-is-the-iot-how-the-internet-of-things-works.html +[3]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html +[4]: https://www.networkworld.com/article/2287045/internet-of-things/wireless-153629-10-most-powerful-internet-of-things-companies.html +[5]: https://www.networkworld.com/article/3270961/internet-of-things/10-hot-iot-startups-to-watch.html +[6]: https://www.networkworld.com/article/3279346/internet-of-things/the-6-ways-to-make-money-in-iot.html +[7]: https://www.networkworld.com/article/3280225/internet-of-things/what-is-digital-twin-technology-and-why-it-matters.html +[8]: https://www.networkworld.com/article/3276313/internet-of-things/blockchain-service-centric-networking-key-to-iot-success.html +[9]: https://www.networkworld.com/article/3269736/internet-of-things/getting-grounded-in-iot-networking-and-security.html +[10]: https://www.networkworld.com/article/3276304/internet-of-things/building-iot-ready-networks-must-become-a-priority.html +[11]: https://www.networkworld.com/article/3243928/internet-of-things/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190725 Storage management a weak area for most enterprises.md b/sources/talk/20190725 Storage management a weak area for most enterprises.md new file mode 100644 index 0000000000..859c1caa32 --- /dev/null +++ b/sources/talk/20190725 Storage management a weak area for most enterprises.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Storage management a weak area for most enterprises) +[#]: via: (https://www.networkworld.com/article/3411400/storage-management-a-weak-area-for-most-enterprises.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Storage management a weak area for most enterprises +====== +Survey finds companies are adopting technology for such things as AI, machine learning, edge computing and IoT, but still use legacy storage that can't handle those workloads. +![Miakievy / Getty Images][1] + +Stop me if you’ve heard this before: Companies are racing to a new technological paradigm but are using yesterday’s tech to do it. + +I know. Shocking. + +A survey of more than 300 storage professionals by storage vendor NGD Systems found only 11% of the companies they talked to would give themselves an “A” grade for their compute and storage capabilities. + +Why? The chief reason given is that while enterprises are rapidly deploying technologies for edge networks, real-time analytics, machine learning, and internet of things (IoT) projects, they are still using legacy storage solutions that are not designed for such data-intensive workloads. More than half — 54% — said their processing of edge applications is a bottleneck, and they want faster and more intelligent storage solutions. + +**[ Read also: [What is NVMe, and how is it changing enterprise storage][2] ]** + +### NVMe SSD use increases, but doesn't solve all needs + +It’s not all bad news. The study, entitled ["The State of Storage and Edge Computing"][3] and conducted by Dimensional Research, found 60% of storage professionals are using NVMe SSDs to speed up the processing of large data sets being generated at the edge. + +However, this has not solved their needs. As artificial intelligence (AI) and other data-intensive deployments increase, data needs to be moved over increasingly longer distances, which causes network bottlenecks and delays analytic results. And edge computing systems tend to have a smaller footprint than a traditional data center, so they are performance constrained. + +The solution is to process the data where it is ingested, in this case, the edge device. Separate the wheat from the chafe and only send relevant data upstream to a data center to be processed. This is called computational storage, processing data where it is stored rather than moving it around. + +According to the survey, 89% of respondents said they expect real value from computational storage. Conveniently, NGD is a vendor of computational storage systems. So, yes, this is a self-serving finding. This happens a lot. That doesn’t mean they don’t have a valid point, though. Processing the data where it lies is the point of edge computing. + +Among the survey’s findings: + + * 55% use edge computing + * 71% use edge computing for real-time analytics + * 61% said the cost of traditional storage solutions continues to plague their applications + * 57% said faster access to storage would improve their compute abilities + + + +The study also found that [NVMe][2] is being adopted very quickly but is being hampered by price. + + * 86% expect storage’s future to rely on NVMe SSDs + * 60% use NVMe SSDs in their work environments + * 63% said NVMe SSDs helped with superior storage speed + * 67% reported budget and cost as issues preventing the use of NVMe SSDs + + + +That last finding is why so many enterprises are hampered in their work. For whatever reason they are using old storage systems rather than new NVMe systems, and it hurts them. + +### GPUs won't improve workload performance + +One interesting finding: 70% of respondents said they are using GPUs to help improve workload performance, but NGD said those are no good. + +“We were not surprised to find that while more than half of respondents are actively using edge computing, more than 70% are using legacy GPUs, which will not reduce the network bandwidth, power and footprint necessary to analyze mass data-sets in real time,” said Nader Salessi, CEO and founder of NGD Systems, in a statement. + +That’s because GPUs lend themselves well to repetitive tasks and parallel processing jobs, while computational storage is very much a serial processing job, with the task constantly changing. So while some processing jobs will benefit from a GPU, a good number will not and the GPU is essentially wasted. + +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/3411400/storage-management-a-weak-area-for-most-enterprises.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://images.idgesg.net/images/article/2019/02/edge_computing_by_miakievy_gettyimages-957694592_2400x1600-100788315-large.jpg +[2]: https://www.networkworld.com/article/3280991/what-is-nvme-and-how-is-it-changing-enterprise-storage.html +[3]: https://ngd.dnastaging.net/brief/NGD_Systems_Storage_Edge_Computing_Survey_Report +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190726 NVMe over Fabrics enterprise storage spec enters final review process.md b/sources/talk/20190726 NVMe over Fabrics enterprise storage spec enters final review process.md new file mode 100644 index 0000000000..f14dcd7d67 --- /dev/null +++ b/sources/talk/20190726 NVMe over Fabrics enterprise storage spec enters final review process.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NVMe over Fabrics enterprise storage spec enters final review process) +[#]: via: (https://www.networkworld.com/article/3411958/nvme-over-fabrics-enterprise-storage-spec-enters-final-review-process.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +NVMe over Fabrics enterprise storage spec enters final review process +====== +The NVMe over Fabric (NVMe-oF) architecture is closer to becoming a formal specification. It's expected improve storage network fabric communications and network performance. +![Gremlin / Getty Images][1] + +NVM Express Inc., the developer of the [NVMe][2] spec for enterprise SSDs, announced that its NVMe-oF architecture has entered a final 45-day review, an important step toward release of a formal specification for enterprise SSD makers. + +NVMe-oF stands for [NVMe over Fabrics][3], a mechanism to transfer data between a host computer and a target SSD or system over a network, such as Ethernet, Fibre Channel (FC), or InfiniBand. NVM Express first released the 1.0 spec of NVMe-oF in 2016, so this is long overdue. + +**[ Read also: [NVMe over Fabrics creates data-center storage disruption][3] ]** + +NVMe has become an important advance in enterprise storage because it allows for intra-network data sharing. Before, when PCI Express-based SSDs first started being used in servers, they could not easily share data with another physical server. The SSD was basically for the machine it was in, and moving data around was difficult. + +With NVMe over Fabrics, it’s possible for one machine to directly reach out to another for data and have it transmitted over a variety of high-speed fabrics rather than just Ethernet. + +### How NVMe-oF 1.1 improves storage network fabric communication + +The NVMe-oF 1.1 architecture is designed to improve storage network fabric communications in several ways: + + * Adds TCP transport supports NVMe-oF on current data center TCP/IP network infrastructure. + * Asynchronous discovery events inform hosts of addition or removal of target ports in a fabric-independent manner. + * Fabric I/O Queue Disconnect enables finer-grain I/O resource management. + * End-to-end (command to response) flow control improves concurrency. + + + +### New enterprise features for NVMe 1.4 + +The organization also announced the release of the NVMe 1.4 base specification with new “enterprise features” described as a further maturation of the protocol. The specification provides important benefits, such as improved quality of service (QoS), faster performance, improvements for high-availability deployments, and scalability optimizations for data centers. + +Among the new features: + + * Rebuild Assist simplifies data recovery and migration scenarios. + * Persistent Event Log enables robust drive history for issue triage and debug at scale. + * NVM Sets and IO Determinism allow for better performance, isolation, and QoS. + * Multipathing enhancements or Asymmetric Namespace Access (ANA) enable optimal and redundant paths to namespaces for high availability and full multi-controller scalability. + * Host Memory Buffer feature reduces latency and SSD design complexity, benefiting client SSDs. + + + +The upgraded NVMe 1.4 base specification and the pending over-fabric spec will be demonstrated at the Flash Memory Summit August 6-8, 2019 in Santa Clara, California. + +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/3411958/nvme-over-fabrics-enterprise-storage-spec-enters-final-review-process.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://images.idgesg.net/images/article/2019/02/big_data_storage_businessman_walks_through_futuristic_data_center_by_gremlin_gettyimages-1098116540_2400x1600-100788347-large.jpg +[2]: https://www.networkworld.com/article/3280991/what-is-nvme-and-how-is-it-changing-enterprise-storage.html +[3]: https://www.networkworld.com/article/3394296/nvme-over-fabrics-creates-data-center-storage-disruption.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20190729 Do you prefer a live demo to be perfect or broken.md b/sources/talk/20190729 Do you prefer a live demo to be perfect or broken.md new file mode 100644 index 0000000000..b4b76aadd6 --- /dev/null +++ b/sources/talk/20190729 Do you prefer a live demo to be perfect or broken.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Do you prefer a live demo to be perfect or broken?) +[#]: via: (https://opensource.com/article/19/7/live-demo-perfect-or-broken) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeohttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesf) + +Do you prefer a live demo to be perfect or broken? +====== +Do you learn more from flawless demos or ones the presenter de-bugs in +real-time? Let us know by answering our poll. +![video editing dashboard][1] + +At [DevFest DC][2] in June, [Sara Robinson][3], developer advocate at Google Cloud, gave the most seamless live demo I've ever witnessed. + +Sara live-coded a machine model from scratch using TensorFlow and Keras. Then she trained the model live, deployed it to Google's Cloud AI platform, and used the deployed model to make predictions. + +With the exception of perhaps one small hiccup, the whole thing went smoothly, and I learned a lot as an audience member. + +At that evening's reception, I congratulated Sara on the live demo's success and told her I've never seen a live demo go so well. It turns out that this subject was already on her mind; Sara asked this question on Twitter less than two hours before her live demo: + +> Do you prefer watching a live demo where everything works perfectly or one that breaks and the presenter has to de-bug? +> +> — Sara Robinson (@SRobTweets) [June 14, 2019][4] + +Contrary to my preference for flawless demos, two-thirds of Sara's followers prefer to watch de-bugging. The replies to her poll were equally enlightening: + +> I prefer ones that break once or twice, just so you know it's real. "Break" can be something small like a typo or skipping a step. +> +> — Seth Vargo (@sethvargo) [June 14, 2019][5] + +> Broken demos which are fixed in real time seem to get a better reaction from the audience. This was our experience with the All-Demo Super Session at NEXT SF. Audible gasps followed by applause from the audience when the broken demo was fixed in real-time 🤓 +> +> — Jamie Kinney (@jamiekinney) [June 14, 2019][6] + +This made me reconsider my preference for perfection. When I attend live demos at events, I'm looking for tools that I'm unfamiliar with. I want to learn the basics of those tools, then see real-world applications. I don't expect magic, but I do want to see how the tools intend to work so I can gain and retain some knowledge. + +I've gone to several live demos that break. In my experience, this has caught most presenters off-guard; they seemed unfamiliar with the bugs at hand and, in one case, the error derailed the rest of the presentation. In short, it was like this: + +> Hmm, at least when the live demo fails you know it's not a video 😁 +> But I don't like when the presenter start to struggle, when everything becomes silent, it becomes so awkward (especially when I'm the one presenting) +> +> — Sylvain Nouts Ⓥ (@SylvainNouts) [June 14, 2019][7] + +Reading the replies to Sara's thread made me wonder what I'm really after when attending live demos. Is "perfection" what I seek? Or is it presenters who are more skilled at de-bugging in real-time? Upon reflection, I suspect that it's the latter. + +After all, "perfect" code is a lofty (if impossible) concept. Mistakes will happen, and I don't expect them not to. But I _do_ expect conference presenters to know their tools well enough that when things go sideways during live demos, they won't get so flustered that they can't keep going. + +Overall, this reply to Sara resonates with me the most. I attend live demos as a new coder with the goal to learn, and those that veer too far off-course aren't as effective for me: + +> I don’t necessarily prefer a broken demo, but I do think they show a more realistic view. +> That said, when you are newer to coding if the error takes things too far off the rails it can make it challenging to understand the original concept. +> +> — April Bowler (@A_Bowler2) [June 14, 2019][8] + +I don't expect everyone to attend live demos with the same goals and perspective as me. That's why we want to learn what the open source community thinks. + +_Do you prefer for live demos to be perfect? Or do you gain more from watching presenters de-bug in real-time? Do you attend live demos primarily to learn or for other reasons? Let us know by taking our poll or leaving a comment below._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/live-demo-perfect-or-broken + +作者:[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/lmaffeohttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My (video editing dashboard) +[2]: https://www.devfestdc.org/ +[3]: https://twitter.com/SRobTweets +[4]: https://twitter.com/SRobTweets/status/1139619990687162368?ref_src=twsrc%5Etfw +[5]: https://twitter.com/sethvargo/status/1139620990546145281?ref_src=twsrc%5Etfw +[6]: https://twitter.com/jamiekinney/status/1139636109585989632?ref_src=twsrc%5Etfw +[7]: https://twitter.com/SylvainNouts/status/1139637154731237376?ref_src=twsrc%5Etfw +[8]: https://twitter.com/A_Bowler2/status/1139648492953976832?ref_src=twsrc%5Etfw diff --git a/sources/talk/20190729 I Used The Web For A Day On A 50 MB Budget - Smashing Magazine.md b/sources/talk/20190729 I Used The Web For A Day On A 50 MB Budget - Smashing Magazine.md new file mode 100644 index 0000000000..b0a7f4a7e0 --- /dev/null +++ b/sources/talk/20190729 I Used The Web For A Day On A 50 MB Budget - Smashing Magazine.md @@ -0,0 +1,538 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (I Used The Web For A Day On A 50 MB Budget — Smashing Magazine) +[#]: via: (https://www.smashingmagazine.com/2019/07/web-on-50mb-budget/) +[#]: author: (Chris Ashton https://www.smashingmagazine.com/author/chrisbashton) + +I Used The Web For A Day On A 50 MB Budget +====== + +Data can be prohibitively expensive, especially in developing countries. Chris Ashton puts himself in the shoes of someone on a tight data budget and offers practical tips for reducing our websites’ data footprint. + +This article is part of a series in which I attempt to use the web under various constraints, representing a given demographic of user. I hope to raise the profile of difficulties faced by real people, which are avoidable if we design and develop in a way that is sympathetic to their needs. + +Last time, I [navigated the web for a day using Internet Explorer 8][7]. This time, I browsed the web for a day on a 50 MB budget. + +### Why 50 MB? + +Many of us are lucky enough to be on mobile plans which allow several gigabytes of data transfer per month. Failing that, we are usually able to connect to home or public WiFi networks that are on fast broadband connections and have effectively unlimited data. + +But there are parts of the world where mobile data is prohibitively expensive, and where there is little or no broadband infrastructure. + +> People often buy data packages of just tens of megabytes at a time, making a gigabyte a relatively large and therefore expensive amount of data to buy. +> — Dan Howdle, consumer telecoms analyst at Cable.co.uk + +Just how expensive are we talking? + +#### The Cost Of Mobile Data + +A 2018 [study by cable.co.uk][8] found that Zimbabwe was the most expensive country in the world for mobile data, where 1 GB cost an average of $75.20, ranging from $12.50 to $138.46. The enormous range in price is due to smaller amounts of data being very expensive, getting proportionally cheaper the bigger the data plan you commit to. You can read the [study methodology][9] for more information. + +Zimbabwe is by no means a one-off. Equatorial Guinea, Saint Helena and the Falkland Islands are next in line, with 1 GB of data costing $65.83, $55.47 and $47.39 respectively. These countries generally have a combination of poor technical infrastructure and low adoption, meaning data is both costly to deliver and doesn’t have the economy of scale to drive costs down. + +Data is expensive in parts of Europe too. A gigabyte of data in Greece will set you back $32.71; in Switzerland, $20.22. For comparison, the same amount of data costs $6.66 in the UK, or $12.37 in the USA. On the other end of the scale, India is the cheapest place in the world for data, at an average cost of $0.26. Kyrgyzstan, Kazakhstan and Ukraine follow at $0.27, $0.49 and $0.51 per GB respectively. + +The speed of mobile networks, too, varies considerably between countries. Perhaps surprisingly, [users experience faster speeds over a mobile network than WiFi][10] in at least 30 countries worldwide, including Australia and France. South Korea has the [fastest mobile download speed][11], averaging 52.4 Mbps, but Iraq has the slowest, averaging 1.6 Mbps download and 0.7 Mbps upload. The USA ranks 40th in the world for mobile download speeds, at around 34 Mbps, and is [at risk of falling further behind][12] as the world moves towards 5G. + +As for mobile network connection type, 84.7% of user connections in the UK are on 4G, compared to 93% in the USA, and 97.5% in South Korea. This compares with less than 50% in Uzbekistan and less than 60% in Algeria, Ecuador, Nepal and Iraq. + +#### The Cost Of Broadband Data + +Meanwhile, a [study of the cost of broadband in 2018][13] shows that a broadband connection in Niger costs $263 ‘per megabit per month’. This metric is a little difficult to comprehend, so here’s an example: if the average cost of broadband packages in a country is $22, and the average download speed offered by the packages is 10 Mbps, then the cost ‘per megabit per month’ would be $2.20. + +It’s an interesting metric, and one that acknowledges that broadband speed is as important a factor as the data cap. A cost of $263 suggests a combination of extremely slow and extremely expensive broadband. For reference, the metric is $1.19 in the UK and $1.26 in the USA. + +What’s perhaps easier to comprehend is the average cost of a broadband package. Note that this study was looking for the cheapest broadband packages on offer, ignoring whether or not these packages had a data cap, so provides a useful ballpark figure rather than the cost of data per se. + +On package cost alone, Mauritania has the most expensive broadband in the world, at an average of $768.16 (a range of $307.26 to $1,368.72). This enormous cost includes building physical lines to the property, since few already exist in Mauritania. At 0.7 Mbps, Mauritania also has one of the slowest broadband networks in the world. + +[Taiwan has the fastest broadband in the world][14], at a mean speed of 85 Mbps. Yemen has the slowest, at 0.38 Mbps. But even countries with good established broadband infrastructure have so-called ‘not-spots’. The United Kingdom is ranked 34th out of 207 countries for broadband speed, but in July 2019 there was [still a school in the UK without broadband][15]. + +The average cost of a broadband package in the UK is $39.58, and in the USA is $67.69. The cheapest average in the world is Ukraine’s, at just $5, although the cheapest broadband deal of them all was found in Kyrgystan ($1.27 — against the country average of $108.22). + +Zimbabwe was the most costly country for mobile data, and the statistics aren’t much better for its broadband, with an average cost of $128.71 and a ‘per megabit per month’ cost of $6.89. + +#### Absolute Cost vs Cost In Real Terms + +All of the costs outlined so far are the absolute costs in USD, based on the exchange rates at the time of the study. These costs have [not been accounted for cost of living][16], meaning that for many countries the cost is actually far higher in real terms. + +I’m going to limit my browsing today to 50 MB, which in Zimbabwe would cost around $3.67 on a mobile data tariff. That may not sound like much, but teachers in Zimbabwe were striking this year because their [salaries had fallen to just $2.50 a day][17]. + +For comparison, $3.67 is around half the [$7.25 minimum wage in the USA][18]. As a Zimbabwean, I’d have to work for around a day and a half to earn the money to buy this 50MB data, compared to just half an hour in the USA. It’s not easy to compare cost of living between countries, but on wages alone the $3.67 cost of 50 MB of data in Zimbabwe would feel like $52 to an American on minimum wage. + +### Setting Up The Experiment + +I launched Chrome and opened the dev tools, where I throttled the network to a slow 3G connection. I wanted to simulate a slow connection like those experienced by users in Uzbekistan, to see what kind of experience websites would give me. I also throttled my CPU to simulate being on a lower end device. + +[![][19]][20]I opted to throttle my network to Slow 3G and my CPU to 6x slowdown. ([Large preview][20]) + +I installed [ModHeader][21] and set the [‘Save-Data’ header][22] to let websites know I want to minimise my data usage. This is also the header set by Chrome for Android’s ‘Lite mode’, which I’ll cover in more detail later. + +I downloaded [TripMode][23]; an application for Mac which gives you control over which apps on your Mac can access the internet. Any other application’s internet access is automatically blocked. + +You can enable/disable individual apps from connecting to the internet with TripMode. I enabled Chrome. ([Large preview][24]) + +How far do I predict my 50 MB budget will take me? With the [average weight of a web page being almost 1.7 MB][25], that suggests I’ve got around 29 pages in my budget, although probably a few more than that if I’m able to stay on the same sites and leverage browser caching. + +Throughout the experiment I will suggest performance tips to speed up the [first contentful paint][26] and perceived loading time of the page. Some of these tips may not affect the amount of data transferred directly, but do generally involve deferring the download of less important resources, which on slow connections may mean the resources are never downloaded and data is saved. + +### The Experiment + +Without any further ado, I loaded google.com, using 402 KB of my budget and spending $0.03 (around 1% of my Zimbabwe budget). + +[![402 KB transferred, 1.1 MB resources, 24 requests][27]][28]402 KB transferred, 1.1 MB resources, 24 requests. ([Large preview][28]) + +All in all, not a bad page size, but I wondered where those 24 network requests were coming from and whether or not the page could be made any lighter. + +#### Google Homepage — DOM + +[![][29]][30]Chrome devtools screenshot of the DOM, where I’ve expanded one inline `style` tag. ([Large preview][30]) + +Looking at the page markup, there are no external stylesheets — all of the CSS is inline. + +##### Performance Tip #1: Inline Critical CSS + +This is good for performance as it saves the browser having to make an additional network request in order to fetch an external stylesheet, so the styles can be parsed and applied immediately for the first contentful paint. There’s a trade-off to be made here, as external stylesheets can be cached but inline ones cannot (unless you [get clever with JavaScript][31]). + +The general advice is for your [critical styles][32] (anything [above-the-fold][33]) to be inline, and for the rest of your styling to be external and loaded asynchronously. Asynchronous loading of CSS can be achieved in [one remarkably clever line of HTML][34]: + +``` + +``` + +The devtools show a prettified version of the DOM. If you want to see what was actually downloaded to the browser, switch to the Sources tab and find the document. + +[![A wall of minified code.][35]][36]Switching to Sources and finding the index shows the ‘raw’ HTML that was delivered to the browser. What a mess! ([Large preview][36]) + +You can see there is a LOT of inline JavaScript here. It’s worth noting that it has been uglified rather than merely minified. + +##### Performance Tip #2: Minify And Uglify Your Assets + +Minification removes unnecessary spaces and characters, but uglification actually ‘mangles’ the code to be shorter. The tell-tale sign is that the code contains short, machine-generated variable names rather than untouched source code. This is good as it means the script is smaller and quicker to download. + +Even so, inline scripts look to be roughly 120 KB of the 210 KB page resource (about half the 60 KB gzipped size). In addition, there are five external JavaScript files amounting to 291 KB of the 402 KB downloaded: + +[![Network tab of DevTools showing the external javascript files][37]][38]Five external JavaScript files in the Network tab of the devtools. ([Large preview][38]) + +This means that JavaScript accounts for about 80 percent of the overall page weight. + +This isn’t useless JavaScript; Google has to have some in order to display suggestions as you type. But I suspect a lot of it is tracking code and advertising setup. + +For comparison, I disabled JavaScript and reloaded the page: + +[![DevTools showing only 5 network requests][39]][40]The disabled JS version of Google search was only 102 KB and had just 5 network requests. ([Large preview][40]) + +The JS-disabled version of Google search is just 102 KB, as opposed to 402 KB. Although Google can’t provide autosuggestions under these conditions, the site is still functional, and I’ve just cut my data usage down to a quarter of what it was. If I really did have to limit my data usage in the long term, one of the first things I’d do is disable JavaScript. [It’s not as bad as it sounds][41]. + +##### Performance Tip #3: Less Is More + +Inlining, uglifying and minifying assets is all well and good, but the best performance comes from not sending down the assets in the first place. + + * Before adding any new features, do you have a [performance budget][42] in place? + * Before adding JavaScript to your site, can your feature be accomplished using plain HTML? (For example, [HTML5 form validation][43]). + * Before pulling a large JavaScript or CSS library into your application, use something like [bundlephobia.com][44] to measure how big it is. Is the convenience worth the weight? Can you accomplish the same thing using vanilla code at a much smaller data size? + + + +#### Analysing The Resource Info + +There’s a lot to unpack here, so let’s get cracking. I’ve only got 50 MB to play with, so I’m going to milk every bit of this page load. Settle in for a short Chrome Devtools tutorial. + +402 KB transferred, but 1.1 MB of resources: what does that actually mean? + +It means 402 KB of content was actually downloaded, but in its compressed form (using a compression algorithm such as [gzip or brotli][45]). The browser then had to do some work to unpack it into something meaningful. The total size of the unpacked data is 1.1 MB. + +This unpacking isn’t free — [there are a few milliseconds of overhead in decompressing the resources][46]. But that’s a negligible overhead compared to sending 1.1MB down the wire. + +##### Performance Tip #4: Compress Text-based Assets + +As a general rule, always compress your assets, using something like gzip. But don’t use compression on your images and other binary files — you should optimize these in advance at source. Compression could actually end up [making them bigger][47]. + +And, if you can, [avoid compressing files that are 1500 bytes or smaller][47]. The smallest TCP packet size is 1500 bytes, so by compressing to, say, 800 bytes, you save nothing, as it’s still transmitted in the same byte packet. Again, the cost is negligible, but wastes some compression CPU time on the server and decompression CPU time on the client. + +Now back to the Network tab in Chrome: let’s dig into those priorities. Notice that resources have priority “Highest” to “Lowest” — these are the browser’s best guess as to what are the more important resources to download. The higher the priority, the sooner the browser will try to download the asset. + +##### Performance Tip #5: Give Resource Hints To The Browser + +The browser will guess at what the highest priority assets are, but you can [provide a resource hint][48] using the `` tag, instructing the browser to download the asset as soon as possible. It’s a good idea to preload fonts, logos and anything else that appears above the fold. + +Let’s talk about caching. I’m going to hold ALT and right-click to change my column headers to unlock some more juicy information. We’re going to check out Cache-Control. + +There are lots of interesting fields tucked away behind ALT. ([Large preview][49]) + +Cache-Control denotes whether or not a resource can be cached, how long it can be cached for, and what rules it should follow around [revalidating][50]. Setting proper cache values is crucial to keeping the data cost of repeat visits down. + +##### Performance Tip #6: Set cache-control Headers On All Cacheable Assets + +Note that the cache-control value begins with a directive of `public` or `private`, followed by an expiration value (e.g. `max-age=31536000`). What does the directive mean, and why the oddly specific `max-age` value? + +[![Screenshot of Google network tab with cache-control column visible][51]][52]A mixture of max-age values and public/private. ([Large preview][52]) + +The value `31536000` is the number of seconds there are in a year, and is the theoretical maximum value allowed by the cache-control specification. It is common to see this value applied to all static assets and effectively means “this resource isn’t going to change”. In practice, [no browser is going to cache for an entire year][53], but it will cache the asset for as long as makes sense. + +To explain the public/private directive, we must explain the two main caches that exist off the server. First, there is the traditional browser cache, where the resource is stored on the user’s machine (the ‘client’). And then there is the CDN cache, which sits between the client and the server; resources are cached at the CDN level to prevent the CDN from requesting the resource from the origin server over and over again. + +A `Cache-Control` directive of `public` allows the resource to be cached in both the client and the CDN. A value of `private` means only the client can cache it; the CDN is not supposed to. This latter value is typically used for pages or assets that exist behind authentication, where it is fine to be cached on the client but we wouldn’t want to leak private information by caching it in the CDN and delivering it to other users. + +[![Screenshot of Google logo cache-control setting: private, max-age=31536000][54]][55]A mixture of max-age values and public/private. ([Large preview][55]) + +One thing that got my attention was that the Google logo has a cache control of “private”. Other images on the page do have a public cache, and I don’t know why the logo would be treated any differently. If you have any ideas, let me know in the comments! + +I refreshed the page and most of the resources were served from cache, apart from the page itself, which as you’ve seen already is `private, max-age=0`, meaning it cannot be cached. This is normal for dynamic web pages where it is important that the user always gets the very latest page when they refresh. + +It was at this point I accidentally clicked on an ‘Explanation’ URL in the devtools, which took me to the [network analysis reference][56], costing me about 5 MB of my budget. Oops. + +### Google Dev Docs + +4.2 MB of this new 5 MB page was down to images; specifically SVGs. The weightiest of these was 186 KB, which isn’t particularly big — there were just so many of them, and they all downloaded at once. + +This is a loooong page. All the images downloaded on page load. ([Large preview][57]) + +That 5 MB page load was 10% of my budget for today. So far I’ve used 5.5 MB, including the no-JavaScript reload of the Google homepage, and spent $0.40. I didn’t even mean to open this page. + +What would have been a better user experience here? + +##### Performance Tip #7: Lazy-load Your Images + +Ordinarily, if I accidentally clicked on a link, I would hit the back button in my browser. I’d have received no benefit whatsoever from downloading those images — what a waste of 4.2 MB! + +Apart from video, where you generally know what you’re getting yourself into, images are by far the biggest culprit to data usage on the web. A [study of the world’s top 500 websites][58] found that images take up to 53% of the average page weight. “This means they have a big impact on page-loading times and subsequently overall performance”. + +Instead of downloading all of the images on page load, it is good practice to lazy-load the images so that only users who are engaged with the page pay the cost of downloading them. Users who choose not to scroll below the fold therefore don’t waste any unnecessary bandwidth downloading images they’ll never see. + +There’s a great [css-tricks.com guide to rolling out lazy-loading for images][59] which offers a good balance between those on good connections, those on poor connections, and those with JavaScript disabled. + +If this page had implemented lazy loading as per the guide above, each of the 38 SVGs would have been represented by a 1 KB placeholder image by default, and only loaded into view on scroll. + +##### Performance Tip #8: Use The Right Format For Your Images + +I thought that Google had missed a trick by not using [WebP][60], which is an image format that is 26% smaller in size compared to PNGs (with no loss in quality) and 25-34% smaller in size compared to JPEGs (and of a comparable quality). I thought I’d have a go at converting SVG to WebP. + +Converting to WebP did bring one of the SVGs down from 186 KB to just 65 KB, but actually, looking at the images side by side, the WebP came out grainy: + +[![Comparison of the two images][61]][62]The SVG (left) is noticeably crisper than the WebP (right). ([Large preview][62]) + +I then tried converting one of the PNGs to WebP, which is supposed to be lossless and should come out smaller. However, the WebP output was *heavier* (127 KB, from 109 KB)! + +[![Comparison of the two images][63]][64]The PNG (left) is a similar quality to the WebP (right) but is smaller at 109 KB compared to 127 KB. ([Large preview][64]) + +This surprised me. WebP isn’t necessarily the silver bullet we think it is, and even Google have neglected to use it on this page. + +So my advice would be: where possible, experiment with different image formats on a per-image basis. The format that keeps the best quality for the smallest size may not be the one you expect. + +Now back to the DOM. I came across this: + +Notice the `async` keyword on the Google analytics script? + +[![Screenshot of performance analysis output of devtools][65]][66]Google analytics has ‘low’ priority. ([Large preview][66]) + +Despite being one of the first things in the head of the document, this was given a low priority, as we’ve explicitly opted out of being a blocking request by using the `async` keyword. + +A blocking request is one that stops the rendering of the page. A ` + + + +``` + +This HTML file must be server for every URL and JavaScript will take care of rendering the correct page. + +So lets go the the `main.go` for a moment and in the `main()` function add the following route: + +``` +router.Handle("GET", "/...", http.FileServer(SPAFileSystem{http.Dir("static")})) + +type SPAFileSystem struct { + fs http.FileSystem +} + +func (spa SPAFileSystem) Open(name string) (http.File, error) { + f, err := spa.fs.Open(name) + if err != nil { + return spa.fs.Open("index.html") + } + return f, nil +} +``` + +We use a custom file system so instead of returning `404 Not Found` for unknown URLs, it serves the `index.html`. + +### Router + +In the `index.html` we loaded two files: `styles.css` and `main.js`. I leave styling to your taste. + +Lets move to `main.js`. Create a `static/main.js` file with the following content: + +``` +import { guard } from './auth.js' +import Router from './router.js' + +let currentPage +const disconnect = new CustomEvent('disconnect') +const router = new Router() + +router.handle('/', guard(view('home'), view('access'))) +router.handle('/callback', view('callback')) +router.handle(/^\/conversations\/([^\/]+)$/, guard(view('conversation'), view('access'))) +router.handle(/^\//, view('not-found')) + +router.install(async result => { + document.body.innerHTML = '' + if (currentPage instanceof Node) { + currentPage.dispatchEvent(disconnect) + } + currentPage = await result + if (currentPage instanceof Node) { + document.body.appendChild(currentPage) + } +}) + +function view(pageName) { + return (...args) => import(`/pages/${pageName}-page.js`) + .then(m => m.default(...args)) +} +``` + +If you are follower of this blog, you already know how this works. That router is the one showed [here][7]. Just download it from [@nicolasparada/router][8] and save it to `static/router.js`. + +We registered four routes. At the root `/` we show the home or access page whether the user is authenticated. At `/callback` we show the callback page. On `/conversations/{conversationID}` we show the conversation or access page whether the user is authenticated and for every other URL, we show a not found page. + +We tell the router to render the result to the document body and dispatch a `disconnect` event to each page before leaving. + +We have each page in a different file and we import them with the new dynamic `import()`. + +### Auth + +`guard()` is a function that given two functions, executes the first one if the user is authenticated, or the sencond one if not. It comes from `auth.js` so lets create a `static/auth.js` file with the following content: + +``` +export function isAuthenticated() { + const token = localStorage.getItem('token') + const expiresAtItem = localStorage.getItem('expires_at') + if (token === null || expiresAtItem === null) { + return false + } + + const expiresAt = new Date(expiresAtItem) + if (isNaN(expiresAt.valueOf()) || expiresAt <= new Date()) { + return false + } + + return true +} + +export function guard(fn1, fn2) { + return (...args) => isAuthenticated() + ? fn1(...args) + : fn2(...args) +} + +export function getAuthUser() { + if (!isAuthenticated()) { + return null + } + + const authUser = localStorage.getItem('auth_user') + if (authUser === null) { + return null + } + + try { + return JSON.parse(authUser) + } catch (_) { + return null + } +} +``` + +`isAuthenticated()` checks for `token` and `expires_at` from localStorage to tell if the user is authenticated. `getAuthUser()` gets the authenticated user from localStorage. + +When we login, we’ll save all the data to localStorage so it will make sense. + +### Access Page + +![access page screenshot][9] + +Lets start with the access page. Create a file `static/pages/access-page.js` with the following content: + +``` +const template = document.createElement('template') +template.innerHTML = ` +

Messenger

+ Access with GitHub +` + +export default function accessPage() { + return template.content +} +``` + +Because the router intercepts all the link clicks to do its navigation, we must prevent the event propagation for this link in particular. + +Clicking on that link will redirect us to the backend, then to GitHub, then to the backend and then to the frontend again; to the callback page. + +### Callback Page + +Create the file `static/pages/callback-page.js` with the following content: + +``` +import http from '../http.js' +import { navigate } from '../router.js' + +export default async function callbackPage() { + const url = new URL(location.toString()) + const token = url.searchParams.get('token') + const expiresAt = url.searchParams.get('expires_at') + + try { + if (token === null || expiresAt === null) { + throw new Error('Invalid URL') + } + + const authUser = await getAuthUser(token) + + localStorage.setItem('auth_user', JSON.stringify(authUser)) + localStorage.setItem('token', token) + localStorage.setItem('expires_at', expiresAt) + } catch (err) { + alert(err.message) + } finally { + navigate('/', true) + } +} + +function getAuthUser(token) { + return http.get('/api/auth_user', { authorization: `Bearer ${token}` }) +} +``` + +The callback page doesn’t render anything. It’s an async function that does a GET request to `/api/auth_user` using the token from the URL query string and saves all the data to localStorage. Then it redirects to `/`. + +### HTTP + +There is an HTTP module. Create a `static/http.js` file with the following content: + +``` +import { isAuthenticated } from './auth.js' + +async function handleResponse(res) { + const body = await res.clone().json().catch(() => res.text()) + + if (res.status === 401) { + localStorage.removeItem('auth_user') + localStorage.removeItem('token') + localStorage.removeItem('expires_at') + } + + if (!res.ok) { + const message = typeof body === 'object' && body !== null && 'message' in body + ? body.message + : typeof body === 'string' && body !== '' + ? body + : res.statusText + throw Object.assign(new Error(message), { + url: res.url, + statusCode: res.status, + statusText: res.statusText, + headers: res.headers, + body, + }) + } + + return body +} + +function getAuthHeader() { + return isAuthenticated() + ? { authorization: `Bearer ${localStorage.getItem('token')}` } + : {} +} + +export default { + get(url, headers) { + return fetch(url, { + headers: Object.assign(getAuthHeader(), headers), + }).then(handleResponse) + }, + + post(url, body, headers) { + const init = { + method: 'POST', + headers: getAuthHeader(), + } + if (typeof body === 'object' && body !== null) { + init.body = JSON.stringify(body) + init.headers['content-type'] = 'application/json; charset=utf-8' + } + Object.assign(init.headers, headers) + return fetch(url, init).then(handleResponse) + }, + + subscribe(url, callback) { + const urlWithToken = new URL(url, location.origin) + if (isAuthenticated()) { + urlWithToken.searchParams.set('token', localStorage.getItem('token')) + } + const eventSource = new EventSource(urlWithToken.toString()) + eventSource.onmessage = ev => { + let data + try { + data = JSON.parse(ev.data) + } catch (err) { + console.error('could not parse message data as JSON:', err) + return + } + callback(data) + } + const unsubscribe = () => { + eventSource.close() + } + return unsubscribe + }, +} +``` + +This module is a wrapper around the [fetch][10] and [EventSource][11] APIs. The most important part is that it adds the JSON web token to the requests. + +### Home Page + +![home page screenshot][12] + +So, when the user login, the home page will be shown. Create a `static/pages/home-page.js` file with the following content: + +``` +import { getAuthUser } from '../auth.js' +import { avatar } from '../shared.js' + +export default function homePage() { + const authUser = getAuthUser() + const template = document.createElement('template') + template.innerHTML = ` +
+
+ ${avatar(authUser)} + ${authUser.username} +
+ +
+ + + ` + const page = template.content + page.getElementById('logout-button').onclick = onLogoutClick + return page +} + +function onLogoutClick() { + localStorage.clear() + location.reload() +} +``` + +For this post, this is the only content we render on the home page. We show the current authenticated user and a logout button. + +When the user clicks to logout, we clear all inside localStorage and do a reload of the page. + +### Avatar + +That `avatar()` function is to show the user’s avatar. Because it’s used in more than one place, I moved it to a `shared.js` file. Create the file `static/shared.js` with the following content: + +``` +export function avatar(user) { + return user.avatarUrl === null + ? `
` + : `${user.username}'s avatar` +} +``` + +We use a small figure with the user’s initial in case the avatar URL is null. + +You can show the initial with a little of CSS using the `attr()` function. + +``` +.avatar[data-initial]::after { + content: attr(data-initial); +} +``` + +### Development Login + +![access page with login form screenshot][13] + +In the previous post we coded a login for development. Lets add a form for that in the access page. Go to `static/pages/access-page.js` and modify it a little. + +``` +import http from '../http.js' + +const template = document.createElement('template') +template.innerHTML = ` +

Messenger

+
+ + +
+ Access with GitHub +` + +export default function accessPage() { + const page = template.content.cloneNode(true) + page.getElementById('login-form').onsubmit = onLoginSubmit + return page +} + +async function onLoginSubmit(ev) { + ev.preventDefault() + + const form = ev.currentTarget + const input = form.querySelector('input') + const submitButton = form.querySelector('button') + + input.disabled = true + submitButton.disabled = true + + try { + const payload = await login(input.value) + input.value = '' + + localStorage.setItem('auth_user', JSON.stringify(payload.authUser)) + localStorage.setItem('token', payload.token) + localStorage.setItem('expires_at', payload.expiresAt) + + location.reload() + } catch (err) { + alert(err.message) + setTimeout(() => { + input.focus() + }, 0) + } finally { + input.disabled = false + submitButton.disabled = false + } +} + +function login(username) { + return http.post('/api/login', { username }) +} +``` + +I added a login form. When the user submits the form. It does a POST requets to `/api/login` with the username. Saves all the data to localStorage and reloads the page. + +Remember to remove this form once you are done with the frontend. + +* * * + +That’s all for this post. In the next one, we’ll continue with the home page to add a form to start conversations and display a list with the latest ones. + +[Souce Code][14] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[7]: https://nicolasparada.netlify.com/posts/js-router/ +[8]: https://unpkg.com/@nicolasparada/router +[9]: https://nicolasparada.netlify.com/img/go-messenger-access-page/access-page.png +[10]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API +[11]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource +[12]: https://nicolasparada.netlify.com/img/go-messenger-access-page/home-page.png +[13]: https://nicolasparada.netlify.com/img/go-messenger-access-page/access-page-v2.png +[14]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180719 Building a Messenger App- Home Page.md b/sources/tech/20180719 Building a Messenger App- Home Page.md new file mode 100644 index 0000000000..ddec2c180f --- /dev/null +++ b/sources/tech/20180719 Building a Messenger App- Home Page.md @@ -0,0 +1,255 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Home Page) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-home-page/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Home Page +====== + +This post is the 8th on a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + * [Part 5: Realtime Messages][5] + * [Part 6: Development Login][6] + * [Part 7: Access Page][7] + + + +Continuing the frontend, let’s finish the home page in this post. We’ll add a form to start conversations and a list with the latest ones. + +### Conversation Form + +![conversation form screenshot][8] + +In the `static/pages/home-page.js` file add some markup in the HTML view. + +``` +
+ +
+``` + +Add that form just below the section in which we displayed the auth user and logout button. + +``` +page.getElementById('conversation-form').onsubmit = onConversationSubmit +``` + +Now we can listen to the “submit” event to create the conversation. + +``` +import http from '../http.js' +import { navigate } from '../router.js' + +async function onConversationSubmit(ev) { + ev.preventDefault() + + const form = ev.currentTarget + const input = form.querySelector('input') + + input.disabled = true + + try { + const conversation = await createConversation(input.value) + input.value = '' + navigate('/conversations/' + conversation.id) + } catch (err) { + if (err.statusCode === 422) { + input.setCustomValidity(err.body.errors.username) + } else { + alert(err.message) + } + setTimeout(() => { + input.focus() + }, 0) + } finally { + input.disabled = false + } +} + +function createConversation(username) { + return http.post('/api/conversations', { username }) +} +``` + +On submit we do a POST request to `/api/conversations` with the username and redirect to the conversation page (for the next post). + +### Conversation List + +![conversation list screenshot][9] + +In the same file, we are going to make the `homePage()` function async to load the conversations first. + +``` +export default async function homePage() { + const conversations = await getConversations().catch(err => { + console.error(err) + return [] + }) + /*...*/ +} + +function getConversations() { + return http.get('/api/conversations') +} +``` + +Then, add a list in the markup to render conversations there. + +``` +
    +``` + +Add it just below the current markup. + +``` +const conversationsOList = page.getElementById('conversations') +for (const conversation of conversations) { + conversationsOList.appendChild(renderConversation(conversation)) +} +``` + +So we can append each conversation to the list. + +``` +import { avatar, escapeHTML } from '../shared.js' + +function renderConversation(conversation) { + const messageContent = escapeHTML(conversation.lastMessage.content) + const messageDate = new Date(conversation.lastMessage.createdAt).toLocaleString() + + const li = document.createElement('li') + li.dataset['id'] = conversation.id + if (conversation.hasUnreadMessages) { + li.classList.add('has-unread-messages') + } + li.innerHTML = ` + +
    + ${avatar(conversation.otherParticipant)} + ${conversation.otherParticipant.username} +
    +
    +

    ${messageContent}

    + +
    +
    + ` + return li +} +``` + +Each conversation item contains a link to the conversation page and displays the other participant info and a preview of the last message. Also, you can use `.hasUnreadMessages` to add a class to the item and do some styling with CSS. Maybe a bolder font or accent the color. + +Note that we’re escaping the message content. That function comes from `static/shared.js`: + +``` +export function escapeHTML(str) { + return str + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, ''') +} +``` + +That prevents displaying as HTML the message the user wrote. If the user happens to write something like: + +``` + +``` + +It would be very annoying because that script will be executed 😅 +So yeah, always remember to escape content from untrusted sources. + +### Messages Subscription + +Last but not least, I want to subscribe to the message stream here. + +``` +const unsubscribe = subscribeToMessages(onMessageArrive) +page.addEventListener('disconnect', unsubscribe) +``` + +Add that line in the `homePage()` function. + +``` +function subscribeToMessages(cb) { + return http.subscribe('/api/messages', cb) +} +``` + +The `subscribe()` function returns a function that once called it closes the underlying connection. That’s why I passed it to the “disconnect” event; so when the user leaves the page, the event stream will be closed. + +``` +async function onMessageArrive(message) { + const conversationLI = document.querySelector(`li[data-id="${message.conversationID}"]`) + if (conversationLI !== null) { + conversationLI.classList.add('has-unread-messages') + conversationLI.querySelector('a > div > p').textContent = message.content + conversationLI.querySelector('a > div > time').textContent = new Date(message.createdAt).toLocaleString() + return + } + + let conversation + try { + conversation = await getConversation(message.conversationID) + conversation.lastMessage = message + } catch (err) { + console.error(err) + return + } + + const conversationsOList = document.getElementById('conversations') + if (conversationsOList === null) { + return + } + + conversationsOList.insertAdjacentElement('afterbegin', renderConversation(conversation)) +} + +function getConversation(id) { + return http.get('/api/conversations/' + id) +} +``` + +Every time a new message arrives, we go and query for the conversation item in the DOM. If found, we add the `has-unread-messages` class to the item, and update the view. If not found, it means the message is from a new conversation created just now. We go and do a GET request to `/api/conversations/{conversationID}` to get the conversation in which the message was created and prepend it to the conversation list. + +* * * + +That covers the home page 😊 +On the next post we’ll code the conversation page. + +[Souce Code][10] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ +[8]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-form.png +[9]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-list.png +[10]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180720 Building a Messenger App- Conversation Page.md b/sources/tech/20180720 Building a Messenger App- Conversation Page.md new file mode 100644 index 0000000000..c721b48161 --- /dev/null +++ b/sources/tech/20180720 Building a Messenger App- Conversation Page.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: Conversation Page) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +Building a Messenger App: Conversation Page +====== + +This post is the 9th and last in a series: + + * [Part 1: Schema][1] + * [Part 2: OAuth][2] + * [Part 3: Conversations][3] + * [Part 4: Messages][4] + * [Part 5: Realtime Messages][5] + * [Part 6: Development Login][6] + * [Part 7: Access Page][7] + * [Part 8: Home Page][8] + + + +In this post we’ll code the conversation page. This page is the chat between the two users. At the top we’ll show info about the other participant, below, a list of the latest messages and a message form at the bottom. + +### Chat heading + +![chat heading screenshot][9] + +Let’s start by creating the file `static/pages/conversation-page.js` with the following content: + +``` +import http from '../http.js' +import { navigate } from '../router.js' +import { avatar, escapeHTML } from '../shared.js' + +export default async function conversationPage(conversationID) { + let conversation + try { + conversation = await getConversation(conversationID) + } catch (err) { + alert(err.message) + navigate('/', true) + return + } + + const template = document.createElement('template') + template.innerHTML = ` +
    + ← Back + ${avatar(conversation.otherParticipant)} + ${conversation.otherParticipant.username} +
    + + + ` + const page = template.content + return page +} + +function getConversation(id) { + return http.get('/api/conversations/' + id) +} +``` + +This page receives the conversation ID the router extracted from the URL. + +First it does a GET request to `/api/conversations/{conversationID}` to get info about the conversation. In case of error, we show it and redirect back to `/`. Then we render info about the other participant. + +### Conversation List + +![chat heading screenshot][10] + +We’ll fetch the latest messages too to display them. + +``` +let conversation, messages +try { + [conversation, messages] = await Promise.all([ + getConversation(conversationID), + getMessages(conversationID), + ]) +} +``` + +Update the `conversationPage()` function to fetch the messages too. We use `Promise.all()` to do both request at the same time. + +``` +function getMessages(conversationID) { + return http.get(`/api/conversations/${conversationID}/messages`) +} +``` + +A GET request to `/api/conversations/{conversationID}/messages` gets the latest messages of the conversation. + +``` +
      +``` + +Now, add that list to the markup. + +``` +const messagesOList = page.getElementById('messages') +for (const message of messages.reverse()) { + messagesOList.appendChild(renderMessage(message)) +} +``` + +So we can append messages to the list. We show them in reverse order. + +``` +function renderMessage(message) { + const messageContent = escapeHTML(message.content) + const messageDate = new Date(message.createdAt).toLocaleString() + + const li = document.createElement('li') + if (message.mine) { + li.classList.add('owned') + } + li.innerHTML = ` +

      ${messageContent}

      + + ` + return li +} +``` + +Each message item displays the message content itself with its timestamp. Using `.mine` we can append a different class to the item so maybe you can show the message to the right. + +### Message Form + +![chat heading screenshot][11] + +``` +
      + + +
      +``` + +Add that form to the current markup. + +``` +page.getElementById('message-form').onsubmit = messageSubmitter(conversationID) +``` + +Attach an event listener to the “submit” event. + +``` +function messageSubmitter(conversationID) { + return async ev => { + ev.preventDefault() + + const form = ev.currentTarget + const input = form.querySelector('input') + const submitButton = form.querySelector('button') + + input.disabled = true + submitButton.disabled = true + + try { + const message = await createMessage(input.value, conversationID) + input.value = '' + const messagesOList = document.getElementById('messages') + if (messagesOList === null) { + return + } + + messagesOList.appendChild(renderMessage(message)) + } catch (err) { + if (err.statusCode === 422) { + input.setCustomValidity(err.body.errors.content) + } else { + alert(err.message) + } + } finally { + input.disabled = false + submitButton.disabled = false + + setTimeout(() => { + input.focus() + }, 0) + } + } +} + +function createMessage(content, conversationID) { + return http.post(`/api/conversations/${conversationID}/messages`, { content }) +} +``` + +We make use of [partial application][12] to have the conversation ID in the “submit” event handler. It takes the message content from the input and does a POST request to `/api/conversations/{conversationID}/messages` with it. Then prepends the newly created message to the list. + +### Messages Subscription + +To make it realtime we’ll subscribe to the message stream in this page also. + +``` +page.addEventListener('disconnect', subscribeToMessages(messageArriver(conversationID))) +``` + +Add that line in the `conversationPage()` function. + +``` +function subscribeToMessages(cb) { + return http.subscribe('/api/messages', cb) +} + +function messageArriver(conversationID) { + return message => { + if (message.conversationID !== conversationID) { + return + } + + const messagesOList = document.getElementById('messages') + if (messagesOList === null) { + return + + } + messagesOList.appendChild(renderMessage(message)) + readMessages(message.conversationID) + } +} + +function readMessages(conversationID) { + return http.post(`/api/conversations/${conversationID}/read_messages`) +} +``` + +We also make use of partial application to have the conversation ID here. +When a new message arrives, first we check if it’s from this conversation. If it is, we go a prepend a message item to the list and do a POST request to `/api/conversations/{conversationID}/read_messages` to updated the last time the participant read messages. + +* * * + +That concludes this series. The messenger app is now functional. + +~~I’ll add pagination on the conversation and message list, also user searching before sharing the source code. I’ll updated once it’s ready along with a hosted demo 👨‍💻~~ + +[Souce Code][13] • [Demo][14] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/ + +作者:[Nicolás Parada][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://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ +[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ +[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ +[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ +[8]: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ +[9]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/heading.png +[10]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/list.png +[11]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/form.png +[12]: https://en.wikipedia.org/wiki/Partial_application +[13]: https://github.com/nicolasparada/go-messenger-demo +[14]: https://go-messenger-demo.herokuapp.com/ diff --git a/sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md b/sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md deleted file mode 100644 index 7f430c3d59..0000000000 --- a/sources/tech/20180725 Best Online Linux Terminals and Online Bash Editors.md +++ /dev/null @@ -1,212 +0,0 @@ -Best Online Linux Terminals and Online Bash Editors -====== -No matter whether you want to practice Linux commands or just analyze/test your shell scripts online, there’s always a couple of online Linux terminals and online bash compilers available. - -This is particularly helpful when you are using the Windows operating system. Though you can [install Linux inside Windows using Windows Subsystem for Linux][1], using online Linux terminals are often more convenient for a quick test. - -![Websites that allow to use Linux Terminal online][2] - -But where can you find free Linux console? Which online Linux shell should you use? - -Fret not, to save you the hassle, here, we have compiled a list of the best online Linux terminals and a separate list of best online bash compilers for you to look at. - -**Note:** All of the online terminals support several browsers that include Google Chrome, Mozilla Firefox, Opera and Microsoft Edge. - -### Best Online Linux Terminals To Practice Linux Commands - -In the first part, I’ll list the online Linux terminals. These websites allow you to run the regular Linux commands in a web browser so that you can practice or test them. Some websites may require you to register and login to save your sessions. - -#### 1. JSLinux - -![online linux terminal - jslinux][3] - -JSLinux is more like a complete Linux emulator instead of just offering you the terminal. As the name suggests, it has been entirely written in JavaScript. You get to choose a console-based system or a GUI-based online Linux system. However, in this case, you would want to launch the console-based system to practice Linux commands. To be able to connect your account, you need to sign up first. - -JSLinux also lets you upload files to the virtual machine. At its core, it utilizes [Buildroot][4] (a tool that helps you to build a complete Linux system for an embedded system). - -[Try JSLinux Terminal][5] - -#### 2. Copy.sh - -![copysh online linux terminal][6] - -Copy.sh offers one of the best online Linux terminals which is fast and reliable to test and run Linux commands. - -Copy.sh is also on [GitHub][7] – and it is being actively maintained, which is a good thing. It also supports other Operating Systems, which includes: - - * Windows 98 - * KolibriOS - * FreeDOS - * Windows 1.01 - * Archlinux - - - -[Try Copy.sh Terminal][8] - -#### 3. Webminal - -![webminal online linux terminal][9] - -Webminal is an impressive online Linux terminal – and my personal favorite when it comes to a recommendation for beginners to practice Linux commands online. - -The website offers several lessons to learn from while you type in the commands in the same window. So, you do not need to refer to another site for the lessons and then switch back or split the screen in order to practice commands. It’s all right there – in a single tab on the browser. - -[Try Webminal Terminal][10] - -#### 4. Tutorialspoint Unix Terminal - -![tutorialspoint linux terminal][11] - -You might be aware of Tutorialspoint – which happens to be one of the most popular websites with high quality (yet free) online tutorials for just about any programming language (and more). - -So, for obvious reasons, they provide a free online Linux console for you to practice commands while referring to their site as a resource at the same time. You also get the ability to upload files. It is quite simple but an effective online terminal. Also, it doesn’t stop there, it offers a lot of different online terminals as well in its [Coding Ground][12] page. - -[Try Unix Terminal Online][13] - -#### 5. JS/UIX - -![js uix online linux terminal][14] - -JS/UIX is yet another online Linux terminal which is written entirely in JavaScript without any plug-ins. It contains an online Linux virtual machine, virtual file-system, shell, and so on. - -You can go through its manual page for the list of commands implemented. - -[Try JS/UX Terminal][15] - -#### 6. CB.VU - -![online linux terminal][16] - -If you are in for a treat with FreeBSD 7.1 stable version, cb.vu is a quite simple solution for that. - -Nothing fancy, just try out the Linux commands you want and get the output. Unfortunately, you do not get the ability to upload files here. - -[Try CB.VU Terminal][17] - -#### 7. Linux Containers - -![online linux terminal][18] - -Linux Containers lets you run a demo server with a 30-minute countdown on which acts as one of the best online Linux terminals. In fact, it’s a project sponsored by Canonical. - -[Try Linux LXD][19] - -#### 8. Codeanywhere - -![online linux terminal][20] - -Codeanywhere is a service which offers cross-platform cloud IDEs. However, in order to run a free Linux virtual machine, you just need to sign up and choose the free plan. And, then, proceed to create a new connection while setting up a container with an OS of your choice. Finally, you will have a free Linux console at your disposal. - -[Try Codeanywhere Editor][21] - -### Best Online Bash Editors - -Wait a sec! Are the online Linux terminals not good enough for Bash scripting? They are. But creating bash scripts in terminal editors and then executing them is not as convinient as using an online Bash editor. - -These bash editors allow you to easily write shell scripts online and you can run them to check if it works or not. - -Let’s see here can you run shell scripts online. - -#### Tutorialspoint Bash Compiler - -![online bash compiler][22] - -As mentioned above, Tutorialspoint also offers an online Bash compiler. It is a very simple bash compiler to execute bash shell online. - -[Try Tutorialspoint Bash Compiler][23] - -#### JDOODLE - -![online bash compiler][24] - -Yet another useful online bash editor to test Bash scripts is JDOODLE. It also offers other IDEs, but we’ll focus on bash script execution here. You get to set the command line arguments and the stdin inputs, and would normally get the result of your code. - -[Try JDOODLE Bash Script Online Tester][25] - -#### Paizo.io - -![paizo online bash editor][26] - -Paizo.io is a good bash online editor that you can try for free. To utilize some of its advanced features like task scheduling, you need to first sign up. It also supports real-time collaboration, but that’s still in the experimental phase. - -[Try Paizo.io Bash Editor][27] - -#### ShellCheck - -![shell check bash check][28] - -An interesting Bash editor which lets you find bugs in your shell script. It is available on [GitHub][29] as well. In addition, you can install ShellCheck locally on [supported platforms][30]. - -[Try ShellCheck][31] - -#### Rextester - -![rextester bash editor][32] - -If you only want a dead simple online bash compiler, Rextester should be your choice. It also supports other programming languages. - -[Try Rextester][33] - -#### Learn Shell - -![online bash shell editor][34] - -Just like [Webminal][35], Learnshell provides you with the content (or resource) to learn shell programming and you could also run/try your code at the same time. It covers the basics and a few advanced topics as well. - -[Try Learn Shell Programming][36] - -### Wrapping Up - -Now that you know of the most reliable and fast online Linux terminals & online bash editors, learn, experiment, and play with the code! - -We might have missed any of your favorite online Linux terminals or maybe the best online bash compiler which you happen to use? Let us know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/online-linux-terminals/ - -作者:[Ankush Das][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/ -[1]:https://itsfoss.com/install-bash-on-windows/ -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/online-linux-terminals.jpeg -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/jslinux-online-linux-terminal.jpg -[4]:https://buildroot.org/ -[5]:https://bellard.org/jslinux/ -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/copy-sh-online-linux-terminal.jpg -[7]:https://github.com/copy/v86 -[8]:https://copy.sh/v86/?profile=linux26 -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/webminal.jpg -[10]:http://www.webminal.org/terminal/ -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/coding-ground-tutorialspoint-online-linux-terminal.jpg -[12]:https://www.tutorialspoint.com/codingground.htm -[13]:https://www.tutorialspoint.com/unix_terminal_online.php -[14]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/JS-UIX-online-linux-terminal.jpg -[15]:http://www.masswerk.at/jsuix/index.html -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/cb-vu-online-linux-terminal.jpg -[17]:http://cb.vu/ -[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/linux-containers-terminal.jpg -[19]:https://linuxcontainers.org/lxd/try-it/ -[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/codeanywhere-terminal.jpg -[21]:https://codeanywhere.com/editor/ -[22]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/tutorialspoint-bash-compiler.jpg -[23]:https://www.tutorialspoint.com/execute_bash_online.php -[24]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/jdoodle-online-bash-editor.jpg -[25]:https://www.jdoodle.com/test-bash-shell-script-online -[26]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/paizo-io-bash-editor.jpg -[27]:https://paiza.io/en/projects/new?language=bash -[28]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/shell-check-bash-analyzer.jpg -[29]:https://github.com/koalaman/shellcheck -[30]:https://github.com/koalaman/shellcheck#user-content-installing -[31]:https://www.shellcheck.net/# -[32]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/rextester-bash-editor.jpg -[33]:http://rextester.com/l/bash_online_compiler -[34]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/learnshell-online-bash-shell.jpg -[35]:http://www.webminal.org/ -[36]:http://www.learnshell.org/ diff --git a/sources/tech/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md b/sources/tech/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md deleted file mode 100644 index c4372724f7..0000000000 --- a/sources/tech/20180727 4 Ways to Customize Xfce and Give it a Modern Look.md +++ /dev/null @@ -1,145 +0,0 @@ -4 Ways to Customize Xfce and Give it a Modern Look -====== -**Brief: Xfce is a great lightweight desktop environment with one drawback. It looks sort of old. But you don’t have to stick with the default looks. Let’s see various ways you can customize Xfce to give it a modern and beautiful look.** - -![Customize Xfce desktop envirnment][1] - -To start with, Xfce is one of the most [popular desktop environments][2]. Being a lightweight DE, you can run Xfce on very low resource and it still works great. This is one of the reasons why many [lightweight Linux distributions][3] use Xfce by default. - -Some people prefer it even on a high-end device stating its simplicity, easy of use and non-resource hungry nature as the main reasons. - -[Xfce][4] is in itself minimal and provides just what you need. The one thing that bothers is its look and feel which feel old. However, you can easily customize Xfce to look modern and beautiful without reaching the limit where a Unity/GNOME session eats up system resources. - -### 4 ways to Customize Xfce desktop - -Let’s see some of the ways by which we can improve the look and feel of your Xfce desktop environment. - -The default Xfce desktop environment looks something like this : - -![Xfce default screen][5] - -As you can see, the default Xfce desktop is kinda boring. We will use some themes, icon packs and change the default dock to make it look fresh and a bit revealing. - -#### 1. Change themes in Xfce - -The first thing we will do is pick up a theme from [xfce-look.org][6]. My favorite Xfce theme is [XFCE-D-PRO][7]. - -You can download the theme from [here][8] and extract it somewhere. - -You can copy this extracted file to **.theme** folder in your home directory. If the folder is not present by default, you can create one and the same goes for icons which needs a **.icons** folder in the home directory. - -Open **Settings > Appearance > Style** to select the theme, log out and login to see the change. Adwaita-dark from default is also a nice one. - -![Appearance Xfce][9] - -You can use any [good GTK theme][10] on Xfce. - -#### 2. Change icons in Xfce - -Xfce-look.org also provides icon themes which you can download, extract and put it in your home directory under **.icons** directory. Once you have added the icon theme in the .icons directory, go to **Settings > Appearance > Icons** to select that icon theme. - -![Moka icon theme][11] - -I have installed [Moka icon set][12] that looks awesome. - -![Moka theme][13] - -You can also refer to our list of [awesome icon themes][14]. - -##### **Optional: Installing themes through Synaptic** - -If you want to avoid the manual search and copying of the files, install Synaptic Manager in your system. You can look for some best themes over web and icon sets, and using synaptic manager you can search and install it. -``` -sudo apt-get install synaptic - -``` - -**Searching and installing theme/icons through Synaptic** - -Open synaptic and click on **Search**. Enter your desired theme, and it will display the list of matching items. Mark all the additional required changes and click on **Apply**. This will download the theme and then install it. - -![Arc Theme][15] - -Once done, you can open the **Appearance** option to select the desired theme. - -In my opinion, this is not the best way to install themes in Xfce. - -#### 3. Change wallpapers in Xfce - -Again, the default Xfce wallpaper is not bad at all. But you can change the wallpaper to something that matches with your icons and themes. - -To change wallpapers in Xfce, right click on the desktop and click on Desktop Settings. You can change the desktop background from your custom collection or the defaults one given. - -Right click on the desktop and click on **Desktop Settings**. Choose **Background** from the folder option, and choose any one of the default backgrounds or a custom one. - -![Changing desktop wallpapers][16] - -#### 4. Change the dock in Xfce - -The default dock is nice and pretty much does what it is for. But again, it looks a bit boring. - -![Docky][17] - -However, if you want your dock to be better and with a little more customization options, you can install another dock. - -Plank is one of the simplest and lightweight docks and is highly configurable. - -To install Plank use the command below: - -`sudo apt-get install plank` - -If Plank is not available in the default repository, you can install it from this PPA. -``` -sudo add-apt-repository ppa:ricotz/docky -sudo apt-get update -sudo apt-get install plank - -``` - -Before you use Plank, you should remove the default dock by right-clicking in it and under Panel Settings, clicking on delete. - -Once done, go to **Accessory > Plank** to launch Plank dock. - -![Plank][18] - -Plank picks up icons from the one you are using. So if you change the icon themes, you’ll see the change is reflected in the dock also. - -### Wrapping Up - -XFCE is a lightweight, fast and highly customizable. If you are limited on system resource, it serves good and you can easily customize it to look better. Here’s how my screen looks after applying these steps. - -![XFCE desktop][19] - -This is just with half an hour of effort. You can make it look much better with different themes/icons customization. Feel free to share your customized XFCE desktop screen in the comments and the combination of themes and icons you are using. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/customize-xfce/ - -作者:[Ambarish Kumar][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/xfce-customization.jpeg -[2]:https://itsfoss.com/best-linux-desktop-environments/ -[3]:https://itsfoss.com/lightweight-linux-beginners/ -[4]:https://xfce.org/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/06/1-1-800x410.jpg -[6]:http://xfce-look.org -[7]:https://www.xfce-look.org/p/1207818/XFCE-D-PRO -[8]:https://www.xfce-look.org/p/1207818/startdownload?file_id=1523730502&file_name=XFCE-D-PRO-1.6.tar.xz&file_type=application/x-xz&file_size=105328&url=https%3A%2F%2Fdl.opendesktop.org%2Fapi%2Ffiles%2Fdownloadfile%2Fid%2F1523730502%2Fs%2F6019b2b57a1452471eac6403ae1522da%2Ft%2F1529360682%2Fu%2F%2FXFCE-D-PRO-1.6.tar.xz -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/4.jpg -[10]:https://itsfoss.com/best-gtk-themes/ -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/6.jpg -[12]:https://snwh.org/moka -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/11-800x547.jpg -[14]:https://itsfoss.com/best-icon-themes-ubuntu-16-04/ -[15]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/5-800x531.jpg -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/7-800x546.jpg -[17]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/8.jpg -[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/9.jpg -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/10-800x447.jpg diff --git a/sources/tech/20180802 Top 5 CAD Software Available for Linux in 2018.md b/sources/tech/20180802 Top 5 CAD Software Available for Linux in 2018.md deleted file mode 100644 index ec02690b6e..0000000000 --- a/sources/tech/20180802 Top 5 CAD Software Available for Linux in 2018.md +++ /dev/null @@ -1,143 +0,0 @@ -Top 5 CAD Software Available for Linux in 2018 -====== -[Computer Aided Design (CAD)][1] is an essential part of many streams of engineering. CAD is professionally used is architecture, auto parts design, space shuttle research, aeronautics, bridge construction, interior design, and even clothing and jewelry. - -A number of professional grade CAD software like SolidWorks and Autodesk AutoCAD are not natively supported on the Linux platform. So today we will be having a look at the top CAD software available for Linux. Let’s dive right in. - -### Best CAD Software available for Linux - -![CAD Software for Linux][2] - -Before you see the list of CAD software for Linux, you should keep one thing in mind that not all the applications listed here are open source. We included some non-FOSS CAD software to help average Linux user. - -Installation instructions of Ubuntu-based Linux distributions have been provided. You may check the respective websites to learn the installation procedure for other distributions. - -The list is not any specific order. CAD application at number one should not be considered better than the one at number three and so on. - -#### 1\. FreeCAD - -For 3D Modelling, FreeCAD is an excellent option which is both free (beer and speech) and open source. FreeCAD is built with keeping mechanical engineering and product design as target purpose. FreeCAD is multiplatform and is available on Windows, Mac OS X+ along with Linux. - -![freecad][3] - -Although FreeCAD has been the choice of many Linux users, it should be noted that FreeCAD is still on version 0.17 and therefore, is not suitable for major deployment. But the development has picked up pace recently. - -[FreeCAD][4] - -FreeCAD does not focus on direct 2D drawings and animation of organic shapes but it’s great for design related to mechanical engineering. FreeCAD version 0.15 is available in the Ubuntu repositories. You can install it by running the below command. -``` -sudo apt install freecad - -``` - -To get newer daily builds (0.17 at the moment), open a terminal (ctrl+alt+t) and run the commands below one by one. -``` -sudo add-apt-repository ppa:freecad-maintainers/freecad-daily - -sudo apt update - -sudo apt install freecad-daily - -``` - -#### 2\. LibreCAD - -LibreCAD is a free, opensource, 2D CAD solution. Generally, CAD tends to be a resource-intensive task, and if you have a rather modest hardware, then I’d suggest you go for LibreCAD as it is really lightweight in terms of resource usage. LibreCAD is a great candidate for geometric constructions. - -![librecad][5] -As a 2D tool, LibreCAD is good but it cannot work on 3D models and renderings. It might be unstable at times but it has a dependable autosave which won’t let your work go wasted. - -[LibreCAD][6] - -You can install LibreCAD by running the following command -``` -sudo apt install librecad - -``` - -#### 3\. OpenSCAD - -OpenSCAD is a free 3D CAD software. OpenSCAD is very lightweight and flexible. OpenSCAD is not interactive. You need to ‘program’ the model and OpenSCAD interprets that code to render a visual model. It is a compiler in a sense. You cannot draw the model. You describe the model. - -![openscad][7] - -OpenSCAD is the most complicated tool on this list but once you get to know it, it provides an enjoyable work experience. - -[OpenSCAD][8] - -You can use the following commands to install OpenSCAD. -``` -sudo apt-get install openscad - -``` - -#### 4\. BRL-CAD - -BRL-CAD is one of the oldest CAD tools out there. It also has been loved by Linux/UNIX users as it aligns itself with *nix philosophies of modularity and freedom. - -![BRL-CAD rendering by Sean][9] - -BRL-CAD was started in 1979, and it is still developed actively. Now, BRL-CAD is not AutoCAD but it is still a great choice for transport studies such as thermal and ballistic penetration. BRL-CAD underlies CSG instead of boundary representation. You might need to keep that in mind while opting for BRL-CAD. You can download BRL-CAD from its official website. - -[BRL-CAD][10] - -#### 5\. DraftSight (not open source) - -If You’re used to working on AutoCAD, then DraftSight would be the perfect alternative for you. - -DraftSight is a great CAD tool available on Linux. It has a rather similar workflow to AutoCAD, which makes migrating easier. It even provides a similar look and feel. DrafSight is also compatible with the .dwg file format of AutoCAD. But DrafSight is a 2D CAD software. It does not support 3D CAD as of yet. - -![draftsight][11] - -Although DrafSight is a commercial software with a starting price of $149. A free version is also made available on the[DraftSight website][12]. You can download the .deb package and install it on Ubuntu based distributions. need to register your free copy using your email ID to start using DraftSight. - -[DraftSight][12] - -#### Honorary mentions - - * With a huge growth in cloud computing technologies, cloud CAD solutions like [OnShape][13] have been getting popular day by day. - * [SolveSpace][14] is another open-source project worth mentioning. It supports 3D modeling. - * Siemens NX is an industrial grade CAD solution available on Windows, Mac OS and Linux, but it is ridiculously expensive, so omitted in this list. - * Then you have [LeoCAD][15], which is a CAD software where you use LEGO blocks to build stuff. What you do with this information is up to you. - - - -#### CAD on Linux, in my opinion - -Although gaming on Linux has picked up, I always tell my hardcore gaming friends to stick to Windows. Similarly, if You are an engineering student with CAD in your curriculum, I’d recommend that you use the software that your college prescribes (AutoCAD, SolidEdge, Catia), which generally tend to run on Windows only. - -And for the advanced professionals, these tools are simply not up to the mark when we’re talking about industry standards. - -For those of you thinking about running AutoCAD in WINE, although some older versions of AutoCAD can be installed on WINE, they simply do not perform, with glitches and crashes ruining the experience. - -That being said, I highly respect the work that has been put by the developers of the above-listed software. They have enriched the FOSS world. And it’s great to see software like FreeCAD developing with an accelerated pace in the recent years. - -Well, that’s it for today. Do share your thoughts with us using the comments section below and don’t forget to share this article. Cheers. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/cad-software-linux/ - -作者:[Aquil Roshan][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/aquil/ -[1]:https://en.wikipedia.org/wiki/Computer-aided_design -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cad-software-linux.jpeg -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freecad.jpg -[4]:https://www.freecadweb.org/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/librecad.jpg -[6]:https://librecad.org/ -[7]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/openscad.jpg -[8]:http://www.openscad.org/ -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/brlcad.jpg -[10]:https://brlcad.org/ -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/draftsight.jpg -[12]:https://www.draftsight2018.com/ -[13]:https://www.onshape.com/ -[14]:http://solvespace.com/index.pl -[15]:https://www.leocad.org/ diff --git a/sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md b/sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md deleted file mode 100644 index 539ac42082..0000000000 --- a/sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md +++ /dev/null @@ -1,169 +0,0 @@ -5 ways to play old-school games on a Raspberry Pi -====== - -Relive the golden age of gaming with these open source platforms for Raspberry Pi. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) - -They don't make 'em like they used to, do they? Video games, I mean. - -Sure, there's a bit more grunt in the gear now. Princess Zelda used to be 16 pixels in each direction; there's now enough graphics power for every hair on her head. Today's processors could beat up 1988's processors in a cage-fight deathmatch without breaking a sweat. - -But you know what's missing? The fun. - -You've got a squillion and one buttons to learn just to get past the tutorial mission. There's probably a storyline, too. You shouldn't need a backstory to kill bad guys. All you need is jump and shoot. So, it's little wonder that one of the most enduring popular uses for a Raspberry Pi is to relive the 8- and 16-bit golden age of gaming in the '80s and early '90s. But where to start? - -There are a few ways to play old-school games on the Pi. Each has its strengths and weaknesses, which I'll discuss here. - -### Retropie - -[Retropie][1] is probably the most popular retro-gaming platform for the Raspberry Pi. It's a solid all-rounder and a great default option for emulating classic desktop and console gaming systems. - -#### What is it? - -Retropie is built to run on [Raspbian][2]. It can also be installed over an existing Raspbian image if you'd prefer. It uses [EmulationStation][3] as a graphical front-end for a library of open source emulators, including the [Libretro][4] emulators. - -You don't need to understand a word of that to play your games, though. - -#### What's great about it - -It's very easy to get started. All you need to do is burn the image to an SD card, configure your controllers, copy your games over, and start killing bad guys. - -The huge user base means that there is a wealth of support and information out there, and active online communities to turn to for questions. - -In addition to the emulators that come installed with the Retropie image, there's a huge library of emulators you can install from the package manager, and it's growing all the time. Retropie also offers a user-friendly menu system to manage this, saving you time. - -From the Retropie menu, it's easy to add Kodi and the Raspbian desktop, which comes with the Chromium web browser. This means your retro-gaming rig is also good for home theatre, [YouTube][5], [SoundCloud][6], and all those other “lounge room computer” goodies. - -Retropie also has a number of other customization options: You can change the graphics in the menus, set up different control pad configurations for different emulators, make your Raspberry Pi file system visible to your local Windows network—all sorts of stuff. - -Retropie is built on Raspbian, which means you have the Raspberry Pi's most popular operating system to explore. Most Raspberry Pi projects and tutorials you find floating around are written for Raspbian, making it easy to customize and install new things on it. I've used my Retropie rig as a wireless bridge, installed MIDI synthesizers on it, taught myself a bit of Python, and more—all without compromising its use as a gaming machine. - -#### What's not so great about it - -Retropie's simple installation and ease of use is, in a way, a double-edged sword. You can go for a long time with Retropie without ever learning simple stuff like `sudo apt-get`, which means you're missing out on a lot of the Raspberry Pi experience. - -It doesn't have to be this way; the command line is still there under the hood when you want it, but perhaps users are a bit too insulated from a Bash shell that's ultimately a lot less scary than it looks. Retropie's main menu is operable only with a control pad, which can be annoying when you don't have one plugged in because you've been using the system for things other than gaming. - -#### Who's it for? - -Anyone who wants to get straight into some gaming, anyone who wants the biggest and best library of emulators, and anyone who wants a great way to start exploring Linux when they're not playing games. - -### Recalbox - -[Recalbox][7] is a newer open source suite of emulators for the Raspberry Pi. It also supports other ARM-based small-board computers. - -#### What is it? - -Like Retropie, Recalbox is built on EmulationStation and Libretro. Where it differs is that it's not built on Raspbian, but on its own flavor of Linux: RecalboxOS. - -#### What's great about it - -The setup for Recalbox is even easier than for Retropie. You don't even need to image an SD card; simply copy some files over and go. It also has out-of-the-box support for some game controllers, getting you to Level 1 that little bit faster. Kodi comes preinstalled. This is a ready-to-go gaming and media rig. - -#### What's not so great about it - -Recalbox has fewer emulators than Retropie, fewer customization options, and a smaller user community. - -Your Recalbox rig is probably always just going to be for emulators and Kodi, the same as when you installed it. If you feel like getting deeper into Linux, you'll probably want a new SD card for Raspbian. - -#### Who's it for? - -Recalbox is great if you want the absolute easiest retro gaming experience and can happily go without some of the more obscure gaming platforms, or if you are intimidated by the idea of doing anything a bit technical (and have no interest in growing out of that). - -For most opensource.com readers, Recalbox will probably come in most handy to recommend to your not-so-technical friend or relative. Its super-simple setup and overall lack of options might even help you avoid having to help them with it. - -### Roll your own - -Ok, if you've been paying attention, you might have noticed that both Retropie and Recalbox are built from many of the same open source components. So what's to stop you from putting them together yourself? - -#### What is it? - -Whatever you want it to be, baby. The nature of open source software means you could use an existing emulator suite as a starting point, or pilfer from them at will. - -#### What's great about it - -If you have your own custom interface in mind, I guess there's nothing to do but roll your sleeves up and get to it. This is also a way to install emulators that haven't quite found their way into Retropie yet, such as [BeebEm][8] or [ArcEm][9]. - -#### What's not so great about it - -Well, it's a bit of work, isn't it? - -#### Who's it for? - -Hackers, tinkerers, builders, seasoned hobbyists, and such. - -### Native RISC OS gaming - -Now here's a dark horse: [RISC OS][10], the original operating system for ARM devices. - -#### What is it? - -Before ARM went on to become the world's most popular CPU architecture, it was originally built to be the heart of the Acorn Archimedes. That's kind of a forgotten beast nowadays, but for a few years it was light years ahead as the most powerful desktop computer in the world, and it attracted a lot of games development. - -Because the ARM processor in the Pi is the great-grandchild of the one in the Archimedes, we can still install RISC OS on it, and with a little bit of work, get these games running. This is different to the emulator options we've covered so far because we're playing our games on the operating system and CPU architecture for which they were written. - -#### What's great about it - -It's the perfect introduction to RISC OS. This is an absolute gem of an operating system and well worth checking out in its own right. - -The fact that you're using much the same operating system as back in the day to load and play your games makes your retro gaming rig just that little bit more of a time machine. This definitely adds some charm and retro value to the project. - -There are a few superb games that were released only on the Archimedes. The massive hardware advantage of the Archimedes also means that it often had the best graphics and smoothest gameplay of a lot of multi-platform titles. The rights holders to many of these games have been generous enough to make them legally available for free download. - -#### What's not so great about it - -Once you have installed RISC OS, it still takes a bit of elbow grease to get the games working. Here's a [guide to getting started][11]. - -This is definitely not a great all-rounder for the lounge room. There's nothing like [Kodi][12]. There's a web browser, [NetSurf][13], but it's struggling to catch up to the modern web. You won't get the range of titles to play as you would with an emulator suite. RISC OS Open is free for hobbyists to download and use and much of the source code has been made open. But despite the name, it's not a 100% open source operating system. - -#### Who's it for? - -This one's for novelty seekers, absolute retro heads, people who want to explore an interesting operating system from the '80s, people who are nostalgic for Acorn machines from back in the day, and people who want a totally different retro gaming project. - -### Command line gaming - -Do you really need to install an emulator or an exotic operating system just to relive the glory days? Why not just install some native linux games from the command line? - -#### What is it? - -There's a whole range of native Linux games tested to work on the [Raspberry Pi][14]. - -#### What's great about it - -You can install most of these from packages using the command line and start playing. Easy. If you've already got Raspbian up and running, it's probably your fastest path to getting a game running. - -#### What's not so great about it - -This isn't, strictly speaking, actual retro gaming. Linux was born in 1991 and took a while longer to come together as a gaming platform. This isn't quite gaming from the classic 8- and 16-bit era; these are ports and retro-influenced games that were built later. - -#### Who's it for? - -If you're just after a bucket of fun, no problem. But if you're trying to relive the actual era, this isn't quite it. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/retro-gaming-raspberry-pi - -作者:[James Mawson][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/dxmjames -[1]: https://retropie.org.uk/ -[2]: https://www.raspbian.org/ -[3]: https://emulationstation.org/ -[4]: https://www.libretro.com/ -[5]: https://www.youtube.com/ -[6]: https://soundcloud.com/ -[7]: https://www.recalbox.com/ -[8]: http://www.mkw.me.uk/beebem/ -[9]: http://arcem.sourceforge.net/ -[10]: https://opensource.com/article/18/7/gentle-intro-risc-os -[11]: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ -[12]: https://kodi.tv/ -[13]: https://www.netsurf-browser.org/ -[14]: https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 diff --git a/sources/tech/20180928 Quiet log noise with Python and machine learning.md b/sources/tech/20180928 Quiet log noise with Python and machine learning.md deleted file mode 100644 index f1fe2f1b7f..0000000000 --- a/sources/tech/20180928 Quiet log noise with Python and machine learning.md +++ /dev/null @@ -1,110 +0,0 @@ -Quiet log noise with Python and machine learning -====== - -Logreduce saves debugging time by picking out anomalies from mountains of log data. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/sound-radio-noise-communication.png?itok=KMNn9QrZ) - -Continuous integration (CI) jobs can generate massive volumes of data. When a job fails, figuring out what went wrong can be a tedious process that involves investigating logs to discover the root cause—which is often found in a fraction of the total job output. To make it easier to separate the most relevant data from the rest, the [Logreduce][1] machine learning model is trained using previous successful job runs to extract anomalies from failed runs' logs. - -This principle can also be applied to other use cases, for example, extracting anomalies from [Journald][2] or other systemwide regular log files. - -### Using machine learning to reduce noise - -A typical log file contains many nominal events ("baselines") along with a few exceptions that are relevant to the developer. Baselines may contain random elements such as timestamps or unique identifiers that are difficult to detect and remove. To remove the baseline events, we can use a [k-nearest neighbors pattern recognition algorithm][3] (k-NN). - -![](https://opensource.com/sites/default/files/uploads/ml-generic-workflow.png) - -Log events must be converted to numeric values for k-NN regression. Using the generic feature extraction tool [HashingVectorizer][4] enables the process to be applied to any type of log. It hashes each word and encodes each event in a sparse matrix. To further reduce the search space, tokenization removes known random words, such as dates or IP addresses. - -![](https://opensource.com/sites/default/files/uploads/hashing-vectorizer.png) - -Once the model is trained, the k-NN search tells us the distance of each new event from the baseline. - -![](https://opensource.com/sites/default/files/uploads/kneighbors.png) - -This [Jupyter notebook][5] demonstrates the process and graphs the sparse matrix vectors. - -![](https://opensource.com/sites/default/files/uploads/anomaly-detection-with-scikit-learn.png) - -### Introducing Logreduce - -The Logreduce Python software transparently implements this process. Logreduce's initial goal was to assist with [Zuul CI][6] job failure analyses using the build database, and it is now integrated into the [Software Factory][7] development forge's job logs process. - -At its simplest, Logreduce compares files or directories and removes lines that are similar. Logreduce builds a model for each source file and outputs any of the target's lines whose distances are above a defined threshold by using the following syntax: **distance | filename:line-number: line-content**. - -``` -$ logreduce diff /var/log/audit/audit.log.1 /var/log/audit/audit.log -INFO  logreduce.Classifier - Training took 21.982s at 0.364MB/s (1.314kl/s) (8.000 MB - 28.884 kilo-lines) -0.244 | audit.log:19963:        type=USER_AUTH acct="root" exe="/usr/bin/su" hostname=managesf.sftests.com -INFO  logreduce.Classifier - Testing took 18.297s at 0.306MB/s (1.094kl/s) (5.607 MB - 20.015 kilo-lines) -99.99% reduction (from 20015 lines to 1 - -``` - -A more advanced Logreduce use can train a model offline to be reused. Many variants of the baselines can be used to fit the k-NN search tree. - -``` -$ logreduce dir-train audit.clf /var/log/audit/audit.log.* -INFO  logreduce.Classifier - Training took 80.883s at 0.396MB/s (1.397kl/s) (32.001 MB - 112.977 kilo-lines) -DEBUG logreduce.Classifier - audit.clf: written -$ logreduce dir-run audit.clf /var/log/audit/audit.log -``` - -Logreduce also implements interfaces to discover baselines for Journald time ranges (days/weeks/months) and Zuul CI job build histories. It can also generate HTML reports that group anomalies found in multiple files in a simple interface. - -![](https://opensource.com/sites/default/files/uploads/html-report.png) - -### Managing baselines - -The key to using k-NN regression for anomaly detection is to have a database of known good baselines, which the model uses to detect lines that deviate too far. This method relies on the baselines containing all nominal events, as anything that isn't found in the baseline will be reported as anomalous. - -CI jobs are great targets for k-NN regression because the job outputs are often deterministic and previous runs can be automatically used as baselines. Logreduce features Zuul job roles that can be used as part of a failed job post task in order to issue a concise report (instead of the full job's logs). This principle can be applied to other cases, as long as baselines can be constructed in advance. For example, a nominal system's [SoS report][8] can be used to find issues in a defective deployment. - -![](https://opensource.com/sites/default/files/uploads/baselines.png) - -### Anomaly classification service - -The next version of Logreduce introduces a server mode to offload log processing to an external service where reports can be further analyzed. It also supports importing existing reports and requests to analyze a Zuul build. The services run analyses asynchronously and feature a web interface to adjust scores and remove false positives. - -![](https://opensource.com/sites/default/files/uploads/classification-interface.png) - -Reviewed reports can be archived as a standalone dataset with the target log files and the scores for anomalous lines recorded in a flat JSON file. - -### Project roadmap - -Logreduce is already being used effectively, but there are many opportunities for improving the tool. Plans for the future include: - - * Curating many annotated anomalies found in log files and producing a public domain dataset to enable further research. Anomaly detection in log files is a challenging topic, and having a common dataset to test new models would help identify new solutions. - * Reusing the annotated anomalies with the model to refine the distances reported. For example, when users mark lines as false positives by setting their distance to zero, the model could reduce the score of those lines in future reports. - * Fingerprinting archived anomalies to detect when a new report contains an already known anomaly. Thus, instead of reporting the anomaly's content, the service could notify the user that the job hit a known issue. When the issue is fixed, the service could automatically restart the job. - * Supporting more baseline discovery interfaces for targets such as SOS reports, Jenkins builds, Travis CI, and more. - - - -If you are interested in getting involved in this project, please contact us on the **#log-classify** Freenode IRC channel. Feedback is always appreciated! - -Tristan Cacqueray will present [Reduce your log noise using machine learning][9] at the [OpenStack Summit][10], November 13-15 in Berlin. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/quiet-log-noise-python-and-machine-learning - -作者:[Tristan de Cacqueray][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/tristanc -[1]: https://pypi.org/project/logreduce/ -[2]: http://man7.org/linux/man-pages/man8/systemd-journald.service.8.html -[3]: https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm -[4]: http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.HashingVectorizer.html -[5]: https://github.com/TristanCacqueray/anomaly-detection-workshop-opendev/blob/master/datasets/notebook/anomaly-detection-with-scikit-learn.ipynb -[6]: https://zuul-ci.org -[7]: https://www.softwarefactory-project.io -[8]: https://sos.readthedocs.io/en/latest/ -[9]: https://www.openstack.org/summit/berlin-2018/summit-schedule/speakers/4307 -[10]: https://www.openstack.org/summit/berlin-2018/ diff --git a/sources/tech/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md b/sources/tech/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md deleted file mode 100644 index 2fd085eda0..0000000000 --- a/sources/tech/20181011 Exploring the Linux kernel- The secrets of Kconfig-kbuild.md +++ /dev/null @@ -1,259 +0,0 @@ -Translating by Jamskr - -Exploring the Linux kernel: The secrets of Kconfig/kbuild -====== -Dive into understanding how the Linux config/build system works. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/compass_map_explore_adventure.jpg?itok=ecCoVTrZ) - -The Linux kernel config/build system, also known as Kconfig/kbuild, has been around for a long time, ever since the Linux kernel code migrated to Git. As supporting infrastructure, however, it is seldom in the spotlight; even kernel developers who use it in their daily work never really think about it. - -To explore how the Linux kernel is compiled, this article will dive into the Kconfig/kbuild internal process, explain how the .config file and the vmlinux/bzImage files are produced, and introduce a smart trick for dependency tracking. - -### Kconfig - -The first step in building a kernel is always configuration. Kconfig helps make the Linux kernel highly modular and customizable. Kconfig offers the user many config targets: -| config | Update current config utilizing a line-oriented program | -| nconfig | Update current config utilizing a ncurses menu-based program | -| menuconfig | Update current config utilizing a menu-based program | -| xconfig | Update current config utilizing a Qt-based frontend | -| gconfig | Update current config utilizing a GTK+ based frontend | -| oldconfig | Update current config utilizing a provided .config as base | -| localmodconfig | Update current config disabling modules not loaded | -| localyesconfig | Update current config converting local mods to core | -| defconfig | New config with default from Arch-supplied defconfig | -| savedefconfig | Save current config as ./defconfig (minimal config) | -| allnoconfig | New config where all options are answered with 'no' | -| allyesconfig | New config where all options are accepted with 'yes' | -| allmodconfig | New config selecting modules when possible | -| alldefconfig | New config with all symbols set to default | -| randconfig | New config with a random answer to all options | -| listnewconfig | List new options | -| olddefconfig | Same as oldconfig but sets new symbols to their default value without prompting | -| kvmconfig | Enable additional options for KVM guest kernel support | -| xenconfig | Enable additional options for xen dom0 and guest kernel support | -| tinyconfig | Configure the tiniest possible kernel | - -I think **menuconfig** is the most popular of these targets. The targets are processed by different host programs, which are provided by the kernel and built during kernel building. Some targets have a GUI (for the user's convenience) while most don't. Kconfig-related tools and source code reside mainly under **scripts/kconfig/** in the kernel source. As we can see from **scripts/kconfig/Makefile** , there are several host programs, including **conf** , **mconf** , and **nconf**. Except for **conf** , each of them is responsible for one of the GUI-based config targets, so, **conf** deals with most of them. - -Logically, Kconfig's infrastructure has two parts: one implements a [new language][1] to define the configuration items (see the Kconfig files under the kernel source), and the other parses the Kconfig language and deals with configuration actions. - -Most of the config targets have roughly the same internal process (shown below): - -![](https://opensource.com/sites/default/files/uploads/kconfig_process.png) - -Note that all configuration items have a default value. - -The first step reads the Kconfig file under source root to construct an initial configuration database; then it updates the initial database by reading an existing configuration file according to this priority: - -> .config -> /lib/modules/$(shell,uname -r)/.config -> /etc/kernel-config -> /boot/config-$(shell,uname -r) -> ARCH_DEFCONFIG -> arch/$(ARCH)/defconfig - -If you are doing GUI-based configuration via **menuconfig** or command-line-based configuration via **oldconfig** , the database is updated according to your customization. Finally, the configuration database is dumped into the .config file. - -But the .config file is not the final fodder for kernel building; this is why the **syncconfig** target exists. **syncconfig** used to be a config target called **silentoldconfig** , but it doesn't do what the old name says, so it was renamed. Also, because it is for internal use (not for users), it was dropped from the list. - -Here is an illustration of what **syncconfig** does: - -![](https://opensource.com/sites/default/files/uploads/syncconfig.png) - -**syncconfig** takes .config as input and outputs many other files, which fall into three categories: - - * **auto.conf & tristate.conf** are used for makefile text processing. For example, you may see statements like this in a component's makefile: - -``` - obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o -``` - - * **autoconf.h** is used in C-language source files. - - * Empty header files under **include/config/** are used for configuration-dependency tracking during kbuild, which is explained below. - - - - -After configuration, we will know which files and code pieces are not compiled. - -### kbuild - -Component-wise building, called _recursive make_ , is a common way for GNU `make` to manage a large project. Kbuild is a good example of recursive make. By dividing source files into different modules/components, each component is managed by its own makefile. When you start building, a top makefile invokes each component's makefile in the proper order, builds the components, and collects them into the final executive. - -Kbuild refers to different kinds of makefiles: - - * **Makefile** is the top makefile located in source root. - * **.config** is the kernel configuration file. - * **arch/$(ARCH)/Makefile** is the arch makefile, which is the supplement to the top makefile. - * **scripts/Makefile.*** describes common rules for all kbuild makefiles. - * Finally, there are about 500 **kbuild makefiles**. - - - -The top makefile includes the arch makefile, reads the .config file, descends into subdirectories, invokes **make** on each component's makefile with the help of routines defined in **scripts/Makefile.*** , builds up each intermediate object, and links all the intermediate objects into vmlinux. Kernel document [Documentation/kbuild/makefiles.txt][2] describes all aspects of these makefiles. - -As an example, let's look at how vmlinux is produced on x86-64: - -![vmlinux overview][4] - -(The illustration is based on Richard Y. Steven's [blog][5]. It was updated and is used with the author's permission.) - -All the **.o** files that go into vmlinux first go into their own **built-in.a** , which is indicated via variables **KBUILD_VMLINUX_INIT** , **KBUILD_VMLINUX_MAIN** , **KBUILD_VMLINUX_LIBS** , then are collected into the vmlinux file. - -Take a look at how recursive make is implemented in the Linux kernel, with the help of simplified makefile code: - -``` - # In top Makefile - vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) -                 +$(call if_changed,link-vmlinux) - - # Variable assignments - vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) $(KBUILD_VMLINUX_LIBS) - - export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) - export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y2) $(drivers-y) $(net-y) $(virt-y) - export KBUILD_VMLINUX_LIBS := $(libs-y1) - export KBUILD_LDS          := arch/$(SRCARCH)/kernel/vmlinux.lds - - init-y          := init/ - drivers-y       := drivers/ sound/ firmware/ - net-y           := net/ - libs-y          := lib/ - core-y          := usr/ - virt-y          := virt/ - - # Transform to corresponding built-in.a - init-y          := $(patsubst %/, %/built-in.a, $(init-y)) - core-y          := $(patsubst %/, %/built-in.a, $(core-y)) - drivers-y       := $(patsubst %/, %/built-in.a, $(drivers-y)) - net-y           := $(patsubst %/, %/built-in.a, $(net-y)) - libs-y1         := $(patsubst %/, %/lib.a, $(libs-y)) - libs-y2         := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y))) - virt-y          := $(patsubst %/, %/built-in.a, $(virt-y)) - - # Setup the dependency. vmlinux-deps are all intermediate objects, vmlinux-dirs - # are phony targets, so every time comes to this rule, the recipe of vmlinux-dirs - # will be executed. Refer "4.6 Phony Targets" of `info make` - $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; - - # Variable vmlinux-dirs is the directory part of each built-in.a - vmlinux-dirs    := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ -                      $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ -                      $(net-y) $(net-m) $(libs-y) $(libs-m) $(virt-y))) - - # The entry of recursive make - $(vmlinux-dirs): -                 $(Q)$(MAKE) $(build)=$@ need-builtin=1 -``` - -The recursive make recipe is expanded, for example: - -``` - make -f scripts/Makefile.build obj=init need-builtin=1 -``` - -This means **make** will go into **scripts/Makefile.build** to continue the work of building each **built-in.a**. With the help of **scripts/link-vmlinux.sh** , the vmlinux file is finally under source root. - -#### Understanding vmlinux vs. bzImage - -Many Linux kernel developers may not be clear about the relationship between vmlinux and bzImage. For example, here is their relationship in x86-64: - -![](https://opensource.com/sites/default/files/uploads/vmlinux-bzimage.png) - -The source root vmlinux is stripped, compressed, put into **piggy.S** , then linked with other peer objects into **arch/x86/boot/compressed/vmlinux**. Meanwhile, a file called setup.bin is produced under **arch/x86/boot**. There may be an optional third file that has relocation info, depending on the configuration of **CONFIG_X86_NEED_RELOCS**. - -A host program called **build** , provided by the kernel, builds these two (or three) parts into the final bzImage file. - -#### Dependency tracking - -Kbuild tracks three kinds of dependencies: - - 1. All prerequisite files (both * **.c** and * **.h** ) - 2. **CONFIG_** options used in all prerequisite files - 3. Command-line dependencies used to compile the target - - - -The first one is easy to understand, but what about the second and third? Kernel developers often see code pieces like this: - -``` - #ifdef CONFIG_SMP - __boot_cpu_id = cpu; - #endif -``` - -When **CONFIG_SMP** changes, this piece of code should be recompiled. The command line for compiling a source file also matters, because different command lines may result in different object files. - -When a **.c** file uses a header file via a **#include** directive, you need write a rule like this: - -``` - main.o: defs.h -         recipe... -``` - -When managing a large project, you need a lot of these kinds of rules; writing them all would be tedious and boring. Fortunately, most modern C compilers can write these rules for you by looking at the **#include** lines in the source file. For the GNU Compiler Collection (GCC), it is just a matter of adding a command-line parameter: **-MD depfile** - -``` - # In scripts/Makefile.lib - c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE)     \ -                  -include $(srctree)/include/linux/compiler_types.h       \ -                  $(__c_flags) $(modkern_cflags)                           \ -                  $(basename_flags) $(modname_flags) -``` - -This would generate a **.d** file with content like: - -``` - init_task.o: init/init_task.c include/linux/kconfig.h \ -  include/generated/autoconf.h include/linux/init_task.h \ -  include/linux/rcupdate.h include/linux/types.h \ -  ... -``` - -Then the host program **[fixdep][6]** takes care of the other two dependencies by taking the **depfile** and command line as input, then outputting a **. .cmd** file in makefile syntax, which records the command line and all the prerequisites (including the configuration) for a target. It looks like this: - -``` - # The command line used to compile the target - cmd_init/init_task.o := gcc -Wp,-MD,init/.init_task.o.d  -nostdinc ... - ... - # The dependency files - deps_init/init_task.o := \ - $(wildcard include/config/posix/timers.h) \ - $(wildcard include/config/arch/task/struct/on/stack.h) \ - $(wildcard include/config/thread/info/in/task.h) \ - ... -   include/uapi/linux/types.h \ -   arch/x86/include/uapi/asm/types.h \ -   include/uapi/asm-generic/types.h \ -   ... -``` - -A **. .cmd** file will be included during recursive make, providing all the dependency info and helping to decide whether to rebuild a target or not. - -The secret behind this is that **fixdep** will parse the **depfile** ( **.d** file), then parse all the dependency files inside, search the text for all the **CONFIG_** strings, convert them to the corresponding empty header file, and add them to the target's prerequisites. Every time the configuration changes, the corresponding empty header file will be updated, too, so kbuild can detect that change and rebuild the target that depends on it. Because the command line is also recorded, it is easy to compare the last and current compiling parameters. - -### Looking ahead - -Kconfig/kbuild remained the same for a long time until the new maintainer, Masahiro Yamada, joined in early 2017, and now kbuild is under active development again. Don't be surprised if you soon see something different from what's in this article. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/10/kbuild-and-kconfig - -作者:[Cao Jin][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/pinocchio -[b]: https://github.com/lujun9972 -[1]: https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-language.txt -[2]: https://www.mjmwired.net/kernel/Documentation/kbuild/makefiles.txt -[3]: https://opensource.com/file/411516 -[4]: https://opensource.com/sites/default/files/uploads/vmlinux_generation_process.png (vmlinux overview) -[5]: https://blog.csdn.net/richardysteven/article/details/52502734 -[6]: https://github.com/torvalds/linux/blob/master/scripts/basic/fixdep.c diff --git a/sources/tech/20181011 The First Beta of Haiku is Released After 16 Years of Development.md b/sources/tech/20181011 The First Beta of Haiku is Released After 16 Years of Development.md deleted file mode 100644 index b6daaef053..0000000000 --- a/sources/tech/20181011 The First Beta of Haiku is Released After 16 Years of Development.md +++ /dev/null @@ -1,87 +0,0 @@ -The First Beta of Haiku is Released After 16 Years of Development -====== -There are a number of small operating systems out there that are designed to replicate the past. Haiku is one of those. We will look to see where Haiku came from and what the new release has to offer. - -![Haiku OS desktop screenshot][1]Haiku desktop - -### What is Haiku? - -Haiku’s history begins with the now defunct [Be Inc][2]. Be Inc was founded by former Apple executive [Jean-Louis Gassée][3] after he was ousted by CEO [John Sculley][4]. Gassée wanted to create a new operating system from the ground up. BeOS was created with digital media work in mind and was designed to take advantage of the most modern hardware of the time. Originally, Be Inc attempted to create their own platform encompassing both hardware and software. The result was called the [BeBox][5]. After BeBox failed to sell well, Be turned their attention to BeOS. - -In the 1990s, Apple was looking for a new operating system to replace the aging Classic Mac OS. The two contenders were Gassée’s BeOS and Steve Jobs’ NeXTSTEP. In the end, Apple went with NeXTSTEP. Be tried to license BeOS to hardware makers, but [in at least one case][6] Microsoft threatened to revoke a manufacturer’s Windows license if they sold BeOS machines. Eventually, Be Inc was sold to Palm in 2001 for $11 million. BeOS was subsequently discontinued. - -Following the news of Palm’s purchase, a number of loyal fans decided they wanted to keep the operating system alive. The original name of the project was OpenBeOS, but was changed to Haiku to avoid infringing on Palm’s trademarks. The name is a reference to reference to the [haikus][7] used as error messages by many of the applications. Haiku is completely written from scratch and is compatible with BeOS. - -### Why Haiku? - -According to the project’s website, [Haiku][8] “is a fast, efficient, simple to use, easy to learn, and yet very powerful system for computer users of all levels”. Haiku comes with a kernel that have been customized for performance. Like FreeBSD, there is a “single team writing everything from the kernel, drivers, userland services, toolkit, and graphics stack to the included desktop applications and preflets”. - -### New Features in Haiku Beta Release - -A number of new features have been introduced since the release of Alpha 4.1. (Please note that Haiku is a passion project and all the devs are part-time, so some they can’t spend as much time working on Haiku as they would like.) - -![Haiku OS software][9] -HaikuDepot, Haiku’s package manager - -One of the biggest features is the inclusion of a complete package management system. HaikuDepot allows you to sort through many applications. Many are built specifically for Haiku, but a number have been ported to the platform, such as [LibreOffice][10], [Otter Browser][11], and [Calligra][12]. Interestingly, each Haiku package is [“a special type of compressed filesystem image, which is ‘mounted’ upon installation”][13]. There is also a command line interface for package management named `pkgman`. - -Another big feature is an upgraded browser. Haiku was able to hire a developer to work full-time for a year to improve the performance of WebPositive, the built-in browser. This included an update to a newer version of WebKit. WebPositive will now play Youtube videos properly. - -![Haiku OS WebPositive browser][14] -WebPositive, Haiku’s built-in browser - -Other features include: - - * A completely rewritten network preflet - * User interface cleanup - * Media subsystem improvements, including better streaming support, HDA driver improvements, and FFmpeg decoder plugin improvements - * Native RemoteDesktop improved - * Add EFI bootloader and GPT support - * Updated Ethernet & WiFi drivers - * Updated filesystem drivers - * General system stabilization - * Experimental Bluetooth stack - - - -### Thoughts on Haiku OS - -I have been following Haiku for many years. I’ve installed and played with the nightly builds a dozen times over the last couple of years. I even took some time to start learning one of its programming languages, so that I could write apps. But I got busy with other things. - -I’m very conflicted about it. I like Haiku because it is a neat non-Linux project, but it is only just getting features that everyone else takes for granted, like a package manager. - -If you’ve got a couple of minutes, download the [ISO][15] and install it on the virtual machine of your choice. You just might like it. - -Have you ever used Haiku or BeOS? If so, what are your favorite features? Let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][16]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/haiku-os-release/ - -作者:[John Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[b]: https://github.com/lujun9972 -[1]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/10/haiku.jpg -[2]: https://en.wikipedia.org/wiki/Be_Inc. -[3]: https://en.wikipedia.org/wiki/Jean-Louis_Gass%C3%A9e -[4]: https://en.wikipedia.org/wiki/John_Sculley -[5]: https://en.wikipedia.org/wiki/BeBox -[6]: https://birdhouse.org/beos/byte/30-bootloader/ -[7]: https://en.wikipedia.org/wiki/Haiku -[8]: https://www.haiku-os.org/about/ -[9]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/10/haiku-depot.png -[10]: https://www.libreoffice.org/ -[11]: https://itsfoss.com/otter-browser-review/ -[12]: https://www.calligra.org/ -[13]: https://www.haiku-os.org/get-haiku/release-notes/ -[14]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/10/webpositive.jpg -[15]: https://www.haiku-os.org/get-haiku -[16]: http://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20181029 Create animated, scalable vector graphic images with MacSVG.md b/sources/tech/20181029 Create animated, scalable vector graphic images with MacSVG.md deleted file mode 100644 index df990db3bc..0000000000 --- a/sources/tech/20181029 Create animated, scalable vector graphic images with MacSVG.md +++ /dev/null @@ -1,69 +0,0 @@ -Create animated, scalable vector graphic images with MacSVG -====== - -Open source SVG: The writing is on the wall - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_design_paper_plane_2_0.jpg?itok=xKdP-GWE) - -The Neo-Babylonian regent [Belshazzar][1] did not heed [the writing on the wall][2] that magically appeared during his great feast. However, if he had had a laptop and a good internet connection in 539 BC, he might have staved off those pesky Persians by reading the SVG on the browser. - -Animating text and objects on web pages is a great way to build user interest and engagement. There are several ways to achieve this, such as a video embed, an animated GIF, or a slideshow—but you can also use [scalable vector graphics][3] (SVG). - -An SVG image is different from, say, a JPG, because it is scalable without losing its resolution. A vector image is created by points, not dots, so no matter how large it gets, it will not lose its resolution or pixelate. An example of a good use of scalable, static images would be logos on websites. - -### Move it, move it - -You can create SVG images with several drawing programs, including open source [Inkscape][4] and Adobe Illustrator. Getting your images to “do something” requires a bit more effort. Fortunately, there are open source solutions that would get even Belshazzar’s attention. - -[MacSVG][5] is one tool that will get your images moving. You can find the source code on [GitHub][6]. - -Developed by Douglas Ward of Conway, Arkansas, MacSVG is an “open source Mac OS app for designing HTML5 SVG art and animation,” according to its [website][5]. - -I was interested in using MacSVG to create an animated signature. I admit that I found the process a bit confusing and failed at my first attempts to create an actual animated SVG image. - -![](https://opensource.com/sites/default/files/uploads/macsvg-screen.png) - -It is important to first learn what makes “the writing on the wall” actually write. - -The attribute behind the animated writing is [stroke-dasharray][7]. Breaking the term into three words helps explain what is happening: Stroke refers to the line or stroke you would make with a pen, whether physical or digital. Dash means breaking the stroke down into a series of dashes. Array means producing the whole thing into an array. That’s a simple overview, but it helped me understand what was supposed to happen and why. - -With MacSVG, you can import a graphic (.PNG) and use the pen tool to trace the path of the writing. I used a cursive representation of my first name. Then it was just a matter of applying the attributes to animate the writing, increase and decrease the thickness of the stroke, change its color, and so on. Once completed, the animated writing was exported as an .SVG file and was ready for use on the web. MacSVG can be used for many different types of SVG animation in addition to handwriting. - -### The writing is on the WordPress - -I was ready to upload and share my SVG example on my [WordPress][8] site, but I discovered that WordPress does not allow for SVG media imports. Fortunately, I found a handy plugin: Benbodhi’s [SVG Support][9] allowed a quick, easy import of my SVG the same way I would import a JPG to my Media Library. I was able to showcase my [writing on the wall][10] to Babylonians everywhere. - -I opened the source code of my SVG in [Brackets][11], and here are the results: - -``` - - -Path animation with stroke-dasharrayThis example demonstrates the use of a path element, an animate element, and the stroke-dasharray attribute to simulate drawing. -``` - -What would you use MacSVG for? - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/10/macsvg-open-source-tool-animation - -作者:[Jeff Macharyas][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/rikki-endsley -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Belshazzar -[2]: https://en.wikipedia.org/wiki/Belshazzar%27s_feast -[3]: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics -[4]: https://inkscape.org/ -[5]: https://macsvg.org/ -[6]: https://github.com/dsward2/macSVG -[7]: https://gist.github.com/mbostock/5649592 -[8]: https://macharyas.com/ -[9]: https://wordpress.org/plugins/svg-support/ -[10]: https://macharyas.com/index.php/2018/10/14/open-source-svg/ -[11]: http://brackets.io/ diff --git a/sources/tech/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md b/sources/tech/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md deleted file mode 100644 index f250cca056..0000000000 --- a/sources/tech/20181029 DF-SHOW - A Terminal File Manager Based On An Old DOS Application.md +++ /dev/null @@ -1,162 +0,0 @@ -DF-SHOW – A Terminal File Manager Based On An Old DOS Application -====== -![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-720x340.png) - -If you have worked on good-old MS-DOS, you might have used or heard about **DF-EDIT**. The DF-EDIT, stands for **D** irectory **F** ile **Edit** or, is an obscure DOS file manager, originally written by **Larry Kroeker** for MS-DOS and PC-DOS systems. It is used to display the contents of a given directory or file in MS-DOS and PC-DOS systems. Today, I stumbled upon a similar utility named **DF-SHOW** ( **D** irectory **F** ile **S** how), a terminal file manager for Unix-like operating systems. It is an Unix rewrite of obscure DF-EDIT file manager and is based on DF-EDIT 2.3d release from 1986. DF-SHOW is completely free, open source and released under GPLv3. - -DF-SHOW can be able to, - - * List contents of a directory, - * View files, - * Edit files using your default file editor, - * Copy files to/from different locations, - * Rename files, - * Delete files, - * Create new directories from within the DF-SHOW interface, - * Update file permissions, owners and groups, - * Search files matching a search term, - * Launch executable files. - - - -### DF-SHOW Usage - -DF-SHOW consists of two programs, namely **“show”** and **“sf”**. - -**Show command** - -The “show” program (similar to the `ls` command) is used to display the contents of a directory, create new directories, rename, delete files/folders, update permissions, search files and so on. - -To view the list of contents in a directory, use the following command: - -``` -$ show -``` - -Example: - -``` -$ show dfshow -``` - -Here, dfshow is a directory. If you invoke the “show” command without specifying a directory path, it will display the contents of current directory. - -Here is how DF-SHOW default interface looks like. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-1.png) - -As you can see, DF-SHOW interface is self-explanatory. - -On the top bar, you see the list of available options such as Copy, Delete, Edit, Modify etc. - -Complete list of available options are given below: - - * **C** opy, - * **D** elete, - * **E** dit, - * **H** idden, - * **M** odify, - * **Q** uit, - * **R** ename, - * **S** how, - * h **U** nt, - * e **X** ec, - * **R** un command, - * **E** dit file, - * **H** elp, - * **M** ake dir, - * **Q** uit, - * **S** how dir - - - -In each option, one letter has been capitalized and marked as bold. Just press the capitalized letter to perform the respective operation. For example, to rename a file, just press **R** and type the new name and hit ENTER to rename the selected item. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-2.png) - -To display all options or cancel an operation, just press **ESC** key. - -Also, you will see a bunch of function keys at the bottom of DF-SHOW interface to navigate through the contents of a directory. - - * **UP/DOWN** arrows or **F1/F2** – Move up and down (one line at time), - * **PgUp/Pg/Dn** – Move one page at a time, - * **F3/F4** – Instantly go to Top and bottom of the list, - * **F5** – Refresh, - * **F6** – Mark/Unmark files (Files marked will be indicated with an ***** in front of them), - * **F7/F8** – Mark/Unmark all files at once, - * **F9** – Sort the list by – Date & time, Name, Size., - - - -Press **h** to learn more details about **show** command and its options. - -To exit DF-SHOW, simply press **q**. - -**SF Command** - -The “sf” (show files) is used to display the contents of a file. - -``` -$ sf -``` - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/dfshow-3.png) - -Press **h** to learn more “sf” command and its options. To quit, press **q**. - -Want to give it a try? Great! Go ahead and install DF-SHOW on your Linux system as described below. - -### Installing DF-SHOW - -DF-SHOW is available in [**AUR**][1], so you can install it on any Arch-based system using AUR programs such as [**Yay**][2]. - -``` -$ yay -S dfshow -``` - -On Ubuntu and its derivatives: - -``` -$ sudo add-apt-repository ppa:ian-hawdon/dfshow - -$ sudo apt-get update - -$ sudo apt-get install dfshow -``` - -On other Linux distributions, you can compile and build it from the source as shown below. - -``` -$ git clone https://github.com/roberthawdon/dfshow -$ cd dfshow -$ ./bootstrap -$ ./configure -$ make -$ sudo make install -``` - -The author of DF-SHOW project has only rewritten some of the applications of DF-EDIT utility. Since the source code is freely available on GitHub, you can add more features, improve the code and submit or fix the bugs (if there are any). It is still in alpha stage, but fully functional. - -Have you tried it already? If so, how’d go? Tell us your experience in the comments section below. - -And, that’s all for now. Hope this was useful.More good stuffs to come. - -Stay tuned! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/df-show-a-terminal-file-manager-based-on-an-old-dos-application/ - -作者:[SK][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.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://aur.archlinux.org/packages/dfshow/ -[2]: https://www.ostechnix.com/yay-found-yet-another-reliable-aur-helper/ diff --git a/sources/tech/20181030 Podman- A more secure way to run containers.md b/sources/tech/20181030 Podman- A more secure way to run containers.md deleted file mode 100644 index a6252d87cc..0000000000 --- a/sources/tech/20181030 Podman- A more secure way to run containers.md +++ /dev/null @@ -1,130 +0,0 @@ -Podman: A more secure way to run containers -====== -Podman uses a traditional fork/exec model (vs. a client/server model) for running containers. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-cloud-safe.png?itok=yj2TFPzq) - -Before I get into the main topic of this article, [Podman][1] and containers, I need to get a little technical about the Linux audit feature. - -### What is audit? - -The Linux kernel has an interesting security feature called **audit**. It allows administrators to watch for security events on a system and have them logged to the audit.log, which can be stored locally or remotely on another machine to prevent a hacker from trying to cover his tracks. - -The **/etc/shadow** file is a common security file to watch, since adding a record to it could allow an attacker to get return access to the system. Administrators want to know if any process modified the file. You can do this by executing the command: - -``` -# auditctl -w /etc/shadow -``` - -Now let's see what happens if I modify the /etc/shadow file: - -``` -# touch /etc/shadow -# ausearch -f /etc/shadow -i -ts recent - -type=PROCTITLE msg=audit(10/10/2018 09:46:03.042:4108) : proctitle=touch /etc/shadow type=SYSCALL msg=audit(10/10/2018 09:46:03.042:4108) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7ffdb17f6704 a2=O_WRONLY|O_CREAT|O_NOCTTY| O_NONBLOCK a3=0x1b6 items=2 ppid=2712 pid=3727 auid=dwalsh uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts1 ses=3 comm=touch exe=/usr/bin/touch subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null)` -``` - -There's a lot of information in the audit record, but I highlighted that it recorded that root modified the /etc/shadow file and the owner of the process' audit UID ( **auid** ) was **dwalsh**. - -Did the kernel do that? - -#### Tracking the login UID - -**loginuid** , stored in **/proc/self/loginuid** , that is part of the proc struct of every process on the system. This field can be set only once; after it is set, the kernel will not allow any process to reset it. - -There is a field called, stored in, that is part of the proc struct of every process on the system. This field can be set only once; after it is set, the kernel will not allow any process to reset it. - -When I log into the system, the login program sets the loginuid field for my login process. - -My UID, dwalsh, is 3267. - -``` -$ cat /proc/self/loginuid -3267 -``` - -Now, even if I become root, my login UID stays the same. - -``` -$ sudo cat /proc/self/loginuid -3267 -``` - -Note that every process that's forked and executed from the initial login process automatically inherits the loginuid. This is how the kernel knew that the person who logged was dwalsh. - -### Containers - -Now let's look at containers. - -``` -sudo podman run fedora cat /proc/self/loginuid -3267 -``` - -Even the container process retains my loginuid. Now let's try with Docker. - -``` -sudo docker run fedora cat /proc/self/loginuid -4294967295 -``` - -### Why the difference? - -Podman uses a traditional fork/exec model for the container, so the container process is an offspring of the Podman process. Docker uses a client/server model. The **docker** command I executed is the Docker client tool, and it communicates with the Docker daemon via a client/server operation. Then the Docker daemon creates the container and handles communications of stdin/stdout back to the Docker client tool. - -The default loginuid of processes (before their loginuid is set) is 4294967295. Since the container is an offspring of the Docker daemon and the Docker daemon is a child of the init system, we see that systemd, Docker daemon, and the container processes all have the same loginuid, 4294967295, which audit refers to as the unset audit UID. - -``` -cat /proc/1/loginuid -4294967295 -``` - -### How can this be abused? - -Let's look at what would happen if a container process launched by Docker modifies the /etc/shadow file. - -``` -$ sudo docker run --privileged -v /:/host fedora touch /host/etc/shadow -$ sudo ausearch -f /etc/shadow -i type=PROCTITLE msg=audit(10/10/2018 10:27:20.055:4569) : proctitle=/usr/bin/coreutils --coreutils-prog-shebang=touch /usr/bin/touch /host/etc/shadow type=SYSCALL msg=audit(10/10/2018 10:27:20.055:4569) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7ffdb6973f50 a2=O_WRONLY|O_CREAT|O_NOCTTY| O_NONBLOCK a3=0x1b6 items=2 ppid=11863 pid=11882 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=touch exe=/usr/bin/coreutils subj=system_u:system_r:spc_t:s0 key=(null) -``` - -In the Docker case, the auid is unset (4294967295); this means the security officer might know that a process modified the /etc/shadow file but the identity was lost. - -If that attacker then removed the Docker container, there would be no trace on the system of who modified the /etc/shadow file. - -Now let's look at the exact same scenario with Podman. - -``` -$ sudo podman run --privileged -v /:/host fedora touch /host/etc/shadow -$ sudo ausearch -f /etc/shadow -i type=PROCTITLE msg=audit(10/10/2018 10:23:41.659:4530) : proctitle=/usr/bin/coreutils --coreutils-prog-shebang=touch /usr/bin/touch /host/etc/shadow type=SYSCALL msg=audit(10/10/2018 10:23:41.659:4530) : arch=x86_64 syscall=openat success=yes exit=3 a0=0xffffff9c a1=0x7fffdffd0f34 a2=O_WRONLY|O_CREAT|O_NOCTTY| O_NONBLOCK a3=0x1b6 items=2 ppid=11671 pid=11683 auid=dwalsh uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=3 comm=touch exe=/usr/bin/coreutils subj=unconfined_u:system_r:spc_t:s0 key=(null) -``` - -Everything is recorded correctly with Podman since it uses traditional fork/exec. - -This was just a simple example of watching the /etc/shadow file, but the auditing system is very powerful for watching what processes do on a system. Using a fork/exec container runtime for launching containers (instead of a client/server container runtime) allows you to maintain better security through audit logging. - -### Final thoughts - -There are many other nice features about the fork/exec model versus the client/server model when launching containers. For example, systemd features include: - - * **SD_NOTIFY:** If you put a Podman command into a systemd unit file, the container process can return notice up the stack through Podman that the service is ready to receive tasks. This is something that can't be done in client/server mode. - * **Socket activation:** You can pass down connected sockets from systemd to Podman and onto the container process to use them. This is impossible in the client/server model. - - - -The nicest feature, in my opinion, is **running Podman and containers as a non-root user**. This means you never have give a user root privileges on the host, while in the client/server model (like Docker employs), you must open a socket to a privileged daemon running as root to launch the containers. There you are at the mercy of the security mechanisms implemented in the daemon versus the security mechanisms implemented in the host operating systems—a dangerous proposition. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/10/podman-more-secure-way-run-containers - -作者:[Daniel J Walsh][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/rhatdan -[b]: https://github.com/lujun9972 -[1]: https://podman.io diff --git a/sources/tech/20181105 How to manage storage on Linux with LVM.md b/sources/tech/20181105 How to manage storage on Linux with LVM.md index 9c0ee685d6..36cc8d47a0 100644 --- a/sources/tech/20181105 How to manage storage on Linux with LVM.md +++ b/sources/tech/20181105 How to manage storage on Linux with LVM.md @@ -1,4 +1,3 @@ -[zianglei translating] How to manage storage on Linux with LVM ====== Create, expand, and encrypt storage pools as needed with the Linux LVM utilities. diff --git a/sources/tech/20181111 Some notes on running new software in production.md b/sources/tech/20181111 Some notes on running new software in production.md new file mode 100644 index 0000000000..bfdfb66a44 --- /dev/null +++ b/sources/tech/20181111 Some notes on running new software in production.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some notes on running new software in production) +[#]: via: (https://jvns.ca/blog/2018/11/11/understand-the-software-you-use-in-production/) +[#]: author: (Julia Evans https://jvns.ca/) + +Some notes on running new software in production +====== + +I’m working on a talk for kubecon in December! One of the points I want to get across is the amount of time/investment it takes to use new software in production without causing really serious incidents, and what that’s looked like for us in our use of Kubernetes. + +To start out, this post isn’t blanket advice. There are lots of times when it’s totally fine to just use software and not worry about **how** it works exactly. So let’s start by talking about when it’s important to invest. + +### when it matters: 99.99% + +If you’re running a service with a low SLO like 99% I don’t think it matters that much to understand the software you run in production. You can be down for like 2 hours a month! If something goes wrong, just fix it and it’s fine. + +At 99.99%, it’s different. That’s 45 minutes / year of downtime, and if you find out about a serious issue for the first time in production it could easily take you 20 minutes or to revert the change. That’s half your uptime budget for the year! + +### when it matters: software that you’re using heavily + +Also, even if you’re running a service with a 99.99% SLO, it’s impossible to develop a super deep understanding of every single piece of software you’re using. For example, a web service might use: + + * 100 library dependencies + * the filesystem (so there’s linux filesystem code!) + * the network (linux networking code!) + * a database (like postgres) + * a proxy (like nginx/haproxy) + + + +If you’re only reading like 2 files from disk, you don’t need to do a super deep dive into Linux filesystems internals, you can just read the file from disk. + +What I try to do in practice is identify the components which we rely on the (or have the most unusual use cases for!), and invest time into understanding those. These are usually pretty easy to identify because they’re the ones which will cause the most problems :) + +### when it matters: new software + +Understanding your software especially matters for newer/less mature software projects, because it’s morely likely to have bugs & or just not have matured enough to be used by most people without having to worry. I’ve spent a bunch of time recently with Kubernetes/Envoy which are both relatively new projects, and neither of those are remotely in the category of “oh, it’ll just work, don’t worry about it”. I’ve spent many hours debugging weird surprising edge cases with both of them and learning how to configure them in the right way. + +### a playbook for understanding your software + +The playbook for understanding the software you run in production is pretty simple. Here it is: + + 1. Start using it in production in a non-critical capacity (by sending a small percentage of traffic to it, on a less critical service, etc) + 2. Let that bake for a few weeks. + 3. Run into problems. + 4. Fix the problems. Go to step 3. + + + +Repeat until you feel like you have a good handle on this software’s failure modes and are comfortable running it in a more critical capacity. Let’s talk about that in a little more detail, though: + +### what running into bugs looks like + +For example, I’ve been spending a lot of time with Envoy in the last year. Some of the issues we’ve seen along the way are: (in no particular order) + + * One of the default settings resulted in retry & timeout headers not being respected + * Envoy (as a client) doesn’t support TLS session resumption, so servers with a large amount of Envoy clients get DDOSed by TLS handshakes + * Envoy’s active healthchecking means that you services get healthchecked by every client. This is mostly okay but (again) services with many clients can get overwhelmed by it. + * Having every client independently healthcheck every server interacts somewhat poorly with services which are under heavy load, and can exacerbate performance issues by removing up-but-slow clients from the load balancer rotation. + * Envoy doesn’t retry failed connections by default + * it frequently segfaults when given incorrect configuration + * various issues with it segfaulting because of resource leaks / memory safety issues + * hosts running out of disk space between we didn’t rotate Envoy log files often enough + + + +A lot of these aren’t bugs – they’re just cases where what we expected the default configuration to do one thing, and it did another thing. This happens all the time, and it can result in really serious incidents. Figuring out how to configure a complicated piece of software appropriately takes a lot of time, and you just have to account for that. + +And Envoy is great software! The maintainers are incredibly responsive, they fix bugs quickly and its performance is good. It’s overall been quite stable and it’s done well in production. But just because something is great software doesn’t mean you won’t also run into 10 or 20 relatively serious issues along the way that need to be addressed in one way or another. And it’s helpful to understand those issues **before** putting the software in a really critical place. + +### try to have each incident only once + +My view is that running new software in production inevitably results in incidents. The trick: + + 1. Make sure the incidents aren’t too serious (by making ‘production’ a less critical system first) + 2. Whenever there’s an incident (even if it’s not that serious!!!), spend the time necessary to understand exactly why it happened and how to make sure it doesn’t happen again + + + +My experience so far has been that it’s actually relatively possible to pull off “have every incident only once”. When we investigate issues and implement remediations, usually that issue **never comes back**. The remediation can either be: + + * a configuration change + * reporting a bug upstream and either fixing it ourselves or waiting for a fix + * a workaround (“this software doesn’t work with 10,000 clients? ok, we just won’t use it with in cases where there are that many clients for now!“, “oh, a memory leak? let’s just restart it every hour”) + + + +Knowledge-sharing is really important here too – it’s always unfortunate when one person finds an incident in production, fixes it, but doesn’t explain the issue to the rest of the team so somebody else ends up causing the same incident again later because they didn’t hear about the original incident. + +### Understand what is ok to break and isn’t + +Another huge part of understanding the software I run in production is understanding which parts are OK to break (aka “if this breaks, it won’t result in a production incident”) and which aren’t. This lets me **focus**: I can put big boxes around some components and decide “ok, if this breaks it doesn’t matter, so I won’t pay super close attention to it”. + +For example, with Kubernetes: + +ok to break: + + * any stateless control plane component can crash or be cycled out or go down for 5 minutes at any time. If we had 95% uptime for the kubernetes control plane that would probably be fine, it just needs to be working most of the time. + * kubernetes networking (the system where you give every pod an IP addresses) can break as much as it wants because we decided not to use it to start + + + +not ok: + + * for us, if etcd goes down for 10 minutes, that’s ok. If it goes down for 2 hours, it’s not + * containers not starting or crashing on startup (iam issues, docker not starting containers, bugs in the scheduler, bugs in other controllers) is serious and needs to be looked at immediately + * containers not having access to the resources they need (because of permissions issues, etc) + * pods being terminated unexpectedly by Kubernetes (if you configure kubernetes wrong it can terminate your pods!) + + + +with Envoy, the breakdown is pretty different: + +ok to break: + + * if the envoy control plane goes down for 5 minutes, that’s fine (it’ll keep working with stale data) + * segfaults on startup due to configuration errors are sort of okay because they manifest so early and they’re unlikely to surprise us (if the segfault doesn’t happen the 1st time, it shouldn’t happen the 200th time) + + + +not ok: + + * Envoy crashes / segfaults are not good – if it crashes, network connections don’t happen + * if the control server serves incorrect or incomplete data that’s extremely dangerous and can result in serious production incidents. (so downtime is fine, but serving incorrect data is not!) + + + +Neither of these lists are complete at all, but they’re examples of what I mean by “understand your sofware”. + +### sharing ok to break / not ok lists is useful + +I think these “ok to break” / “not ok” lists are really useful to share, because even if they’re not 100% the same for every user, the lessons are pretty hard won. I’d be curious to hear about your breakdown of what kinds of failures are ok / not ok for software you’re using! + +Figuring out all the failure modes of a new piece of software and how they apply to your situation can take months. (this is is why when you ask your database team “hey can we just use NEW DATABASE” they look at you in such a pained way). So anything we can do to help other people learn faster is amazing +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/11/11/understand-the-software-you-use-in-production/ + +作者:[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 diff --git a/sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md b/sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md new file mode 100644 index 0000000000..f95f17db01 --- /dev/null +++ b/sources/tech/20181118 An example of how C-- destructors are useful in Envoy.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An example of how C++ destructors are useful in Envoy) +[#]: via: (https://jvns.ca/blog/2018/11/18/c---destructors---really-useful/) +[#]: author: (Julia Evans https://jvns.ca/) + +An example of how C++ destructors are useful in Envoy +====== + +For a while now I’ve been working with a C++ project (Envoy), and sometimes I need to contribute to it, so my C++ skills have gone from “nonexistent” to “really minimal”. I’ve learned what an initializer list is and that a method starting with `~` is a destructor. I almost know what an lvalue and an rvalue are but not quite. + +But the other day when writing some C++ code I figured out something exciting about how to use destructors that I hadn’t realized! (the tl;dr of this post for people who know C++ is “julia finally understands what RAII is and that it is useful” :)) + +### what’s a destructor? + +C++ has objects. When an C++ object goes out of scope, the compiler inserts a call to its destructor. So if you have some code like + +``` +function do_thing() { + Thing x{}; // this calls the Thing constructor + return 2; +} +``` + +there will be a call to x’s destructor at the end of the `do_thing` function. so the code c++ generates looks something like: + + * make new thing + * call the new thing’s destructor + * return 2 + + + +Obviously destructors are way more complicated like this. They need to get called when there are exceptions! And sometimes they get called manually. And for lots of other reasons too. But there are 10 million things to know about C++ and that is not what we’re doing today, we are just talking about one thing. + +### what happens in a destructor? + +A lot of the time memory gets freed, which is how you avoid having memory leaks. But that’s not what we’re talking about in this post! We are talking about something more interesting. + +### the thing we’re interested in: Envoy circuit breakers + +So I’ve been working with Envoy a lot. 3 second Envoy refresher: it’s a HTTP proxy, your application makes requests to Envoy, which then proxies the request to the servers the application wants to talk to. + +One very useful feature Envoy has is this thing called “circuit breakers”. Basically the idea with is that if your application makes 50 billion connections to a service, that will probably overwhelm the service. So Envoy keeps track how many TCP connections you’ve made to a service, and will stop you from making new requests if you hit the limit. The default `max_connection` limit + +### how do you track connection count? + +To maintain a circuit breaker on the number of TCP connections, that means you need to keep an accurate count of how many TCP connections are currently open! How do you do that? Well, the way it works is to maintain a `connections` counter and: + + * every time a connection is opened, increment the counter + * every time a connection is destroyed (because of a reset / timeout / whatever), decrement the counter + * when creating a new connection, check that the `connections` counter is not over the limit + + + +that’s all! And incrementing the counter when creating a new connection is pretty easy. But how do you make sure that the counter gets _decremented_ wheh the connection is destroyed? Connections can be destroyed in a lot of ways (they can time out! they can be closed by Envoy! they can be closed by the server! maybe something else I haven’t thought of could happen!) and it seems very easy to accidentally miss a way of closing them. + +### destructors to the rescue + +The way Envoy solves this problem is to create a connection object (called `ActiveClient` in the HTTP connection pool) for every connection. + +Then it: + + * increments the counter in the constructor ([code][1]) + * decrements the counter in the destructor ([code][2]) + * checks the counter when a new connection is created ([code][3]) + + + +The beauty of this is that now you don’t need to make sure that the counter gets decremented in all the right places, you now just need to organize your code so that the `ActiveClient` object’s destructor gets called when the connection has closed. + +Where does the `ActiveClient` destructor get called in Envoy? Well, Envoy maintains 2 lists of clients (`ready_clients` and `busy_clients`), and when a connection gets closed, Envoy removes the client from those lists. And when it does that, it doesn’t need to do any extra cleanup!! In C++, anytime a object is removed from a list, its destructor is called. So `client.removeFromList(ready_clients_);` takes care of all the cleanup. And there’s no chance of forgetting to decrement the counter!! It will definitely always happen unless you accidentally leave the object on one of these lists, which would be a bug anyway because the connection is closed :) + +### RAII + +This pattern Envoy is using here is an extremely common C++ programming pattern called “resource acquisition is initialization”. I find that name very confusing but that’s what it’s called. basically the way it works is: + + * identify a resource (like “connection”) where a lot of things need to happen when the connection is initialized / finished + * make a class for that connection + * put all the initialization / finishing code in the constructor / destructor + * make sure the object’s destructor method gets called when appropriate! (by removing it from a vector / having it go out of scope) + + + +Previously I knew about using this pattern for kind of obvious things (make sure all the memory gets freed in the destructor, or make sure file descriptors get closed). But I didn’t realize it was also useful for cases that are slightly less obviously a resource like “decrement a counter”. + +The reason this pattern works is because the C++ compiler/standard library does a bunch of work to make sure that destructors get called when you’re done with an object – the compiler inserts destructor calls at the end of each block of code, after exceptions, and many standard library collections make sure destructors are called when you remove an object from a collection. + +### RAII gives you prompt, deterministic, and hard-to-screw-up cleanup of resources + +The exciting thing here is that this programming pattern gives you a way to schedule cleaning up resources that’s: + + * easy to ensure always happens (when the object goes away, it always happens, even if there was an exception!) + * prompt & determinstic (it happens right away and it’s guaranteed to happen!) + + + +### what languages have RAII? + +C++ and Rust have RAII. Probably other languages too. Java, Python, Go, and garbage collected languages in general do not. In a garbage collected language you can often set up destructors to be run when the object is GC’d. But often (like in this case, which the connection count) you want things to be cleaned up **right away** when the object is no longer in use, not some indeterminate period later whenever GC happens to run. + +Python context managers are a related idea, you could do something like: + +``` +with conn_pool.connection() as conn: + do stuff +``` + +### that’s all for now! + +Hopefully this explanation of RAII is interesting and mostly correct. Thanks to Kamal for clarifying some RAII things for me! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/11/18/c---destructors---really-useful/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/envoyproxy/envoy/blob/200b0e41641be46471c2ce3d230aae395fda7ded/source/common/http/http1/conn_pool.cc#L301 +[2]: https://github.com/envoyproxy/envoy/blob/200b0e41641be46471c2ce3d230aae395fda7ded/source/common/http/http1/conn_pool.cc#L315 +[3]: https://github.com/envoyproxy/envoy/blob/200b0e41641be46471c2ce3d230aae395fda7ded/source/common/http/http1/conn_pool.cc#L97 diff --git a/sources/tech/20181202 How To Customize The GNOME 3 Desktop.md b/sources/tech/20181202 How To Customize The GNOME 3 Desktop.md deleted file mode 100644 index 91c16e4e99..0000000000 --- a/sources/tech/20181202 How To Customize The GNOME 3 Desktop.md +++ /dev/null @@ -1,266 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (How To Customize The GNOME 3 Desktop?) -[#]: via: (https://www.2daygeek.com/how-to-customize-the-gnome-3-desktop/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -[#]: url: ( ) - -How To Customize The GNOME 3 Desktop? -====== - -We have got many emails from user to write an article about GNOME 3 desktop customization but we don’t get a time to write this topic. - -I was using Ubuntu operating system since long time in my primary laptop and i got bored so, i would like to test some other distro which is related to Arch Linux. - -I prefer to go with Majaro so, i have installed Manjaro 18.0 with GNOME 3 desktop in my laptop. - -I’m customizing my desktop, how i want it. So, i would like to take this opportunity to write up this article in detailed way to help others. - -This article helps others to customize their desktop without headache. - -I’m not going to include all my customization and i will be adding a necessary things which will be mandatory and useful for Linux desktop users. - -If you feel some tweak is missing in this article, i would request you to mention that in comment sections. It will be very helpful for other users. - -### 1) How to Launch Activities Overview in GNOME 3 Desktop? - -The Activities Overview will display all the running applications or launched/opened windows by clicking `Super Key` or by clicking `Activities` button in the topmost left corner. - -It allows you to launch a new applications, switch windows, and move windows between workspaces. - -You can simply exit the Activities Overview by choosing the following any of the one actions like selecting a window, application or workspace, or by pressing the `Super Key` or `Esc Key`. - -Activities Overview Screenshot. -![][2] - -### 2) How to Resize Windows in GNOME 3 Desktop? - -The Launched windows can be maximized, unmaximized and snapped to one side of the screen (Left or Right) by using the following key combinations. - - * `Super Key+Down Arrow:` To unmaximize the window. - * `Super Key+Up Arrow:` To maximize the window. - * `Super Key+Right Arrow:` To fill a window in the right side of the half screen. - * `Super Key+Left Arrow:` To fill a window in the left side of the half screen - - - -Use `Super Key+Down Arrow` to unmaximize the window. -![][3] - -Use `Super Key+Up Arrow` to maximize the window. -![][4] - -Use `Super Key+Right Arrow` to fill a window in the right side of the half screen. -![][5] - -Use `Super Key+Left Arrow` to fill a window in the left side of the half screen. -![][6] - -This feature will help you to view two applications at a time a.k.a splitting screen. -![][7] - -### 3) How to Display Applications in GNOME 3 Desktop? - -Click on the `Show Application Grid` button in the Dash to display all the installed applications on your system. -![][8] - -### 4) How to Add Applications on Dash in GNOME 3 Desktop? - -To speed up your day to day activity you may want to add frequently used application into Dash or Drag the application launcher to the Dash. - -It will allow you to directly launch your favorite applications without searching them. To do so, simply right click on it and use the option `Add to Favorites`. -![][9] - -To remove a application launcher a.k.a favorite from Dash, either drag it from the Dash to the grid button or simply right click on it and use the option `Remove from Favorites`. -![][10] - -### 5) How to Switch Between Workspaces in GNOME 3 Desktop? - -Workspaces allow you to group windows together. It will helps you to segregate your work properly. If you are working on Multiple things and you want to group each work and related things separately then it will be very handy and perfect option for you. - -You can switch workspaces in two ways, Open the Activities Overview and select a workspace from the right-hand side or use the following key combinations. - - * Use `Ctrl+Alt+Up` Switch to the workspace above. - * Use `Ctrl+Alt+Down` Switch to the workspace below. - - - -![][11] - -### 6) How to Switch Between Applications (Application Switcher) in GNOME 3 Desktop? - -Use either `Alt+Tab` or `Super+Tab` to switch between applications. To launch Application Switcher, use either `Alt+Tab` or `Super+Tab`. - -Once launched, just keep holding the Alt or Super key and hit the tab key to move to the next application from left to right order. - -### 7) How to Add UserName to Top Panel in GNOME 3 Desktop? - -If you would like to add your UserName to Top Panel then install the following [Add Username to Top Panel][12] GNOME Extension. -![][13] - -### 8) How to Add Microsoft Bing’s wallpaper in GNOME 3 Desktop? - -Install the following [Bing Wallpaper Changer][14] GNOME shell extension to change your wallpaper every day to Microsoft Bing’s wallpaper. -![][15] - -### 9) How to Enable Night Light in GNOME 3 Desktop? - -Night light app is one of the famous app which reduces strain on the eyes by turning your screen a dim yellow from blue light after sunset. - -It is available in smartphones. The other known apps for the same purpose are flux and **[redshift][16]**. - -To enable this, navigate to **System Settings** >> **Devices** >> **Displays** and turn Nigh Light on. -![][17] - -Once it’s enabled and status icon will be placed on the top panel. -![][18] - -### 10) How to Show the Battery Percentage in GNOME 3 Desktop? - -Battery percentage will show you the exact battery usage. To enable this follow the below steps. - -Start GNOME Tweaks >> **Top Bar** >> **Battery Percentage** and switch it on. -![][19] - -After modification you can able to see the battery percentage icon on the top panel. -![][20] - -### 11) How to Enable Mouse Right Click in GNOME 3 Desktop? - -By default right click is disabled on GNOME 3 desktop environment. To enable this follow the below steps. - -Start GNOME Tweaks >> **Keyboard & Mouse** >> Mouse Click Emulation and select “Area” option. -![][21] - -### 12) How to Enable Minimize On Click in GNOME 3 Desktop? - -Enable one-click minimize feature which will help us to minimize opened window without using minimize option. - -``` -$ gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize' -``` - -### 13) How to Customize Dock in GNOME 3 Desktop? - -If you would like to change your Dock similar to Deepin desktop or Mac then use the following set of commands. - -``` -$ gsettings set org.gnome.shell.extensions.dash-to-dock dock-position BOTTOM -$ gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false -$ gsettings set org.gnome.shell.extensions.dash-to-dock transparency-mode FIXED -$ gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 50 -``` - -![][22] - -### 14) How to Show Desktop in GNOME 3 Desktop? - -By default `Super Key+D` shortcut doesn’t show your desktop. To configure this follow the below steps. - -Settings >> **Devices** >> **Keyboard** >> Click **Hide all normal windows** under Navigation then Press `Super Key+D` finally hit `Set` button to enable it. -![][23] - -### 15) How to Customize Date and Time Format? - -By default GNOME 3 shows date and time with `Sun 04:48`. It’s not clear and if you want to get the output with following format `Sun Dec 2 4:49 AM` follow the below steps. - -**For Date Modification:** Start GNOME Tweaks >> **Top Bar** and enable `Weekday` option under Clock. -![][24] - -**For Time Modification:** Settings >> **Details** >> **Date & Time** then choose `AM/PM` option in the time format. -![][25] - -After modification you can able to see the date and time format same as below. -![][26] - -### 16) How to Permanently Disable Unused Services in Boot? - -In my case, i’m not going to use **Bluetooth** & **cpus a.k.a Printer service**. Hence, disabling these services on my laptop. To disable services on Arch based systems use **[Pacman Package Manager][27]**. -For Bluetooth - -``` -$ sudo systemctl stop bluetooth.service -$ sudo systemctl disable bluetooth.service -$ sudo systemctl mask bluetooth.service -$ systemctl status bluetooth.service -``` - -For cups - -``` -$ sudo systemctl stop org.cups.cupsd.service -$ sudo systemctl disable org.cups.cupsd.service -$ sudo systemctl mask org.cups.cupsd.service -$ systemctl status org.cups.cupsd.service -``` - -Finally verify whether these services are disabled or not in the boot using the following command. If you want to double confirm this, you can reboot once and check the same. Navigate to the following link to know more about **[systemctl][28]** usage, - -``` -$ systemctl list-unit-files --type=service | grep enabled -[email protected] enabled -dbus-org.freedesktop.ModemManager1.service enabled -dbus-org.freedesktop.NetworkManager.service enabled -dbus-org.freedesktop.nm-dispatcher.service enabled -display-manager.service enabled -gdm.service enabled -[email protected] enabled -linux-module-cleanup.service enabled -ModemManager.service enabled -NetworkManager-dispatcher.service enabled -NetworkManager-wait-online.service enabled -NetworkManager.service enabled -systemd-fsck-root.service enabled-runtime -tlp-sleep.service enabled -tlp.service enabled -``` - -### 17) Install Icons & Themes in GNOME 3 Desktop? - -Bunch of Icons and Themes are available for GNOME Desktop so, choose the desired **[GTK Themes][29]** and **[Icons Themes][30]** for you. To configure this further, navigate to the below links which makes your Desktop more elegant. - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/how-to-customize-the-gnome-3-desktop/ - -作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-overview-screenshot.jpg -[3]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-unmaximize-the-window.jpg -[4]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-maximize-the-window.jpg -[5]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-fill-a-window-right-side.jpg -[6]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-fill-a-window-left-side.jpg -[7]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-activities-split-screen.jpg -[8]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-applications.jpg -[9]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-applications-on-dash.jpg -[10]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-remove-applications-from-dash.jpg -[11]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-workspaces-screenshot.jpg -[12]: https://extensions.gnome.org/extension/1108/add-username-to-top-panel/ -[13]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-username-to-top-panel.jpg -[14]: https://extensions.gnome.org/extension/1262/bing-wallpaper-changer/ -[15]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-add-microsoft-bings-wallpaper.jpg -[16]: https://www.2daygeek.com/install-redshift-reduce-prevent-protect-eye-strain-night-linux/ -[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-night-light.jpg -[18]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-night-light-1.jpg -[19]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-battery-percentage.jpg -[20]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-display-battery-percentage-1.jpg -[21]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-mouse-right-click.jpg -[22]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-dock-customization.jpg -[23]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-enable-show-desktop.jpg -[24]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-date.jpg -[25]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-time.jpg -[26]: https://www.2daygeek.com/wp-content/uploads/2018/12/how-to-customize-the-gnome-3-desktop-customize-date-time.jpg -[27]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ -[28]: https://www.2daygeek.com/sysvinit-vs-systemd-cheatsheet-systemctl-command-usage/ -[29]: https://www.2daygeek.com/category/gtk-theme/ -[30]: https://www.2daygeek.com/category/icon-theme/ diff --git a/sources/tech/20181209 How do you document a tech project with comics.md b/sources/tech/20181209 How do you document a tech project with comics.md new file mode 100644 index 0000000000..02d4981875 --- /dev/null +++ b/sources/tech/20181209 How do you document a tech project with comics.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How do you document a tech project with comics?) +[#]: via: (https://jvns.ca/blog/2018/12/09/how-do-you-document-a-tech-project-with-comics/) +[#]: author: (Julia Evans https://jvns.ca/) + +How do you document a tech project with comics? +====== + +Every so often I get email from people saying basically “hey julia! we have an open source project! we’d like to use comics / zines / art to document our project! Can we hire you?“. + +spoiler: the answer is “no, you can’t hire me” – I don’t do commissions. But I do think this is a cool idea and I’ve often wished I had something more useful to say to people than “no”, so if you’re interested in this, here are some ideas about how to accomplish it! + +### zine != drawing + +First, a terminology distinction. One weird thing I’ve noticed is that people frequently refer to individual tech drawings as “zines”. I think this is due to me communicating poorly somehow, but – drawings are not zines! A zine is a **printed booklet**, like a small maga**zine**. You wouldn’t call a photo of a model in Vogue a magazine! The magazine has like a million pages! An individual drawing is a drawing/comic/graphic/whatever. Just clarifying this because I think it causes a bit of unnecessary confusion. + +### comics without good information are useless + +Usually when folks ask me “hey, could we make a comic explaining X”, it doesn’t seem like they have a clear idea of what information exactly they want to get across, they just have a vague idea that maybe it would be cool to draw some comics. This makes sense – figuring out what information would be useful to tell people is very hard!! It’s 80% of what I spend my time on when making comics. + +You should think about comics the same way as any kind of documentation – start with the information you want to convey, who your target audience is, and how you want to distribute it (twitter? on your website? in person?), and figure out how to illustrate it after :). The information is the main thing, not the art! + +Once you have a clear story about what you want to get across, you can start trying to think about how to represent it using illustrations! + +### focus on concepts that don’t change + +Drawing comics is a much bigger investment than writing documentation (it takes me like 5x longer to convey the same information in a comic than in writing). So use it wisely! Because it’s not that easy to edit, if you’re going to make something a comic you want to focus on concepts that are very unlikely to change. So talk about the core ideas in your project instead of the exact command line arguments it takes! + +Here are a couple of options for how you could use comics/illustrations to document your project! + +### option 1: a single graphic + +One format you might want to try is a single, small graphic explaining what your project is about and why folks might be interested in it. For example: [this zulip comic][1] + +This is a short thing, you could post it on Twitter or print it as a pamphlet to give out. The information content here would probably be basically what’s on your project homepage, but presented in a more fun/exciting way :) + +You can put a pretty small amount of information in a single comic. With that Zulip comic, the things I picked out were: + + * zulip is sort of like slack, but it has threads + * it’s easy to keep track of threads even if the conversation takes place over several days + * you can much more easily selectively catch up with Zulip + * zulip is open source + * there’s an open zulip server you can try out + + + +That’s not a lot of information! It’s 50 words :). So to do this effectively you need to distill your project down to 50 words in a way that’s still useful. It’s not easy! + +### option 2: many comics + +Another approach you can take is to make a more in depth comic / illustration, like [google’s guide to kubernetes][2] or [the children’s illustrated guide to kubernetes][3]. + +To do this, you need a much stronger concept than “uh, I want to explain our project” – you want to have a clear target audience in mind! For example, if I were drawing a set of Docker comics, I’d probably focus on folks who want to use Docker in production. so I’d want to discuss: + + * publishing your containers to a public/private registry + * some best practices for tagging your containers + * how to make sure your hosts don’t run out of disk space from downloading too many containers + * how to use layers to save on disk space / download less stuff + * whether it’s reasonable to run the same containers in production & in dev + + + +That’s totally different from the set of comics I’d write for folks who just want to use Docker to develop locally! + +### option 3: a printed zine + +The main thing that differentiates this from “many comics” is that zines are printed! Because of that, for this to make sense you need to have a place to give out the printed copies! Maybe you’re going present your project at a major conference? Maybe you give workshops about your project and want to give our the zine to folks in the workshop as notes? Maybe you want to mail it to people? + +### how to hire someone to help you + +There are basically 3 ways to hire someone: + + 1. Hire someone who both understands (or can quickly learn) the technology you want to document and can illustrate well. These folks are tricky to find and probably expensive (I certainly wouldn’t do a project like this for less than $10,000 even if I did do commissions), just because programmers can usually charge a pretty high consulting rate. I’d guess that the main failure mode here is that it might be impossible/very hard to find someone, and it might be expensive. + 2. Collaborate with an illustrator to draw it for you. The main failure mode here is that if you don’t give the illustrator clear explanations of your tech to work with, you.. won’t end up with a clear and useful explanation. From what I’ve seen, **most folks underinvest in writing clear explanations for their illustrators** – I’ve seen a few really adorable tech comics that I don’t find useful or clear at all. I’d love to see more people do a better job of this. What’s the point of having an adorable illustration if it doesn’t teach anyone anything? :) + 3. Draw it yourself :). This is what I do, obviously. stick figures are okay! + + + +Most people seem to use method #2 – I’m not actually aware of any tech folks who have done commissioned comics (though I’m sure it’s happened!). I think method #2 is a great option and I’d love to see more folks do it. Paying illustrators is really fun! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/12/09/how-do-you-document-a-tech-project-with-comics/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/986444234365521920 +[2]: https://cloud.google.com/kubernetes-engine/kubernetes-comic/ +[3]: https://thenewstack.io/kubernetes-gets-childrens-book/ diff --git a/sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md b/sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md deleted file mode 100644 index adc14c6111..0000000000 --- a/sources/tech/20181213 Podman and user namespaces- A marriage made in heaven.md +++ /dev/null @@ -1,145 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Podman and user namespaces: A marriage made in heaven) -[#]: via: (https://opensource.com/article/18/12/podman-and-user-namespaces) -[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) - -Podman and user namespaces: A marriage made in heaven -====== -Learn how to use Podman to run containers in separate user namespaces. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/architecture_structure_planning_design_.png?itok=KL7dIDct) - -[Podman][1], part of the [libpod][2] library, enables users to manage pods, containers, and container images. In my last article, I wrote about [Podman as a more secure way to run containers][3]. Here, I'll explain how to use Podman to run containers in separate user namespaces. - -I have always thought of [user namespace][4], primarily developed by Red Hat's Eric Biederman, as a great feature for separating containers. User namespace allows you to specify a user identifier (UID) and group identifier (GID) mapping to run your containers. This means you can run as UID 0 inside the container and UID 100000 outside the container. If your container processes escape the container, the kernel will treat them as UID 100000. Not only that, but any file object owned by a UID that isn't mapped into the user namespace will be treated as owned by "nobody" (65534, kernel.overflowuid), and the container process will not be allowed access unless the object is accessible by "other" (world readable/writable). - -If you have a file owned by "real" root with permissions [660][5], and the container processes in the user namespace attempt to read it, they will be prevented from accessing it and will see the file as owned by nobody. - -### An example - -Here's how that might work. First, I create a file in my system owned by root. - -``` -$ sudo bash -c "echo Test > /tmp/test" -$ sudo chmod 600 /tmp/test -$ sudo ls -l /tmp/test --rw-------. 1 root root 5 Dec 17 16:40 /tmp/test -``` - -Next, I volume-mount the file into a container running with a user namespace map 0:100000:5000. - -``` -$ sudo podman run -ti -v /tmp/test:/tmp/test:Z --uidmap 0:100000:5000 fedora sh -# id -uid=0(root) gid=0(root) groups=0(root) -# ls -l /tmp/test --rw-rw----. 1 nobody nobody 8 Nov 30 12:40 /tmp/test -# cat /tmp/test -cat: /tmp/test: Permission denied -``` - -The **\--uidmap** setting above tells Podman to map a range of 5000 UIDs inside the container, starting with UID 100000 outside the container (so the range is 100000-104999) to a range starting at UID 0 inside the container (so the range is 0-4999). Inside the container, if my process is running as UID 1, it is 100001 on the host - -Since the real UID=0 is not mapped into the container, any file owned by root will be treated as owned by nobody. Even if the process inside the container has **CAP_DAC_OVERRIDE** , it can't override this protection. **DAC_OVERRIDE** enables root processes to read/write any file on the system, even if the process was not owned by root or world readable or writable. - -User namespace capabilities are not the same as capabilities on the host. They are namespaced capabilities. This means my container root has capabilities only within the container—really only across the range of UIDs that were mapped into the user namespace. If a container process escaped the container, it wouldn't have any capabilities over UIDs not mapped into the user namespace, including UID=0. Even if the processes could somehow enter another container, they would not have those capabilities if the container uses a different range of UIDs. - -Note that SELinux and other technologies also limit what would happen if a container process broke out of the container. - -### Using `podman top` to show user namespaces - -We have added features to **podman top** to allow you to examine the usernames of processes running inside a container and identify their real UIDs on the host. - -Let's start by running a sleep container using our UID mapping. - -``` -$ sudo podman run --uidmap 0:100000:5000 -d fedora sleep 1000 -``` - -Now run **podman top** : - -``` -$ sudo podman top --latest user huser -USER   HUSER -root   100000 - -$ ps -ef | grep sleep -100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 -``` - -Notice **podman top** reports that the user process is running as root inside the container but as UID 100000 on the host (HUSER). Also the **ps** command confirms that the sleep process is running as UID 100000. - -Now let's run a second container, but this time we will choose a separate UID map starting at 200000. - -``` -$ sudo podman run --uidmap 0:200000:5000 -d fedora sleep 1000 -$ sudo podman top --latest user huser -USER   HUSER -root   200000 - -$ ps -ef | grep sleep -100000   21821 21809  0 08:04 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 -200000   23644 23632  1 08:08 ?         00:00:00 /usr/bin/coreutils --coreutils-prog-shebang=sleep /usr/bin/sleep 1000 -``` - -Notice that **podman top** reports the second container is running as root inside the container but as UID=200000 on the host. - -Also look at the **ps** command—it shows both sleep processes running: one as 100000 and the other as 200000. - -This means running the containers inside separate user namespaces gives you traditional UID separation between processes, which has been the standard security tool of Linux/Unix from the beginning. - -### Problems with user namespaces - -For several years, I've advocated user namespace as the security tool everyone wants but hardly anyone has used. The reason is there hasn't been any filesystem support or a shifting file system. - -In containers, you want to share the **base** image between lots of containers. The examples above use the Fedora base image in each example. Most of the files in the Fedora image are owned by real UID=0. If I run a container on this image with the user namespace 0:100000:5000, by default it sees all of these files as owned by nobody, so we need to shift all of these UIDs to match the user namespace. For years, I've wanted a mount option to tell the kernel to remap these file UIDs to match the user namespace. Upstream kernel storage developers continue to investigate and make progress on this feature, but it is a difficult problem. - - -Podman can use different user namespaces on the same image because of automatic [chowning][6] built into [containers/storage][7] by a team led by Nalin Dahyabhai. Podman uses containers/storage, and the first time Podman uses a container image in a new user namespace, container/storage "chowns" (i.e., changes ownership for) all files in the image to the UIDs mapped in the user namespace and creates a new image. Think of this as the **fedora:0:100000:5000** image. - -When Podman runs another container on the image with the same UID mappings, it uses the "pre-chowned" image. When I run the second container on 0:200000:5000, containers/storage creates a second image, let's call it **fedora:0:200000:5000**. - -Note if you are doing a **podman build** or **podman commit** and push the newly created image to a container registry, Podman will use container/storage to reverse the shift and push the image with all files chowned back to real UID=0. - -This can cause a real slowdown in creating containers in new UID mappings since the **chown** can be slow depending on the number of files in the image. Also, on a normal [OverlayFS][8], every file in the image gets copied up. The normal Fedora image can take up to 30 seconds to finish the chown and start the container. - -Luckily, the Red Hat kernel storage team, primarily Vivek Goyal and Miklos Szeredi, added a new feature to OverlayFS in kernel 4.19. The feature is called **metadata only copy-up**. If you mount an overlay filesystem with **metacopy=on** as a mount option, it will not copy up the contents of the lower layers when you change file attributes; the kernel creates new inodes that include the attributes with references pointing at the lower-level data. It will still copy up the contents if the content changes. This functionality is available in the Red Hat Enterprise Linux 8 Beta, if you want to try it out. - -This means container chowning can happen in a couple of seconds, and you won't double the storage space for each container. - -This makes running containers with tools like Podman in separate user namespaces viable, greatly increasing the security of the system. - -### Going forward - -I want to add a new flag, like **\--userns=auto** , to Podman that will tell it to automatically pick a unique user namespace for each container you run. This is similar to the way SELinux works with separate multi-category security (MCS) labels. If you set the environment variable **PODMAN_USERNS=auto** , you won't even need to set the flag. - -Podman is finally allowing users to run containers in separate user namespaces. Tools like [Buildah][9] and [CRI-O][10] will also be able to take advantage of user namespaces. For CRI-O, however, Kubernetes needs to understand which user namespace will run the container engine, and the upstream is working on that. - -In my next article, I will explain how to run Podman as non-root in a user namespace. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/podman-and-user-namespaces - -作者:[Daniel J Walsh][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/rhatdan -[b]: https://github.com/lujun9972 -[1]: https://podman.io/ -[2]: https://github.com/containers/libpod -[3]: https://opensource.com/article/18/10/podman-more-secure-way-run-containers -[4]: http://man7.org/linux/man-pages/man7/user_namespaces.7.html -[5]: https://chmodcommand.com/chmod-660/ -[6]: https://en.wikipedia.org/wiki/Chown -[7]: https://github.com/containers/storage -[8]: https://en.wikipedia.org/wiki/OverlayFS -[9]: https://buildah.io/ -[10]: http://cri-o.io/ diff --git a/sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md b/sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md new file mode 100644 index 0000000000..93755329c7 --- /dev/null +++ b/sources/tech/20181215 New talk- High Reliability Infrastructure Migrations.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New talk: High Reliability Infrastructure Migrations) +[#]: via: (https://jvns.ca/blog/2018/12/15/new-talk--high-reliability-infrastructure-migrations/) +[#]: author: (Julia Evans https://jvns.ca/) + +New talk: High Reliability Infrastructure Migrations +====== + +On Tuesday I gave a talk at KubeCon called [High Reliability Infrastructure Migrations][1]. The abstract was: + +> For companies with high availability requirements (99.99% uptime or higher), running new software in production comes with a lot of risks. But it’s possible to make significant infrastructure changes while maintaining the availability your customers expect! I’ll give you a toolbox for derisking migrations and making infrastructure changes with confidence, with examples from our Kubernetes & Envoy experience at Stripe. + +### video + +#### slides + +Here are the slides: + +since everyone always asks, I drew them in the Notability app on an iPad. I do this because it’s faster than trying to use regular slides software and I can make better slides. + +### a few notes + +Here are a few links & notes about things I mentioned in the talk + +#### skycfg: write functions, not YAML + +I talked about how my team is working on non-YAML interfaces for configuring Kubernetes. The demo is at [skycfg.fun][2], and it’s [on GitHub here][3]. It’s based on [Starlark][4], a configuration language that’s a subset of Python. + +My coworker [John][5] has promised that he’ll write a blog post about it at some point, and I’m hoping that’s coming soon :) + +#### no haunted forests + +I mentioned a deploy system rewrite we did. John has a great blog post about when rewrites are a good idea and how he approached that rewrite called [no haunted forests][6]. + +#### ignore most kubernetes ecosystem software + +One small point that I made in the talk was that on my team we ignore almost all software in the Kubernetes ecosystem so that we can focus on a few core pieces (Kubernetes & Envoy, plus some small things like kiam). I wanted to mention this because I think often in Kubernetes land it can seem like everyone is using Cool New Things (helm! istio! knative! eep!). I’m sure those projects are great but I find it much simpler to stay focused on the basics and I wanted people to know that it’s okay to do that if that’s what works for your company. + +I think the reality is that actually a lot of folks are still trying to work out how to use this new software in a reliable and secure way. + +#### other talks + +I haven’t watched other Kubecon talks yet, but here are 2 links: + +I heard good things about [this keynote from melanie cebula about kubernetes at airbnb][7], and I’m excited to see [this talk about kubernetes security][8]. The [slides from that security talk look useful][9] + +Also I’m very excited to see Kelsey Hightower’s keynote as always, but that recording isn’t up yet. If you have other Kubecon talks to recommend I’d love to know what they are. + +#### my first work talk I’m happy with + +I usually give talks about debugging tools, or side projects, or how I approach my job at a high level – not on the actual work that I do at my job. What I talked about in this talk is basically what I’ve been learning how to do at work for the last ~2 years. Figuring out how to make big infrastructure changes safely took me a long time (and I’m not done!), and so I hope this talk helps other folks do the same thing. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/12/15/new-talk--high-reliability-infrastructure-migrations/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=obB2IvCv-K0 +[2]: http://skycfg.fun +[3]: https://github.com/stripe/skycfg +[4]: https://github.com/bazelbuild/starlark +[5]: https://john-millikin.com/ +[6]: https://john-millikin.com/sre-school/no-haunted-forests +[7]: https://www.youtube.com/watch?v=ytu3aUCwlSg&index=127&t=0s&list=PLj6h78yzYM2PZf9eA7bhWnIh_mK1vyOfU +[8]: https://www.youtube.com/watch?v=a03te8xEjUg&index=65&list=PLj6h78yzYM2PZf9eA7bhWnIh_mK1vyOfU&t=0s +[9]: https://schd.ws/hosted_files/kccna18/1c/KubeCon%20NA%20-%20This%20year%2C%20it%27s%20about%20security%20-%2020181211.pdf diff --git a/sources/tech/20181220 Getting started with Prometheus.md b/sources/tech/20181220 Getting started with Prometheus.md deleted file mode 100644 index 79704addb7..0000000000 --- a/sources/tech/20181220 Getting started with Prometheus.md +++ /dev/null @@ -1,166 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Prometheus) -[#]: via: (https://opensource.com/article/18/12/introduction-prometheus) -[#]: author: (Michael Zamot https://opensource.com/users/mzamot) - -Getting started with Prometheus -====== -Learn to install and write queries for the Prometheus monitoring and alerting system. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) - -[Prometheus][1] is an open source monitoring and alerting system that directly scrapes metrics from agents running on the target hosts and stores the collected samples centrally on its server. Metrics can also be pushed using plugins like **collectd_exporter** —although this is not Promethius' default behavior, it may be useful in some environments where hosts are behind a firewall or prohibited from opening ports by security policy. - -Prometheus, a project of the [Cloud Native Computing Foundation][2], scales up using a federation model, which enables one Prometheus server to scrape another Prometheus server. This allows creation of a hierarchical topology, where a central system or higher-level Prometheus server can scrape aggregated data already collected from subordinate instances. - -Besides the Prometheus server, its most common components are its [Alertmanager][3] and its exporters. - -Alerting rules can be created within Prometheus and configured to send custom alerts to Alertmanager. Alertmanager then processes and handles these alerts, including sending notifications through different mechanisms like email or third-party services like [PagerDuty][4]. - -Prometheus' exporters can be libraries, processes, devices, or anything else that exposes the metrics that will be scraped by Prometheus. The metrics are available at the endpoint **/metrics** , which allows Prometheus to scrape them directly without needing an agent. The tutorial in this article uses **node_exporter** to expose the target hosts' hardware and operating system metrics. Exporters' outputs are plaintext and highly readable, which is one of Prometheus' strengths. - -In addition, you can configure [Grafana][5] to use Prometheus as a backend to provide data visualization and dashboarding functions. - -### Making sense of Prometheus' configuration file - -The number of seconds between when **/metrics** is scraped controls the granularity of the time-series database. This is defined in the configuration file as the **scrape_interval** parameter, which by default is set to 60 seconds. - -Targets are set for each scrape job in the **scrape_configs** section. Each job has its own name and a set of labels that can help filter, categorize, and make it easier to identify the target. One job can have many targets. - -### Installing Prometheus - -In this tutorial, for simplicity, we will install a Prometheus server and **node_exporter** with docker. Docker should already be installed and configured properly on your system. For a more in-depth, automated method, I recommend Steve Ovens' article [How to use Ansible to set up system monitoring with Prometheus][6]. - -Before starting, create the Prometheus configuration file **prometheus.yml** in your work directory as follows: - -``` -global: -  scrape_interval:      15s -  evaluation_interval: 15s - -scrape_configs: -  - job_name: 'prometheus' - -        static_configs: -        - targets: ['localhost:9090'] - -  - job_name: 'webservers' - -        static_configs: -        - targets: [':9100'] -``` - -Start Prometheus with Docker by running the following command: - -``` -$ sudo docker run -d -p 9090:9090 -v -/path/to/prometheus.yml:/etc/prometheus/prometheus.yml -prom/prometheus -``` - -By default, the Prometheus server will use port 9090. If this port is already in use, you can change it by adding the parameter **\--web.listen-address=" :"** at the end of the previous command. - -In the machine you want to monitor, download and run the **node_exporter** container by using the following command: - -``` -$ sudo docker run -d -v "/proc:/host/proc" -v "/sys:/host/sys" -v -"/:/rootfs" --net="host" prom/node-exporter --path.procfs -/host/proc --path.sysfs /host/sys --collector.filesystem.ignored- -mount-points "^/(sys|proc|dev|host|etc)($|/)" -``` - -For the purposes of this learning exercise, you can install **node_exporter** and Prometheus on the same machine. Please note that it's not wise to run **node_exporter** under Docker in production—this is for testing purposes only. - -To verify that **node_exporter** is running, open your browser and navigate to **http:// :9100/metrics**. All the metrics collected will be displayed; these are the same metrics Prometheus will scrape. - -![](https://opensource.com/sites/default/files/uploads/check-node_exporter.png) - -To verify the Prometheus server installation, open your browser and navigate to . - -You should see the Prometheus interface. Click on **Status** and then **Targets**. Under State, you should see your machines listed as **UP**. - -![](https://opensource.com/sites/default/files/uploads/targets-up.png) - -### Using Prometheus queries - -It's time to get familiar with [PromQL][7], Prometheus' query syntax, and its graphing web interface. Go to **** on your Prometheus server. You will see a query editor and two tabs: Graph and Console. - -Prometheus stores all data as time series, identifying each one with a metric name. For example, the metric **node_filesystem_avail_bytes** shows the available filesystem space. The metric's name can be used in the expression box to select all of the time series with this name and produce an instant vector. If desired, these time series can be filtered using selectors and labels—a set of key-value pairs—for example: - -``` -node_filesystem_avail_bytes{fstype="ext4"} -``` - -When filtering, you can match "exactly equal" ( **=** ), "not equal" ( **!=** ), "regex-match" ( **=~** ), and "do not regex-match" ( **!~** ). The following examples illustrate this: - -To filter **node_filesystem_avail_bytes** to show both ext4 and XFS filesystems: - -``` -node_filesystem_avail_bytes{fstype=~"ext4|xfs"} -``` - -To exclude a match: - -``` -node_filesystem_avail_bytes{fstype!="xfs"} -``` - -You can also get a range of samples back from the current time by using square brackets. You can use **s** to represent seconds, **m** for minutes, **h** for hours, **d** for days, **w** for weeks, and **y** for years. When using time ranges, the vector returned will be a range vector. - -For example, the following command produces the samples from five minutes to the present: - -``` -node_memory_MemAvailable_bytes[5m] -``` - -Prometheus also includes functions to allow advanced queries, such as this: - -``` -100 core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated (1 - avg by(instance)(irate(node_cpu_seconds_total{job='webservers',mode='idle'}[5m]))) -``` - -Notice how the labels are used to filter the job and the mode. The metric **node_cpu_seconds_total** returns a counter, and the **irate()** function calculates the per-second rate of change based on the last two data points of the range interval (meaning the range can be smaller than five minutes). To calculate the overall CPU usage, you can use the idle mode of the **node_cpu_seconds_total** metric. The idle percent of a processor is the opposite of a busy processor, so the **irate** value is subtracted from 1. To make it a percentage, multiply it by 100. - -![](https://opensource.com/sites/default/files/uploads/cpu-usage.png) - -### Learn more - -Prometheus is a powerful, scalable, lightweight, and easy to use and deploy monitoring tool that is indispensable for every system administrator and developer. For these and other reasons, many companies are implementing Prometheus as part of their infrastructure. - -To learn more about Prometheus and its functions, I recommend the following resources: - -+ About [PromQL][8] -+ What [node_exporters collects][9] -+ [Prometheus functions][10] -+ [4 open source monitoring tools][11] -+ [Now available: The open source guide to DevOps monitoring tools][12] - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/introduction-prometheus - -作者:[Michael Zamot][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/mzamot -[b]: https://github.com/lujun9972 -[1]: https://prometheus.io/ -[2]: https://www.cncf.io/ -[3]: https://prometheus.io/docs/alerting/alertmanager/ -[4]: https://en.wikipedia.org/wiki/PagerDuty -[5]: https://grafana.com/ -[6]: https://opensource.com/article/18/3/how-use-ansible-set-system-monitoring-prometheus -[7]: https://prometheus.io/docs/prometheus/latest/querying/basics/ -[8]: https://prometheus.io/docs/prometheus/latest/querying/basics/ -[9]: https://github.com/prometheus/node_exporter#collectors -[10]: https://prometheus.io/docs/prometheus/latest/querying/functions/ -[11]: https://opensource.com/article/18/8/open-source-monitoring-tools -[12]: https://opensource.com/article/18/8/now-available-open-source-guide-devops-monitoring-tools diff --git a/sources/tech/20181222 How to detect automatically generated emails.md b/sources/tech/20181222 How to detect automatically generated emails.md deleted file mode 100644 index 23b509a77b..0000000000 --- a/sources/tech/20181222 How to detect automatically generated emails.md +++ /dev/null @@ -1,144 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to detect automatically generated emails) -[#]: via: (https://arp242.net/weblog/autoreply.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -How to detect automatically generated emails -====== - -### How to detect automatically generated emails - - -When you send out an auto-reply from an email system you want to take care to not send replies to automatically generated emails. At best, you will get a useless delivery failure. At words, you will get an infinite email loop and a world of chaos. - -Turns out that reliably detecting automatically generated emails is not always easy. Here are my observations based on writing a detector for this and scanning about 100,000 emails with it (extensive personal archive and company archive). - -### Auto-submitted header - -Defined in [RFC 3834][1]. - -This is the ‘official’ standard way to indicate your message is an auto-reply. You should **not** send a reply if `Auto-Submitted` is present and has a value other than `no`. - -### X-Auto-Response-Suppress header - -Defined [by Microsoft][2] - -This header is used by Microsoft Exchange, Outlook, and perhaps some other products. Many newsletters and such also set this. You should **not** send a reply if `X-Auto-Response-Suppress` contains `DR` (“Suppress delivery reports”), `AutoReply` (“Suppress auto-reply messages other than OOF notifications”), or `All`. - -### List-Id and List-Unsubscribe headers - -Defined in [RFC 2919][3] - -You usually don’t want to send auto-replies to mailing lists or news letters. Pretty much all mail lists and most newsletters set at least one of these headers. You should **not** send a reply if either of these headers is present. The value is unimportant. - -### Feedback-ID header - -Defined [by Google][4]. - -Gmail uses this header to identify mail newsletters, and uses it to generate statistics/reports for owners of those newsletters. You should **not** send a reply if this headers is present; the value is unimportant. - -### Non-standard ways - -The above methods are well-defined and clear (even though some are non-standard). Unfortunately some email systems do not use any of them :-( Here are some additional measures. - -#### Precedence header - -Not really defined anywhere, mentioned in [RFC 2076][5] where its use is discouraged (but this header is commonly encountered). - -Note that checking for the existence of this field is not recommended, as some ails use `normal` and some other (obscure) values (this is not very common though). - -My recommendation is to **not** send a reply if the value case-insensitively matches `bulk`, `auto_reply`, or `list`. - -#### Other obscure headers - -A collection of other (somewhat obscure) headers I’ve encountered. I would recommend **not** sending an auto-reply if one of these is set. Most mails also set one of the above headers, but some don’t (but it’s not very common). - - * `X-MSFBL`; can’t really find a definition (Microsoft header?), but I only have auto-generated mails with this header. - - * `X-Loop`; not really defined anywhere, and somewhat rare, but sometimes it’s set. It’s most often set to the address that should not get emails, but `X-Loop: yes` is also encountered. - - * `X-Autoreply`; fairly rare, and always seems to have a value of `yes`. - - - - -#### Email address - -Check if the `From` or `Reply-To` headers contains `noreply`, `no-reply`, or `no_reply` (regex: `^no.?reply@`). - -#### HTML only - -If an email only has a HTML part, but no text part it’s a good indication this is an auto-generated mail or newsletter. Pretty much all mail clients also set a text part. - -#### Delivery failures - -Many delivery failure messages don’t really indicate that they’re failures. Some ways to check this: - - * `From` contains `mailer-daemon` or `Mail Delivery Subsystem` - - - -Many mail libraries leave some sort of footprint, and most regular mail clients override this with their own data. Checking for this seems to work fairly well. - - * `X-Mailer: Microsoft CDO for Windows 2000` – Set by some MS software; I can only find it on autogenerated mails. Yes, it’s still used in 2015. - - * `Message-ID` header contains `.JavaMail.` – I’ve found a few (5 on 50k) regular messages with this, but not many; the vast majority (thousends) of messages are news-letters, order confirmations, etc. - - * `^X-Mailer` starts with `PHP`. This should catch both `X-Mailer: PHP/5.5.0` and `X-Mailer: PHPmailer blah blah`. The same as `JavaMail` applies. - - * `X-Library` presence; only [Indy][6] seems to set this. - - * `X-Mailer` starts with `wdcollect`. Set by some Plesk mails. - - * `X-Mailer` starts with `MIME-tools`. - - - - -### Final precaution: limit the number of replies - -Even when following all of the above advice, you may still encounter an email program that will slip through. This can very dangerous, as email systems that simply `IF email THEN send_email` have the potential to cause infinite email loops. - -For this reason, I recommend keeping track of which emails you’ve sent an autoreply to and rate limiting this to at most n emails in n minutes. This will break the back-and-forth chain. - -We use one email per five minutes, but something less strict will probably also work well. - -### What you need to set on your auto-response - -The specifics for this will vary depending on what sort of mails you’re sending. This is what we use for auto-reply mails: - -``` -Auto-Submitted: auto-replied -X-Auto-Response-Suppress: All -Precedence: auto_reply -``` - -### Feedback - -You can mail me at [martin@arp242.net][7] or [create a GitHub issue][8] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/autoreply.html - -作者:[Martin Tournoij][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://arp242.net/ -[b]: https://github.com/lujun9972 -[1]: http://tools.ietf.org/html/rfc3834 -[2]: https://msdn.microsoft.com/en-us/library/ee219609(v=EXCHG.80).aspx -[3]: https://tools.ietf.org/html/rfc2919) -[4]: https://support.google.com/mail/answer/6254652?hl=en -[5]: http://www.faqs.org/rfcs/rfc2076.html -[6]: http://www.indyproject.org/index.en.aspx -[7]: mailto:martin@arp242.net -[8]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/sources/tech/20181229 Some nonparametric statistics math.md b/sources/tech/20181229 Some nonparametric statistics math.md new file mode 100644 index 0000000000..452c295781 --- /dev/null +++ b/sources/tech/20181229 Some nonparametric statistics math.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some nonparametric statistics math) +[#]: via: (https://jvns.ca/blog/2018/12/29/some-initial-nonparametric-statistics-notes/) +[#]: author: (Julia Evans https://jvns.ca/) + +Some nonparametric statistics math +====== + +I’m trying to understand nonparametric statistics a little more formally. This post may not be that intelligible because I’m still pretty confused about nonparametric statistics, there is a lot of math, and I make no attempt to explain any of the math notation. I’m working towards being able to explain this stuff in a much more accessible way but first I would like to understand some of the math! + +There’s some MathJax in this post so the math may or may not render in an RSS reader. + +Some questions I’m interested in: + + * what is nonparametric statistics exactly? + * what guarantees can we make? are there formulas we can use? + * why do methods like the bootstrap method work? + + + +since these notes are from reading a math book and math books are extremely dense this is basically going to be “I read 7 pages of this math book and here are some points I’m confused about” + +### what’s nonparametric statistics? + +Today I’m looking at “all of nonparametric statistics” by Larry Wasserman. He defines nonparametric inference as: + +> a set of modern statistical methods that aim to keep the number of underlying assumptions as weak as possible + +Basically my interpretation of this is that – instead of assuming that your data comes from a specific family of distributions (like the normal distribution) and then trying to estimate the paramters of that distribution, you don’t make many assumptions about the distribution (“this is just some data!!“). Not having to make assumptions is nice! + +There aren’t **no** assumptions though – he says + +> we assume that the distribution $F$ lies in some set $\mathfrak{F}$ called a **statistical model**. For example, when estimating a density $f$, we might assume that $$ f \in \mathfrak{F} = \left\\{ g : \int(g^{\prime\prime}(x))^2dx \leq c^2 \right\\}$$ which is the set of densities that are not “too wiggly”. + +I have not too much intuition for the condition $\int(g^{\prime\prime}(x))^2dx \leq c^2$. I calculated that integral for [the normal distribution on wolfram alpha][1] and got 4, which is a good start. (4 is not infinity!) + +some questions I still have about this definition: + + * what’s an example of a probability density function that _doesn’t_ satisfy that $\int(g^{\prime\prime}(x))^2dx \leq c^2$ condition? (probably something with an infinite number of tiny wiggles, and I don’t think any distribution i’m interested in in practice would have an infinite number of tiny wiggles?) + * why does the density function being “too wiggly” cause problems for nonparametric inference? very unclear as yet. + + + +### we still have to assume independence + +One assumption we **won’t** get away from is that the samples in the data we’re dealing with are independent. Often data in the real world actually isn’t really independent, but I think the what people do a lot of the time is to make a good effort at something approaching independence and then close your eyes and pretend it is? + +### estimating the density function + +Okay! Here’s a useful section! Let’s say that I have 100,000 data points from a distribution. I can draw a histogram like this of those data points: + +![][2] + +If I have 100,000 data points, it’s pretty likely that that histogram is pretty close to the actual distribution. But this is math, so we should be able to make that statement precise, right? + +For example suppose that 5% of the points in my sample are more than 100. Is the probability that a point is greater than 100 **actually** 0.05? The book gives a nice formula for this: + +$$ \mathbb{P}(|\widehat{P}_n(A) - P(A)| > \epsilon ) \leq 2e^{-2n\epsilon^2} $$ + +(by [“Hoeffding’s inequality”][3] which I’ve never heard of before). Fun aside about that inequality: here’s a nice jupyter notebook by henry wallace using it to [identify the most common Boggle words][4]. + +here, in our example: + + * n is 1000 (the number of data points we have) + * $A$ is the set of points more than 100 + * $\widehat{P}_n(A)$ is the empirical probability that a point is more than 100 (0.05) + * $P(A)$ is the actual probability + * $\epsilon$ is how certain we want to be that we’re right + + + +So, what’s the probability that the **real** probability is between 0.04 and 0.06? $\epsilon = 0.01$, so it’s $2e^{-2 \times 100,000 \times (0.01)^2} = 4e^{-9} $ ish (according to wolfram alpha) + +here is a table of how sure we can be: + + * 100,000 data points: 4e-9 (TOTALLY CERTAIN that 4% - 6% of points are more than 100) + * 10,000 data points: 0.27 (27% probability that we’re wrong! that’s… not bad?) + * 1,000 data points: 1.6 (we know the probability we’re wrong is less than.. 160%? that’s not good!) + * 100 data points: lol + + + +so basically, in this case, using this formula: 100,000 data points is AMAZING, 10,000 data points is pretty good, and 1,000 is much less useful. If we have 1000 data points and we see that 5% of them are more than 100, we DEFINITELY CANNOT CONCLUDE that 4% to 6% of points are more than 100. But (using the same formula) we can use $\epsilon = 0.04$ and conclude that with 92% probability 1% to 9% of points are more than 100. So we can still learn some stuff from 1000 data points! + +This intuitively feels pretty reasonable to me – like it makes sense to me that if you have NO IDEA what your distribution that with 100,000 points you’d be able to make quite strong inferences, and that with 1000 you can do a lot less! + +### more data points are exponentially better? + +One thing that I think is really cool about this estimating the density function formula is that how sure you can be of your inferences scales **exponentially** with the size of your dataset (this is the $e^{-n\epsilon^2}$). And also exponentially with the square of how sure you want to be (so wanting to be sure within 0.01 is VERY DIFFERENT than within 0.04). So 100,000 data points isn’t 10x better than 10,000 data points, it’s actually like 10000000000000x better. + +Is that true in other places? If so that seems like a super useful intuition! I still feel pretty uncertain about this, but having some basic intuition about “how much more useful is 10,000 data points than 1,000 data points?“) feels like a really good thing. + +### some math about the bootstrap + +The next chapter is about the bootstrap! Basically the way the bootstrap works is: + + 1. you want to estimate some statistic (like the median) of your distribution + 2. the bootstrap lets you get an estimate and also the variance of that estimate + 3. you do this by repeatedly sampling with replacement from your data and then calculating the statistic you want (like the median) on your samples + + + +I’m not going to go too much into how to implement the bootstrap method because it’s explained in a lot of place on the internet. Let’s talk about the math! + +I think in order to say anything meaningful about bootstrap estimates I need to learn a new term: a **consistent estimator**. + +### What’s a consistent estimator? + +Wikipedia says: + +> In statistics, a **consistent estimator** or **asymptotically consistent estimator** is an estimator — a rule for computing estimates of a parameter $\theta_0$ — having the property that as the number of data points used increases indefinitely, the resulting sequence of estimates converges in probability to $\theta_0$. + +This includes some terms where I forget what they mean (what’s “converges in probability” again?). But this seems like a very good thing! If I’m estimating some parameter (like the median), I would DEFINITELY LIKE IT TO BE TRUE that if I do it with an infinite amount of data then my estimate works. An estimator that is not consistent does not sound very useful! + +### why/when are bootstrap estimators consistent? + +spoiler: I have no idea. The book says the following: + +> Consistency of the boostrap can now be expressed as follows. +> +> **3.19 Theorem**. Suppose that $\mathbb{E}(X_1^2) < \infty$. Let $T_n = g(\overline{X}_n)$ where $g$ is continuously differentiable at $\mu = \mathbb{E}(X_1)$ and that $g\prime(\mu) \neq 0$. Then, +> +> $$ \sup_u | \mathbb{P}_{\widehat{F}_n} \left( \sqrt{n} (T( \widehat{F}_n*) - T( \widehat{F}_n) \leq u \right) - \mathbb{P}_{\widehat{F}} \left( \sqrt{n} (T( \widehat{F}_n) - T( \widehat{F}) \leq u \right) | \rightarrow^\text{a.s.} 0 $$ +> +> **3.21 Theorem**. Suppose that $T(F)$ is Hadamard differentiable with respect to $d(F,G)= sup_x|F(x)-G(x)|$ and that $0 < \int L^2_F(x) dF(x) < \infty$. Then, +> +> $$ \sup_u | \mathbb{P}_{\widehat{F}_n} \left( \sqrt{n} (T( \widehat{F}_n*) - T( \widehat{F}_n) \leq u \right) - \mathbb{P}_{\widehat{F}} \left( \sqrt{n} (T( \widehat{F}_n) - T( \widehat{F}) \leq u \right) | \rightarrow^\text{P} 0 $$ + +things I understand about these theorems: + + * the two formulas they’re concluding are the same, except I think one is about convergence “almost surely” and one about “convergence in probability”. I don’t remember what either of those mean. + * I think for our purposes of doing Regular Boring Things we can replace “Hadamard differentiable” with “differentiable” + * I think they don’t actually show the consistency of the bootstrap, they’re actually about consistency of the bootstrap confidence interval estimate (which is a different thing) + + + +I don’t really understand how they’re related to consistency, and in particular the $\sup_u$ thing is weird, like if you’re looking at $\mathbb{P}(something < u)$, wouldn’t you want to minimize $u$ and not maximize it? Maybe it’s a typo and it should be $\inf_u$? + +it concludes: + +> there is a tendency to treat the bootstrap as a panacea for all problems. But the bootstrap requires regularity conditions to yield valid answers. It should not be applied blindly. + +### this book does not seem to explain why the bootstrap is consistent + +In the appendix (3.7) it gives a sketch of a proof for showing that estimating the **median** using the bootstrap is consistent. I don’t think this book actually gives a proof anywhere that bootstrap estimates in general are consistent, which was pretty surprising to me. It gives a bunch of references to papers. Though I guess bootstrap confidence intervals are the most important thing? + +### that’s all for now + +This is all extremely stream of consciousness and I only spent 2 hours trying to work through this, but some things I think I learned in the last couple hours are: + + 1. maybe having more data is exponentially better? (is this true??) + 2. “consistency” of an estimator is a thing, not all estimators are consistent + 3. understanding when/why nonparametric bootstrap estimators are consistent in general might be very hard (the proof that the bootstrap median estimator is consistent already seems very complicated!) + 4. boostrap confidence intervals are not the same thing as bootstrap estimators. Maybe I’ll learn the difference next! + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2018/12/29/some-initial-nonparametric-statistics-notes/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.wolframalpha.com/input/?i=integrate+(d%2Fdx(d%2Fdx(exp(-x%5E2))))%5E2++dx+from+x%3D-infinity+to+infinity +[2]: https://jvns.ca/images/nonpar-histogram.png +[3]: https://en.wikipedia.org/wiki/Hoeffding%27s_inequality +[4]: https://nbviewer.jupyter.org/github/henrywallace/games/blob/master/boggle/boggle.ipynb#Estimating-Word-Probabilities diff --git a/sources/tech/20190129 A few early marketing thoughts.md b/sources/tech/20190129 A few early marketing thoughts.md new file mode 100644 index 0000000000..79cc6b1b1d --- /dev/null +++ b/sources/tech/20190129 A few early marketing thoughts.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A few early marketing thoughts) +[#]: via: (https://jvns.ca/blog/2019/01/29/marketing-thoughts/) +[#]: author: (Julia Evans https://jvns.ca/) + +A few early marketing thoughts +====== + +At some point last month I said I might write more about business, so here are some very early marketing thoughts for my zine business (!). The question I’m trying to make some progress on in this post is: “how to do marketing in a way that feels good?” + +### what’s the point of marketing? + +Okay! What’s marketing? What’s the point? I think the ideal way marketing works is: + + 1. you somehow tell a person about a thing + 2. you explain somehow why the thing will be useful to them / why it is good + 3. they buy it and they like the thing because it’s what they expected + + + +(or, when you explain it they see that they don’t want it and don’t buy it which is good too!!) + +So basically as far as I can tell good marketing is just explaining what the thing is and why it is good in a clear way. + +### what internet marketing techniques do people use? + +I’ve been thinking a bit about internet marketing techniques I see people using on me recently. Here are a few examples of internet marketing techniques I’ve seen: + + 1. word of mouth (“have you seen this cool new thing?!”) + 2. twitter / instagram marketing (build a twitter/instagram account) + 3. email marketing (“build a mailing list with a bajillion people on it and sell to them”) + 4. email marketing (“tell your existing users about features that they already have that they might want to use”) + 5. social proof marketing (“jane from georgia bought a sweater”), eg fomo.com + 6. cart notifications (“you left this sweater in your cart??! did you mean to buy it? maybe you should buy it!“) + 7. content marketing (which is fine but whenever people refer to my writing as ‘content’ I get grumpy :)) + + + +### you need _some_ way to tell people about your stuff + +Something that is definitely true about marketing is that you need some way to tell new people about the thing you are doing. So for me when I’m thinking about running a business it’s less about “should i do marketing” and more like “well obviously i have to do marketing, how do i do it in a way that i feel good about?” + +### what’s up with email marketing? + +I feel like every single piece of internet marketing advice I read says “you need a mailing list”. This is advice that I haven’t really taken to heart – technically I have 2 mailing lists: + + 1. the RSS feed for this blog, which sends out new blog posts to a mailing list for folks who don’t use RSS (which 3000 of you get) + 2. ’s list, for comics / new zine announcements (780 people subscribe to that! thank you!) + + + +but definitely neither of them is a Machine For Making Sales and I’ve put in almost no efforts in that direction yet. + +here are a few things I’ve noticed about marketing mailing lists: + + * most marketing mailing lists are boring but some marketing mailing lists are actually interesting! For example I kind of like [amy hoy][1]’s emails. + * Someone told me recently that they have 200,000 people on their mailing list (?!!) which made the “a mailing list is a machine for making money” concept make a lot more sense to me. I wonder if people who make a lot of money from their mailing lists all have huge 10k+ person mailing lists like this? + + + +### what works for me: twitter + +Right now for my zines business I’d guess maybe 70% of my sales come from Twitter. The main thing I do is tweet pages from zines I’m working on (for example: yesterday’s [comic about ss][2]). The comics are usually good and fun so invariably they get tons of retweets, which means that I end up with lots of followers, which means that when I later put up the zine for sale lots of people will buy it. + +And of course people don’t _have_ to buy the zines, I post most of what ends up in my zines on twitter for free, so it feels like a nice way to do it. Everybody wins, I think. + +(side note: when I started getting tons of new followers from my comics I was actually super worried that it would make my experience of Twitter way worse. That hasn’t happened! the new followers all seem totally reasonable and I still get a lot of really interesting twitter replies which is wonderful ❤) + +I don’t try to hack/optimize this really: I just post comics when I make them and I try to make them good. + +### a small Twitter innovation: putting my website on the comics + +Here’s one small marketing change that I made that I think makes sense! + +In the past, I didn’t put anything about how to buy my comics on the comics I posted on Twitter, just my Twitter username. Like this: + +![][3] + +After a while, I realized people were asking me all the time “hey, can I buy a book/collection? where do these come from? how do I get more?“! I think a marketing secret is “people actually want to buy things that are good, it is useful to tell people where they can buy things that are good”. + +So just recently I’ve started adding my website and a note about my current project on the comics I post on Twitter. It doesn’t say much: just “❤ these comics? buy a collection! wizardzines.com” and “page 11 of my upcoming bite size networking zine”. Here’s what it looks like: + +![][4] + +I feel like this strikes a pretty good balance between “julia you need to tell people what you’re doing otherwise how are they supposed to buy things from you” and “omg too many sales pitches everywhere”? I’ve only started doing this recently so we’ll see how it goes. + +### should I work on a mailing list? + +It seems like the same thing that works on twitter would work by email if I wanted to put in the time (email people comics! when a zine comes out, email them about the zine and they can buy it if they want!). + +One thing I LOVE about Twitter though is that people always reply to the comics I post with their own tips and tricks that they love and I often learn something new. I feel like email would be nowhere near as fun :) + +But I still think this is a pretty good idea: keeping up with twitter can be time consuming and I bet a lot of people would like to get occasional email with programming drawings. (would you?) + +One thing I’m not sure about is – a lot of marketing mailing lists seem to use somewhat aggressive techniques to get new emails (a lot of popups on a website, or adding everyone who signs up to their service / buys a thing to a marketing list) and while I’m basically fine with that (unsubscribing is easy!), I’m not sure that it’s what I’d want to do, and maybe less aggressive techniques will work just as well? We’ll see. + +### should I track conversion rates? + +A piece of marketing advice I assume people give a lot is “be data driven, figure out what things convert the best, etc”. I don’t do this almost at all – gumroad used to tell me that most of my sales came from Twitter which was good to know, but right now I have basically no idea how it works. + +Doing a bunch of work to track conversion rates feels bad to me: it seems like it would be really easy to go down a dumb rabbit hole of “oh, let’s try to increase conversion by 5%” instead of just focusing on making really good and cool things. + +My guess is that what will work best for me for a while is to have some data that tells me in broad strokes how the business works (like “about 70% of sales come from twitter”) and just leave it at that. + +### should I do advertising? + +I had a conversation with Kamal about this post that went: + + * julia: “hmm, maybe I should talk about ads?” + * julia: “wait, are ads marketing?” + * kamal: “yes ads are marketing” + + + +So, ads! I don’t know anything about advertising except that you can advertise on Facebook or Twitter or Google. Some non-ethical questions I have about advertising: + + * how do you choose what keywords to advertise on? + * are there actually cheap keywords, like is ‘file descriptors’ cheap? + * how much do you need to pay per click? (for some weird linux keywords, google estimated 20 cents a click?) + * can you use ads effectively for something that costs $10? + + + +This seems nontrivial to learn about and I don’t think I’m going to try soon. + +### other marketing things + +a few other things I’ve thought about: + + * I learned about “social proof marketing” sites like fomo.com yesterday which makes popups on your site like “someone bought COOL THING 3 hours ago”. This seems like it has some utility (people are actually buying things from me all the time, maybe that’s useful to share somehow?) but those popups feel a bit cheap to me and I don’t really think it’s something I’d want to do right now. + * similarly a lot of sites like to inject these popups like “HELLO PLEASE SIGN UP FOR OUR MAILING LIST”. similar thoughts. I’ve been putting an email signup link in the footer which seems like a good balance between discoverable and annoying. As an example of a popup which isn’t too intrusive, though: nate berkopec has [one on his site][5] which feels really reasonable! (scroll to the bottom to see it) + + + +Maybe marketing is all about “make your things discoverable without being annoying”? :) + +### that’s all! + +Hopefully some of this was interesting! Obviously the most important thing in all of this is to make cool things that are useful to people, but I think cool useful writing does not actually sell itself! + +If you have thoughts about what kinds of marketing have worked well for you / you’ve felt good about I would love to hear them! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/01/29/marketing-thoughts/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://stackingthebricks.com/ +[2]: https://twitter.com/b0rk/status/1090058524137345025 +[3]: https://jvns.ca/images/kill.jpeg +[4]: https://jvns.ca/images/ss.jpeg +[5]: https://www.speedshop.co/2019/01/10/three-activerecord-mistakes.html diff --git a/sources/tech/20190129 Create an online store with this Java-based framework.md b/sources/tech/20190129 Create an online store with this Java-based framework.md deleted file mode 100644 index b72a8551de..0000000000 --- a/sources/tech/20190129 Create an online store with this Java-based framework.md +++ /dev/null @@ -1,235 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Create an online store with this Java-based framework) -[#]: via: (https://opensource.com/article/19/1/scipio-erp) -[#]: author: (Paul Piper https://opensource.com/users/madppiper) - -Create an online store with this Java-based framework -====== -Scipio ERP comes with a large range of applications and functionality. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0) - -So you want to sell products or services online, but either can't find a fitting software or think customization would be too costly? [Scipio ERP][1] may just be what you are looking for. - -Scipio ERP is a Java-based open source e-commerce framework that comes with a large range of applications and functionality. The project was forked from [Apache OFBiz][2] in 2014 with a clear focus on better customization and a more modern appeal. The e-commerce component is quite extensive and works in a multi-store setup, internationally, and with a wide range of product configurations, and it's also compatible with modern HTML frameworks. The software also provides standard applications for many other business cases, such as accounting, warehouse management, or sales force automation. It's all highly standardized and therefore easy to customize, which is great if you are looking for more than a virtual cart. - -The system makes it very easy to keep up with modern web standards, too. All screens are constructed using the system's "[templating toolkit][3]," an easy-to-learn macro set that separates HTML from all applications. Because of it, every application is already standardized to the core. Sounds confusing? It really isn't—it all looks a lot like HTML, but you write a lot less of it. - -### Initial setup - -Before you get started, make sure you have Java 1.8 (or greater) SDK and a Git client installed. Got it? Great! Next, check out the master branch from GitHub: - -``` -git clone https://github.com/ilscipio/scipio-erp.git -cd scipio-erp -git checkout master -``` - -To set up the system, simply run **./install.sh** and select either option from the command line. Throughout development, it is best to stick to an **installation for development** (Option 1), which will also install a range of demo data. For professional installations, you can modify the initial config data ("seed data") so it will automatically set up the company and catalog data for you. By default, the system will run with an internal database, but it [can also be configured][4] with a wide range of relational databases such as PostgreSQL and MariaDB. - -![Setup wizard][6] - -Follow the setup wizard to complete your initial configuration, - -Start the system with **./start.sh** and head over to **** to complete the configuration. If you installed with demo data, you can log in with username **admin** and password **scipio**. During the setup wizard, you can set up a company profile, accounting, a warehouse, your product catalog, your online store, and additional user profiles. Keep the website entries on the product store configuration screen for now. The system allows you to run multiple webstores with different underlying code; unless you want to do that, it is easiest to stick to the defaults. - -Congratulations, you just installed Scipio ERP! Play around with the screens for a minute or two to get a feel for the functionality. - -### Shortcuts - -Before you jump into the customization, here are a few handy commands that will help you along the way: - - * Create a shop-override: **./ant create-component-shop-override** - * Create a new component: **./ant create-component** - * Create a new theme component: **./ant create-theme** - * Create admin user: **./ant create-admin-user-login** - * Various other utility functions: **./ant -p** - * Utility to install & update add-ons: **./git-addons help** - - - -Also, make a mental note of the following locations: - - * Scripts to run Scipio as a service: **/tools/scripts/** - * Log output directory: **/runtime/logs** - * Admin application: **** - * E-commerce application: **** - - - -Last, Scipio ERP structures all code in the following five major directories: - - * Framework: framework-related sources, the application server, generic screens, and configurations - * Applications: core applications - * Addons: third-party extensions - * Themes: modifies the look and feel - * Hot-deploy: your own components - - - -Aside from a few configurations, you will be working within the hot-deploy and themes directories. - -### Webstore customizations - -To really make the system your own, start thinking about [components][7]. Components are a modular approach to override, extend, and add to the system. Think of components as self-contained web modules that capture information on databases ([entity][8]), functions ([services][9]), screens ([views][10]), [events and actions][11], and web applications. Thanks to components, you can add your own code while remaining compatible with the original sources. - -Run **./ant create-component-shop-override** and follow the steps to create your webstore component. A new directory will be created inside of the hot-deploy directory, which extends and overrides the original e-commerce application. - -![component directory structure][13] - -A typical component directory structure. - -Your component will have the following directory structure: - - * config: configurations - * data: seed data - * entitydef: database table definitions - * script: Groovy script location - * servicedef: service definitions - * src: Java classes - * webapp: your web application - * widget: screen definitions - - - -Additionally, the **ivy.xml** file allows you to add Maven libraries to the build process and the **ofbiz-component.xml** file defines the overall component and web application structure. Apart from the obvious, you will also find a **controller.xml** file inside the web apps' **WEB-INF** directory. This allows you to define request entries and connect them to events and screens. For screens alone, you can also use the built-in CMS functionality, but stick to the core mechanics first. Familiarize yourself with **/applications/shop/** before introducing changes. - -#### Adding custom screens - -Remember the [templating toolkit][3]? You will find it used on every screen. Think of it as a set of easy-to-learn macros that structure all content. Here's an example: - -``` -<@section title="Title"> -    <@heading id="slider">Slider -    <@row> -        <@cell columns=6> -            <@slider id="" class="" controls=true indicator=true> -                <@slide link="#" image="https://placehold.it/800x300">Just some content… -                <@slide title="This is a title" link="#" image="https://placehold.it/800x300"> -            -        -        <@cell columns=6>Second column -    - -``` - -Not too difficult, right? Meanwhile, themes contain the HTML definitions and styles. This hands the power over to your front-end developers, who can define the output of each macro and otherwise stick to their own build tools for development. - -Let's give it a quick try. First, define a request on your own webstore. You will modify the code for this. A built-in CMS is also available at **** , which allows you to create new templates and screens in a much more efficient way. It is fully compatible with the templating toolkit and comes with example templates that can be adopted to your preferences. But since we are trying to understand the system here, let's go with the more complicated way first. - -Open the **[controller.xml][14]** file inside of your shop's webapp directory. The controller keeps track of request events and performs actions accordingly. The following will create a new request under **/shop/test** : - -``` - - -      -      - -``` - -You can define multiple responses and, if you want, you could use an event or a service call inside the request to determine which response you may want to use. I opted for a response of type "view." A view is a rendered response; other types are request-redirects, forwards, and alike. The system comes with various renderers and allows you to determine the output later; to do so, add the following: - -``` - - -``` - -Replace **my-component** with your own component name. Then you can define your very first screen by adding the following inside the tags within the **widget/CommonScreens.xml** file: - -``` - -       
      -            -            -            -                -                    -                        -                    -                -            -       
      -   
      -``` - -Screens are actually quite modular and consist of multiple elements ([widgets, actions, and decorators][15]). For the sake of simplicity, leave this as it is for now, and complete the new webpage by adding your very first templating toolkit file. For that, create a new **webapp/mycomponent/test/test.ftl** file and add the following: - -``` -<@alert type="info">Success! -``` - -![Custom screen][17] - -A custom screen. - -Open **** and marvel at your own accomplishments. - -#### Custom themes - -Modify the look and feel of the shop by creating your very own theme. All themes can be found as components inside of the themes folder. Run **./ant create-theme** to add your own. - -![theme component layout][19] - -A typical theme component layout. - -Here's a list of the most important directories and files: - - * Theme configuration: **data/*ThemeData.xml** - * Theme-specific wrapping HTML: **includes/*.ftl** - * Templating Toolkit HTML definition: **includes/themeTemplate.ftl** - * CSS class definition: **includes/themeStyles.ftl** - * CSS framework: **webapp/theme-title/*** - - - -Take a quick look at the Metro theme in the toolkit; it uses the Foundation CSS framework and makes use of all the things above. Afterwards, set up your own theme inside your newly constructed **webapp/theme-title** directory and start developing. The Foundation-shop theme is a very simple shop-specific theme implementation that you can use as a basis for your own work. - -Voila! You have set up your own online store and are ready to customize! - -![Finished Scipio ERP shop][21] - -A finished shop based on Scipio ERP. - -### What's next? - -Scipio ERP is a powerful framework that simplifies the development of complex e-commerce applications. For a more complete understanding, check out the project [documentation][7], try the [online demo][22], or [join the community][23]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/scipio-erp - -作者:[Paul Piper][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/madppiper -[b]: https://github.com/lujun9972 -[1]: https://www.scipioerp.com -[2]: https://ofbiz.apache.org/ -[3]: https://www.scipioerp.com/community/developer/freemarker-macros/ -[4]: https://www.scipioerp.com/community/developer/installation-configuration/configuration/#database-configuration -[5]: /file/419711 -[6]: https://opensource.com/sites/default/files/uploads/setup_step5_sm.jpg (Setup wizard) -[7]: https://www.scipioerp.com/community/developer/architecture/components/ -[8]: https://www.scipioerp.com/community/developer/entities/ -[9]: https://www.scipioerp.com/community/developer/services/ -[10]: https://www.scipioerp.com/community/developer/views-requests/ -[11]: https://www.scipioerp.com/community/developer/events-actions/ -[12]: /file/419716 -[13]: https://opensource.com/sites/default/files/uploads/component_structure.jpg (component directory structure) -[14]: https://www.scipioerp.com/community/developer/views-requests/request-controller/ -[15]: https://www.scipioerp.com/community/developer/views-requests/screen-widgets-decorators/ -[16]: /file/419721 -[17]: https://opensource.com/sites/default/files/uploads/success_screen_sm.jpg (Custom screen) -[18]: /file/419726 -[19]: https://opensource.com/sites/default/files/uploads/theme_structure.jpg (theme component layout) -[20]: /file/419731 -[21]: https://opensource.com/sites/default/files/uploads/finished_shop_1_sm.jpg (Finished Scipio ERP shop) -[22]: https://www.scipioerp.com/demo/ -[23]: https://forum.scipioerp.com/ diff --git a/sources/tech/20190217 Organizing this blog into categories.md b/sources/tech/20190217 Organizing this blog into categories.md new file mode 100644 index 0000000000..e8a03f1bdd --- /dev/null +++ b/sources/tech/20190217 Organizing this blog into categories.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Organizing this blog into categories) +[#]: via: (https://jvns.ca/blog/2019/02/17/organizing-this-blog-into-categories/) +[#]: author: (Julia Evans https://jvns.ca/) + +Organizing this blog into categories +====== + +Today I organized the front page of this blog ([jvns.ca][1]) into CATEGORIES! Now it is actually possible to make some sense of what is on here!! There are 28 categories (computer networking! learning! “how things work”! career stuff! many more!) I am so excited about this. + +How it works: Every post is in only 1 category. Obviously the categories aren’t “perfect” (there is a “how things work” category and a “kubernetes” category and a “networking” category, and so for a “how container networking works in kubernetes” I need to just pick one) but I think it’s really nice and I’m hoping that it’ll make the blog easier for folks to navigate. + +If you’re interested in more of the story of how I’m thinking about this: I’ve been a little dissatisfied for a long time with how this blog is organized. Here’s where I started, in 2013, with a pretty classic blog layout (this is Octopress, which was a Jekyll Wordpress-lookalike theme that was cool back then and which served me very well for a long time): + +![][2] + +### problem with “show the 5 most recent posts”: you don’t know what the person’s writing is about! + +This is a super common way to organize a blog: on the homepage of your blog, you display maybe the 5 most recent posts, and then maybe have a “previous” link. + +The thing I find tricky about this (as a blog reader) is that + + 1. it’s hard to hunt through their back catalog to find cool things they’ve written + 2. it’s SO HARD to get an overall sense for the body of a person’s work by reading 1 blog post at a time + + + +### next attempt: show every post in chronological order + +My next attempt at blog organization was to show every post on the homepage in chronological order. This was inspired by [Dan Luu’s blog][3], which takes a super minimal approach. I switched to this (according to the internet archive) sometime in early 2016. Here’s what it looked like (with some CSS issues :)) + +![][4] + +The reason I like this “show every post in chronological order” approach more is that when I discover a new blog, I like to obsessively binge read through the whole thing to see all the cool stuff the person has written. [Rachel by the bay][5] also organizes her writing this way, and when I found her blog I was like OMG WOW THIS IS AMAZING I MUST READ ALL OF THIS NOW and being able to look through all the entries quickly and start reading ones that caught my eye was SO FUN. + +[Will Larson’s blog][6] also has a “list of all posts” page which I find useful because it’s a good blog, and sometimes I want to refer back to something he wrote months ago and can’t remember what it was called, and being able to scan through all the titles makes it easier to do that. + +I was pretty happy with this and that’s how it’s been for the last 3 years. + +### problem: a chronological list of 390 posts still kind of sucks + +As of today, I have 390 posts here (360,000 words! that’s, like, 4 300-page books! eep!). This is objectively a lot of writing and I would like people new to the blog to be able to navigate it and actually have some idea what’s going on. + +And this blog is not actually just a totally disorganized group of words! I have a lot of specific interests: I’ve written probably 30 posts about computer networking, 15ish on ML/statistics, 20ish career posts, etc. And when I write a new Kubernetes post or whatever, it’s usually at least sort of related to some ongoing train of thought I have about Kubernetes. And it’s totally obvious to _me_ what other posts that post is related to, but obviously to a new person it’s not at all clear what the trains of thought are in this blog. + +### solution for now: assign every post 1 (just 1) category + +My new plan is to assign every post a single category. I got this idea from [Itamar Turner-Trauring’s site][7]. + +Here are the initial categories: + + * Cool computer tools / features / ideas + * Computer networking + * How a computer thing works + * Kubernetes / containers + * Zines / comics + * On writing comics / zines + * Conferences + * Organizing conferences + * Businesses / marketing + * Statistics / machine learning / data analysis + * Year in review + * Infrastructure / operations engineering + * Career / work + * Working with others / communication + * Remote work + * Talks transcripts / podcasts + * On blogging / speaking + * On learning + * Rust + * Linux debugging / tracing tools + * Debugging stories + * Fan posts about awesome work by other people + * Inclusion + * rbspy + * Performance + * Open source + * Linux systems stuff + * Recurse Center (my daily posts during my RC batch) + + + +I guess you can tell this is a systems-y blog because there are 8 different systems-y categories (kubernetes, infrastructure, linux debugging tools, rust, debugging stories, performance, and linux systems stuff, how a computer thing works) :). + +But it was nice to see that I also have this huge career / work category! And that category is pretty meaningful to me, it includes a lot of things that I struggled with and were hard for me to learn. And I get to put all my machine learning posts together, which is an area I worked in for 3 years and am still super interested in and every so often learn a new thing about! + +### How I assign the categories: a big text file + +I came up with a scheme for assigning the categories that I thought was really fun! I knew immediately that coming up with categories in advance would be impossible (how was I supposed to know that “fan posts about awesome work by other people” was a substantial category?) + +So instead, I took kind of a Marie Kondo approach: I wrote a script to just dump all the titles of every blog post into a text file, and then I just used vim to organize them roughly into similar sections. Seeing everything in one place (a la marie kondo) really helped me see the patterns and figure out what some categories were. + +[Here’s the final result of that text file][8]. I think having a lightweight way of organizing the posts all in one file made a huge difference and that it would have been impossible for me to seen the patterns otherwise. + +### How I implemented it: a hugo taxonomy + +Once I had that big text file, I wrote [a janky python script][9] to assign the categories in that text file to the actual posts. + +I use Hugo for this blog, and so I also needed to tell Hugo about the categories. This blog already technically has tags (though they’re woefully underused, I didn’t want to delete them). I use Hugo, and it turns out that in Hugo you can define arbitrary taxonomies. So I defined a new taxonomy for these sections (right now it’s called, unimaginitively, `juliasections`). + +The details of how I did this are pretty boring but [here’s the hugo template that makes it display on the homepage][10]. I used this [Hugo documentation page on taxonomies a lot][11]. + +### organizing my site is cool! reverse chronology maybe isn’t the best possible thing! + +Amy Hoy has this interesting article called [how the blog broke the web][12] about how the rise of blog software made people adopt a site format that maybe didn’t serve what they were writing the best. + +I don’t personally feel that mad about the blog / reverse chronology organization: I like blogging! I think it was nice for the first 6 years or whatever to be able to just write things that I think are cool without thinking about where they “fit”. It’s worked really well for me. + +But today, 360,000 words in, I think it makes sense to add a little more structure :). + +### what it looks like now! + +Here’s what the new front page organization looks like! These are the blogging / learning / rust sections! I think it’s cool how you can see the evolution of some of my thinking (I sure have written a lot of posts about asking questions :)). + +![][13] + +### I ❤ the personal website + +This is also part of why I love having a personal website that I can organize any way I want: for both of my main sites ([jvns.ca][1] and now [wizardzines.com][14]) I have total control over how they appear! And I can evolve them over time at my own pace if I decide something a little different will work better for me. I’ve gone from a jekyll blog to octopress to a custom-designed octopress blog to Hugo and made a ton of little changes over time. It’s so nice. + +I think it’s fun that these 3 screenshots are each 3 years apart – what I wanted in 2013 is not the same as 2016 is not the same as 2019! This is okay! + +And I really love seeing how other people choose to organize their personal sites! Please keep making cool different personal sites. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/02/17/organizing-this-blog-into-categories/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca +[2]: https://jvns.ca/images/website-2013.png +[3]: https://danluu.com +[4]: https://jvns.ca/images/website-2016.png +[5]: https://rachelbythebay.com/w/ +[6]: https://lethain.com/all-posts/ +[7]: https://codewithoutrules.com/worklife/ +[8]: https://github.com/jvns/jvns.ca/blob/2f7b2723994628a5348069dd87b3df68c2f0285c/scripts/titles.txt +[9]: https://github.com/jvns/jvns.ca/blob/2f7b2723994628a5348069dd87b3df68c2f0285c/scripts/parse_titles.py +[10]: https://github.com/jvns/jvns.ca/blob/25d239a3ba36c1bae1d055d2b7d50a4f1d0489ef/themes/orange/layouts/index.html#L39-L59 +[11]: https://gohugo.io/templates/taxonomy-templates/ +[12]: https://stackingthebricks.com/how-blogs-broke-the-web/ +[13]: https://jvns.ca/images/website-2019.png +[14]: https://wizardzines.com diff --git a/sources/tech/20190218 Talk, then code.md b/sources/tech/20190218 Talk, then code.md index a4352ffdbf..18ed81e43c 100644 --- a/sources/tech/20190218 Talk, then code.md +++ b/sources/tech/20190218 Talk, then code.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (zianglei) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md deleted file mode 100644 index 4ba0580ece..0000000000 --- a/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]) -[#]: via: (https://itsfoss.com/install-virtualbox-ubuntu) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Install VirtualBox on Ubuntu [Beginner’s Tutorial] -====== - -**This beginner’s tutorial explains various ways to install VirtualBox on Ubuntu and other Debian-based Linux distributions.** - -Oracle’s free and open source offering [VirtualBox][1] is an excellent virtualization tool, specially for desktop operating systems. I prefer using it over [VMWare Workstation in Linux][2], another virtualization tool. - -You can use virtualization software like VirtualBox for installing and using another operating system within a virtual machine. - -For example, you can [install Linux on VirtualBox inside Windows][3]. Similarly, you can also [install Windows inside Linux using VirtualBox][4]. - -You can also use VirtualBox for installing another Linux distribution in your current Linux system. Actually, this is what I use it for. If I hear about a nice Linux distribution, instead of installing it on a real system, I test it on a virtual machine. It’s more convenient when you just want to try out a distribution before making a decision about installing it on your actual machine. - -![Linux installed inside Linux using VirtualBox][5]Ubuntu 18.10 installed inside Ubuntu 18.04 - -In this beginner’s tutorial, I’ll show you various ways of installing Oracle VirtualBox on Ubuntu and other Debian-based distributions. - -### Installing VirtualBox on Ubuntu and Debian based Linux distributions - -The installation methods mentioned here should also work for other Debian and Ubuntu-based Linux distributions such as Linux Mint, elementary OS etc. - -#### Method 1: Install VirtualBox from Ubuntu Repository - -**Pros** : Easy installation - -**Cons** : Installs older version - -The easiest way to install VirtualBox on Ubuntu would be to search for it in the Software Center and install it from there. - -![VirtualBox in Ubuntu Software Center][6]VirtualBox is available in Ubuntu Software Center - -You can also install it from the command line using the command: - -``` -sudo apt install virtualbox -``` - -However, if you [check the package version before installing it][7], you’ll see that the VirtualBox provided by Ubuntu’s repository is quite old. - -For example, the current VirtualBox version at the time of writing this tutorial is 6.0 but the one in Software Center is 5.2. This means you won’t get the newer features introduced in the [latest version of VirtualBox][8]. - -#### Method 2: Install VirtualBox using Deb file from Oracle’s website - -**Pros** : Easily install the latest version - -**Cons** : Can’t upgrade to newer version - -If you want to use the latest version of VirtualBox on Ubuntu, the easiest way would be to [use the deb file][9]. - -Oracle provides read to use binary files for VirtualBox releases. If you look at its download page, you’ll see the option to download the deb installer files for Ubuntu and other distributions. - -![VirtualBox Linux Download][10] - -You just have to download this deb file and double click on it to install it. It’s as simple as that. - -However, the problem with this method is that you won’t get automatically updated to the newer VirtualBox releases. The only way is to remove the existing version, download the newer version and install it again. That’s not very convenient, is it? - -#### Method 3: Install VirualBox using Oracle’s repository - -**Pros** : Automatically updates with system updates - -**Cons** : Slightly complicated installation - -Now this is the command line method and it may seem complicated to you but it has advantages over the previous two methods. You’ll get the latest version of VirtualBox and it will be automatically updated to the future releases. That’s what you would want, I presume. - -To install VirtualBox using command line, you add the Oracle VirtualBox’s repository in your list of repositories. You add its GPG key so that your system trusts this repository. Now when you install VirtualBox, it will be installed from Oracle’s repository instead of Ubuntu’s repository. If there is a new version released, VirtualBox install will be updated along with the system updates. Let’s see how to do that. - -First, add the key for the repository. You can download and add the key using this single command. - -``` -wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - -``` - -``` -Important for Mint users - -The next step will work for Ubuntu only. If you are using Linux Mint or some other distribution based on Ubuntu, replace $(lsb_release -cs) in the command with the Ubuntu version your current version is based on. For example, Linux Mint 19 series users should use bionic and Mint 18 series users should use xenial. Something like this - -sudo add-apt-repository “deb [arch=amd64] **bionic** contrib“ -``` - -Now add the Oracle VirtualBox repository in the list of repositories using this command: - -``` -sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" -``` - -If you have read my article on [checking Ubuntu version][11], you probably know that ‘lsb_release -cs’ will print the codename of your Ubuntu system. - -**Note** : If you see [add-apt-repository command not found][12] error, you’ll have to install software-properties-common package. - -Now that you have the correct repository added, refresh the list of available packages through these repositories and install VirtualBox. - -``` -sudo apt update && sudo apt install virtualbox-6.0 -``` - -**Tip** : A good idea would be to type sudo apt install **virtualbox–** and hit tab to see the various VirtualBox versions available for installation and then select one of them by typing it completely. - -![Install VirtualBox via terminal][13] - -### How to remove VirtualBox from Ubuntu - -Now that you have learned to install VirtualBox, I would also mention the steps to remove it. - -If you installed it from the Software Center, the easiest way to remove the application is from the Software Center itself. You just have to find it in the [list of installed applications][14] and click the Remove button. - -Another ways is to use the command line. - -``` -sudo apt remove virtualbox virtualbox-* -``` - -Note that this will not remove the virtual machines and the files associated with the operating systems you installed using VirtualBox. That’s not entirely a bad thing because you may want to keep them safe to use it later or in some other system. - -**In the end…** - -I hope you were able to pick one of the methods to install VirtualBox. I’ll also write about using it effectively in another article. For the moment, if you have and tips or suggestions or any questions, feel free to leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-virtualbox-ubuntu - -作者:[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://www.virtualbox.org -[2]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ -[3]: https://itsfoss.com/install-linux-in-virtualbox/ -[4]: https://itsfoss.com/install-windows-10-virtualbox-linux/ -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/linux-inside-linux-virtualbox.png?resize=800%2C450&ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-ubuntu-software-center.jpg?ssl=1 -[7]: https://itsfoss.com/know-program-version-before-install-ubuntu/ -[8]: https://itsfoss.com/oracle-virtualbox-release/ -[9]: https://itsfoss.com/install-deb-files-ubuntu/ -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-download.jpg?resize=800%2C433&ssl=1 -[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ -[12]: https://itsfoss.com/add-apt-repository-command-not-found/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-virtualbox-ubuntu-terminal.png?resize=800%2C165&ssl=1 -[14]: https://itsfoss.com/list-installed-packages-ubuntu/ diff --git a/sources/tech/20190304 How to Install MongoDB on Ubuntu.md b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md deleted file mode 100644 index 30d588ddba..0000000000 --- a/sources/tech/20190304 How to Install MongoDB on Ubuntu.md +++ /dev/null @@ -1,238 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (An-DJ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install MongoDB on Ubuntu) -[#]: via: (https://itsfoss.com/install-mongodb-ubuntu) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Install MongoDB on Ubuntu -====== - -**This tutorial presents two ways to install MongoDB on Ubuntu and Ubuntu-based Linux distributions.** - -[MongoDB][1] is an increasingly popular free and open-source NoSQL database that stores data in collections of JSON-like, flexible documents, in contrast to the usual table approach you’ll find in SQL databases. - -You are most likely to find MongoDB used in modern web applications. Its document model makes it very intuitive to access and handle with various programming languages. - -![mongodb Ubuntu][2] - -In this article, I’ll cover two ways you can install MongoDB on your Ubuntu system. - -### Installing MongoDB on Ubuntu based Distributions - - 1. Install MongoDB using Ubuntu’s repository. Easy but not the latest version of MongoDB - 2. Install MongoDB using its official repository. Slightly complicated but you get the latest version of MongoDB. - - - -The first installation method is easier, but I recommend the second method if you plan on using the latest release with official support. - -Some people might prefer using snap packages. There are snaps available in the Ubuntu Software Center, but I wouldn’t recommend using them; they’re outdated at the moment and I won’t be covering that. - -#### Method 1. Install MongoDB from Ubuntu Repository - -This is the easy way to install MongoDB on your system, you only need to type in a simple command. - -##### Installing MongoDB - -First, make sure your packages are up-to-date. Open up a terminal and type: - -``` -sudo apt update && sudo apt upgrade -y -``` - -Go ahead and install MongoDB with: - -``` -sudo apt install mongodb -``` - -That’s it! MongoDB is now installed on your machine. - -The MongoDB service should automatically be started on install, but to check the status type - -``` -sudo systemctl status mongodb -``` - -![Check if the MongoDB service is running.][3] - -You can see that the service is **active**. - -##### Running MongoDB - -MongoDB is currently a systemd service, so we’ll use **systemctl** to check and modify it’s state, using the following commands: - -``` -sudo systemctl status mongodb -sudo systemctl stop mongodb -sudo systemctl start mongodb -sudo systemctl restart mongodb -``` - -You can also change if MongoDB automatically starts when the system starts up ( **default** : enabled): - -``` -sudo systemctl disable mongodb -sudo systemctl enable mongodb -``` - -To start working with (creating and editing) databases, type: - -``` -mongo -``` - -This will start up the **mongo shell**. Please check out the [manual][4] for detailed information on the available queries and options. - -**Note:** Depending on how you plan to use MongoDB, you might need to adjust your Firewall. That’s unfortunately more involved than what I can cover here and depends on your configuration. - -##### Uninstall MongoDB - -If you installed MongoDB from the Ubuntu Repository and want to uninstall it (maybe to install using the officially supported way), type: - -``` -sudo systemctl stop mongodb -sudo apt purge mongodb -sudo apt autoremove -``` - -This should completely get rid of your MongoDB install. Make sure to **backup** any collections or documents you might want to keep since they will be wiped out! - -#### Method 2. Install MongoDB Community Edition on Ubuntu - -This is the way the recommended way to install MongoDB, using the package manager. You’ll have to type a few more commands and it might be intimidating if you are newer to the Linux world. - -But there’s nothing to be afraid of! We’ll go through the installation process step by step. - -##### Installing MongoDB - -The package maintained by MongoDB Inc. is called **mongodb-org** , not **mongodb** (this is the name of the package in the Ubuntu Repository). Make sure **mongodb** is not installed on your system before applying this steps. The packages will conflict. Let’s get to it! - -First, we’ll have to import the public key: - -``` -sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 -``` - -Now, you need to add a new repository in your sources list so that you can install MongoDB Community Edition and also get automatic updates: - -``` -echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list -``` - -To be able to install **mongodb-org** , we’ll have to update our package database so that your system is aware of the new packages available: - -``` -sudo apt update -``` - -Now you can ether install the **latest stable version** of MongoDB: - -``` -sudo apt install -y mongodb-org -``` - -or a **specific version** (change the version number after **equal** sign) - -``` -sudo apt install -y mongodb-org=4.0.6 mongodb-org-server=4.0.6 mongodb-org-shell=4.0.6 mongodb-org-mongos=4.0.6 mongodb-org-tools=4.0.6 -``` - -If you choose to install a specific version, make sure you change the version number everywhere. If you only change it in the **mongodb-org=4.0.6** part, the latest version will be installed. - -By default, when updating using the package manager ( **apt-get** ), MongoDB will be updated to the newest updated version. To stop that from happening (and freezing to the installed version), use: - -``` -echo "mongodb-org hold" | sudo dpkg --set-selections -echo "mongodb-org-server hold" | sudo dpkg --set-selections -echo "mongodb-org-shell hold" | sudo dpkg --set-selections -echo "mongodb-org-mongos hold" | sudo dpkg --set-selections -echo "mongodb-org-tools hold" | sudo dpkg --set-selections -``` - -You have now successfully installed MongoDB! - -##### Configuring MongoDB - -By default, the package manager will create **/var/lib/mongodb** and **/var/log/mongodb** and MongoDB will run using the **mongodb** user account. - -I won’t go into changing these default settings since that is beyond the scope of this guide. You can check out the [manual][5] for detailed information. - -The settings in **/etc/mongod.conf** are applied when starting/restarting the **mongodb** service instance. - -##### Running MongoDB - -To start the mongodb daemon **mongod** , type: - -``` -sudo service mongod start -``` - -Now you should verify that the **mongod** process started successfully. This information is stored (by default) at **/var/log/mongodb/mongod.log**. Let’s check the contents of that file: - -``` -sudo cat /var/log/mongodb/mongod.log -``` - -![Check MongoDB logs to see if the process is running properly.][6] - -As long as you get this: **[initandlisten] waiting for connections on port 27017** somewhere in there, the process is running properly. - -**Note: 27017** is the default port of **mongod.** - -To stop/restart **mongod** enter: - -``` -sudo service mongod stop -sudo service mongod restart -``` - -Now, you can use MongoDB by opening the **mongo shell** : - -``` -mongo -``` - -##### Uninstall MongoDB - -Run the following commands - -``` -sudo service mongod stop -sudo apt purge mongodb-org* -``` - -To remove the **databases** and **log files** (make sure to **backup** what you want to keep!): - -``` -sudo rm -r /var/log/mongodb -sudo rm -r /var/lib/mongodb -``` - -**Wrapping Up** - -MongoDB is a great NoSQL database, easy to integrate into modern projects. I hope this tutorial helped you to set it up on your Ubuntu machine! Let us know how you plan on using MongoDB in the comments below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-mongodb-ubuntu - -作者:[Sergiu][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/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://www.mongodb.com/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/mongodb-ubuntu.jpeg?resize=800%2C450&ssl=1 -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_check_status.jpg?fit=800%2C574&ssl=1 -[4]: https://docs.mongodb.com/manual/tutorial/getting-started/ -[5]: https://docs.mongodb.com/manual/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_org_check_logs.jpg?fit=800%2C467&ssl=1 diff --git a/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md b/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md deleted file mode 100644 index 8f69143d36..0000000000 --- a/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md +++ /dev/null @@ -1,309 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel) -[#]: via: (https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel -====== - -We had written two articles in the past to run commands on multiple remote server in parallel. - -These are **[Parallel SSH (PSSH)][1]** or **[Distributed Shell (DSH)][2]**. - -Today also, we are going to discuss about the same kind of topic but it allows us to perform the same on cluster nodes as well. - -You may think, i can write a small shell script to archive this instead of installing these third party packages. - -Of course you are right and if you are going to run some commands in 10-15 remote systems then you don’t need to use this. - -However, the scripts take some time to complete this task as it’s running in a sequential order. - -Think about if you would like to run some commands on 1000+ servers what will be the options? - -In this case your script won’t help you. Also, it would take good amount of time to complete a task. - -So, to overcome this kind of issue and situation. We need to run the command in parallel on remote machines. - -For that, we need use in one of the Parallel applications. I hope this explanation might fulfilled your doubts about parallel utilities. - -### What Is ClusterShell? - -clush stands for [ClusterShell][3]. ClusterShell is an event-driven open source Python library, designed to run local or distant commands in parallel on server farms or on large Linux clusters. - -It will take care of common issues encountered on HPC clusters, such as operating on groups of nodes, running distributed commands using optimized execution algorithms, as well as gathering results and merging identical outputs, or retrieving return codes. - -ClusterShell takes advantage of existing remote shell facilities already installed on your systems, like SSH. - -ClusterShell’s primary goal is to improve the administration of high- performance clusters by providing a lightweight but scalable Python API for developers. It also provides clush, clubak and cluset/nodeset, convenient command-line tools that allow traditional shell scripts to benefit from some of the library features. - -ClusterShell’s written in Python and it requires Python (v2.6+ or v3.4+) to run on your system. - -### How To Install ClusterShell On Linux? - -ClusterShell package is available in most of the distribution official package manager. So, use the distribution package manager tool to install it. - -For **`Fedora`** system, use **[DNF Command][4]** to install clustershell. - -``` -$ sudo dnf install clustershell -``` - -Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on Fedora System. - -``` -$ sudo dnf install python3-clustershell -``` - -Make sure you should have enabled the **[EPEL repository][5]** on your system before performing clustershell installation. - -For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install clustershell. - -``` -$ sudo yum install clustershell -``` - -Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on CentOS/RHEL System. - -``` -$ sudo yum install python34-clustershell -``` - -For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install clustershell. - -``` -$ sudo zypper install clustershell -``` - -Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on OpenSUSE System. - -``` -$ sudo zypper install python3-clustershell -``` - -For **`Debian/Ubuntu`** systems, use **[APT-GET Command][8]** or **[APT Command][9]** to install clustershell. - -``` -$ sudo apt install clustershell -``` - -### How To Install ClusterShell In Linux Using PIP? - -Use PIP to install ClusterShell because it’s written in Python. - -Make sure you should have enabled the **[Python][10]** and **[PIP][11]** on your system before performing clustershell installation. - -``` -$ sudo pip install ClusterShell -``` - -### How To Use ClusterShell On Linux? - -It’s straight forward and awesome tool compared with other utilities such as pssh and dsh. It has so many options to perform the remote execution in parallel. - -Make sure you should have enabled the **[password less login][12]** on your system before start using clustershell. - -The following configuration file defines system-wide default values. You no need to modify anything here. - -``` -$ cat /etc/clustershell/clush.conf -``` - -If you would like to create a servers group. Here you can go. By default some examples were available so, do the same for your requirements. - -``` -$ cat /etc/clustershell/groups.d/local.cfg -``` - -Just run the clustershell command in the following format to get the information from the given nodes. - -``` -$ clush -w 192.168.1.4,192.168.1.9 cat /proc/version -192.168.1.9: Linux version 4.15.0-45-generic ([email protected]) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 -192.168.1.4: Linux version 3.10.0-957.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018 -``` - -**Option:** - - * **`-w:`** nodes where to run the command. - - - -You can use the regular expressions instead of using full hostname and IPs. - -``` -$ clush -w 192.168.1.[4,9] uname -r -192.168.1.9: 4.15.0-45-generic -192.168.1.4: 3.10.0-957.el7.x86_64 -``` - -Alternatively you can use the following format if you have the servers in the same IP series. - -``` -$ clush -w 192.168.1.[4-9] date -192.168.1.6: Mon Mar 4 21:08:29 IST 2019 -192.168.1.7: Mon Mar 4 21:08:29 IST 2019 -192.168.1.8: Mon Mar 4 21:08:29 IST 2019 -192.168.1.5: Mon Mar 4 09:16:30 CST 2019 -192.168.1.9: Mon Mar 4 21:08:29 IST 2019 -192.168.1.4: Mon Mar 4 09:16:30 CST 2019 -``` - -clustershell allow us to run the command in batch mode. Use the following format to achieve this. - -``` -$ clush -w 192.168.1.4,192.168.1.9 -b -Enter 'quit' to leave this interactive mode -Working with nodes: 192.168.1.[4,9] -clush> hostnamectl ---------------- -192.168.1.4 ---------------- - Static hostname: CentOS7.2daygeek.com - Icon name: computer-vm - Chassis: vm - Machine ID: 002f47b82af248f5be1d67b67e03514c - Boot ID: f9b37a073c534dec8b236885e754cb56 - Virtualization: kvm - Operating System: CentOS Linux 7 (Core) - CPE OS Name: cpe:/o:centos:centos:7 - Kernel: Linux 3.10.0-957.el7.x86_64 - Architecture: x86-64 ---------------- -192.168.1.9 ---------------- - Static hostname: Ubuntu18 - Icon name: computer-vm - Chassis: vm - Machine ID: 27f6c2febda84dc881f28fd145077187 - Boot ID: f176f2eb45524d4f906d12e2b5716649 - Virtualization: oracle - Operating System: Ubuntu 18.04.2 LTS - Kernel: Linux 4.15.0-45-generic - Architecture: x86-64 -clush> free -m ---------------- -192.168.1.4 ---------------- - total used free shared buff/cache available -Mem: 1838 641 217 19 978 969 -Swap: 2047 0 2047 ---------------- -192.168.1.9 ---------------- - total used free shared buff/cache available -Mem: 1993 352 1067 1 573 1473 -Swap: 1425 0 1425 -clush> w ---------------- -192.168.1.4 ---------------- - 09:21:14 up 3:21, 3 users, load average: 0.00, 0.01, 0.05 -USER TTY FROM [email protected] IDLE JCPU PCPU WHAT -daygeek :0 :0 06:02 ?xdm? 1:28 0.30s /usr/libexec/gnome-session-binary --session gnome-classic -daygeek pts/0 :0 06:03 3:17m 0.06s 0.06s bash -daygeek pts/1 192.168.1.6 06:03 52:26 0.10s 0.10s -bash ---------------- -192.168.1.9 ---------------- - 21:13:12 up 3:12, 1 user, load average: 0.08, 0.03, 0.00 -USER TTY FROM [email protected] IDLE JCPU PCPU WHAT -daygeek pts/0 192.168.1.6 20:42 29:41 0.05s 0.05s -bash -clush> quit -``` - -If you would like to run the command on a group of nodes then use the following format. - -``` -$ clush -w @dev uptime -or -$ clush -g dev uptime -or -$ clush --group=dev uptime - -192.168.1.9: 21:10:10 up 3:09, 1 user, load average: 0.09, 0.03, 0.01 -192.168.1.4: 09:18:12 up 3:18, 3 users, load average: 0.01, 0.02, 0.05 -``` - -If you would like to run the command on more than one group of nodes then use the following format. - -``` -$ clush -w @dev,@uat uptime -or -$ clush -g dev,uat uptime -or -$ clush --group=dev,uat uptime - -192.168.1.7: 07:57:19 up 59 min, 1 user, load average: 0.08, 0.03, 0.00 -192.168.1.9: 20:27:20 up 1:00, 1 user, load average: 0.00, 0.00, 0.00 -192.168.1.5: 08:57:21 up 59 min, 1 user, load average: 0.00, 0.01, 0.05 -``` - -clustershell allow us to copy a file to remote machines. To copy local file or directory to the remote nodes in the same location. - -``` -$ clush -w 192.168.1.[4,9] --copy /home/daygeek/passwd-up.sh -``` - -We can verify the same by running the following command. - -``` -$ clush -w 192.168.1.[4,9] ls -lh /home/daygeek/passwd-up.sh -192.168.1.4: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 4 09:00 /home/daygeek/passwd-up.sh -192.168.1.9: -rwxr-xr-x 1 daygeek daygeek 159 Mar 4 20:52 /home/daygeek/passwd-up.sh -``` - -To copy local file or directory to the remote nodes in the different location. - -``` -$ clush -g uat --copy /home/daygeek/passwd-up.sh --dest /tmp -``` - -We can verify the same by running the following command. - -``` -$ clush --group=uat ls -lh /tmp/passwd-up.sh -192.168.1.7: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 6 07:44 /tmp/passwd-up.sh -``` - -To copy file or directory from remote nodes to local system. - -``` -$ clush -w 192.168.1.7 --rcopy /home/daygeek/Documents/magi.txt --dest /tmp -``` - -We can verify the same by running the following command. - -``` -$ ls -lh /tmp/magi.txt.192.168.1.7 --rw-r--r-- 1 daygeek daygeek 35 Mar 6 20:24 /tmp/magi.txt.192.168.1.7 -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/ - -作者:[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/pssh-parallel-ssh-run-execute-commands-on-multiple-linux-servers/ -[2]: https://www.2daygeek.com/dsh-run-execute-shell-commands-on-multiple-linux-servers-at-once/ -[3]: https://cea-hpc.github.io/clustershell/ -[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ -[5]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/ -[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ -[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ -[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ -[9]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ -[10]: https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-centos-6-system/ -[11]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ -[12]: https://www.2daygeek.com/linux-passwordless-ssh-login-using-ssh-keygen/ diff --git a/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md deleted file mode 100644 index 16e9c70627..0000000000 --- a/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md +++ /dev/null @@ -1,264 +0,0 @@ -[#]: collector: "lujun9972" -[#]: translator: "zhangxiangping " -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "How To Parse And Pretty Print JSON With Linux Commandline Tools" -[#]: via: "https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/" -[#]: author: "EDITOR https://www.ostechnix.com/author/editor/" - -How To Parse And Pretty Print JSON With Linux Commandline Tools -====== - -**JSON** is a lightweight and language independent data storage format, easy to integrate with most programming languages and also easy to understand by humans, of course when properly formatted. The word JSON stands for **J** ava **S** cript **O** bject **N** otation, though it starts with JavaScript, and primarily used to exchange data between server and browser, but now being used in many fields including embedded systems. Here we’re going to parse and pretty print JSON with command line tools on Linux. It’s extremely useful for handling large JSON data in a shell scripts, or manipulating JSON data in a shell script. - -### What is pretty printing? - -The JSON data is structured to be somewhat more human readable. However in most cases, JSON data is stored in a single line, even without a line ending character. - -Obviously that’s not very convenient for reading and editing manually. - -That’s when pretty print is useful. The name is quite self explanatory, re-formatting the JSON text to be more legible by humans. This is known as **JSON pretty printing**. - -### Parse And Pretty Print JSON With Linux Commandline Tools - -JSON data could be parsed with command line text processors like **awk** , **sed** and **gerp**. In fact JSON.awk is an awk script to do that. However there are some dedicated tools for the same purpose. - - 1. **jq** or **jshon** , JSON parser for shell, both of them are quite useful. - - 2. Shell scripts like **JSON.sh** or **jsonv.sh** to parse JSON in bash, zsh or dash shell. - - 3. **JSON.awk** , JSON parser awk script. - - 4. Python modules like **json.tool**. - - 5. **underscore-cli** , Node.js and javascript based. - - - - -In this tutorial I’m focusing only on **jq** , which is quite powerful JSON parser for shells with advanced filtering and scripting capability. - -### JSON pretty printing - -JSON data could be in one and nearly illegible for humans, so to make it somewhat readable, JSON pretty printing is here. - -**Example:** A data from **jsonip.com** , to get external IP address in JSON format, use **curl** or **wget** tools like below. - -``` -$ wget -cq http://jsonip.com/ -O - -``` - -The actual data looks like this: - -``` -{"ip":"111.222.333.444","about":"/about","Pro!":"http://getjsonip.com"} -``` - -Now pretty print it with jq: - -``` -$ wget -cq http://jsonip.com/ -O - | jq '.' -``` - -This should look like below, after filtering the result with jq. - -``` -{ - - "ip": "111.222.333.444", - - "about": "/about", - - "Pro!": "http://getjsonip.com" - -} -``` - -The Same thing could be done with python **json.tool** module. Here is an example: - -``` -$ cat anything.json | python -m json.tool -``` - -This Python based solution should be fine for most users, but it’s not that useful where Python is not pre-installed or could not be installed, like on embedded systems. - -However the json.tool python module has a distinct advantage, it’s cross platform. So, you can use it seamlessly on Windows, Linux or mac OS. - - -### How to parse JSON with jq - -First, you need to install jq, it’s already picked up by most GNU/Linux distributions, install it with their respective package installer commands. - -On Arch Linux: - -``` -$ sudo pacman -S jq -``` - -On Debian, Ubuntu, Linux Mint: - -``` -$ sudo apt-get install jq -``` - -On Fedora: - -``` -$ sudo dnf install jq -``` - -On openSUSE: - -``` -$ sudo zypper install jq -``` - -For other OS or platforms, see the [official installation instructions][1]. - -**Basic filters and identifiers of jq** - -jq could read the JSON data either from **stdin** or a **file**. You’ve to use both depending on the situation. - -The single symbol of **.** is the most basic filter. These filters are also called as **object identifier-index**. Using a single **.** along with jq basically pretty prints the input JSON file. - -**Single quotes** – You don’t have to use the single quote always. But if you’re combining several filters in a single line, then you must use them. - -**Double quotes** – You’ve to enclose any special character like **@** , **#** , **$** within two double quotes, like this example, **jq .foo.”@bar”** - -**Raw data print** – For any reason, if you need only the final parsed data, not enclosed within a double quote, use the -r flag with the jq command, like this. **– jq -r .foo.bar**. - -**Parsing specific data** - -To filter out a specific part of JSON, you’ve to look into the pretty printed JSON file’s data hierarchy. - -An example of JSON data, from Wikipedia: - -``` -{ - - "firstName": "John", - - "lastName": "Smith", - - "age": 25, - - "address": { - - "streetAddress": "21 2nd Street", - - "city": "New York", - - "state": "NY", - - "postalCode": "10021" - -}, - - "phoneNumber": [ - -{ - - "type": "home", - - "number": "212 555-1234" - -}, - -{ - - "type": "fax", - - "number": "646 555-4567" - -} - -], - - "gender": { - - "type": "male" - - } - -} -``` - -I’m going to use this JSON data as an example in this tutorial, saved this as **sample.json**. - -Let’s say I want to filter out the address from sample.json file. So the command should be like: - -``` -$ jq .address sample.json -``` - -**Sample output:** - -``` -{ - - "streetAddress": "21 2nd Street", - - "city": "New York", - - "state": "NY", - - "postalCode": "10021" - -} -``` - -Again let’s say I want the postal code, then I’ve to add another **object identifier-index** , i.e. another filter. - -``` -$ cat sample.json | jq .address.postalCode -``` - -Also note that the **filters are case sensitive** and you’ve to use the exact same string to get something meaningful output instead of null. - -**Parsing elements from JSON array** - -Elements of JSON array are enclosed within square brackets, undoubtedly quite versatile to use. - -To parse elements from a array, you’ve to use the **[]identifier** along with other object identifier-index. - -In this sample JSON data, the phone numbers are stored inside an array, to get all the contents from this array, you’ve to use only the brackets, like this example. - -``` -$ jq .phoneNumber[] sample.json -``` - -Let’s say you just want the first element of the array, then use the array object numbers starting for 0, for the first item, use **[0]** , for the next items, it should be incremented by one each step. - -``` -$ jq .phoneNumber[0] sample.json -``` - -**Scripting examples** - -Let’s say I want only the the number for home, not entire JSON array data. Here’s when scripting within jq command comes handy. - -``` -$ cat sample.json | jq -r '.phoneNumber[] | select(.type == "home") | .number' -``` - -Here first I’m piping the results of one filer to another, then using the select attribute to select a particular type of data, again piping the result to another filter. - -Explaining every type of jq filters and scripting is beyond the scope and purpose of this tutorial. It’s highly suggested to read the JQ manual for better understanding given below. - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/ - -作者:[EDITOR][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.ostechnix.com/author/editor/ -[b]: https://github.com/lujun9972 -[1]: https://stedolan.github.io/jq/download/ diff --git a/sources/tech/20190315 New zine- Bite Size Networking.md b/sources/tech/20190315 New zine- Bite Size Networking.md new file mode 100644 index 0000000000..cd47c5619a --- /dev/null +++ b/sources/tech/20190315 New zine- Bite Size Networking.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New zine: Bite Size Networking!) +[#]: via: (https://jvns.ca/blog/2019/03/15/new-zine--bite-size-networking-/) +[#]: author: (Julia Evans https://jvns.ca/) + +New zine: Bite Size Networking! +====== + +Last week I released a new zine: Bite Size Networking! It’s the third zine in the “bite size” series: + + 1. [Bite Size Linux][1] + 2. [Bite Size Command Line][2] + 3. [Bite Size Networking][3] + + + +You can get it for $10 at ! (or $150/$250/$600 for the corporate rate). + +Here’s the cover and table of contents! + +[![][4]][5] + +A few people have asked for a 3-pack with all 3 “bite size” zines which is coming soon! + +### why this zine? + +In last few years I’ve been doing a lot of networking at work, and along the way I’ve gone from “uh, what even is tcpdump” to “yes I can just type in `sudo tcpdump -c 200 -n port 443 -i lo`” without even thinking twice about it. As usual this zine is the resource I wish I had 4 years ago. There are so many things it took me a long time to figure out how to do like: + + * inspect SSL certificates + * make DNS queries + * figure out what server is using that port + * find out whether the firewall is causing you problems or not + * capture / search network traffic on a machine + + + +and as often happens with computers none of them are really that hard!! But the man pages for the tols you need to do these things are Very Long and as usual don’t differentiate between “everybody always uses this option and you 10000% need to know it” and “you will never use this option it does not matter”. So I spent a long time staring sadly at the tcpdump man page. + +the pitch for this zine is: + +> It’s Thursday afternoon and your users are reporting SSL errors in production and you don’t know why. Or a HTTP header isn’t being set correctly and it’s breaking the site. Or you just got a notification that your site’s SSL certificate is expiring in 2 days. Or you need to update DNS to point to a new server. Or a server suddenly isn’t able to connect to a service. And networking maybe isn’t your full time job, but you still need to get the problem fixed. + +Kamal (my partner) proofreads all my zines and we hit an exciting milestone with this one: this is the first zine where he was like “wow, I really did not know a lot of the stuff in this zine”. This is of course because I’ve spent a lot more time than him debugging weird networking things, and when you practice something you get better at it :) + +### a couple of example pages + +Here are a couple of example pages, to give you an idea of what’s in the zine: + +![][6] ![][7] + +### next thing to get better at: getting feedback! + +One thing I’ve realized that while I get a ton of help from people while writing these zines (I read probably a thousand tweets from people suggesting ideas for things to include in the zine), I don’t get as much feedback from people about the final product as I’d like! + +I often hear positive things (“I love them!”, “thank you so much!”, “this helped me in my job!”) but I’d really love to hear more about which bits specifically helped the most and what didn’t make as much sense or what you would have liked to see more of. So I’ll probably be asking a few questions about that to people who buy this zine! + +### selling zines is going well + +When I made the switch about a year ago from “every zine I release is free” to “the old zines are free but all the new ones are not free” it felt scary! It’s been startlingly totally fine and a very positive thing. Sales have been really good, people take the work more seriously, I can spend more time on them, and I think the quality has gone up. + +And I’ve been doing occasional [giveaways][8] for people who can’t afford a $10 zine, which feels like a nice way to handle “some people legitimately can’t afford $10 and I would like to get them information too”. + +### what’s next? + +I’m not sure yet! A few options: + + * kubernetes + * more about linux concepts (bite size linux part II) + * how to do statistics using simulations + * something else! + + + +We’ll see what I feel most inspired by :) + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/03/15/new-zine--bite-size-networking-/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com/zines/bite-size-linux/ +[2]: https://wizardzines.com/zines/bite-size-command-line/ +[3]: https://wizardzines.com/zines/bite-size-networking/ +[4]: https://jvns.ca/images/bite-size-networking-cover.png +[5]: https://gum.co/bite-size-networking +[6]: https://jvns.ca/images/ngrep.png +[7]: https://jvns.ca/images/ping.png +[8]: https://twitter.com/b0rk/status/1104368319816220674 diff --git a/sources/tech/20190318 Let-s try dwm - dynamic window manager.md b/sources/tech/20190318 Let-s try dwm - dynamic window manager.md deleted file mode 100644 index 48f44a33cb..0000000000 --- a/sources/tech/20190318 Let-s try dwm - dynamic window manager.md +++ /dev/null @@ -1,150 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Let’s try dwm — dynamic window manager) -[#]: via: (https://fedoramagazine.org/lets-try-dwm-dynamic-window-manger/) -[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) - -Let’s try dwm — dynamic window manager -====== - -![][1] - -If you like efficiency and minimalism, and are looking for a new window manager for your Linux desktop, you should try _dwm_ — dynamic window manager. Written in under 2000 standard lines of code, dwm is extremely fast yet powerful and highly customizable window manager. - -You can dynamically choose between tiling, monocle and floating layouts, organize your windows into multiple workspaces using tags, and quickly navigate through using keyboard shortcuts. This article helps you get started using dwm. - -## **Installation** - -To install dwm on Fedora, run: - -``` -$ sudo dnf install dwm dwm-user -``` - -The _dwm_ package installs the window manager itself, and the _dwm-user_ package significantly simplifies configuration which will be explained later in this article. - -Additionally, to be able to lock the screen when needed, we’ll also install _slock_ — a simple X display locker. - -``` -$ sudo dnf install slock -``` - -However, you can use a different one based on your personal preference. - -## **Quick start** - -To start dwm, choose the _dwm-user_ option on the login screen. - -![][2] - -After you log in, you’ll see a very simple desktop. In fact, the only thing there will be a bar at the top listing our nine tags that represent workspaces and a _[]=_ symbol that represents the layout of your windows. - -### Launching applications - -Before looking into the layouts, first launch some applications so you can play with the layouts as you go. Apps can be started by pressing _Alt+p_ and typing the name of the app followed by _Enter_. There’s also a shortcut _Alt+Shift+Enter_ for opening a terminal. - -Now that some apps are running, have a look at the layouts. - -### Layouts - -There are three layouts available by default: the tiling layout, the monocle layout, and the floating layout. - -The tiling layout, represented by _[]=_ on the bar, organizes windows into two main areas: master on the left, and stack on the right. You can activate the tiling layout by pressing _Alt+t._ - -![][3] - -The idea behind the tiling layout is that you have your primary window in the master area while still seeing the other ones in the stack. You can quickly switch between them as needed. - -To swap windows between the two areas, hover your mouse over one in the stack area and press _Alt+Enter_ to swap it with the one in the master area. - -![][4] - -The monocle layout, represented by _[N]_ on the top bar, makes your primary window take the whole screen. You can switch to it by pressing _Alt+m_. - -Finally, the floating layout lets you move and resize your windows freely. The shortcut for it is _Alt+f_ and the symbol on the top bar is _> <>_. - -### Workspaces and tags - -Each window is assigned to a tag (1-9) listed at the top bar. To view a specific tag, either click on its number using your mouse or press _Alt+1..9._ You can even view multiple tags at once by clicking on their number using the secondary mouse button. - -Windows can be moved between different tags by highlighting them using your mouse, and pressing _Alt+Shift+1..9._ - -## **Configuration** - -To make dwm as minimalistic as possible, it doesn’t use typical configuration files. Instead, you modify a C header file representing the configuration, and recompile it. But don’t worry, in Fedora it’s as simple as just editing one file in your home directory and everything else happens in the background thanks to the _dwm-user_ package provided by the maintainer in Fedora. - -First, you need to copy the file into your home directory using a command similar to the following: - -``` -$ mkdir ~/.dwm -$ cp /usr/src/dwm-VERSION-RELEASE/config.def.h ~/.dwm/config.h -``` - -You can get the exact path by running _man dwm-start._ - -Second, just edit the _~/.dwm/config.h_ file. As an example, let’s configure a new shortcut to lock the screen by pressing _Alt+Shift+L_. - -Considering we’ve installed the _slock_ package mentioned earlier in this post, we need to add the following two lines into the file to make it work: - -Under the _/* commands */_ comment, add: - -``` -static const char *slockcmd[] = { "slock", NULL }; -``` - -And the following line into _static Key keys[]_ : - -``` -{ MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } }, -``` - -In the end, it should look like as follows: (added lines are highlighted) - -``` -... - /* commands */ - static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ - static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; - static const char *termcmd[] = { "st", NULL }; - static const char *slockcmd[] = { "slock", NULL }; - - static Key keys[] = { - /* modifier key function argument */ - { MODKEY|ShiftMask, XK_l, spawn, {.v = slockcmd } }, - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, - ... -``` - -Save the file. - -Finally, just log out by pressing _Alt+Shift+q_ and log in again. The scripts provided by the _dwm-user_ package will recognize that you have changed the _config.h_ file in your home directory and recompile dwm on login. And becuse dwm is so tiny, it’s fast enough you won’t even notice it. - -You can try locking your screen now by pressing _Alt+Shift+L_ , and then logging back in again by typing your password and pressing enter. - -## **Conclusion** - -If you like minimalism and want a very fast yet powerful window manager, dwm might be just what you’ve been looking for. However, it probably isn’t for beginners. There might be a lot of additional configuration you’ll need to do in order to make it just as you like it. - -To learn more about dwm, see the project’s homepage at . - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/lets-try-dwm-dynamic-window-manger/ - -作者:[Adam Šamalík][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/asamalik/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/03/dwm-magazine-image-816x345.png -[2]: https://fedoramagazine.org/wp-content/uploads/2019/03/choosing-dwm-1024x469.png -[3]: https://fedoramagazine.org/wp-content/uploads/2019/03/dwm-desktop-1024x593.png -[4]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-2019-03-15-at-11.12.32-1024x592.png diff --git a/sources/tech/20190326 Why are monoidal categories interesting.md b/sources/tech/20190326 Why are monoidal categories interesting.md new file mode 100644 index 0000000000..37aaef753a --- /dev/null +++ b/sources/tech/20190326 Why are monoidal categories interesting.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why are monoidal categories interesting?) +[#]: via: (https://jvns.ca/blog/2019/03/26/what-are-monoidal-categories/) +[#]: author: (Julia Evans https://jvns.ca/) + +Why are monoidal categories interesting? +====== + +Hello! Someone on Twitter asked a question about tensor categories recently and I remembered “oh, I know something about that!! These are a cool thing!“. Monoidal categories are also called “tensor categories” and I think that term feels a little more concrete: one of the biggest examples of a tensor category is the category of vector spaces with the tensor product as the way you combine vectors / functions. “Monoidal” means “has an associative binary operation with an identity”, and with vector spaces the tensor product is the “associative binary operation” it’s referring to. So I’m going to mostly use “tensor categories” in this post instead. + +So here’s a quick stab at explaining why tensor categories are cool. I’m going to make a lot of oversimplifications which I figure is better than trying to explain category theory from the ground up. I’m not a category theorist (though I spent 2 years in grad school doing a bunch of category theory) and I will almost certainly say wrong things about category theory. + +In this post I’m going to try to talk about [Seven Sketches in Compositionality: An Invitation to Applied Category Theory][1] using mostly plain English. + +### tensor categories aren’t monads + +If you have been around functional programming for a bit, you might see the word “monoid” and “categories” and wonder “oh, is julia writing about monads, like in Haskell”? I am not!! + +There is a sentence “monads are a monoid in the category of endofunctors” which includes both the word “monoid” and “category” but that is not what I am talking about at all. We’re not going to talk about types or Haskell or monads or anything. + +#### tensor categories are about proving (or defining) things with pictures + +Here’s what I think is a really nice example from this [“seven sketches in compositionality”](() PDF (on page 47): + +![][2] + +The idea here is that you have 3 inequalities + + 1. `t <= v + w` + 2. `w + u <= x + z` + 3. `v + x <= y`, + + + +and you want to prove that `t + u <= y + z`. + +You can do this algebraically pretty easily. + +But in this diagram they’ve done something really different! They’ve sort of drawn the inequalities as boxes with lines coming out of them for each variable, and then you can see that you end up with a `t` and a `u` on the left and a `y` and a `z` on the right, and so maybe that means that `t + u <= y + z`. + +The first time I saw something like this in a math class I felt like – what? what is happening? you can’t just draw PICTURES to prove things?!! And of course you can’t _just_ draw pictures to prove things. + +What’s actually happening in pictures like this is that when you put 2 things next to each other in the picture (like `t` and `u`), that actually represents the “tensor product” of `t` and `u`. In this case the “tensor product” is defined to be addition. And the tensor product (addition in this case) has some special properties – + + 1. it’s associative + 2. if `a <= b` and `c <= d` then `a + c <= b + d` + + + +so saying that this picture proves that `t + u <= y + z` **actually** means that you can read a proof off the diagram in a straightforward way: + +``` + t + u +<= (v + w) + u += v + (w + u) +<= v + (x + z) += (v + x) + z +<= y + z +``` + +So all the things that “look like they would work” according to the picture actually do work in practice because our tensor product thing is associative and because addition works nicely with the `<=` relationship. The book explains all this in a lot more detail. + +### draw vector spaces with “string diagrams” + +Proving this simple inequality is kind of boring though! We want to do something more interesting, so let’s talk about vector spaces! Here’s a diagram that includes some vector spaces (U1, U2, V1, V2) and some functions (f,g) between them. + +![][3] + +Again, here what it means to have U1 stacked on top of U2 is that we’re taking a tensor product of U1 and U2. And the tensor product is associative, so there’s no ambiguity if we stack 3 or 4 vector spaces together! + +This is all explained in a lot more detail in this nice blog post called [introduction to string diagrams][4] (which I took that picture from). + +### define the trace of a matrix with a picture + +So far this is pretty boring! But in a [follow up blog post][5], they talk about something more outrageous: you can (using vector space duality) take the lines in one of these diagrams and move them **backwards** and make loops. So that lets us define the trace of a function `f : V -> V` like this: + +![][6] + +This is a really outrageous thing! We’ve said, hey, we have a function and we want to get a number in return right? Okay, let’s just… draw a circle around it so that there are no lines left coming out of it, and then that will be a number! That seems a lot more natural and prettier than the usual way of defining the trace of a matrix (“sum up the numbers on the diagonal”)! + +When I first saw this I thought it was super cool that just drawing a circle is actually a legitimate way of defining a mathematical concept! + +### how are tensor category diagrams different from regular category theory diagrams? + +If you see “tensor categories let you prove things with pictures” you might think “well, the whole point of category theory is to prove things with pictures, so what?“. I think there are a few things that are different in tensor category diagrams: + + 1. with string diagrams, the lines are objects and the boxes are functions which is the opposite of how usual category theory diagrams are + 2. putting things next to each other in the diagram has a specific meaning (“take the tensor product of those 2 things”) where as in usual category theory diagrams it doesn’t. being able to combine things in this way is powerful! + 3. half circles have a specific meaning (“take the dual”) + 4. you can use specific elements of a (eg vector space) in a diagram which usually you wouldn’t do in a category theory diagram (the objects would be the whole vector space, not one element of that vector space) + + + +### what does this have to do with programming? + +Even though this is usually a programming blog I don’t know whether this particular thing really has anything to do with programming, I just remembered I thought it was cool. I wrote my [master’s thesis][7] (which i will link to even though it’s not very readable) on topological quantum computing which involves a bunch of monoidal categories. + +Some of the diagrams in this post are sort of why I got interested in that area in the first place – I thought it was really cool that you could formally define / prove things with pictures. And useful things, like the trace of a matrix! + +### edit: some ways this might be related to programming + +Someone pointed me to a couple of twitter threads (coincidentally from this week!!) that relate tensor categories & diagrammatic methods to programming: + + 1. [this thread from @KenScambler][8] (“My best kept secret* is that string & wiring diagrams–plucked straight out of applied category theory–are _fabulous_ for software and system design.) + 2. [this other thread by him of 31 interesting related things to this topic][9] + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/03/26/what-are-monoidal-categories/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://arxiv.org/pdf/1803.05316.pdf +[2]: https://jvns.ca/images/monoidal-preorder.png +[3]: https://jvns.ca/images/tensor-vector.png +[4]: https://qchu.wordpress.com/2012/11/05/introduction-to-string-diagrams/ +[5]: https://qchu.wordpress.com/2012/11/06/string-diagrams-duality-and-trace/ +[6]: https://jvns.ca/images/trace.png +[7]: https://github.com/jvns/masters-thesis/raw/master/thesis.pdf +[8]: https://twitter.com/KenScambler/status/1108738366529400832 +[9]: https://twitter.com/KenScambler/status/1109474342822244353 diff --git a/sources/tech/20190401 Build and host a website with Git.md b/sources/tech/20190401 Build and host a website with Git.md deleted file mode 100644 index 32a07d3490..0000000000 --- a/sources/tech/20190401 Build and host a website with Git.md +++ /dev/null @@ -1,226 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Build and host a website with Git) -[#]: via: (https://opensource.com/article/19/4/building-hosting-website-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Build and host a website with Git -====== -Publishing your own website is easy if you let Git help you out. Learn -how in the first article in our series about little-known Git uses. -![web development and design, desktop and browser][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. - -Creating a website used to be both sublimely simple and a form of black magic all at once. Back in the old days of Web 1.0 (that's not what anyone actually called it), you could just open up any website, view its source code, and reverse engineer the HTML—with all its inline styling and table-based layout—and you felt like a programmer after an afternoon or two. But there was still the matter of getting the page you created on the internet, which meant dealing with servers and FTP and webroot directories and file permissions. While the modern web has become far more complex since then, self-publication can be just as easy (or easier!) if you let Git help you out. - -### Create a website with Hugo - -[Hugo][3] is an open source static site generator. Static sites are what the web used to be built on (if you go back far enough, it was _all_ the web was). There are several advantages to static sites: they're relatively easy to write because you don't have to code them, they're relatively secure because there's no code executed on the pages, and they can be quite fast because there's no processing aside from transferring whatever you have on the page. - -Hugo isn't the only static site generator out there. [Grav][4], [Pico][5], [Jekyll][6], [Podwrite][7], and many others provide an easy way to create a full-featured website with minimal maintenance. Hugo happens to be one with GitLab integration built in, which means you can generate and host your website with a free GitLab account. - -Hugo has some pretty big fans, too. For instance, if you've ever gone to the Let's Encrypt website, then you've used a site built with Hugo. - -![Let's Encrypt website][8] - -#### Install Hugo - -Hugo is cross-platform, and you can find installation instructions for MacOS, Windows, Linux, OpenBSD, and FreeBSD in [Hugo's getting started resources][9]. - -If you're on Linux or BSD, it's easiest to install Hugo from a software repository or ports tree. The exact command varies depending on what your distribution provides, but on Fedora you would enter: - -``` -$ sudo dnf install hugo -``` - -Confirm you have installed it correctly by opening a terminal and typing: - -``` -$ hugo help -``` - -This prints all the options available for the **hugo** command. If you don't see that, you may have installed Hugo incorrectly or need to [add the command to your path][10]. - -#### Create your site - -To build a Hugo site, you must have a specific directory structure, which Hugo will generate for you by entering: - -``` -$ hugo new site mysite -``` - -You now have a directory called **mysite** , and it contains the default directories you need to build a Hugo website. - -Git is your interface to get your site on the internet, so change directory to your new **mysite** folder and initialize it as a Git repository: - -``` -$ cd mysite -$ git init . -``` - -Hugo is pretty Git-friendly, so you can even use Git to install a theme for your site. Unless you plan on developing the theme you're installing, you can use the **\--depth** option to clone the latest state of the theme's source: - -``` -$ git clone --depth 1 \ - -themes/mero -``` - - -Now create some content for your site: - -``` -$ hugo new posts/hello.md -``` - -Use your favorite text editor to edit the **hello.md** file in the **content/posts** directory. Hugo accepts Markdown files and converts them to themed HTML files at publication, so your content must be in [Markdown format][11]. - -If you want to include images in your post, create a folder called **images** in the **static** directory. Place your images into this folder and reference them in your markup using the absolute path starting with **/images**. For example: - -``` -![A picture of a thing](/images/thing.jpeg) -``` - -#### Choose a theme - -You can find more themes at [themes.gohugo.io][12], but it's best to stay with a basic theme while testing. The canonical Hugo test theme is [Ananke][13]. Some themes have complex dependencies, and others don't render pages the way you might expect without complex configuration. The Mero theme used in this example comes bundled with a detailed **config.toml** configuration file, but (for the sake of simplicity) I'll provide just the basics here. Open the file called **config.toml** in a text editor and add three configuration parameters: - -``` - -languageCode = "en-us" -title = "My website on the web" -theme = "mero" - -[params] - author = "Seth Kenlon" - description = "My hugo demo" -``` - -#### Preview your site - -You don't have to put anything on the internet until you're ready to publish it. While you work, you can preview your site by launching the local-only web server that ships with Hugo. - -``` -$ hugo server --buildDrafts --disableFastRender -``` - -Open a web browser and navigate to **** to see your work in progress. - -### Publish with Git to GitLab - -To publish and host your site on GitLab, create a repository for the contents of your site. - -To create a repository in GitLab, click on the **New Project** button in your GitLab Projects page. Create an empty repository called **yourGitLabUsername.gitlab.io** , replacing **yourGitLabUsername** with your GitLab user name or group name. You must use this scheme as the name of your project. If you want to add a custom domain later, you can. - -Do not include a license or a README file (because you've started a project locally, adding these now would make pushing your data to GitLab more complex, and you can always add them later). - -Once you've created the empty repository on GitLab, add it as the remote location for the local copy of your Hugo site, which is already a Git repository: - -``` -$ git remote add origin git@gitlab.com:skenlon/mysite.git -``` - -Create a GitLab site configuration file called **.gitlab-ci.yml** and enter these options: - -``` -image: monachus/hugo - -variables: - GIT_SUBMODULE_STRATEGY: recursive - -pages: - script: - - hugo - artifacts: - paths: - - public - only: - - master -``` - -The **image** parameter defines a containerized image that will serve your site. The other parameters are instructions telling GitLab's servers what actions to execute when you push new code to your remote repository. For more information on GitLab's CI/CD (Continuous Integration and Delivery) options, see the [CI/CD section of GitLab's docs][14]. - -#### Set the excludes - -Your Git repository is configured, the commands to build your site on GitLab's servers are set, and your site ready to publish. For your first Git commit, you must take a few extra precautions so you're not version-controlling files you don't intend to version-control. - -First, add the **/public** directory that Hugo creates when building your site to your **.gitignore** file. You don't need to manage the finished site in Git; all you need to track are your source Hugo files. - -``` -$ echo "/public" >> .gitignore -``` - -You can't maintain a Git repository within a Git repository without creating a Git submodule. For the sake of keeping this simple, move the embedded **.git** directory so that the theme is just a theme. - -Note that you _must_ add your theme files to your Git repository so GitLab will have access to the theme. Without committing your theme files, your site cannot successfully build. - -``` -$ mv themes/mero/.git ~/.local/share/Trash/files/ -``` - -Alternately, use a **trash** command such as [Trashy][15]: - -``` -$ trash themes/mero/.git -``` - -Now you can add all the contents of your local project directory to Git and push it to GitLab: - -``` -$ git add . -$ git commit -m 'hugo init' -$ git push -u origin HEAD -``` - -### Go live with GitLab - -Once your code has been pushed to GitLab, take a look at your project page. An icon indicates GitLab is processing your build. It might take several minutes the first time you push your code, so be patient. However, don't be _too_ patient, because the icon doesn't always update reliably. - -![GitLab processing your build][16] - -While you're waiting for GitLab to assemble your site, go to your project settings and find the **Pages** panel. Once your site is ready, its URL will be provided for you. The URL is **yourGitLabUsername.gitlab.io/yourProjectName**. Navigate to that address to view the fruits of your labor. - -![Previewing Hugo site][17] - -If your site fails to assemble correctly, GitLab provides insight into the CI/CD pipeline logs. Review the error message for an indication of what went wrong. - -### Git and the web - -Hugo (or Jekyll or similar tools) is just one way to leverage Git as your web publishing tool. With server-side Git hooks, you can design your own Git-to-web pipeline with minimal scripting. With the community edition of GitLab, you can self-host your own GitLab instance or you can use an alternative like [Gitolite][18] or [Gitea][19] and use this article as inspiration for a custom solution. Have fun! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/building-hosting-website-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][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/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) -[2]: https://git-scm.com/ -[3]: http://gohugo.io -[4]: http://getgrav.org -[5]: http://picocms.org/ -[6]: https://jekyllrb.com -[7]: http://slackermedia.info/podwrite/ -[8]: https://opensource.com/sites/default/files/uploads/letsencrypt-site.jpg (Let's Encrypt website) -[9]: https://gohugo.io/getting-started/installing -[10]: https://opensource.com/article/17/6/set-path-linux -[11]: https://commonmark.org/help/ -[12]: https://themes.gohugo.io/ -[13]: https://themes.gohugo.io/gohugo-theme-ananke/ -[14]: https://docs.gitlab.com/ee/ci/#overview -[15]: http://slackermedia.info/trashy -[16]: https://opensource.com/sites/default/files/uploads/hugo-gitlab-cicd.jpg (GitLab processing your build) -[17]: https://opensource.com/sites/default/files/uploads/hugo-demo-site.jpg (Previewing Hugo site) -[18]: http://gitolite.com -[19]: http://gitea.io diff --git a/sources/tech/20190402 Manage your daily schedule with Git.md b/sources/tech/20190402 Manage your daily schedule with Git.md deleted file mode 100644 index 8f5d7d89bb..0000000000 --- a/sources/tech/20190402 Manage your daily schedule with Git.md +++ /dev/null @@ -1,240 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Manage your daily schedule with Git) -[#]: via: (https://opensource.com/article/19/4/calendar-git) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Manage your daily schedule with Git -====== -Treat time like source code and maintain your calendar with the help of -Git. -![website design image][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at using Git to keep track of your calendar. - -### Keep track of your schedule with Git - -What if time itself was but source code that could be managed and version controlled? While proving or disproving such a theory is probably beyond the scope of this article, it happens that you can treat time like source code and manage your daily schedule with the help of Git. - -The reigning champion for calendaring is the [CalDAV][3] protocol, which drives popular open source calendaring applications like [NextCloud][4] as well as popular closed source ones. There's nothing wrong with CalDAV (commenters, take heed). But it's not for everyone, and besides there's nothing less inspiring than a mono-culture. - -Because I have no interest in becoming invested in largely GUI-dependent CalDAV clients (although if you're looking for a good terminal CalDAV viewer, see [khal][5]), I started investigating text-based alternatives. Text-based calendaring has all the usual benefits of working in [plaintext][6]. It's lightweight, it's highly portable, and as long as it's structured, it's easy to parse and beautify (whatever _beauty_ means to you). - -And best of all, it's exactly what Git was designed to manage. - -### Org mode not in a scary way - -If you don't impose structure on your plaintext, it quickly falls into a pandemonium of off-the-cuff thoughts and devil-may-care notation. Luckily, a markup syntax exists for calendaring, and it's contained in the venerable productivity Emacs mode, [Org mode][7] (which, admit it, you've been meaning to start using anyway). - -The amazing thing about Org mode that many people don't realize is [you don't need to know or even use Emacs][8] to take advantage of conventions established by Org mode. You get a lot of great features if you _do_ use Emacs, but if Emacs intimidates you, then you can implement a Git-based Org-mode calendaring system without so much as installing Emacs. - -The only part of Org mode that you need to know is its syntax. Org-mode syntax is low-maintenance and fairly intuitive. The biggest difference in calendaring with Org mode instead of a GUI calendaring app is the workflow: instead of going to a calendar and finding the day you want to schedule a task, you create a list of tasks and then assign each one a day and time. - -Lists in Org mode use asterisks (*) as bullets. Here's my gaming task list: **** - -``` -* Gaming -** Build Stardrifter character -** Read Stardrifter rules -** Stardrifter playtest - -** Blue Planet @ Mike's - -** Run Rappan Athuk -*** Purchase hard copy -*** Skim Rappan Athuk -*** Build Rappan Athuk maps in maptool -*** Sort Rappan Athuk tokens -``` - -If you're familiar with [CommonMark][9] or Markdown, you'll notice that instead of using whitespace to create a subtask, Org mode favors the more explicit use of additional bullets. Whatever your background with lists, this is an intuitive and easy way to build a list, and it obviously is not inherently tied to Emacs (although using Emacs provides you with shortcuts so you can rearrange your list quickly). - -To turn your list into scheduled tasks or events in a calendar, go back through and add the keywords **SCHEDULED** and, optionally, **:CATEGORY:**. - -``` -* Gaming -:CATEGORY: Game -** Build Stardrifter character -SCHEDULED: <2019-03-22 18:00-19:00> -** Read Stardrifter rules -SCHEDULED: <2019-03-22 19:00-21:00> -** Stardrifter playtest -SCHEDULED: <2019-03-25 0900-1300> -** Blue Planet @ Mike's -SCHEDULED: <2019-03-18 18:00-23:00 +1w> - -and so on... -``` - -The **SCHEDULED** keyword marks the entry as an event that you expect to be notified about and the optional **:CATEGORY:** keyword is an arbitrary tagging system for your own use (and in Emacs, you can color-code entries according to category). - -For a repeating event, you can use notation such as **+1w** to create a weekly event or **+2w** for a fortnightly event, and so on. - -All the fancy markup available for Org mode is [documented][10], so don't hesitate to find more tricks to help it fit your needs. - -### Put it into Git - -Without Git, your Org-mode appointments are just a file on your local machine. It's the 21st century, though, so you at least need your calendar on your mobile phone, if not on all of your personal computers. You can use Git to publish your calendar for yourself and others. - -First, create a directory for your **.org** files. I store mine in **~/cal**. - -``` -$ mkdir ~/cal -``` - -Change into your directory and make it a Git repository: - -``` -$ cd cal -$ git init -``` - -Move your **.org** file to your local Git repo. In practice, I maintain one **.org** file per category. - -``` -$ mv ~/*.org ~/cal -$ ls -Game.org Meal.org Seth.org Work.org -``` - -Stage and commit your files: - -``` -$ git add *.org -$ git commit -m 'cal init' -``` - -### Create a Git remote - -To make your calendar available from anywhere, you must have a Git repository on the internet. Your calendar is plaintext, so any Git repository will do. You can put your calendar on [GitLab][11] or any other public Git hosting service (even proprietary ones), and as long as your host allows it, you can even mark the repository as private. If you don't want to post your calendar to a server you don't control, it's easy to host a Git repository yourself, either using a bare repository for a single user or using a frontend service like [Gitolite][12] or [Gitea][13]. - -In the interest of simplicity, I'll assume a self-hosted bare Git repository. You can create a bare remote repository on any server you have SSH access to with one Git command: -``` -$ ssh -p 22122 [seth@example.com][14] -[remote]$ mkdir cal.git -[remote]$ cd cal.git -[remote]$ git init --bare -[remote]$ exit -``` - -This bare repository can serve as your calendar's home on the internet. - -Set it as the remote source for your local (on your computer, not your server) Git repository: - -``` -$ git remote add origin seth@example.com:/home/seth/cal.git -``` - -And then push your calendar data to the server: - -``` -$ git push -u origin HEAD -``` - -With your calendar in a Git repository, it's available to you on any device running Git. That means you can make updates and changes to your schedule and push your changes upstream so it updates everywhere. - -I use this method to keep my calendar in sync between my work laptop and my home workstation. Since I use Emacs every day for most of the day, being able to view and edit my calendar in Emacs is a major convenience. The same is true for most people with a mobile device, so the next step is to set up an Org-mode calendaring system on a mobile. - -### Mobile Git - -Since your calendar data is in plaintext, strictly speaking, you can "use" it on any device that can read a text file. That's part of the beauty of this system; you're never without, at the very least, your raw data. But to integrate your calendar on a mobile device the way you'd expect a modern calendar to work, you need two components: a mobile Git client and a mobile Org-mode viewer. - -#### Git client for mobile - -[MGit][15] is a good Git client for Android. There are Git clients for iOS, as well. - -Once you've installed MGit (or a similar Git client), you must clone your calendar repository so your phone has a copy. To access your server from your mobile device, you must set up an SSH key for authentication. MGit can generate and store a key for you, which you must add to your server's **~/.ssh/authorized_keys** file or to your SSH keys in the settings of your hosted Git account. - -You must do this manually. MGit does not have an interface to log into your server or hosted Git account. If you do not do this, your mobile device cannot access your server to access your calendar data. - -I did it by copying the key file I generated in MGit to my laptop over [KDE Connect][16] (but you can do the same over Bluetooth, or with an SD card reader, or a USB cable, depending on your preferred method of accessing data on your phone). I copied the key (a file called **calkey** to my server with this command: - -``` -$ cat calkey | ssh seth@example.com "cat >> /home/seth/.ssh/authorized_keys" -``` - -You may have a different way of doing it, but if you ever set your server up for passwordless login, this is exactly the same process. If you're using a hosted Git service like GitLab, you must copy and paste the contents of your key file into your user account's SSH Key panel. - -![Adding key file data to GitLab][17] - -Once that's done, your mobile device can authorize to your server, but it still needs to know where to go to find your calendar data. Different apps may use different notation, but MGit uses plain old Git-over-SSH. That means if you're using a non-standard SSH port, you must specify the SSH port to use: - -``` -$ git clone ssh://seth@example.com:22122//home/seth/git/cal.git -``` - -![Specifying SSH port in MGit][18] - -If you use a different app, it may use a different syntax that allows you to provide a port in a special field or drop the **ssh://** prefix. Refer to the app documentation if you experience issues. - -Clone the repository to your phone. - -![Cloned repositories][19] - -Few Git apps are set to automatically update the repository. There are a few apps you can use to automate pulls, or you can set up Git hooks to push updates from your server—but I won't get into that here. For now, after you make an update to your calendar, be sure to pull new changes manually in MGit (or if you change events on your phone, push the changes to your server). - -![MGit push/pull settings][20] - -#### Mobile calendar - -There are a few different apps that provide frontends for Org mode on a mobile device. [Orgzly][21] is a great open source Android app that provides an interface for Org mode's greatest features, from the Agenda mode to the TODO lists. Install and launch it. - -From the Main menu, choose Setting Sync Repositories and select the directory containing your calendar files (i.e., the Git repository you cloned from your server). - -Give Orgzly a moment to import the data, then use Orgzly's [hamburger][22] menu to select the Agenda view. - -![Orgzly's agenda view][23] - -In Orgzly's Settings Reminders menu, you can choose which event types trigger a notification on your phone. You can get notifications for **SCHEDULED** tasks, **DEADLINE** tasks, or anything with an event time assigned to it. If you use your phone as your taskmaster, you'll never miss an event with Org mode and Orgzly. - -![Orgzly notification][24] - -Orgzly isn't just a parser. You can edit and update events, and even mark events **DONE**. - -![Orgzly to-do list][25] - -### Designed for and by you - -The important thing to understand about using Org mode and Git is that both applications are highly flexible, and it's expected that you'll customize how and what they do so they will adapt to your needs. If something in this article is an affront to how you organize your life or manage your weekly schedule, but you like other parts of what this proposal offers, then throw out the part you don't like. You can use Org mode in Emacs if you want, or you can just use it as calendar markup. You can set your phone to pull Git data right off your computer at the end of the day instead of a server on the internet, or you can configure your computer to sync calendars whenever your phone is plugged in, or you can manage it daily as you load up your phone with all the stuff you need for the workday. It's up to you, and that's the most significant thing about Git, about Org mode, and about open source. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/calendar-git - -作者:[Seth Kenlon (Red Hat, Community Moderator)][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/web-design-monitor-website.png?itok=yUK7_qR0 (website design image) -[2]: https://git-scm.com/ -[3]: https://tools.ietf.org/html/rfc4791 -[4]: http://nextcloud.com -[5]: https://github.com/pimutils/khal -[6]: https://plaintextproject.online/ -[7]: https://orgmode.org -[8]: https://opensource.com/article/19/1/productivity-tool-org-mode -[9]: https://commonmark.org/ -[10]: https://orgmode.org/manual/ -[11]: http://gitlab.com -[12]: http://gitolite.com/gitolite/index.html -[13]: https://gitea.io/en-us/ -[14]: mailto:seth@example.com -[15]: https://f-droid.org/en/packages/com.manichord.mgit -[16]: https://community.kde.org/KDEConnect -[17]: https://opensource.com/sites/default/files/uploads/gitlab-add-key.jpg (Adding key file data to GitLab) -[18]: https://opensource.com/sites/default/files/uploads/mgit-0.jpg (Specifying SSH port in MGit) -[19]: https://opensource.com/sites/default/files/uploads/mgit-1.jpg (Cloned repositories) -[20]: https://opensource.com/sites/default/files/uploads/mgit-2.jpg (MGit push/pull settings) -[21]: https://f-droid.org/en/packages/com.orgzly/ -[22]: https://en.wikipedia.org/wiki/Hamburger_button -[23]: https://opensource.com/sites/default/files/uploads/orgzly-agenda.jpg (Orgzly's agenda view) -[24]: https://opensource.com/sites/default/files/uploads/orgzly-cal-notify.jpg (Orgzly notification) -[25]: https://opensource.com/sites/default/files/uploads/orgzly-cal-todo.jpg (Orgzly to-do list) diff --git a/sources/tech/20190403 Use Git as the backend for chat.md b/sources/tech/20190403 Use Git as the backend for chat.md deleted file mode 100644 index e564bbc6e7..0000000000 --- a/sources/tech/20190403 Use Git as the backend for chat.md +++ /dev/null @@ -1,141 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Git as the backend for chat) -[#]: via: (https://opensource.com/article/19/4/git-based-chat) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Use Git as the backend for chat -====== -GIC is a prototype chat application that showcases a novel way to use Git. -![Team communication, chat][1] - -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at GIC, a Git-based chat application - -### Meet GIC - -While the authors of Git probably expected frontends to be created for Git, they undoubtedly never expected Git would become the backend for, say, a chat client. Yet, that's exactly what developer Ephi Gabay did with his experimental proof-of-concept [GIC][3]: a chat client written in [Node.js][4] using Git as its backend database. - -GIC is by no means intended for production use. It's purely a programming exercise, but it's one that demonstrates the flexibility of open source technology. What's astonishing is that the client consists of just 300 lines of code, excluding the Node libraries and Git itself. And that's one of the best things about the chat client and about open source; the ability to build upon existing work. Seeing is believing, so you should give GIC a look for yourself. - -### Get set up - -GIC uses Git as its engine, so you need an empty Git repository to serve as its chatroom and logger. The repository can be hosted anywhere, as long as you and anyone who needs access to the chat service has access to it. For instance, you can set up a Git repository on a free Git hosting service like GitLab and grant chat users contributor access to the Git repository. (They must be able to make commits to the repository, because each chat message is a literal commit.) - -If you're hosting it yourself, create a centrally located bare repository. Each user in the chat must have an account on the server where the bare repository is located. You can create accounts specific to Git with Git hosting software like [Gitolite][5] or [Gitea][6], or you can give them individual user accounts on your server, possibly using **git-shell** to restrict their access to Git. - -Performance is best on a self-hosted instance. Whether you host your own or you use a hosting service, the Git repository you create must have an active branch, or GIC won't be able to make commits as users chat because there is no Git HEAD. The easiest way to ensure that a branch is initialized and active is to commit a README or license file upon creation. If you don't do that, you can create and commit one after the fact: - -``` -$ echo "chat logs" > README -$ git add README -$ git commit -m 'just creating a HEAD ref' -$ git push -u origin HEAD -``` - -### Install GIC - -Since GIC is based on Git and written in Node.js, you must first install Git, Node.js, and the Node package manager, npm (which should be bundled with Node). The command to install these differs depending on your Linux or BSD distribution, but here's an example command on Fedora: - -``` -$ sudo dnf install git nodejs -``` - -If you're not running Linux or BSD, follow the installation instructions on [git-scm.com][7] and [nodejs.org][8]. - -There's no install process, as such, for GIC. Each user (Alice and Bob, in this example) must clone the repository to their hard drive: - -``` -$ git cone https://github.com/ephigabay/GIC GIC -``` - -Change directory into the GIC directory and install the Node.js dependencies with **npm** : - -``` -$ cd GIC -$ npm install -``` - -Wait for the Node modules to download and install. - -### Configure GIC - -The only configuration GIC requires is the location of your Git chat repository. Edit the **config.js** file: - -``` -module.exports = { -gitRepo: '[seth@example.com][9]:/home/gitchat/chatdemo.git', -messageCheckInterval: 500, -branchesCheckInterval: 5000 -}; -``` - - -Test your connection to the Git repository before trying GIC, just to make sure your configuration is sane: - -``` -$ git clone --quiet seth@example.com:/home/gitchat/chatdemo.git > /dev/null -``` - -Assuming you receive no errors, you're ready to start chatting. - -### Chat with Git - -From within the GIC directory, start the chat client: - -``` -$ npm start -``` - -When the client first launches, it must clone the chat repository. Since it's nearly an empty repository, it won't take long. Type your message and press Enter to send a message. - -![GIC][10] - -A Git-based chat client. What will they think of next? - -As the greeting message says, a branch in Git serves as a chatroom or channel in GIC. There's no way to create a new branch from within the GIC UI, but if you create one in another terminal session or in a web UI, it shows up immediately in GIC. It wouldn't take much to patch some IRC-style commands into GIC. - -After chatting for a while, take a look at your Git repository. Since the chat happens in Git, the repository itself is also a chat log: - -``` -$ git log --pretty=format:"%p %cn %s" -4387984 Seth Kenlon Hey Chani, did you submit a talk for All Things Open this year? -36369bb Chani No I didn't get a chance. Did you? -[...] -``` - -### Exit GIC - -Not since Vim has there been an application as difficult to stop as GIC. You see, there is no way to stop GIC. It will continue to run until it is killed. When you're ready to stop GIC, open another terminal tab or window and issue this command: - -``` -$ kill `pgrep npm` -``` - -GIC is a novelty. It's a great example of how an open source ecosystem encourages and enables creativity and exploration and challenges us to look at applications from different angles. Try GIC out. Maybe it will give you ideas. At the very least, it's a great excuse to spend an afternoon with Git. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/git-based-chat - -作者:[Seth Kenlon (Red Hat, Community Moderator)][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/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://git-scm.com/ -[3]: https://github.com/ephigabay/GIC -[4]: https://nodejs.org/en/ -[5]: http://gitolite.com -[6]: http://gitea.io -[7]: http://git-scm.com -[8]: http://nodejs.org -[9]: mailto:seth@example.com -[10]: https://opensource.com/sites/default/files/uploads/gic.jpg (GIC) diff --git a/sources/tech/20190404 How writers can get work done better with Git.md b/sources/tech/20190404 How writers can get work done better with Git.md new file mode 100644 index 0000000000..1da47fd69f --- /dev/null +++ b/sources/tech/20190404 How writers can get work done better with Git.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How writers can get work done better with Git) +[#]: via: (https://opensource.com/article/19/4/write-git) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/noreplyhttps://opensource.com/users/seth) + +How writers can get work done better with Git +====== +If you're a writer, you could probably benefit from using Git. Learn how +in our series about little-known uses of Git. +![Writing Hand][1] + +[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at ways writers can use Git to get work done. + +### Git for writers + +Some people write fiction; others write academic papers, poetry, screenplays, technical manuals, or articles about open source. Many do a little of each. The common thread is that if you're a writer, you could probably benefit from using Git. While Git is famously a highly technical tool used by computer programmers, it's ideal for the modern author, and this article will demonstrate how it can change the way you write—and why you'd want it to. + +Before talking about Git, though, it's important to talk about what _copy_ (or _content_ , for the digital age) really is, and why it's different from your delivery _medium_. It's the 21 st century, and the tool of choice for most writers is a computer. While computers are deceptively good at combining processes like copy editing and layout, writers are (re)discovering that separating content from style is a good idea, after all. That means you should be writing on a computer like it's a typewriter, not a word processor. In computer lingo, that means writing in _plaintext_. + +### Writing in plaintext + +It used to be a safe assumption that you knew what market you were writing for. You wrote content for a book, or a website, or a software manual. These days, though, the market's flattened: you might decide to use content you write for a website in a printed book project, and the printed book might release an EPUB version later. And in the case of digital editions of your content, the person reading your content is in ultimate control: they may read your words on the website where you published them, or they might click on Firefox's excellent [Reader View][3], or they might print to physical paper, or they could dump the web page to a text file with Lynx, or they may not see your content at all because they use a screen reader. + +It makes sense to write your words as words, leaving the delivery to the publishers. Even if you are also your own publisher, treating your words as a kind of source code for your writing is a smarter and more efficient way to work, because when it comes time to publish, you can use the same source (your plaintext) to generate output appropriate to your target (PDF for print, EPUB for e-books, HTML for websites, and so on). + +Writing in plaintext not only means you don't have to worry about layout or how your text is styled, but you also no longer require specialized tools. Anything that can produce text becomes a valid "word processor" for you, whether it's a basic notepad app on your mobile or tablet, the text editor that came bundled with your computer, or a free editor you download from the internet. You can write on practically any device, no matter where you are or what you're doing, and the text you produce integrates perfectly with your project, no modification required. + +And, conveniently, Git specializes in managing plaintext. + +### The Atom editor + +When you write in plaintext, a word processor is overkill. Using a text editor is easier because text editors don't try to "helpfully" restructure your input. It lets you type the words in your head onto the screen, no interference. Better still, text editors are often designed around a plugin architecture, such that the application itself is woefully basic (it edits text), but you can build an environment around it to meet your every need. + +A great example of this design philosophy is the [Atom][4] editor. It's a cross-platform text editor with built-in Git integration. If you're new to working in plaintext and new to Git, Atom is the easiest way to get started. + +#### Install Git and Atom + +First, make sure you have Git installed on your system. If you run Linux or BSD, Git is available in your software repository or ports tree. The command you use will vary depending on your distribution; on Fedora, for instance: + + +``` +`$ sudo dnf install git` +``` + +You can also download and install Git for [Mac][5] and [Windows][6]. + +You won't need to use Git directly, because Atom serves as your Git interface. Installing Atom is the next step. + +If you're on Linux, install Atom from your software repository through your software installer or the appropriate command, such as: + + +``` +`$ sudo dnf install atom` +``` + +Atom does not currently build on BSD. However, there are very good alternatives available, such as [GNU Emacs][7]. For Mac and Windows users, you can find installers on the [Atom website][4]. + +Once your installs are done, launch the Atom editor. + +#### A quick tour + +If you're going to live in plaintext and Git, you need to get comfortable with your editor. Atom's user interface may be more dynamic than what you are used to. You can think of it more like Firefox or Chrome than as a word processor, in fact, because it has tabs and panels that can be opened and closed as they are needed, and it even has add-ons that you can install and configure. It's not practical to try to cover all of Atom's many features, but you can at least get familiar with what's possible. + +When Atom opens, it displays a welcome screen. If nothing else, this screen is a good introduction to Atom's tabbed interface. You can close the welcome screens by clicking the "close" icons on the tabs at the top of the Atom window and create a new file using **File > New File**. + +Working in plaintext is a little different than working in a word processor, so here are some tips for writing content in a way that a human can connect with and that Git and computers can parse, track, and convert. + +#### Write in Markdown + +These days, when people talk about plaintext, mostly they mean Markdown. Markdown is more of a style than a format, meaning that it intends to provide a predictable structure to your text so computers can detect natural patterns and convert the text intelligently. Markdown has many definitions, but the best technical definition and cheatsheet is on [CommonMark's website][8]. + + +``` +# Chapter 1 + +This is a paragraph with an *italic* word and a **bold** word in it. +And it can even reference an image. + +![An image will render here.](drawing.jpg) +``` + +As you can tell from the example, Markdown isn't meant to read or feel like code, but it can be treated as code. If you follow the expectations of Markdown defined by CommonMark, then you can reliably convert, with just one click of a button, your writing from Markdown to .docx, .epub, .html, MediaWiki, .odt, .pdf, .rtf, and a dozen other formats _without_ loss of formatting. + +You can think of Markdown a little like a word processor's styles. If you've ever written for a publisher with a set of styles that govern what chapter titles and section headings look like, this is basically the same thing, except that instead of selecting a style from a drop-down menu, you're adding little notations to your text. These notations look natural to any modern reader who's used to "txt speak," but are swapped out with fancy text stylings when the text is rendered. It is, in fact, what word processors secretly do behind the scenes. The word processor shows bold text, but if you could see the code generated to make your text bold, it would be a lot like Markdown (actually it's the far more complex XML). With Markdown, that barrier is removed, which looks scarier on the one hand, but on the other hand, you can write Markdown on literally anything that generates text without losing any formatting information. + +The popular file extension for Markdown files is .md. If you're on a platform that doesn't know what a .md file is, you can associate the extension to Atom manually or else just use the universal .txt extension. The file extension doesn't change the nature of the file; it just changes how your computer decides what to do with it. Atom and some platforms are smart enough to know that a file is plaintext no matter what extension you give it. + +#### Live preview + +Atom features the **Markdown Preview** plugin, which shows you both the plain Markdown you're writing and the way it will (commonly) render. + +![Atom's preview screen][9] + +To activate this preview pane, select **Packages > Markdown Preview > Toggle Preview** or press **Ctrl+Shift+M**. + +This view provides you with the best of both worlds. You get to write without the burden of styling your text, but you also get to see a common example of what your text will look like, at least in a typical digital format. Of course, the point is that you can't control how your text is ultimately rendered, so don't be tempted to adjust your Markdown to force your render preview to look a certain way. + +#### One sentence per line + +Your high school writing teacher doesn't ever have to see your Markdown. + +It won't come naturally at first, but maintaining one sentence per line makes more sense in the digital world. Markdown ignores single line breaks (when you've pressed the Return or Enter key) and only creates a new paragraph after a single blank line. + +![Writing in Atom][10] + +The advantage of writing one sentence per line is that your work is easier to track. That is, if you've changed one word at the start of a paragraph, then it's easy for Atom, Git, or any application to highlight that change in a meaningful way if the change is limited to one line rather than one word in a long paragraph. In other words, a change to one sentence should only affect that sentence, not the whole paragraph. + +You might be thinking, "many word processors track changes, too, and they can highlight a single word that's changed." But those revision trackers are bound to the interface of that word processor, which means you can't look through revisions without being in front of that word processor. In a plaintext workflow, you can review revisions in plaintext, which means you can make or approve edits no matter what you have on hand, as long as that device can deal with plaintext (and most of them can). + +Writers admittedly don't usually think in terms of line numbers, but it's a useful tool for computers, and ultimately a great reference point in general. Atom numbers the lines of your text document by default. A _line_ is only a line once you have pressed the Enter or Return key. + +![Writing in Atom][11] + +If a line has a dot instead of a number, that means it's part of the previous line wrapped for you because it couldn't fit on your screen. + +#### Theme it + +If you're a visual person, you might be very particular about the way your writing environment looks. Even if you are writing in plain Markdown, it doesn't mean you have to write in a programmer's font or in a dark window that makes you look like a coder. The simplest way to modify what Atom looks like is to use [theme packages][12]. It's conventional for theme designers to differentiate dark themes from light themes, so you can search with the keyword Dark or Light, depending on what you want. + +To install a theme, select **Edit > Preferences**. This opens a new tab in the Atom interface. Yes, tabs are used for your working documents _and_ for configuration and control panels. In the **Settings** tab, click on the **Install** category. + +In the **Install** panel, search for the name of the theme you want to install. Click the **Themes** button on the right of the search field to search only for themes. Once you've found your theme, click its **Install** button. + +![Atom's themes][13] + +To use a theme you've installed or to customize a theme to your preference, navigate to the **Themes** category in your **Settings** tab. Pick the theme you want to use from the drop-down menu. The changes take place immediately, so you can see exactly how the theme affects your environment. + +You can also change your working font in the **Editor** category of the **Settings** tab. Atom defaults to monospace fonts, which are generally preferred by programmers. But you can use any font on your system, whether it's serif or sans or gothic or cursive. Whatever you want to spend your day staring at, it's entirely up to you. + +On a related note, by default Atom draws a vertical marker down its screen as a guide for people writing code. Programmers often don't want to write long lines of code, so this vertical line is a reminder to them to simplify things. The vertical line is meaningless to writers, though, and you can remove it by disabling the **wrap-guide** package. + +To disable the **wrap-guide** package, select the **Packages** category in the **Settings** tab and search for **wrap-guide**. When you've found the package, click its **Disable** button. + +#### Dynamic structure + +When creating a long document, I find that writing one chapter per file makes more sense than writing an entire book in a single file. Furthermore, I don't name my chapters in the obvious syntax **chapter-1.md** or **1.example.md** , but by chapter titles or keywords, such as **example.md**. To provide myself guidance in the future about how the book is meant to be assembled, I maintain a file called **toc.md** (for "Table of Contents") where I list the (current) order of my chapters. + +I do this because, no matter how convinced I am that chapter 6 just couldn't possibly happen before chapter 1, there's rarely a time that I don't swap the order of one or two chapters or sections before I'm finished with a book. I find that keeping it dynamic from the start helps me avoid renaming confusion, and it also helps me treat the material less rigidly. + +### Git in Atom + +Two things every writer has in common is that they're writing for keeps and their writing is a journey. You don't sit down to write and finish with a final draft; by definition, you have a first draft. And that draft goes through revisions, each of which you carefully save in duplicate and triplicate just in case one of your files turns up corrupted. Eventually, you get to what you call a final draft, but more than likely you'll be going back to it one day, either to resurrect the good parts or to fix the bad. + +The most exciting feature in Atom is its strong Git integration. Without ever leaving Atom, you can interact with all of the major features of Git, tracking and updating your project, rolling back changes you don't like, integrating changes from a collaborator, and more. The best way to learn it is to step through it, so here's how to use Git within the Atom interface from the beginning to the end of a writing project. + +First thing first: Reveal the Git panel by selecting **View > Toggle Git Tab**. This causes a new tab to open on the right side of Atom's interface. There's not much to see yet, so just keep it open for now. + +#### Starting a Git project + +You can think of Git as being bound to a folder. Any folder outside a Git directory doesn't know about Git, and Git doesn't know about it. Folders and files within a Git directory are ignored until you grant Git permission to keep track of them. + +You can create a Git project by creating a new project folder in Atom. Select **File > Add Project Folder** and create a new folder on your system. The folder you create appears in the left **Project Panel** of your Atom window. + +#### Git add + +Right-click on your new project folder and select **New File** to create a new file in your project folder. If you have files you want to import into your new project, right-click on the folder and select **Show in File Manager** to open the folder in your system's file viewer (Dolphin or Nautilus on Linux, Finder on Mac, Explorer on Windows), and then drag-and-drop your files. + +With a project file (either the empty one you created or one you've imported) open in Atom, click the **Create Repository** button in the **Git** tab. In the pop-up dialog box, click **Init** to initialize your project directory as a local Git repository. Git adds a **.git** directory (invisible in your system's file manager, but visible to you in Atom) to your project folder. Don't be fooled by this: The **.git** directory is for Git to manage, not you, so you'll generally stay out of it. But seeing it in Atom is a good reminder that you're working in a project actively managed by Git; in other words, revision history is available when you see a **.git** directory. + +In your empty file, write some stuff. You're a writer, so type some words. It can be any set of words you please, but remember the writing tips above. + +Press **Ctrl+S** to save your file and it will appear in the **Unstaged Changes** section of the **Git** tab. That means the file exists in your project folder but has not yet been committed over to Git's purview. Allow Git to keep track of your file by clicking on the **Stage All** button in the top-right of the **Git** tab. If you've used a word processor with revision history, you can think of this step as permitting Git to record changes. + +#### Git commit + +Your file is now staged. All that means is Git is aware that the file exists and is aware that it has been changed since the last time Git was made aware of it. + +A Git commit sends your file into Git's internal and eternal archives. If you're used to word processors, this is similar to naming a revision. To create a commit, enter some descriptive text in the **Commit** message box at the bottom of the **Git** tab. You can be vague or cheeky, but it's more useful if you enter useful information for your future self so that you know why the revision was made. + +The first time you make a commit, you must create a branch. Git branches are a little like alternate realities, allowing you to switch from one timeline to another to make changes that you may or may not want to keep forever. If you end up liking the changes, you can merge one experimental branch into another, thereby unifying different versions of your project. It's an advanced process that's not worth learning upfront, but you still need an active branch, so you have to create one for your first commit. + +Click on the **Branch** icon at the very bottom of the **Git** tab to create a new branch. + +![Creating a branch][14] + +It's customary to name your first branch **master**. You don't have to; you can name it **firstdraft** or whatever you like, but adhering to the local customs can sometimes make talking about Git (and looking up answers to questions) a little easier because you'll know that when someone mentions **master** , they really mean **master** and not **firstdraft** or whatever you called your branch. + +On some versions of Atom, the UI may not update to reflect that you've created a new branch. Don't worry; the branch will be created (and the UI updated) once you make your commit. Press the **Commit** button, whether it reads **Create detached commit** or **Commit to master**. + +Once you've made a commit, the state of your file is preserved forever in Git's memory. + +#### History and Git diff + +A natural question is how often you should make a commit. There's no one right answer to that. Saving a file with **Ctrl+S** and committing to Git are two separate processes, so you will continue to do both. You'll probably want to make commits whenever you feel like you've done something significant or are about to try out a crazy new idea that you may want to back out of. + +To get a feel for what impact a commit has on your workflow, remove some text from your test document and add some text to the top and bottom. Make another commit. Do this a few times until you have a small history at the bottom of your **Git** tab, then click on a commit to view it in Atom. + +![Viewing differences][15] + +When viewing a past commit, you see three elements: + + 1. Text in green was added to a document when the commit was made. + 2. Text in red was removed from the document when the commit was made. + 3. All other text was untouched. + + + +#### Remote backup + +One of the advantages of using Git is that, by design, it is distributed, meaning you can commit your work to your local repository and push your changes out to any number of servers for backup. You can also pull changes in from those servers so that whatever device you happen to be working on always has the latest changes. + +For this to work, you must have an account on a Git server. There are several free hosting services out there, including GitHub, the company that produces Atom but oddly is not open source, and GitLab, which is open source. Preferring open source to proprietary, I'll use GitLab in this example. + +If you don't already have a GitLab account, sign up for one and start a new project. The project name doesn't have to match your project folder in Atom, but it probably makes sense if it does. You can leave your project private, in which case only you and anyone you give explicit permissions to can access it, or you can make it public if you want it to be available to anyone on the internet who stumbles upon it. + +Do not add a README to the project. + +Once the project is created, it provides you with instructions on how to set up the repository. This is great information if you decide to use Git in a terminal or with a separate GUI, but Atom's workflow is different. + +Click the **Clone** button in the top-right of the GitLab interface. This reveals the address you must use to access the Git repository. Copy the **SSH** address (not the **https** address). + +In Atom, click on your project's **.git** directory and open the **config**. Add these configuration lines to the file, adjusting the **seth/example.git** part of the **url** value to match your unique address. + +* * * + + +``` +[remote "origin"] +url = [git@gitlab.com][16]:seth/example.git +fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] +remote = origin +merge = refs/heads/master +``` + +At the bottom of the **Git** tab, a new button has appeared, labeled **Fetch**. Since your server is brand new and therefore has no data for you to fetch, right-click on the button and select **Push**. This pushes your changes to your Gitlab account, and now your project is backed up on a Git server. + +Pushing changes to a server is something you can do after each commit. It provides immediate offsite backup and, since the amount of data is usually minimal, it's practically as fast as a local save. + +### Writing and Git + +Git is a complex system, useful for more than just revision tracking and backups. It enables asynchronous collaboration and encourages experimentation. This article has covered the basics, but there are many more articles—and entire books—on Git and how to use it to make your work more efficient, more resilient, and more dynamic. It all starts with using Git for small tasks. The more you use it, the more questions you'll find yourself asking, and eventually the more tricks you'll learn. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/write-git + +作者:[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/noreplyhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/write-hand_0.jpg?itok=Uw5RJD03 (Writing Hand) +[2]: https://git-scm.com/ +[3]: https://support.mozilla.org/en-US/kb/firefox-reader-view-clutter-free-web-pages +[4]: http://atom.io +[5]: https://git-scm.com/download/mac +[6]: https://git-scm.com/download/win +[7]: http://gnu.org/software/emacs +[8]: https://commonmark.org/help/ +[9]: https://opensource.com/sites/default/files/uploads/atom-preview.jpg (Atom's preview screen) +[10]: https://opensource.com/sites/default/files/uploads/atom-para.jpg (Writing in Atom) +[11]: https://opensource.com/sites/default/files/uploads/atom-linebreak.jpg (Writing in Atom) +[12]: https://atom.io/themes +[13]: https://opensource.com/sites/default/files/uploads/atom-theme.jpg (Atom's themes) +[14]: https://opensource.com/sites/default/files/uploads/atom-branch.jpg (Creating a branch) +[15]: https://opensource.com/sites/default/files/uploads/git-diff.jpg (Viewing differences) +[16]: mailto:git@gitlab.com diff --git a/sources/tech/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md b/sources/tech/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md deleted file mode 100644 index 2110c17606..0000000000 --- a/sources/tech/20190408 A beginner-s guide to building DevOps pipelines with open source tools.md +++ /dev/null @@ -1,352 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A beginner's guide to building DevOps pipelines with open source tools) -[#]: via: (https://opensource.com/article/19/4/devops-pipeline) -[#]: author: (Bryant Son https://opensource.com/users/brson/users/milindsingh/users/milindsingh/users/dscripter) - -A beginner's guide to building DevOps pipelines with open source tools -====== -If you're new to DevOps, check out this five-step process for building -your first pipeline. -![Shaking hands, networking][1] - -DevOps has become the default answer to fixing software development processes that are slow, siloed, or otherwise dysfunctional. But that doesn't mean very much when you're new to DevOps and aren't sure where to begin. This article explores what a DevOps pipeline is and offers a five-step process to create one. While this tutorial is not comprehensive, it should give you a foundation to start on and expand later. But first, a story. - -### My DevOps journey - -I used to work for the cloud team at Citi Group, developing an Infrastructure-as-a-Service (IaaS) web application to manage Citi's cloud infrastructure, but I was always interested in figuring out ways to make the development pipeline more efficient and bring positive cultural change to the development team. I found my answer in a book recommended by Greg Lavender, who was the CTO of Citi's cloud architecture and infrastructure engineering, called _[The Phoenix Project][2]_. The book reads like a novel while it explains DevOps principles. - -A table at the back of the book shows how often different companies deploy to the release environment: - -Company | Deployment Frequency ----|--- -Amazon | 23,000 per day -Google | 5,500 per day -Netflix | 500 per day -Facebook | 1 per day -Twitter | 3 per week -Typical enterprise | 1 every 9 months - -How are the frequency rates of Amazon, Google, and Netflix even possible? It's because these companies have figured out how to make a nearly perfect DevOps pipeline. - -This definitely wasn't the case before we implemented DevOps at Citi. Back then, my team had different staged environments, but deployments to the development server were very manual. All developers had access to just one development server based on IBM WebSphere Application Server Community Edition. The problem was the server went down whenever multiple users simultaneously tried to make deployments, so the developers had to let each other know whenever they were about to make a deployment, which was quite a pain. In addition, there were problems with low code test coverages, cumbersome manual deployment processes, and no way to track code deployments with a defined task or a user story. - -I realized something had to be done, and I found a colleague who felt the same way. We decided to collaborate to build an initial DevOps pipeline—he set up a virtual machine and a Tomcat application server while I worked on Jenkins, integrating with Atlassian Jira and BitBucket, and code testing coverages. This side project was hugely successful: we almost fully automated the development pipeline, we achieved nearly 100% uptime on our development server, we could track and improve code testing coverage, and the Git branch could be associated with the deployment and Jira task. And most of the tools we used to construct our DevOps pipeline were open source. - -I now realize how rudimentary our DevOps pipeline was, as we didn't take advantage of advanced configurations like Jenkins files or Ansible. However, this simple process worked well, maybe due to the [Pareto][3] principle (also known as the 80/20 rule). - -### A brief introduction to DevOps and the CI/CD pipeline - -If you ask several people, "What is DevOps? you'll probably get several different answers. DevOps, like agile, has evolved to encompass many different disciplines, but most people will agree on a few things: DevOps is a software development practice or a software development lifecycle (SDLC) and its central tenet is cultural change, where developers and non-developers all breathe in an environment where formerly manual things are automated; everyone does what they are best at; the number of deployments per period increases; throughput increases; and flexibility improves. - -While having the right software tools is not the only thing you need to achieve a DevOps environment, some tools are necessary. A key one is continuous integration and continuous deployment (CI/CD). This pipeline is where the environments have different stages (e.g., DEV, INT, TST, QA, UAT, STG, PROD), manual things are automated, and developers can achieve high-quality code, flexibility, and numerous deployments. - -This article describes a five-step approach to creating a DevOps pipeline, like the one in the following diagram, using open source tools. - -![Complete DevOps pipeline][4] - -Without further ado, let's get started. - -### Step 1: CI/CD framework - -The first thing you need is a CI/CD tool. Jenkins, an open source, Java-based CI/CD tool based on the MIT License, is the tool that popularized the DevOps movement and has become the de facto standard. - -So, what is Jenkins? Imagine it as some sort of a magical universal remote control that can talk to many many different services and tools and orchestrate them. On its own, a CI/CD tool like Jenkins is useless, but it becomes more powerful as it plugs into different tools and services. - -Jenkins is just one of many open source CI/CD tools that you can leverage to build a DevOps pipeline. - -Name | License ----|--- -[Jenkins][5] | Creative Commons and MIT -[Travis CI][6] | MIT -[CruiseControl][7] | BSD -[Buildbot][8] | GPL -[Apache Gump][9] | Apache 2.0 -[Cabie][10] | GNU - -Here's what a DevOps process looks like with a CI/CD tool. - -![CI/CD tool][11] - -You have a CI/CD tool running in your localhost, but there is not much you can do at the moment. Let's follow the next step of DevOps journey. - -### Step 2: Source control management - -The best (and probably the easiest) way to verify that your CI/CD tool can perform some magic is by integrating with a source control management (SCM) tool. Why do you need source control? Suppose you are developing an application. Whenever you build an application, you are programming—whether you are using Java, Python, C++, Go, Ruby, JavaScript, or any of the gazillion programming languages out there. The programming codes you write are called source codes. In the beginning, especially when you are working alone, it's probably OK to put everything in your local directory. But when the project gets bigger and you invite others to collaborate, you need a way to avoid merge conflicts while effectively sharing the code modifications. You also need a way to recover a previous version—and the process of making a backup and copying-and-pasting gets old. You (and your teammates) want something better. - -This is where SCM becomes almost a necessity. A SCM tool helps by storing your code in repositories, versioning your code, and coordinating among project members. - -Although there are many SCM tools out there, Git is the standard and rightly so. I highly recommend using Git, but there are other open source options if you prefer. - -Name | License ----|--- -[Git][12] | GPLv2 & LGPL v2.1 -[Subversion][13] | Apache 2.0 -[Concurrent Versions System][14] (CVS) | GNU -[Vesta][15] | LGPL -[Mercurial][16] | GNU GPL v2+ - -Here's what the DevOps pipeline looks like with the addition of SCM. - -![Source control management][17] - -The CI/CD tool can automate the tasks of checking in and checking out source code and collaborating across members. Not bad? But how can you make this into a working application so billions of people can use and appreciate it? - -### Step 3: Build automation tool - -Excellent! You can check out the code and commit your changes to the source control, and you can invite your friends to collaborate on the source control development. But you haven't yet built an application. To make it a web application, it has to be compiled and put into a deployable package format or run as an executable. (Note that an interpreted programming language like JavaScript or PHP doesn't need to be compiled.) - -Enter the build automation tool. No matter which build tool you decide to use, all build automation tools have a shared goal: to build the source code into some desired format and to automate the task of cleaning, compiling, testing, and deploying to a certain location. The build tools will differ depending on your programming language, but here are some common open source options to consider. - -Name | License | Programming Language ----|---|--- -[Maven][18] | Apache 2.0 | Java -[Ant][19] | Apache 2.0 | Java -[Gradle][20] | Apache 2.0 | Java -[Bazel][21] | Apache 2.0 | Java -[Make][22] | GNU | N/A -[Grunt][23] | MIT | JavaScript -[Gulp][24] | MIT | JavaScript -[Buildr][25] | Apache | Ruby -[Rake][26] | MIT | Ruby -[A-A-P][27] | GNU | Python -[SCons][28] | MIT | Python -[BitBake][29] | GPLv2 | Python -[Cake][30] | MIT | C# -[ASDF][31] | Expat (MIT) | LISP -[Cabal][32] | BSD | Haskell - -Awesome! You can put your build automation tool configuration files into your source control management and let your CI/CD tool build it. - -![Build automation tool][33] - -Everything is good, right? But where can you deploy it? - -### Step 4: Web application server - -So far, you have a packaged file that might be executable or deployable. For any application to be truly useful, it has to provide some kind of a service or an interface, but you need a vessel to host your application. - -For a web application, a web application server is that vessel. An application server offers an environment where the programming logic inside the deployable package can be detected, render the interface, and offer the web services by opening sockets to the outside world. You need an HTTP server as well as some other environment (like a virtual machine) to install your application server. For now, let's assume you will learn about this along the way (although I will discuss containers below). - -There are a number of open source web application servers available. - -Name | License | Programming Language ----|---|--- -[Tomcat][34] | Apache 2.0 | Java -[Jetty][35] | Apache 2.0 | Java -[WildFly][36] | GNU Lesser Public | Java -[GlassFish][37] | CDDL & GNU Less Public | Java -[Django][38] | 3-Clause BSD | Python -[Tornado][39] | Apache 2.0 | Python -[Gunicorn][40] | MIT | Python -[Python Paste][41] | MIT | Python -[Rails][42] | MIT | Ruby -[Node.js][43] | MIT | Javascript - -Now the DevOps pipeline is almost usable. Good job! - -![Web application server][44] - -Although it's possible to stop here and integrate further on your own, code quality is an important thing for an application developer to be concerned about. - -### Step 5: Code testing coverage - -Implementing code test pieces can be another cumbersome requirement, but developers need to catch any errors in an application early on and improve the code quality to ensure end users are satisfied. Luckily, there are many open source tools available to test your code and suggest ways to improve its quality. Even better, most CI/CD tools can plug into these tools and automate the process. - -There are two parts to code testing: _code testing frameworks_ that help write and run the tests, and _code quality suggestion tools_ that help improve code quality. - -#### Code test frameworks - -Name | License | Programming Language ----|---|--- -[JUnit][45] | Eclipse Public License | Java -[EasyMock][46] | Apache | Java -[Mockito][47] | MIT | Java -[PowerMock][48] | Apache 2.0 | Java -[Pytest][49] | MIT | Python -[Hypothesis][50] | Mozilla | Python -[Tox][51] | MIT | Python - -#### Code quality suggestion tools - -Name | License | Programming Language ----|---|--- -[Cobertura][52] | GNU | Java -[CodeCover][53] | Eclipse Public (EPL) | Java -[Coverage.py][54] | Apache 2.0 | Python -[Emma][55] | Common Public License | Java -[JaCoCo][56] | Eclipse Public License | Java -[Hypothesis][50] | Mozilla | Python -[Tox][51] | MIT | Python -[Jasmine][57] | MIT | JavaScript -[Karma][58] | MIT | JavaScript -[Mocha][59] | MIT | JavaScript -[Jest][60] | MIT | JavaScript - -Note that most of the tools and frameworks mentioned above are written for Java, Python, and JavaScript, since C++ and C# are proprietary programming languages (although GCC is open source). - -Now that you've implemented code testing coverage tools, your DevOps pipeline should resemble the DevOps pipeline diagram shown at the beginning of this tutorial. - -### Optional steps - -#### Containers - -As I mentioned above, you can host your application server on a virtual machine or a server, but containers are a popular solution. - -[What are][61] [containers][61]? The short explanation is that a VM needs the huge footprint of an operating system, which overwhelms the application size, while a container just needs a few libraries and configurations to run the application. There are clearly still important uses for a VM, but a container is a lightweight solution for hosting an application, including an application server. - -Although there are other options for containers, Docker and Kubernetes are the most popular. - -Name | License ----|--- -[Docker][62] | Apache 2.0 -[Kubernetes][63] | Apache 2.0 - -To learn more, check out these other [Opensource.com][64] articles about Docker and Kubernetes: - - * [What Is Docker?][65] - * [An introduction to Docker][66] - * [What is Kubernetes?][67] - * [From 0 to Kubernetes][68] - - - -#### Middleware automation tools - -Our DevOps pipeline mostly focused on collaboratively building and deploying an application, but there are many other things you can do with DevOps tools. One of them is leveraging Infrastructure as Code (IaC) tools, which are also known as middleware automation tools. These tools help automate the installation, management, and other tasks for middleware software. For example, an automation tool can pull applications, like a web application server, database, and monitoring tool, with the right configurations and deploy them to the application server. - -Here are several open source middleware automation tools to consider: - -Name | License ----|--- -[Ansible][69] | GNU Public -[SaltStack][70] | Apache 2.0 -[Chef][71] | Apache 2.0 -[Puppet][72] | Apache or GPL - -For more on middleware automation tools, check out these other [Opensource.com][64] articles: - - * [A quickstart guide to Ansible][73] - * [Automating deployment strategies with Ansible][74] - * [Top 5 configuration management tools][75] - - - -### Where can you go from here? - -This is just the tip of the iceberg for what a complete DevOps pipeline can look like. Start with a CI/CD tool and explore what else you can automate to make your team's job easier. Also, look into [open source communication tools][76] that can help your team work better together. - -For more insight, here are some very good introductory articles about DevOps: - - * [What is DevOps][77] - * [5 things to master to be a DevOps engineer][78] - * [DevOps is for everyone][79] - * [Getting started with predictive analytics in DevOps][80] - - - -Integrating DevOps with open source agile tools is also a good idea: - - * [What is agile?][81] - * [4 steps to becoming an awesome agile developer][82] - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/devops-pipeline - -作者:[Bryant Son (Red Hat, Community Moderator)][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/brson/users/milindsingh/users/milindsingh/users/dscripter -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) -[2]: https://www.amazon.com/dp/B078Y98RG8/ -[3]: https://en.wikipedia.org/wiki/Pareto_principle -[4]: https://opensource.com/sites/default/files/uploads/1_finaldevopspipeline.jpg (Complete DevOps pipeline) -[5]: https://github.com/jenkinsci/jenkins -[6]: https://github.com/travis-ci/travis-ci -[7]: http://cruisecontrol.sourceforge.net -[8]: https://github.com/buildbot/buildbot -[9]: https://gump.apache.org -[10]: http://cabie.tigris.org -[11]: https://opensource.com/sites/default/files/uploads/2_runningjenkins.jpg (CI/CD tool) -[12]: https://git-scm.com -[13]: https://subversion.apache.org -[14]: http://savannah.nongnu.org/projects/cvs -[15]: http://www.vestasys.org -[16]: https://www.mercurial-scm.org -[17]: https://opensource.com/sites/default/files/uploads/3_sourcecontrolmanagement.jpg (Source control management) -[18]: https://maven.apache.org -[19]: https://ant.apache.org -[20]: https://gradle.org/ -[21]: https://bazel.build -[22]: https://www.gnu.org/software/make -[23]: https://gruntjs.com -[24]: https://gulpjs.com -[25]: http://buildr.apache.org -[26]: https://github.com/ruby/rake -[27]: http://www.a-a-p.org -[28]: https://www.scons.org -[29]: https://www.yoctoproject.org/software-item/bitbake -[30]: https://github.com/cake-build/cake -[31]: https://common-lisp.net/project/asdf -[32]: https://www.haskell.org/cabal -[33]: https://opensource.com/sites/default/files/uploads/4_buildtools.jpg (Build automation tool) -[34]: https://tomcat.apache.org -[35]: https://www.eclipse.org/jetty/ -[36]: http://wildfly.org -[37]: https://javaee.github.io/glassfish -[38]: https://www.djangoproject.com/ -[39]: http://www.tornadoweb.org/en/stable -[40]: https://gunicorn.org -[41]: https://github.com/cdent/paste -[42]: https://rubyonrails.org -[43]: https://nodejs.org/en -[44]: https://opensource.com/sites/default/files/uploads/5_applicationserver.jpg (Web application server) -[45]: https://junit.org/junit5 -[46]: http://easymock.org -[47]: https://site.mockito.org -[48]: https://github.com/powermock/powermock -[49]: https://docs.pytest.org -[50]: https://hypothesis.works -[51]: https://github.com/tox-dev/tox -[52]: http://cobertura.github.io/cobertura -[53]: http://codecover.org/ -[54]: https://github.com/nedbat/coveragepy -[55]: http://emma.sourceforge.net -[56]: https://github.com/jacoco/jacoco -[57]: https://jasmine.github.io -[58]: https://github.com/karma-runner/karma -[59]: https://github.com/mochajs/mocha -[60]: https://jestjs.io -[61]: /resources/what-are-linux-containers -[62]: https://www.docker.com -[63]: https://kubernetes.io -[64]: http://Opensource.com -[65]: https://opensource.com/resources/what-docker -[66]: https://opensource.com/business/15/1/introduction-docker -[67]: https://opensource.com/resources/what-is-kubernetes -[68]: https://opensource.com/article/17/11/kubernetes-lightning-talk -[69]: https://www.ansible.com -[70]: https://www.saltstack.com -[71]: https://www.chef.io -[72]: https://puppet.com -[73]: https://opensource.com/article/19/2/quickstart-guide-ansible -[74]: https://opensource.com/article/19/1/automating-deployment-strategies-ansible -[75]: https://opensource.com/article/18/12/configuration-management-tools -[76]: https://opensource.com/alternatives/slack -[77]: https://opensource.com/resources/devops -[78]: https://opensource.com/article/19/2/master-devops-engineer -[79]: https://opensource.com/article/18/11/how-non-engineer-got-devops -[80]: https://opensource.com/article/19/1/getting-started-predictive-analytics-devops -[81]: https://opensource.com/article/18/10/what-agile -[82]: https://opensource.com/article/19/2/steps-agile-developer diff --git a/sources/tech/20190409 Working with variables on Linux.md b/sources/tech/20190409 Working with variables on Linux.md deleted file mode 100644 index da4fec5ea9..0000000000 --- a/sources/tech/20190409 Working with variables on Linux.md +++ /dev/null @@ -1,267 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Working with variables on Linux) -[#]: via: (https://www.networkworld.com/article/3387154/working-with-variables-on-linux.html#tk.rss_all) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Working with variables on Linux -====== -Variables often look like $var, but they also look like $1, $*, $? and $$. Let's take a look at what all these $ values can tell you. -![Mike Lawrence \(CC BY 2.0\)][1] - -A lot of important values are stored on Linux systems in what we call “variables,” but there are actually several types of variables and some interesting commands that can help you work with them. In a previous post, we looked at [environment variables][2] and where they are defined. In this post, we're going to look at variables that are used on the command line and within scripts. - -### User variables - -While it's quite easy to set up a variable on the command line, there are a few interesting tricks. To set up a variable, all you need to do is something like this: - -``` -$ myvar=11 -$ myvar2="eleven" -``` - -To display the values, you simply do this: - -``` -$ echo $myvar -11 -$ echo $myvar2 -eleven -``` - -You can also work with your variables. For example, to increment a numeric variable, you could use any of these commands: - -``` -$ myvar=$((myvar+1)) -$ echo $myvar -12 -$ ((myvar=myvar+1)) -$ echo $myvar -13 -$ ((myvar+=1)) -$ echo $myvar -14 -$ ((myvar++)) -$ echo $myvar -15 -$ let "myvar=myvar+1" -$ echo $myvar -16 -$ let "myvar+=1" -$ echo $myvar -17 -$ let "myvar++" -$ echo $myvar -18 -``` - -With some of these, you can add more than 1 to a variable's value. For example: - -``` -$ myvar0=0 -$ ((myvar0++)) -$ echo $myvar0 -1 -$ ((myvar0+=10)) -$ echo $myvar0 -11 -``` - -With all these choices, you'll probably find at least one that is easy to remember and convenient to use. - -You can also _unset_ a variable — basically undefining it. - -``` -$ unset myvar -$ echo $myvar -``` - -Another interesting option is that you can set up a variable and make it **read-only**. In other words, once set to read-only, its value cannot be changed (at least not without some very tricky command line wizardry). That means you can't unset it either. - -``` -$ readonly myvar3=1 -$ echo $myvar3 -1 -$ ((myvar3++)) --bash: myvar3: readonly variable -$ unset myvar3 --bash: unset: myvar3: cannot unset: readonly variable -``` - -You can use any of those setting and incrementing options for assigning and manipulating variables within scripts, but there are also some very useful _internal variables_ for working within scripts. Note that you can't reassign their values or increment them. - -### Internal variables - -There are quite a few variables that can be used within scripts to evaluate arguments and display information about the script itself. - - * $1, $2, $3 etc. represent the first, second, third, etc. arguments to the script. - * $# represents the number of arguments. - * $* represents the string of arguments. - * $0 represents the name of the script itself. - * $? represents the return code of the previously run command (0=success). - * $$ shows the process ID for the script. - * $PPID shows the process ID for your shell (the parent process for the script). - - - -Some of these variables also work on the command line but show related information: - - * $0 shows the name of the shell you're using (e.g., -bash). - * $$ shows the process ID for your shell. - * $PPID shows the process ID for your shell's parent process (for me, this is sshd). - - - -If we throw all of these variables into a script just to see the results, we might do this: - -``` -#!/bin/bash - -echo $0 -echo $1 -echo $2 -echo $# -echo $* -echo $? -echo $$ -echo $PPID -``` - -When we call this script, we'll see something like this: - -``` -$ tryme one two three -/home/shs/bin/tryme <== script name -one <== first argument -two <== second argument -3 <== number of arguments -one two three <== all arguments -0 <== return code from previous echo command -10410 <== script's process ID -10109 <== parent process's ID -``` - -If we check the process ID of the shell once the script is done running, we can see that it matches the PPID displayed within the script: - -``` -$ echo $$ -10109 <== shell's process ID -``` - -Of course, we're more likely to use these variables in considerably more useful ways than simply displaying their values. Let's check out some ways we might do this. - -Checking to see if arguments have been provided: - -``` -if [ $# == 0 ]; then - echo "$0 filename" - exit 1 -fi -``` - -Checking to see if a particular process is running: - -``` -ps -ef | grep apache2 > /dev/null -if [ $? != 0 ]; then - echo Apache is not running - exit -fi -``` - -Verifying that a file exists before trying to access it: - -``` -if [ $# -lt 2 ]; then - echo "Usage: $0 lines filename" - exit 1 -fi - -if [ ! -f $2 ]; then - echo "Error: File $2 not found" - exit 2 -else - head -$1 $2 -fi -``` - -And in this little script, we check if the correct number of arguments have been provided, if the first argument is numeric, and if the second argument is an existing file. - -``` -#!/bin/bash - -if [ $# -lt 2 ]; then - echo "Usage: $0 lines filename" - exit 1 -fi - -if [[ $1 != [0-9]* ]]; then - echo "Error: $1 is not numeric" - exit 2 -fi - -if [ ! -f $2 ]; then - echo "Error: File $2 not found" - exit 3 -else - echo top of file - head -$1 $2 -fi -``` - -### Renaming variables - -When writing a complicated script, it's often useful to assign names to the script's arguments rather than continuing to refer to them as $1, $2, and so on. By the 35th line, someone reading your script might have forgotten what $2 represents. It will be a lot easier on that person if you assign an important parameter's value to $filename or $numlines. - -``` -#!/bin/bash - -if [ $# -lt 2 ]; then - echo "Usage: $0 lines filename" - exit 1 -else - numlines=$1 - filename=$2 -fi - -if [[ $numlines != [0-9]* ]]; then - echo "Error: $numlines is not numeric" - exit 2 -fi - -if [ ! -f $ filename]; then - echo "Error: File $filename not found" - exit 3 -else - echo top of file - head -$numlines $filename -fi -``` - -Of course, this example script does nothing more than run the head command to show the top X lines in a file, but it is meant to show how internal parameters can be used within scripts to help ensure the script runs well or fails with at least some clarity. - -**[ Watch Sandra Henry-Stocker's Two-Minute Linux Tips[to learn how to master a host of Linux commands][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/3387154/working-with-variables-on-linux.html#tk.rss_all - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/04/variable-key-keyboard-100793080-large.jpg -[2]: https://www.networkworld.com/article/3385516/how-to-manage-your-linux-environment.html -[3]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md b/sources/tech/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md deleted file mode 100644 index ce667a1dff..0000000000 --- a/sources/tech/20190429 How To Turn On And Shutdown The Raspberry Pi -Absolute Beginner Tip.md +++ /dev/null @@ -1,111 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Turn On And Shutdown The Raspberry Pi [Absolute Beginner Tip]) -[#]: via: (https://itsfoss.com/turn-on-raspberry-pi/) -[#]: author: (Chinmay https://itsfoss.com/author/chinmay/) - -How To Turn On And Shutdown The Raspberry Pi [Absolute Beginner Tip] -====== - -_**Brief: This quick tip teaches you how to turn on Raspberry Pi and how to shut it down properly afterwards.**_ - -The [Raspberry Pi][1] is one of the [most popular SBC (Single-Board-Computer)][2]. If you are interested in this topic, I believe that you’ve finally got a Pi device. I also advise to get all the [additional Raspberry Pi accessories][3] to get started with your device. - -You’re ready to turn it on and start to tinker around with it. It has it’s own similarities and differences compared to traditional computers like desktops and laptops. - -Today, let’s go ahead and learn how to turn on and shutdown a Raspberry Pi as it doesn’t really feature a ‘power button’ of sorts. - -For this article I’m using a Raspberry Pi 3B+, but it’s the same for all the Raspberry Pi variants. - -Bestseller No. 1 - -[][4] - -[CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)][4] - -CanaKit - Personal Computers - -$79.99 [][5] - -Bestseller No. 2 - -[][6] - -[CanaKit Raspberry Pi 3 B+ (B Plus) with Premium Clear Case and 2.5A Power Supply][6] - -CanaKit - Personal Computers - -$54.99 [][5] - -### Turn on Raspberry Pi - -![Micro USB port for Power][7] - -The micro USB port powers the Raspberry Pi, the way you turn it on is by plugging in the power cable into the micro USB port. But, before you do that you should make sure that you have done the following things. - - * Preparing the micro SD card with Raspbian according to the official [guide][8] and inserting into the micro SD card slot. - * Plugging in the HDMI cable, USB keyboard and a Mouse. - * Plugging in the Ethernet Cable(Optional). - - - -Once you have done the above, plug in the power cable. This turns on the Raspberry Pi and the display will light up and load the Operating System. - -Bestseller No. 1 - -[][4] - -[CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)][4] - -CanaKit - Personal Computers - -$79.99 [][5] - -### Shutting Down the Pi - -Shutting down the Pi is pretty straight forward, click the menu button and choose shutdown. - -![Turn off Raspberry Pi graphically][9] - -Alternatively, you can use the [shutdown command][10] in the terminal: - -``` -sudo shutdown now -``` - -Once the shutdown process has started **wait** till it completely finishes and then you can cut the power to it. Once the Pi shuts down, there is no real way to turn the Pi back on without turning off and turning on the power. You could the GPIO’s to turn on the Pi from the shutdown state but it’ll require additional modding. - -[][2] - -Suggested read 12 Single Board Computers: Alternative to Raspberry Pi - -_Note: Micro USB ports tend to be fragile, hence turn-off/on the power at source instead of frequently unplugging and plugging into the micro USB port._ - -Well, that’s about all you should know about turning on and shutting down the Pi, what do you plan to use it for? Let me know in the comments. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/turn-on-raspberry-pi/ - -作者:[Chinmay][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/chinmay/ -[b]: https://github.com/lujun9972 -[1]: https://www.raspberrypi.org/ -[2]: https://itsfoss.com/raspberry-pi-alternatives/ -[3]: https://itsfoss.com/things-you-need-to-get-your-raspberry-pi-working/ -[4]: https://www.amazon.com/CanaKit-Raspberry-Starter-Premium-Black/dp/B07BCC8PK7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07BCC8PK7&keywords=raspberry%20pi%20kit (CanaKit Raspberry Pi 3 B+ (B Plus) Starter Kit (32 GB EVO+ Edition, Premium Black Case)) -[5]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) -[6]: https://www.amazon.com/CanaKit-Raspberry-Premium-Clear-Supply/dp/B07BC7BMHY?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07BC7BMHY&keywords=raspberry%20pi%20kit (CanaKit Raspberry Pi 3 B+ (B Plus) with Premium Clear Case and 2.5A Power Supply) -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/04/raspberry-pi-3-microusb.png?fit=800%2C532&ssl=1 -[8]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/04/Raspbian-ui-menu.jpg?fit=800%2C492&ssl=1 -[10]: https://linuxhandbook.com/linux-shutdown-command/ diff --git a/sources/tech/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md b/sources/tech/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md deleted file mode 100644 index bb1d187ea4..0000000000 --- a/sources/tech/20190505 Blockchain 2.0 - An Introduction To Hyperledger Project (HLP) -Part 8.md +++ /dev/null @@ -1,88 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0 – An Introduction To Hyperledger Project (HLP) [Part 8]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/) -[#]: author: (editor https://www.ostechnix.com/author/editor/) - -Blockchain 2.0 – An Introduction To Hyperledger Project (HLP) [Part 8] -====== - -![Introduction To Hyperledger Project][1] - -Once a new technology platform reaches a threshold level of popularity in terms of active development and commercial interests, major global companies and smaller start-ups alike rush to catch a slice of the pie. **Linux** was one such platform back in the day. Once the ubiquity of its applications was realized individuals, firms, and institutions started displaying their interest in it and by 2000 the **Linux foundation** was formed. - -The Linux foundation aims to standardize and develop Linux as a platform by sponsoring their development team. The Linux Foundation is a non-profit organization that is supported by software and IT behemoths such as Microsoft, Oracle, Samsung, Cisco, IBM, Intel among others[1]. This is excluding the hundreds of individual developers who offer their services for the betterment of the platform. Over the years the Linux foundation has taken many projects under its roof. The **Hyperledger Project** is their fastest growing one till date. - -Such consortium led development have a lot of advantages when it comes to furthering tech into usable useful forms. Developing the standards, libraries and all the back-end protocols for large scale projects are expensive and resource intensive without a shred of income generating from it. Hence, it makes sense for companies to pool in their resources to develop the common “boring” parts by supporting such organizations and later upon completing work on these standard parts to simply plug & play and customize their products afterwards. Apart from the economics of the model, such collaborative efforts also yield standards allowing for easier use and integration into aspiring products and services. - -Other major innovations that were once or are currently being developed following the said consortium model include standards for WiFi (The Wi-Fi alliance), Mobile Telephony etc. - -### Introduction to Hyperledger Project (HLP) - -The Hyperledger project was launched in December 2015 by the Linux foundation as is currently among the fastest growing project they’ve incubated. It’s an umbrella organization for collaborative efforts into developing and advancing tools & standards for [**blockchain**][2] based distributed ledger technologies(DLT). Major industry players supporting the project include **IBM** , **Intel** and **SAP Ariba** among [**others**][3]. The HLP aims to create frameworks for individuals and companies to create shared as well as closed blockchains as required to further their own requirements. The design principles include a strong tilt toward developing a globally deployable, scalable, robust platform with a focus on privacy, and future auditability[2]. It is also important to note that most of the blockchains proposed and the frame. - -### Development goals and structure: Making it plug & play - -Although enterprise facing platforms exist from the likes of the Ethereum alliance, HLP is by definition business facing and supported by industry behemoths who contribute and further development in the many modules that come under the HLP banner. The HLP incubates projects in development after their induction into the cause and after finishing work on it and correcting the knick-knacks rolls it out for the public. Members of the Hyperledger project contribute their own work such as how IBM contributed their Fabric platform for collaborative development. The codebase is absorbed and developed in house by the group in the project and rolled out for all members equally for their use. - -Such processes make the modules in HLP highly flexible plug-in frameworks which will support rapid development and roll-outs in enterprise settings. Furthermore, other comparable platforms are open **permission-less blockchains** or rather **public chains** by default and even though it is possible to adapt them to specific applications, HLP modules support the feature natively. - -The differences and use cases of public & private blockchains are covered more [**here**][4] in this comparative primer on the same. - -The Hyperledger project’s mission is four-fold according to **Brian Behlendorf** , the executive director of the project. - -They are: - - 1. To create an enterprise grade DLT framework and standards which anyone can port to suit their specific industrial or personal needs. - 2. To give rise to a robust open source community to aid the ecosystem. - 3. To promote and further participation of industry members of the said ecosystem such as member firms. - 4. To host a neutral unbiased infrastructure for the HLP community to gather and share updates and developments regarding the same. - - - -The original document can be accessed [**here**][5]****. - -### Structure of the HLP - -The **HLP consists of 12 projects** that are classified as independent modules, each usually structured and working independently to develop their module. These are first studied for their capabilities and viability before being incubated. Proposals for additions can be made by any member of the organization. After the project is incubated active development ensues after which it is rolled out. The interoperability between these modules are given a high priority, hence regular communication between these groups are maintained by the community. Currently 4 of these projects are categorized as active. The active tag implies these are ready for use but not ready for a major release yet. These 4 are arguably the most significant or rather fundamental modules to furthering the blockchain revolution. We’ll look at the individual modules and their functionalities at a later time in detail. However, a brief description of a the Hyperledger Fabric platform, arguably the most popular among them follows. - -### Hyperledger Fabric - -The **Hyperledger Fabric** [2] is a fully open-source, permissioned (non-public) blockchain-based DLT platform that is designed keeping enterprise uses in mind. The platform provides features and is structured to fit the enterprise environment. It is highly modular allowing its developers to choose from different consensus protocols, **chain code protocols ([smart contracts][6])** , or identity management systems etc., as they go along. **It is a permissioned blockchain based platform** that’s makes use of an identity management system, meaning participants will be aware of each other’s identities which is required in an enterprise setting. Fabric allows for smart contract ( _ **“chaincode”, is the term that the Hyperledger team uses**_ ) development in a variety of mainstream programming languages including **Java** , **Javascript** , **Go** etc. This allows institutions and enterprises to make use of their existing talent in the area without hiring or re-training developers to develop their own smart contracts. Fabric also uses an execute-order-validate system to handle smart contracts for better reliability compared to the standard order-validate system that is used by other platforms providing smart contract functionality. Pluggable performance, identity management systems, DBMS, Consensus platforms etc. are other features of Fabric that keeps it miles ahead of its competition. - -### Conclusion - -Projects such as the Hyperledger Fabric platforms enable a faster rate of adoption of blockchain technology in mainstream use-cases. The Hyperledger community structure itself supports open governance principles and since all the projects are led as open source platforms, this improves the security and accountability that the teams exhibit in pushing out commitments. - -Since major applications of such projects involve working with enterprises to further development of platforms and standards, the Hyperledger project is currently at a great position with respect to comparable projects by others. - -**References:** - - * **[1][Samsung takes a seat with Intel and IBM at the Linux Foundation | TheINQUIRER][7]** - * **[2] E. Androulaki et al., “Hyperledger Fabric: A Distributed Operating System for Permissioned Blockchains,” 2018.** - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ - -作者:[editor][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.ostechnix.com/author/editor/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Introduction-To-Hyperledger-Project-720x340.png -[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ -[3]: https://www.hyperledger.org/members -[4]: https://www.ostechnix.com/blockchain-2-0-public-vs-private-blockchain-comparison/ -[5]: http://www.hitachi.com/rev/archive/2017/r2017_01/expert/index.html -[6]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ -[7]: https://www.theinquirer.net/inquirer/news/2182438/samsung-takes-seat-intel-ibm-linux-foundation diff --git a/sources/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md b/sources/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md deleted file mode 100644 index a4669a2eb0..0000000000 --- a/sources/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md +++ /dev/null @@ -1,83 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Blockchain 2.0 – What Is Ethereum [Part 9]) -[#]: via: (https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/) -[#]: author: (editor https://www.ostechnix.com/author/editor/) - -Blockchain 2.0 – What Is Ethereum [Part 9] -====== - -![Ethereum][1] - -In the previous guide of this series, we discussed about [**Hyperledger Project (HLP)**][2], a fastest growing product developed by **Linux Foundation**. In this guide, we are going to discuss about what is **Ethereum** and its features in detail. Many researchers opine that the future of the internet will be based on principles of decentralized computing. Decentralized computing was in fact among one of the broader objectives of having the internet in the first place. However, the internet took another turn owing to differences in computing capabilities available. While modern server capabilities make the case for server-side processing and execution, lack of decent mobile networks in large parts of the world make the case for the same on the client side. Modern smartphones now have **SoCs** (system on a chip or system on chip) capable of handling many such operations on the client side itself, however, limitations owing to retrieving and storing data securely still pushes developers to have server-side computing and data management. Hence, a bottleneck in regards to data transfer capabilities is currently observed. - -All of that might soon change because of advancements in distributed data storage and program execution platforms. [**The blockchain**][3], for the first time in the history of the internet, basically allows for secure data management and program execution on a distributed network of users as opposed to central servers. - -**Ethereum** is one such blockchain platform that gives developers access to frameworks and tools used to build and run applications on such a decentralized network. Though more popularly known in general for its cryptocurrency, Ethereum is more than just **ethers** (the cryptocurrency). It’s a full **Turing complete programming language** that is designed to develop and deploy **DApps** or **Distributed APPlications** [1]. We’ll look at DApps in more detail in one of the upcoming posts. - -Ethereum is an open-source, supports by default a public (non-permissioned) blockchain, and features an extensive smart contract platform **(Solidity)** underneath. Ethereum provides a virtual computing environment called the **Ethereum virtual machine** to run applications and [**smart contracts**][4] as well[2]. The Ethereum virtual machine runs on thousands of participating nodes all over the world, meaning the application data while being secure, is almost impossible to be tampered with or lost. - -### Getting behind Ethereum: What sets it apart - -In 2017, a 30 plus group of the who’s who of the tech and financial world got together to leverage the Ethereum blockchain’s capabilities. Thus, the **Ethereum Enterprise Alliance (EEA)** was formed by a long list of supporting members including _Microsoft_ , _JP Morgan_ , _Cisco Systems_ , _Deloitte_ , and _Accenture_. JP Morgan already has **Quorum** , a decentralized computing platform for financial services based on Ethereum currently in operation, while Microsoft has Ethereum based cloud services it markets through its Azure cloud business[3]. - -### What is ether and how is it related to Ethereum - -Ethereum creator **Vitalik Buterin** understood the true value of a decentralized processing platform and the underlying blockchain tech that powered bitcoin. He failed to gain majority agreement for his idea of proposing that Bitcoin should be developed to support running distributed applications (DApps) and programs (now referred to as smart contracts). - -Hence in 2013, he proposed the idea of Ethereum in a white paper he published. The original white paper is still maintained and available for readers **[here][5]**. The idea was to develop a blockchain based platform to run smart contracts and applications designed to run on nodes and user devices instead of servers. - -The Ethereum system is often mistaken to just mean the cryptocurrency ether, however, it has to be reiterated that Ethereum is a full stack platform for developing applications and executing them as well and has been so since inception whereas bitcoin isn’t. **Ether is currently the second biggest cryptocurrency** by market capitalization and trades at an average of $170 per ether at the time of writing this article[4]. - -### Features and technicalities of the platform[5] - - * As we’ve already mentioned, the cryptocurrency called ether is simply one of the things the platform features. The purpose of the system is more than taking care of financial transactions. In fact, the key difference between the Ethereum platform and Bitcoin is in their scripting capabilities. Ethereum is developed in a Turing complete programming language which means it has scripting and application capabilities similar to other major programming languages. Developers require this feature to create DApps and complex smart contracts on the platform, a feature that bitcoin misses on. - * The “mining” process of ether is more stringent and complex. While specialized ASICs may be used to mine bitcoin, the basic hashing algorithm used by Ethereum **(EThash)** reduces the advantage that ASICs have in this regard. - * The transaction fees itself to be paid as an incentive to miners and node operators for running the network is calculated using a computational token called **Gas**. Gas improves the system’s resilience and resistance to external hacks and attacks by requiring the initiator of the transaction to pay ethers proportionate to the number of computational resources that are required to carry out that transaction. This is in contrast to other platforms such as Bitcoin where the transaction fee is measured in tandem with the transaction size. As such, the average transaction costs in Ethereum is radically less than Bitcoin. This also implies that running applications running on the Ethereum virtual machine will require a fee depending straight up on the computational problems that the application is meant to solve. Basically, the more complex an execution, the more the fee. - * The block time for Ethereum is estimated to be around _**10-15 seconds**_. The block time is the average time that is required to timestamp and create a block on the blockchain network. Compared to the 10+ minutes the same transaction will take on the bitcoin network, it becomes apparent that _**Ethereum is much faster**_ with respect to transactions and verification of blocks. - * _It is also interesting to note that there is no hard cap on the amount of ether that can be mined or the rate at which ether can be mined leading to less radical system design than bitcoin._ - - - -### Conclusion - -While Ethereum is comparable and far outpaces similar platforms, the platform itself lacked a definite path for development until the Ethereum enterprise alliance started pushing it. While the definite push for enterprise developments are made by the Ethereum platform, it has to be noted that Ethereum also caters to small-time developers and individuals as well. As such developing the platform for end users and enterprises leave a lot of specific functionality out of the loop for Ethereum. Also, the blockchain model proposed and developed by the Ethereum foundation is a public model whereas the one proposed by projects such as the Hyperledger project is private and permissioned. - -While only time can tell which platform among the ones put forward by Ethereum, Hyperledger, and R3 Corda among others will find the most fans in real-world use cases, such systems do prove the validity behind the claim of a blockchain powered future. - -**References:** - - * [1] [**Gabriel Nicholas, “Ethereum Is Coding’s New Wild West | WIRED,” Wired , 2017**][6]. - * [2] [**What is Ethereum? — Ethereum Homestead 0.1 documentation**][7]. - * [3] [**Ethereum, a Virtual Currency, Enables Transactions That Rival Bitcoin’s – The New York Times**][8]. - * [4] [**Cryptocurrency Market Capitalizations | CoinMarketCap**][9]. - * [5] [**Introduction — Ethereum Homestead 0.1 documentation**][10]. - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/ - -作者:[editor][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.ostechnix.com/author/editor/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Ethereum-720x340.png -[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ -[3]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ -[4]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ -[5]: https://github.com/ethereum/wiki/wiki/White-Paper -[6]: https://www.wired.com/story/ethereum-is-codings-new-wild-west/ -[7]: http://www.ethdocs.org/en/latest/introduction/what-is-ethereum.html#ethereum-virtual-machine -[8]: https://www.nytimes.com/2016/03/28/business/dealbook/ethereum-a-virtual-currency-enables-transactions-that-rival-bitcoins.html -[9]: https://coinmarketcap.com/ -[10]: http://www.ethdocs.org/en/latest/introduction/index.html diff --git a/sources/tech/20190518 Best Linux Distributions for Beginners.md b/sources/tech/20190518 Best Linux Distributions for Beginners.md deleted file mode 100644 index 1630f1bc85..0000000000 --- a/sources/tech/20190518 Best Linux Distributions for Beginners.md +++ /dev/null @@ -1,206 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: () -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Best Linux Distributions for Beginners) -[#]: via: (https://itsfoss.com/best-linux-beginners/) -[#]: author: (Aquil Roshan https://itsfoss.com/author/aquil/) - -Best Linux Distributions for Beginners -====== - -_**Brief** : In this article, we will see the **best Linux distro for beginners**_. This will help new Linux users to pick their first distribution. - -Let’s face it, [Linux][1] can pose an overwhelming complexity to new users. But then, it’s not Linux itself that brings this complexity. Rather, it’s the “newness” factor that causes this. Not getting nostalgic, but remembering my first time with Linux, I didn’t even know what to expect. I liked it. But it was an upstream swim for me initially. - -Not knowing where to start can be a downer. Especially for someone who does not have the concept of something else running on their PC in place of Windows. - -Linux is more than an OS. It’s an idea where everybody grows together and there’s something for everybody. We have already covered: - - * [Best Linux distributions for Windows users][2] - * [Best lightweight Linux distros][3] - * [Best Linux distributions for hacking][4] - * [Best Linux distributions for gaming][5] - * [Best Linux distributions for privacy and anonymity][6] - * [Best Linux distributions that look like MacOS][7] - - - -In addition to that, there are distributions that cater to the needs of newcomers especially. So here are a few such Linux distros for beginners. You can watch it in a video and [subscribe to our YouTube channel][8] for more Linux related videos. - -### Best Linux Distros for Beginners - -Please remember that this list is no particular order. The main criteria for compiling this list is ease of installation, out of the box hardware software, ease of use and availability of software packages. - -#### 1\. Ubuntu - -If you’ve researched Linux on the internet, it’s highly probable that you have come across Ubuntu. Ubuntu is one of the leading Linux distributions. It is also the perfect path to begin your Linux journey. - -![][9] - -Ubuntu has been tagged as Linux for human beings. Now, this is because Ubuntu has put in a lot of effort on universal usability. Ubuntu does not require you to be technically sound for you to use it. It breaks the notion of Linux=Command line hassle. This is one of the major plus points that rocketed Ubuntu to where it is today. - -Ubuntu offers a very convenient installation procedure. The installer speaks plain English (or any major language you want). You can even try out Ubuntu before actually going through the installation procedure. The installer provides simple options to: - - * Install Ubuntu removing the older OS - * [Install Ubuntu alongside Windows][10] or any other existing OS (A choice is given at every startup to select the OS to boot). - * Configure partitions for users who know what they are doing. - - - -_Beginner tip: Select the second option if you are not sure about what to do._ - -Ubuntu’s user interface is called GNOME. It is as simple as well as productive as it gets. You can search anything from applications to files by pressing the Windows key. Is there any way you can make this simpler? - -There are no driver installation issues as Ubuntu comes with a hardware detector which detects, downloads and installs optimal drivers for your PC. Also, the installation comes with all the basic software like a music player, video player, an office suite and games for some time killing. - -Ubuntu has a great documentation and community support. [Ubuntu forums ][11]and [Ask Ubuntu][12] provide an appreciable quality support in almost all aspects regarding Ubuntu. It’s highly probable that any question you might have will already be answered. And the answers are beginner friendly. - -Do check out and download [Ubuntu][13] at the [official site.][13] - -#### 2\. Linux Mint Cinnamon - -For years, Linux Mint has been the **number one** Linux distribution on [Distrowatch][14]. Well deserved throne I must say. Linux mint is one of my personal favorites. It is elegant, graceful and provides a superior computing experience (out of the box). - -![][15] - -Linux Mint features the Cinnamon desktop environment. New Linux users who are still in the process of familiarizing themselves with Linux software will find Cinnamon very useful. All the software are very accessibly grouped under categories. Although this is nothing of a mind-blowing feature, to new users who do not know the names of Linux software, this is a huge bonus. - -[][16] - -Suggested read Installing Microsoft Visual Studio Code on Linux - -Linux Mint is fast. Runs fine on older computers. Linux Mint is built upon the rock-solid Ubuntu base. It uses the same software repository as Ubuntu. About the Ubuntu software repository, Ubuntu pushes software for general only use after extensive testing. This means users will not have to deal with unexpected crashes and glitches that some new software are prone to, which can be a real no-no for new Linux users. - -![][17] - -Windows 7 lovers who are really not into where Microsoft if heading with Windows 10 will find Linux Mint lovable. Linux Mint desktop is pretty similar to Windows 7 desktop. Similar toolbar, similar menu, similar tray icons are all set to make Windows users feel absolutely at home. - -Personally, I’m more likely to suggest Linux Mint to someone who is new to Linux world as Linux Mint does impress users enough for them to accept it. To me, Linux Mint should be the first among the list of Linux for beginners. - -Do check out [Linux Mint here][18]. Go for the Cinnamon version. - -#### 3\. Zorin OS - -A majority of computer users are Windows users. And when a [Windows user gets a Linux][2], there’s a fair amount of ‘unlearning process’ that user must go through. A huge amount of operations have been fixed in our muscle memory. For example, the mouse reaching to the lower left corner of the screen (Start) everytime you want to launch an application. So if we could find something that eases these issues on Linux, it’s half a battle won. Enter Zorin OS. - -![][19] - -Zorin OS is an Ubuntu-based, highly polished Linux distribution, entirely made for Windows refugees. Although pretty much every Linux distro is usable by everybody, some people might tend to be reluctant when the desktop looks too alien. Zorin OS dodges past this obstacle because of its similarities with Windows appearance wise. - -Package managers are something of a new concept to Linux newcomers. That’s why Zorin OS comes with a huge (I mean really huge) list of pre-installed software. Anything you need, there’s good chance it’s already installed on Zorin OS. As if that was not enough, [Wine and PlayOnLinux][20] come pre-installed so you can run your loved Windows software and [games][21] here too. - -![][22] - -Zorin OS comes with an amazing theme engine called the ‘Zorin look changer’. It offers some heavy customization options with presets to make your OS look like Windows 7, XP, 2000 or even a Mac for that matter. You’re going to feel home. - -![][23] - -These features make Zorin OS the _**best Linux distro for beginners**_ , isn’t it? Do check out the [Zorin OS website][24] to know more and download the OS. - -#### 4\. Elementary OS - -Since we have taken a look at Linux distros for Windows users, let’s swing by something for MacOS users too. Elementary OS very quickly rose to fame and now is always included in the list of top distros, all thanks to its aesthetic essence. Inspired by MacOS looks, Elementary OS is one of the most beautiful Linux distros. - -![][25] - -Elementary OS is another Ubuntu-based operating system which means the operating system itself is unquestionably stable. Elementary OS features the Pantheon desktop environment. You can immediately notice the resemblance to MacOS desktop. This is an advantage to MacOS users switching to Linux as they will much comfortable with the desktop and this really eases the process of coping to this change. - -![][26] - -The menu is simple and customizable according to user preferences. The operating system is zero intrusive so you can really focus on your work. It comes with a very small number of pre-installed software. So, any new user will not be repulsed by huge bloat. But hey, it’s got everything you need out of the box. For more software, Elementary OS provides a neat AppCenter. It is highly accessible and simple. Everything at one place. You can get all the software you want and perform upgrades in clicks. - -[][27] - -Suggested read How to Install and Use Slack in Linux - -Experience wise, [Elementary OS][28] is really a great piece of software. Definitely give [it a try.][28] - -#### 5\. Linux Mint Mate - -A good number of people who come to Linux are looking to revive older computers. With Windows 10, many computers that had decent specs just some years ago have become incompetent. A quick google will suggest you install Linux on such computers. In that way, you can keep them running up to the mark for the near future. Linux Mint Mate is a great Linux distro if you are looking for something to run your older computers. - -![][29] - -Linux Mint Mate is very light, resource efficient but still a polished distro. It can run smoothly on computers with less muscle power. The desktop environment does not come with bells and jingles. But in no way is it functionally inferior to any other desktop environments. The operating system is non-intrusive and allows you to have a productive computing experience without getting in your way. - -Again, the Linux Mint Mate is based on Ubuntu and has the advantage of huge base solid Ubuntu software repository. It comes with a minimum number of necessities pre-installed. Easy driver installation and setting management are made available. - -You can run Linux Mint Mate even if you have 512 MB RAM and 9 GB hard disk space (the more the merrier). - -The Mate desktop environment is really simple to use with no twists in the tale. This is really a huge plus point for Linux beginners. All the more reason to [try out Linux Mint Mate][30]. - -#### 6\. Manjaro Linux - -Ok. Any long time Linux user will say guiding a newcomer even in the general direction of Arch Linux is a sin. But hear me out. - -Arch is considered experts-only Linux because of it’s highly complex installation procedure. Manajro and Arch Linux have a common origin. But they differ extensively in everything else. - -![][31] - -Manajro Linux has an extremely beginner friendly installation procedure. A lot of things are automated like driver installation using ‘Hardware detection’. Manjaro hugely negates the hardware driver hassles that torments a lot of other Linux distros. And even if you face any issues, Manjaro has an amazing community support. - -Manjaro has its own software repository which maintains the latest of software. While providing up to date software to users is a priority, guaranteed stability is not at all compromised. This is one of the prime differences between Arch and Manjaro. Manjaro delays package releases to make sure they are absolutely stable and no regression will be caused. You can also access the Arch User Repository on Manjaro, so anything and everything you need, is always available. - -If you want to know more about Manjaro features, do read my colleague [John’s experience with Manjaro Linux and why he is hooked][32] to it. - -![][33] - -Manjaro Linux comes in XFCE, KDE, Gnome, Cinnamon and a host of more desktop environments. Do check out the [official website][34]. - -To install any of the above 6 operating systems, you need to create a bootable USB stick. If you are currently using Windows [use this guide to do so][35]. Mac OS users may [follow this guide][36]. - -**Your choice for the best Linux distro for beginners?** - -Linux might come with a learning curve, but that’s not something anybody ever regretted. Go ahead get an ISO and check out Linux. If you are already a Linux user, do share this article and help someone fall in love with Linux in this season of love. Cheers. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-linux-beginners/ - -作者:[Aquil Roshan][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/aquil/ -[b]: https://github.com/lujun9972 -[1]: https://www.linux.com/what-is-linux -[2]: https://itsfoss.com/windows-like-linux-distributions/ -[3]: https://itsfoss.com/lightweight-linux-beginners/ -[4]: https://itsfoss.com/linux-hacking-penetration-testing/ -[5]: https://itsfoss.com/linux-gaming-distributions/ -[6]: https://itsfoss.com/privacy-focused-linux-distributions/ -[7]: https://itsfoss.com/macos-like-linux-distros/ -[8]: https://www.youtube.com/c/itsfoss -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/06/ubuntu-18-04-desktop.jpeg?resize=800%2C450&ssl=1 -[10]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ -[11]: https://ubuntuforums.org/ -[12]: http://askubuntu.com/ -[13]: https://www.ubuntu.com/ -[14]: https://distrowatch.com/ -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/LM_Home.jpg?ssl=1 -[16]: https://itsfoss.com/install-visual-studio-code-ubuntu/ -[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/LM_SS.jpg?ssl=1 -[18]: https://linuxmint.com/ -[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/Zorin.jpg?ssl=1 -[20]: https://itsfoss.com/use-windows-applications-linux/ -[21]: https://itsfoss.com/linux-gaming-guide/ -[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/Zorin-office.jpg?ssl=1 -[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/OSX.jpg?ssl=1 -[24]: https://zorinos.com/ -[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/02/Pantheon-Desktop.jpg?resize=800%2C500&ssl=1 -[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/Application-Menu.jpg?ssl=1 -[27]: https://itsfoss.com/slack-use-linux/ -[28]: https://elementary.io/ -[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/mate.jpg?ssl=1 -[30]: http://blog.linuxmint.com/?p=3182 -[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/02/manajro.jpg?ssl=1 -[32]: https://itsfoss.com/why-use-manjaro-linux/ -[33]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/02/manjaro-kde.jpg?ssl=1 -[34]: https://manjaro.org/ -[35]: https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows -[36]: https://www.ubuntu.com/download/desktop/create-a-usb-stick-on-macos diff --git a/sources/tech/20190522 Convert Markdown files to word processor docs using pandoc.md b/sources/tech/20190522 Convert Markdown files to word processor docs using pandoc.md deleted file mode 100644 index 8fab8bfcae..0000000000 --- a/sources/tech/20190522 Convert Markdown files to word processor docs using pandoc.md +++ /dev/null @@ -1,119 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Convert Markdown files to word processor docs using pandoc) -[#]: via: (https://opensource.com/article/19/5/convert-markdown-to-word-pandoc) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt/users/jason-van-gumster/users/kikofernandez) - -Convert Markdown files to word processor docs using pandoc -====== -Living that plaintext life? Here's how to create the word processor -documents people ask for without having to work in a word processor -yourself. -![][1] - -If you live your life in [plaintext][2], there invariably comes a time when someone asks for a word processor document. I run into this issue frequently, especially at the Day JobTM. Although I've introduced one of the development teams I work with to a [Docs Like Code][3] workflow for writing and reviewing release notes, there are a small number of people who have no interest in GitHub or working with [Markdown][4]. They prefer documents formatted for a certain proprietary application. - -The good news is that you're not stuck copying and pasting unformatted text into a word processor document. Using **[pandoc][5]** , you can quickly give people what they want. Let's take a look at how to convert a document from Markdown to a word processor format in [Linux][6] using **pandoc.** ​​​​ - -Note that **pandoc** is also available for a wide variety of operating systems, ranging from two flavors of BSD ([NetBSD][7] and [FreeBSD][8]) to Chrome OS, MacOS, and Windows. - -### Converting basics - -To begin, [install **pandoc**][9] on your computer. Then, crack open a console terminal window and navigate to the directory containing the file that you want to convert. - -Type this command to create an ODT file (which you can open with a word processor like [LibreOffice Writer][10] or [AbiWord][11]): - -**pandoc -t odt filename.md -o filename.odt** - -Remember to replace **filename** with the file's actual name. And if you need to create a file for that other word processor (you know the one I mean), replace **odt** on the command line with **docx**. Here's what this article looks like when converted to an ODT file: - -![Basic conversion results with pandoc.][12] - -These results are serviceable, but a bit bland. Let's look at how to add a bit more style to the converted documents. - -### Converting with style - -**pandoc** has a nifty feature enabling you to specify a style template when converting a marked-up plaintext file to a word processor format. In this file, you can edit a small number of styles in the document, including those that control the look of paragraphs, headings, captions, titles and subtitles, a basic table, and hyperlinks. - -Let's look at the possibilities. - -#### Creating a template - -In order to style your documents, you can't just use _any_ template. You need to generate what **pandoc** calls a _reference_ template, which is the template it uses when converting text files to word processor documents. To create this file, type the following in a terminal window: - -**pandoc -o custom-reference.odt --print-default-data-file reference.odt** - -This command creates a file called **custom-reference.odt**. If you're using that other word processor, change the references to **odt** on the command line to **docx**. - -Open the template file in LibreOffice Writer, and then press **F11** to open LibreOffice Writer's **Styles** pane. Although the [pandoc manual][13] advises against making other changes to the file, I change the page size and add headers and footers when necessary. - -#### Using the template - -So, how do you use that template you just created? There are two ways to do this. - -The easiest way is to drop the template in your **/home** directory's **.pandoc** folder—you might have to create the folder first if it doesn't exist. When it's time to convert a document, **pandoc** uses this template file. See the next section on how to choose from multiple templates if you need more than one. - -The other way to use your template is to type this set of conversion options at the command line: - -**pandoc -t odt file-name.md --reference-doc=path-to-your-file/reference.odt -o file-name.odt** - -If you're wondering what a converted file looks like with a customized template, here's an example: - -![A document converted using a pandoc style template.][14] - -#### Choosing from multiple templates - -Many people only need one **pandoc** template. Some people, however, need more than one. - -At my day job, for example, I use several templates—one with a DRAFT watermark, one with a watermark stating FOR INTERNAL USE, and one for a document's final versions. Each type of document needs a different template. - -If you have similar needs, start the same way you do for a single template, by creating the file **custom-reference.odt**. Rename the resulting file—for example, to **custom-reference-draft.odt** —then open it in LibreOffice Writer and modify the styles. Repeat this process for each template you need. - -Next, copy the files into your **/home** directory. You can even put them in the **.pandoc** folder if you want to. - -To select a specific template at conversion time, you'll need to run this command in a terminal: - -**pandoc -t odt file-name.md --reference-doc=path-to-your-file/custom-template.odt -o file-name.odt** - -Change **custom-template.odt** to your template file's name. - -### Wrapping up - -To avoid having to remember a set of options I don't regularly use, I cobbled together some simple, very lame one-line scripts that encapsulate the options for each template. For example, I run the script **todraft.sh** to create a word processor document using the template with a DRAFT watermark. You might want to do the same. - -Here's an example of a script using the template containing a DRAFT watermark: - -`pandoc -t odt $1.md -o $1.odt --reference-doc=~/Documents/pandoc-templates/custom-reference-draft.odt` - -Using **pandoc** is a great way to provide documents in the format that people ask for, without having to give up the command line life. This tool doesn't just work with Markdown, either. What I've discussed in this article also allows you to create and convert documents between a wide variety of markup languages. See the **pandoc** site linked earlier for more details. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc - -作者:[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/users/jason-van-gumster/users/kikofernandez -[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 -[2]: https://plaintextproject.online/ -[3]: https://www.docslikecode.com/ -[4]: https://en.wikipedia.org/wiki/Markdown -[5]: https://pandoc.org/ -[6]: /resources/linux -[7]: https://www.netbsd.org/ -[8]: https://www.freebsd.org/ -[9]: https://pandoc.org/installing.html -[10]: https://www.libreoffice.org/discover/writer/ -[11]: https://www.abisource.com/ -[12]: https://opensource.com/sites/default/files/uploads/pandoc-wp-basic-conversion_600_0.png (Basic conversion results with pandoc.) -[13]: https://pandoc.org/MANUAL.html -[14]: https://opensource.com/sites/default/files/uploads/pandoc-wp-conversion-with-tpl_600.png (A document converted using a pandoc style template.) diff --git a/sources/tech/20190528 A Quick Look at Elvish Shell.md b/sources/tech/20190528 A Quick Look at Elvish Shell.md index 82927332a7..778965d442 100644 --- a/sources/tech/20190528 A Quick Look at Elvish Shell.md +++ b/sources/tech/20190528 A Quick Look at Elvish Shell.md @@ -1,4 +1,3 @@ -Translating by name1e5s [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) diff --git a/sources/tech/20190603 How many browser tabs do you usually have open.md b/sources/tech/20190603 How many browser tabs do you usually have open.md deleted file mode 100644 index 7777477029..0000000000 --- a/sources/tech/20190603 How many browser tabs do you usually have open.md +++ /dev/null @@ -1,44 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How many browser tabs do you usually have open?) -[#]: via: (https://opensource.com/article/19/6/how-many-browser-tabs) -[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst) - -How many browser tabs do you usually have open? -====== -Plus, get a few tips for browser productivity. -![Browser of things][1] - -Here's a potentially loaded question: How many browser tabs do you usually have open at one time? Do you have multiple windows, each with multiple tabs? Or are you a minimalist, and only have a couple of tabs open at once. Another option is to move a 20-tabbed browser window to a different monitor so that it is out of the way while working on a particular task. Does your approach differ between work, personal, and mobile browsers? Is your browser strategy related to your [productivity habits][2]? - -### 4 tips for browser productivity - - 1. Know your browser shortcuts to save clicks. Whether you use Firefox or Chrome, there are plenty of keyboard shortcuts to help make switching between tabs and performing certain functions a breeze. For example, Chrome makes it easy to open up a blank Google document. Use the shortcut **"Ctrl + t"** to open a new tab, then type **"doc.new"**. The same can be done for spreadsheets, slides, and forms. - 2. Organize your most frequent tasks with bookmark folders. When it's time to start a particular task, simply open all of the bookmarks in the folder **(Ctrl + click)** to check it off your list quickly. - 3. Get the right browser extensions for you. There are thousands of browser extensions out there all claiming to improve productivity. Before you install, make sure you're not just adding more distractions to your screen. - 4. Reduce screen time by using a timer. It doesn't matter if you use an old-fashioned egg timer or a fancy browser extension. To prevent eye strain, implement the 20/20/20 rule. Every 20 minutes, take a 20-second break from your screen and look at something 20 feet away. - - - -Take our poll to share how many browser tabs you like to have open at once. Be sure to tell us about your favorite browser tricks in the comments. - -There are two components of productivity—doing the right things and doing those things efficiently... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/how-many-browser-tabs - -作者:[Lauren Pritchett][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/lauren-pritchett/users/sarahwall/users/ksonney/users/jwhitehurst -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) -[2]: https://enterprisersproject.com/article/2019/1/5-time-wasting-habits-break-new-year diff --git a/sources/tech/20190603 How to stream music with GNOME Internet Radio.md b/sources/tech/20190603 How to stream music with GNOME Internet Radio.md deleted file mode 100644 index fc21d82d0b..0000000000 --- a/sources/tech/20190603 How to stream music with GNOME Internet Radio.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to stream music with GNOME Internet Radio) -[#]: via: (https://opensource.com/article/19/6/gnome-internet-radio) -[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/r3bl) - -How to stream music with GNOME Internet Radio -====== -If you're looking for a simple, straightforward interface that gets your -streams playing, try GNOME's Internet Radio plugin. -![video editing dashboard][1] - -Internet radio is a great way to listen to stations from all over the world. Like many developers, I like to turn on a station as I code. You can listen to internet radio with a media player for the terminal like [MPlayer][2] or [mpv][3], which is what I use to listen via the Linux command line. However, if you prefer using a graphical user interface (GUI), you may want to try [GNOME Internet Radio][4], a nifty plugin for the GNOME desktop. You can find it in the package manager. - -![GNOME Internet Radio plugin][5] - -Listening to internet radio with a graphical desktop operating system generally requires you to launch an application such as [Audacious][6] or [Rhythmbox][7]. They have nice interfaces, plenty of options, and cool audio visualizers. But if you want a simple, straightforward interface that gets your streams playing, GNOME Internet Radio is for you. - -After installing it, a small icon appears in your toolbar, which is where you do all your configuration and management. - -![GNOME Internet Radio icons][8] - -The first thing I did was go to the Settings menu. I enabled the following two options: show title notifications and show volume adjustment. - -![GNOME Internet Radio Settings][9] - -GNOME Internet Radio includes a few pre-configured stations, and it is really easy to add others. Just click the ( **+** ) sign. You'll need to enter a channel name, which can be anything you prefer (including the station name), and the station address. For example, I like to listen to Synthetic FM. I enter the name, e.g., "Synthetic FM," and the stream address, i.e., . - -Then click the star next to the stream to add it to your menu. - -However you listen to music and whatever genre you choose, it is obvious—coders need their music! The GNOME Internet Radio plugin makes it simple to get your favorite internet radio station queued up. - -In honor of the Gnome desktop's 18th birthday on August 15, we've rounded up 18 reasons to toast... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/gnome-internet-radio - -作者:[Alan Formy-Duval][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/alanfdoss/users/r3bl -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My (video editing dashboard) -[2]: https://opensource.com/article/18/12/linux-toy-mplayer -[3]: https://mpv.io/ -[4]: https://extensions.gnome.org/extension/836/internet-radio/ -[5]: https://opensource.com/sites/default/files/uploads/packagemanager_s.png (GNOME Internet Radio plugin) -[6]: https://audacious-media-player.org/ -[7]: https://help.gnome.org/users/rhythmbox/stable/ -[8]: https://opensource.com/sites/default/files/uploads/titlebaricons.png (GNOME Internet Radio icons) -[9]: https://opensource.com/sites/default/files/uploads/gnomeinternetradio_settings.png (GNOME Internet Radio Settings) diff --git a/sources/tech/20190611 What is a Linux user.md b/sources/tech/20190611 What is a Linux user.md deleted file mode 100644 index c7d52b521c..0000000000 --- a/sources/tech/20190611 What is a Linux user.md +++ /dev/null @@ -1,56 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qfzy1233 ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is a Linux user?) -[#]: via: (https://opensource.com/article/19/6/what-linux-user) -[#]: author: (Anderson Silva https://opensource.com/users/ansilva/users/petercheer/users/ansilva/users/greg-p/users/ansilva/users/ansilva/users/bcotton/users/ansilva/users/seth/users/ansilva/users/don-watkins/users/ansilva/users/seth) - -What is a Linux user? -====== -The definition of who is a "Linux user" has grown to be a bigger tent, -and it's a great change. -![][1] - -> _Editor's note: this article was updated on Jun 11, 2019, at 1:15:19 PM to more accurately reflect the author's perspective on an open and inclusive community of practice in the Linux community._ - -In only two years, the Linux kernel will be 30 years old. Think about that! Where were you in 1991? Were you even born? I was 13! Between 1991 and 1993 a few Linux distributions were created, and at least three of them—Slackware, Debian, and Red Hat–provided the [backbone][2] the Linux movement was built on. - -Getting a copy of a Linux distribution and installing and configuring it on a desktop or server was very different back then than today. It was hard! It was frustrating! It was an accomplishment if you got it running! We had to fight with incompatible hardware, configuration jumpers on devices, BIOS issues, and many other things. Even if the hardware was compatible, many times, you still had to compile the kernel, modules, and drivers to get them to work on your system. - -If you were around during those days, you are probably nodding your head. Some readers might even call them the "good old days," because choosing to use Linux meant you had to learn about operating systems, computer architecture, system administration, networking, and even programming, just to keep the OS functioning. I am not one of them though: Linux being a regular part of everyone's technology experience is one of the most amazing changes in our industry! - -Almost 30 years later, Linux has gone far beyond the desktop and server. You will find Linux in automobiles, airplanes, appliances, smartphones… virtually everywhere! You can even purchase laptops, desktops, and servers with Linux preinstalled. If you consider cloud computing, where corporations and even individuals can deploy Linux virtual machines with the click of a button, it's clear how widespread the availability of Linux has become. - -With all that in mind, my question for you is: **How do you define a "Linux user" today?** - -If you buy your parent or grandparent a Linux laptop from System76 or Dell, log them into their social media and email, and tell them to click "update system" every so often, they are now a Linux user. If you did the same with a Windows or MacOS machine, they would be Windows or MacOS users. It's incredible to me that, unlike the '90s, Linux is now a place for anyone and everyone to compute. - -In many ways, this is due to the web browser becoming the "killer app" on the desktop computer. Now, many users don't care what operating system they are using as long as they can get to their app or service. - -How many people do you know who use their phone, desktop, or laptop regularly but can't manage files, directories, and drivers on their systems? How many can't install a binary that isn't attached to an "app store" of some sort? How about compiling an application from scratch?! For me, it's almost no one. That's the beauty of open source software maturing along with an ecosystem that cares about accessibility. - -Today's Linux user is not required to know, study, or even look up information as the Linux user of the '90s or early 2000s did, and that's not a bad thing. The old imagery of Linux being exclusively for bearded men is long gone, and I say good riddance. - -There will always be room for a Linux user who is interested, curious, _fascinated_ about computers, operating systems, and the idea of creating, using, and collaborating on free software. There is just as much room for creative open source contributors on Windows and MacOS these days as well. Today, being a Linux user is being anyone with a Linux system. And that's a wonderful thing. - -### The change to what it means to be a Linux user - -When I started with Linux, being a user meant knowing how to the operating system functioned in every way, shape, and form. Linux has matured in a way that allows the definition of "Linux users" to encompass a much broader world of possibility and the people who inhabit it. It may be obvious to say, but it is important to say clearly: anyone who uses Linux is an equal Linux user. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/what-linux-user - -作者:[Anderson Silva][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/ansilva/users/petercheer/users/ansilva/users/greg-p/users/ansilva/users/ansilva/users/bcotton/users/ansilva/users/seth/users/ansilva/users/don-watkins/users/ansilva/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 -[2]: https://en.wikipedia.org/wiki/Linux_distribution#/media/File:Linux_Distribution_Timeline.svg diff --git a/sources/tech/20190612 Why use GraphQL.md b/sources/tech/20190612 Why use GraphQL.md index f9210b02e4..ad0d3a0056 100644 --- a/sources/tech/20190612 Why use GraphQL.md +++ b/sources/tech/20190612 Why use GraphQL.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (Flowsnow) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190613 Continuous integration testing for the Linux kernel.md b/sources/tech/20190613 Continuous integration testing for the Linux kernel.md deleted file mode 100644 index d837cd9e67..0000000000 --- a/sources/tech/20190613 Continuous integration testing for the Linux kernel.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Continuous integration testing for the Linux kernel) -[#]: via: (https://opensource.com/article/19/6/continuous-kernel-integration-linux) -[#]: author: (Major Hayden https://opensource.com/users/mhayden) - -Continuous integration testing for the Linux kernel -====== -How this team works to prevent bugs from being merged into the Linux -kernel. -![Linux kernel source code \(C\) in Visual Studio Code][1] - -With 14,000 changesets per release from over 1,700 different developers, it's clear that the Linux kernel moves quickly, and brings plenty of complexity. Kernel bugs range from small annoyances to larger problems, such as system crashes and data loss. - -As the call for continuous integration (CI) grows for more and more projects, the [Continuous Kernel Integration (CKI)][2] team forges ahead with a single mission: prevent bugs from being merged into the kernel. - -### Linux testing problems - -Many Linux distributions test the Linux kernel when needed. This testing often occurs around release time, or when users find a bug. - -Unrelated issues sometimes appear, and maintainers scramble to find which patch in a changeset full of tens of thousands of patches caused the new, unrelated bug. Diagnosing the bug may require specialized hardware, a series of triggers, and specialized knowledge of that portion of the kernel. - -#### CI and Linux - -Most modern software repositories have some sort of automated CI testing that tests commits before they find their way into the repository. This automated testing allows the maintainers to find software quality issues, along with most bugs, by reviewing the CI report. Simpler projects, such as a Python library, come with tons of tools to make this process easier. - -Linux must be configured and compiled prior to any testing. Doing so takes time and compute resources. In addition, that kernel must boot in a virtual machine or on a bare metal machine for testing. Getting access to certain system architectures requires additional expense or very slow emulation. From there, someone must identify a set of tests which trigger the bug or verify the fix. - -#### How the CKI team works - -The CKI team at Red Hat currently follows changes from several internal kernels, as well as upstream kernels such as the [stable kernel tree][3]. We watch for two critical events in each repository: - - 1. When maintainers merge pull requests or patches, and the resulting commits in the repository change. - - 2. When developers propose changes for merging via patchwork or the stable patch queue. - - - - -As these events occur, automation springs into action and [GitLab CI pipelines][4] begin the testing process. Once the pipeline runs [linting][5] scripts, merges any patches, and compiles the kernel for multiple architectures, the real testing begins. We compile kernels in under six minutes for four architectures and submit feedback to the stable mailing list usually in two hours or less. Over 100,000 kernel tests run each month and over 11,000 GitLab pipelines have completed (since January 2019). - -Each kernel is booted on its native architecture, which includes: - -● [aarch64][6]: 64-bit [ARM][7], such as the [Cavium (now Marvell) ThunderX][8]. - -● [ppc64/ppc64le][9]: Big and little endian [IBM POWER][10] systems. - -● [s390x][11]: [IBM Zseries][12] mainframes. - -● [x86_64][13]: [Intel][14] and [AMD][15] workstations, laptops, and servers. - -Multiple tests run on these kernels, including the [Linux Test Project (LTP)][16], which contains a myriad of tests using a common test harness. My CKI team open-sourced over 44 tests with more on the way. - -### Get involved - -The upstream kernel testing effort grows day-by-day. Many companies provide test output for various kernels, including [Google][17], Intel, [Linaro][18], and [Sony][19]. Each effort is focused on bringing value to the upstream kernel as well as each company’s customer base. - -If you or your company want to join the effort, please come to the [Linux Plumbers Conference 2019][20] in Lisbon, Portugal. Join us at the Kernel CI hackfest during the two days after the conference, and drive the future of rapid kernel testing. - -For more details, [review the slides][21] from my Texas Linux Fest 2019 talk. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/continuous-kernel-integration-linux - -作者:[Major Hayden][a] -选题:[lujun9972][b] -译者:[LazyWolfLin](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/mhayden -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_kernel_clang_vscode.jpg?itok=fozZ4zrr (Linux kernel source code (C) in Visual Studio Code) -[2]: https://cki-project.org/ -[3]: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html -[4]: https://docs.gitlab.com/ee/ci/pipelines.html -[5]: https://en.wikipedia.org/wiki/Lint_(software) -[6]: https://en.wikipedia.org/wiki/ARM_architecture -[7]: https://www.arm.com/ -[8]: https://www.marvell.com/server-processors/thunderx-arm-processors/ -[9]: https://en.wikipedia.org/wiki/Ppc64 -[10]: https://www.ibm.com/it-infrastructure/power -[11]: https://en.wikipedia.org/wiki/Linux_on_z_Systems -[12]: https://www.ibm.com/it-infrastructure/z -[13]: https://en.wikipedia.org/wiki/X86-64 -[14]: https://www.intel.com/ -[15]: https://www.amd.com/ -[16]: https://github.com/linux-test-project/ltp -[17]: https://www.google.com/ -[18]: https://www.linaro.org/ -[19]: https://www.sony.com/ -[20]: https://www.linuxplumbersconf.org/ -[21]: https://docs.google.com/presentation/d/1T0JaRA0wtDU0aTWTyASwwy_ugtzjUcw_ZDmC5KFzw-A/edit?usp=sharing diff --git a/sources/tech/20190623 What does debugging a program look like.md b/sources/tech/20190623 What does debugging a program look like.md new file mode 100644 index 0000000000..7cc7c1432e --- /dev/null +++ b/sources/tech/20190623 What does debugging a program look like.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What does debugging a program look like?) +[#]: via: (https://jvns.ca/blog/2019/06/23/a-few-debugging-resources/) +[#]: author: (Julia Evans https://jvns.ca/) + +What does debugging a program look like? +====== + +I was debugging with a friend who’s a relatively new programmer yesterday, and showed them a few debugging tips. Then I was thinking about how to teach debugging this morning, and [mentioned on Twitter][1] that I’d never seen a really good guide to debugging your code. (there are a ton of really great replies by Anne Ogborn to that tweet if you are interested in debugging tips) + +As usual, I got a lot of helpful answers and now I have a few ideas about how to teach debugging skills / describe the process of debugging. + +### a couple of debugging resources + +I was hoping for more links to debugging books/guides, but here are the 2 recommendations I got: + +**“Debugging” by David Agans**: Several people recommended the book [Debugging][2], which looks like a nice and fairly short book that explains a debugging strategy. I haven’t read it yet (though I ordered it to see if I should be recommending it) and the rules laid out in the book (“understand the system”, “make it fail”, “quit thinking and look”, “divide and conquer”, “change one thing at a time”, “keep an audit trail”, “check the plug”, “get a fresh view”, and “if you didn’t fix it, it ain’t fixed”) seem extremely resaonable :). He also has a charming [debugging poster][3]. + +**“How to debug” by John Regehr**: [How to Debug][4] is a very good blog post based on Regehr’s experience teaching a university embedded systems course. Lots of good advice. He also has a [blog post reviewing 4 books about debugging][5], including Agans’ book. + +### reproduce your bug (but how do you do that?) + +The rest of this post is going to be an attempt to aggregate different ideas about debugging people tweeted at me. + +Somewhat obviously, everybody agrees that being able to consistently reproduce a bug is important if you want to figure out what’s going on. I have an intuitive sense for how to do this but I’m not sure how to **explain** how to go from “I saw this bug twice” to “I can consistently reproduce this bug on demand on my laptop”, and I wonder whether the techniques you use to do this depend on the domain (backend web dev, frontend, mobile, games, C++ programs, embedded etc). + +### reproduce your bug _quickly_ + +Everybody also agrees that it’s extremely useful be able to reproduce the bug quickly (if it takes you 3 minutes to check if every change helped, iterating is VERY SLOW). + +A few suggested approaches: + + * for something that requires clicking on a bunch of things in a browser to reproduce, recording what you clicked on with [Selenium][6] and getting Selenium to replay the UI interactions (suggested [here][7]) + * writing a unit test that reproduces the bug (if you can). bonus: you can add this to your test suite later if it makes sense + * writing a script / finding a command line incantation that does it (like `curl MY_APP.local/whatever`) + + + +### accept that it’s probably your code’s fault + +Sometimes I see a problem and I’m like “oh, library X has a bug”, “oh, it’s DNS”, “oh, SOME OTHER THING THAT IS NOT MY CODE is broken”. And sometimes it’s not my code! But in general between an established library and my code that I wrote last month, usually it’s my code that I wrote last month that’s the problem :). + +### start doing experiments + +@act_gardner gave a [nice, short explanation of what you have to do after you reproduce your bug][8] + +> I try to encourage people to first fully understand the bug - What’s happening? What do you expect to happen? When does it happen? When does it not happen? Then apply their mental model of the system to guess at what could be breaking and come up with experiments. +> +> Experiments could be changing or removing code, making API calls from a REPL, trying new inputs, poking at memory values with a debugger or print statements. + +I think the loop here may be: + + * make guess about one aspect about what might be happening (“this variable is set to X where it should be Y”, “the server is being sent the wrong request”, “this code is never running at all”) + * do experiment to check that guess + * repeat until you understand what’s going on + + + +### change one thing at a time + +Everybody definitely agrees that it is important to change one thing a time when doing an experiment to verify an assumption. + +### check your assumptions + +A lot of debugging is realizing that something you were **sure** was true (“wait this request is going to the new server, right, not the old one???“) is actually… not true. I made an attempt to [list some common incorrect assumptions][9]. Here are some examples: + + * this variable is set to X (“that filename is definitely right”) + * that variable’s value can’t possibly have changed between X and Y + * this code was doing the right thing before + * this function does X + * I’m editing the right file + * there can’t be any typos in that line I wrote it is just 1 line of code + * the documentation is correct + * the code I’m looking at is being executed at some point + * these two pieces of code execute sequentially and not in parallel + * the code does the same thing when compiled in debug / release mode (or with -O2 and without, or…) + * the compiler is not buggy (though this is last on purpose, the compiler is only very rarely to blame :)) + + + +### weird methods to get information + +There are a lot of normal ways to do experiments to check your assumptions / guesses about what the code is doing (print out variable values, use a debugger, etc). Sometimes, though, you’re in a more difficult environment where you can’t print things out and don’t have access to a debugger (or it’s inconvenient to do those things, maybe because there are too many events). Some ways to cope: + + * [adding sounds on mobile][10]: “In the mobile world, I live on this advice. Xcode can play a sound when you hit a breakpoint (and continue without stopping). I place them certain places in the code, and listen for buzzing Tink to indicate tight loops or Morse/Pop pairs to catch unbalanced events” (also [this tweet][11]) + * there’s a very cool talk about [using XCode to play sound for iOS debugging here][12] + * [adding LEDs][13]: “When I did embedded dev ages ago on grids of transputers, we wired up an LED to an unused pin on each chip. It was surprisingly effective for diagnosing parallelism issues.” + * [string][14]: “My networks prof told me about a hack he saw at Xerox in the early days of Ethernet: a tap in the coax with an amp and motor and piece of string. The busier the network was, the faster the string twirled.” + * [peep][15] is a “network auralizer” that translates what’s happening on your system into sounds. I spent 10 minutes trying to get it to compile and failed so far but it looks very fun and I want to try it!! + + + +The point here is that information is the most important thing and you need to do whatever’s necessary to get information. + +### write your code so it’s easier to debug + +Another point a few people brought up is that you can improve your program to make it easier to debug. tef has a nice post about this: [Write code that’s easy to delete, and easy to debug too.][16] here. I thought this was very true: + +> Debuggable code isn’t necessarily clean, and code that’s littered with checks or error handling rarely makes for pleasant reading. + +I think one interpretation of “easy to debug” is “every single time there’s an error, the program reports to you exactly what happened in an easy to understand way”. Whenever my program has a problem and says sometihng “error: failure to connect to SOME_IP port 443: connection timeout” I’m like THANK YOU THAT IS THE KIND OF THING I WANTED TO KNOW and I can check if I need to fix a firewall thing or if I got the wrong IP for some reason or what. + +One simple example of this recently: I was making a request to a server I wrote and the reponse I got was “upstream connect error or disconnect/reset before headers”. This is an nginx error which basically in this case boiled down to “your program crashed before it sent anything in response to the request”. Figuring out the cause of the crash was pretty easy, but having better error handling (returning an error instead of crashing) would have saved me a little time because instead of having to go check the cause of the crash, I could have just read the error message and figured out what was going on right away. + +### error messages are better than silently failing + +To get closer to the dream of “every single time there’s an error, the program reports to you exactly what happened in an easy to understand way” you also need to be disciplined about immediately returning an error message instead of silently writing incorrect data / passing a nonsense value to another function which will do WHO KNOWS WHAT with it and cause you a gigantic headache. This means adding code like this: + +``` +if UNEXPECTED_THING: + raise "oh no THING happened" +``` + +This isn’t easy to get right (it’s not always obvious where you should be raising errors!“) but it really helps a lot. + +### failure: print out a stack of errors, not just one error. + +Related to returning helpful errors that make it easy to debug: Rust has a really incredible error handling library [called failure][17] which basicaly lets you return a chain of errors instead of just one error, so you can print out a stack of errors like: + +``` +"error starting server process" caused by +"error initializing logging backend" caused by +"connection failure: timeout connecting to 1.2.3.4 port 1234". +``` + +This is SO MUCH MORE useful than just `connection failure: timeout connecting to 1.2.3.4 port 1234` by itself because it tells you the significance of 1.2.3.4 (it’s something to do with the logging backend!). And I think it’s also more useful than `connection failure: timeout connecting to 1.2.3.4 port 1234` with a stack trace, because it summarizes at a high level the parts that went wrong instead of making you read all the lines in the stack trace (some of which might not be relevant!). + +tools like this in other languages: + + * Go: the idiom to do this seems to be to just concatenate your stack of errors together as a big string so you get “error: thing one: error: thing two : error: thing three” which works okay but is definitely a lot less structured than `failure`’s system + * Java: I hear you can give exceptions causes but haven’t used that myself + * Python 3: you can use `raise ... from` which sets the `__cause__` attribute on the exception and then your exceptions will be separated by `The above exception was the direct cause of the following exception:..` + + + +If you know how to do this in other languages I’d be interested to hear! + +### understand what the error messages mean + +One sub debugging skill that I take for granted a lot of the time is understanding what error messages mean! I came across this nice graphic explaining [common Python errors and what they mean][18], which breaks down things like `NameError`, `IOError`, etc. + +I think a reason interpreting error messages is hard is that understanding a new error message might mean learning a new concept – `NameError` can mean “Your code uses a variable outside the scope where it’s defined”, but to really understand that you need to understand what variable scope is! I ran into this a lot when learning Rust – the Rust compiler would be like “you have a weird lifetime error” and I’d like be “ugh ok Rust I get it I will go actually learn about how lifetimes work now!“. + +And a lot of the time error messages are caused by a problem very different from the text of the message, like how “upstream connect error or disconnect/reset before headers” might mean “julia, your server crashed!“. The skill of understanding what error messages mean is often not transferable when you switch to a new area (if I started writing a lot of React or something tomorrow, I would probably have no idea what any of the error messages meant!). So this definitely isn’t just an issue for beginner programmers. + +### that’s all for now! + +I feel like the big thing I’m missing when talking about debugging skills is a stronger understanding of where people get stuck with debugging – it’s easy to say “well, you need to reproduce the problem, then make a more minimal reproduction, then start coming up with guesses and verifying them, and improve your mental model of the system, and then figure it out, then fix the problem and hopefully write a test to make it not come back”, but – where are people actually getting stuck in practice? What are the hardest parts? I have some sense of what the hardest parts usually are for me but I’m still not sure what the hardest parts usually are for someone newer to debugging their code. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/06/23/a-few-debugging-resources/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/1142825259546140673 +[2]: http://debuggingrules.com/ +[3]: http://debuggingrules.com/?page_id=40 +[4]: https://blog.regehr.org/archives/199 +[5]: https://blog.regehr.org/archives/849 +[6]: https://www.seleniumhq.org/ +[7]: https://twitter.com/AnnieTheObscure/status/1142843984642899968 +[8]: https://twitter.com/act_gardner/status/1142838587437830144 +[9]: https://twitter.com/b0rk/status/1142812831420768257 +[10]: https://twitter.com/cocoaphony/status/1142847665690030080 +[11]: https://twitter.com/AnnieTheObscure/status/1142842421954244608 +[12]: https://qnoid.com/2013/06/08/Sound-Debugging.html +[13]: https://twitter.com/wombatnation/status/1142887843963867136 +[14]: https://twitter.com/irvingreid/status/1142887472441040896 +[15]: http://peep.sourceforge.net/intro.html +[16]: https://programmingisterrible.com/post/173883533613/code-to-debug +[17]: https://github.com/rust-lang-nursery/failure +[18]: https://pythonforbiologists.com/29-common-beginner-errors-on-one-page/ diff --git a/sources/tech/20190628 Get your work recognized- write a brag document.md b/sources/tech/20190628 Get your work recognized- write a brag document.md new file mode 100644 index 0000000000..e13dd2a07b --- /dev/null +++ b/sources/tech/20190628 Get your work recognized- write a brag document.md @@ -0,0 +1,256 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get your work recognized: write a brag document) +[#]: via: (https://jvns.ca/blog/brag-documents/) +[#]: author: (Julia Evans https://jvns.ca/) + +Get your work recognized: write a brag document +====== + +There’s this idea that, if you do great work at your job, people will (or should!) automatically recognize that work and reward you for it with promotions / increased pay. In practice, it’s often more complicated than that – some kinds of important work are more visible/memorable than others. It’s frustrating to have done something really important and later realize that you didn’t get rewarded for it just because the people making the decision didn’t understand or remember what you did. So I want to talk about a tactic that I and lots of people I work with have used! + +This blog post isn’t just about being promoted or getting raises though. The ideas here have actually been more useful to me to help me reflect on themes in my work, what’s important to me, what I’m learning, and what I’d like to be doing differently. But they’ve definitely helped with promotions! + +You can also [skip to the brag document template at the end][1]. + +### you don’t remember everything you did + +One thing I’m always struck by when it comes to performance review time is a feeling of “wait, what _did_ I do in the last 6 months?“. This is a kind of demoralizing feeling and it’s usually not based in reality, more in “I forgot what cool stuff I actually did”. + +I invariably end up having to spend a bunch of time looking through my pull requests, tickets, launch emails, design documents, and more. I always end up finding small (and sometimes not-so-small) things that I completely forgot I did, like: + + * mentored an intern 5 months ago + * did a small-but-important security project + * spent a few weeks helping get an important migration over the line + * helped X put together this design doc + * etcetera! + + + +### your manager doesn’t remember everything you did + +And if you don’t remember everything important you did, your manager (no matter how great they are!) probably doesn’t either. And they need to explain to other people why you should be promoted or given an evaluation like “exceeds expectations” (“X’s work is so awesome!!!!” doesn’t fly). + +So if your manager is going to effectively advocate for you, they need help. + +### here’s the tactic: write a document listing your accomplishments + +The tactic is pretty simple! Instead of trying to remember everything you did with your brain, maintain a “brag document” that lists everything so you can refer to it when you get to performance review season! This is a pretty common tactic – when I started doing this I mentioned it to more experienced people and they were like “oh yeah, I’ve been doing that for a long time, it really helps”. + +Where I work we call this a “brag document” but I’ve heard other names for the same concept like “hype document” or “list of stuff I did” :). + +There’s a basic template for a brag document at the end of this post. + +### share your brag document with your manager + +When I first wrote a brag document I was kind of nervous about sharing it with my manager. It felt weird to be like “hey, uh, look at all the awesome stuff I did this year, I wrote a long document listing everything”. But my manager was really thankful for it – I think his perspective was “this makes my job way easier, now I can look at the document when writing your perf review instead of trying to remember what happened”. + +Giving them a document that explains your accomplishments will really help your manager advocate for you in discussions about your performance and come to any meetings they need to have prepared. + +Brag documents also **really** help with manager transitions – if you get a new manager 3 months before an important performance review that you want to do well on, giving them a brag document outlining your most important work & its impact will help them understand what you’ve been doing even though they may not have been aware of any of your work before. + +### share it with your peer reviewers + +Similarly, if your company does peer feedback as part of the promotion/perf process – share your brag document with your peer reviewers!! Every time someone shares their doc with me I find it SO HELPFUL with writing their review for much the same reasons it’s helpful to share it with your manager – it reminds me of all the amazing things they did, and when they list their goals in their brag document it also helps me see what areas they might be most interested in feedback on. + +On some teams at work it’s a team norm to share a brag document with peer reviewers to make it easier for them. + +### explain the big picture + +In addition to just listing accomplishments, in your brag document you can write the narrative explaining the big picture of your work. Have you been really focused on security? On building your product skills & having really good relationships with your users? On building a strong culture of code review on the team? + +In my brag document, I like to do this by making a section for areas that I’ve been focused on (like “security”) and listing all the work I’ve done in that area there. This is especially good if you’re working on something fuzzy like “building a stronger culture of code review” where all the individual actions you do towards that might be relatively small and there isn’t a big shiny ship. + +### use your brag document to notice patterns + +In the past I’ve found the brag document useful not just to hype my accomplishments, but also to reflect on the work I’ve done. Some questions it’s helped me with: + + * What work do I feel most proud of? + * Are there themes in these projects I should be thinking about? What’s the big picture of what I’m working on? (am I working a lot on security? localization?). + * What do I wish I was doing more / less of? + * Which of my projects had the effect I wanted, and which didn’t? Why might that have been? + * What could have gone better with project X? What might I want to do differently next time? + + + +### you can write it all at once or update it every 2 weeks + +Many people have told me that it works best for them if they take a few minutes to update their brag document every 2 weeks ago. For me it actually works better to do a single marathon session every 6 months or every year where I look through everything I did and reflect on it all at once. Try out different approaches and see what works for you! + +### don’t forget to include the fuzzy work + +A lot of us work on fuzzy projects that can feel hard to quantify, like: + + * improving code quality on the team / making code reviews a little more in depth + * making on call easier + * building a more fair interview process / performance review system + * refactoring / driving down technical debt + + + +A lot of people will leave this kind of work out because they don’t know how to explain why it’s important. But I think this kind of work is especially important to put into your brag document because it’s the most likely to fall under the radar! One way to approach this is to, for each goal: + + 1. explain your goal for the work (why do you think it’s important to refactor X piece of code?) + 2. list some things you’ve done towards that goal + 3. list any effects you’ve seen of the work, even if they’re a little indirect + + + +If you tell your coworkers this kind of work is important to you and tell them what you’ve been doing, maybe they can also give you ideas about how to do it more effectively or make the effects of that work more obvious! + +### encourage each other to celebrate accomplishments + +One nice side effect of having a shared idea that it’s normal/good to maintain a brag document at work is that I sometimes see people encouraging each other to record & celebrate their accomplishments (“hey, you should put that in your brag doc, that was really good!”). It can be hard to see the value of your work sometimes, especially when you’re working on something hard, and an outside perspective from a friend or colleague can really help you see why what you’re doing is important. + +Brag documents are good when you use them on your own to advocate for yourself, but I think they’re better as a collaborative effort to recognize where people are excelling. + +Next, I want to talk about a couple of structures that we’ve used to help people recognize their accomplishments. + +### the brag workshop: help people list their accomplishments + +The way this “brag document” practice started in the first place is that my coworker [Karla][2] and I wanted to help other women in engineering advocate for themselves more in the performance review process. The idea is that some people undersell their accomplishments more than they should, so we wanted to encourage those people to “brag” a little bit and write down what they did that was important. + +We did this by running a “brag workshop” just before performance review season. The format of the workshop is like this: + +**Part 1: write the document: 1-2 hours**. Everybody sits down with their laptop, starts looking through their pull requests, tickets they resolved, design docs, etc, and puts together a list of important things they did in the last 6 months. + +**Part 2: pair up and make the impact of your work clearer: 1 hour**. The goal of this part is to pair up, review each other’s documents, and identify places where people haven’t bragged “enough” – maybe they worked on an extremely critical project to the company but didn’t highlight how important it was, maybe they improved test performance but didn’t say that they made the tests 3 times faster and that it improved everyone’s developer experience. It’s easy to accidentally write “I shipped $feature” and miss the follow up (“… which caused $thing to happen”). Another person reading through your document can help you catch the places where you need to clarify the impact. + +### biweekly brag document writing session + +Another approach to helping people remember their accomplishments: my friend Dave gets some friends together every couple of weeks or so for everyone to update their brag documents. It’s a nice way for people to talk about work that they’re happy about & celebrate it a little bit, and updating your brag document as you go can be easier than trying to remember everything you did all at once at the end of the year. + +These don’t have to be people in the same company or even in the same city – that group meets over video chat and has people from many different companies doing this together from Portland, Toronto, New York, and Montreal. + +In general, especially if you’re someone who really cares about your work, I think it’s really positive to share your goals & accomplishments (and the things that haven’t gone so well too!) with your friends and coworkers. It makes it feel less like you’re working alone and more like everyone is supporting each other in helping them accomplish what they want. + +### thanks + +Thanks to Karla Burnett who I worked with on spreading this idea at work, to Dave Vasilevsky for running brag doc writing sessions, to Will Larson who encouraged me to start one [of these][3] in the first place, to my manager Jay Shirley for always being encouraging & showing me that this is a useful way to work with a manager, and to Allie, Dan, Laura, Julian, Kamal, Stanley, and Vaibhav for reading a draft of this. + +I’d also recommend the blog post [Hype Yourself! You’re Worth It!][4] by Aashni Shah which talks about a similar approach. + +## Appendix: brag document template + +Here’s a template for a brag document! Usually I make one brag document per year. (“Julia’s 2017 brag document”). I think it’s okay to make it quite long / comprehensive – 5-10 pages or more for a year of work doesn’t seem like too much to me, especially if you’re including some graphs/charts / screenshots to show the effects of what you did. + +One thing I want to emphasize, for people who don’t like to brag, is – **you don’t have to try to make your work sound better than it is**. Just make it sound **exactly as good as it is**! For example “was the primary contributor to X new feature that’s now used by 60% of our customers and has gotten Y positive feedback”. + +### Goals for this year: + + * List your major goals here! Sharing your goals with your manager & coworkers is really nice because it helps them see how they can support you in accomplishing those goals! + + + +### Goals for next year + + * If it’s getting towards the end of the year, maybe start writing down what you think your goals for next year might be. + + + +### Projects + +For each one, go through: + + * What your contributions were (did you come up with the design? Which components did you build? Was there some useful insight like “wait, we can cut scope and do what we want by doing way less work” that you came up with?) + * The impact of the project – who was it for? Are there numbers you can attach to it? (saved X dollars? shipped new feature that has helped sell Y big deals? Improved performance by X%? Used by X internal users every day?). Did it support some important non-numeric company goal (required to pass an audit? helped retain an important user?) + + + +Remember: don’t forget to explain what the results of you work actually were! It’s often important to go back a few months later and fill in what actually happened after you launched the project. + +### Collaboration & mentorship + +Examples of things in this category: + + * Helping others in an area you’re an expert in (like “other engineers regularly ask me for one-off help solving weird bugs in their CSS” or “quoting from the C standard at just the right moment”) + * Mentoring interns / helping new team members get started + * Writing really clear emails/meeting notes + * Foundational code that other people built on top of + * Improving monitoring / dashboards / on call + * Any code review that you spent a particularly long time on / that you think was especially important + * Important questions you answered (“helped Risha from OTHER_TEAM with a lot of questions related to Y”) + * Mentoring someone on a project (“gave Ben advice from time to time on leading his first big project”) + * Giving an internal talk or workshop + + + +### Design & documentation + +List design docs & documentation that you worked on + + * Design docs: I usually just say “wrote design for X” or “reviewed design for X” + * Documentation: maybe briefly explain the goal behind this documentation (for example “we were getting a lot of questions about X, so I documented it and now we can answer the questions more quickly”) + + + +### Company building + +This is a category we have at work – it basically means “things you did to help the company overall, not just your project / team”. Some things that go in here: + + * Going above & beyond with interviewing or recruiting (doing campus recruiting, etc) + * Improving important processes, like the interview process or writing better onboarding materials + + + +### What you learned + +My friend Julian suggested this section and I think it’s a great idea – try listing important things you learned or skills you’ve acquired recently! Some examples of skills you might be learning or improving: + + * how to do performance analysis & make code run faster + * internals of an important piece of software (like the JVM or Postgres or Linux) + * how to use a library (like React) + * how to use an important tool (like the command line or Firefox dev tools) + * about a specific area of programming (like localization or timezones) + * an area like product management / UX design + * how to write a clear design doc + * a new programming language + + + +It’s really easy to lose track of what skills you’re learning, and usually when I reflect on this I realize I learned a lot more than I thought and also notice things that I’m _not_ learning that I wish I was. + +### Outside of work + +It’s also often useful to track accomplishments outside of work, like: + + * blog posts + * talks/panels + * open source work + * Industry recognition + + + +I think this can be a nice way to highlight how you’re thinking about your career outside of strictly what you’re doing at work. + +This can also include other non-career-related things you’re proud of, if that feels good to you! Some people like to keep a combined personal + work brag document. + +### General prompts + +If you’re feeling stuck for things to mention, try: + + * If you were trying to convince a friend to come join your company/team, what would you tell them about your work? + * Did anybody tell you you did something well recently? + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/brag-documents/ + +作者:[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]: tmp.nd0Dg3RXQE#template +[2]: https://karla.io/ +[3]: https://lethain.com/career-narratives/ +[4]: http://blog.aashni.me/2019/01/hype-yourself-youre-worth-it/ diff --git a/sources/tech/20190628 How to Install and Use R on Ubuntu.md b/sources/tech/20190628 How to Install and Use R on Ubuntu.md deleted file mode 100644 index abbbeef6a2..0000000000 --- a/sources/tech/20190628 How to Install and Use R on Ubuntu.md +++ /dev/null @@ -1,209 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (guevaraya) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install and Use R on Ubuntu) -[#]: via: (https://itsfoss.com/install-r-ubuntu/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Install and Use R on Ubuntu -====== - -_**Brief: This tutorial teaches you to install R on Ubuntu. You’ll also learn how to run your first R program in Ubuntu using various methods.**_ - -[R][1], together with Python, is the most commonly used programming language for statistical computing and graphics, making it easy to work with data. With the growing interest in data analysis, data visualization, data science (the machine learning craze), it is now more popular than ever and is a great tool for anyone looking to dive into this fields. - -The good thing about R is that its syntax is pretty straight-forward and you can find many tutorials/guides on how R is used in the real world. - -In this article, I’ll cover how to install R on Ubuntu Linux. I’ll also show you how to run your first R program in Linux. - -![][2] - -### Installing R on Ubuntu - -**R** is included in the Ubuntu repositories. It can be easily installed using: - -``` -sudo apt install r-base -``` - -Do note that this may install a slightly older version. At the time of writing this article, Ubuntu offers version 3.4 whereas the latest is version 3.6. - -_I advise sticking with whichever version Ubuntu provides unless you must use the newer version._ - -In order to get the latest version (or any specific version for that matter), you must use **[CRAN][3]** (The Comprehensive R Archive Network). This is a list of mirrors for downloading the latest version of R. Click on the next section to learn how to install the latest version of R on Ubuntu. - -**How to install latest R version 3.6 on Ubuntu (click to expand)** - -To get the R version 3.6, you need to add the mirror to your sources list. I have simplified it for you in this command: - -``` -sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran35/" -``` - -Now you should add the key for the repository: - -``` -sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 -``` - -And then update the repository information and install R: - -``` -sudo apt update -sudo apt install r-base -``` - -That’s it. - -[][4] - -Suggested read  How to Create a Bootable Windows 10 USB in Linux - -### Using R programming on Ubuntu - -R has more than one use. I’ll go over several methods you can use to run R programs. - -#### Interactive Mode in R - -After having installed **R**, you can run the console using: - -``` -R -``` - -This should open up the interactive mode: - -![R Interactive Mode][5] - -This R console is very similar to the **Python** and **Haskell** interactive prompts. You can enter any **R** command and you can do basic mathematical computations. For example: - -``` -> 20+40 -[1] 60 - -> print ("Hello World!") -[1] "Hello World!" -``` - -You could test plotting too: - -![R Plotting][6] - -You can **quit** using **q()** or pressing **CTRL+c**. When doing so, you will be asked if you want to save a workspace ****image; a workspace ****is an environment for created variables. - -#### Running R program with Rscript - -The second way to run R programs is in directly on the Linux command line. You can do so using **RScript**, a utility included with **r-base**. - -First, you have to save your R program to a file using your [favorite code editor on Linux][7]. The file extension should be .r. - -This is my sample R program printing “Hello World”. I have saved it in a file name hello.r. - -``` -print("Hello World!") -a <- rnorm(100) -plot(a) -``` - -To run the R program, use the command like this: - -``` -Rscript hello.r -``` - -You should get back the output: - -``` -[1] "Hello World!" -``` - -The plot is going to be saved in the working directory, to a file named **Rplots.pdf**: - -![Rplots.pdf][8] - -**Note:** _**Rscript**_ _doesn’t load the_ _**methods**_ _package by default. Make sure to [load it explicitly][9] in your script_. - -#### Run R scripts with RStudio in Ubuntu - -The most common way to use **R** is using [RStudio][10], a great cross-platform open source IDE. You can [install it using deb file in Ubuntu][11]. Download the deb file from the link below. You’ll have to scroll down a bit to locate the DEB files for Ubuntu. - -[Download RStudio for Ubuntu][12] - -Once you download the DEB file, just double click on it to install it. - -Once installed, search for it in the menu and start it. The home window of the application should pop up: - -![RStudio Home][13] - -Here you have a working console, just like the one you got in the terminal with the **R** command. - -[][14] - -Suggested read  Setting Up Python Environments In Linux and Unix Systems - -To create a file, in the top bar click on **File** and select **New File > Rscript** (or **CTRL+Shift+n)**: - -![RStudio New File][15] - -Press **CTRL+s** to save the file and choose a location and a name it: - -![RStudio Save File][16] - -After doing so, click on **Session > Set Working Directory > To Source File Location** to change the working directory to the location of your script: - -![RStudio Working Directory][17] - -You are now ready to go! Write in your code and click run. You should be able to see output both in the console and in the plotting window: - -![RStudio Run][18] - -**Wrapping Up** - -In this article, I showed you step by step how to get started using the **R** programming language on an Ubuntu system. I covered several ways you can go about this: **R console** – useful for testing, **Rscript** – for the terminal lover, **RStudio** – the IDE for your needs. - -Whether you are willing to get into data science or simply love statistics, **R** is a good addition to your programming arsenal, being the perfect tool for analyzing data. - -If you are absolutely new to R, let me recommend you this excellent book that will teach you fundamentals of R. It’s available on Amazon Kindle. - -Preview | Product | Price | ----|---|---|--- -![Learn R in a Day][19] ![Learn R in a Day][19] | [Learn R in a Day][20] | | [Buy on Amazon][21] - -Do you use **R**? Are you just getting into it? Let us know more about how and why you use or want to learn to use **R**! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-r-ubuntu/ - -作者:[Sergiu][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/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://www.r-project.org/ -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/install-r-on-ubuntu.jpg?resize=800%2C450&ssl=1 -[3]: https://cran.r-project.org/ -[4]: https://itsfoss.com/bootable-windows-usb-linux/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_interactive_mode.png?fit=800%2C516&ssl=1 -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/r_plotting.jpg?fit=800%2C434&ssl=1 -[7]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rplots_pdf.png?fit=800%2C539&ssl=1 -[9]: https://www.dummies.com/programming/r/how-to-install-load-and-unload-packages-in-r/ -[10]: https://www.rstudio.com/ -[11]: https://itsfoss.com/install-deb-files-ubuntu/ -[12]: https://www.rstudio.com/products/rstudio/download/#download -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_home.jpg?fit=800%2C603&ssl=1 -[14]: https://itsfoss.com/python-setup-linux/ -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_new_file.png?fit=800%2C392&ssl=1 -[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_save_file.png?fit=800%2C258&ssl=1 -[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_working_directory.png?fit=800%2C394&ssl=1 -[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/06/rstudio_run.jpg?fit=800%2C626&ssl=1 -[19]: https://i1.wp.com/images-na.ssl-images-amazon.com/images/I/51oIJTbUlnL._SL160_.jpg?ssl=1 -[20]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Learn R in a Day) -[21]: https://www.amazon.com/Learn-R-Day-Steven-Murray-ebook/dp/B00GC2LKOK?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B00GC2LKOK (Buy on Amazon) diff --git a/sources/tech/20190701 Get modular with Python functions.md b/sources/tech/20190701 Get modular with Python functions.md deleted file mode 100644 index a424323503..0000000000 --- a/sources/tech/20190701 Get modular with Python functions.md +++ /dev/null @@ -1,337 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get modular with Python functions) -[#]: via: (https://opensource.com/article/19/7/get-modular-python-functions) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/xd-deng/users/nhuntwalker/users/don-watkins) - -Get modular with Python functions -====== -Minimize your coding workload by using Python functions for repeating -tasks. -![OpenStack source code \(Python\) in VIM][1] - -Are you confused by fancy programming terms like functions, classes, methods, libraries, and modules? Do you struggle with the scope of variables? Whether you're a self-taught programmer or a formally trained code monkey, the modularity of code can be confusing. But classes and libraries encourage modular code, and modular code can mean building up a collection of multipurpose code blocks that you can use across many projects to reduce your coding workload. In other words, if you follow along with this article's study of [Python][2] functions, you'll find ways to work smarter, and working smarter means working less. - -This article assumes enough Python familiarity to write and run a simple script. If you haven't used Python, read my [intro to Python][3] article first. - -### Functions - -Functions are an important step toward modularity because they are formalized methods of repetition. If there is a task that needs to be done again and again in your program, you can group the code into a function and call the function as often as you need it. This way, you only have to write the code once, but you can use it as often as you like. - -Here is an example of a simple function: - - -``` -#!/usr/bin/env python3 - -import time - -def Timer(): -        print("Time is " + str(time.time() ) ) -``` - -Create a folder called **mymodularity** and save the function code as **timestamp.py**. - -In addition to this function, create a file called **__init__.py** in the **mymodularity** directory. You can do this in a file manager or a Bash shell: - - -``` -`$ touch mymodularity/__init__.py` -``` - -You have now created your own Python library (a "module," in Python lingo) in your Python package called **mymodularity**. It's not a very useful module, because all it does is import the **time** module and print a timestamp, but it's a start. - -To use your function, treat it just like any other Python module. Here's a small application that tests the accuracy of Python's **sleep()** function, using your **mymodularity** package for support. Save this file as **sleeptest.py** _outside_ the **mymodularity** directory (if you put this _into_ **mymodularity**, then it becomes a module in your package, and you don't want that). - - -``` -#!/usr/bin/env python3 - -import time -from mymodularity import timestamp - -print("Testing Python sleep()...") - -# modularity -timestamp.Timer() -time.sleep(3) -timestamp.Timer() -``` - -In this simple script, you are calling your **timestamp** module from your **mymodularity** package (twice). When you import a module from a package, the usual syntax is to import the module you want from the package and then use the _module name + a dot + the name of the function you want to call_ (e.g., **timestamp.Timer()**). - -You're calling your **Timer()** function twice, so if your **timestamp** module were more complicated than this simple example, you'd be saving yourself quite a lot of repeated code. - -Save the file and run it: - - -``` -$ python3 ./sleeptest.py -Testing Python sleep()... -Time is 1560711266.1526039 -Time is 1560711269.1557732 -``` - -According to your test, the sleep function in Python is pretty accurate: after three seconds of sleep, the timestamp was successfully and correctly incremented by three, with a little variance in microseconds. - -The structure of a Python library might seem confusing, but it's not magic. Python is _programmed_ to treat a folder full of Python code accompanied by an **__init__.py** file as a package, and it's programmed to look for available modules in its current directory _first_. This is why the statement **from mymodularity import timestamp** works: Python looks in the current directory for a folder called **mymodularity**, then looks for a **timestamp** file ending in **.py**. - -What you have done in this example is functionally the same as this less modular version: - - -``` -#!/usr/bin/env python3 - -import time -from mymodularity import timestamp - -print("Testing Python sleep()...") - -# no modularity -print("Time is " + str(time.time() ) ) -time.sleep(3) -print("Time is " + str(time.time() ) ) -``` - -For a simple example like this, there's not really a reason you wouldn't write your sleep test that way, but the best part about writing your own module is that your code is generic so you can reuse it for other projects. - -You can make the code more generic by passing information into the function when you call it. For instance, suppose you want to use your module to test not the _computer's_ sleep function, but a _user's_ sleep function. Change your **timestamp** code so it accepts an incoming variable called **msg**, which will be a string of text controlling how the **timestamp** is presented each time it is called: - - -``` -#!/usr/bin/env python3 - -import time - -# updated code -def Timer(msg): -    print(str(msg) + str(time.time() ) ) -``` - -Now your function is more abstract than before. It still prints a timestamp, but what it prints for the user is undefined. That means you need to define it when calling the function. - -The **msg** parameter your **Timer** function accepts is arbitrarily named. You could call the parameter **m** or **message** or **text** or anything that makes sense to you. The important thing is that when the **timestamp.Timer** function is called, it accepts some text as its input, places whatever it receives into a variable, and uses the variable to accomplish its task. - -Here's a new application to test the user's ability to sense the passage of time correctly: - - -``` -#!/usr/bin/env python3 - -from mymodularity import timestamp - -print("Press the RETURN key. Count to 3, and press RETURN again.") - -input() -timestamp.Timer("Started timer at ") - -print("Count to 3...") - -input() -timestamp.Timer("You slept until ") -``` - -Save your new application as **response.py** and run it: - - -``` -$ python3 ./response.py -Press the RETURN key. Count to 3, and press RETURN again. - -Started timer at 1560714482.3772075 -Count to 3... - -You slept until 1560714484.1628013 -``` - -### Functions and required parameters - -The new version of your timestamp module now _requires_ a **msg** parameter. That's significant because your first application is broken because it doesn't pass a string to the **timestamp.Timer** function: - - -``` -$ python3 ./sleeptest.py -Testing Python sleep()... -Traceback (most recent call last): -  File "./sleeptest.py", line 8, in <module> -    timestamp.Timer() -TypeError: Timer() missing 1 required positional argument: 'msg' -``` - -Can you fix your **sleeptest.py** application so it runs correctly with the updated version of your module? - -### Variables and functions - -By design, functions limit the scope of variables. In other words, if a variable is created within a function, that variable is available to _only_ that function. If you try to use a variable that appears in a function outside the function, an error occurs. - -Here's a modification of the **response.py** application, with an attempt to print the **msg** variable from the **timestamp.Timer()** function: - - -``` -#!/usr/bin/env python3 - -from mymodularity import timestamp - -print("Press the RETURN key. Count to 3, and press RETURN again.") - -input() -timestamp.Timer("Started timer at ") - -print("Count to 3...") - -input() -timestamp.Timer("You slept for ") - -print(msg) -``` - -Try running it to see the error: - - -``` -$ python3 ./response.py -Press the RETURN key. Count to 3, and press RETURN again. - -Started timer at 1560719527.7862902 -Count to 3... - -You slept for 1560719528.135406 -Traceback (most recent call last): -  File "./response.py", line 15, in <module> -    print(msg) -NameError: name 'msg' is not defined -``` - -The application returns a **NameError** message because **msg** is not defined. This might seem confusing because you wrote code that defined **msg**, but you have greater insight into your code than Python does. Code that calls a function, whether the function appears within the same file or if it's packaged up as a module, doesn't know what happens inside the function. A function independently performs its calculations and returns what it has been programmed to return. Any variables involved are _local_ only: they exist only within the function and only as long as it takes the function to accomplish its purpose. - -#### Return statements - -If your application needs information contained only in a function, use a **return** statement to have the function provide meaningful data after it runs. - -They say time is money, so modify your timestamp function to allow for an imaginary charging system: - - -``` -#!/usr/bin/env python3 - -import time - -def Timer(msg): -    print(str(msg) + str(time.time() ) ) -    charge = .02 -    return charge -``` - -The **timestamp** module now charges two cents for each call, but most importantly, it returns the amount charged each time it is called. - -Here's a demonstration of how a return statement can be used: - - -``` -#!/usr/bin/env python3 - -from mymodularity import timestamp - -print("Press RETURN for the time (costs 2 cents).") -print("Press Q RETURN to quit.") - -total = 0 - -while True: -    kbd = input() -    if kbd.lower() == "q": -        print("You owe $" + str(total) ) -        exit() -    else: -        charge = timestamp.Timer("Time is ") -        total = total+charge -``` - -In this sample code, the variable **charge** is assigned as the endpoint for the **timestamp.Timer()** function, so it receives whatever the function returns. In this case, the function returns a number, so a new variable called **total** is used to keep track of how many changes have been made. When the application receives the signal to quit, it prints the total charges: - - -``` -$ python3 ./charge.py -Press RETURN for the time (costs 2 cents). -Press Q RETURN to quit. - -Time is 1560722430.345412 - -Time is 1560722430.933996 - -Time is 1560722434.6027434 - -Time is 1560722438.612629 - -Time is 1560722439.3649364 -q -You owe $0.1 -``` - -#### Inline functions - -Functions don't have to be created in separate files. If you're just writing a short script specific to one task, it may make more sense to just write your functions in the same file. The only difference is that you don't have to import your own module, but otherwise the function works the same way. Here's the latest iteration of the time test application as one file: - - -``` -#!/usr/bin/env python3 - -import time - -total = 0 - -def Timer(msg): -    print(str(msg) + str(time.time() ) ) -    charge = .02 -    return charge - -print("Press RETURN for the time (costs 2 cents).") -print("Press Q RETURN to quit.") - -while True: -    kbd = input() -    if kbd.lower() == "q": -        print("You owe $" + str(total) ) -        exit() -    else: -        charge = Timer("Time is ") -        total = total+charge -``` - -It has no external dependencies (the **time** module is included in the Python distribution), and produces the same results as the modular version. The advantage is that everything is located in one file, and the disadvantage is that you cannot use the **Timer()** function in some other script you are writing unless you copy and paste it manually. - -#### Global variables - -A variable created outside a function has nothing limiting its scope, so it is considered a _global_ variable. - -An example of a global variable is the **total** variable in the **charge.py** example used to track current charges. The running total is created outside any function, so it is bound to the application rather than to a specific function. - -A function within the application has access to your global variable, but to get the variable into your imported module, you must send it there the same way you send your **msg** variable. - -Global variables are convenient because they seem to be available whenever and wherever you need them, but it can be difficult to keep track of their scope and to know which ones are still hanging around in system memory long after they're no longer needed (although Python generally has very good garbage collection). - -Global variables are important, though, because not all variables can be local to a function or class. That's easy now that you know how to send variables to functions and get values back. - -### Wrapping up functions - -You've learned a lot about functions, so start putting them into your scripts—if not as separate modules, then as blocks of code you don't have to write multiple times within one script. In the next article in this series, I'll get into Python classes. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/get-modular-python-functions - -作者:[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/users/xd-deng/users/nhuntwalker/users/don-watkins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM) -[2]: https://www.python.org/ -[3]: https://opensource.com/article/17/10/python-101 diff --git a/sources/tech/20190703 6 open source web browser alternatives.md b/sources/tech/20190703 6 open source web browser alternatives.md index e569277b1e..3a965cc74c 100644 --- a/sources/tech/20190703 6 open source web browser alternatives.md +++ b/sources/tech/20190703 6 open source web browser alternatives.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (zmaster-zhang) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190703 Parse arguments with Python.md b/sources/tech/20190703 Parse arguments with Python.md deleted file mode 100644 index 73933c53ed..0000000000 --- a/sources/tech/20190703 Parse arguments with Python.md +++ /dev/null @@ -1,200 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Parse arguments with Python) -[#]: via: (https://opensource.com/article/19/7/parse-arguments-python) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/notsag) - -Parse arguments with Python -====== -Parse Python like a pro with the argparse module. -![COBOL punch card][1] - -If you're using [Python][2] for any amount of development, you have probably issued a command in a terminal, even if only to launch a Python script or install a Python module with [pip][3]. Commands may be simple and singular: - - -``` -`$ ls` -``` - -Commands also might take an argument: - - -``` -`$ ls example` -``` - -Commands can also have options or flags: - - -``` -`$ ls --color example` -``` - -Sometimes options also have arguments: - - -``` -`$ sudo firewall-cmd  --list-all --zone home` -``` - -### Arguments - -The POSIX shell automatically splits whatever you type as a command into an array. For instance, here is a simple command: - - -``` -`$ ls example` -``` - -The command **ls** is position **$0**, and the argument **example** is in position **$1**. - -You _could_ write a loop to iterate over each item; determine whether it is the command, an option, or an argument; and take action accordingly. Luckily, a module called [argparse][4] already exists for that. - -### Argparse - -The argparse module is easy to integrate into your Python programs and has several convenience features. For instance, if your user changes the order of options or uses one option that takes no arguments (called a _Boolean_, meaning the option toggles a setting on or off) and then another that requires an argument (such as **\--color red**, for example), argparse can handle the variety. If your user forgets an option that's required, the argparse module can provide a friendly error message. - -Using argparse in your application starts with defining what options you want to provide your user. There are several different kinds of arguments you can accept, but the syntax is consistent and simple. - -Here's a simple example: - - -``` -#!/usr/bin/env python -import argparse -import sys - -def getOptions(args=sys.argv[1:]): -    parser = argparse.ArgumentParser(description="Parses command.") -    parser.add_argument("-i", "--input", help="Your input file.") -    parser.add_argument("-o", "--output", help="Your destination output file.") -    parser.add_argument("-n", "--number", type=int, help="A number.") -    parser.add_argument("-v", "--verbose",dest='verbose',action='store_true', help="Verbose mode.") -    options = parser.parse_args(args) -    return options -``` - -This code sample creates a function called **getOptions** and tells Python to look at each potential argument preceded by some recognizable string (such as **\--input** or **-i**). Any option that Python finds is returned out of the function as an **options** object (**options** is an arbitrary name and has no special meaning; it's just a data object containing a summary of all the arguments that the function has parsed). - -By default, any argument given by the user is seen by Python as a string. If you need to ingest an integer (a number), you must specify that an option expects **type=int**, as in the **\--number** option in the sample code. - -If you have an argument that just turns a feature on or off, then you must use the **boolean** type, as with the **\--verbose** flag in the sample code. This style of option simply stores **True** or **False**, specifying whether or not the user used the flag. If the option is used, then **stored_true** is activated. - -Once the **getOptions** function runs, you can use the contents of the **options** object and have your program make decisions based on how the user invoked the command. You can see the contents of **options** with a test print statement. Add this to the bottom of your example file: - - -``` -`print(getOptions())` -``` - -Then run the code with some arguments: - - -``` -$ python3 ./example.py -i foo -n 4 -Namespace(input='foo', number=4, output=None, verbose=False) -``` - -### Retrieving values - -The **options** object in the sample code contains any value provided by the user (or a derived Boolean value) in keys named after the long option. In the sample code, for instance, the **\--number** option can be retrieved by looking at **options.number**. - - -``` -options = getOptions(sys.argv[1:]) - -if options.verbose: -    print("Verbose mode on") -else: -    print("Verbose mode off") - -print(options.input) -print(options.output) -print(options.number) - -# Insert Useful Python Code Here... -``` - -The Boolean option, **\--verbose** in the example, is determined by testing whether **options.verbose** is True (meaning the user did use the **\--verbose** flag) or False (the user did not use the **\--verbose** flag), and taking some action accordingly. - -### Help and feedback - -Argparse also includes a built-in **\--help** (**-h** for short) option that provides a helpful tip on how the command is used. This is derived from your code, so it takes no extra work to generate this help system: - - -``` -$ ./example.py --help -usage: example.py [-h] [-i INPUT] [-o OUTPUT] [-n NUMBER] [-v] - -Parses command. - -optional arguments: -  -h, --help            show this help message and exit -  -i INPUT, --input INPUT -                        Your input file. -  -o OUTPUT, --output OUTPUT -                        Your destination output file. -  -n NUMBER, --number NUMBER -                        A number. -  -v, --verbose         Verbose mode. -``` - -### Python parsing like a pro - -This a simple example that demonstrates how to deal with parsing arguments in a Python application and how to quickly and efficiently document their syntax. The next time you write a quick Python script, give it some options with argparse. You'll thank yourself later, and your command will feel less like a quick hack and more like a "real" Unix command! - -Here's the sample code, which you can use for testing: - - -``` -#!/usr/bin/env python3 -# GNU All-Permissive License -# Copying and distribution of this file, with or without modification, -# are permitted in any medium without royalty provided the copyright -# notice and this notice are preserved.  This file is offered as-is, -# without any warranty. - -import argparse -import sys - -def getOptions(args=sys.argv[1:]): -    parser = argparse.ArgumentParser(description="Parses command.") -    parser.add_argument("-i", "--input", help="Your input file.") -    parser.add_argument("-o", "--output", help="Your destination output file.") -    parser.add_argument("-n", "--number", type=int, help="A number.") -    parser.add_argument("-v", "--verbose",dest='verbose',action='store_true', help="Verbose mode.") -    options = parser.parse_args(args) -    return options - -options = getOptions(sys.argv[1:]) - -if options.verbose: -    print("Verbose mode on") -else: -    print("Verbose mode off") - -print(options.input) -print(options.output) -print(options.number) -``` - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/parse-arguments-python - -作者:[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/users/notsag -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cobol-card-punch-programming-code.png?itok=6W6PUqUi (COBOL punch card) -[2]: https://www.python.org/ -[3]: https://pip.pypa.io/en/stable/installing/ -[4]: https://pypi.org/project/argparse/ diff --git a/sources/tech/20190705 Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux.md b/sources/tech/20190705 Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux.md deleted file mode 100644 index d7799311d6..0000000000 --- a/sources/tech/20190705 Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux.md +++ /dev/null @@ -1,127 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux) -[#]: via: (https://www.2daygeek.com/linux-bash-script-to-monitor-messages-log-warning-error-critical-send-email/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -Bash Script to Monitor Messages Log (Warning, Error and Critical) on Linux -====== - -There are many open source monitoring tools are currently available in market to monitor Linux systems performance. - -It will send an email alert when the system reaches the specified threshold limit. - -It monitors everything such as CPU utilization, Memory utilization, swap utilization, disk space utilization and much more. - -If you only have few systems and want to monitor them then writing a small shell script can make your task very easy. - -In this tutorial we have added a shell script to monitor Messages Log on Linux system. - -We had added many useful shell scripts in the past. If you want to check those, navigate to the below link. - - * **[How to automate day to day activities using shell scripts?][1]** - - - -This script will check **“warning, error and critical”** in the `/var/log/messages` file and trigger a mail to given email id, if it’s found anything related it. - -We can’t run this script frequently that may fill up your inbox if the server has many matching strings, instead we can run once in a day. - -To overcome this issue, i made the script to trigger an email in a different manner. - -If any given strings are found in the **“/var/log/messages”** file for yesterday’s date then the script will send an email alert to given email id. - -**Note:** You need to change the email id instead of ours. Also, you can change the Memory utilization threshold value as per your requirement. - -``` -# vi /opt/scripts/os-log-alert.sh - -#!/bin/bash - -#Set the variable which equal to zero - -prev_count=0 - -count=$(grep -i "`date --date='yesterday' '+%b %e'`" /var/log/messages | egrep -wi 'warning|error|critical' | wc -l) - -if [ "$prev_count" -lt "$count" ] ; then - -# Send a mail to given email id when errors found in log - -SUBJECT="WARNING: Errors found in log on "`date --date='yesterday' '+%b %e'`"" - -# This is a temp file, which is created to store the email message. - -MESSAGE="/tmp/logs.txt" - -TO="[email protected]" - -echo "ATTENTION: Errors are found in /var/log/messages. Please Check with Linux admin." >> $MESSAGE - -echo "Hostname: `hostname`" >> $MESSAGE - -echo -e "\n" >> $MESSAGE - -echo "+------------------------------------------------------------------------------------+" >> $MESSAGE - -echo "Error messages in the log file as below" >> $MESSAGE - -echo "+------------------------------------------------------------------------------------+" >> $MESSAGE - -grep -i "`date --date='yesterday' '+%b %e'`" /var/log/messages | awk '{ $3=""; print}' | egrep -wi 'warning|error|critical' >> $MESSAGE - -mail -s "$SUBJECT" "$TO" < $MESSAGE - -#rm $MESSAGE - -fi -``` - -Set an executable permission to `os-log-alert.sh` file. - -``` -$ chmod +x /opt/scripts/os-log-alert.sh -``` - -Finally add a cronjob to automate this. It will run everyday at 7'o clock. - -``` -# crontab -e -0 7 * * * /bin/bash /opt/scripts/os-log-alert.sh -``` - -**Note:** You will be getting an email alert everyday at 7 o'clock, which is for yesterday's log. - -**Output:** You will be getting an email alert similar to below. - -``` -ATTENTION: Errors are found in /var/log/messages. Please Check with Linux admin. - -+-----------------------------------------------------+ -Error messages in the log file as below -+-----------------------------------------------------+ -Jul 3 02:40:11 ns1 kernel: php-fpm[3175]: segfault at 299 ip 000055dfe7cc7e25 sp 00007ffd799d7d38 error 4 in php-fpm[55dfe7a89000+3a7000] -Jul 3 02:50:14 ns1 kernel: lmtp[8249]: segfault at 20 ip 00007f9cc05295e4 sp 00007ffc57bca1a0 error 4 in libdovecot-storage.so.0.0.0[7f9cc04df000+148000] -Jul 3 15:36:09 ns1 kernel: php-fpm[17846]: segfault at 299 ip 000055dfe7cc7e25 sp 00007ffd799d7d38 error 4 in php-fpm[55dfe7a89000+3a7000] -Jul 3 15:45:54 ns1 pure-ftpd: ([email protected]) [WARNING] Authentication failed for user [daygeek] -Jul 3 16:25:36 ns1 pure-ftpd: ([email protected]) [WARNING] Sorry, cleartext sessions and weak ciphers are not accepted on this server.#012Please reconnect using TLS security mechanisms. -Jul 3 16:44:20 ns1 kernel: php-fpm[8979]: segfault at 299 ip 000055dfe7cc7e25 sp 00007ffd799d7d38 error 4 in php-fpm[55dfe7a89000+3a7000] -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-bash-script-to-monitor-messages-log-warning-error-critical-send-email/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/category/shell-script/ diff --git a/sources/tech/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md b/sources/tech/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md deleted file mode 100644 index 8c62453ef7..0000000000 --- a/sources/tech/20190705 Enable ‘Tap to click- on Ubuntu Login Screen -Quick Tip.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Enable ‘Tap to click’ on Ubuntu Login Screen [Quick Tip]) -[#]: via: (https://itsfoss.com/enable-tap-to-click-on-ubuntu-login-screen/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Enable ‘Tap to click’ on Ubuntu Login Screen [Quick Tip] -====== - -_**Brief: The tap to click option doesn’t work on the login screen in Ubuntu 18.04 GNOME desktop. In this tutorial, you’ll learn to enable the ‘tap to click’ on the Ubuntu login screen.**_ - -One of the first few things I do after installing Ubuntu is to make sure that tap to click has been enabled. As a laptop user, I prefer to tap the touchpad for making a left click. This is more convenient than using the left click button on the touchpad all the time. - -This is what happens when I have logged in and using the operating system. But if you are at the login screen, the tap to click doesn’t work and that’s an annoyance. - -On the [GDM login screen][1] in Ubuntu (or other distributions using GNOME desktop), you have to click the username in order to bring the password field. Now if you are habitual of tap to click, it doesn’t work on the login screen even if you have it enabled and use it after logging into the system. - -This is a minor annoyance but an annoyance nonetheless. The good news is that you can fix this annoyance.Let me show you how to do that in this quick tip. - -### Enabling tap to click on Ubuntu login screen - -![][2] - -You’ll have to use the terminal and a few commands here. I hope you are comfortable with it. - -[Open a terminal using Ctrl+Alt+T shortcut in Ubuntu][3]. Since Ubuntu 18.04 is still using X server, you need to enable it to connect to the [x server][4]. For that, you can add gdm to access control list. - -Switch to root user first. It’s required because you have to switch as gdm user later and you cannot do that as a non-root user. - -``` -sudo -i -``` - -[There is no password set for root user in Ubuntu][5]. You access it with your admin user account. So when asked for password, use your own password. You won’t see anything being typed on the screen when you type in your password. - -``` -xhost +SI:localuser:gdm -``` - -Here’s the output for me: - -``` -xhost +SI:localuser:gdm -localuser:gdm being added to access control list -``` - -Now run this command so that the the ‘user gdm’ has the correct tap to click setting. - -``` -gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true -``` - -If you see a warning like this: (process:6339): dconf-WARNING **: 19:52:21.217: Unable to open /root/.local/share/flatpak/exports/share/dconf/profile/user: Permission denied . Don’t worry. Just ignore it. - -[][6] - -Suggested read  How To Change Hostname on Ubuntu & Other Linux Distributions - -This will enable you to perform a tap to click on the login screen. Why were you not able to use tap to click when you made the changes in the system settings before? It’s because at the login screen, you haven’t selected your username yet. You get to use your account only when you select the user on the screen. This is why you had to use the user gdm and add the correct settings with it. - -Restart Ubuntu and you’ll see that you can now use the tap to select your user account now. - -#### Revert the changes - -If you are not happy with the tap to click on the Ubuntu login screen for some reason, you can revert the changes. - -You’ll have to perform all the steps you did in the previous section: switch to root, connect gdm with x server, switch to gdm user. But instead of the last command, you need to run this command: - -``` -gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click false -``` - -That’s it. - -As I said, it’s a tiny thing. I mean you can easily do a left click instead of the tap to click. It’s just a matter of one single click.However, it breaks the ‘continuity’ when you are forced to use the left click after a few taps. - -I hope you liked this quick little tweak. If you know some other cool tweaks, do share it with us. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/enable-tap-to-click-on-ubuntu-login-screen/ - -作者:[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://wiki.archlinux.org/index.php/GDM -[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/tap-to-click-on-ubuntu-login.jpg?ssl=1 -[3]: https://itsfoss.com/ubuntu-shortcuts/ -[4]: https://en.wikipedia.org/wiki/X.Org_Server -[5]: https://itsfoss.com/change-password-ubuntu/ -[6]: https://itsfoss.com/change-hostname-ubuntu/ diff --git a/sources/tech/20190705 Learn object-oriented programming with Python.md b/sources/tech/20190705 Learn object-oriented programming with Python.md deleted file mode 100644 index b617517526..0000000000 --- a/sources/tech/20190705 Learn object-oriented programming with Python.md +++ /dev/null @@ -1,311 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn object-oriented programming with Python) -[#]: via: (https://opensource.com/article/19/7/get-modular-python-classes) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Learn object-oriented programming with Python -====== -Make your code more modular with Python classes. -![Developing code.][1] - -In my previous article, I explained how to [make Python modular][2] by using functions, creating modules, or both. Functions are invaluable to avoid repeating code you intend to use several times, and modules ensure that you can use your code across different projects. But there's another component to modularity: the class. - -If you've heard the term _object-oriented programming_, then you may have some notion of the purpose classes serve. Programmers tend to consider a class as a virtual object, sometimes with a direct correlation to something in the physical world, and other times as a manifestation of some programming concept. Either way, the idea is that you can create a class when you want to create "objects" within a program for you or other parts of the program to interact with. - -### Templates without classes - -Assume you're writing a game set in a fantasy world, and you need this application to be able to drum up a variety of baddies to bring some excitement into your players' lives. Knowing quite a lot about functions, you might think this sounds like a textbook case for functions: code that needs to be repeated often but is written once with allowance for variations when called. - -Here's an example of a purely function-based implementation of an enemy generator: - - -``` -#!/usr/bin/env python3 - -import random - -def enemy(ancestry,gear): -    enemy=ancestry -    weapon=gear -    hp=random.randrange(0,20) -    ac=random.randrange(0,20) -    return [enemy,weapon,hp,ac] - -def fight(tgt): -    print("You take a swing at the " + tgt[0] + ".") -    hit=random.randrange(0,20) -    if hit > tgt[3]: -        print("You hit the " + tgt[0] + " for " + str(hit) + " damage!") -        tgt[2] = tgt[2] - hit -    else: -        print("You missed.") - -foe=enemy("troll","great axe") -print("You meet a " + foe[0] + " wielding a " + foe[1]) -print("Type the a key and then RETURN to attack.") - -while True: -    action=input() - -    if action.lower() == "a": -        fight(foe) - -    if foe[2] < 1: -        print("You killed your foe!") -    else: -        print("The " + foe[0] + " has " + str(foe[2]) + " HP remaining") -``` - -The **enemy** function creates an enemy with several attributes, such as ancestry, a weapon, health points, and a defense rating. It returns a list of each attribute, representing the sum total of the enemy. - -In a sense, this code has created an object, even though it's not using a class yet. Programmers call this "enemy" an _object_ because the result (a list of strings and integers, in this case) of the function represents a singular but complex _thing_ in the game. That is, the strings and integers in the list aren't arbitrary: together, they describe a virtual object. - -When writing a collection of descriptors, you use variables so you can use them any time you want to generate an enemy. It's a little like a template. - -In the example code, when an attribute of the object is needed, the corresponding list item is retrieved. For instance, to get the ancestry of an enemy, the code looks at **foe[0]**, for health points, it looks at **foe[2]** for health points, and so on. - -There's nothing necessarily wrong with this approach. The code runs as expected. You could add more enemies of different types, you could create a list of enemy types and randomly select from the list during enemy creation, and so on. It works well enough, and in fact [Lua][3] uses this principle very effectively to approximate an object-oriented model. - -However, there's sometimes more to an object than just a list of attributes. - -### The way of the object - -In Python, everything is an object. Anything you create in Python is an _instance_ of some predefined template. Even basic strings and integers are derivatives of the Python **type** class. You can witness this for yourself an interactive Python shell: - - -``` ->>> foo=3 ->>> type(foo) -<class 'int'> ->>> foo="bar" ->>> type(foo) -<class 'str'> -``` - -When an object is defined by a class, it is more than just a collection of attributes. Python classes have functions all their own. This is convenient, logically, because actions that pertain only to a certain class of objects are contained within that object's class. - -In the example code, the fight code is a function of the main application. That works fine for a simple game, but in a complex one, there would be more than just players and enemies in the game world. There might be townsfolk, livestock, buildings, forests, and so on, and none of them ever need access to a fight function. Placing code for combat in an enemy class means your code is better organized; and in a complex application, that's a significant advantage. - -Furthermore, each class has privileged access to its own local variables. An enemy's health points, for instance, isn't data that should ever change except by some function of the enemy class. A random butterfly in the game should not accidentally reduce an enemy's health to 0. Ideally, even without classes, that would never happen, but in a complex application with lots of moving parts, it's a powerful trick of the trade to ensure that parts that don't need to interact with one another never do. - -Python classes are also subject to garbage collection. When an instance of a class is no longer used, it is moved out of memory. You may never know when this happens, but you tend to notice when it doesn't happen because your application takes up more memory and runs slower than it should. Isolating data sets into classes helps Python track what is in use and what is no longer needed. - -### Classy Python - -Here's the same simple combat game using a class for the enemy: - - -``` -#!/usr/bin/env python3 - -import random - -class Enemy(): -    def __init__(self,ancestry,gear): -        self.enemy=ancestry -        self.weapon=gear -        self.hp=random.randrange(10,20) -        self.ac=random.randrange(12,20) -        self.alive=True - -    def fight(self,tgt): -        print("You take a swing at the " + self.enemy + ".") -        hit=random.randrange(0,20) - -        if self.alive and hit > self.ac: -            print("You hit the " + self.enemy + " for " + str(hit) + " damage!") -            self.hp = self.hp - hit -            print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") -        else: -            print("You missed.") - -        if self.hp < 1: -            self.alive=False - -# game start -foe=Enemy("troll","great axe") -print("You meet a " + foe.enemy + " wielding a " + foe.weapon) - -# main loop -while True: -    -    print("Type the a key and then RETURN to attack.") -        -    action=input() - -    if action.lower() == "a": -        foe.fight(foe) -                -    if foe.alive == False: -        print("You have won...this time.") -        exit() -``` - -This version of the game handles the enemy as an object containing the same attributes (ancestry, weapon, health, and defense), plus a new attribute measuring whether the enemy has been vanquished yet, as well as a function for combat. - -The first function of a class is a special function called (in Python) an _init_, or initialization, function. This is similar to a [constructor][4] in other languages; it creates an instance of the class, which is identifiable to you by its attributes and to whatever variable you use when invoking the class (**foe** in the example code). - -### Self and class instances - -The class' functions accept a new form of input you don't see outside of classes: **self**. If you don't include **self**, then Python has no way of knowing _which_ instance of the class to use when you call a class function. It's like challenging a single orc to a duel by saying "I'll fight the orc" in a room full of orcs; nobody knows which one you're referring to, and so bad things happen. - -![Image of an Orc, CC-BY-SA by Buch on opengameart.org][5] - -CC-BY-SA by Buch on opengameart.org - -Each attribute created within a class is prepended with the **self** notation, which identifies that variable as an attribute of the class. Once an instance of a class is spawned, you swap out the **self** prefix with the variable representing that instance. Using this technique, you could challenge just one orc to a duel in a room full of orcs by saying "I'll fight the gorblar.orc"; when Gorblar the Orc hears **gorblar.orc**, he knows which orc you're referring to (him_self_), and so you get a fair fight instead of a brawl. In Python: - - -``` -gorblar=Enemy("orc","sword") -print("The " + gorblar.enemy + " has " + str(gorblar.hp) + " remaining.") -``` - -Instead of looking to **foe[0]** (as in the functional example) or **gorblar[0]** for the enemy type, you retrieve the class attribute (**gorblar.enemy** or **gorblar.hp** or whatever value for whatever object you need). - -### Local variables - -If a variable in a class is not prepended with the **self** keyword, then it is a local variable, just as in any function. For instance, no matter what you do, you cannot access the **hit** variable outside the **Enemy.fight** class: - - -``` ->>> print(foe.hit) -Traceback (most recent call last): -  File "./enclass.py", line 38, in <module> -    print(foe.hit) -AttributeError: 'Enemy' object has no attribute 'hit' - ->>> print(foe.fight.hit) -Traceback (most recent call last): -  File "./enclass.py", line 38, in <module> -    print(foe.fight.hit) -AttributeError: 'function' object has no attribute 'hit' -``` - -The **hit** variable is contained within the Enemy class, and only "lives" long enough to serve its purpose in combat. - -### More modularity - -This example uses a class in the same text document as your main application. In a complex game, it's easier to treat each class almost as if it were its own self-standing application. You see this when multiple developers work on the same application: one developer works on a class, and the other works on the main program, and as long as they communicate with one another about what attributes the class must have, the two code bases can be developed in parallel. - -To make this example game modular, split it into two files: one for the main application and one for the class. Were it a more complex application, you might have one file per class, or one file per logical groups of classes (for instance, a file for buildings, a file for natural surroundings, a file for enemies and NPCs, and so on). - -Save one file containing just the Enemy class as **enemy.py** and another file containing everything else as **main.py**. - -Here's **enemy.py**: - - -``` -import random - -class Enemy(): -    def __init__(self,ancestry,gear): -        self.enemy=ancestry -        self.weapon=gear -        self.hp=random.randrange(10,20) -        self.stg=random.randrange(0,20) -        self.ac=random.randrange(0,20) -        self.alive=True - -    def fight(self,tgt): -        print("You take a swing at the " + self.enemy + ".") -        hit=random.randrange(0,20) - -        if self.alive and hit > self.ac: -            print("You hit the " + self.enemy + " for " + str(hit) + " damage!") -            self.hp = self.hp - hit -            print("The " + self.enemy + " has " + str(self.hp) + " HP remaining") -        else: -            print("You missed.") - -        if self.hp < 1: -            self.alive=False -``` - -Here's **main.py**: - - -``` -#!/usr/bin/env python3 - -import enemy as en - -# game start -foe=en.Enemy("troll","great axe") -print("You meet a " + foe.enemy + " wielding a " + foe.weapon) - -# main loop -while True: -    -    print("Type the a key and then RETURN to attack.") - -    action=input() - -    if action.lower() == "a": -        foe.fight(foe) - -    if foe.alive == False: -        print("You have won...this time.") -        exit() -``` - -Importing the module **enemy.py** is done very specifically with a statement that refers to the file of classes as its name without the **.py** extension, followed by a namespace designator of your choosing (for example, **import enemy as en**). This designator is what you use in the code when invoking a class. Instead of just using **Enemy()**, you preface the class with the designator of what you imported, such as **en.Enemy**. - -All of these file names are entirely arbitrary, although not uncommon in principle. It's a common convention to name the part of the application that serves as the central hub **main.py**, and a file full of classes is often named in lowercase with the classes inside it, each beginning with a capital letter. Whether you follow these conventions doesn't affect how the application runs, but it does make it easier for experienced Python programmers to quickly decipher how your application works. - -There's some flexibility in how you structure your code. For instance, using the code sample, both files must be in the same directory. If you want to package just your classes as a module, then you must create a directory called, for instance, **mybad** and move your classes into it. In **main.py**, your import statement changes a little: - - -``` -`from mybad import enemy as en` -``` - -Both systems produce the same results, but the latter is best if the classes you have created are generic enough that you think other developers could use them in their projects. - -Regardless of which you choose, launch the modular version of the game: - - -``` -$ python3 ./main.py -You meet a troll wielding a great axe -Type the a key and then RETURN to attack. -a -You take a swing at the troll. -You missed. -Type the a key and then RETURN to attack. -a -You take a swing at the troll. -You hit the troll for 8 damage! -The troll has 4 HP remaining -Type the a key and then RETURN to attack. -a -You take a swing at the troll. -You hit the troll for 11 damage! -The troll has -7 HP remaining -You have won...this time. -``` - -The game works. It's modular. And now you know what it means for an application to be object-oriented. But most importantly, you know to be specific when challenging an orc to a duel. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/get-modular-python-classes - -作者:[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_development_programming.png?itok=M_QDcgz5 (Developing code.) -[2]: https://opensource.com/article/19/6/get-modular-python-functions -[3]: https://opensource.com/article/17/4/how-program-games-raspberry-pi -[4]: https://opensource.com/article/19/6/what-java-constructor -[5]: https://opensource.com/sites/default/files/images/orc-buch-opengameart_cc-by-sa.jpg (CC-BY-SA by Buch on opengameart.org) diff --git a/sources/tech/20190706 How to enable DNS-over-HTTPS (DoH) in Firefox.md b/sources/tech/20190706 How to enable DNS-over-HTTPS (DoH) in Firefox.md deleted file mode 100644 index f2440f0fb7..0000000000 --- a/sources/tech/20190706 How to enable DNS-over-HTTPS (DoH) in Firefox.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to enable DNS-over-HTTPS (DoH) in Firefox) -[#]: via: (https://www.zdnet.com/article/how-to-enable-dns-over-https-doh-in-firefox/) -[#]: author: (Catalin Cimpanu https://www.zdnet.com/meet-the-team/us/catalin.cimpanu/) - -How to enable DNS-over-HTTPS (DoH) in Firefox -====== - -The DNS-over-HTTPS (DoH) protocol is currently the talk of the town, and the Firefox browser is the only one to support it. - -However, the feature is not enabled by default for Firefox users, who will have to go through many hoops and modify multiple settings before they can get the DoH up and running. - -But before we go into a step-by-step tutorial on how someone can enable DoH support in Firefox, let's describe what it does first. - -### How DNS-over-HTTPS works - -The DNS-over-HTTPS protocol works by taking a domain name that a user has typed in their browser and sending a query to a DNS server to learn the numerical IP address of the web server that hosts that specific site. - -This is how normal DNS works, too. However, DoH takes the DNS query and sends it to a DoH-compatible DNS server (resolver) via an encrypted HTTPS connection on port 443, rather than plaintext on port 53. - -This way, DoH hides DNS queries inside regular HTTPS traffic, so third-party observers won't be able to sniff traffic and tell what DNS queries users have run and infer what websites they are about to access. - -Further, a secondary feature of DNS-over-HTTPS is that the protocol works at the app level. Apps can come with internally hardcoded lists of DoH-compatible DNS resolvers where they can send DoH queries. - -This mode of operation bypasses the default DNS settings that exist at the OS level, which, in most cases are the ones set by local internet service providers (ISPs). - -This also means that apps that support DoH can effectively bypass local ISPs traffic filters and access content that may be blocked by a local telco or local government -- and a reason why DoH is currently hailed as a boon for users' privacy and security. - -This is one of the reasons that DoH has gained quite the popularity in less than two years after it launched, and a reason why a group of [UK ISPs nominated Mozilla for the award of 2019 Internet Vilain][1] for its plans to support the DoH protocol, which they said would thwart their efforts in filtering bad traffic. - -As a response, and due to the complex situation in the UK where the government blocks access to copyright-infringing content, and where ISPs voluntarily block access to child abuse website, [Mozilla has decided not to enable this feature by default for British users][2]. - -The below step-by-step guide will show Firefox users in the UK and Firefox users all over the world how to enable the feature right now, and not wait until Mozilla enables it later down the road -- if it will ever do. There are two methods of enabling DoH support in Firefox. - -### Method 1 - via the Firefox settings - -**Step 1:** Go to the Firefox menu, choose **Tools** , and then **Preferences**. Optionally type **about:preferences** in the URL bar and press enter. This will open the Firefox prerences section. - -**Step 2:** In the **General** section, scroll down to the **Network Settings** panel, and press the **Settings** button. - -![DoH section in Firefox settings][3] - -Image: ZDNet - -**Step 3:** In the popup, scroll down and select " **Enable DNS over HTTPS** ," then configure your desired DoH resolver. You can use the built in Cloudflare resolver (a company with which Mozilla has [reached an agreement][4] to log less data about Firefox users), or use one of your choice, [from this list][4]. - -![DoH section in Firefox settings][5]![DoH section in Firefox settings][6] - -Image: ZDNet - -### Method 2 - via about:config - -**Step 1:** Type **about:config** in the URL bar and press Enter to access Firefox's hidden configuration panel. Here users will need to enable and modify three settings. - -**Step 2:** The first setting is **network.trr.mode**. This turns on DoH support. This setting supports four values: - - * 0 - Default value in standard Firefox installations (currently is 5, which means DoH is disabled) - * 1 - DoH is enabled, but Firefox picks if it uses DoH or regular DNS based on which returns faster query responses - * 2 - DoH is enabled, and regular DNS works as a backup - * 3 - DoH is enabled, and regular DNS is disabled - * 5 - DoH is disabled - - - -A value of 2 works best. - -![DoH in Firefox][5]![DoH in Firefox][7] - -Image: ZDNet - -**Step 3:** The second setting that needs to be modified is **network.trr.uri**. This is the URL of the DoH-compatible DNS server where Firefox will send DoH DNS queries. By default, Firefox uses Cloudflare's DoH service located at . However, users can use their own DoH server URL. They can select one from the many available servers, [from this list, here][8]. The reason why Mozilla uses Cloudflare in Firefox is because the companies [reached an agreement][4] following which Cloudflare would collect very little data on DoH queries coming from Firefox users. - -![DoH in Firefox][5]![DoH in Firefox][9] - -Image: ZDNet - -**Step 4:** The third setting is optional and you can skip this one. But if things don't work, you can use this one as a backup for Step 3. The option is called **network.trr.bootstrapAddress** and is an input field where users can enter the numerical IP address of the DoH-compatible DNS resolver they entered in Step 3. For Cloudflare, that would be 1.1.1.1. For Google's service, that would be 8.8.8.8. If you used another DoH resolver's URL, you'll need to track down that server's IP and enter it here, if ever necesarry. - -![DoH in Firefox][5]![DoH in Firefox][10] - -Image: ZDNet - -Normally, the URL entered in Step 3 should be enough, though. - -Settings should apply right away, but in case they don't work, give Firefox a restart. - -Article source: [Mozilla Wiki][11] - - --------------------------------------------------------------------------------- - -via: https://www.zdnet.com/article/how-to-enable-dns-over-https-doh-in-firefox/ - -作者:[Catalin Cimpanu][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.zdnet.com/meet-the-team/us/catalin.cimpanu/ -[b]: https://github.com/lujun9972 -[1]: https://www.zdnet.com/article/uk-isp-group-names-mozilla-internet-villain-for-supporting-dns-over-https/ -[2]: https://www.zdnet.com/article/mozilla-no-plans-to-enable-dns-over-https-by-default-in-the-uk/ -[3]: https://zdnet1.cbsistatic.com/hub/i/2019/07/07/df30c7b0-3a20-4de7-8640-3dea6d249a49/121bd379b6232e1e2a97c35ea8c7764e/doh-settings-1.png -[4]: https://developers.cloudflare.com/1.1.1.1/commitment-to-privacy/privacy-policy/firefox/ -[5]: -[6]: https://zdnet3.cbsistatic.com/hub/i/2019/07/07/8608af28-2a28-4ff1-952b-9b6d2deb1ea6/b1fc322caaa2c955b1a2fb285daf0e42/doh-settings-2.png -[7]: https://zdnet1.cbsistatic.com/hub/i/2019/07/06/0232b3a7-82c6-4a6f-90c1-faf0c090254c/6db9b36509021c460fcc7fe825bb74c5/doh-1.png -[8]: https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers -[9]: https://zdnet2.cbsistatic.com/hub/i/2019/07/06/4dd1d5c1-6fa7-4f5b-b7cd-b544748edfed/baa7a70ac084861d94a744a57a3147ad/doh-2.png -[10]: https://zdnet1.cbsistatic.com/hub/i/2019/07/06/8ec20a28-673c-4a17-8195-16579398e90a/538fe8420f9b24724aeb4a6c8d4f0f0f/doh-3.png -[11]: https://wiki.mozilla.org/Trusted_Recursive_Resolver diff --git a/sources/tech/20190706 Install NetData Performance Monitoring Tool On Linux.md b/sources/tech/20190706 Install NetData Performance Monitoring Tool On Linux.md deleted file mode 100644 index a0fa775728..0000000000 --- a/sources/tech/20190706 Install NetData Performance Monitoring Tool On Linux.md +++ /dev/null @@ -1,312 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Install NetData Performance Monitoring Tool On Linux) -[#]: via: (https://www.ostechnix.com/netdata-real-time-performance-monitoring-tool-linux/) -[#]: author: (sk https://www.ostechnix.com/author/sk/) - -Install NetData Performance Monitoring Tool On Linux -====== - -![][1] - -**NetData** is a distributed, real-time, performance and health monitoring tool for systems and applications. It provides unparalleled insights of everything happening on a system in real-time. You can view the results in a highly interactive web-dashboard. Using Netdata, you can get a clear idea of what is happening now, and what happened before in your systems and applications. You don’t need to be an expert to deploy this tool in your Linux systems. NetData just works fine out of the box with zero configuration, and zero dependencies. Just install this utility and sit back, NetData will take care of the rest. - -It has its own built-in webserver to display the result in graphical format. NetData is quite fast and efficient, and it will immediately start to analyze the performance of your system in no time after installing it. It is written using **C** programming language, so it is extremely light weight. It consumes less than 3% of a single core CPU usage and a 10-15MB of RAM. We can easily embed the charts on any existing web pages, and also it has a plugin API, so that you can monitor any application. - -Here is the list of things that will be monitored by NetData utility in your Linux system. - - * CPU usage, - * RAM Usage, - * Swap memory usage, - * Kernel memory usage, - * Hard disks and its usage, - * Network interfaces, - * IPtables, - * Netfilter, - * DDoS protection, - * Processes, - * Applications, - * NFS server, - * Web server (Apache & Nginx), - * Database servers (MySQL), - * DHCP server, - * DNS server, - * Email serve,r - * Proxy server, - * Tomcat, - * PHP, - * SNP devices, - * And many more. - - - -NetData is free, open source tool and it supports Linux, FreeBSD and Mac OS. - -### Install NetData On Linux - -Netdata can be installed on any Linux distributions that have **Bash** installed. - -The easiest way to install Netdata is to run the following one-liner command from the Terminal: - -``` -$ bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) -``` - -This will download and install everything needed to up and run Netdata. - -Some users may not want to inject something directly into Bash without investigating it. If you don’t like this method, you can follow the steps below to install it on your system. - -**On Arch Linux:** - -The latest version is available in the Arch Linux default repositories. So, we can install it with [**pacman**][2] using command: - -``` -$ sudo pacman -S netdata -``` - -**On DEB and RPM-based systems** - -NetData is not available in the default repositories of DEB based (Ubuntu / Debian) or RPM based (RHEL / CentOS / Fedora) systems. We need to install NetData manually from its Git repository. - -First install the required dependencies: - -``` -# Debian / Ubuntu -$ sudo apt-get install zlib1g-dev uuid-dev libuv1-dev liblz4-dev libjudy-dev libssl-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl - -# Fedora -$ sudo dnf install zlib-devel libuuid-devel libuv-devel lz4-devel Judy-devel openssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils - -# CentOS / Red Hat Enterprise Linux -$ sudo yum install epel-release -$ sudo yum install autoconf automake curl gcc git libmnl-devel libuuid-devel openssl-devel libuv-devel lz4-devel Judy-devel lm_sensors make MySQL-python nc pkgconfig python python-psycopg2 PyYAML zlib-devel - -# openSUSE -$ sudo zypper install zlib-devel libuuid-devel libuv-devel liblz4-devel judy-devel openssl-devel libmnl-devel gcc make git autoconf autoconf-archive autogen automake pkgconfig curl findutils -``` - -After installing the required dependencies, install NetData on DEB or RPM based systems as shown below. - -Git clone the NetData repository: - -``` -$ git clone https://github.com/netdata/netdata.git --depth=100 -``` - -The above command will create a directory called **‘netdata’** in the current working directory. - -Change to the ‘netdata’ directory: - -``` -$ cd netdata/ -``` - -Finally, install and start NetData using command: - -``` -$ sudo ./netdata-installer.sh -``` - -**Sample output:** - -``` -Welcome to netdata! -Nice to see you are giving it a try! - -You are about to build and install netdata to your system. - -It will be installed at these locations: - -- the daemon at /usr/sbin/netdata - - config files at /etc/netdata - - web files at /usr/share/netdata - - plugins at /usr/libexec/netdata - - cache files at /var/cache/netdata - - db files at /var/lib/netdata - - log files at /var/log/netdata - - pid file at /var/run - -This installer allows you to change the installation path. -Press Control-C and run the same command with --help for help. - -Press ENTER to build and install netdata to your system > ## Press ENTER key -``` - -After installing NetData, you will see the following output at the end: - -``` -------------------------------------------------------------------------------- - -OK. NetData is installed and it is running (listening to *:19999). - -------------------------------------------------------------------------------- - -INFO: Command line options changed. -pidfile, -nd and -ch are deprecated. -If you use custom startup scripts, please run netdata -h to see the -corresponding options and update your scripts. - -Hit http://localhost:19999/ from your browser. - -To stop netdata, just kill it, with: - -killall netdata - -To start it, just run it: - -/usr/sbin/netdata - - -Enjoy! - -Uninstall script generated: ./netdata-uninstaller.sh -``` - -![][3] - -Install NetData - -NetData has been installed and started. - -To install Netdata on other Linux distributions, refer the [**official installation instructions page**][4]. - -##### Allow NetData default port via Firewall or Router - -If your system stays behind any firewall or router, you must allow the default port **19999** to access the NetData web interface from any remote systems on the network,. - -**On Ubuntu / Debian:** - -``` -$ sudo ufw allow 19999 -``` - -**On CentOS / RHEL / Fedora:** - -``` -$ sudo firewall-cmd --permanent --add-port=19999/tcp - -$ sudo firewall-cmd --reload -``` - -### Starting / Stopping NetData - -To enable and start Netdata service on systems that use **Systemd** , run: - -``` -$ sudo systemctl enable netdata - -$ sudo systemctl start netdata -``` - -To stop: - -``` -$ sudo systemctl stop netdata -``` - -To enable and start Netdata service on systems that use **Init** , run: - -``` -$ sudo service netdata start - -$ sudo chkconfig netdata on -``` - -To stop it: - -``` -$ sudo service netdata stop -``` - -### Access NetData via Web browser - -Open your web browser, and navigate to **** or **** or ****. You should see a screen something like below. - -![][5] - -Netdata dashboard - -From the dashboard, you will find the complete statistics of your Linux system. Scroll down to view each section. - -You can download and/or view NetData default configuration file at any time by simply navigating to ****. - -![][6] - -Netdata configuration file - -### Updating NetData - -In Arch Linux, just run the following command to update NetData. If the updated version is available in the repository, it will be automatically installed. - -``` -$ sudo pacman -Syyu -``` - -In DEB or RPM based systems, just go to the directory where you have cloned it (In our case it’s netdata). - -``` -$ cd netdata -``` - -Pull the latest update: - -``` -$ git pull -``` - -Then, rebuild and update it using command: - -``` -$ sudo ./netdata-installer.sh -``` - -### Uninstalling NetData - -Go to the location where you have cloned NetData. - -``` -$ cd netdata -``` - -Then, uninstall it using command: - -``` -$ sudo ./netdata-uninstaller.sh --force -``` - -In Arch Linux, the following command will uninstall it. - -``` -$ sudo pacman -Rns netdata -``` - -**Resources:** - - * [**NetData website**][7] - * [**NetData GitHub page**][8] - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/netdata-real-time-performance-monitoring-tool-linux/ - -作者:[sk][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.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/wp-content/uploads/2016/06/Install-netdata-720x340.png -[2]: https://www.ostechnix.com/getting-started-pacman/ -[3]: https://www.ostechnix.com/wp-content/uploads/2016/06/Deepin-Terminal_002-6.png -[4]: https://docs.netdata.cloud/packaging/installer/ -[5]: https://www.ostechnix.com/wp-content/uploads/2016/06/Netdata-dashboard.png -[6]: https://www.ostechnix.com/wp-content/uploads/2016/06/Netdata-config-file.png -[7]: http://netdata.firehol.org/ -[8]: https://github.com/firehol/netdata diff --git a/sources/tech/20190709 How to install Elasticsearch and Kibana on Linux.md b/sources/tech/20190709 How to install Elasticsearch and Kibana on Linux.md deleted file mode 100644 index 25e8997f3c..0000000000 --- a/sources/tech/20190709 How to install Elasticsearch and Kibana on Linux.md +++ /dev/null @@ -1,185 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (runningwater) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install Elasticsearch and Kibana on Linux) -[#]: via: (https://opensource.com/article/19/7/install-elasticsearch-and-kibana-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to install Elasticsearch and Kibana on Linux -====== -Get our simplified instructions for installing both. -![5 pengiuns floating on iceburg][1] - -If you're keen to learn Elasticsearch, the famous open source search engine based on the open source Lucene library, then there's no better way than to install it locally. The process is outlined in detail on the [Elasticsearch website][2], but the official instructions have a lot more detail than necessary if you're a beginner. This article takes a simplified approach. - -### Add the Elasticsearch repository - -First, add the Elasticsearch software repository to your system, so you can install it and receive updates as needed. How you do so depends on your distribution. On an RPM-based system, such as [Fedora][3], [CentOS][4], [Red Hat Enterprise Linux (RHEL)][5], or [openSUSE][6], (anywhere in this article that references Fedora or RHEL applies to CentOS and openSUSE as well) create a repository description file in **/etc/yum.repos.d/** called **elasticsearch.repo**: - - -``` -$ cat << EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo -[elasticsearch-7.x] -name=Elasticsearch repository for 7.x packages -baseurl= -gpgcheck=1 -gpgkey= -enabled=1 -autorefresh=1 -type=rpm-md -EOF -``` - -On Ubuntu or Debian, do not use the **add-apt-repository** utility. It causes errors due to a mismatch in its defaults and what Elasticsearch’s repository provides. Instead, set up this one: - - -``` -$ echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list -``` - -This repository contains only Elasticsearch’s open source features, under an [Apache License][7], with none of the extra features provided by a subscription. If you need subscription-only features (these features are _not_ open source), the **baseurl** must be set to: - - -``` -`baseurl=https://artifacts.elastic.co/packages/7.x/yum` -``` - -  - -### Install Elasticsearch - -The name of the package you need to install depends on whether you use the open source version or the subscription version. This article uses the open source version, which appends **-oss** to the end of the package name. Without **-oss** appended to the package name, you are requesting the subscription-only version. - -If you create a repository pointing to the subscription version but try to install the open source version, you will get a fairly non-specific error in return. If you create a repository for the open source version and fail to append **-oss** to the package name, you will also get an error. - -Install Elasticsearch with your package manager. For instance, on Fedora, CentOS, or RHEL, run the following: - - -``` -$ sudo dnf install elasticsearch-oss -``` - -On Ubuntu or Debian, run: - - -``` -$ sudo apt install elasticsearch-oss -``` - -If you get errors while installing Elasticsearch, then you may be attempting to install the wrong package. If your intention is to use the open source package, as this article does, then make sure you are using the correct **apt** repository or baseurl in your Yum configuration. - -### Start and enable Elasticsearch - -Once Elasticsearch has been installed, you must start and enable it: - - -``` -$ sudo systemctl daemon-reload -$ sudo systemctl enable --now elasticsearch.service -``` - -Then, to confirm that Elasticsearch is running on its default port of 9200, point a web browser to **localhost:9200**. You can use a GUI browser or you can do it in the terminal: - - -``` -$ curl localhost:9200 -{ - -  "name" : "fedora30", -  "cluster_name" : "elasticsearch", -  "cluster_uuid" : "OqSbb16NQB2M0ysynnX1hA", -  "version" : { -    "number" : "7.2.0", -    "build_flavor" : "oss", -    "build_type" : "rpm", -    "build_hash" : "508c38a", -    "build_date" : "2019-06-20T15:54:18.811730Z", -    "build_snapshot" : false, -    "lucene_version" : "8.0.0", -    "minimum_wire_compatibility_version" : "6.8.0", -    "minimum_index_compatibility_version" : "6.0.0-beta1" -  }, -  "tagline" : "You Know, for Search" -} -``` - -### Install Kibana - -Kibana is a graphical interface for Elasticsearch data visualization. It’s included in the Elasticsearch repository, so you can install it with your package manager. Just as with Elasticsearch itself, you must append **-oss** to the end of the package name if you are using the open source version of Elasticsearch, and not the subscription version (the two installations need to match): - - -``` -$ sudo dnf install kibana-oss -``` - -On Ubuntu or Debian: - - -``` -$ sudo apt install kibana-oss -``` - -Kibana runs on port 5601, so launch a graphical web browser and navigate to **localhost:5601** to start using the Kibana interface, which is shown below: - -![Kibana running in Firefox.][8] - -### Troubleshoot - -If you get errors while installing Elasticsearch, try installing a Java environment manually. On Fedora, CentOS, and RHEL: - - -``` -$ sudo dnf install java-openjdk-devel java-openjdk -``` - -On Ubuntu: - - -``` -`$ sudo apt install default-jdk` -``` - -If all else fails, try installing the Elasticsearch RPM directly from the Elasticsearch servers: - - -``` -$ wget -$ shasum -a 512 -c elasticsearch-oss-7.2.0-x86_64.rpm.sha512 && sudo rpm --install elasticsearch-oss-7.2.0-x86_64.rpm -``` - -On Ubuntu or Debian, use the DEB package instead. - -If you cannot access either Elasticsearch or Kibana with a web browser, then your firewall may be blocking those ports. You can allow traffic on those ports by adjusting your firewall settings. For instance, if you are running **firewalld** (the default on Fedora and RHEL, and installable on Debian and Ubuntu), then you can use **firewall-cmd**: - - -``` -$ sudo firewall-cmd --add-port=9200/tcp --permanent -$ sudo firewall-cmd --add-port=5601/tcp --permanent -$ sudo firewall-cmd --reload -``` - -You’re now set up and can follow along with our upcoming installation articles for Elasticsearch and Kibana. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/install-elasticsearch-and-kibana-linux - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者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/rh_003499_01_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) -[2]: https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html -[3]: https://getfedora.org -[4]: https://www.centos.org -[5]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[6]: https://www.opensuse.org -[7]: http://www.apache.org/licenses/ -[8]: https://opensource.com/sites/default/files/uploads/kibana.jpg (Kibana running in Firefox.) diff --git a/sources/tech/20190711 Type Linux Commands In Capital Letters To Run Them As Sudo User.md b/sources/tech/20190711 Type Linux Commands In Capital Letters To Run Them As Sudo User.md deleted file mode 100644 index b93c727644..0000000000 --- a/sources/tech/20190711 Type Linux Commands In Capital Letters To Run Them As Sudo User.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Type Linux Commands In Capital Letters To Run Them As Sudo User) -[#]: via: (https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/) -[#]: author: (sk https://www.ostechnix.com/author/sk/) - -Type Linux Commands In Capital Letters To Run Them As Sudo User -====== - -![Type Linux Commands In Capital Letters To Run Them As Sudo User][1] - -The reason I love Linux community a lot is they create so many FUN projects which you rarely find in any other propriety operating systems. A while ago, we looked at a fun project named [**“Hollywood”**][2] which turns the Terminal into a Hollywood technical melodrama hacker interface in Ubuntu-like systems. There are few other utilities available, for example **cowsay** , **fortune** , **sl** and **toilet** (!) etc., to kill your free time and keep you entertained! They may not be useful, but these utilities are really entertaining and fun to use. Today, I stumbled upon yet another similar utility named **“SUDO”**. As the name implies, whenever you type Linux commands in capital letters, the SUDO utility will run them as sudo user! Meaning, you need not to type “sudo” in-front of the Linux commands you about to run. Cool, yeah? - -### Install SUDO - -* * * - -**A word of caution:** - -Before installing this (or any utility), take a look at the source code (Link given at the end) and see if there are suspicious/malicious code included to harm your system. Test it in a VM. If you like or found it useful, you can use it in your personal/production systems. - -* * * - -Git clone the SUDO repository: - -``` -$ git clone https://github.com/jthistle/SUDO.git -``` - -This command will clone the contents of SUDO GIT repository and saves them in a directory named “SUDO” in your current working directory. - -``` -Cloning into 'SUDO'... -remote: Enumerating objects: 42, done. -remote: Counting objects: 100% (42/42), done. -remote: Compressing objects: 100% (29/29), done. -remote: Total 42 (delta 17), reused 30 (delta 12), pack-reused 0 -Unpacking objects: 100% (42/42), done. -``` - -Switch to SUDO directory: - -``` -$ cd SUDO/ -``` - -And, install it using command: - -``` -$ ./install.sh -``` - -The command will add the following entries in your **~/.bashrc** file: - -``` -[...] -# SUDO - shout at bash to su commands -# Distributed under GNU GPLv2, @jthistle on github - -shopt -s expand_aliases - -IFS_=${IFS} -IFS=":" read -ra PATHS <<< "$PATH" - -for i in "${PATHS[@]}"; do - for j in $( ls "$i" ); do - if [ ${j^^} != $j ] && [ $j != "sudo" ]; then - alias ${j^^}="sudo $j" - fi - done -done - -alias SUDO='sudo $(history -p !!)' - -IFS=${IFS_} - -# end SUDO -``` - -It will also take a backup of your **~/.bashrc** and save it as **~/.bashrc.old**. You can restore it if anything goes catastrophically wrong. - -Finally, update the changes using command: - -``` -$ source ~/.bashrc -``` - -### Now, type Linux Commands in Capital letters to run them as Sudo user - -Usually, we execute Linux commands that requires sudo/root privileges like below. - -``` -$ sudo mkdir /ostechnix -``` - -Right? Yes! The above command will create directory named “ostechnix” in root (/). Let us cancel this command using **Ctrl+c**. - -Once SUDO is installed, you can **type any Linux command in capital without sudo** and run them. So, you can run the above command like below: - -``` -$ MKDIR /ostechnix - -$ TOUCH /ostechnix/test.txt - -$ LS /ostechnix -``` - -![][3] - -Type Linux Commands In Capital Letters To Run Them As Sudo User - -Please note that **it will not bypass the sudo password**. You still need to type sudo password to execute the given command. It will only help to avoid typing “sudo” in-front of each command. - -* * * - -**Related read:** - - * [**How To Run Particular Commands Without Sudo Password In Linux**][4] - * [**How To Restore Sudo Privileges To A User**][5] - * [**How To Grant And Remove Sudo Privileges To Users On Ubuntu**][6] - * [**How To Find All Sudo Users In Your Linux System**][7] - * [**How To Display Asterisks When You Type Password In Terminal**][8] - * [**How To Change The Sudo Prompt In Linux**][9] - - - -* * * - -Of course, typing “sudo” will take only a few seconds, so it is not a big deal. I must tell this is just fun and USELESS project to pass time. If you don’t like it, go away and learn something useful. If you like it, give it a go and have fun! - -**Resource:** - - * [**SUDO GitHub Repository**][10] - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/type-linux-commands-in-capital-letters-to-run-them-as-sudo-user/ - -作者:[sk][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.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/sudo-720x340.png -[2]: https://www.ostechnix.com/turn-ubuntu-terminal-hollywood-technical-melodrama-hacker-interface/ -[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/SUDO-in-action.gif -[4]: https://www.ostechnix.com/run-particular-commands-without-sudo-password-linux/ -[5]: https://www.ostechnix.com/how-to-restore-sudo-privileges-to-a-user/ -[6]: https://www.ostechnix.com/how-to-grant-and-remove-sudo-privileges-to-users-on-ubuntu/ -[7]: https://www.ostechnix.com/find-sudo-users-linux-system/ -[8]: https://www.ostechnix.com/display-asterisks-type-password-terminal/ -[9]: https://www.ostechnix.com/change-sudo-prompt-linux-unix/ -[10]: https://github.com/jthistle/SUDO diff --git a/sources/tech/20190711 What is a golden image.md b/sources/tech/20190711 What is a golden image.md deleted file mode 100644 index 5bbb61e329..0000000000 --- a/sources/tech/20190711 What is a golden image.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is a golden image?) -[#]: via: (https://opensource.com/article/19/7/what-golden-image) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -What is a golden image? -====== -Working on projects that will be distributed widely? Learn more about -golden images so it's easy to revert to a "perfect" state if things go -wrong. -![Gold star][1] - -If you’re in quality assurance, system administration, or (believe it or not) media production, you might have heard some variation of the term _gold master_, _golden image_, or _master image_, and so on. It’s a term that has made its way into the collective consciousness of anyone involved in creating one _perfect_ model and then producing many duplicates from that mold. That’s what a gold master, or golden image, is: The virtual mold from which you cast your distributable models. - -In media production, the theory is that a crew works toward the gold master. This final product is one of a kind. It looks and sounds the best a movie or an album (or whatever it is) can possibly look and sound. Copies of this master image are made, compressed, and sent out to the eager public. - -In software, a similar idea is associated with the term. Once software has been compiled and tested and re-tested, the perfect build is declared _gold_. No further changes are allowed, and all distributable copies are generated from this master image (this used to actually mean something, back when software was distributed on CDs or DVDs). - -And in system administration, you may encounter golden images of an organization’s chosen operating system, with the important settings *baked in—*the virtual private network (VPN) certificates are already in place, incoming email servers are already set in the email client, and so on. Similarly, you might also hear this term in the world of virtual machines (VMs), where a _golden image_ of a carefully configured virtual drive is the source from which all new virtual machines are cloned. - -### GNOME Boxes - -The concept of a gold master is simple, but putting it into practice is often overlooked. Sometimes, your team is just so happy to have reached their goal that no one stops to think about designating the achievement as the authoritative version. At other times, there’s no simple mechanism for doing this. - -A golden image is equal parts historical preservation and a backup plan in advance. Once you craft a perfect model of whatever it is you were toiling over, you owe it to yourself to preserve that work, because it not only marks your progress, but it serves as a fallback should you stumble as you continue your work. - -[GNOME Boxes][2], the virtualization platform that ships with the GNOME desktop, can provide a simple demonstration. If you’ve never used GNOME Boxes, you can learn the basics from Alan Formy-Duval in his article [Getting started with GNOME Boxes][3]. - -Imagine that you used GNOME boxes to create a virtual machine, and then installed an operating system into that VM. Now, you want to make a golden image. GNOME Boxes is one step ahead of you: It has already taken a snapshot of your install, which can serve as the golden image for a stock OS installation. - -With GNOME Boxes open and in the dashboard view, right-click on any virtual machine and select **Properties**. In the **Properties** window, select the **Snapshots** tab. The first snapshot, created automatically by GNOME Boxes, is **Just Installed**. As its name suggests, this is the operating system as you originally installed it onto its virtual machine. - -![The Just Installed snapshot, or initial golden image, in GNOME Boxes.][4] - -Should your virtual machine reach a state that you did not intend, you can always revert to this **Just Installed** image. - -Of course, reverting back to the OS after it’s just been installed would be a drastic measure if you’ve already fine-tuned the environment for yourself. That’s why it’s a common workflow with virtual machines to first install the OS, then modify it to suit your requirements or preferences, and then take a snapshot, declaring that snapshot as your configured golden image. For instance, if you are using the virtual machine for [Flatpak][5] packaging, then after your initial install you might add software and Flatpak development tools, construct your working environment, and then take a snapshot. Once the snapshot is created, you can rename the virtual machine to indicate its true purpose in life. - -To rename a virtual machine, right-click on its thumbnail in the dashboard view, and select **Properties**. In the **Properties** window, enter a new name: - -![Renaming your VM image in GNOME Boxes.][6] - -To make a clone of your golden image, right-click on the virtual machine in the GNOME Boxes interfaces and select **Clone**. - -![Cloning your golden image in GNOME Boxes.][7] - -You now have a clone from your golden image’s latest snapshot. - -### Golden - -There are few disciplines that can’t benefit from golden images. Whether you’re tagging releases in [Git][8], taking snapshots in Boxes, pressing a prototype vinyl, printing a book for approval, designing a screen print for mass production, or fashioning a literal mold, the archetype is everything. It’s just one more way that modern technology lets us humans work smarter rather than harder, so make a golden image for your project, and generate clones as often as you need. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/what-golden-image - -作者:[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/origami_star_gold_best_top.jpg?itok=aEc0eutt (Gold star) -[2]: https://wiki.gnome.org/Apps/Boxes -[3]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization -[4]: https://opensource.com/sites/default/files/uploads/snapshots.jpg (The Just Installed snapshot, or initial golden image.) -[5]: https://opensource.com/business/16/8/flatpak -[6]: https://opensource.com/sites/default/files/uploads/boxes-rename_0.jpg (Renaming your virtual machine in GNOME Boxes.) -[7]: https://opensource.com/sites/default/files/uploads/boxes-clone.jpg (Cloning your golden image in GNOME Boxes.) -[8]: https://git-scm.com diff --git a/sources/tech/20190712 MTTR is dead, long live CIRT.md b/sources/tech/20190712 MTTR is dead, long live CIRT.md deleted file mode 100644 index 4ceca78067..0000000000 --- a/sources/tech/20190712 MTTR is dead, long live CIRT.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (MTTR is dead, long live CIRT) -[#]: via: (https://opensource.com/article/19/7/measure-operational-performance) -[#]: author: (Julie Gunderson https://opensource.com/users/juliegund/users/kearnsjd/users/ophir) - -MTTR is dead, long live CIRT -====== -By focusing on business-impacting incidents, CIRT is a more accurate way -to gauge ops performance. -![Green graph of measurements][1] - -The game is changing for the IT ops community, which means the rules of the past make less and less sense. Organizations need accurate, understandable, and actionable metrics in the right context to measure operations performance and drive critical business transformation. - -The more customers use modern tools and the more variation in the types of incidents they manage, the less sense it makes to smash all those different incidents into one bucket to compute an average resolution time that will represent ops performance, which is what IT has been doing for a long time. - -### History and metrics - -History shows that context is key when analyzing signals to prevent errors and misunderstandings. For example, during the 1980s, Sweden set up a system to analyze hydrophone signals to alert them to Russian submarines in local Sweden waters. The Swedes used an acoustic signature they thought represented a class of Russian submarines—but was actually [gas bubbles][2] released by herring when confronted by a potential predator. This misinterpretation of a metric increased tensions between the countries and almost resulted in a war. - -![Funny fish cartoon][3] - -Mean time to resolve (MTTR) is the main ops performance metric operations managers use to gain insight towards achieving their goals. It is an age-old measure based on systems reliability engineering. MTTR has been adopted across many industries, including manufacturing, facility maintenance, and, more recently, IT ops, where it represents the average time it takes to resolve incidents from the time they were created across a given period of time. - -MTTR is calculated by dividing the time it takes to resolve all incidents (from the time of incident creation to time of resolution) by the total number of incidents. - -![MTTR formula][4] - -MTTR is exactly what it says: It's the average across _**all**_ incidents. MTTR smears together both high- and low-urgency incidents. It also repetitively counts each separate, ungrouped incident and results in a biased resolve time. It includes manually resolved and auto-resolved incidents in the same context. It mashes together incidents that are tabled for days (or months) after creation or are even completely ignored. Finally, MTTR includes every little transient burst (incidents that are auto-closed in under 120 seconds), which are either noisy non-issues or quickly resolved by a machine. - -![Variability in incident types][5] - -MTTR takes all incidents, regardless of type, throws them into a single bucket, mashes them all together, and calculates an "average" resolution time across the entire set. This overly simplistic method results in a noisy, erroneous, and misleading indication of how operations is performing. - -### A new way of measuring performance - -Critical incident response time (CIRT) is a new, significantly more accurate method to evaluate operations performance. PagerDuty developed the concept of CIRT, but the methodology is freely available for anyone to use. - -CIRT focuses on the incidents that are most likely to impact business by culling noise from incoming signals using the following techniques: - - 1. Real business-impacting (or potentially impacting) incidents are very rarely low urgency, so rule out all low-urgency incidents. - 2. Real business-impacting incidents are very rarely (if ever) auto-resolved by monitoring tools without the need for human intervention, so rule out incidents that were not resolved by a human. - 3. Short, bursting, and transient incidents that are resolved within 120 seconds are highly unlikely to be real business-impacting incidents, so rule them out. - 4. Incidents that go unnoticed, tabled, or ignored (not acknowledged, not resolved) for a very long time are rarely business-impacting; rule them out. Note: This threshold can be a statistically derived number that is customer-specific (e.g., two standard deviations above the mean) to avoid using an arbitrary number. - 5. Individual, ungrouped incidents generated by separate alerts are not representative of the larger business-impacting incident. Therefore, simulate incident groupings with a very conservative threshold, e.g., two minutes, to calculate response time. - - - -What effect does applying these assumptions have on response times? In a nutshell, a very, very large effect! - -By focusing on ops performance during critical, business-impacting incidents, the resolve-time distribution narrows and shifts greatly to the left, because now it is dealing with similar types of incidents rather than all events. - -Because MTTR calculates a much longer, artificially skewed response time, it is a poor indicator of operations performance. CIRT, on the other hand, is an intentional measure focused on the incidents that matter most to business. - -An additional critical measure that is wise to use alongside CIRT is the percentage of responders who are acknowledging and resolving incidents. This is important, as it validates whether the CIRT (or MTTA/MTTR for that matter) is worth utilizing. For example, if an MTTR result is low, say 10 minutes, it sounds great, but if only 42% of your responders are resolving their incidents, then that number is suspect. - -In summary, CIRT and the percentage of responders who are acknowledging and resolving incidents form a valuable set of metrics that give you a much better idea of how operations is performing. Gauging performance is the first step to improving performance, so these new measures are key to achieving continuous cycles of measurable improvement for your organization. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/measure-operational-performance - -作者:[Julie Gunderson][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/juliegund/users/kearnsjd/users/ophir -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) -[2]: http://blogfishx.blogspot.com/2014/05/herring-fart-to-communicate.html -[3]: https://opensource.com/sites/default/files/uploads/fish.png (Funny fish cartoon) -[4]: https://opensource.com/sites/default/files/uploads/mttr.png (MTTR formula) -[5]: https://opensource.com/sites/default/files/uploads/incidents.png (Variability in incident types) diff --git a/sources/tech/20190713 ElectronMail - a Desktop Client for ProtonMail and Tutanota.md b/sources/tech/20190713 ElectronMail - a Desktop Client for ProtonMail and Tutanota.md deleted file mode 100644 index 0c8b0028b6..0000000000 --- a/sources/tech/20190713 ElectronMail - a Desktop Client for ProtonMail and Tutanota.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (ElectronMail – a Desktop Client for ProtonMail and Tutanota) -[#]: via: (https://itsfoss.com/electronmail/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -ElectronMail – a Desktop Client for ProtonMail and Tutanota -====== - -The majority of people on the internet have email accounts from big companies, such as Google, that do not respect your privacy. Thankfully, there are privacy conscience alternatives like [Tutanota][1] and [ProtonMail][2]. The problems is that not all of them have a desktop client. Today, we will look at a project that seeks to solve that problem for you. Let’s take a look at ElectronMail. - -‘Electron’-ic warning! - -The following app is built with Electron (the name is ElectronMail for a reason). If the use of Electron upsets you, please consider this a trigger warning. - -### ElectronMail: Desktop Client for Tutanota and ProtonMail - -![Electron Mail About][3] - -[ElectronMail][4] is simply put an email client for ProtonMail and Tutanota. It is built using three big technologies: [Electron][5], [TypeScript][6] and [Angular][7]. It includes the following features: - - * Multi accounts support per each email provider - * Encrypted local storage - * Available for Linux, Windows, macOS, and FreeBSD - * Native notifications - * System tray icon with a total number of unread messages - * Master password to protect account information - * Switchable view layouts - * Offline access to the emails - * Encrypted local storage for emails - * Batch emails export to EML files - * Full-text search - * Built-in/prepackaged web clients - * Configuring proxy per account - * Spell Checking - * Support for two-factor authentication for extra security - - - -Currently, ElectronMail only supports Tutanota and ProtonMail. I get the feeling that they will be adding more in the future. According to the [GitHub page][4]: “Multi email providers support. ProtonMail and Tutanota at the moment.” - -ElectronMail is licensed under the MIT license. - -#### How to install ElectronMail - -Currently, there are several options to install ElectronMail on Linux. for Arch and Arch-based distros, you can install it from the [Arch User Repository][8]. There is also a Snap available for ElectrionMail. To install it, just enter `sudo snap install electron-mail`. - -For all other Linux distros, you can [download][9] a `.deb` or `.rpm` file. - -![Electron Mail Inbox][10] - -You can also [download][9] an `.exe` installer for Windows or a `.dmg` file for macOS. There is even a file for FreeBSD. - -[][11] - -Suggested read  Zettlr - Markdown Editor for Writers and Researchers - -#### Removing ElectronMail - -If you install ElectronMail and decide that it is not for you, there are a couple steps that the [developer][12] recommends. **Be sure to follow these steps before you uninstall the application.** - -If you are using the “Keep Me Signed In” feature, click “Log out” on the menu. This will delete the locally stored master password. It is possible to delete the master password after uninstalling ElectronMail, but that would involve editing the system keychain. - -You will also need to delete the settings folder manually. You can find it by clicking “Open setting folder” after selecting the application’s icon in the system tray. - -![Electron Mail Setting][13] - -### My Thoughts on ElectronMail - -I don’t usually use email clients. In fact, I mostly depend on web clients. So, I don’t have much use for this application. - -That being said, ElectronMail has a nice feel to it and is easy to set up. It has a good number of features activated out of the box and the advanced features aren’t that hard to activate. - -The one question I have relates to search. According to the features list, ElectronMail supports full-text search. However, the free version of Tutanota only supports a limited search. I wonder how ElectronMail handles that. - -At the end of the day, ElectronMail is just an Electron wrapper for a couple of web-based emails. I would rather just have them open in my browser than dedicate separate system resources to running Electron. If you only [use Tutanota email, they have their own official Electron-based desktop client][14]. You may try that. - -My biggest issue is with security. This is an unofficial app for two very secure email apps. What if there is a way to capture your login info or read through your emails? Someone who is smarter than I would have to go through the source code to know for sure. That is always the issue with unofficial apps for a security project. - -[][14] - -Suggested read  Secure Email Service Tutanota Has a Desktop App Now - -Have you every used ElectronMail? Do you think it would be worthwhile to install ElectronMail? What is your favorite email client? Please let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][15]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/electronmail/ - -作者:[John Paul][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/tutanota-review/ -[2]: https://itsfoss.com/protonmail/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/electron-mail-about.jpg?resize=800%2C500&ssl=1 -[4]: https://github.com/vladimiry/ElectronMail -[5]: https://electronjs.org/ -[6]: http://www.typescriptlang.org/ -[7]: https://angular.io/ -[8]: https://aur.archlinux.org/packages/electronmail-bin -[9]: https://github.com/vladimiry/ElectronMail/releases -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/electron-mail-inbox.jpg?ssl=1 -[11]: https://itsfoss.com/zettlr-markdown-editor/ -[12]: https://github.com/vladimiry -[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/electron-mail-setting.jpg?ssl=1 -[14]: https://itsfoss.com/tutanota-desktop/ -[15]: http://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20190715 What is POSIX- Richard Stallman explains.md b/sources/tech/20190715 What is POSIX- Richard Stallman explains.md deleted file mode 100644 index b09db22275..0000000000 --- a/sources/tech/20190715 What is POSIX- Richard Stallman explains.md +++ /dev/null @@ -1,193 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (martin2011qi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is POSIX? Richard Stallman explains) -[#]: via: (https://opensource.com/article/19/7/what-posix-richard-stallman-explains) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -What is POSIX? Richard Stallman explains -====== -Discover what's behind the standards for operating system compatibility -from a pioneer of computer freedom. -![Scissors cutting open access to files][1] - -What is [POSIX][2], and why does it matter? It's a term you've likely seen in technical writing, but it often gets lost in a sea of techno-initialisms and jargon-that-ends-in-X. I emailed Dr. [Richard Stallman][3] (better known in hacker circles as RMS) to find out more about the term's origin and the concept behind it. - -Richard Stallman says "open" and "closed" are the wrong way to classify software. Stallman classifies programs as _freedom-respecting_ ("free" or "libre") and _freedom-trampling_ ("non-free" or "proprietary"). Open source discourse typically encourages certain practices for the sake of practical advantages, not as a moral imperative. - -The free software movement, which Stallman launched in 1984, says more than _advantages_ are at stake. Users of computers _deserve_ control of their computing, so programs denying users control are an injustice to be rejected and eliminated. For users to have control, the program must give them the [four essential freedoms][4]: - - * The freedom to run the program as you wish, for any purpose (freedom 0). - * The freedom to study how the program works and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this. - * The freedom to redistribute copies so you can help others (freedom 2). - * The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this. - - - -### About POSIX - -**Seth:** The POSIX standard is a document released by the [IEEE][5] that describes a "portable operating system." As long as developers write programs to match this description, they have produced a POSIX-compliant program. In the tech industry, we call this a "specification" or "spec" for short. That's mostly understandable, as far as tech jargon goes, but what makes an operating system "portable"? - -**RMS:** I think it was the _interface_ that was supposed to be portable (among systems), rather than any one _system_. Indeed, various systems that are different inside do support parts of the POSIX interface spec. - -**Seth:** So if two systems feature POSIX-compliant programs, then they can make assumptions about one another, enabling them to know how to "talk" to one another. I read that it was you who came up with the name "POSIX." How did you come up with the term, and how was it adopted by the IEEE? - -**RMS:** The IEEE had finished developing the spec but had no concise name for it. The title said something like "portable operating system interface," though I don't remember the exact words. The committee put on "IEEEIX" as the concise name. I did not think that was a good choice. It is ugly to pronounce—it would sound like a scream of terror, "Ayeee!"—so I expected people would instead call the spec "Unix." - -Since [GNU's Not Unix][6], and it was intended to replace Unix, I did not want people to call GNU a "Unix system." I, therefore, proposed a concise name that people might actually use. Having no particular inspiration, I generated a name the unclever way: I took the initials of "portable operating system" and added "ix." The IEEE adopted this eagerly. - -**Seth:** Does "operating system" in the POSIX acronym refer only to Unix and Unix-like systems such as GNU, or is the intent to encompass all operating systems? - -**RMS:** The term "operating system," in the abstract, covers systems that are not at all like Unix, not at all close to the POSIX spec. However, the spec is meant for systems that are a lot like Unix; only such systems will fit the POSIX spec. - -**Seth:** Are you involved in reviewing or updating the current POSIX standards? - -**RMS:** Not now. - -**Seth:** The GNU Autotools toolchain does a lot to make applications easier to port, at least in terms of when it comes time to build and install. Is Autotools an important part of building a portable infrastructure? - -**RMS:** Yes, because even among systems that follow POSIX, there are lots of little differences. The Autotools make it easier for a program to adapt to those differences. By the way, if anyone wants to help in the development of the Autotools, please email me. - -**Seth:** I imagine, way back when GNU was just starting to make people realize that a (not)Unix liberated from proprietary technology was possible, there must have been a void of clarity about how free software could possibly work together. - -**RMS:** I don't think there was any void or any uncertainty. I was simply going to follow the interfaces of BSD. - -**Seth:** Some GNU applications are POSIX-compliant, while others have GNU-specific features either not in the POSIX spec or lack features required by the spec. How important is POSIX compliance to GNU applications? - -**RMS:** Following a standard is important to the extent it serves users. We do not treat a standard as an authority, but rather as a guide that may be useful to follow. Thus, we talk about following standards rather than "complying" with them. See the section [Non-GNU Standards][7] in the GNU Coding Standards. - -We strive to be compatible with standards on most issues because, on most issues, that serves users best. But there are occasional exceptions. - -For instance, POSIX specifies that some utilities measure disk space in units of 512 bytes. I asked the committee to change this to 1K, but it refused, saying that a bureaucratic rule compelled the choice of 512. I don't recall much attempt to argue that users would be pleased with that decision. - -Since GNU's second priority, after users' freedom, is users' convenience, we made GNU programs measure disk space in blocks of 1K by default. - -However, to defend against potential attacks by competitors who might claim that this deviation made GNU "noncompliant," we implemented optional modes that follow POSIX and ISO C to ridiculous extremes. For POSIX, setting the environment variable POSIXLY_CORRECT makes programs specified by POSIX list disk space in terms of 512 bytes. If anyone knows of a case of an actual use of POSIXLY_CORRECT or its GCC counterpart **\--pedantic** that provides an actual benefit to some user, please tell me about it. - -**Seth:** Are POSIX-compliant free software projects easier to port to other Unix-like systems? - -**RMS:** I suppose so, but I decided in the 1980s not to spend my time on porting software to systems other than GNU. I focused on advancing the GNU system towards making it unnecessary to use any non-free software and left the porting of GNU programs to non-GNU-like systems to whoever wanted to run them on those systems. - -**Seth:** Is POSIX important to software freedom? - -**RMS:** At the fundamental level, it makes no difference. However, standardization by POSIX and ISO C surely made the GNU system easier to migrate to, and that helped us advance more quickly towards the goal of liberating users from non-free software. That was achieved in the early 1990s, when Linux was made free software and then filled the kernel-shaped gap in GNU. - -### GNU innovations adopted by POSIX - -I also asked Dr. Stallman whether any GNU-specific innovations or conventions had later become adopted as a POSIX standard. He couldn't recall specific examples, but kindly emailed several developers on my behalf. - -Developers Giacomo Catenazzi, James Youngman, Eric Blake, Arnold Robbins, and Joshua Judson Rosen all responded with memories of previous POSIX iterations as well as ones still in progress. POSIX is a "living" standard, so it's being updated and reviewed by industry professionals continuously, and many developers who work on GNU projects propose the inclusion of GNU features. - -For the sake of historical interest, here' are some popular GNU features that have made their way into POSIX. - -#### Make - -Some GNU **Make** features have been adopted into POSIX's definition of **make**. The relevant [specification][8] provides detailed attribution for features borrowed from existing implementations. - -#### Diff and patch - -Both the **[diff][9]** and **[patch][10]** commands have gotten **-u** and **-U** options added directly from GNU versions of those tools. - -#### C library - -Many features of the GNU C library, **glibc**, have been adopted in POSIX. Lineage is sometimes difficult to trace, but James Youngman wrote: - -> "I'm pretty sure there are a number of features of ISO C which were pioneered by GCC. For example, **_Noreturn** is new in C11, but GCC-1.35 had this feature (one used the **volatile** modifier on a function declaration). Also—though I'm not certain about this—GCC-1.35 supported Arrays of Variable Length which seem to be very similar to modern C's conformant arrays." - -Giacomo Catenazzi cites the Open Group's [**strftime** article][11], pointing to this attribution: "This is based on a feature in some versions of GNU libc's **strftime()**." - -Eric Blake notes that the **getline()** and various ***_l()** locale-based functions were definitely pioneered by GNU. - -Joshua Judson Rosen adds to this, saying he clearly remembers being impressed by the adoption of **getline** functions after witnessing strangely familiar GNU-like behavior from code meant for a different OS entirely. - -"Wait…that's GNU-specific… isn't it? Oh—not anymore, apparently." - -Rosen pointed me to the [**getline** man page][12], which says: - -> Both **getline()** and **getdelim()** were originally GNU extensions. They were standardized in POSIX.1-2008. - -Eric Blake sent me a list of other extensions that may be added in the next POSIX revision (codenamed Issue 8, currently due around 2021): - - * [ppoll][13] - * [pthread_cond_clockwait et al.][14] - * [posix_spawn_file_actions_addchdir][15] - * [getlocalename_1][16] - * [reallocarray][17] - - - -### Userspace extensions - -POSIX doesn't just define functions and features for developers. It defines standard behavior for userspace as well. - -#### ls - -The **-A** option is used to exclude the **.** (representing the current location) and **..** (representing the opportunity to go back one directory) notation from the results of an **ls** command. This was adopted for POSIX 2008. - -#### find - -The **find** command is a useful tool for ad hoc [**for** loops][18] and as a gateway into [parallel][19] processing. - -A few conveniences made their way from GNU to POSIX, including the **-path** and **-perm** options. - -The **-path** option lets you filter search results matching a filesystem path pattern and was available in GNU's version of **find** since before 1996 (the earliest record in **findutil**'s Git repository). James Youngman notes that [HP-UX][20] also had this option very early on, so whether it's a GNU or an HP-UX innovation (or both) is uncertain. - -The **-perm** option lets you filter search results by file permission. This was in GNU's version of **find** by 1996 and arrived later in the POSIX standard "IEEE Std 1003.1, 2004 Edition." - -The **xargs** command, part of the **findutils** package, had a **-p** option to put **xargs** into an interactive mode (the user is prompted whether to continue or not) by 1996, and it arrived in POSIX in "IEEE Std 1003.1, 2004 Edition." - -#### Awk - -Arnold Robbins, the maintainer of GNU **awk** (the **gawk** command in your **/usr/bin** directory, probably the destination of the symlink **awk**), says that **gawk** and **mawk** (another GPL **awk** implementation) allow **RS** to be a regular expression, which is the case when **RS** has a length greater than 1. This isn't a feature in POSIX yet, but there's an [indication that it will be][21]: - -> _The undefined behavior resulting from NULs in extended regular expressions allows future extensions for the GNU gawk program to process binary data._ -> -> _The unspecified behavior from using multi-character RS values is to allow possible future extensions based on extended regular expressions used for record separators. Historical implementations take the first character of the string and ignore the others._ - -This is a significant enhancement because the **RS** notation defines a separator between records. It might be a comma or a semicolon or a dash or any such character, but if it's a _sequence_ of characters, then only the first character is used unless you're working in **gawk** or **mawk**. Imagine parsing a document of IP addresses with records separated by an ellipsis (three dots in a row), only to get back results parsed at every dot in every IP address. - -**[Mawk][22]** supported the feature first, but it was without a maintainer for several years, leaving **gawk** to carry the torch. (**Mawk** has since gained a new maintainer, so arguably credit can be shared for pushing this feature into the collective expectation.) - -### The POSIX spec - -In general, Giacomo Catenzzi points out, "…because GNU utilities were used so much, a lot of other options and behaviors were aligned. At every change in shell, Bash is used as comparison (as a first-class citizen)." There's no requirement to cite GNU or any other influence when something is rolled into the POSIX spec, and it can safely be assumed that influences to POSIX come from many sources, with GNU being only one of many. - -The significance of POSIX is consensus. A group of technologists working together toward common specifications to be shared by hundreds of uncommon developers lends strength to the greater movement toward software independence and developer and user freedom. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/what-posix-richard-stallman-explains - -作者:[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/document_free_access_cut_security.png?itok=ocvCv8G2 (Scissors cutting open access to files) -[2]: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/ -[3]: https://stallman.org/ -[4]: https://www.gnu.org/philosophy/free-sw.en.html -[5]: https://www.ieee.org/ -[6]: http://gnu.org -[7]: https://www.gnu.org/prep/standards/html_node/Non_002dGNU-Standards.html -[8]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html -[9]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html -[10]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/patch.html -[11]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html -[12]: http://man7.org/linux/man-pages/man3/getline.3.html -[13]: http://austingroupbugs.net/view.php?id=1263 -[14]: http://austingroupbugs.net/view.php?id=1216 -[15]: http://austingroupbugs.net/view.php?id=1208 -[16]: http://austingroupbugs.net/view.php?id=1220 -[17]: http://austingroupbugs.net/view.php?id=1218 -[18]: https://opensource.com/article/19/6/how-write-loop-bash -[19]: https://opensource.com/article/18/5/gnu-parallel -[20]: https://www.hpe.com/us/en/servers/hp-ux.html -[21]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html -[22]: https://invisible-island.net/mawk/ diff --git a/sources/tech/20190716 Save and load Python data with JSON.md b/sources/tech/20190716 Save and load Python data with JSON.md deleted file mode 100644 index 6400ab0cac..0000000000 --- a/sources/tech/20190716 Save and load Python data with JSON.md +++ /dev/null @@ -1,134 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Save and load Python data with JSON) -[#]: via: (https://opensource.com/article/19/7/save-and-load-data-python-json) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Save and load Python data with JSON -====== -The JSON format saves you from creating your own data formats, and is -particularly easy to learn if you already know Python. Here's how to use -it with Python. -![Cloud and databsae incons][1] - -[JSON][2] stands for JavaScript Object Notation. This format is a popular method of storing data in key-value arrangements so it can be parsed easily later. Don’t let the name fool you, though: You can use JSON in Python—not just JavaScript—as an easy way to store data, and this article demonstrates how to get started. - -First, take a look at this simple JSON snippet: - - -``` -{ -        "name":"tux", -        "health":"23", -        "level":"4" -} -``` - -That's pure JSON and has not been altered for Python or any other language. Yet if you’re familiar with Python, you might notice that this example JSON code looks an awful lot like a Python dictionary. In fact, the two are very similar: If you are comfortable with Python lists and dictionaries, then JSON is a natural fit for you. - -### Storing data in JSON format - -You might consider using JSON if your application needs to store somewhat complex data. While you may have previously resorted to custom text configuration files or data formats, JSON offers you structured, recursive storage, and Python’s JSON module offers all of the parsing libraries necessary for getting this data in and out of your application. So, you don’t have to write parsing code yourself, and other programmers don’t have to decode a new data format when interacting with your application. For this reason, JSON is easy to use, and ubiquitous. - -Here is some sample Python code using a dictionary within a dictionary: - - -``` -#!/usr/bin/env python3 - -import json - -# instantiate an empty dict -team = {} - -# add a team member -team['tux'] = {'health': 23, 'level': 4} -team['beastie'] = {'health': 13, 'level': 6} -team['konqi'] = {'health': 18, 'level': 7} -``` - -This code creates a Python dictionary called **team**. It’s empty initially (you can create one that's already populated, but that’s impossible if you don’t have the data to put into the dictionary yet). - -To add to the **dict** object, you create a key, such as **tux**, **beastie**, or **konqi** in the example code, and then provide a value. In this case, the value is _another_ dictionary full of player statistics. - -Dictionaries are mutable. You can add, remove, and update the data they contain as often as you please. This format is ideal storage for data that your application frequently uses. - -### Saving data in JSON format  - -If the data you’re storing in your dictionary is user data that needs to persist after the application quits, then you must write the data to a file on disk. This is where the JSON Python module comes in: - - -``` -with open('mydata.json', 'w') as f: -    json.dump(team, f) -``` - -This code block creates a file called **mydata.json** and opens it in write mode. The file is represented with the variable **f** (a completely arbitrary designation; you can use whatever variable name you like, such as **file**, **FILE**, **output**, or practically anything). Meanwhile, the JSON module’s **dump** function is used to dump the data from the **dict** into the data file. - -Saving data from your application is as simple as that, and the best part about this is that the data is structured and predictable. To see, take a look at the resulting file: - - -``` -$ cat mydata.json -{"tux": {"health": 23, "level": 4}, "beastie": {"health": 13, "level": 6}, "konqi": {"health": 18, "level": 7}} -``` - -### Reading data from a JSON file - -If you are saving data to JSON format, you probably want to read the data back into Python eventually. To do this, use the Python JSON module’s **json.load** function: - - -``` -#!/usr/bin/env python3 - -import json - -f = open('mydata.json') -team = json.load(f) - -print(team['tux']) -print(team['tux']['health']) -print(team['tux']['level']) - -print(team['beastie']) -print(team['beastie']['health']) -print(team['beastie']['level']) - -# when finished, close the file -f.close() -``` - -This function implements the inverse, more or less, of saving the file: an arbitrary variable (**f**) represents the data file, and then the JSON module’s **load** function dumps the data from the file into the arbitrary **team** variable. - -The **print** statements in the code sample demonstrate how to use the data. It can be confusing to compound **dict** key upon **dict** key, but as long as you are familiar with your own dataset, or else can read the JSON source to get a mental map of it, the logic makes sense. - -Of course, the **print** statements don’t have to be hard-coded. You could rewrite the sample application using a **for** loop: - - -``` -for i in team.values(): -    print(i) -``` - -### Using JSON - -As you can see, JSON integrates surprisingly well with Python, so it’s a great format when your data fits in with its model. JSON is flexible and simple to use, and learning one basically means you’re learning the other, so consider it for data storage the next time you’re working on a Python application. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/save-and-load-data-python-json - -作者:[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/bus_cloud_database.png?itok=lhhU42fg (Cloud and databsae incons) -[2]: https://json.org diff --git a/sources/tech/20190717 Bond WiFi and Ethernet for easier networking mobility.md b/sources/tech/20190717 Bond WiFi and Ethernet for easier networking mobility.md deleted file mode 100644 index 4eeabbeeb6..0000000000 --- a/sources/tech/20190717 Bond WiFi and Ethernet for easier networking mobility.md +++ /dev/null @@ -1,126 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bond WiFi and Ethernet for easier networking mobility) -[#]: via: (https://fedoramagazine.org/bond-wifi-and-ethernet-for-easier-networking-mobility/) -[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) - -Bond WiFi and Ethernet for easier networking mobility -====== - -![][1] - -Sometimes one network interface isn’t enough. Network bonding allows multiple network connections to act together with a single logical interface. You might do this because you want more bandwidth than a single connection can handle. Or maybe you want to switch back and forth between your wired and wireless networks without losing your network connection. - -The latter applies to me. One of the benefits to working from home is that when the weather is nice, it’s enjoyable to work from a sunny deck instead of inside. But every time I did that, I lost my network connections. IRC, SSH, VPN — everything goes away, at least for a moment while some clients reconnect. This article describes how I set up network bonding on my Fedora 30 laptop to seamlessly move from the wired connection my laptop dock to a WiFi connection. - -In Linux, interface bonding is handled by the bonding kernel module. Fedora does not ship with this enabled by default, but it is included in the kernel-core package. This means that enabling interface bonding is only a command away: - -``` -sudo modprobe bonding -``` - -Note that this will only have effect until you reboot. To permanently enable interface bonding, create a file called _bonding.conf_ in the _/etc/modules-load.d_ directory that contains only the word “bonding”. - -Now that you have bonding enabled, it’s time to create the bonded interface. First, you must get the names of the interfaces you want to bond. To list the available interfaces, run: - -``` -sudo nmcli device status -``` - -You will see output that looks like this: - -``` -DEVICE TYPE STATE CONNECTION -enp12s0u1 ethernet connected Wired connection 1 -tun0 tun connected tun0 -virbr0 bridge connected virbr0 -wlp2s0 wifi disconnected -- -p2p-dev-wlp2s0 wifi-p2p disconnected -- -enp0s31f6 ethernet unavailable -- -lo loopback unmanaged -- -virbr0-nic tun unmanaged -- -``` - -In this case, there are two (wired) Ethernet interfaces available. _enp12s0u1_ is on a laptop docking station, and you can tell that it’s connected from the _STATE_ column. The other, _enp0s31f6_, is the built-in port in the laptop. There is also a WiFi connection called _wlp2s0_. _enp12s0u1_ and _wlp2s0_ are the two interfaces we’re interested in here. (Note that it’s not necessary for this exercise to understand how network devices are named, but if you’re interested you can see the [systemd.net-naming-scheme man page][2].) - -The first step is to create the bonded interface: - -``` -sudo nmcli connection add type bond ifname bond0 con-name bond0 -``` - -In this example, the bonded interface is named _bond0_. The “_con-name bond0_” sets the connection name to _bond0_; leaving this off would result in a connection named _bond-bond0_. You can also set the connection name to something more human-friendly, like “Docking station bond” or “Ben” - -The next step is to add the interfaces to the bonded interface: - -``` -sudo nmcli connection add type ethernet ifname enp12s0u1 master bond0 con-name bond-ethernet -sudo nmcli connection add type wifi ifname wlp2s0 master bond0 ssid Cotton con-name bond-wifi -``` - -As above, the connection name is specified to be [more descriptive][3]. Be sure to replace _enp12s0u1_ and _wlp2s0_ with the appropriate interface names on your system. For the WiFi interface, use your own network name (SSID) where I use “Cotton”. If your WiFi connection has a password (and of course it does!), you’ll need to add that to the configuration, too. The following assumes you’re using [WPA2-PSK][4] authentication - -``` -sudo nmcli connection modify bond-wifi wifi-sec.key-mgmt wpa-psk -sudo nmcli connection edit bond-wif -``` - -The second command will bring you into the interactive editor where you can enter your password without it being logged in your shell history. Enter the following, replacing _password_ with your actual password - -``` -set wifi-sec.psk password -save -quit -``` - -Now you’re ready to start your bonded interface and the secondary interfaces you created - -``` -sudo nmcli connection up bond0 -sudo nmcli connection up bond-ethernet -sudo nmcli connection up bond-wifi -``` - -You should now be able to disconnect your wired or wireless connections without losing your network connections. - -### A caveat: using other WiFi networks - -This configuration works well when moving around on the specified WiFi network, but when away from this network, the SSID used in the bond is not available. Theoretically, one could add an interface to the bond for every WiFi connection used, but that doesn’t seem reasonable. Instead, you can disable the bonded interface: - -``` -sudo nmcli connection down bond0 -``` - -When back on the defined WiFi network, simply start the bonded interface as above. - -### Fine-tuning your bond - -By default, the bonded interface uses the “load balancing (round-robin)” mode. This spreads the load equally across the interfaces. But if you have a wired and a wireless connection, you may want to prefer the wired connection. The “active-backup” mode enables this. You can specify the mode and primary interface when you are creating the interface, or afterward using this command (the bonded interface should be down): - -``` -sudo nmcli connection modify bond0 +bond.options "mode=active-backup,primary=enp12s0u1" -``` - -The [kernel documentation][5] has much more information about bonding options. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/bond-wifi-and-ethernet-for-easier-networking-mobility/ - -作者:[Ben Cotton][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/bcotton/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/networkingmobility-816x345.jpg -[2]: https://www.freedesktop.org/software/systemd/man/systemd.net-naming-scheme.html -[3]: https://en.wikipedia.org/wiki/Master/slave_(technology)#Terminology_concerns -[4]: https://en.wikipedia.org/wiki/Wi-Fi_Protected_Access#Target_users_(authentication_key_distribution) -[5]: https://www.kernel.org/doc/Documentation/networking/bonding.txt diff --git a/sources/tech/20190717 How to install Kibana on MacOS.md b/sources/tech/20190717 How to install Kibana on MacOS.md deleted file mode 100644 index cd930fcddc..0000000000 --- a/sources/tech/20190717 How to install Kibana on MacOS.md +++ /dev/null @@ -1,120 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install Kibana on MacOS) -[#]: via: (https://opensource.com/article/19/7/installing-kibana-macos) -[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) - -How to install Kibana on MacOS -====== -Once you have Elasticsearch installed, the Kibana plugin adds -visualization to this powerful search tool. -![Analytics: Charts and Graphs][1] - -In my previous post, I walked Mac users through the steps they’ll take to [install Elasticsearch][2], the world’s most popular enterprise search engine. (Here's a [separate article][3] for Linux users.) Its natural language processing power makes Elasticsearch excel at finding details within datasets. Once you’ve discovered the data you need, you can take it to the next level if you’ve installed [Kibana][4] as well. - -Kibana is an open source data visualization plugin for Elasticsearch. Once you’ve found data in Elasticsearch, Kibana helps you put it into line charts, [time series queries][5], geospatial maps, and more. This tool is ideal for data scientists who must present their research results, especially those working with open source data. - -### Installing Kibana - -You’ll need to install Kibana separately from Elasticsearch. Since I installed Elasticsearch 7.1.1, I’ll install Kibana 1.1. It’s important to match versions so Kibana runs against an Elasticsearch node of the same version. (Kibana runs on **node.js**.) - -Here are the steps I followed to install Kibana 7.1.1 for MacOS: - - 1. Make sure Elasticsearch is downloaded and running. See the previous article for instructions if needed. - - - -**Note**: At minimum, you’ll need to install Elasticsearch 1.4.4 or later before you can use Kibana. This is because you’ll need to give Kibana the URL for the Elasticsearch instance to connect to, along with the Elasticsearch indices you want to search. In general, it’s best to install the latest versions of both. - - 2. Click [here][6] to download Kibana. You’ll see the webpage below, which prompts you to download Kibana for Mac in the top right-hand corner of the **Downloads** section: - - - -![Download Kibana here.][7] - - 3. In your **Downloads** folder, open the **.tar** file to expand it. This action creates a folder with the same name (for example, **kibana-7.1.1-darwin-x86_64**). - 4. If you would prefer Kibana to live in another folder, move it now. - - - -Double-check that Elasticsearch is running, and if not, launch it before continuing. (See the previous article if you need instructions.)  - -### Opening the Kibana plugin - -With Elasticsearch running, you can now launch Kibana. The process is similar to launching Elasticsearch: - - 1. From your Mac’s **Downloads** folder (or the new folder if you moved Kibana), open the Kibana folder (i.e. **~Downloads/kibana-7.1.1-darwin-x86_64**). - 2. Open the **bin** subfolder to enter that one. - - - -![The Kibana bin folder.][8] - - 3. Run **kibana-plugin**. You may run into the same security warning that came up in the previous article: - - - -![Security warning][9] - -In general, if you get this warning, follow the instructions in that article to clear the warning and open Kibana. Note that if I try to open the plugin without Elasticsearch running in the terminal, I get this same security warning. To fix this, I open Elasticsearch and run it in the terminal as described in the previous article. Launching Elasticsearch with the GUI should open the terminal as well. - -Then, I right-clicked on **kibana-plugin** and selected **Open**. This solution worked for me, but you might need to try a few times. Several people in my Elasticsearch meetup had some trouble opening Kibana on their devices. - -### Changing Kibana’s host and port numbers - -Kibana’s default settings configure it to run on **localhost: 5601**. You’ll need to update the file (in the case of this example) **~Downloads/kibana-7.1.1-darwin-x86_64/config/kibana.yml** to change the host or port number before you run Kibana. - -![The Kibana config directory.][10] - -Here’s what the terminal looked like when my Elasticsearch meetup group configured Kibana so it would default to ****, which is the URL to use when querying your Elasticsearch instances: - -![Configuring Kibana's host and port connections.][11] - -### Running Kibana from the command line - -Once you’ve opened the plugin, you can run Kibana from the command line or from the GUI. Here’s what the terminal looked like once it connected to Elasticsearch: - -![Kibana running once it's connected to Elasticsearch.][12] - -Like Elasticsearch, Kibana runs in the foreground by default. You can stop it by pressing **Ctrl-C**. - -### Wrapping up - -Elasticsearch and Kibana are large packages that take up a fair amount of storage. With so many people downloading both packages at once, my fellow Elasticsearch meetup members and I had to wait an average of several minutes for both of them to download. This might have been due to poor WiFi and/or too many users at once, but keep this possibility in mind if the same thing happens to you. - -After that, I couldn’t upload the JSON file we were using due to low storage on my laptop. I was able to follow the instructor’s visualizations, but couldn’t use Kibana myself in real time. So, before you download Elasticsearch and Kibana, make sure there’s enough room (at least a few gigabytes) on your device to upload and search files with these tools. - -To learn more about Kibana, their user guide’s [Introduction][13] is ideal. (You can configure the guide based on which version of Kibana you’re using.) Their demo also shows you how to [build a dashboard in minutes][14] and then make your first deployment. - -Have fun! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/installing-kibana-macos - -作者:[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/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) -[2]: https://opensource.com/article/19/7/installing-elasticsearch-macos -[3]: https://opensource.com/article/19/7/installing-elasticsearch-and-kibana-linux -[4]: https://www.elastic.co/products/kibana -[5]: https://en.wikipedia.org/wiki/Time_series -[6]: https://www.elastic.co/downloads/kibana -[7]: https://opensource.com/sites/default/files/uploads/download_kibana.png (Download Kibana here.) -[8]: https://opensource.com/sites/default/files/uploads/kibana_bin_folder.png (The Kibana bin folder.) -[9]: https://opensource.com/sites/default/files/uploads/security_warning.png (Security warning) -[10]: https://opensource.com/sites/default/files/uploads/kibana_config_directory.png (The Kibana config directory.) -[11]: https://opensource.com/sites/default/files/uploads/kibana_host_port_config.png (Configuring Kibana's host and port connections.) -[12]: https://opensource.com/sites/default/files/uploads/kibana_running.png (Kibana running once it's connected to Elasticsearch.) -[13]: https://www.elastic.co/guide/en/kibana/7.2/introduction.html -[14]: https://www.elastic.co/webinars/getting-started-kibana?baymax=rtp&elektra=docs&storm=top-video&iesrc=ctr diff --git a/sources/tech/20190717 Mastering user groups on Linux.md b/sources/tech/20190717 Mastering user groups on Linux.md deleted file mode 100644 index 0778b93a4b..0000000000 --- a/sources/tech/20190717 Mastering user groups on Linux.md +++ /dev/null @@ -1,225 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Mastering user groups on Linux) -[#]: via: (https://www.networkworld.com/article/3409781/mastering-user-groups-on-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Mastering user groups on Linux -====== -Managing user groups on Linux systems is easy, but the commands can be more flexible than you might be aware. -![Scott 97006 \(CC BY 2.0\)][1] - -User groups play an important role on Linux systems. They provide an easy way for a select groups of users to share files with each other. They also allow sysadmins to more effectively manage user privileges, since they can assign privileges to groups rather than individual users. - -While a user group is generally created whenever a user account is added to a system, there’s still a lot to know about how they work and how to work with them. - -**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][2] ]** - -### One user, one group? - -Most user accounts on Linux systems are set up with the user and group names the same. The user "jdoe" will be set up with a group named "jdoe" and will be the only member of that newly created group. The user’s login name, user id, and group id will be added to the **/etc/passwd** and **/etc/group** files when the account is added, as shown in this example: - -``` -$ sudo useradd jdoe -$ grep jdoe /etc/passwd -jdoe:x:1066:1066:Jane Doe:/home/jdoe:/bin/sh -$ grep jdoe /etc/group -jdoe:x:1066: -``` - -The values in these files allow the system to translate between the text (jdoe) and numeric (1066) versions of the user id — jdoe is 1066 and 1066 is jdoe. - -The assigned UID (user id) and GID (group id) for each user are generally the same and configured sequentially. If Jane Doe in the above example were the most recently added user, the next new user would likely be assigned 1067 as their user and group IDs. - -### GID = UID? - -UIDs and GIDs can get of out sync. For example, if you add a group using the **groupadd** command without specifying a group id, your system will assign the next available group id (in this case, 1067). The next user to be added to the system would then get 1067 as a UID but 1068 as a GID. - -You can avoid this issue by specifying a smaller group id when you add a group rather than going with the default. In this command, we add a new group and provide a GID that is smaller than the range used for user accounts. - -``` -$ sudo groupadd -g 500 devops -``` - -If it works better for you, you can specify a shared group when you create accounts. For example, you might want to assign new development staff members to a devops group instead of putting each one in their own group. - -``` -$ sudo useradd -g staff bennyg -$ grep bennyg /etc/passwd -bennyg:x:1064:50::/home/bennyg:/bin/sh -``` - -### Primary and secondary groups - -There are actually two types of groups — primary and secondary. - -The **primary group** is the one that’s recorded in the **/etc/passwd** file, configured when an account is set up. When a user creates a file, it’s their primary group that is associated with it. - -``` -$ whoami -jdoe -$ grep jdoe /etc/passwd -jdoe:x:1066:1066:John Doe:/home/jdoe:/bin/bash - ^ - | - +-------- primary group -$ touch newfile -$ ls -l newfile --rw-rw-r-- 1 jdoe jdoe 0 Jul 16 15:22 newfile - ^ - | - +-------- primary group -``` - -**Secondary groups** are those that users might be added to once they already have accounts. Secondary group memberships show up in the /etc/group file. - -``` -$ grep devops /etc/group -devops:x:500:shs,jadep - ^ - | - +-------- secondary group for shs and jadep -``` - -The **/etc/group** file assigns names to user groups (e.g., 500 = devops) and records secondary group members. - -### Preferred convention - -The convention of having each user a member of their own group and optionally a member of any number of secondary groups allows users to more easily separate files that are personal from those they need to share with co-workers. When a user creates a file, members of the various user groups they belong to don't necessarily have access. A user will have to use the **chgrp** command to associate a file with a secondary group. - -### There’s no place like /home - -One important detail when adding a new account is that the **useradd** command does not necessarily add a home directory for a new user. If you want this step to be taken only some of the time, you can add **-m** (think of this as the “make home” option) with your useradd commands. - -``` -$ sudo useradd -m -g devops -c "John Doe" jdoe2 -``` - -The options in this command: - - * **-m** creates the home directory and populates it with start-up files - * **-g** specifies the group to assign the user to - * **-c** adds a descriptor for the account (usually the person’s name) - - - -If you want a home directory to be created _all_ of the time, you can change the default behavior by editing the **/etc/login.defs** file. Change or add a setting for the CREATE_HOME variable and set it to “yes”: - -``` -$ grep CREATE_HOME /etc/login.defs -CREATE_HOME yes -``` - -Another option is to set yourself up with an alias so that **useradd** always uses the -m option. - -``` -$ alias useradd=’useradd -m’ -``` - -Make sure you add the alias to your ~/.bashrc or similar start-up file to make it permanent. - -### Looking into /etc/login.defs - -Here’s a command to list all the setting in the /etc/login.defs file. The **grep** commands are hiding comments and blank lines. - -``` -$ cat /etc/login.defs | grep -v "^#" | grep -v "^$" -MAIL_DIR /var/mail -FAILLOG_ENAB yes -LOG_UNKFAIL_ENAB no -LOG_OK_LOGINS no -SYSLOG_SU_ENAB yes -SYSLOG_SG_ENAB yes -FTMP_FILE /var/log/btmp -SU_NAME su -HUSHLOGIN_FILE .hushlogin -ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games -TTYGROUP tty -TTYPERM 0600 -ERASECHAR 0177 -KILLCHAR 025 -UMASK 022 -PASS_MAX_DAYS 99999 -PASS_MIN_DAYS 0 -PASS_WARN_AGE 7 -UID_MIN 1000 -UID_MAX 60000 -GID_MIN 1000 -GID_MAX 60000 -LOGIN_RETRIES 5 -LOGIN_TIMEOUT 60 -CHFN_RESTRICT rwh -DEFAULT_HOME yes -CREATE_HOME yes <=== -USERGROUPS_ENAB yes -ENCRYPT_METHOD SHA512 -``` - -Notice the various settings in this file determine the range of user ids to be used along with password aging and other setting (e.g., umask). - -### How to display a user’s groups - -Users can be members of multiple groups for various reasons. Group membership gives a user access to group-owned files and directories, and sometimes this behavior is critical. To generate a list of the groups that some user belongs to, use the **groups** command. - -``` -$ groups jdoe -jdoe : jdoe adm admin cdrom sudo dip plugdev lpadmin staff sambashare -``` - -You can list your own groups by typing “groups” without an argument. - -### How to add users to groups - -If you want to add an existing user to another group, you can do that with a command like this: - -``` -$ sudo usermod -a -G devops jdoe -``` - -You can also add a user to multiple groups by specifying the groups in a comma-separated list: - -``` -$ sudo usermod -a -G devops,mgrs jdoe -``` - -The **-a** argument means “add” while **-G** lists the groups. - -You can remove a user from a group by editing the **/etc/group** file and removing the username from the list. The usermod command may also have an option for removing a member from a group. - -``` -fish:x:16:nemo,dory,shark - | - V -fish:x:16:nemo,dory -``` - -### Wrap-up - -Adding and managing user groups isn't particularly difficult, but consistency in how you configure accounts can make it easier in the long run. - -**[ Now see: [Must-know Linux Commands][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/3409781/mastering-user-groups-on-linux.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2019/07/carrots-100801917-large.jpg -[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua -[3]: https://www.networkworld.com/article/3391029/must-know-linux-commands.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190719 Buying a Linux-ready laptop.md b/sources/tech/20190719 Buying a Linux-ready laptop.md new file mode 100644 index 0000000000..f63f9276e4 --- /dev/null +++ b/sources/tech/20190719 Buying a Linux-ready laptop.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Buying a Linux-ready laptop) +[#]: via: (https://opensource.com/article/19/7/linux-laptop) +[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-eshttps://opensource.com/users/greg-phttps://opensource.com/users/chrisodhttps://opensource.com/users/victorhckhttps://opensource.com/users/hankghttps://opensource.com/users/noplanman) + +Buying a Linux-ready laptop +====== +Tuxedo makes it easy to buy an out-of-the-box "penguin-ready" laptop. +![Penguin with green background][1] + +Recently, I bought and started using a Tuxedo Book BC1507, a Linux laptop computer. Ten years ago, if someone had told me that, by the end of the decade, I could buy top-quality, "penguin-ready" laptops from companies such as [System76][2], [Slimbook][3], and [Tuxedo][4], I probably would have laughed. Well, now I'm laughing, but with joy! + +Going beyond designing computers for free/libre open source software (FLOSS), all three companies recently [announced][5] they are trying to eliminate proprietary BIOS software by switching to [Coreboot][6]. + +### Buying it + +Tuxedo Computers is a German company that builds Linux-ready laptops. In fact, if you want a different operating system, it costs more. + +Buying the computer was incredibly easy. Tuxedo offers many payment methods: not only credit cards but also PayPal and even bank transfers. Just fill out the bank transfer form on Tuxedo's web page, and the company will send you the bank coordinates. + +Tuxedo builds every computer on demand, and picking exactly what you want is as easy as selecting the basic model and exploring the drop-down menus to select different components. There is a lot of information on the page to guide you in the purchase. + +If you pick a different Linux distribution from the recommended one, Tuxedo does a "net install," so have a network cable ready to finish the installation, or you can burn your preferred image onto a USB key. I used a DVD with the openSUSE Leap 15.1 installer through an external DVD reader instead, but you get the idea. + +The model I chose accepts up to two disks: one SSD and the other either an SSD or a conventional hard drive. As I was already over budget, I decided to pick a conventional 1TB disk and increase the RAM to 16GB. The processor is an 8th Generation i5 with four cores. I selected a back-lit Spanish keyboard, a 1920×1080/96dpi screen, and an SD card reader—all in all, a great system. + +If you're fine with the default English or German keyboard, you can even ask for a penguin icon on the Meta key! I needed a Spanish keyboard, which doesn't offer this option. + +### Receiving and using it + +The perfectly packaged computer arrived in total safety to my door just six working days after the payment was registered. After unpacking the computer and unlocking the battery, I was ready to roll. + +![Tuxedo Book BC1507][7] + +The new toy on top of my (physical) desktop. + +The computer's design is really nice and feels solid. Even though the chassis on this model is not aluminum, it stays cool. The fan is really quiet, and the airflow goes to the back edge, not to the sides, as in many other laptops. The battery provides several hours of autonomy from an electrical outlet. An option in the BIOS called FlexiCharger stops charging the battery after it reaches a certain percentage, so you don't need to remove the battery when you work for a long time while plugged in. + +The keyboard is really comfortable and surprisingly quiet. Even the touchpad keys are quiet! Also, you can easily adjust the light intensity on the back-lit keyboard. + +Finally, it's easy to access every component in the laptop so the computer can be updated or repaired without problems. Tuxedo even sends spare screws! + +### Conclusion + +After a month of heavy use, I'm really happy with the system. I got exactly what I asked for, and everything works perfectly. + +Because they are usually high-end systems, Linux-included computers tend to be on the expensive side of the spectrum. If you compare the price of a Tuxedo or Slimbook computer with something with similar specifications from a more established brand, the prices are not that different. If you are after a powerful system to use with free software, don't hesitate to support these companies: What they offer is worth the price. + +Let's us know in the comments about your experience with Tuxedo and other "penguin-friendly" companies. + +* * * + +_This article is based on "[My new 'penguin ready' laptop: Tuxedo-Book-BC1507][8]," published on Ricardo's blog, [From Mind to Type][9]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/linux-laptop + +作者:[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-eshttps://opensource.com/users/greg-phttps://opensource.com/users/chrisodhttps://opensource.com/users/victorhckhttps://opensource.com/users/hankghttps://opensource.com/users/noplanman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://system76.com/ +[3]: https://slimbook.es/en/ +[4]: https://www.tuxedocomputers.com/ +[5]: https://www.tuxedocomputers.com/en/Infos/News/Tuxedo-Computers-stands-for-Free-Software-and-Security-.tuxedo +[6]: https://coreboot.org/ +[7]: https://opensource.com/sites/default/files/uploads/tuxedo-600_0.jpg (Tuxedo Book BC1507) +[8]: https://frommindtotype.wordpress.com/2019/06/17/my-new-penguin-ready-laptop-tuxedo-book-bc1507/ +[9]: https://frommindtotype.wordpress.com/ diff --git a/sources/tech/20190719 Modifying Windows local accounts with Fedora and chntpw.md b/sources/tech/20190719 Modifying Windows local accounts with Fedora and chntpw.md new file mode 100644 index 0000000000..10d779fe6b --- /dev/null +++ b/sources/tech/20190719 Modifying Windows local accounts with Fedora and chntpw.md @@ -0,0 +1,375 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Modifying Windows local accounts with Fedora and chntpw) +[#]: via: (https://fedoramagazine.org/modifying-windows-local-accounts-with-fedora-and-chntpw/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Modifying Windows local accounts with Fedora and chntpw +====== + +![][1] + +I recently encountered a problem at work where a client’s Windows 10 PC lost trust to the domain. The user is an executive and the hindrance of his computer can affect real-time mission-critical tasks. He gave me 30 minutes to resolve the issue while he attended a meeting. + +Needless to say, I’ve encountered this issue many times in my career. It’s an easy fix using the Windows 7/8/10 installation media to reset the Administrator password, remove the PC off the domain and rejoin it. Unfortunately it didn’t work this time. After 20 minutes of scouring the net and scanning through the Microsoft Docs with no success, I turned to my development machine running Fedora with hopes of finding a solution. + +With _dnf search_ I found a utility called **chntpw**: + +``` +$ dnf search windows | grep password +``` + +According to the summary, _chntpw_ will “change passwords in Windows SAM files.” + +Little did I know at the time there was more to this utility than explained in the summary. Hence, this article will go through the steps I used to successfully reset a Windows local user password using _chntpw_ and a Fedora Workstation Live boot USB. The article will also cover some of the features of _chntpw_ used for basic user administration. + +### Installation and setup + +If the PC can connect to the internet after booting the live media, install _chntpw_ from the official Fedora repository with: + +``` +$ sudo dnf install chntpw +``` + +If you’re unable to access the internet, no sweat! Fedora Workstation Live boot media has all the dependencies installed out-of-the-box, so all we need is the package. You can find the builds for your Fedora version from the [Fedora Project’s Koji][2] site. You can use another computer to download the utility and use a USB thumb drive, or other form of media to copy the package. + +First and foremost we need to create the Fedora Live USB stick. If you need instructions, the article on [How to make a Fedora USB stick][3] is a great reference. + +Once the key is created shut-down the Windows PC, insert the thumb drive if the USB key was created on another computer, and turn on the PC — be sure to boot from the USB drive. Once the live media boots, select “Try Fedora” and open the Terminal application. + +Also, we need to mount the Windows drive to access the files. Enter the following command to view all drive partitions with an NTFS filesystem: + +``` +$ sudo blkid | grep ntfs +``` + +Most hard drives are assigned to _/dev/sdaX_ where X is the partition number — virtual drives may be assigned to _/dev/vdX_, and some newer drives (like SSDs) use _/dev/nvmeX_. For this example the Windows C drive is assigned to _/dev/sda2_. To mount the drive enter: + +``` +$ sudo mount /dev/sda2 /mnt +``` + +Fedora Workstation contains the _ntfs-3g_ and _ntfsprogs_ packages out-of-the-box. If you’re using a spin that does not have NTFS working out of the box, you can install these two packages from the official Fedora repository with: + +``` +$ sudo dnf install ntfs-3g ntfsprogs +``` + +Once the drive is mounted, navigate to the location of the SAM file and verify that it’s there: + +``` +$ cd /mnt/Windows/System32/config +$ ls | grep SAM + SAM + SAM.LOG1 + SAM.LOG2 +``` + +### Clearing or resetting a password + +Now it’s time to get to work. The help flag **-h** provides everything we need to know about this utility and how to use it: + +``` +$ chntpw -h +chntpw: change password of a user in a Windows SAM file, +or invoke registry editor. Should handle both 32 and 64 bit windows and +all version from NT3.x to Win8.1 +chntpw [OPTIONS] [systemfile] [securityfile] [otherreghive] […] + -h This message + -u Username or RID (0x3e9 for example) to interactively edit + -l list all users in SAM file and exit + -i Interactive Menu system + -e Registry editor. Now with full write support! + -d Enter buffer debugger instead (hex editor), + -v Be a little more verbose (for debuging) + -L For scripts, write names of changed files to /tmp/changed + -N No allocation mode. Only same length overwrites possible (very safe mode) + -E No expand mode, do not expand hive file (safe mode) + +Usernames can be given as name or RID (in hex with 0x first) +See readme file on how to get to the registry files, and what they are. + Source/binary freely distributable under GPL v2 license. See README for details. + NOTE: This program is somewhat hackish! You are on your own! +``` + +Use the **-l** parameter to display a list of users it reads from the SAM file: + +``` +$ sudo chntpw -l SAM +chntpw version 1.00 140201, (c) Petter N Hagen +Hive name (from header): <\SystemRoot\System32\Config\SAM> +ROOT KEY at offset: 0x001020 * Subkey indexing type is: 686c +File size 65536 [10000] bytes, containing 7 pages (+ 1 headerpage) +Used for data: 346/37816 blocks/bytes, unused: 23/7016 blocks/bytes. + +| RID -|---------- Username ------------| Admin? |- Lock? --| +| 01f4 | Administrator | ADMIN | dis/lock | +| 01f7 | DefaultAccount | | dis/lock | +| 03e8 | defaultuser0 | | dis/lock | +| 01f5 | Guest | | dis/lock | +| 03ea | sysadm | ADMIN | | +| 01f8 | WDAGUtilityAccount | | dis/lock | +| 03e9 | WinUser | | | +``` + +Now that we have a list of Windows users we can edit the account. Use the **-u** parameter followed by the username and the name of the SAM file. For this example, edit the _sysadm_ account: + +``` +$ sudo chntpw -u sysadm SAM +chntpw version 1.00 140201, (c) Petter N Hagen +Hive name (from header): <\SystemRoot\System32\Config\SAM> +ROOT KEY at offset: 0x001020 * Subkey indexing type is: 686c +File size 65536 [10000] bytes, containing 7 pages (+ 1 headerpage) +Used for data: 346/37816 blocks/bytes, unused: 23/7016 blocks/bytes. + +================= USER EDIT ==================== + +RID : 1002 [03ea] +Username: sysadm +fullname: SysADM +comment : +homedir : + +00000220 = Administrators (which has 2 members) + +Account bits: 0x0010 = +[ ] Disabled | [ ] Homedir req. | [ ] Passwd not req. | +[ ] Temp. duplicate | [X] Normal account | [ ] NMS account | +[ ] Domain trust ac | [ ] Wks trust act. | [ ] Srv trust act | +[ ] Pwd don't expir | [ ] Auto lockout | [ ] (unknown 0x08) | +[ ] (unknown 0x10) | [ ] (unknown 0x20) | [ ] (unknown 0x40) | + +Failed login count: 0, while max tries is: 0 +Total login count: 0 + +- - - User Edit Menu: +1 - Clear (blank) user password +(2 - Unlock and enable user account) [seems unlocked already] +3 - Promote user (make user an administrator) +4 - Add user to a group +5 - Remove user from a group +q - Quit editing user, back to user select +Select: [q] > +``` + +To clear the password press **1** and ENTER. If successful you will see the following message: + +``` +... +Select: [q] > 1 +Password cleared! +================= USER EDIT ==================== + +RID : 1002 [03ea] +Username: sysadm +fullname: SysADM +comment : +homedir : + +00000220 = Administrators (which has 2 members) + +Account bits: 0x0010 = +[ ] Disabled | [ ] Homedir req. | [ ] Passwd not req. | +[ ] Temp. duplicate | [X] Normal account | [ ] NMS account | +[ ] Domain trust ac | [ ] Wks trust act. | [ ] Srv trust act | +[ ] Pwd don't expir | [ ] Auto lockout | [ ] (unknown 0x08) | +[ ] (unknown 0x10) | [ ] (unknown 0x20) | [ ] (unknown 0x40) | + +Failed login count: 0, while max tries is: 0 +Total login count: 0 +** No NT MD4 hash found. This user probably has a BLANK password! +** No LANMAN hash found either. Try login with no password! +... +``` + +Verify the change by repeating: + +``` +$ sudo chntpw -l SAM +chntpw version 1.00 140201, (c) Petter N Hagen +Hive name (from header): <\SystemRoot\System32\Config\SAM> +ROOT KEY at offset: 0x001020 * Subkey indexing type is: 686c +File size 65536 [10000] bytes, containing 7 pages (+ 1 headerpage) +Used for data: 346/37816 blocks/bytes, unused: 23/7016 blocks/bytes. + +| RID -|---------- Username ------------| Admin? |- Lock? --| +| 01f4 | Administrator | ADMIN | dis/lock | +| 01f7 | DefaultAccount | | dis/lock | +| 03e8 | defaultuser0 | | dis/lock | +| 01f5 | Guest | | dis/lock | +| 03ea | sysadm | ADMIN | *BLANK* | +| 01f8 | WDAGUtilityAccount | | dis/lock | +| 03e9 | WinUser | | | + +... +``` + +The “Lock?” column now shows _BLANK_ for the sysadm user. Type **q** to exit and **y** to write the changes to the SAM file. Reboot the machine into Windows and login using the account (in this case _sysadm_) without a password. + +### Features + +Furthermore, _chntpw_ can perform basic Windows user administrative tasks. It has the ability to promote the user to the administrators group, unlock accounts, view and modify group memberships, and edit the registry. + +#### The interactive menu + +_chntpw_ has an easy-to-use interactive menu to guide you through the process. Use the **-i** parameter to launch the interactive menu: + +``` +$ chntpw -i SAM +chntpw version 1.00 140201, (c) Petter N Hagen +Hive name (from header): <\SystemRoot\System32\Config\SAM> +ROOT KEY at offset: 0x001020 * Subkey indexing type is: 686c +File size 65536 [10000] bytes, containing 7 pages (+ 1 headerpage) +Used for data: 346/37816 blocks/bytes, unused: 23/7016 blocks/bytes. + +<>========<> chntpw Main Interactive Menu <>========<> +Loaded hives: + 1 - Edit user data and passwords + 2 - List groups + - - - + 9 - Registry editor, now with full write support! + q - Quit (you will be asked if there is something to save) +``` + +#### Groups and account membership + +To display a list of groups and view its members, select option **2** from the interactive menu: + +``` +... +What to do? [1] -> 2 +Also list group members? [n] y +=== Group # 220 : Administrators + 0 | 01f4 | Administrator | + 1 | 03ea | sysadm | +=== Group # 221 : Users + 0 | 0004 | NT AUTHORITY\INTERACTIVE | + 1 | 000b | NT AUTHORITY\Authenticated Users | + 2 | 03e8 | defaultuser0 | + 3 | 03e9 | WinUser | +=== Group # 222 : Guests + 0 | 01f5 | Guest | +=== Group # 223 : Power Users +... +=== Group # 247 : Device Owners +``` + +#### Adding the user to the administrators group + +To elevate the user with administrative privileges press **1** to edit the account, then **3** to promote the user: + +``` +... +Select: [q] > 3 + +=== PROMOTE USER +Will add the user to the administrator group (0x220) +and to the users group (0x221). That should usually be +what is needed to log in and get administrator rights. +Also, remove the user from the guest group (0x222), since +it may forbid logins. + +(To add or remove user from other groups, please other menu selections) + +Note: You may get some errors if the user is already member of some +of these groups, but that is no problem. + +Do it? (y/n) [n] : y + +Adding to 0x220 (Administrators) … +sam_put_user_grpids: success exit +Adding to 0x221 (Users) … +sam_put_user_grpids: success exit +Removing from 0x222 (Guests) … +remove_user_from_grp: NOTE: group not in users list of groups, may mean user not member at all. Safe. Continuing. +remove_user_from_grp: NOTE: user not in groups list of users, may mean user was not member at all. Does not matter, continuing. +sam_put_user_grpids: success exit + +Promotion DONE! +``` + +#### Editing the Windows registry + +Certainly the most noteworthy, as well as the most powerful, feature of chntpw is the ability to edit the registry and write to it. Select **9** from the interactive menu: + +``` +... +What to do? [1] -> 9 +Simple registry editor. ? for help. + +> ? + Simple registry editor: + hive [] - list loaded hives or switch to hive number + cd - change current key + ls | dir [] - show subkeys & values, + cat | type - show key value + dpi - show decoded DigitalProductId value + hex - hexdump of value data + ck [] - Show keys class data, if it has any + nk - add key + dk - delete key (must be empty) + ed - Edit value + nv - Add value + dv - Delete value + delallv - Delete all values in current key + rdel - Recursively delete key & subkeys + ek - export key to (Windows .reg file format) + debug - enter buffer hexeditor + st [] - debug function: show struct info + q - quit +``` + +#### Finding help + +As we saw earlier, the **-h** parameter allows us to quickly access a reference guide to the options available with chntpw. The man page contains detailed information and can be accessed with: + +``` +$ man chntpw +``` + +Also, if you’re interested in a more hands-on approach, spin up a virtual machine. [Windows Server 2019][4] has an evaluation period of 180 days, and [Windows Hyper-V Server 2019][5] is unlimited. Creating a Windows guest VM will provide the basics to modify the Administrator account for testing and learning. For help with quickly creating a guest VM refer to the article [Getting started with virtualization in Gnome Boxes][6]. + +### Conclusion + +_chntpw_ is a hidden gem for Linux administrators and IT professionals alike. While a nifty tool to quickly reset Windows account passwords, it can also be used to troubleshoot and modify local Windows accounts with a no-nonsense feel that delivers. This is perhaps only one such tool for solving the problem, though. If you’ve experienced this issue and have an alternative solution, feel free to put it in the comments below. + +This tool, like many other “hacking” tools, holds with it an ethical responsibility. Even chntpw states: + +> NOTE: This program is somewhat hackish! You are on your own! + +When using such programs, we should remember the three edicts outlined in the message displayed when running **sudo** for the first time: + + 1. Respect the privacy of others. + 2. Think before you type. + 3. With great power comes great responsibility. + + + +* * * + +_Photo by _[_Silas Köhler_][7]_ on _[_Unsplash_][8]_,_ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/modifying-windows-local-accounts-with-fedora-and-chntpw/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/chntpw-816x345.jpg +[2]: https://koji.fedoraproject.org/koji/packageinfo?packageID=6945 +[3]: https://fedoramagazine.org/make-fedora-usb-stick/ +[4]: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2019 +[5]: https://www.microsoft.com/en-us/evalcenter/evaluate-hyper-v-server-2019 +[6]: https://fedoramagazine.org/getting-started-with-virtualization-in-gnome-boxes/ +[7]: https://unsplash.com/@silas_crioco?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[8]: https://unsplash.com/search/photos/key-lock?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20190722 10 resources every sysadmin should know about.md b/sources/tech/20190722 10 resources every sysadmin should know about.md new file mode 100644 index 0000000000..d61feedcd4 --- /dev/null +++ b/sources/tech/20190722 10 resources every sysadmin should know about.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 resources every sysadmin should know about) +[#]: via: (https://opensource.com/article/19/7/resources-sysadmin) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/erezhttps://opensource.com/users/sethhttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/alanfdoss) + +10 resources every sysadmin should know about +====== +Work smarter, not harder with these 10 resources that make a sysadmin +look superhuman. +![Person on top of a mountain, arm raise][1] + +Everybody knows that sysadmins are impossibly busy people. Consequently, it sometimes seems they are superhuman. The sysadmin's dirty secret, the same one shared by many open source users, is that they don't actually _do_ all of the work it looks like they've done. One of the greatest tools in the sysadmin's kit is their ability to reuse work someone else has already done for them. + +A good sysadmin knows where to turn when there's a big job to be done but nobody available to do it. If you're looking to work smarter, not harder, this is for you: a list of the top 10 resources every sysadmin should know about. + +### Turnkey Linux + +![Turnkey Linux][2] + +The [Turnkey Linux][3] project is the app store of systems administration. Turnkey takes popular open source components of infrastructure, installs them on a virtual server, creates an image of the install, and offers them to the world as free downloads. In the days before [containers][4], Turnkey mostly targeted virtualization engines, but with the advent of the cloud, the project also offers cloud "apps." + +Whether you use a cloud version or virtual machines, installing infrastructure has never been easier. No matter what a department requests, you can satisfy and close the ticket by simply spinning up a virtual server and dropping Turnkey Linux into it or installing the app on Turnkey's cloud platform. Turnkey provides OVA, ISO, VMDK, QCow2, Xen, and Docker images, so no matter what your infrastructure is based on, you can use Turnkey. + +The most exciting thing about Turnkey (aside from how easy it makes to spin up infrastructure) is that it also serves as a working example for new sysadmins. If you've never configured an NFS server, you can run a Turnkey solution to witness a working instance and use it as context for your research on how to make it happen the next time. + +If you haven't tried a Turnkey image yet, do yourself a favor and download one for evaluation. + +An easy demonstration is the [file sharing][5] package. You can download the image as an ISO and install it into a virtual machine such as [GNOME Boxes][6]. Start the image and run it as a live demo. + +![Turnkey Linux][7] + +Once the Turnkey server starts, it prompts you to create an administrative password. You can skip the other options until you see a list of IP addresses and ports. You can use whatever protocol best suits your OS, using **root** as the username with the administrative password you created after boot. + +### Subnet calculator + +If you're a new sysadmin, you might be struggling with the concept of subnets, or the limits placed on routers to direct traffic within a network. Subnets can be confusing, and calculating subnets and masks and the resulting blocks of addresses can be hard. Even for the experienced sysadmin used to configuring routers and who can calculate subnets in their head, it never hurts to double-check the math. + +There are many subnet calculators online, but if you're in a text-only SSH session, that's not always convenient. That's where [SubNetCalc][8]** **comes in. + +The **subnetcalc** command, available from your distribution's repositories, is an IPv4 and IPv6 subnet calculator for your terminal. The basic command is simple: provide it with the IP address you want to provision along with an estimated bit mask using CIDR notation, and **subnetcalc** displays the ramifications: + + +``` +$ subnetcalc  192.168.6.0/24 +Address       = 192.168.6.0 +   11000000.10101000.00000110.00000000 +Network       = 192.168.6.0 / 24 +Netmask       = 255.255.255.0 +Broadcast     = 192.168.6.255 +Wildcard Mask = 0.0.0.255 +Hosts Bits    = 8 +Max. Hosts    = 254   (2^8 - 2) +Host Range    = { 192.168.6.1 - 192.168.6.254 } +Properties    = +   - 192.168.6.0 is a NETWORK address +   - Class C +   - Private +``` + +It also understands IPv6: + + +``` +Address       = fe80::f811:e76e:7218:ff46 +                   fe80 = 11111110 10000000 +                   0000 = 00000000 00000000 +                   0000 = 00000000 00000000 +                   0000 = 00000000 00000000 +                   f811 = 11101000 00011001 +                   e76e = 11100101 01011110 +                   7328 = 01110011 00011000 +                   ff46 = 11111111 01010110 +Network       = fe80:: / 64 +Netmask       = ffff:ffff:ffff:ffff:: +Wildcard Mask = ::ffff:ffff:ffff:ffff +Hosts Bits    = 64 +Max. Hosts    = 18446744073709551615   (2^64 - 1) +Host Range    = { fe80::1 - fe80::ffff:ffff:ffff:ffff } +Properties    = +   - fe80::f811:e74e:7318:ff56 is a HOST address in fe80::/64 +   - Link-Local Unicast Properties: +      + Interface ID = f811:e74e:7318:ff56 +      + Sol. Node MC = ff02::1:ff18:ff56 +``` + +### Crontab Guru + +The Unix [cron][9] subsystem is a timer that runs commands at a specific time on a specific day. It's one of the many ways a sysadmin ensures that important tasks, like backups, reminder emails, and log rotations, happen automatically. Crontabs, the configuration files that control **cron**, were once an arcane sequence of numbers, slashes, and asterisks that somehow translated to a representation of time. + +The good news is they've gotten a lot easier to use, with syntax like **@daily** and **@weekly** instead of **0 0 * * */1** or **0 0 * * 7**, respectively. Even better are online crontab composers like [Crontab Guru][10]. + +![Crontab guru][11] + +This website serves one purpose: to de-mystify crontab scheduling. With its simple interface, you can compose what you believe is your desired schedule in cron syntax and get the results back in plain English. No more struggling to remember mnemonics for the order of minute, hour, date, month, weekday (mine was "Mini Horrific Devils Maraud the Weary"). No more giving up and resorting to the comparatively imprecise **@daily**-style shorthand. And most importantly, no more feeling sure that you got the syntax right only to discover later that your cron job isn't set to run until the year 2112. With a good crontab interpreter, you can enter your best guess and get instant feedback. + +### A rescue and testing thumb drive + +![Kali Linux][12] + +Be honest with yourself: the reason you got into the sysadmin racket in the first place was because you like to play with computers. Take your love of digital exploration and put it to good use with occasional pen-test challenges. No matter how careful you've been while setting up your infrastructure, you probably overlooked something, whether it's a configuration that's not as strict as it ought to be or a bug you couldn't have possibly known about. And sometimes it's not you, but shadow IT on your network that exposes a vulnerability. Regardless of the cause, it's your job to find weaknesses, and Kali Linux is the most hyper-focused pen-testing distribution available. + +You can [download Kali][13] and install it on a spare machine, a virtual machine, a thumb drive, and even your mobile phone with [NetHunter][14]. + +Start learning some of its [tools][15], like Metasploit, Wifiphisher, and Wireshark. Kali has excellent training resources available, and there's nothing quite as fun and nerve-racking as trying to break into a network of your own design. + +### Samba + +![File sharing with Samba][16] + +No matter your intentions as a sysadmin using open source, you're going to encounter a mixed environment of platforms that need to share files. Not everyone on your network is going to agree to just SSH copies of files to one another or to work in plain text so they can commit to [Git][17]. In fact, if you don't provide an easy method for users to share information, your users will find a way to do it anyway, and their solution will involve putting company data on whatever free service they encounter online. + +When sysadmins need a universal platform for file sharing, they invariably turn to [Samba][18], which humbly bills itself as the standard Windows interoperability suite of programs for Linux and Unix. In fact, Samba is much more than that, partly because of the scope of Active Directory and partly because of the business world's acceptance of Microsoft technology. For instance, there's no need to run separate file share interfaces for the different operating systems on your network, because nearly everything on your network is compatible with SMB/CIFS. + +### Cockpit web console + +![Cockpit web console][19] + +For people unfamiliar with the Linux terminal, it can be difficult to visualize what a server is, much less what it does. That can make it difficult for interns or transitioning Windows admins to help administer Linux servers, and it can make it difficult to justify hardware purchases to management. + +Fedora, RHEL, and CentOS ship with the [Cockpit][20] web console, and it's easy to install on Debian, Ubuntu, and many others. + +Cockpit lets you monitor and modify properties of servers that otherwise would require SSH access and familiarity with Linux commands. Not only is it open source, but it has a rich API and is easy to extend, so if you need your web console to do more than what Cockpit provides, you can develop your own interfaces to common tasks. + +The [server edition of Fedora][21] enables the web console by default, so if you haven't tried Cockpit, you can see it in action with just one install. If you're already running Ubuntu or Debian and want to see Cockpit in action, you can install it with: + + +``` +`$ sudo apt-get install cockpit` +``` + +### Hex keys and Screwdrivers + +There are some things web consoles and terminals just can't fix. Sometimes, you have to go to the source of the problem, and if the source turns out to be bare metal, then every sysadmin will happily tell you that hex keys and screwdrivers are an absolute must. + +![Multi-tool carabiner][22] + +Any given sysadmin may have their allegiances, but I never go to work without my Leatherman and a few common hex keys. There are also some pretty handy keyrings out there with screwdrivers and other tools built-in, so if you're looking for a gift for your friendly local sysadmin, you can't go wrong with a multi-tool carabiner. + +### Telnet and OpenSSL + +Those who experienced the old-school internet may remember Telnet as a clunky, unwieldy, but effective interface for public Unix servers for big institutions. The New York Public Library used to make its card catalog available for online searches over Telnet, and many an online [MUD][23] (multi-user dungeon) was accessed over this ancient protocol. Most people call Telnet a dead protocol and a dangerous command because it lacks encryption, and while its use is limited, it's still a great command for probing ports. + +As the world moves slowly toward encryption-by-default, though, alternatives arise. Things you used to use Telnet for can be done better with new tools. For instance, the old way of testing an email server was with the **telnet** command, but in many cases OpenSSL can be used instead: + + +``` +$ openssl s_client -starttls smtp -connect email.example.com:587 +> ehlo example.com +> auth login +(the user as a base64 string) +(the pass as a base64 string) +> mail from: [noreply@example.com][24] +> rcpt to: [foo@example.com][25] +> data +> Subject: foo bar +Baz Quux Blah. +. +> quit +``` + +It's a classic email server test done over an encrypted line. + +Whether you use Telnet or OpenSSL to probe and test servers, it's important to remember that low-level commands are vital even in the days of fancy frontends. + +### Cheat + +Having a hard time remembering a command? Normally you might resort to a man page, but some man pages have a hard time getting to the point. It's the reason Chris Allen Lane came up with the idea (and more importantly, the code) for a [**cheat** command][26]. + +The **cheat** command displays cheatsheets for common tasks in your terminal. It's a man page without the preamble. It cuts to the chase and tells you exactly how to do whatever it is you're trying to do. And if it lacks a common example that you think ought to be included, you can submit an update. + + +``` +$ cheat tar +# To extract an uncompressed archive: +tar -xvf '/path/to/foo.tar' + +# To extract a .gz archive: +tar -xzvf '/path/to/foo.tgz' +[...] +``` + +You can also treat **cheat** as a local cheatsheet system, which is great for all the in-house commands you and your team have invented over the years. You can easily add a local cheatsheet to your own home directory, and **cheat** will find and display it just as if it were a popular system command. + +### Emacs + +At the end of the day, there's nothing better than sitting back with a fresh [Emacs][27] session and typing that magical key combo: **M-x tetris**. Yes, the popular multi-tool text editor is not just the sysadmin's most worthy tool during work hours; it's the best way to relax. + +![Tetris in Emacs][28] + +Turn off the pager, close [Mutt][29], and enjoy. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/resources-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/erezhttps://opensource.com/users/sethhttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/developer_mountain_cloud_top_strong_win.jpg?itok=axK3EX-q (Person on top of a mountain, arm raise) +[2]: https://opensource.com/sites/default/files/uploads/turnkey-linux.jpg (Turnkey Linux) +[3]: https://www.turnkeylinux.org/ +[4]: https://opensource.com/resources/what-are-linux-containers +[5]: https://www.turnkeylinux.org/fileserver +[6]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[7]: https://opensource.com/sites/default/files/uploads/turnkey.jpg (Turnkey Linux) +[8]: https://www.uni-due.de/~be0001/subnetcalc/ +[9]: https://opensource.com/article/17/11/how-use-cron-linux +[10]: http://crontab.guru +[11]: https://opensource.com/sites/default/files/uploads/crontab-guru.jpg (Crontab guru) +[12]: https://opensource.com/sites/default/files/uploads/kali.jpg (Kali Linux) +[13]: https://www.kali.org/ +[14]: https://www.kali.org/kali-linux-nethunter/ +[15]: https://tools.kali.org/ +[16]: https://opensource.com/sites/default/files/uploads/samba.jpg (File sharing with Samba) +[17]: https://opensource.com/article/19/4/file-sharing-git +[18]: https://www.samba.org +[19]: https://opensource.com/sites/default/files/uploads/cockpit.jpg (Cockpit web console) +[20]: https://cockpit-project.org/ +[21]: https://getfedora.org/en/server/ +[22]: https://opensource.com/sites/default/files/uploads/multitool.jpg (Multi-tool carabiner) +[23]: https://mudlistings.com/ +[24]: mailto:noreply@example.com +[25]: mailto:foo@example.com +[26]: https://github.com/cheat/cheat +[27]: https://opensource.com/life/16/2/intro-to-emacs +[28]: https://opensource.com/sites/default/files/uploads/tetris.jpg (Tetris in Emacs) +[29]: http://www.mutt.org/ diff --git a/sources/tech/20190722 Gift ideas for Sysadmin Appreciation Day.md b/sources/tech/20190722 Gift ideas for Sysadmin Appreciation Day.md new file mode 100644 index 0000000000..7109378d61 --- /dev/null +++ b/sources/tech/20190722 Gift ideas for Sysadmin Appreciation Day.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Gift ideas for Sysadmin Appreciation Day) +[#]: via: (https://opensource.com/article/19/7/gift-ideas-sysadmin-appreciation-day) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/jamesf) + +Gift ideas for Sysadmin Appreciation Day +====== +What was the best gift you received as a sysadmin? Take our poll and +check out some gift ideas for Sysadmin Appreciation Day. +![Gift box opens with colors coming out][1] + +Sysadmin Appreciation Day is coming up this Friday, July 26. To help honor sysadmins everywhere, we want you to share your best gift ideas. What would be the best way a team member or customer could show their appreciation for you? As a sysadmin, what was the best gift you've ever received? We asked our writers the same question, and here are their answers: + +"Whilst working in the Ubuntu community on Edubuntu, I took it upon myself to develop the startup/shutdown sound scheme, which became the default in Ubuntu for, from what I can understand, the next decade. Whilst people had a love-hate relationship with my sound scheme, and rightly so, I had a love-hate relationship with my sound card during the development. + +At the time I had recorded all my sound samples using one sample rate, but my new sound card, as my motherboard had exploded a few days earlier, did not support it. I had two choices, resample all my samples (which I didn't really want to do) or buy a new sound card. + +After discussing my displeasure at the choices I faced in one of the Ubuntu channels, a very kind member of the community told me they would be happy to purchase a sound card for me, in thanks for all the work I had done on the sound scheme. However, I was not prepared for what showed up. + +I had expected a run-of-the-mill, entry-level sound card that would get me through the difficulties. I received an M-audio Delta 1010, a truly amazing beast of a sound card which I joyfully used for many years after. Hands down the BEST gift I've received in appreciation of my Open Source efforts ever!" ⁠—Pete Savage + +"Best gift: time off." ⁠—Chris Short + +"At my very first job, the CTO would hand out little 1-inch plastic pelicans if you did a good job at something. And a gold-painted plastic pelican if it was an outstanding job. He only did it for a year, I think he probably ran out of pelicans. It was a small thing, but it was nice to have a little token to say 'Thank you.' And it was a conversation starter at work: 'You got a pelican. What did you do?'" ⁠—Jim Hall + +Take our poll or let us know your own gift idea by leaving us a comment. If you are still looking for ideas, be sure to check out our [favorite sysadmin snack poll][2], too! + +Some are creative and encourage productivity, and others just inspire creativity. Some are just... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/gift-ideas-sysadmin-appreciation-day + +作者:[Lauren Pritchett][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/jamesf +[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/article/19/7/sysadmins-snack-on-call diff --git a/sources/tech/20190722 System administrator responsibilities- 9 critical tasks.md b/sources/tech/20190722 System administrator responsibilities- 9 critical tasks.md new file mode 100644 index 0000000000..cd133a836d --- /dev/null +++ b/sources/tech/20190722 System administrator responsibilities- 9 critical tasks.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (System administrator responsibilities: 9 critical tasks) +[#]: via: (https://opensource.com/article/19/7/sysadmin-best-practices) +[#]: author: (Alok Sharma https://opensource.com/users/aloksharma08https://opensource.com/users/vincepowerhttps://opensource.com/users/bcottonhttps://opensource.com/users/penglishhttps://opensource.com/users/bijeshhttps://opensource.com/users/aloksharma08https://opensource.com/users/jamesfhttps://opensource.com/users/aloksharma08) + +System administrator responsibilities: 9 critical tasks +====== +Sysadmins are responsible for a wide range of duties, but these are the +most essential. +![Tools for the sysadmin][1] + +System administrators are critical to the reliable and successful operation of an organization and its network operations center and data center. A sysadmin must have expertise with the system's underlying platform (i.e., Windows, Linux) as well as be familiar with multiple areas including networking, backup, data restoration, IT security, database operations, middleware basics, load balancing, and more. Sysadmin tasks are not limited to server management, maintenance, and repair, but also any functions that support a smoothly running production environment with minimal (or no) complaints from customers and end users. + +Although sysadmins have a seemingly endless list of responsibilities, some are more critical than others. If you work in a sysadmin role (or hope to one day), make sure you are ready to follow these best practices. + +### Documentation + +Documentation is how sysadmins keep records of assets, including hardware and software types, counts, and licenses. Should there be any issues in the production environment, documentation helps identify the hardware, virtual machine, appliance, software, etc., that may be involved. + +#### Hardware inventory + +Maintain lists of all your physical and virtual servers with the following details: + + * **OS:** Linux or Windows, hypervisor with versions + * **RAM:** DIMM slots in physical servers + * **CPU:** Logical and virtual CPUs + * **HDD:** Type and size of hard disks + * **External storage (SAN/NAS):** Make and model of storage with management IP address and interface IP address + * **Open ports:** Ports opened at the server end for incoming traffic + * **IP address:** Management and interface IP address with VLANs + * **Engineering appliances:** e.g., Exalogic, PureApp, etc. + + + +#### Software inventory + + * **Configured applications:** e.g., Oracle WebLogic, IBM WebSphere Application Server, Apache Tomcat, Red Hat JBoss, etc. + * **Third-party software:** Any software not shipped with the installed OS + + + +#### License details + +Maintain license counts and details for physical servers and virtual servers (VMs), including licenses for Windows, subscriptions for Linux OS, and the license limit of hypervisor host. + +### Server health checkup + + * **Running processes:** Check for processes that are consuming more resources than expected, and take action to fine-tune the applications (with the help of the application team). + * **CPU utilization:** Consistently monitor and check the CPU utilization of the critical process like "java", "http", "mysql" etc. to ensure that these are not consuming the CPU resources more than expected. If it is so, then coordinate with the application team to check it at application level  and fine tune the same. Parallely analyse the OS parameters like "Ulimits". + * **Memory utilization:** Check memory utilization and clear the cache, if required. + * **Zombie processes:** Check for processes where the PID still exists in the process table after it is terminated. Zombie processes degrade server performance, so find and kill any that exist. + * **Load average:** If you're having performance issues, check the load average and tune the server for performance. + * **Disk/SAN/NAS utilization:** Check the I/O reports for externally attached storage to track and check the speed of read/write operations. If you find any issues, coordinate with the storage and network teams immediately to correct them. + + + +### Backup and disaster recovery planning + +Communicate with the backup team and provide them the data and client priorities for backup. The recommended backup criteria for production servers is: + + * **Incremental backups:** Daily, Monday to Friday + * **Full backup:** Saturday and Sunday + * **Disaster recovery drills:** Perform restoration mock drills once a month (preferably, or quarterly if necessary) with the backup team to ensure the data can be restored in case of an issue. + + + +### Patching + +Operating system patches for known vulnerabilities must be implemented promptly. There are many types and levels of patches, including: + + * Security  + * Critical  + * Moderate + + + +When a patch is released, check the bug or vulnerability details to see how it applies to your system (e.g., does the vulnerability affect the hardware in your system?), and take any necessary actions to apply the patches when required. Make sure to cross-verify applications' compatibility with patches or upgrades. + +### Application compatibility + +Before going live with any application, check its compatibility with your hardware and operating system, and make sure to do load testing (with the support of application team). + +### Server hardening + +#### Linux: + + * **Set a BIOS password:** This prevents users from altering BIOS settings. + * **Set a GRUB password:** This stops users from altering the GRUB bootloader. + * **Deny root access:** Rejecting root access minimizes the probability of intrusions. + * **Sudo users:** Make sudo users and assign limited privileges to invoke commands. + * **TCP wrappers:** This is the weapon to protect a server from hackers. Apply a rule for the SSH daemon to allow only trusted hosts to access the server, and deny all others. Apply similar rules for other services like FTP, SSH File Transfer Protocol, etc. + * **Firewalld/iptables:** Configure firewalld and iptables rules for incoming traffic to the server. Include the particular port, source IP, and destination IP and allow, reject, deny ICMP requests, etc. for the public zone and private zone. + * **Antivirus:** Install antivirus software and update virus definitions regularly. + * **Secure and audit logs:** Check the logs regularly and when required. + * **Rotate the logs:** Keep the logs for limited period of time like "for 7 days", to keep the sufficient disk space for flawless operation. + + + +#### Windows: + + * **Set a BIOS password:** This prevents users from altering BIOS settings. + * **Antivirus:** Install antivirus software and update virus definitions regularly. + * **Configure firewall rules:** Prevent unauthorized parties from accessing your systems. + * **Deny administrator login:** Limit users' ability to make changes that could increase your systems' vulnerabilities. + + + +### Use a syslog server + +By configuring a syslog server in the environment to keep records of system and application logs, in the event of an intrusion or issue, the sysadmin can check previous and real-time logs to diagnose and resolve the problem. + +### Automation + +Many sysadmin tasks (such as server health checkups, resource utilization, backup triggers, transfer files and logs, etc.) must be done at specific times. Therefore, the sysadmin must write scripts or use external tools and configure them as cron jobs to do the tasks automatically at the proper time. + +### Monitoring tools + +Install and configure live monitoring tools like Nagios, HP, etc., to monitor your IT infrastructure and issue alerts about potential problems. + +### Conclusion + +While these are the most important tasks a sysadmin is responsible for, there is much more to the role than the duties on this list. + +For example, the sysadmin must coordinate with multiple teams to resolve issues, communicate with and update customers, maintain 100% uptime, hold discussions with the audit team, prepare weekly/monthly/quarterly reports, do continuous monitoring of servers and services using appropriate tools, and maintain the hardware console and respond to any triggered alarms. + +The sysadmin is always a single point of content (SPOC) in the data center or network operations center for issues related to web hosting, application and server outages, and other critical IT operations problems. + +_What other tasks or best practices do you think are essential for sysadmins? Please share your opinion in the comments._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/sysadmin-best-practices + +作者:[Alok Sharma][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/aloksharma08https://opensource.com/users/vincepowerhttps://opensource.com/users/bcottonhttps://opensource.com/users/penglishhttps://opensource.com/users/bijeshhttps://opensource.com/users/aloksharma08https://opensource.com/users/jamesfhttps://opensource.com/users/aloksharma08 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn (Tools for the sysadmin) diff --git a/sources/tech/20190723 8 Best Open Source CRM Software.md b/sources/tech/20190723 8 Best Open Source CRM Software.md new file mode 100644 index 0000000000..89d0b977b4 --- /dev/null +++ b/sources/tech/20190723 8 Best Open Source CRM Software.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 Best Open Source CRM Software) +[#]: via: (https://itsfoss.com/best-open-source-crm/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +8 Best Open Source CRM Software +====== + +_**In this article, we list some of the best open source CRM software available for small and medium sized businesses.**_ + +### What is CRM? + +CRM stands for [Customer Relationship Management][1]. A CRM software enables the companies to interact with their potential and existing customers, understand and manage their requirement. This improved the relation of the organization with customer and you know that a happy customer brings profitability to the business. + +No matter how big your team is (small business or a big firm), a CRM software always comes in handy when you want to keep things organized in your business. + +You may avoid a CRM software for a couple of employees when you start a business. However, to streamline the process and make the work efficient and fast – you will eventually need a CRM software. + +But, what about the level of control (or security) in a CRM software? Do you want a transparent CRM software which you can take control of? + +Well, that is when an open source CRM software comes into play. You can host it yourself, and you can customize it as per your requirements. You may also opt for the hosted version where you don’t have to manage it yourself. + +In this article, we talk about some of the best open-source CRM software I have found. + +### Best Free and Open Source CRM Software + +![][2] + +Let me clarify something. CRM is intended for businesses and when there is a software created for business organizations, the developers would also like to make money. This is why almost all of the free and open source software also have their paid ‘enterprise versions’ available. + +While you can download the open source version and host it on your own Linux based server, the ‘enterprise versions’ are hosted by the developers themselves so that you don’t have to manage it. Some enterprise versions also provide premium features that are not available for the open source versions. Ticket support is also a feature available only for the enterprise versions. + +I have tried to highlight their ‘premium features’ in the list. Of course, t_he list below is in no particular order of ranking._ + +#### 1\. SuiteCRM + +![Suitecrm Hosting][3] + +Key Highlights: + + * Sever-basis charge instead of per-user subscription for hosted service + * Open-source + * Affordable managed hosting plans + * Supports third party integration + * 7-days free trial + + + +SuiteCRM was originally inspired (and forked) from SugarCRM’s open-source version. Well, that is no longer available. So, SuiteCRM is the open source alternative for organizations who utilized SugarCRM earlier. + +[][4] + +Suggested read  Use Do Not Disturb Mode in Ubuntu With NoNotifications + +In addition to all the essential features a CRM has to offer, SuiteCRM offers some great affordable managed hosting deals for organizations. With an impressive pricing plan (on server-basis with unlimited users), [SuiteCRM takes aim at Salesforce][5] – which is promising. + +[SuiteCRM][6] + +#### 2\. Odoo + +![][7] + +Key Highlights: + + * Open-source edition available + * Enterprise edition pricing on a per-user basis + * Wide variety of third party integrations + * 15-days free trial + + + +Odoo is yet another popular open-source CRM solution. However, in contrast to SuitCRM, you will observe the pricing plan per user. So, if you are just starting out with a lot of users – you might find it a bit pricey. + +The third-party integrations can be done easily and you can find the pricing for each app/integration when purchasing a subscription. You can either opt for the open source community edition or purchase the enterprise edition. + +[Odoo][8] + +#### 3\. Vtiger + +![][9] + +Key Highlights: + + * Open source edition based on SugarCRM + * Separate pricing plans for Marketing, Sales, Help desk or all-in-one + * Regional pricing available for some countries like India + * Per-user pricing + + + +Vtiger offers a cloud version and an open source version. Of course, if you opt for the open source version, you get to host it yourself and manage it all by yourself or hire a team. + +After observing the pricing plan, the managed cloud version obviously looks promising. – with separate pricing plans for sales, marketing, and help desk. However, if you have the required technical expertise, the open-source version is good enough as well. Also, it was interesting to see a regional pricing plan for India because they have an office here. + +[Vtiger][10] + +#### 4\. ConcourseSuite + +![][11] + +Key Highlights: + + * Offers a separate (but outdated) open source community edition + * Provides a 5-user trial plan for the latest version + + + +ConcourseSuite is a simple CRM which offers open-source version as well. The community edition (or the open-source version) is outdated – which you can still utilize as a basic CRM. + +In case you want the latest version (which is the enhanced version of the community edition), you will have to opt for a 5-user trial or purchase the enterprise/cloud version. I couldn’t find a clear pricing plan but its pricing page did mention $10,000 for unlimited users. So, you will probably find out about it after trying out the trial. + +[ConcourseSuite][12] + +#### 5\. EspoCRM + +![][13] + +Key Highlights: + + * The ability to switch to on-premise anytime. + * Actively maintained open source (self-hosted) package. + + + +EspoCRM is new to the scene and it is an impressive CRM software. You can download it for free and host it yourself or opt for the cloud solution where they do it for you. + +[][14] + +Suggested read  10 Amazing Websites Every Linux Gamer Must Follow + +They have got a detailed [documentation][15] – in case you want to try it yourself. Also, if you want to go with the cloud solution – you can always switch to on-premise anytime you want. I guess that makes it a bit more appealing. + +[EspoCRM][16] + +#### 6\. Axelor CRM + +![Axelor Crm][17] + +Key Highlights: + + * A complete suite of ERP, CRM, and BPM. + * Mobile apps for Android and iOS + + + +Axelor is normally a complete suite of ERP, CRM, and BPM. Here, we talk about the CRM which is an incredible open source CRM available out there. + +In addition to the web app, it also offers mobiles apps for Android and iOS. So, no matter you host it yourself or purchase a subscription for managed hosting – Axelor CRM is a great choice to keep up across multiple platforms. + +#### 7\. Crust CRM (Corteza) + +![][18] + +Key Highlights: + + * A unified open source solution + * Recently launched with latest features on board + + + +[Crust CRM][19] is one of the best enterprise-level Slack/Salesforce alternatives. Well, the primary aim of Crust CRM is to provide you a unified platform. + +Crust CRM offers a community edition “Corteza” which is open-source in nature with all the latest features that you get with Crust CRM. It has been recently launched – so you can expect it to be compatible with a lot of services. You need to go through the [technical documentation][20] to set it up. + +[Corteza][21] + +#### 8\. X2CRM + +![][22] + +Key Highlights: + + * The open-source package is no longer actively maintained – but available. + * On-premise and hosted options available + + + +X2CRM is yet another convincing open source solution. The open source package includes all the modules (Sales, Marketing, and Support). + +However, do note that the open source package isn’t actively maintained anymore – so if you want the latest and greatest features, you will have to purchase it. You can let them manage everything (hosted solution) or you get to manage everything and opt for their support and optimization services (on-premise). + +[X2CRM][23] + +### Wrapping Up + +I had made the [list of best open source CMS][24] earlier. You may read that to get some ideas about which open source technology to use for creating your business website. + +Coming back to CRM, if you would ever consider trying out an open source CRM, these are the best ones I would recommend. Did I miss one of your favorites? Let us know about it in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-open-source-crm/ + +作者:[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://en.wikipedia.org/wiki/Customer_relationship_management +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/open-source-crm-software.png?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/suitecrm-hosting.jpg?resize=800%2C457&ssl=1 +[4]: https://itsfoss.com/do-not-disturb-mode-ubuntu/ +[5]: https://itsfoss.com/suitecrm-ondemand/ +[6]: https://suitecrm.com/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/odoocrm.jpg?fit=800%2C384&ssl=1 +[8]: https://www.odoo.com/page/crm +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/vtiger.jpg?fit=800%2C419&ssl=1 +[10]: https://www.vtiger.com/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/concoursesuite-crm.jpg?fit=800%2C629&ssl=1 +[12]: https://www.concursive.com/show/concoursesuite/wiki/How+to+Get+ConcourseSuite +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/espo-crm.jpg?ssl=1 +[14]: https://itsfoss.com/best-linux-gaming-websites/ +[15]: https://github.com/espocrm/documentation +[16]: https://www.espocrm.com/ +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/axelor-crm.jpg?fit=800%2C526&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/corteza.jpg?resize=800%2C417&ssl=1 +[19]: https://www.crust.tech/products/crust-crm/ +[20]: https://github.com/cortezaproject/corteza-docs +[21]: https://cortezaproject.org/ +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/x2crm.png?ssl=1 +[23]: https://x2crm.com/download +[24]: https://itsfoss.com/open-source-cms/ diff --git a/sources/tech/20190723 9 people for sysadmins to follow on Twitter.md b/sources/tech/20190723 9 people for sysadmins to follow on Twitter.md new file mode 100644 index 0000000000..8fb6e32c2e --- /dev/null +++ b/sources/tech/20190723 9 people for sysadmins to follow on Twitter.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 people for sysadmins to follow on Twitter) +[#]: via: (https://opensource.com/article/19/7/twitter-sysadmins) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/sethhttps://opensource.com/users/aloksharma08https://opensource.com/users/marcobravohttps://opensource.com/users/don-watkins) + +9 people for sysadmins to follow on Twitter +====== +Follow these accounts to gain a wealth of knowledge about being a better +sysadmin. +![Red and blue birds chatting on telephone wire over city skyline][1] + +While Twitter certainly isn't the most open source platform, the open source community on the social network brings a lot of great minds together on a daily basis. The site, as I see it, also democratizes access to these brilliant minds since we're all just one **@** away. + +Here are nine people whose Twitter accounts are making my pursuit of sysadmin knowledge, and its continued evolution, better. They fall across the spectrum of technology with the one thing they have in common being their passionate, informative, and thoughtful perspective. They share a wealth of knowledge from explaining Linux commands through comics, to applying a PhD's worth of knowledge to making DevOps make sense. + +### Julia Evans [@b0rk][2] + +Julia has found a beautiful way to combine her love for sysadmin skills with her talent in drawing. She teaches the skills you need to be a deeply knowledgeable sysadmin through "zines" (online magazines) that are as playful as they are brilliant. + +> reminder: if you like the comics I post on twitter, they're collected into zines you can buy at ★ ★ [pic.twitter.com/rRy9uijlnS][3] +> +> — 🔎Julia Evans🔍 (@b0rk) [January 23, 2019][4] + +### Nicole Forsgren, PhD [@nicolefv][5] + +If you have ever asked, "Is there data that supports DevOps' effectiveness?" then you need to be following Nicole. She has led [DORA][6]'s annual State of DevOps Report from its inception and is the lead author of the new book [_Accelerate: The Science of Lean Software and DevOps_][7]. + +> Y'all, I am SUPER excited and unbelievably proud to announce that Accelerate, the book I coauthored with [@jezhumble][8] and [@RealGeneKim][9], has just been awarded the Shingo Publication Award from [@ShingoPrize][10] \-- the top award for Lean and operational work. 🎉 +> +> — nicole forsgren PHD IN COMPUTERING THINGS (@nicolefv) [April 26, 2019][11] + +### Jessie Frazelle [@jessfraz][12] + +If you're into kernel hacking, NASA nerdery, and honest thoughts from a self-defined weirdo, you will be very happy to follow Jessie's exploration of the intersection of technology and culture. You will become smarter on a regular basis if you investigate the projects she's exploring. + +> I got to write the forward for [@calavera][13] and [@fntlnz][14]'s new eBPF book! Here it is :D +> +> — jessie frazelle 👩🏼‍🚀 (@jessfraz) [July 11, 2019][15] + +### Jess Dodson [@girlgerms][16] + +Jess is a passionate, open, and witty sysadmin-focused tweeter. + +> [pic.twitter.com/f5U9lMX4k1][17] +> +> — Jess Dodson (@girlgerms) [July 14, 2019][18] + +### Angie Jones [@techgirl1908][19] + +If you've ever wondered what the evolution of manual testing looks like, go no further than Angie's tweets. She's deep in that space and exploring topics that all sysadmin-minded people can appreciate. You'll be smarter for doing so. Bonus: If you're ever wanted to learn Java, she's recently released a free course to help you do so (and it has a great testing angle to it).  + +> The wait is over! I've just released my free [#Java][20] course! 🎉 +> +> The course is designed for beginners to programming, so if you or anyone you know has been wanting to get into coding, this is a great resource to do so. [pic.twitter.com/Pk9q2dcH6b][21] +> +> — Angie Jones (@techgirl1908) [May 31, 2019][22] + +  + +### Bridget Kromhout [@bridgetkromhout][23] + +Bridget is the person who first introduced me to container technology. She continues to share her expertise in DevOps, Kubernetes, and many other IT ops topics. She also is the [DevOpsDays][24] international lead and the local Minneapolis lead, and an expert-level live-tweeter of talks. + +> “What’s left is _people_.” [@adamhjk][25] with a powerful message on community stewardship and building meaning. [#oscon][26] [pic.twitter.com/66CjbedrXJ][27] +> +> — Bridget Kromhout (@bridgetkromhout) [July 18, 2019][28] + +### Vallery Lancey [@vllry][29] + +As I see it, Vallery is live-tweeting, amongst other things, her pursuit to be an expert Kubernetes administrator. She goes *deep* on the topic on a regular basis and is a textbook example of how to engage with the open source community. This thread will give you an idea: + +> Kubernetes' data model is a major performance/scalability bottleneck. I'm wondering how (if ever) it will change. +> +> All resources (within a scope, EG all pods within a namespace) are stored together. This makes things simple, but becomes huge. +> +> — Vallery Lancey (@vllry) [July 12, 2019][30] + +### Ashley McNamara [@ashleymcnamara][31] + +Some joke that a Sysadmin who learns Go is now [an SRE][32]. f you have wondered about the programming language [Go][33], follow Ashley to keep up-to-date on its maturation and new uses. She's also an excellent curator of internet memes. + +> My kid is gaming with friends so I brought him a snack and he says, "Thanks, Love you" then laughter erupts on the headset and he goes, "What? You don't love your mothers? I'm sad for you." so if you need me I'll just be over here sobbing into my worlds best mom ribbon. +> +> — Ashley McNamara (@ashleymcnamara) [April 19, 2019][34] + +### Nina Zakharenko [@nnja][35] + +Similar to the Sysadmin + Go meme is a Sysadmin that knows Python is now a DevOps Engineer. Nina continuously shares her expertise in Python with incredible storytelling. She's an inspiration. + +> Thanks for the nice write up of my PyCon US keynote! 🐍🎉 [@btskinn][36] +> +> 👉 Missed it? +> 📺 Video: +> 📊 Slides: +> ✏️ blog post by [@pylogging][37]: [pic.twitter.com/u9kAjebfhP][38] +> +> — Nina Zakharenko 💜🐍 (@nnja) [June 27, 2019][39] + +### Bonus: Follow sysadmin topics and companies + +While I find the most value from Twitter by following real human beings that inspire me on a regular basis, there are some wonderful companies and projects that can also add to your day-to-day fun on the site. Here are a few:  + + * Reading [IT Revolution Books][40] has greatly improved my knowledge of DevOps; it's worth following on Twitter, too. + * [Hackaday.io][41] bills itself as the "world's largest hardware + software community. It looks pretty fun.  + * Lists can also be a great way to avoid following lots of people, but still seeing their work. Chris Short has curated a fantastic [list of Twitter accounts about sysadmin topics][42]. + * I love podcasts, and [The Changelog][43] is a mix of new episodes, open source news, and tech memes.  + * The best conference to attend as an open source enthusiast is [All Things Open][44], and they curate a fun set of content. + + + +And finally, to enjoy Twitter more as a work tool, [don't forget about muting][45] the noise you don't want to see there. It's made all the difference for me personally.  + +Have questions? Ask in the comments or DM me [@mbbroberg][46]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/twitter-sysadmins + +作者:[Matthew Broberg][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/mbbroberghttps://opensource.com/users/sethhttps://opensource.com/users/aloksharma08https://opensource.com/users/marcobravohttps://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/birds_wire.png?itok=1RsjPYwB (Red and blue birds chatting on telephone wire over city skyline) +[2]: https://twitter.com/b0rk +[3]: https://t.co/rRy9uijlnS +[4]: https://twitter.com/b0rk/status/1087923184488366084?ref_src=twsrc%5Etfw +[5]: https://twitter.com/nicolefv +[6]: https://devops-research.com/ +[7]: https://www.amazon.com/dp/B07B9F83WM +[8]: https://twitter.com/jezhumble?ref_src=twsrc%5Etfw +[9]: https://twitter.com/RealGeneKim?ref_src=twsrc%5Etfw +[10]: https://twitter.com/ShingoPrize?ref_src=twsrc%5Etfw +[11]: https://twitter.com/nicolefv/status/1121841152603246593?ref_src=twsrc%5Etfw +[12]: https://twitter.com/jessfraz +[13]: https://twitter.com/calavera?ref_src=twsrc%5Etfw +[14]: https://twitter.com/fntlnz?ref_src=twsrc%5Etfw +[15]: https://twitter.com/jessfraz/status/1149336855441108992?ref_src=twsrc%5Etfw +[16]: https://twitter.com/girlgerms +[17]: https://t.co/f5U9lMX4k1 +[18]: https://twitter.com/girlgerms/status/1150531514611847168?ref_src=twsrc%5Etfw +[19]: https://twitter.com/techgirl1908 +[20]: https://twitter.com/hashtag/Java?src=hash&ref_src=twsrc%5Etfw +[21]: https://t.co/Pk9q2dcH6b +[22]: https://twitter.com/techgirl1908/status/1134451364833050625?ref_src=twsrc%5Etfw +[23]: https://twitter.com/bridgetkromhout +[24]: https://devopsdays.org/ +[25]: https://twitter.com/adamhjk?ref_src=twsrc%5Etfw +[26]: https://twitter.com/hashtag/oscon?src=hash&ref_src=twsrc%5Etfw +[27]: https://t.co/66CjbedrXJ +[28]: https://twitter.com/bridgetkromhout/status/1151884811855728640?ref_src=twsrc%5Etfw +[29]: https://twitter.com/vllry +[30]: https://twitter.com/vllry/status/1149534333553614849?ref_src=twsrc%5Etfw +[31]: https://twitter.com/ashleymcnamara +[32]: https://opensource.com/article/19/7/sysadmins-vs-sres +[33]: https://golang.org/ +[34]: https://twitter.com/ashleymcnamara/status/1119357024691638277?ref_src=twsrc%5Etfw +[35]: https://twitter.com/nnja +[36]: https://twitter.com/btskinn?ref_src=twsrc%5Etfw +[37]: https://twitter.com/pylogging?ref_src=twsrc%5Etfw +[38]: https://t.co/u9kAjebfhP +[39]: https://twitter.com/nnja/status/1144046094348890112?ref_src=twsrc%5Etfw +[40]: https://twitter.com/ITRevBooks +[41]: https://twitter.com/hackadayio +[42]: https://twitter.com/ChrisShort/lists/systems-devops-sre-devs +[43]: https://twitter.com/changelog +[44]: https://twitter.com/AllThingsOpen +[45]: https://help.twitter.com/en/using-twitter/advanced-twitter-mute-options +[46]: https://twitter.com/mbbroberg diff --git a/sources/tech/20190723 Building an organization that-s always learning- Tips for leaders.md b/sources/tech/20190723 Building an organization that-s always learning- Tips for leaders.md new file mode 100644 index 0000000000..dca14d131e --- /dev/null +++ b/sources/tech/20190723 Building an organization that-s always learning- Tips for leaders.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building an organization that's always learning: Tips for leaders) +[#]: via: (https://opensource.com/open-organization/19/7/continuous-learning-tool) +[#]: author: (Colin Willis https://opensource.com/users/colinwillishttps://opensource.com/users/colinwillishttps://opensource.com/users/marcobravohttps://opensource.com/users/jamesf) + +Building an organization that's always learning: Tips for leaders +====== +Research shows that informal learning is essential in open +organizations. How can we measure and foster it? +![word learn in chalk on blackboard][1] + +In open organizations, informal learning is critical to success. "Informal learning" accounts for all learning that occurs outside a training program, a classroom, or another formalized instruction setting. Unlike the learning in these formalized learning settings, informal learning is unstructured, personal, and voluntary. + +As a result, systematic study of it is difficult. But due to [the prevalence and importance of informal learning in workplaces][2], several researchers have called for additional research into the subject—and particularly for the design of instruments to actually _measure_ informal learning. Such instruments could likewise be useful in [open organizations][3] hoping to measure and foster informal learning practices among employees. + +Over the past few years, I've conducted research addressing this gap in the scientific literature. In this article, I'll describe a recent study I conducted and explain how my results can help us think about informal learning in the open organization. + +### Measuring the invisible + +The field of psychology studies the thoughts, attitudes, and behaviors of individuals both in isolation and in group settings. The specific field of psychology in which I specialize, industrial and organizational psychology, studies these same variables in the workplace. + +My research in this area concerns a phenomenon important to everyone in my field: How do we _accurately_ and _reliably_ measure psychological phenomena? In my case, I'm attempting to develop a specific tool for measuring informal learning. In short, this means I'm testing for two things: + + 1. Can an "invisible" concept, like one's ability to adapt, be measured by a set of behaviors that are thought to be indicative of, in this example, adapting? + 2. If these conceptual abilities exist, are they related to other behaviors or outcomes in an interesting way (for example, is there a relationship between adapting and job performance)? + + + +One method of measurement is the use of psychological scales, which are a set of statements that describe a psychological construct. People respond to statements they're given and note the extent to which they agree with the statement or believe the statement to be true of them, typically on some form of "low to high" scale. For example, common psychological scales include, but are not limited to, personality inventories of traits like "conscientiousness," "openness to experience," "extraversion," "agreeableness," or "emotional stability" and specific attitudes like "job satisfaction" or "self-efficacy." Scales such as these go through an extensive scientific development process. + +However, not all scales are created equally. You may recognize the similarity between a psychological scale and an internet or magazine quiz. Both include a series of statements that you rate, and your ratings tell you something about yourself. But the former has undergone a rigorous process of study and verification involving creation of many possible statements, as well as continual refinement via data collection and statistical analysis. The latter has not. + +### A new tool + +To create a measure of informal learning behaviors, I reviewed theories and behaviors of informal learning documented in hundreds of journal articles and books on the subject. + +To create a measure of informal learning behaviors, I reviewed theories and behaviors of informal learning documented in hundreds of journal articles and books on the subject. I then analyzed what I found in them to create a set of six higher-level dimensions of behaviors that I believed would comprehensively and accurately describe the wide variety of intentional learning behaviors often seen in the workplace. These were: + + * **Planning:** the act of thinking ahead or preparing for future events by amassing materials, rehearsing, setting goals, or evaluating one's learning ability + * **Socializing:** the process of debating, conversing, or digesting information with a group of peers, creating or maintaining a network, or observing the work of others + * **Reflecting:** the internal act of thinking about feedback one has received, maintaining awareness about one's environment, or drawing upon experiences to adjust future behavior + * **Experimenting:** The outwardly act of trying out new ideas, taking on new challenges, coming up with alternatives, taking risks, and anticipating consequences of actions. + * **Adapting:** the set of proactive behaviors one takes to learn, adjust to, and master changes to one's environment such as asking clarifying questions, addressing conflict directly, or making conclusions about new situations + * **Scanning:** the process of staying current on job-related knowledge by researching answers to new questions, reading or watching content related to one's job, or attending events related to one's profession + + + +I then wrote slightly fewer than 100 statements that described unique behaviors related to the six dimensions I hypothesized existed. With the help of several subject matter experts, I revised and retooled the language of these statements. For example, a planning item reads, "Set a learning goal for yourself," and an experimenting item reads, "Challenge existing assumptions about ideas at work." Subjects rate their responses to these items on a 1-to-5 scale, where "1" means "not at all characteristic of me" and "5" means "highly characteristic of me." + +I collected more than 1,000 responses to these items and several additional, related psychological scales that pertained to motivations and attitudes centered on learning. I found strong support for four of my dimensions and additional evidence that two of my dimensions—"planning" and "scanning"—were very similar to one another, so I began treating those two dimensions as one. Furthermore, I reduced the number of statements down to 23 while retaining the ability to measure each dimension accurately. These five dimensions were very strongly related to other learning concepts, like one's motivation to learn, one's tendency to think about one's own thinking and learning, and one's tendency to act in a goal-driven manner. + +### What I learned about learning + +Given this evidence, I conducted a second study to confirm the five dimensions and 23 items I found in the first study. I conducted this study in an organization where I asked participants to respond to my "informal learning" scale, a "professional confidence" scale, and a "support for learning" scale. The organization also provided performance data to use as an outcome measure. + +Specifically, I was interested in determining whether and how professional confidence and perceived support for learning in the organization predicted informal learning behaviors and whether informal learning behaviors predicted job performance. It is increasingly common in the organizational science to test statistical models of individual and organizational level variables; in this case, I was interested in determining the extent to which one's confidence in their ability to do their job affected informal learning (are confident people more likely to self-guide their own learning?) and the extent to which a culture of learning (or lack thereof) bolstered or inhibited learning (if one thinks they won't be rewarded for learning, will they perform learning behaviors anyway?). Finally, job performance is a common outcome to measure in the organizational sciences, as researchers and practitioners in the field are often concerned with the ability to predict and improve performance. + +For this study, 167 employees completed the survey. The small sample size limited the ability for the statistical analyses to study all proposed research questions, but I still uncovered several interesting results. + +I found that two dimensions of informal learning were strong predictors of job outcomes: + + 1. Experimenting behaviors, or _a willingness to try new things_, predicted job performance and job potential. + 2. Reflecting behaviors, or _the extent to which one requests and processes feedback_, predicted a likelihood to remain with the organization. + + + +Additionally, the study found a strong relationship between occupational self-efficacy, or _one's confidence in his or her ability to do their job_, and informal learning. + +### Some results and implications + +Succeeding in any organization—but especially an open organization—requires one to develop as a continuous learner. Evidence supports this claim. + +The second study provided some compelling indications that informal learning is not only theoretically but also practically important to both the employee and the organization. Succeeding in any organization—but especially an open organization—requires one to develop as a continuous learner. Evidence supports this claim. Those who had well-developed habits of experimenting and reflecting were more likely to be top performers who were well-ingrained in the organization. + +That's not to say that these are the only important behaviors. But they do represent important areas of concern for both individual contributors, managers, and other leaders in an organization. If you're intrigued and want to begin supporting informal learning in a concrete way, consider the following: + + * Evidence from these studies suggest that informal learning is closely related to one's confidence in their ability to do their job. Confidence can be developed through motivation and work design; for example, giving an employee the ability to shape his or her own tasks or role, which cultivates a sense of autonomy and curiosity, would likely spur learning behaviors. + * Following up with support and rewards for doing so, which are strong motivators, would reinforce that learning. You might also consider educating yourself or your team about learning behaviors and providing, where applicable, tools and opportunities to develop those behaviors. For example, research has shown that reflecting via note-taking or journaling has been very effective at bolstering reflecting abilities and later ability to recall information. + + + +Learning informally at work is incredibly common; however, treating learning as a skill is far less common. Hopefully this article series has better equipped you to think about and support learning at work using the latest research has to offer on the topic. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/7/continuous-learning-tool + +作者:[Colin Willis][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/colinwillishttps://opensource.com/users/colinwillishttps://opensource.com/users/marcobravohttps://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_khan_520x292_FINAL.png?itok=vuhXpZDI (word learn in chalk on blackboard) +[2]: https://opensource.com/open-organization/19/7/informal-learning-adaptability +[3]: https://opensource.com/open-organization/resources/open-org-definition diff --git a/sources/tech/20190723 JavaScript-s surprising rise from the ashes of the browser wars on Command Line Heroes.md b/sources/tech/20190723 JavaScript-s surprising rise from the ashes of the browser wars on Command Line Heroes.md new file mode 100644 index 0000000000..b65d6f5ee3 --- /dev/null +++ b/sources/tech/20190723 JavaScript-s surprising rise from the ashes of the browser wars on Command Line Heroes.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (JavaScript's surprising rise from the ashes of the browser wars on Command Line Heroes) +[#]: via: (https://opensource.com/article/19/7/command-line-heroes-javascript) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/petercheerhttps://opensource.com/users/marcobravohttps://opensource.com/users/madtom1999) + +JavaScript's surprising rise from the ashes of the browser wars on Command Line Heroes +====== +A single Netscape employee wrote JavaScript in 10 days. It's now the +most pervasive programming language in the world. Here's the unlikely +story of how it happened. +![Listen to the Command Line Heroes Podcast][1] + +The third season of the [Command Line Heroes][2] podcast continues its look at the history of the programming languages we depend on every day. Episode 3, released today, investigates the origin of JavaScript. Here's the unlikely story of how it happened. + +### A look back at the browser wars + +1995 was a year full of competition over a new frontier. The web browser created by Netscape had been out for a full year already, and the competition was heating up. [Clive Thompson][3] recollects the intensity and the excitement in the air during that time. Today we talk about the velocity of technology being faster than ever, and I wonder if it's our [recency bias][4] tricking our minds from remembering the buzz in 1995. + +> "Things were moving so rapidly back then." +> —Clive Thompson + +The story goes of a single person being "locked in a room" (I hope that's an exaggeration) and creating what is now the most prevalent language of the web. That was 34-year-old Netscape employee Brendan Eich, who chained himself to his desk for 10 days. At the end of those 10 days in 1995, [he delivered JavaScript][5]. + +Eich's efforts to deliver value to his company also sound like a fulfillment of his passion to write a widely used programming language. This story hits home, especially after hearing about the [history of BASIC][6] on episode 2. + +The programming community of 1995 did not accept JavaScript with open arms. (I believe the word "derision" was used in the episode.) But it was unpretentious, secretly elegant, based on the best in language design, and sacrificed some bugginess for speed to market. It worked. + +> "The origins of Firefox can be traced directly to Netscape, a compan­y whose web browser, Netscape Navigator, was the dominant browser before Microsoft developed Internet Explorer. The internal company name for the browser was Mozilla. Eventually, Netscape released the source code for Navigator under an open source license, meaning anyone could see and use the code. A non­profit group was set up to direct the development of browsers using this code. This group became the Mozilla Foundation in 2003." +> —Sayak Sarkar, [From Netscape To Firefox: The Story Of Mozilla Firefox][7] + +This story makes me think about what my 18-year-old niece studying computer science might take away from all of this. A long time ago, very few people were on the internet. One person made a difference for his company. Even though that company wouldn't survive its time, ultimately, he made a difference for all of us. It's a fun story to explore. + +### A look back at waterfall development + +There's a subtle element in the conversation around JavaScript that looks at software lifecycles in 1995. Netscape was far ahead of the curve with three-month development cycles at a time when the most dominant force in technology was releasing updates every four years. It was well before [Agile][8] and its Manifesto, before the hyper-scale mantra of "move fast and break things" (which [hasn't aged well][9]) and the brilliance of [Toyota Kata][10]. That boldness absolutely blows my mind. + +### Give it a listen + +Command Line Heroes' combination of history and present time creates a great story. Give it a listen. + +Command Line Heroes will cover programming languages for all of season 3. [Subscribe][2] to learn everything you want to know about the origin of programming languages. I would love to hear your thoughts about it in the comments below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/command-line-heroes-javascript + +作者:[Matthew Broberg][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/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/petercheerhttps://opensource.com/users/marcobravohttps://opensource.com/users/madtom1999 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command-line-heroes-520x292.png?itok=s_F6YEoS (Listen to the Command Line Heroes Podcast) +[2]: https://www.redhat.com/en/command-line-heroes +[3]: https://www.clivethompson.net/ +[4]: https://www.davemanuel.com/investor-dictionary/recency-bias/ +[5]: https://thenewstack.io/brendan-eich-on-creating-javascript-in-10-days-and-what-hed-do-differently-today/ +[6]: https://opensource.com/19/7/command-line-heroes-ruby-basic +[7]: https://sayaksarkar.wordpress.com/2012/03/12/from-netscape-to-firefox-the-story-of-mozilla-firefox/ +[8]: https://opensource.com/article/18/10/what-agile +[9]: https://hbr.org/2019/01/the-era-of-move-fast-and-break-things-is-over +[10]: https://en.wikipedia.org/wiki/Toyota_Kata diff --git a/sources/tech/20190724 How to make an old computer useful again.md b/sources/tech/20190724 How to make an old computer useful again.md new file mode 100644 index 0000000000..68748a93b6 --- /dev/null +++ b/sources/tech/20190724 How to make an old computer useful again.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to make an old computer useful again) +[#]: via: (https://opensource.com/article/19/7/how-make-old-computer-useful-again) +[#]: author: (Howard Fosdick https://opensource.com/users/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth) + +How to make an old computer useful again +====== +Refurbish an old machine with these step-by-step instructions. +![Person typing on a 1980's computer][1] + +Have an old computer gathering dust in your basement? Why not put it to use? A backup machine could come in handy if your primary computer fails and you want to be online with a larger screen than your smartphone. Or it could act as a cheap secondary computer shared by the family. You could even make it into a retro gaming box. + +You can take any computer up to a dozen years old and—with the right software—perform many of the same tasks you can with new machines. Open source software is the key. + +I've refurbished computers for two decades, and in this article, I'll share how I do it. We're talking about dual-core laptops and desktops between five and 12 years old. + +### Verify the hardware + +Step one is to verify that your hardware all works. Overlooking a problem here could cause you big headaches later. + +Dust kills electronics, so open up the box and clean out the dirt. [Compressed air][2] comes in handy. Be careful that you're [grounded][3] whenever you touch the machine. And _don't_ rub anything with a cleaning cloth. Even a static shock so small you won't feel it can destroy circuitry. + +Then close the clean computer and verify that all the hardware works. Test: + + * Memory + * Disk + * Motherboard + * Peripherals (DVD drive, USB ports, sound, etc.) + + + +Run any diagnostic tests in the computer's boot panels (the [UEFI][4] or [BIOS][5] panels). [This list][6] tells you which program function (PF) key to press to access those panels for your computer. + +Free resource kits like [Hirens BootCD][7] or [Ultimate Boot CD][8] enable you to test what your boot panels don't. They contain hundreds of testing programs; all are free, but not all are open source. You don't have to install anything to run these kits because they'll boot from a USB thumb drive or DVD drive. + +Be thorough! Run the extended tests for memory and disk—not just the short tests. Let them run overnight. That's the only way to catch transient (sporadic) errors. + +If you find problems, my [Quick guide to fixing hardware][9] will help you solve the most common hardware issues. + +### Select the software + +The key to refurbishing is to install software appropriate for the hardware resources you have. The three essential hardware resources are: + + 1. Processor (number of cores and speed) + 2. Memory + 3. Video memory + + + +You can identify your computer's resources in its boot-time UEFI/BIOS panels. Write down your findings so that you don't forget them. Then, look up your processor at [CPU Benchmark][10]. That website gives you background on your CPU plus a CPU Mark that indicates its performance. + +Now that you know your hardware's power, you're ready to select software that it can efficiently run. Your software choices are divided into four critical areas: + + 1. Operating system (OS) + 2. Desktop environment (DE) + 3. Browser + 4. Applications + + + +A good Linux distribution covers all four. Don't be tempted to run an unsupported version of Windows like 8, Vista, or XP just because it's already on the computer! The [risk][11] of malware is too great. You're much better off with a more virus-resistant, up-to-date operating system. + +How about Windows 7? [Extended support][12] ends January 14, 2020, meaning you get security fixes only until that date. After that, zilch. Now is the perfect time to migrate off Windows 7. + +Linux's big benefit is that it offers [many distros][13] specifically designed for older hardware. Plus, its design decouples [DEs][14] from the OS, so you can mix and match the two. This is important because DEs heavily impact low-end system performance. (With Windows and MacOS, the OS version you run dictates the DE.) + +Other Linux advantages: Its thousands of apps are free and open source, so you don't have to worry about activation and licensing. And Linux is portable. You can copy, move, or clone the OS and applications across partitions, disks, devices, or computers. (Windows binds itself to the computer it's installed on via its Registry.) + +### What can your refurbished computer do? + +We're talking dual-core machines dating from about 2006 to 2013, especially [Intel Core 2][15] CPUs and [AMD Athlon 64 X2][16] family processors. Most have a [CPU Mark][10] of between 1,000 and 4,000. You can often pick up these machines for a song, yet they're still powerful enough to run lightweight Linux software. + +One caution: be sure your computer has at least 2GB of memory. Upgrade the RAM if you have to. End users on my refurbished machines typically use between 0.5 and 2GB of RAM (exclusive of data buffering); rarely do they go over 2 gig. So if you can bump memory to 2GB, your system won't be forced to _swap_, or substitute disk for memory. That's critical for good performance. + +For example, I removed 1GB RAM from the decade-old rebuild I'm writing this article on, which dropped memory down to 1GB. The machine slowed to a crawl. Web surfing and other tasks became frustrating, even painful. I popped the memory stick back in and, with 2GB RAM, the desktop instantly reverted to its usable self. + +With a 2 gig dual-core computer, most people can do whatever they want, so long as they run a lightweight distro and browser. You can web surf, email, edit documents, do spreadsheets, watch YouTube videos, bid on eBay auctions, post on social media, listen to podcasts, view photo collections, manage home finance and personal scheduling, play games, and more. + +### Limitations + +What can't these older computers do? Their concurrency is less than state-of-the-art machines. So run a fast browser and block ads, because that's what slows down web surfing. If your virtual private network (VPN) can block ads for you and offload that work from your processor, that's ideal. Disable autoplay of videos, Flash, and animation. Surf with a couple of tabs open rather than 20. Install a browser extension so you can toggle JavaScript. + +Direct the processors to what you're working on; don't keep a ton of apps open or run lots of stuff in the background. High-end graphics and video editing may be slow. Virtual machine hosting is out. + +How about games? The open source software repositories offer literally thousands of games. That's why I listed video memory as one of the three essential hardware resources. If your box doesn't have a video card, it likely has only 32 or 64MB of VRAM. Bump that to 256 or 512MB by adding a video card, and you'll find that processor-intensive games run much better. [Here's how][17] to see how much VRAM your computer has. Be sure to get a card that fits your computer's [video slot][18] (AGP, PCI-Express, or PCI) and has the right [cable connector][19] (VGA, DVI, or HDMI). + +#### What about Windows compatibility? + +People often ask about Windows compatibility. First, there's a [Linux equivalent][20] for every Windows program. + +Second, if you really must run a specific Windows program, you can usually do that on Linux using [Wine][21]. Look up your application in the [Wine database][22] to verify it runs under Wine and learn any special install tricks. Then the auxiliary tools [Winetricks][23] or [PlayOnLinux][24] will help you with installation and setup. + +Wine's other benefit is that it runs programs from old Windows versions like Vista, XP, ME/98/95, and 3.1. I know a guy who set up a fantastic game box running his old XP games. You can even run thousands of [free DOS programs][25] using [DOSBox.][26] One caution: if Windows programs can run, so can Windows [viruses][27]. You must protect your Wine environment inside Linux just as you would any other Windows environment. + +How about compatibility with Microsoft Office? I use LibreOffice and routinely edit and exchange Word and Excel files without problems. You must, however, avoid using obscure or specialized features. + +### Which distro? + +Assuming Linux is the OS, you need to select a DE, browser, and applications. The easy way to do this is to install a distribution that bundles everything you need. + +Remember that you can try out different distros without installing anything by booting from a [live USB][28] thumb drive or DVD. [Here's how to create a bootable Linux][29] from within Linux or Windows. + +I rebuild computers for charity, so I can't assume any knowledge on the part of my users. I need a distro with these traits: + + * User-friendly + * Lightweight interface + * Bundles lightweight apps + * Big repository + * Solid track record + * Large user community with an active forum + * Stability through long-term support releases (not rolling releases) + * Prioritizes reliability over cutting-edge features + * Configurable by a GUI rather than by text files + + + +Many distros fulfill these criteria. The three I've successfully deployed are [Mint/Xfce][30], [Xubuntu,][31] and [Lubuntu][32]. The first two use the Xfce desktop environment, while the latter runs LXQt. These DEs [use less][33] processor and memory resources than alternatives like GNOME, Unity, KDE, MATE, and Cinnamon. + +Xfce and LXQt are very easy to use. My clients have never seen Linux before, yet they have no trouble using these simple, menu-driven interfaces. + +It's vital to run the fastest, most efficient browser on older equipment. [Many feel][34] Chromium wins the browser race. I also install Firefox Quantum because people are familiar with it and [its performance][35] rivals [that of Chromium][36]. I toss in Opera because it's speedy and has some unique features, like integrated ad-blocking and a free [virtual private network][37]. Opera is free but not open source. + +Whatever browser you use, block ads and trackers! Minimize browser overhead. And don't allow videos or Flash to run without your explicit say-so. + +For applications, I rely on the lightweight apps bundled with Mint/Xfce, Xubuntu, and Lubuntu. They address every possible need. + +### Go for it + +Will you be happy with your rebuild? The computers I've been using lately are both over a decade old. One has an Intel dual-core processor ([eMachines T5274a][38]) while the other features an AMD Athlon 64 x2 processor ([HP dc5750][39]). Both have 2 gig memory. They're as effective for my office workload as my quad-core i5 with 16GB RAM. The only function I miss when using them is the ability to host virtual machines. + +We live in an amazing era. You can take a five- to 12-year-old computer and, with a little effort, restore it to practical use. What could be more fun? + +Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... + +I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/how-make-old-computer-useful-again + +作者:[Howard Fosdick][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/howtechhttps://opensource.com/users/don-watkinshttps://opensource.com/users/suehlehttps://opensource.com/users/aseem-sharmahttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/dragonbitehttps://opensource.com/users/don-watkinshttps://opensource.com/users/jamesfhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=compressed+air+for+computers&rh=i%3Aaps%2Ck%3Acompressed+air+for+computers +[3]: https://www.wikihow.com/Ground-Yourself-to-Avoid-Destroying-a-Computer-with-Electrostatic-Discharge +[4]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface +[5]: http://en.wikipedia.org/wiki/BIOS +[6]: http://www.disk-image.com/faq-bootmenu.htm +[7]: http://www.hirensbootcd.org/download/ +[8]: http://www.ultimatebootcd.com/ +[9]: http://www.rexxinfo.org/Quick_Guide/Quick_Guide_To_Fixing_Computer_Hardware +[10]: http://www.cpubenchmark.net/ +[11]: https://askleo.com/unsupported-software-really-mean/ +[12]: http://home.bt.com/tech-gadgets/computing/windows-7/windows-7-support-end-11364081315419 +[13]: https://fossbytes.com/best-lightweight-linux-distros/ +[14]: http://en.wikipedia.org/wiki/Desktop_environment +[15]: https://en.wikipedia.org/wiki/Intel_Core_2 +[16]: https://en.wikipedia.org/wiki/Athlon_64_X2 +[17]: http://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/ +[18]: https://www.onlinecomputertips.com/support-categories/hardware/493-pci-vs-agp-vs-pci-express-video-cards/ +[19]: https://silentpc.com/articles/video-connectors +[20]: http://wiki.linuxquestions.org/wiki/Linux_software_equivalent_to_Windows_software +[21]: https://en.wikipedia.org/wiki/Wine_%28software%29 +[22]: https://appdb.winehq.org/ +[23]: https://en.wikipedia.org/wiki/Winetricks +[24]: https://en.wikipedia.org/wiki/PlayOnLinux +[25]: https://archive.org/details/softwarelibrary_msdos +[26]: https://en.wikipedia.org/wiki/DOSBox +[27]: https://wiki.winehq.org/FAQ#Is_Wine_malware-compatible.3F +[28]: https://www.howtogeek.com/howto/linux/create-a-bootable-ubuntu-usb-flash-drive-the-easy-way/ +[29]: https://unetbootin.github.io/ +[30]: https://linuxmint.com/ +[31]: https://xubuntu.org/ +[32]: https://lubuntu.me/ +[33]: https://www.makeuseof.com/tag/best-lean-linux-desktop-environment-lxde-vs-xfce-vs-mate/ +[34]: https://www.zdnet.com/article/chrome-is-the-most-popular-web-browser-of-all/ +[35]: https://www.laptopmag.com/articles/firefox-quantum-vs-chrome +[36]: https://www.zdnet.com/article/just-how-fast-is-firefox-quantum/ +[37]: http://en.wikipedia.org/wiki/Virtual_private_network +[38]: https://www.cnet.com/products/emachines-t5274/specs/ +[39]: https://community.spiceworks.com/products/7727-hewlett-packard-dc5750-microtower diff --git a/sources/tech/20190724 Introducing Fedora CoreOS.md b/sources/tech/20190724 Introducing Fedora CoreOS.md new file mode 100644 index 0000000000..070573f74e --- /dev/null +++ b/sources/tech/20190724 Introducing Fedora CoreOS.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing Fedora CoreOS) +[#]: via: (https://fedoramagazine.org/introducing-fedora-coreos/) +[#]: author: (Benjamin Gilbert https://fedoramagazine.org/author/bgilbert/) + +Introducing Fedora CoreOS +====== + +![The Fedora CoreOS logo on a gray background.][1] + +The Fedora CoreOS team is excited to [announce the first preview release][2] of Fedora CoreOS, a new Fedora edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][3] and [CoreOS Container Linux][4]. Fedora CoreOS combines the provisioning tools, automatic update model, and philosophy of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host. + +Read on for more details about this exciting new release. + +### Why Fedora CoreOS? + +Containers allow workloads to be reproducibly deployed to production and automatically scaled to meet demand. The isolation provided by a container means that the host OS can be small. It only needs a Linux kernel, systemd, a container runtime, and a few additional services such as an SSH server. + +While containers can be run on a full-sized server OS, an operating system built specifically for containers can provide functionality that a general purpose OS cannot. Since the required software is minimal and uniform, the entire OS can be deployed as a unit with little customization. And, since containers are deployed across multiple nodes for redundancy, the OS can update itself automatically and then reboot without interrupting workloads. + +Fedora CoreOS is built to be the secure and reliable host for your compute clusters. It’s designed specifically for running containerized workloads without regular maintenance, automatically updating itself with the latest OS improvements, bug fixes, and security updates. It provisions itself with Ignition, runs containers with Podman and Moby, and updates itself atomically and automatically with rpm-ostree. + +### Provisioning immutable infrastructure + +Whether you run in the cloud, virtualized, or on bare metal, a Fedora CoreOS machine always begins from the same place: a [generic OS image][5]. Then, during the first boot, Fedora CoreOS uses _Ignition_ to provision the system. Ignition reads an _Ignition config_ from cloud user data or a remote URL, and uses it to create disk partitions and file systems, users, files and systemd units. + +To provision a machine: + + 1. Write a [Fedora CoreOS Config][6] (FCC), a YAML document that specifies the desired configuration of a machine. FCCs support all Ignition functionality, and also provide additional syntax (“sugar”) that makes it easier to specify typical configuration changes. + 2. Use the [Fedora CoreOS Config Transpiler][7] to [validate your FCC and convert it to an Ignition config][8]. + 3. Launch a Fedora CoreOS machine and [pass it the Ignition config][9]. If the machine boots successfully, provisioning has completed without errors. + + + +Fedora CoreOS is designed to be managed as _immutable infrastructure_. After a machine is provisioned, you should not modify _/etc_ or otherwise reconfigure the machine. Instead, modify the FCC and use it to provision a replacement machine. + +This is similar to how you’d manage a container: container images are not updated in place, but rebuilt from scratch and redeployed. This approach makes it easy to scale out when load increases. Simply use the same Ignition config to launch additional machines. + +### Automatic updates + +By default, Fedora CoreOS automatically downloads new OS releases, atomically installs them, and reboots into them. Releases roll out gradually over time. We can even stop a rollout if we discover a problem in a new release. Upgrades between Fedora releases are treated as any other update, and are automatically applied without user intervention. + +The Linux ecosystem evolves quickly, and software updates can bring undesired behavior changes. However, for automatic updates to be trustworthy, they cannot break existing machines. To avoid this, Fedora CoreOS takes a two-pronged approach. First, we automatically test each change to the OS. However, automatic testing can’t catch all regressions, so Fedora CoreOS also ships multiple independent _release streams_: + + * The _testing_ stream is a regular snapshot of the current Fedora release, plus updates. + * After a _testing_ release has been available for two weeks, it is sent to the _stable_ stream. Bugs discovered in _testing_ will be fixed before a release is sent to _stable_. + * The _next_ stream is a regular snapshot of the upcoming Fedora release, allowing additional time for testing larger changes. + + + +All three streams receive security updates and critical bugfixes, and are intended to be safe for production use. Most machines should run the _stable_ stream, since that receives the most testing. However, users should run a few percent of their nodes on the _next_ and _testing_ streams, and report problems to the [issue tracker][10]. This helps ensure that bugs that only affect certain workloads or certain hardware are fixed before they reach _stable_. + +### Telemetry + +To help direct our development efforts, Fedora CoreOS will perform some telemetry by default. A service called _[fedora-coreos-pinger][11]_ will periodically collect non-identifying information about the machine, such as the OS version, cloud platform, and instance type, and report it to servers controlled by the Fedora project. + +No unique identifiers will be reported or collected, and the data will only be used in aggregate to answer questions about how Fedora CoreOS is being used. We will prominently document that this collection is occurring and how to disable it. We will also tell you how to help the project by reporting additional detail, including information that might identify the machine. + +### Current status of Fedora CoreOS + +Fedora CoreOS is still under active development, and some planned functionality is not available in the first preview release: + + * Only the _testing_ stream currently exists; the _next_ and _stable_ streams are not yet available. + * Several cloud and virtualization platforms are not yet available. Only x86_64 is currently supported. + * Booting a live Fedora CoreOS system via network (PXE) or CD is not yet supported. + * We are actively discussing plans for closer integration with Kubernetes distributions, including OKD. + * Fedora CoreOS Config Transpiler will gain more sugar over time. + * Telemetry is not yet active. + * Documentation is still under development. + + + +**While Fedora CoreOS is intended for production use, preview releases should _not_ be used in production. Fedora CoreOS may change in incompatible ways during the preview period. There is no guarantee that a preview release will successfully update to a later preview release, or to a stable release.** + +### The future + +We expect the preview period to continue for about six months. At the end of the preview, we will declare Fedora CoreOS stable and encourage its use in production. + +CoreOS Container Linux will be maintained until about six months after Fedora CoreOS is declared stable. We’ll announce the exact timing later this year. During the preview period, we’ll publish tools and documentation to help Container Linux users migrate to Fedora CoreOS. + +[Fedora Atomic Host will be maintained][12] until the end of life of Fedora 29, expected in late November. Before then, Fedora Atomic Host users should migrate to Fedora CoreOS. + +### Getting involved in Fedora CoreOS + +To try out the new release, head over to the [download page][5] to get OS images or cloud image IDs. Then use the [quick start guide][13] to get a machine running quickly. Finally, get involved! You can report bugs and missing features to the [issue tracker][10]. You can also discuss Fedora CoreOS in [Fedora Discourse][14], the [development mailing list][15], or in #fedora-coreos on Freenode. + +Welcome to Fedora CoreOS, and let us know what you think! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/introducing-fedora-coreos/ + +作者:[Benjamin Gilbert][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/bgilbert/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/introducing-fedora-coreos-816x345.png +[2]: https://getfedora.org/coreos/ +[3]: https://www.projectatomic.io/ +[4]: https://coreos.com/os/docs/latest/ +[5]: https://getfedora.org/coreos/download/ +[6]: https://github.com/coreos/fcct/blob/master/docs/configuration-v1_0.md +[7]: https://github.com/coreos/fcct/releases +[8]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/#_generating_ignition_configs +[9]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/#_launching_fedora_coreos +[10]: https://github.com/coreos/fedora-coreos-tracker/issues +[11]: https://github.com/coreos/fedora-coreos-pinger/ +[12]: https://fedoramagazine.org/announcing-fedora-coreos/ +[13]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[14]: https://discussion.fedoraproject.org/c/server/coreos +[15]: https://lists.fedoraproject.org/archives/list/coreos@lists.fedoraproject.org/ diff --git a/sources/tech/20190725 24 sysadmin job interview questions you should know.md b/sources/tech/20190725 24 sysadmin job interview questions you should know.md new file mode 100644 index 0000000000..c80bf8f86e --- /dev/null +++ b/sources/tech/20190725 24 sysadmin job interview questions you should know.md @@ -0,0 +1,292 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (24 sysadmin job interview questions you should know) +[#]: via: (https://opensource.com/article/19/7/sysadmin-job-interview-questions) +[#]: author: (DirectedSoul https://opensource.com/users/directedsoul) + +24 sysadmin job interview questions you should know +====== +Have a sysadmin job interview coming up? Read this article for some +questions you might encounter and possible answers. +![Question and answer.][1] + +As a geek who always played with computers, a career after my masters in IT was a natural choice. So, I decided the sysadmin path was the right one. In the process of my career, I have grown quite familiar with the job interview process. Here is a look at what to expect, the general career path, and a set of common questions and my answers to them. + +### Typical sysadmin tasks and duties + +Organizations need someone who understands the basics of how a system works so that they can keep their data safe, and keep their services running smoothly. You might ask: "Wait, isn’t there more that a sysadmin can do?" + +You are right. Now, in general, let’s look at what might be a typical sysadmin’s day-to-day tasks. Depending on their company’s needs and the person’s skill level, a sysadmin’s tasks vary from managing desktops, laptops, networks, and servers, to designing the organization’s IT policies. Sometimes sysadmins are even in charge of purchasing and placing orders for new IT equipment. + +Those seeking system administration as their career paths might find it difficult to keep their skills and knowledge up to date, as rapid changes in the IT field are inevitable. The next natural question that arises out of anyone’s mind is how IT professionals keep up with the latest updates and skills. + +### Low difficulty questions + +Here are some of the more basic questions you will encounter, and my answers: + + 1. What are the first five commands you type on a *nix server after login? + + + +> * **lsblk** to see information on all block devices +> * **who** to see who is logged into the server +> * **top** to get a sense of what is running on the server +> * **df -khT** to view the amount of disk space available on the server +> * **netstat** to see what TCP network connections are active +> + + + 2. How do you make a process run in the background, and what are the advantages of doing so? + + + +> You can make a process run in the background by adding the special character **&** at the end of the command. Generally, applications that take too long to execute, and don’t require user interaction are sent to the background so that we can continue our work in the terminal. ([Citation][2]) + + 3. Is running these commands as root a good or bad idea? + + + +> Running (everything) as root is bad due to two major issues. The first is _risk_. Nothing prevents you from making a careless mistake when you are logged in as **root**. If you try to change the system in a potentially harmful way, you need to use **sudo**, which introduces a pause (while you’re entering the password) to ensure that you aren’t about to make a mistake. +> +> The second reason is _security_. Systems are harder to hack if you don’t know the admin user’s login information. Having access to root means you already have one half of the working set of admin credentials. + + 4. What is the difference between **rm** and **rm -rf**? + + + +> The **rm** command by itself only deletes the named files (and not directories). With **-rf** you add two additional features: The **-r**, **-R**, or --**recursive** flag recursively deletes the directory’s contents, including hidden files and subdirectories, and the **-f**, or --**force**, flag makes **rm** ignore nonexistent files, and never prompt for confirmation. + + 5. **Compress.tgz** has a file size of approximately 15GB. How can you list its contents, and how do you list them only for a specific file? + + + +> To list the file’s contents: +> +> **tar tf archive.tgz** +> +> To extract a specific file: +> +> **tar xf archive.tgz filename** + +### Medium difficulty questions + +Here are some harder questions you might encounter, and my answers: + + 6. What is RAID? What is RAID 0, RAID 1, RAID 5, RAID 6, and RAID 10? + + + +> A RAID (Redundant Array of Inexpensive Disks) is a technology used to increase the performance and/or reliability of data storage. The RAID levels are: +> +> * RAID 0: Also known as disk striping, which is a technique that breaks up a file, and spreads the data across all of the disk drives in a RAID group. There are no safeguards against failure. ([Citation][3]) +> * RAID 1: A popular disk subsystem that increases safety by writing the same data on two drives. Called _mirroring_, RAID1 does not increase write performance, but read performance may increase up to the sum of each disks’ performance. Also, if one drive fails, the second drive is used, and the failed drive is manually replaced. After replacement, the RAID controller duplicates the contents of the working drive onto the new one. +> * RAID 5: A disk subsystem that increases safety by computing parity data and increasing speed. RAID 5 does this by interleaving data across three or more drives (striping). Upon failure of a single drive, subsequent reads can be calculated from the distributed parity such that no data is lost. +> * RAID 6: Which extends RAID 5 by adding another parity block. This level requires a minimum of four disks, and can continue to execute read/write with any two concurrent disk failures. RAID 6 does not have a performance penalty for reading operations, but it does have a performance penalty on write operations because of the overhead associated with parity calculations. +> * RAID 10: Also known as RAID 1+0, RAID 10 combines disk mirroring and disk striping to protect data. It requires a minimum of four disks, and stripes data across mirrored pairs. As long as one disk in each mirrored pair is functional, data can be retrieved. If two disks in the same mirrored pair fail, all data will be lost because there is no parity in the striped sets. ([Citation][4]) +> + + + 7. Which port is used for the **ping** command? + + + +> The **ping** command uses ICMP. Specifically, it uses ICMP echo requests and ICMP echo reply packets. +> +> ICMP does not use either UDP or TCP communication services: Instead, it uses raw IP communication services. This means that the ICMP message is carried directly in an IP datagram data field. + + 8. What is the difference between a router and a gateway? What is the default gateway? + + + +> _Router_ describes the general technical function (layer 3 forwarding), or a hardware device intended for that purpose, while _gateway_ describes the function for the local segment (providing connectivity to elsewhere). You could also state that you "set up a router as a gateway." Another term is _hop_, which describes forwarding between subnets. +> +> The term _default gateway_ is used to mean the router on your LAN, which has the responsibility of being the first point of contact for traffic to computers outside the LAN. + + 9. Explain the boot process for Linux. + + + +> BIOS -> Master Boot Record (MBR) -> GRUB -> the kernel -> init -> runlevel + + 10. How do you check the error messages while the server is booting up? + + + +> Kernel messages are always stored in the kmsg buffer, visible via the **dmesg** command. +> +> Boot issues and errors call for a system administrator to look into certain important files, in conjunction with particular commands, which are each handled differently by different versions of Linux: +> +> * **/var/log/boot.log** is the system boot log, which contains all that unfolded during the system boot. +> * **/var/log/messages** stores global system messages, including the messages logged during system boot. +> * **/var/log/dmesg** contains kernel ring buffer information. +> + + + 11. What is the difference between a symbolic link and a hard link? + + + +> A _symbolic_ or _soft link_ is an actual link to the original file, whereas a _hard link_ is a mirror copy of the original file. If you delete the original file, the soft link has no value, because it then points to a non-existent file. In the case of a hard link, it is entirely the opposite. If you delete the original file, the hard link still contains the data from the original file. ([Citation][5]) + + 12. How do you change kernel parameters? What kernel options might you need to tune? + + + +> To set the kernel parameters in Unix-like systems, first edit the file **/etc/sysctl.conf**. After making the changes, save the file and run the **sysctl -p** command. This command makes the changes permanent without rebooting the machine + + 13. Explain the **/proc** filesystem. + + + +> The **/proc** filesystem is virtual, and provides detailed information about the kernel, hardware, and running processes. Since **/proc** contains virtual files, it is called the _virtual file system_. These virtual files have unique qualities. Most of them are listed as zero bytes in size. +> +> Virtual files such as **/proc/interrupts**, **/proc/meminfo**, **/proc/mounts** and **/proc/partitions** provide an up-to-the-moment glimpse of the system’s hardware. Others, such as **/proc/filesystems** and the **/proc/sys** directory provide system configuration information and interfaces. + + 14. How do you run a script as another user without their password? + + + +> For example, if you were editing the sudoers file (such as **/private/etc/sudoers**), you might use **visudo** to add the following: +> +> [**user1 ALL=(user2) NOPASSWD: /opt/scripts/bin/generate.sh**][2] + + 15. What is the UID 0 toor account? Have you been compromised? + + + +> The toor user is an alternative superuser account, where toor is root spelled backward. It is intended to be used with a non-standard shell, so the default shell for root does not need to change. +> +> This purpose is important. Shells which are not part of the base distribution, but are instead installed from ports or packages, are installed in **/usr/local/bin**; which, by default, resides on a different file system. If root’s shell is located in **/usr/local/bin** and the file system containing **/usr/local/bin** is not mounted, root could not log in to fix a problem, and the sysadmin would have to reboot into single-user mode to enter the shell’s path. + +### Advanced questions + +Here are the even more difficult questions you may encounter: + + 16. How does **tracert** work and what protocol does it use? + + + +> The command **tracert**—or **traceroute** depending on the operating system—allows you to see exactly what routers you touch as you move through the chain of connections to your final destination. If you end up with a problem where you can’t connect to or **ping** your final destination, a **tracert** can help in that you can tell exactly where the chain of connections stops. ([Citation][6]) +> +> With this information, you can contact the correct people; whether it be your own firewall, your ISP, your destination’s ISP, or somewhere in the middle. The **tracert** command—like **ping**—uses the ICMP protocol, but also can use the first step of the TCP three-way handshake to send SYN requests for a response. + + 17. What is the main advantage of using **chroot**? When and why do we use it? What is the purpose of the **mount /dev**, **mount /proc**, and **mount /sys** commands in a **chroot** environment?  + + + +> An advantage of having a **chroot** environment is that the filesystem is isolated from the physical host, since **chroot** has a separate filesystem inside your filesystem. The difference is that **chroot** uses a newly created root (**/**) as its root directory. +> +> A **chroot** jail lets you isolate a process and its children from the rest of the system. It should only be used for processes that don’t run as **root**, as **root** users can break out of the jail easily. +> +> The idea is that you create a directory tree where you copy or link in all of the system files needed for the process to run. You then use the **chroot()** system call to tell it the root directory now exists at the base of this new tree, and then start the process running in that **chroot**’d environment. Since the command then can’t reference paths outside the modified root directory, it can’t perform operations (read, write, etc.) maliciously on those locations. ([Citation][7]) + + 18. How do you protect your system from getting hacked? + + + +> By following the principle of least privileges and these practices: +> +> * Encrypt with public keys, which provides excellent security. +> * Enforce password complexity. +> * Understand why you are making exceptions to the rules above. +> * Review your exceptions regularly. +> * Hold someone to account for failure. (It keeps you on your toes.) ([Citation][8]) +> + + + 19. What is LVM, and what are the advantages of using it? + + + +> LVM, or Logical Volume Management, uses a storage device management technology that gives users the power to pool and abstract the physical layout of component storage devices for easier and flexible administration. Using the device mapper Linux kernel framework, the current iteration (LVM2) can be used to gather existing storage devices into groups and allocate logical units from the combined space as needed. + + 20. What are sticky ports? + + + +> Sticky ports are one of the network administrator’s best friends and worst headaches. They allow you to set up your network so that each port on a switch only permits one (or a number that you specify) computer to connect on that port, by locking it to a particular MAC address. + + 21. Explain port forwarding? + + + +> When trying to communicate with systems on the inside of a secured network, it can be very difficult to do so from the outside—and with good reason. Therefore, the use of a port forwarding table within the router itself, or other connection management device, can allow specific traffic to automatically forward to a particular destination. For example, if you had a web server running on your network and you wanted to grant access to it from the outside, you would set up port forwarding to port 80 on the server in question. This would mean that anyone entering your IP address in a web browser would connect to the server’s website immediately. +> +> Please note, it is usually not recommended to allow access to a server from the outside directly into your network. + + 22. What is a false positive and false negative in the case of IDS? + + + +> When the Intrusion Detection System (IDS) device generates an alert for an intrusion which has actually not happened, this is false positive. If the device has not generated any alert and the intrusion has actually happened, this is the case of a false negative. + + 23. Explain **:(){ :|:& };:** and how to stop this code if you are already logged into the system? + + + +> This is a fork bomb. It breaks down as follows: +> +> * **:()** defines the function, with **:** as the function name, and the empty parenthesis shows that it will not accept any arguments. +> * **{ }** shows the beginning and end of the function definition. +> * **:|:** loads a copy of the function **:** into memory, and pipes its output to another copy of the **:** function, which also has to be loaded into memory. +> * **&** makes the previous item a background process, so that the child processes will not get killed even though the parent gets auto-killed. +> * **:** at the end executes the function again, and hence the chain reaction begins. +> + +> +> The best way to protect a multi-user system is to use Privileged Access Management (PAM) to limit the number of processes a user can use. +> +> The biggest problem with a fork bomb is the fact it takes up so many processes. So, we have two ways of attempting to fix this if you are already logged into the system. One option is to execute a SIGSTOP command to stop the process, such as: +> +> **killall -STOP -u user1** +> +> If you can’t use the command line due to all processes being used, you will have to use **exec** to force it to run: +> +> **exec killall -STOP -u user1** +> +> With fork bombs, your best option is preventing them from becoming too big of an issue in the first place + + 24. What is OOM killer and how does it decide which process to kill first? + + + +> If memory is exhaustively used up by processes to the extent that possibly threatens the system’s stability, then the out of memory (OOM) killer comes into the picture. +> +> An OOM killer first has to select the best process(es) to kill. _Best_ here refers to the process which will free up the maximum memory upon being killed, and is also the least important to the system. The primary goal is to kill the least number of processes to minimize the damage done, and at the same time maximize the amount of memory freed. +> +> To facilitate this goal, the kernel maintains an oom_score for each of the processes. You can see the oom_score of each of the processes in the **/proc** filesystem under the **pid** directory: +> +> **$ cat /proc/10292/oom_score** +> +> The higher the value of oom_score for any process, the higher its likelihood is of being killed by the OOM Killer in an out-of-memory situation. ([Citation][9]) + +### Conclusion + +System administration salaries have a [wide range][10] with some sites mentioning $70,000 to $100,000 a year, depending on the location, the size of the organization, and your education level plus years of experience. In the end, the system administration career path boils down to your interest in working with servers and solving cool problems. Now, I would say go ahead and achieve your dream path. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/sysadmin-job-interview-questions + +作者:[DirectedSoul][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/directedsoul +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_HowToFish_520x292.png?itok=DHbdxv6H (Question and answer.) +[2]: https://github.com/trimstray/test-your-sysadmin-skills +[3]: https://www.waytoeasylearn.com/2016/05/netapp-filer-tutorial.html +[4]: https://searchstorage.techtarget.com/definition/RAID-10-redundant-array-of-independent-disks +[5]: https://www.answers.com/Q/What_is_hard_link_and_soft_link_in_Linux +[6]: https://www.wisdomjobs.com/e-university/network-administrator-interview-questions.html +[7]: https://unix.stackexchange.com/questions/105/chroot-jail-what-is-it-and-how-do-i-use-it +[8]: https://serverfault.com/questions/391370/how-to-prevent-zero-day-attacks +[9]: https://unix.stackexchange.com/a/153586/8369 +[10]: https://blog.netwrix.com/2018/07/23/systems-administrator-salary-in-2018-how-much-can-you-earn/ diff --git a/sources/tech/20190726 The Future Of Red Hat At IBM.md b/sources/tech/20190726 The Future Of Red Hat At IBM.md new file mode 100644 index 0000000000..72cfc84a65 --- /dev/null +++ b/sources/tech/20190726 The Future Of Red Hat At IBM.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Future Of Red Hat At IBM) +[#]: via: (https://www.linux.com/blog/future-red-hat-ibm) +[#]: author: (Swapnil Bhartiya https://www.linux.com/users/swapnil) + +The Future Of Red Hat At IBM +====== + +![][1] + +[Creative Commons Attribution-NonCommercial-NoDerivs][2] + +Swapnil Bhartiya + +IBM has a long history of [working with the open source community][3]. Way back in 1999, [IBM announced a $1billion investment in Linux][4]. IBM is also credited for creating one of the [most innovative advertisements about Linux.][5] But IBM’s acquisition of Red Hat raised some serious and genuine questions around IBM’s commitment to Open Source and the future of Red Hat at the big blue. + +Red Hat CTO, Chris Wright, took it upon himself to address some of these concerns and answer people’s questions in [an AMA (Ask Me Anything) on Reddit.][6] Wright has evolved from being a Linux kernel developer to becoming the CTO of the world’s largest open source company. He has his pulse on both the business and community sides of the open source world. + +**Red vs Blue:** Some of the most pressing questions asked during the AMA were around the future of open source and Red Hat at IBM. Red Hat has its unique identity and branding. You will often see people walking with their red hats on at open source events, you may even notice some permanent tattoos. + +One Redditor asked if there were any plans to overhaul Red Hat branding to make it blue or purple, Wright said, “No, Red Hat is Red. We just announced the evolution of our logo in May, no plans for any other changes. We like the new logo and so do the associates who already got tattoos of it!” + +**Kubernetes:** A Redditor asked about the future of Red Hat OpenShift and OKD (the Origin community distribution of Kubernetes). Wright assured that the acquisition doesn’t have any effect on OpenShift and OKD. Wright said that Red Hat is focused on delivering the industry’s most comprehensive enterprise Kubernetes platform – OpenShift - without changes.  + +As far as community engagement is concerned, “…upstream first development in Kubernetes and community ecosystem development in OKD are part of our product development process. Neither of those change,” he said. “The IBM acquisition can help accelerate the adoption of OpenShift given the increasing scale and reach in sales and services that IBM has.” + +**Conflict of Culture:** IBM and Red Hat are two companies with different, and often conflicting cultures. While Red Hat employees are allowed and encouraged to contribute to open Source, IBMers do not have the same level of freedom. One ex-IBMer asked, “IBM has traditionally had very strict policies regarding contributing to non-IBM open source projects. I understand that Red Hat's culture is quite different in this regard; do you see IBM loosening up in this regard? Or will only the Red Hat division operate differently?” + +Wright said that Red Hat would continue to operate the way it does with respect to allowing Red Hatters to contribute to open source projects.  + +IBM’s CTO of Open Source, Chris Ferris pitched in and said that for the past 5 years or so, the policy for IBMers contributing to open source on their own time was relaxed such that they could do so with their manager’s permission.  + +“In fact, we have been on a steady trend over the past 5 years or more to reduce the process barriers to both contributing to, and consuming open source and we continue to review our policies periodically. With the acquisition now complete, IBM has chosen to adopt the same policy towards contributing to open source on one’s own time as Red Hat has had historically. This is one important way that the Red Hat culture has benefited IBM developers.” + +Adam Kaplan, Senior Software Engineer at Red Hat, contributed to the AMA and said that Red Hat employees are free to contribute as they see fit, even if a said contribution goes against Red Hat's business objectives. + +**Future of Fedora & Gnome:** Red Hat is among the leading contributors to many open source projects that are being used by the larger open source community. Some Redditors expressed fear about the future of such projects that won’t be bringing in any revenue for IBM. + +One user asked about Fedora, which is the upstream for Red Hat Enterprise Linux. Wright assured that Fedora and its path stays the same. “It is an important community Linux distribution and Red Hat's involvement will continue to be the same.” + +Red Hat is one of the major contributors to Gnome, one of the biggest desktop environments for Linux and BSD. When asked about the future of Gnome, Wright said that nothing will change. “Certainly not to what we have contributed. More importantly, our future contributions will follow the same pattern,” he said. “We contribute to open source projects that are part of our product portfolio and focus on the areas that are important to our customers, which includes not just features but also long term maintainability (this becomes important in a codebase when you talk about architectural changes).” + +**Sunset at Oracle:** Some Redditors drew a comparison with Oracle’s acquisition of Sun Microsystems. “I guess the biggest concern among the “Linux community” in general is that Red Hat might go down the path Solaris did after Oracle's acquisition. IBM is viewed as an old school company, a bit like Oracle in that sense. We have learned through press that IBM's plan is to use Red Hat to change IBMs perception and not the other way around. Hope it's true. How do you guys plan on addressing such concerns? + +Wright said that Red Hat would continue to run as an independent company and the team would continue to do what it does best: engage with customers, partners, and open source communities to build open-source solutions.  + +“Those solutions focus on our hybrid cloud strategy. A key part of the acquisition is for IBM and Red Hat to work closely together to advance our customers’ journeys to an open hybrid cloud. You’ve seen mention of IBM’s plans to use Red Hat platforms as part of their offerings, so this is the other key piece here.  We stay independent, we share a vision, and IBM is building from our core platforms,” he said. + +Addressing a similar question that IBM has a history of buying companies and then breaking them up, Wright said, Red Hat will remain committed to the upstream work it does across the board.  “It is a fundamental part of how we develop our software products. Things like Network Manager create desktop usability, and can even be the impetus behind more core distro improvements. The IBM acquisition doesn’t change this at all. I see the future of Red Hat as staying focused on our core mission and continuing to evolve with (upstream first!) open source and our customer's needs,” he said. + +**IBM nukes all Open Source at Red Hat**: One Redditor asked what stops IBM from going nuclear and dismantling all of the open source work Red Hat has done?  + +Wright said that the reality of software is that open source has become the de facto means by which software is developed. “I often refer to this historic acquisition as an acknowledgment that open source has won. So, a simple way to look at this is the $34b value is about how important open source is to IBM’s strategy...again, open source has won!” he said, “Another way to look at it is the value that we’ve created with Red Hat is synonymous with open source. We wouldn’t exist without open source, it’s core to our strategy. And we (both Red Hat and IBM) are deeply vested in Red Hat’s continued success.” + +**Take Away** + +People should remember that by design, open source is protected from any such risk. If a company gets acquired and the code is at risk of being nuked, the community can fork the project and maintain it. Life goes on. Since everything that Red Hat does is open source, people can always take the code-base and maintain it themselves. open source code has escape velocities, it doesn’t go away with the companies that built it. + +After reading the entire AMA, it’s fair to conclude that Red Hat is safe in the hands of IBM. It’s like a drop of color in a glass of water. The entire glass of water turns red. Red Hat has a very strong community-driven, open source culture. It’s very likely that IBM will be the one benefitting and transforming into an even more open source friendly company. + +Rumor has it that one day Red Hat CEO Jim Whitehurst might become the CEO of IBM. When a Redditor asked the same question, whether Whitehurst will succeed Ginni Rometty as the CEO, Wright said, “I certainly don’t have a crystal ball, but I think Jim is a great CEO!” + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/future-red-hat-ibm + +作者:[Swapnil Bhartiya][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/swapnil +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dsc_7800.jpg?itok=Ch1vMOHq (Jim Whitehurst) +[2]: https://www.linux.com/licenses/category/creative-commons-attribution-noncommercial-noderivs +[3]: https://www-03.ibm.com/press/us/en/pressrelease/2262.wss +[4]: https://en.wikipedia.org/wiki/Linux_Technology_Center +[5]: https://www.youtube.com/watch?v=s7dTjpvakmA +[6]: https://www.reddit.com/r/linux/comments/cgu6aj/chris_wright_cto_of_red_hat_is_hosting_an_ama_at/ diff --git a/sources/tech/20190726 What does it mean to be a sysadmin hero.md b/sources/tech/20190726 What does it mean to be a sysadmin hero.md new file mode 100644 index 0000000000..bc3148eb63 --- /dev/null +++ b/sources/tech/20190726 What does it mean to be a sysadmin hero.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What does it mean to be a sysadmin hero?) +[#]: via: (https://opensource.com/article/19/7/sysadmin-heroics-saving-day) +[#]: author: (Opensource.com https://opensource.com/users/admin) + +What does it mean to be a sysadmin hero? +====== +Two stories from the community on sysadmin heroics: What does it mean to +you? +![Open Force superhero characters][1] + +Sysadmins spend a lot of time preventing and fixing problems. There are certainly times when a sysadmin becomes a hero, whether to their team, department, company, or the general public, though the people they "saved" from trouble may never even know. + +Enjoy these two stories from the community on sysadmin heroics. What does it mean to you? + +* * * + +I worked as a system administrator for a contract with the Army National Guard in the early 2000s. I was involved in a project to pilot a new content management system. This system would enable distribution of online educational materials to classrooms across the country. The state of Montana was chosen for the initial pilot and test phase. I traveled to Montana and deployed several servers running Red Hat Linux plus the content management software in their data centers. + +A few days later, I received a call at my regular office from a worried guardsman with urgent news. One of the servers would not boot. Due to the circumstances, there was no way to easily troubleshoot. + +The testing was scheduled to commence the following week, which left little time to get the server back online. A delay in the project would be costly. I needed to solve the problem fast. Fortunately, we had several identical servers in our local data center. I used one of them to reinstall the operating system and applications, and then configured it identically to the problem server back in Montana. I then pulled the hard drive, packed it safely, and overnighted it to the Montana National Guard Armory. + +The guardsman called me the next morning to say he had the replacement drive. I instructed him on how to remove and replace the boot drive. After doing so, he pressed the power button. We waited for several silent seconds before he informed me that he could see lights and hear the sound of drive activity. I began pinging the server and after a few positive responses, I was able to SSH into it. This was a great sign! + +Everyone was relieved that the server was online again so that testing could get underway. + +If you want to know more about this program, [there is an article here][2]. (It takes a really long time to load for some reason, so I saved it as a PDF just in case.)  + +—_Alan Formy-Duval_ + +* * * + +Humans love good stories. In IT, stories about heroic feats of coding and cabling go back to the first computers and the bugs that lived inside them. They’re all loved. They’re loved more if the audience wasn’t part of the fallout of what created the story. + +Sysadmins tend to be left holding the bag when events turn sour. That fact affords us the often unwanted honor of being cast as the protagonist for one of these stories. Antagonists can be anything from bad weather or dug up cables, to mistyped commands, or simply human error. Because we operate in an industry built around generated conflict and drama, the legendary epics in our industry usually involve sysadmins battling the thoughtless developer. It’s an old trope, but a good one that gets lots of laughs and amazed stares when the stories are told. + +I’ve always been someone who’s loved to share these stories with my peers and friends. The camaraderie and the laughs are important to me. These stories are ice breakers and scene closers when on stage, in a conference room, or just when having a beer with your friends after a hard day. But this year, I’ve begun to think about our storytelling tradition a little differently. The heroes we should be talking about around the water cooler aren’t the sysadmins who fix the problem with a flourish at 3am on Sunday. The true heroes in the industry are the sysadmins who prevent the problem from ever happening at 3pm on a Tuesday. + +When I talk to my customers about building effective solutions, I focus the conversation around two core principles. First, I implore them to not rabbit hole themselves with shiny objects and base their solution around proven, supportable technology. Yes, shiny new tech can provide value in some use cases. But most likely it just adds complexity that drives down stability and maintainability. These factors all work together to ultimately slow down adoption by their end users. + +Platforms that don’t grow are platforms that don’t last. I don’t want to work on a platform that won’t be around for its first upgrade. Violating this principle creates systems that require Herculean efforts to keep alive. No one benefits from that situation, even if you do get a good story out of it. + +The second principle I drive home every time I get a chance is to focus on fundamental knowledge, and understand how the technology we’re implementing actually works. We’ve focused for a long time in our industry on marketing our products as fast to deploy, and easy to manage, but that’s almost always a thin veneer. Every IT system designed by humans will ultimately break at some point in its lifecycle. If you don’t understand what’s happening when that system goes sideways, you don’t have a chance of recovering without writing a new saga to talk about at lunch for weeks to come. + +It took me much longer than I’m comfortable with to figure out that the same hero stories we all enjoyed are a result of not sticking to the fundamental principles that I value the most in any solution I have a hand in creating. So, when Sysadmin Day rolls around this year, I won’t be lifting my glass to the heroes who built a bad system and kept it alive through extreme circumstances and too much caffeine. I’ll tip my hat and share a drink with the boring people in the middle of our industry who specialize in preventing the hero moments. A boring weekend with the on-call phone is the most heroic thing I’m ever going to ask from my sysadmin brethren from now on. + +_—Jamie Duncan_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/sysadmin-heroics-saving-day + +作者:[Opensource.com][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/admin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/superhero_character_open_force.jpg?itok=cndIf6Zw (Open Force superhero characters) +[2]: https://gcn.com/Articles/2002/01/18/National-Guard-will-test-distancelearning-standard.aspx diff --git a/sources/tech/20190729 3 commands to reboot Linux (plus 4 more ways to do it safely).md b/sources/tech/20190729 3 commands to reboot Linux (plus 4 more ways to do it safely).md new file mode 100644 index 0000000000..4cc9cf417e --- /dev/null +++ b/sources/tech/20190729 3 commands to reboot Linux (plus 4 more ways to do it safely).md @@ -0,0 +1,262 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 commands to reboot Linux (plus 4 more ways to do it safely)) +[#]: via: (https://opensource.com/article/19/7/reboot-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/sethhttps://opensource.com/users/greg-phttps://opensource.com/users/greg-phttps://opensource.com/users/sethhttps://opensource.com/users/cldxsolutions) + +3 commands to reboot Linux (plus 4 more ways to do it safely) +====== +Learn how to reboot Linux through many different methods, from the GUI +to deep within the command line. +![Tux with binary code background][1] + +Linux is fully capable of running not weeks, but years, without a reboot. In some industries, that’s exactly what Linux does, thanks to advances like **kpatch** and **kgraph**. + +For laptop and desktop users, though, that metric is a little extreme. While it may not be a day-to-day reality, it’s at least a weekly reality that sometimes you have a good reason to reboot your machine. And for a system that doesn’t need rebooting often, Linux offers plenty of choices for when it’s time to start over. + +### Understand your options + +Before continuing though, a note on rebooting. Rebooting is a unique process on each operating system. Even within [POSIX][2] systems, the commands to power down and reboot may behave differently due to different initialization systems or command designs. + +Despite this factor, two concepts are vital. First, rebooting is rarely requisite on a POSIX system. Your Linux machine can operate for weeks or months at a time without a reboot if that’s what you need. There’s no need to "freshen up" your computer with a reboot unless specifically advised to do so by a software installer or updater. Then again, it doesn’t hurt to reboot, either, so it’s up to you. + +Second, rebooting is meant to be a friendly process, allowing time for programs to exit, files to be saved, temporary files to be removed, filesystem journals updated, and so on. Whenever possible, reboot using the intended interfaces, whether in a GUI or a terminal. If you force your computer to shut down or reboot, you risk losing unsaved and even recently-saved data, and even corrupting important system information; you should only ever force your computer off when there’s no other option**.** + +### Click the button + +The first way to reboot or shut down Linux is the most common one, and the most intuitive for most desktop users regardless of their OS: It’s the power button in the GUI. Since powering down and rebooting are common tasks on a workstation, you can usually find the power button (typically with reboot and shut down options) in a few different places. On the GNOME desktop, it's in the system tray:  + +![The GNOME power button.][3] + +It’s also in the GNOME **Activities** menu: + +![The GNOME Activities menu power button.][4] + +On the KDE desktop, the power buttons can be found in the **Applications** menu: + +![The KDE power buttons via the Applications menu.][5] + +You can also access the KDE power controls by right-clicking on the desktop and selecting the **Leave** option, which opens the window you see here: + +![The KDE power buttons via the Leave option.][6] + +Other desktops provide variations on these themes, but the general idea is the same: use your mouse to locate the power button, and then click it. You may have to select between rebooting and powering down, but in the end, the result is nearly identical: Processes are stopped, nicely, so that data is saved and temporary files are removed, then data is synchronized to drives, and then the system is powered down. + +### Push the physical button + +Most computers have a physical power button. If you press that button, your Linux desktop may display a power menu with options to shut down or reboot. This feature is provided by the [Advanced Configuration and Power Interface (ACPI)][7] subsystem, which communicates with your motherboard’s firmware to control your computer’s state. + +ACPI is important but it’s limited in scope, so there’s not much to configure from the user’s perspective. Usually, ACPI options are generically called **Power** and are set to a sane default. If you want to change this setup, you can do so in your system settings. + +On GNOME, open the system tray menu and select **Activities**, and then **Settings.** Next, select the **Power** category in the left column, which opens the following menu: + +![GNOME’s power button settings.][8] + +In the **Suspend & Power Button** section, select what you want the physical power button to do. + +The process is similar across desktops. For instance, on KDE, the **Power Management** panel in **System Settings** contains an option for **Button Event Handling.** + +* * * + +* * * + +* * * + +**![KDE Power Management][9]** + +* * * + +* * * + +* * * + +**opensource.com** + +After you configure how the button event is handled, pressing your computer’s physical power button follows whatever option you chose. Depending on your computer vendor (or parts vendors, if you build your own), a button press might be a light tap, or it may require a slightly longer push, so you might have to do some tests before you get the hang of it. + +Beware of an over-long press, though, since it may shut your computer down without warning. + +### Run the systemctl command + +If you operate more in a terminal than in a GUI desktop, you might prefer to reboot with a command. Broadly speaking, rebooting and powering down are processes of the _init_ system—the sequence of programs that bring a computer up or down after a power signal (either on or off, respectively) is received. + +On most modern Linux distributions, **systemd** is the init system, so both rebooting and powering down can be performed through the **systemd** user interface, **systemctl**. The **systemctl** command accepts, among many other options, **halt** (halts disk activity but does not cut power) **reboot** (halts disk activity and sends a reset signal to the motherboard) and **poweroff** (halts disk acitivity, and then cut power). These commands are mostly equivalent to starting the target file of the same name. + +For instance, to trigger a reboot: + + +``` +`$ sudo systemctl start reboot.target` +``` + +### Run the shutdown command + +Traditional UNIX, before the days of **systemd** (and for some Linux distributions, like [Slackware][10], that’s _now_), there were commands specific to stopping a system. The **shutdown** command, for instance, can power down your machine, but it has several options to control exactly what that means. + +This command requires a time argument, in minutes, so that **shutdown** knows when to execute. To reboot immediately, append the **-r** flag: + + +``` +`$ sudo shutdown -r now` +``` + +To power down immediately: + + +``` +`$ sudo shutdown -P now` +``` + +Or you can use the **poweroff** command: + + +``` +`$ poweroff` +``` + +To reboot after 10 minutes: + + +``` +`$ sudo shutdown -r 10` +``` + +The **shutdown** command is a safe way to power off or reboot your computer, allowing disks to sync and processes to end. This command prevents new logins within the final 5 minutes of shutdown commencing, which is particularly useful on multi-user systems. + +On many systems today, the **shutdown** command is actually just a call to **systemctl** with the appropriate reboot or power off option. + +### Run the reboot command + +The **reboot** command, on its own, is basically a shortcut to **shutdown -r now**. From a terminal, this is the easiest and quickest reboot command: + + +``` +`$ sudo reboot` +``` + +If your system is being blocked from shutting down (perhaps due to a runaway process), you can use the **\--force** flag to make the system shut down anyway. However, this option skips the actual shutting down process, which can be abrupt for running processes, so it should only be used when the **shutdown** command is blocking you from powering down. + +On many systems, **reboot** is actually a call to **systemctl** with the appropriate reboot or power off option. + +### Init + +On Linux distributions without **systemd**, there are up to 7 runlevels your computer understands. Different distributions can assign each mode uniquely, but generally, 0 initiates a halt state, and 6 initiates a reboot (the numbers in between denote states such as single-user mode, multi-user mode, a GUI prompt, and a text prompt). + +These modes are defined in **/etc/inittab** on systems without **systemd**. On distributions using **systemd** as the init system, the **/etc/inittab** file is either missing, or it’s just a placeholder. + +The **telinit** command is the front-end to your init system. If you’re using **systemd**, then this command is a link to **systemctl** with the appropriate options. + +To power off your computer by sending it into runlevel 0: + + +``` +`$ sudo telinit 0` +``` + +To reboot using the same method: + + +``` +`$ sudo telinit 6` +``` + +How unsafe this command is for your data depends entirely on your init configuration. Most distributions try to protect you from pulling the plug (or the digital equivalent of that) by mapping runlevels to friendly commands. + +You can see for yourself what happens at each runlevel by reading the init scripts found in **/etc/rc.d** or **/etc/init.d**, or by reading the **systemd** targets in **/lib/systemd/system/**. + +### Apply brute force + +So far I’ve covered all the _right_ ways to reboot or shut down your Linux computer. To be thorough, I include here additional methods of bringing down a Linux computer, but by no means are these methods recommended. They aren’t designed as a daily reboot or shut down command (**reboot** and **shutdown** exist for that), but they’re valid means to accomplish the task. + +If you try these methods, try them in a virtual machine. Otherwise, use them only in emergencies. + +#### Proc + +A step lower than the init system is the **/proc** filesystem, which is a virtual representation of nearly everything happening on your computer. For instance, you can view your CPUs as though they were text files (with **cat /proc/cpuinfo**), view how much power is left in your laptop’s battery, or, after a fashion, reboot your system. + +There’s a provision in the Linux kernel for system requests (**Sysrq** on most keyboards). You can communicate directly with this subsystem using key combinations, ideally regardless of what state your computer is in; it gets complex on some keyboards because the **Sysrq** key can be a special function key that requires a different key to access (such as **Fn** on many laptops). + +An option less likely to fail is using **echo** to insert information into **/proc**, manually. First, make sure that the Sysrq system is enabled: + + +``` +`$ sudo echo 1 > /proc/sys/kernel/sysrq` +``` + +To reboot, you can use either **Alt**+**Sysrq**+**B** or type: + + +``` +`$ sudo echo b > /proc/sysrq-trigger` +``` + +This method is not a reasonable way to reboot your machine on a regular basis, but it gets the job done in a pinch. + +#### Sysctl + +Kernel parameters can be managed during runtime with **sysctl**. There are lots of kernel parameters, and you can see them all with **sysctl --all**. Most probably don’t mean much to you until you know what to look for, and in this case, you’re looking for **kernel.panic**. + +You can query kernel parameters using the **-–value** option: + + +``` +`$ sudo sysctl --value kernel.panic` +``` + +If you get a 0 back, then the kernel you’re running has no special setting, at least by default, to reboot upon a kernel panic. That situation is fairly typical since rebooting immediately on a catastrophic system crash makes it difficult to diagnose the cause of the crash. Then again, systems that need to stay on no matter what might benefit from an automatic restart after a kernel failure, so it’s an option that does get switched on in some cases. + +You can activate this feature as an experiment (if you’re following along, try this in a virtual machine rather than on your actual computer): + + +``` +`$ sudo sysctl kernel.reboot=1` +``` + +Now, should your computer experience a kernel panic, it is set to reboot instead of waiting patiently for you to diagnose the problem. You can test this by simulating a catastrophic crash with **sysrq**. First, make sure that Sysrq is enabled: + + +``` +`$ sudo echo 1 > /proc/sys/kernel/sysrq` +``` + +And then simulate a kernel panic: + + +``` +`$ sudo echo c > /proc/sysrq-trigger` +``` + +Your computer reboots immediately. + +### Reboot responsibly + +Knowing all of these options doesn't mean that you should use them all. Give careful thought to what you're trying to accomplish, and what the command you've selected will do. You don't want to damage your system by being reckless. That's what virtual machines are for. However, having so many options means that you're ready for most situations. + +Have I left out your favorite method of rebooting or powering down a system? List what I’ve missed in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/reboot-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/sethhttps://opensource.com/users/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/sethhttps://opensource.com/users/greg-phttps://opensource.com/users/greg-phttps://opensource.com/users/sethhttps://opensource.com/users/cldxsolutions +[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/sites/default/files/uploads/gnome-menu-power.jpg (The GNOME power button.) +[4]: https://opensource.com/sites/default/files/uploads/gnome-screen-power.jpg (The GNOME Activities menu power button.) +[5]: https://opensource.com/sites/default/files/uploads/kde-menu-power.jpg (The KDE power buttons via the Applications menu.) +[6]: https://opensource.com/sites/default/files/uploads/kde-screen-power.jpg (The KDE power buttons via the Leave option.) +[7]: https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface +[8]: https://opensource.com/sites/default/files/uploads/gnome-settings-power.jpg (GNOME’s power button settings.) +[9]: https://opensource.com/sites/default/files/images/kde-power-management.jpg +[10]: http://slackware.com diff --git a/sources/tech/20190729 How to structure a multi-file C program- Part 1.md b/sources/tech/20190729 How to structure a multi-file C program- Part 1.md new file mode 100644 index 0000000000..b4c9cd194d --- /dev/null +++ b/sources/tech/20190729 How to structure a multi-file C program- Part 1.md @@ -0,0 +1,197 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to structure a multi-file C program: Part 1) +[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-1) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions) + +How to structure a multi-file C program: Part 1 +====== +Grab your favorite beverage, editor, and compiler, crank up some tunes, +and start structuring a C program composed of multiple files. +![Programming keyboard.][1] + +It has often been said that the art of computer programming is part managing complexity and part naming things. I contend that this is largely true with the addition of "and sometimes it requires drawing boxes." + +In this article, I'll name some things and manage some complexity while writing a small C program that is loosely based on the program structure I discussed in "[How to write a good C main function][2]"—but different. This one will do something. Grab your favorite beverage, editor, and compiler, crank up some tunes, and let's write a mildly interesting C program together. + +### Philosophy of a good Unix program + +The first thing to know about this C program is that it's a [Unix][3] command-line tool. This means that it runs on (or can be ported to) operating systems that provide a Unix C runtime environment. When Unix was invented at Bell Labs, it was imbued from the beginning with a [design philosophy][4]. In my own words: _programs do one thing, do it well, and act on files_. While it makes sense to do one thing and do it well, the part about "acting on files" seems a little out of place. + +It turns out that the Unix abstraction of a "file" is very powerful. A Unix file is a stream of bytes that ends with an end-of-file (EOF) marker. That's it. Any other structure in a file is imposed by the application and not the operating system. The operating system provides system calls that allow a program to perform a set of standard operations on files: open, read, write, seek, and close (there are others, but those are the biggies). Standardizing access to files allows different programs to share a common abstraction and work together even when different people implement them in different programming languages. + +Having a shared file interface makes it possible to build programs that are _composable_. The output of one program can be the input of another program. The Unix family of operating systems provides three files by default whenever a program is executed: standard in (**stdin**), standard out (**stdout**), and standard error (**stderr**). Two of these files are opened in write-only mode: **stdout** and **stderr**, while **stdin** is opened read-only. We see this in action whenever we use file redirection in a command shell like Bash: + + +``` +`$ ls | grep foo | sed -e 's/bar/baz/g' > ack` +``` + +This construction can be described briefly as: the output of **ls** is written to stdout, which is redirected to the stdin of **grep**, whose stdout is redirected to **sed**, whose stdout is redirected to write to a file called **ack** in the current directory. + +We want our program to play well in this ecosystem of equally flexible and awesome programs, so let's write a program that reads and writes files. + +### MeowMeow: A stream encoder/decoder concept + +When I was a dewy-eyed kid studying computer science in the <mumbles>s, there were a plethora of encoding schemes. Some of them were for compressing files, some were for packaging files together, and others had no purpose but to be excruciatingly silly. An example of the last is the [MooMoo encoding scheme][5]. + +To give our program a purpose, I'll update this concept for the [2000s][6] and implement a concept called MeowMeow encoding (since the internet loves cats). The basic idea here is to take files and encode each nibble (half of a byte) with the text "meow." A lower-case letter indicates a zero, and an upper-case indicates a one. Yes, it will balloon the size of a file since we are trading 4 bits for 32 bits. Yes, it's pointless. But imagine the surprise on someone's face when this happens: + + +``` +$ cat /home/your_sibling/.super_secret_journal_of_my_innermost_thoughts +MeOWmeOWmeowMEoW... +``` + +This is going to be awesome. + +### Implementation, finally + +The full source for this can be found on [GitHub][7], but I'll talk through my thought process while writing it. The object is to illustrate how to structure a C program composed of multiple files. + +Having already established that I want to write a program that encodes and decodes files in MeowMeow format, I fired up a shell and issued the following commands: + + +``` +$ mkdir meowmeow +$ cd meowmeow +$ git init +$ touch Makefile     # recipes for compiling the program +$ touch main.c       # handles command-line options +$ touch main.h       # "global" constants and definitions +$ touch mmencode.c   # implements encoding a MeowMeow file +$ touch mmencode.h   # describes the encoding API +$ touch mmdecode.c   # implements decoding a MeowMeow file +$ touch mmdecode.h   # describes the decoding API +$ touch table.h      # defines encoding lookup table values +$ touch .gitignore   # names in this file are ignored by git +$ git add . +$ git commit -m "initial commit of empty files" +``` + +In short, I created a directory full of empty files and committed them to git. + +Even though the files are empty, you can infer the purpose of each from its name. Just in case you can't, I annotated each **touch** with a brief description. + +Usually, a program starts as a single, simple **main.c** file, with only two or three functions that solve the problem. And then the programmer rashly shows that program to a friend or her boss, and suddenly the number of functions in the file balloons to support all the new "features" and "requirements" that pop up. The first rule of "Program Club" is don't talk about "Program Club." The second rule is to minimize the number of functions in one file. + +To be honest, the C compiler does not care one little bit if every function in your program is in one file. But we don't write programs for computers or compilers; we write them for other people (who are sometimes us). I know that is probably a surprise, but it's true. A program embodies a set of algorithms that solve a problem with a computer, and it's important that people understand it when the parameters of the problem change in unanticipated ways. People will have to modify the program, and they will curse your name if you have all 2,049 functions in one file. + +So we good and true programmers break functions out, grouping similar functions into separate files. Here I've got files **main.c**, **mmencode.c**, and **mmdecode.c**. For small programs like this, it may seem like overkill. But small programs rarely stay small, so planning for expansion is a "Good Idea." + +But what about those **.h** files? I'll explain them in general terms later, but in brief, those are called _header_ files, and they can contain C language type definitions and C preprocessor directives. Header files should _not_ have any functions in them. You can think of headers as a definition of the application programming interface (API) offered by the **.c** flavored file that is used by other **.c** files. + +### But what the heck is a Makefile? + +I know all you cool kids are using the "Ultra CodeShredder 3000" integrated development environment to write the next blockbuster app, and building your project consists of mashing on Ctrl-Meta-Shift-Alt-Super-B. But back in my day (and also today), lots of useful work got done by C programs built with Makefiles. A Makefile is a text file that contains recipes for working with files, and programmers use it to automate building their program binaries from source (and other stuff too!). + +Take, for instance, this little gem: + + +``` +00 # Makefile +01 TARGET= my_sweet_program +02 $(TARGET): main.c +03    cc -o my_sweet_program main.c +``` + +Text after an octothorpe/pound/hash is a comment, like in line 00. + +Line 01 is a variable assignment where the variable **TARGET** takes on the string value **my_sweet_program**. By convention, OK, my preference, all Makefile variables are capitalized and use underscores to separate words. + +Line 02 consists of the name of the file that the recipe creates and the files it depends on. In this case, the target is **my_sweet_program**, ****and the dependency is **main.c**. + +The final line, 03, is indented with a tab and not four spaces. This is the command that will be executed to create the target. In this case, we call **cc** the C compiler frontend to compile and link **my_sweet_program**. + +Using a Makefile is simple: + + +``` +$ make +cc -o my_sweet_program main.c +$ ls +Makefile  main.c  my_sweet_program +``` + +The [Makefile][8] that will build our MeowMeow encoder/decoder is considerably more sophisticated than this example, but the basic structure is the same. I'll break it down Barney-style in another article. + +### Form follows function + +My idea here is to write a program that reads a file, transforms it, and writes the transformed data to another file. The following fabricated command-line interaction is how I imagine using the program: + + +``` +        $ meow < clear.txt > clear.meow +        $ unmeow < clear.meow > meow.tx +        $ diff clear.txt meow.tx +        $ +``` + +We need to write code to handle command-line parsing and managing the input and output streams. We need a function to encode a stream and write it to another stream. And finally, we need a function to decode a stream and write it to another stream. Wait a second, I've only been talking about writing one program, but in the example above, I invoke two commands: **meow** and **unmeow**? I know you are probably thinking that this is getting complex as heck. + +### Minor sidetrack: argv[0] and the ln command + +If you recall, the signature of a C main function is: + + +``` +`int main(int argc, char *argv[])` +``` + +where **argc** is the number of command-line arguments, and **argv** is a list of character pointers (strings). The value of **argv[0]** is the path of the file containing the program being executed. Many Unix utility programs with complementary functions (e.g., compress and uncompress) look like two programs, but in fact, they are one program with two names in the filesystem. The two-name trick is accomplished by creating a filesystem "link" using the **ln** command. + +An example from **/usr/bin** on my laptop is: + + +``` +   $ ls -li /usr/bin/git* +3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git +3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git-receive-pack +... +``` + +Here **git** and **git-receive-pack** are the same file with different names. We can tell it's the same file because they have the same inode number (the first column). An inode is a feature of the Unix filesystem and is super outside the scope of this article. + +Good and/or lazy programmers can use this feature of the Unix filesystem to write less code but double the number of programs they deliver. First, we write a program that changes its behavior based on the value of **argv[0]**, then we make sure to create links with the names that cause the behavior. + +In our Makefile, the **unmeow** link is created using this recipe: + + +``` + # Makefile + ... + $(DECODER): $(ENCODER) +         $(LN) -f $< $@ +        ... +``` + +I tend to parameterize everything in my Makefiles, rarely using a "bare" string. I group all the definitions at the top of the Makefile, which makes it easy to find and change them. This makes a big difference when you are trying to port software to a new platform and you need to change all your rules to use **xcc** instead of **cc**. + +The recipe should appear relatively straightforward except for the two built-in variables **$@** and **$<**. The first is a shortcut for the target of the recipe; in this case, **$(DECODER)**. (I remember this because the at-sign looks like a target to me.) The second, **$<** is the rule dependency; in this case, it resolves to **$(ENCODER)**. + +Things are getting complex for sure, but it's managed. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/structure-multi-file-c-part-1 + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) +[2]: https://opensource.com/article/19/5/how-write-good-c-main-function +[3]: https://en.wikipedia.org/wiki/Unix +[4]: http://harmful.cat-v.org/cat-v/ +[5]: http://www.jabberwocky.com/software/moomooencode.html +[6]: https://giphy.com/gifs/nyan-cat-sIIhZliB2McAo +[7]: https://github.com/JnyJny/meowmeow +[8]: https://github.com/JnyJny/meowmeow/blob/master/Makefile diff --git a/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md b/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md new file mode 100644 index 0000000000..b5f8611a1c --- /dev/null +++ b/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md @@ -0,0 +1,304 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Python to explore Google's Natural Language API) +[#]: via: (https://opensource.com/article/19/7/python-google-natural-language-api) +[#]: author: (JR Oakes https://opensource.com/users/jroakes) + +Using Python to explore Google's Natural Language API +====== +Google's API can surface clues to how Google is classifying your site +and ways to tweak your content to improve search results. +![magnifying glass on computer screen][1] + +As a technical search engine optimizer, I am always looking for ways to use data in novel ways to better understand how Google ranks websites. I recently investigated whether Google's [Natural Language API][2] could better inform how Google may be classifying a site's content. + +Although there are [open source NLP tools][3], I wanted to explore Google's tools under the assumption it might use the same tech in other products, like Search. This article introduces Google's Natural Language API and explores common natural language processing (NLP) tasks and how they might be used to inform website content creation. + +### Understanding the data types + +To begin, it is important to understand the types of data that Google's Natural Language API returns. + +#### Entities + +Entities are text phrases that can be tied back to something in the physical world. Named entity recognition (NER) is a difficult part of NLP because tools often need to look at the full context around words to understand their usage. For example, homographs are spelled the same but have multiple meanings. Does "lead" in a sentence refer to a metal (a noun), causing someone to move (a verb), or the main character in a play (also a noun)? Google has 12 distinct types of entities, as well as a 13th catch-all category called "UNKNOWN." Some of the entities tie back to Wikipedia articles, suggesting [Knowledge Graph][4] influence on the data. Each entity returns a salience score, which is its overall relevance to the supplied text. + +![Entities][5] + +#### Sentiment + +Sentiment, a view of or attitude towards something, is measured at the document and sentence level and for individual entities discovered in the document. The score of the sentiment ranges from -1.0 (negative) to 1.0 (positive). The magnitude represents the non-normalized strength of emotion; it ranges between 0.0 and infinity. + +![Sentiment][6] + +#### Syntax + +Syntax parsing contains most of the common NLP activities found in better libraries, like [lemmatization][7], [part-of-speech tagging][8], and [dependency-tree parsing][9]. NLP mainly deals with helping machines understand text and the relationship between words. Syntax parsing is a foundational part of most language-processing or understanding tasks. + +![Syntax][10] + +#### Categories + +Categories assign the entire given content to a specific industry or topical category with a confidence score from 0.0 to 1.0. The categories appear to be the same audience and website categories used by other Google tools, like AdWords. + +![Categories][11] + +### Pulling some data + +Now I'll pull some sample data to play around with. I gathered some search queries and their corresponding URLs using Google's [Search Console API][12]. Google Search Console is a tool that reports the terms people use to find a website's pages with Google Search. This [open source Jupyter notebook][13] allows you to pull similar data about your website. For this example, I pulled Google Search Console data on a website (which I won't name) generated between January 1 and June 1, 2019, and restricted it to queries that received at least one click (as opposed to just impressions). + +This dataset contains information on 2,969 pages and 7,144 queries that displayed the website's pages in Google Search results. The table below shows that the vast majority of pages received very few clicks, as this site focuses on what is called long-tail (more specific and usually longer) as opposed to short-tail (very general, higher search volume) search queries. + +![Histogram of clicks for all pages][14] + +To reduce the dataset size and get only top-performing pages, I limited the dataset to pages that received at least 20 impressions over the period. This is the histogram of clicks by page for this refined dataset, which includes 723 pages: + +![Histogram of clicks for subset of pages][15] + +### Using Google's Natural Language API library in Python + +To test out the API, create a small script that leverages the **[google-cloud-language][16]** library in Python. The following code is Python 3.5+. + +First, activate a new virtual environment and install the libraries. Replace **<your-env>** with a unique name for the environment. + + +``` +virtualenv <your-env> +source <your-env>/bin/activate +pip install --upgrade google-cloud-language +pip install --upgrade requests +``` + +This script extracts HTML from a URL and feeds the HTML to the Natural Language API. It returns a dictionary of **sentiment**, **entities**, and **categories**, where the values for these keys are all lists. I used a Jupyter notebook to run this code because it makes it easier to annotate and retry code using the same kernel. + + +``` +# Import needed libraries +import requests +import json + +from google.cloud import language +from google.oauth2 import service_account +from google.cloud.language import enums +from google.cloud.language import types + +# Build language API client (requires service account key) +client = language.LanguageServiceClient.from_service_account_json('services.json') + +# Define functions +def pull_googlenlp(client, url, invalid_types = ['OTHER'], **data): +    +        html = load_text_from_url(url, **data) +    +        if not html: +        return None +    +        document = types.Document( +        content=html, +        type=language.enums.Document.Type.HTML ) + +        features = {'extract_syntax': True, +                'extract_entities': True, +                'extract_document_sentiment': True, +                'extract_entity_sentiment': True, +                'classify_text': False +                } +    +        response = client.annotate_text(document=document, features=features) +        sentiment = response.document_sentiment +        entities = response.entities +    +        response = client.classify_text(document) +        categories = response.categories +          +        def get_type(type): +        return client.enums.Entity.Type(entity.type).name +    +        result = {} +    +        result['sentiment'] = []     +        result['entities'] = [] +        result['categories'] = [] + +        if sentiment: +        result['sentiment'] = [{ 'magnitude': sentiment.magnitude, 'score':sentiment.score }] +          +        for entity in entities: +        if get_type(entity.type) not in invalid_types: +                result['entities'].append({'name': entity.name, 'type': get_type(entity.type), 'salience': entity.salience, 'wikipedia_url': entity.metadata.get('wikipedia_url', '-')  }) +          +        for category in categories: +        result['categories'].append({'name':category.name, 'confidence': category.confidence}) +          +          +        return result + +def load_text_from_url(url, **data): + +        timeout = data.get('timeout', 20) +    +        results = [] +    +        try: +          +        print("Extracting text from: {}".format(url)) +        response = requests.get(url, timeout=timeout) + +        text = response.text +        status = response.status_code + +        if status == 200 and len(text) > 0: +                return text +          +        return None +          + +        except Exception as e: +        print('Problem with url: {0}.'.format(url)) +        return None +``` + +To access the API, follow Google's [quickstart instructions][17] to create a project in Google Cloud Console, enable the API, and download a service account key. Afterward, you should have a JSON file that looks similar to this: + +![services.json file][18] + +Upload it to your project folder with the name **services.json**. + +Then you can pull the API data for any URL (such as Opensource.com) by running the following: + + +``` +url = "" +pull_googlenlp(client,url) +``` + +If it's set up correctly, you should see this output: + +![Output from pulling API data][19] + +To make it easier to get started, I created a [Jupyter Notebook][20] that you can download and use to test extracting web pages' entities, categories, and sentiment. I prefer using [JupyterLab][21], which is an extension of Jupyter Notebooks that includes a file viewer and other enhanced user experience features. If you're new to these tools, I think [Anaconda][22] is the easiest way to get started using Python and Jupyter. It makes installing and setting up Python, as well as common libraries, very easy, especially on Windows. + +### Playing with the data + +With these functions that scrape the HTML of the given page and pass it to the Natural Language API, I can run some analysis across the 723 URLs. First, I'll look at the categories relevant to the site by looking at the count of returned top categories across all pages. + +#### Categories + +![Categories data from example site][23] + +This seems to be a fairly accurate representation of the key themes of this particular site. Looking at a single query that one of the top-performing pages ranks for, I can compare the other ranking pages in Google's results for that same query. + + * _URL 1 | Top Category: /Law & Government/Legal (0.5099999904632568) of 1 total categories._ + * _No categories returned._ + * _URL 3 | Top Category: /Internet & Telecom/Mobile & Wireless (0.6100000143051147) of 1 total categories._ + * _URL 4 | Top Category: /Computers & Electronics/Software (0.5799999833106995) of 2 total categories._ + * _URL 5 | Top Category: /Internet & Telecom/Mobile & Wireless/Mobile Apps & Add-Ons (0.75) of 1 total categories._ + * _No categories returned._ + * _URL 7 | Top Category: /Computers & Electronics/Software/Business & Productivity Software (0.7099999785423279) of 2 total categories._ + * _URL 8 | Top Category: /Law & Government/Legal (0.8999999761581421) of 3 total categories._ + * _URL 9 | Top Category: /Reference/General Reference/Forms Guides & Templates (0.6399999856948853) of 1 total categories._ + * _No categories returned._ + + + +The numbers in parentheses above represent Google's confidence that the content of the page is relevant for that category. The eighth result has much higher confidence than the first result for the same category, so this doesn't seem to be a magic bullet for defining relevance for ranking. Also, the categories are much too broad to make sense for a specific search topic. + +Looking at average confidence by ranking position, there doesn't seem to be a correlation between these two metrics, at least for this dataset: + +![Plot of average confidence by ranking position ][24] + +Both of these approaches make sense to review for a website at scale to ensure the content categories seem appropriate, and boilerplate or sales content isn't moving your pages out of relevance for your main expertise area. Think if you sell industrial supplies, but your pages return _Marketing_ as the main category. There doesn't seem to be a strong suggestion that category relevancy has anything to do with how well you rank, at least at a page level. + +#### Sentiment + +I won't spend much time on sentiment. Across all the pages that returned a sentiment from the API, they fell into two bins: 0.1 and 0.2, which is almost neutral sentiment. Based on the histogram, it is easy to tell that sentiment doesn't provide much value. It would be a much more interesting metric to run for a news or opinion site to measure the correlation of sentiment to median rank for particular pages. + +![Histogram of sentiment for unique pages][25] + +#### Entities + +Entities were the most interesting part of the API, in my opinion. This is a selection of the top entities, across all pages, by salience (or relevancy to the page). Notice that Google is inferring different types for the same terms (Bill of Sale), perhaps incorrectly. This is caused by the terms appearing in different contexts in the content. + +![Top entities for example site][26] + +Then I looked at each entity type individually and all together to see if there was any correlation between the salience of the entity and the best-ranking position of the page. For each type, I matched the salience (overall relevance to the page) of the top entity matching that type ordered by salience (descending). + +Some of the entity types returned zero salience across all examples, so I omitted those results from the charts below. + +![Correlation between salience and best ranking position][27] + +The **Consumer Good** entity type had the highest positive correlation, with a Pearson correlation of 0.15854, although since lower-numbered rankings are better, the **Person** entity had the best result with a -0.15483 correlation. This is an extremely small sample set, especially for individual entity types, so I can't make too much of the data. I didn't find any value with a strong correlation, but the **Person** entity makes the most sense. Sites usually have pages about their chief executive and other key employees, and these pages are very likely to do well in search results for those queries. + +Moving on, while looking at the site holistically, the following themes emerge based on **entity** **name** and **entity type**. + +![Themes based on entity name and entity type][28] + +I blurred a few results that seem too specific to mask the site's identity. Thematically, the name information is a good way to look topically at your (or a competitor's) site to see its core themes. This was done based only on the example site's ranking URLs and not all the site's possible URLs (Since Search Console data only reports on pages that received impressions in Google), but the results would be interesting, especially if you were to pull a site's main ranking URLs from a tool like [Ahrefs][29], which tracks many, many queries and the Google results for those queries. + +The other interesting piece in the entity data is that entities marked **CONSUMER_GOOD** tended to "look" like results I have seen in Knowledge Results, i.e., the Google Search results on the right-hand side of the page. + +![Google search results][30] + +Of the **Consumer Good** entity names from our data set that had three or more words, 5.8% had the same Knowledge Results as Google's results for the entity name. This means, if you searched for the term or phrase in Google, the block on the right (eg. the Knowledge Results showing Linux above), would display in the search result page. Since Google "picks" an exemplar webpage to represent the entity, it is a good opportunity to identify opportunities to be singularly featured in search results. Also of interest, of the 5.8% names that displayed these Knowledge Results in Google, none of the entities had Wikipedia URLs returned from the Natural Language API. This is interesting enough to warrant additional analysis. It would be very useful, especially for more esoteric topics that traditional global rank-tracking tools, like Ahrefs, don't have in their databases. + +As mentioned, the Knowledge Results can be important to site owners who want to have their content featured in Google, as they are strongly highlighted on desktop search. They are also more than likely, hypothetically, to line up with knowledge-base topics from Google [Discover][31], an offering for Android and iOS that attempts to surface content for users based on topics they are interested in but haven't searched explicitly for. + +### Wrapping up + +This article went over Google's Natural Language API, shared some code, and investigated ways this API may be useful for site owners. The key takeaways are: + + * Learning to use Python and Jupyter Notebooks opens your data-gathering tasks to a world of incredible APIs and open source projects (like Pandas and NumPy) built by incredibly smart and talented people. + * Python allows me to quickly pull and test my hypothesis about the value of an API for a particular purpose. + * Passing a website's pages through Google's categorization API may be a good check to ensure its content falls into the correct thematic categories. Doing this for competitors' sites may also offer guidance on where to tune-up or create content. + * Google's sentiment score didn't seem to be an interesting metric for the example site, but it may be for news or opinion-based sites. + * Google's found entities gave a much more granular topic-level view of the website holistically and, like categorization, would be very interesting to use in competitive content analysis. + * Entities may help define opportunities where your content can line up with Google Knowledge blocks in search results or Google Discover results. With 5.8% of our results set for longer (word count) **Consumer Goods** entities, displaying these results, there may be opportunities, for some sites, to better optimize their page's salience score for these entities to stand a better chance of capturing this featured placement in Google search results or Google Discovers suggestions. + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/python-google-natural-language-api + +作者:[JR Oakes][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/jroakes +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_issue_bug_programming.png?itok=XPrh7fa0 (magnifying glass on computer screen) +[2]: https://cloud.google.com/natural-language/#natural-language-api-demo +[3]: https://opensource.com/article/19/3/natural-language-processing-tools +[4]: https://en.wikipedia.org/wiki/Knowledge_Graph +[5]: https://opensource.com/sites/default/files/uploads/entities.png (Entities) +[6]: https://opensource.com/sites/default/files/uploads/sentiment.png (Sentiment) +[7]: https://en.wikipedia.org/wiki/Lemmatisation +[8]: https://en.wikipedia.org/wiki/Part-of-speech_tagging +[9]: https://en.wikipedia.org/wiki/Parse_tree#Dependency-based_parse_trees +[10]: https://opensource.com/sites/default/files/uploads/syntax.png (Syntax) +[11]: https://opensource.com/sites/default/files/uploads/categories.png (Categories) +[12]: https://developers.google.com/webmaster-tools/ +[13]: https://github.com/MLTSEO/MLTS/blob/master/Demos.ipynb +[14]: https://opensource.com/sites/default/files/uploads/histogram_1.png (Histogram of clicks for all pages) +[15]: https://opensource.com/sites/default/files/uploads/histogram_2.png (Histogram of clicks for subset of pages) +[16]: https://pypi.org/project/google-cloud-language/ +[17]: https://cloud.google.com/natural-language/docs/quickstart +[18]: https://opensource.com/sites/default/files/uploads/json_file.png (services.json file) +[19]: https://opensource.com/sites/default/files/uploads/output.png (Output from pulling API data) +[20]: https://github.com/MLTSEO/MLTS/blob/master/Tutorials/Google_Language_API_Intro.ipynb +[21]: https://github.com/jupyterlab/jupyterlab +[22]: https://www.anaconda.com/distribution/ +[23]: https://opensource.com/sites/default/files/uploads/categories_2.png (Categories data from example site) +[24]: https://opensource.com/sites/default/files/uploads/plot.png (Plot of average confidence by ranking position ) +[25]: https://opensource.com/sites/default/files/uploads/histogram_3.png (Histogram of sentiment for unique pages) +[26]: https://opensource.com/sites/default/files/uploads/entities_2.png (Top entities for example site) +[27]: https://opensource.com/sites/default/files/uploads/salience_plots.png (Correlation between salience and best ranking position) +[28]: https://opensource.com/sites/default/files/uploads/themes.png (Themes based on entity name and entity type) +[29]: https://ahrefs.com/ +[30]: https://opensource.com/sites/default/files/uploads/googleresults.png (Google search results) +[31]: https://www.blog.google/products/search/introducing-google-discover/ diff --git a/sources/tech/20190731 How to structure a multi-file C program- Part 2.md b/sources/tech/20190731 How to structure a multi-file C program- Part 2.md new file mode 100644 index 0000000000..0570214eba --- /dev/null +++ b/sources/tech/20190731 How to structure a multi-file C program- Part 2.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to structure a multi-file C program: Part 2) +[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-2) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +How to structure a multi-file C program: Part 2 +====== +Dive deeper into the structure of a C program composed of multiple files +in the second part of this article. +![4 manilla folders, yellow, green, purple, blue][1] + +In [Part 1][2], I laid out the structure for a multi-file C program called [MeowMeow][3] that implements a toy [codec][4]. I also talked about the Unix philosophy of program design, laying out a number of empty files to start with a good structure from the very beginning. Lastly, I touched on what a Makefile is and what it can do for you. This article picks up where the other one left off and now I'll get to the actual implementation of our silly (but instructional) MeowMeow codec. + +The structure of the **main.c** file for **meow**/**unmeow** should be familiar to anyone who's read my article "[How to write a good C main function][5]." It has the following general outline: + + +``` +/* main.c - MeowMeow, a stream encoder/decoder */ + +/* 00 system includes */ +/* 01 project includes */ +/* 02 externs */ +/* 03 defines */ +/* 04 typedefs */ +/* 05 globals (but don't)*/ +/* 06 ancillary function prototypes if any */ +    +int main(int argc, char *argv[]) +{ +  /* 07 variable declarations */ +  /* 08 check argv[0] to see how the program was invoked */ +  /* 09 process the command line options from the user */ +  /* 10 do the needful */ +} +    +/* 11 ancillary functions if any */ +``` + +### Including project header files + +The second section, **/* 01 project includes /***, reads like this from the source: + + +``` +/* main.c - MeowMeow, a stream encoder/decoder */ +... +/* 01 project includes */ +#include "main.h" +#include "mmecode.h" +#include "mmdecode.h" +``` + +The **#include** directive is a C preprocessor command that causes the contents of the named file to be "included" at this point in the file. If the programmer uses double-quotes around the name of the header file, the compiler will look for that file in the current directory. If the file is enclosed in <>, it will look for the file in a set of predefined directories. + +The file [**main.h**][6] contains the definitions and typedefs used in [**main.c**][7]. I like to collect these things here in case I want to use those definitions elsewhere in my program. + +The files [**mmencode.h**][8] and [**mmdecode.h**][9] are nearly identical, so I'll break down **mmencode.h**. + + +``` + /* mmencode.h - MeowMeow, a stream encoder/decoder */ +    + #ifndef _MMENCODE_H + #define _MMENCODE_H +    + #include <stdio.h> +    + int mm_encode(FILE *src, FILE *dst); +    + #endif /* _MMENCODE_H */ +``` + +The **#ifdef, #define, #endif** construction is collectively known as a "guard." This keeps the C compiler from including this file more than once per file. The compiler will complain if it finds multiple definitions/prototypes/declarations, so the guard is a _must-have_ for header files. + +Inside the guard, there are only two things: an **#include** directive and a function prototype declaration. I include **stdio.h** here to bring in the definition of **FILE** that is used in the function prototype. The function prototype can be included by other C files to establish that function in the file's namespace. You can think of each file as a separate _namespace_, which means variables and functions in one file are not usable by functions or variables in another file. + +Writing header files is complex, and it is tough to manage in larger projects. Use guards. + +### MeowMeow encoding, finally + +The meat and potatoes of this program—encoding and decoding bytes into/out of **MeowMeow** strings—is actually the easy part of this project. All of our activities until now have been putting the scaffolding in place to support calling this function: parsing the command line, determining which operation to use, and opening the files that we'll operate on. Here is the encoding loop: + + +``` + /* mmencode.c - MeowMeow, a stream encoder/decoder */ + ... +     while (![feof][10](src)) { +    +       if (![fgets][11](buf, sizeof(buf), src)) +         break; +              +       for(i=0; i<[strlen][12](buf); i++) { +         lo = (buf[i] & 0x000f); +         hi = (buf[i] & 0x00f0) >> 4; +         [fputs][13](tbl[hi], dst); +         [fputs][13](tbl[lo], dst); +       } +            } +``` + +In plain English, this loop reads in a chunk of the file while there are chunks left to read (**feof(3)** and **fgets(3)**). Then it splits each byte in the chunk into **hi** and **lo** nibbles. Remember, a nibble is half of a byte, or 4 bits. The real magic here is realizing that 4 bits can encode 16 values. I use **hi** and **lo** as indices into a 16-string lookup table, **tbl**, that contains the **MeowMeow** strings that encode each nibble. Those strings are written to the destination **FILE** stream using **fputs(3)**, then we move on to the next byte in the buffer. + +The table is initialized with a macro defined in [**table.h**][14] for no particular reason except to demonstrate including another project local header file, and I like initialization macros. We will go further into why a future article. + +### MeowMeow decoding + +Alright, I'll admit it took me a couple of runs at this before I got it working. The decode loop is similar: read a buffer full of **MeowMeow** strings and reverse the encoding from strings to bytes. + + +``` + /* mmdecode.c - MeowMeow, a stream decoder/decoder */ + ... + int mm_decode(FILE *src, FILE *dst) + { +   if (!src || !dst) { +     errno = EINVAL; +     return -1; +   } +   return stupid_decode(src, dst); + } +``` + +Not what you were expecting? + +Here, I'm exposing the function **stupid_decode()** via the externally visible **mm_decode()** function. When I say "externally," I mean outside this file. Since **stupid_decode()** isn't in the header file, it isn't available to be called in other files. + +Sometimes we do this when we want to publish a solid public interface, but we aren't quite done noodling around with functions to solve a problem. In my case, I've written an I/O-intensive function that reads 8 bytes at a time from the source stream to decode 1 byte to write to the destination stream. A better implementation would work on a buffer bigger than 8 bytes at a time. A _much_ better implementation would also buffer the output bytes to reduce the number of single-byte writes to the destination stream. + + +``` + /* mmdecode.c - MeowMeow, a stream decoder/decoder */ + ... + int stupid_decode(FILE *src, FILE *dst) + { +   char           buf[9]; +   decoded_byte_t byte; +   int            i; +      +   while (![feof][10](src)) { +     if (![fgets][11](buf, sizeof(buf), src)) +       break; +     byte.field.f0 = [isupper][15](buf[0]); +     byte.field.f1 = [isupper][15](buf[1]); +     byte.field.f2 = [isupper][15](buf[2]); +     byte.field.f3 = [isupper][15](buf[3]); +     byte.field.f4 = [isupper][15](buf[4]); +     byte.field.f5 = [isupper][15](buf[5]); +     byte.field.f6 = [isupper][15](buf[6]); +     byte.field.f7 = [isupper][15](buf[7]); +        +     [fputc][16](byte.value, dst); +   } +   return 0; + } +``` + +Instead of using the bit-shifting technique I used in the encoder, I elected to create a custom data structure called **decoded_byte_t**. + + +``` + /* mmdecode.c - MeowMeow, a stream decoder/decoder */ + ... + + typedef struct { +   unsigned char f7:1; +   unsigned char f6:1; +   unsigned char f5:1; +   unsigned char f4:1; +   unsigned char f3:1; +   unsigned char f2:1; +   unsigned char f1:1; +   unsigned char f0:1; + } fields_t; +    + typedef union { +   fields_t      field; +   unsigned char value; + } decoded_byte_t; +``` + +It's a little complex when viewed all at once, but hang tight. The **decoded_byte_t** is defined as a **union** of a **fields_t** and an **unsigned char**. The named members of a union can be thought of as aliases for the same region of memory. In this case, **value** and **field** refer to the same 8-bit region of memory. Setting **field.f0** to 1 would also set the least significant bit in **value**. + +While **unsigned char** shouldn't be a mystery, the **typedef** for **fields_t** might look a little unfamiliar. Modern C compilers allow programmers to specify "bit fields" in a **struct**. The field type needs to be an unsigned integral type, and the member identifier is followed by a colon and an integer that specifies the length of the bit field. + +This data structure makes it simple to access each bit in the byte by field name and then access the assembled value via the **value** field of the union. We depend on the compiler to generate the correct bit-shifting instructions to access the fields, which can save you a lot of heartburn when you are debugging. + +Lastly, **stupid_decode()** is _stupid_ because it only reads 8 bytes at a time from the source **FILE** stream. Usually, we try to minimize the number of reads and writes to improve performance and reduce our cost of system calls. Remember that reading or writing a bigger chunk less often is much better than reading/writing a lot of smaller chunks more frequently. + +### The wrap-up + +Writing a multi-file program in C requires a little more planning on behalf of the programmer than just a single **main.c**. But just a little effort up front can save a lot of time and headache when you refactor as you add functionality. + +To recap, I like to have a lot of files with a few short functions in them. I like to expose a small subset of the functions in those files via header files. I like to keep my constants in header files, both numeric and string constants. I _love_ Makefiles and use them instead of Bash scripts to automate all sorts of things. I like my **main()** function to handle command-line argument parsing and act as a scaffold for the primary functionality of the program. + +I know I've only touched the surface of what's going on in this simple program, and I'm excited to learn what things were helpful to you and which topics need better explanations. Share your thoughts in the comments to let me know. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/structure-multi-file-c-part-2 + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/file_system.jpg?itok=pzCrX1Kc (4 manilla folders, yellow, green, purple, blue) +[2]: https://opensource.com/article/19/7/how-structure-multi-file-c-program-part-1 +[3]: https://github.com/jnyjny/MeowMeow.git +[4]: https://en.wikipedia.org/wiki/Codec +[5]: https://opensource.com/article/19/5/how-write-good-c-main-function +[6]: https://github.com/JnyJny/meowmeow/blob/master/main.h +[7]: https://github.com/JnyJny/meowmeow/blob/master/main.c +[8]: https://github.com/JnyJny/meowmeow/blob/master/mmencode.h +[9]: https://github.com/JnyJny/meowmeow/blob/master/mmdecode.h +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html +[11]: http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[13]: http://www.opengroup.org/onlinepubs/009695399/functions/fputs.html +[14]: https://github.com/JnyJny/meowmeow/blob/master/table.h +[15]: http://www.opengroup.org/onlinepubs/009695399/functions/isupper.html +[16]: http://www.opengroup.org/onlinepubs/009695399/functions/fputc.html diff --git a/sources/tech/20190801 GitHub Pages is a CI-CD pipeline.md b/sources/tech/20190801 GitHub Pages is a CI-CD pipeline.md new file mode 100644 index 0000000000..cad16c5512 --- /dev/null +++ b/sources/tech/20190801 GitHub Pages is a CI-CD pipeline.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GitHub Pages is a CI/CD pipeline) +[#]: via: (https://opensource.com/article/19/8/github-pages-cicd-pipeline) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +GitHub Pages is a CI/CD pipeline +====== +Integrating just a little bit of automation into your workflow can +greatly improve your productivity and development velocity. +![An intersection of pipes.][1] + +One of GitHub's superpowers is the ability to _magically_ turn your documentation into a website. If you configure a [GitHub Page][2] for your **docs/** folder on your AwesomeProject website, you'll end up with **yourname.github.io/awesomeproject**, showing your documentation, all for free. + +But it's not actually magic. Sadly, even though we have taught glass to think, we can still only thank the advanced application of technology for anything that appears to be magical. + +GitHub Pages is just an integrated pathway within GitHub to help you set up a Jekyll project. [Jekyll][3] is a static site generator, written in Ruby. Out of the box you can quickly generate websites using markdown files that are then merged into pre-formatted HTML templated themes. There are many [default themes][4] available for GitHub Pages, or you can use one of the many [free templates][5] out there. + +![Jekyll Themes screenshot][6] + +There are many open source licensed templates available for use. + +When you first set up GitHub Pages, you declare which branch you want to build from and the domain you want to use. When you merge into that branch, GitHub goes and takes your Jekyll site, renders it, and hosts it for you on that domain. You don't have to do anything else. No FTP transfers onto a server. No server costs. [No GitHub costs][7]. This is all the power of automation. + +### Turning it up to 11 with Netlify PR previews + +One of the limitations of this system is when you're working with pull requests (PRs). If you want to test your code, you have to run Jekyll locally. This isn't [terribly difficult][8], but when you're reviewing someone else's PR, say when it's related to the documentation on a project's homepage, you want to be able to see what the new website will look like if you merge the PR. Especially if there could be issues with the changes that are proposed (particularly large changes, changes to the theme/layout, etc) + +Normally, you'd have to go to the PR, clone the fork of the repo and check out the branch that was used for the PR, merge that code into your local master, build _that_ version of the code in Jekyll, and open the local server to look at the changes. + +But the great thing is, you can automate this. + +One such service is [Netlify][9]. You can use Netlify to host your projects, but you can also use its [Deploy Previews][10] feature to generate Jekyll sites for any PR on your project automatically. + +Its [continuous deployment][11] docs show how to set up Netlify to automatically build your site any time a PR is opened or updated. The results of that build are available as a temporary website that is linked in the "Checks" section at the bottom of the PR, uniquely named for the PR and project. You can have multiple active PRs and Netlify will update the previews independently! + +This has greatly improved the website development process for [PyCon AU][12], which is using GitHub Pages to host the [2019 event website][13]. We heavily borrowed this idea and the Netlify setup from [DjangoCon US][14], which has every [DjangoCon website][15] on GitHub. Well, [most of them][16], as there is an ongoing project to ensure that every DjangoCon conference website is archived for prosperity. + +### Machines do the work, so people have time to code + +CI and CD have many benefits, but integrating just a little bit of automation into your workflow can greatly improve your productivity and development velocity. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/github-pages-cicd-pipeline + +作者:[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/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) +[2]: https://help.github.com/en/articles/configuring-a-publishing-source-for-github-pages +[3]: https://jekyllrb.com/ +[4]: https://pages.github.com/themes/ +[5]: http://jekyllthemes.org/ +[6]: https://opensource.com/sites/default/files/uploads/jekyll-themes.png (Jekyll Themes screenshot) +[7]: https://github.com/pricing +[8]: https://jekyllrb.com/docs/ +[9]: https://www.netlify.com/ +[10]: https://www.netlify.com/blog/2017/10/31/introducing-public-deploy-logs-for-open-source-sites/ +[11]: https://www.netlify.com/docs/continuous-deployment/ +[12]: http://2019.pycon-au.org +[13]: https://github.com/pyconau/2019.pycon-au.org +[14]: https://2019.djangocon.us/ +[15]: https://github.com/djangocon +[16]: https://github.com/djangocon/djangocon-archive-project diff --git a/sources/tech/20190801 Linux permissions 101.md b/sources/tech/20190801 Linux permissions 101.md new file mode 100644 index 0000000000..cfbc3d0a29 --- /dev/null +++ b/sources/tech/20190801 Linux permissions 101.md @@ -0,0 +1,346 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux permissions 101) +[#]: via: (https://opensource.com/article/19/8/linux-permissions-101) +[#]: author: (Alex Juarez https://opensource.com/users/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p) + +Linux permissions 101 +====== +Knowing how to control users' access to files is a fundamental system +administration skill. +![Penguins][1] + +Understanding Linux permissions and how to control which users have access to files is a fundamental skill for systems administration. + +This article will cover standard Linux file systems permissions, dig further into special permissions, and wrap up with an explanation of default permissions using **umask**. + +### Understanding the ls command output + +Before we can talk about how to modify permissions, we need to know how to view them. The **ls** command with the long listing argument (**-l**) gives us a lot of information about a file. + + +``` +$ ls -lAh +total 20K +-rwxr-xr--+ 1 root root    0 Mar  4 19:39 file1 +-rw-rw-rw-. 1 root root    0 Mar  4 19:39 file10 +-rwxrwxr--+ 1 root root    0 Mar  4 19:39 file2 +-rw-rw-rw-. 1 root root    0 Mar  4 19:39 file8 +-rw-rw-rw-. 1 root root    0 Mar  4 19:39 file9 +drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir +``` + +To understand what this means, let's break down the output regarding the permissions into individual sections. It will be easier to reference each section individually. + +Take a look at each component of the final line in the output above: + + +``` +`drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir` +``` + +Section 1 | Section 2 | Section 3 | Section 4 | Section 5 | Section 6 | Section 7 +---|---|---|---|---|---|--- +d | rwx | rwx | rwx | . | root | root + +Section 1 (on the left) reveals what type of file it is. + +d | Directory +---|--- +- | Regular file +l | A soft link + +The [info page][2] for **ls** has a full listing of the different file types. + +Each file has three modes of access: + + * the owner + * the group + * all others + + + +Sections 2, 3, and 4 refer to the user, group, and "other users" permissions. And each section can include a combination of **r** (read), **w** (write), and **x** (executable) permissions. + +Each of the permissions is also assigned a numerical value, which is important when talking about the octal representation of permissions. + +Permission | Octal Value +---|--- +Read | 4 +Write | 2 +Execute | 1 + +Section 5 details any alternative access methods, such as SELinux or File Access Control List (FACL). + +Method | Character +---|--- +No other method | - +SELinux | . +FACLs | + +Any combination of methods | + + +Sections 6 and 7 are the names of the owner and the group, respectively. + +### Using chown and chmod + +#### The chown command + +The **chown** (change ownership) command is used to change a file's user and group ownership. + +To change both the user and group ownership of the file **foo** to **root**, we can use these commands: + + +``` +$ chown root:root foo +$ chown root: foo +``` + +Running the command with the user followed by a colon (**:**) sets both the user and group ownership. + +To set only the user ownership of the file **foo** to the **root** user, enter: + + +``` +`$ chown root foo` +``` + +To change only the group ownership of the file **foo**, precede the group with a colon: + + +``` +`$ chown :root foo` +``` + +#### The chmod command + +The **chmod** (change mode) command controls file permissions for the owner, group, and all other users who are neither the owner nor part of the group associated with the file. + +The **chmod** command can set permissions in both octal (e.g., 755, 644, etc.) and symbolic (e.g., u+rwx, g-rwx, o=rw) formatting. + +Octal notation assigns 4 "points" to **read**, 2 to **write**, and 1 to **execute**. If we want to assign the user **read** permissions, we assign 4 to the first slot, but if we want to add **write** permissions, we must add 2. If we want to add **execute**, then we add 1. We do this for each permission type: owner, group, and others. + +For example, if we want to assign **read**, **write**, and **execute** to the owner of the file, but only **read** and **execute** to group members and all other users, we would use 755 in octal formatting. That's all permission bits for the owner (4+2+1), but only a 4 and 1 for the group and others (4+1). + +> The breakdown for that is: 4+2+1=7; 4+1=5; and 4+1=5. + +If we wanted to assign **read** and **write** to the owner of the file but only **read** to members of the group and all other users, we could use **chmod** as follows: + + +``` +`$ chmod 644 foo_file` +``` + +In the examples below, we use symbolic notation in different groupings. Note the letters **u**, **g**, and **o** represent **user**, **group**, and **other**. We use **u**, **g**, and **o** in conjunction with **+**, **-**, or **=** to add, remove, or set permission bits. + +To add the **execute** bit to the ownership permission set: + + +``` +`$ chmod u+x foo_file` +``` + +To remove **read**, **write**, and **execute** from members of the group: + + +``` +`$ chmod g-rwx foo_file` +``` + +To set the ownership for all other users to **read** and **write**: + + +``` +`$ chmod o=rw` +``` + +### The special bits: Set UID, set GID, and sticky bits + +In addition to the standard permissions, there are a few special permission bits that have some useful benefits. + +#### Set user ID (suid) + +When **suid** is set on a file, an operation executes as the owner of the file, not the user running the file. A [good example][3] of this is the **passwd** command. It needs the **suid** bit to be set so that changing a password runs with root permissions. + + +``` +$ ls -l /bin/passwd +-rwsr-xr-x. 1 root root 27832 Jun 10  2014 /bin/passwd +``` + +An example of setting the **suid** bit would be: + + +``` +`$ chmod u+s /bin/foo_file_name` +``` + +#### Set group ID (sgid) + +The **sgid** bit is similar to the **suid** bit in the sense that the operations are done under the group ownership of the directory instead of the user running the command. + +An example of using **sgid** would be if multiple users are working out of the same directory, and every file created in the directory needs to have the same group permissions. The example below creates a directory called **collab_dir**, sets the **sgid** bit, and changes the group ownership to **webdev**. + + +``` +$ mkdir collab_dir +$ chmod g+s collab_dir +$ chown :webdev collab_dir +``` + +Now any file created in the directory will have the group ownership of **webdev** instead of the user who created the file. + + +``` +$ cd collab_dir +$ touch file-sgid +$ ls -lah file-sgid +-rw-r--r--. 1 root webdev 0 Jun 12 06:04 file-sgid +``` + +#### The "sticky" bit + +The sticky bit denotes that only the owner of a file can delete the file, even if group permissions would otherwise allow it. This setting usually makes the most sense on a common or collaborative directory such as **/tmp**. In the example below, the **t** in the **execute** column of the **all others** permission set indicates that the sticky bit has been applied. + + +``` +$ ls -ld /tmp +drwxrwxrwt. 8 root root 4096 Jun 12 06:07 /tmp/ +``` + +Keep in mind this does not prevent somebody from editing the file; it just keeps them from deleting the contents of a directory. + +We set the sticky bit with: + + +``` +`$ chmod o+t foo_dir` +``` + +On your own, try setting the sticky bit on a directory and give it full group permissions so that multiple users can read, write and execute on the directory because they are in the same group. + +From there, create files as each user and then try to delete them as the other. + +If everything is configured correctly, one user should not be able to delete users from the other user. + +Note that each of these bits can also be set in octal format with SUID=4, SGID=2, and Sticky=1. + + +``` +$ chmod 4744 +$ chmod 2644 +$ chmod 1755 +``` + +#### Uppercase or lowercase? + +If you are setting the special bits and see an uppercase **S** or **T** instead of lowercase (as we've seen until this point), it is because the underlying execute bit is not present. To demonstrate, the following example creates a file with the sticky bit set. We can then add/remove the execute bit to demonstrate the case change. + + +``` +$ touch file cap-ST-demo +$ chmod 1755 cap-ST-demo +$ ls -l cap-ST-demo +-rwxr-xr-t. 1 root root 0 Jun 12 06:16 cap-ST-demo + +$ chmod o-x cap-X-demo +$ ls -l cap-X-demo +-rwxr-xr-T. 1 root root 0 Jun 12 06:16 cap-ST-demo +``` + +#### Setting the execute bit conditionally + +To this point, we've set the **execute** bit using a lowercase **x**, which sets it without asking any questions. We have another option: using an uppercase **X** instead of lowercase will set the **execute** bit only if it is already present somewhere in the permission group. This can be a difficult concept to explain, but the demo below will help illustrate it. Notice here that after trying to add the **execute** bit to the group privileges, it is not applied. + + +``` +$ touch cap-X-file +$ ls -l cap-X-file +-rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file +$ chmod g+X cap-X-file +$ ls -l cap-X-file +-rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file +``` + +In this similar example, we add the execute bit first to the group permissions using the lowercase **x** and then use the uppercase **X** to add permissions for all other users. This time, the uppercase **X** sets the permissions. + + +``` +$ touch cap-X-file +$ ls -l cap-X-file +-rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file +$ chmod g+x cap-X-file +$ ls -l cap-X-file +-rw-r-xr--. 1 root root 0 Jun 12 06:31 cap-X-file +$ chmod g+x cap-X-file +$ chmod o+X cap-X-file +ls -l cap-X-file +-rw-r-xr-x. 1 root root 0 Jun 12 06:31 cap-X-file +``` + +### Understanding umask + +The **umask** masks (or "blocks off") bits from the default permission set in order to define permissions for a file or directory. For example, a 2 in the **umask** output indicates it is blocking the **write** bit from a file, at least by default. + +Using the **umask** command without any arguments allows us to see the current **umask** setting. There are four columns: the first is reserved for the special suid, sgid, or sticky bit, and the remaining three represent the owner, group, and other permissions. + + +``` +$ umask +0022 +``` + +To understand what this means, we can execute **umask** with a **-S** (as shown below) to get the result of masking the bits. For instance, because of the **2** value in the third column, the **write** bit is masked off from the group and other sections; only **read** and **execute** can be assigned for those. + + +``` +$ umask -S +u=rwx,g=rx,o=rx +``` + +To see what the default permission set is for files and directories, let's set our **umask** to all zeros. This means that we are not masking off any bits when we create a file. + + +``` +$ umask 000 +$ umask -S +u=rwx,g=rwx,o=rwx + +$ touch file-umask-000 +$ ls -l file-umask-000 +-rw-rw-rw-. 1 root root 0 Jul 17 22:03 file-umask-000 +``` + +Now when we create a file, we see the default permissions are **read** (4) and **write** (2) for all sections, which would equate to 666 in octal representation. + +We can do the same for a directory and see its default permissions are 777. We need the **execute** bit on directories so we can traverse through them. + + +``` +$ mkdir dir-umask-000 +$ ls -ld dir-umask-000 +drwxrwxrwx. 2 root root 4096 Jul 17 22:03 dir-umask-000/ +``` + +### Conclusion + +There are many other ways an administrator can control access to files on a system. These permissions are basic to Linux, and we can build upon these fundamental aspects. If your work takes you into FACLs or SELinux, you will see that they also build upon these first rules of file access. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-permissions-101 + +作者:[Alex Juarez][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/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins) +[2]: https://www.gnu.org/software/texinfo/manual/info-stnd/info-stnd.html +[3]: https://www.theurbanpenguin.com/using-a-simple-c-program-to-explain-the-suid-permission/ diff --git a/sources/tech/20190802 Getting started with the BBC Microbit.md b/sources/tech/20190802 Getting started with the BBC Microbit.md new file mode 100644 index 0000000000..6e32536f04 --- /dev/null +++ b/sources/tech/20190802 Getting started with the BBC Microbit.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the BBC Microbit) +[#]: via: (https://opensource.com/article/19/8/getting-started-bbc-microbit) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Getting started with the BBC Microbit +====== +Tiny open hardware board makes it easy for anyone to learn to code with +fun projects. +![BBC Microbit board][1] + +Whether you are a maker, a teacher, or someone looking to expand your Python skillset, the [BBC:Microbit][2] has something for you. It was designed by the British Broadcasting Corporation to support computer education in the United Kingdom. + +The [open hardware board][3] is half the size of a credit card and packed with an ARM processor, a three-axis accelerometer, a three-axis magnetometer, a Micro USB port, a 25-pin edge connector, and 25 LEDs in a 5x5 array. + +I purchased my Microbit online for $19.99. It came in a small box and included a battery pack and a USB-to-Micro USB cable. It connects to my Linux laptop very easily and shows up as a USB drive. + +![BBC Microbit board][4] + +### Start coding + +Microbit's website offers several ways to start exploring and [coding][5] quickly, including links to [third-party code editors][6] and its two official editors: [Microsoft MakeCode][7] and [MicroPython][8], which both operate in any browser using any computer (including a Chromebook). MakeCode is a block coding editor, like the popular Scratch interface, and MicroPython is a Python 3 implementation that includes a small subset of the Python library and is designed to work on microcontrollers. Both save your created code as a HEX file, which you can download and copy to the device, just as you would with any other file you are writing to a USB drive. + +The [documentation][9] suggests using the [Mu Python editor][10], which I [wrote about][11] last year, because it's designed to work with the Microbit. One advantage of the Mu editor is it uses the Python REPL (read–evaluate–print loop) to enter code directly to the device, rather than having to download and copy it over. + +When you're writing code for the Microbit, it's important to begin each program with **From microbit import ***. This is true even when you're using the REPL in Mu because it imports all the objects and functions in the Microbit library. + +![Beginning a Microbit project][12] + +### Example projects + +The documentation provides a wealth of code examples and [projects][13] that got me started hacking these incredible devices right away. + +You can start out easy by getting the Microbit to say "Hello." Load your new code using the **Flash** button at the top of the Mu editor. + +![Flash button loads new code][14] + +There are many built-in [images][15] you can load, and you can make your own, too. To display an image, enter the code **display.show(Image.IMAGE)** where IMAGE is the name of the image you want to use. For example, **display.show(Image.HEART)** shows the built-in heart image. + +The **sleep** command adds time between display commands, which I found useful for making the display work a little slower. + +Here is a simple **for** loop with images and a scrolling banner for my favorite NFL football team, the Buffalo Bills. In the code, **display** is a Python object that controls the 25 LEDs on the front of the Microbit. The **show** method within the **display** object indicates which image to show. The **scroll** within the **display** object scrolls the string _"The Buffalo Bills are my team"_ across the LED array. + +![Code for Microbit to display Buffalo Bills tribute][16] + +The Microbit also has two buttons, Button A and Button B, that can be programmed to perform many tasks. Here is a simple example. + +![Code to program Microbit buttons][17] + +By attaching a speaker, the device can speak, beep, and play music. You can also program it to function as a compass and accelerometer and to respond to gestures and movement. Check the documentation for more information about these and other capabilities. + +### Get involved + +Research studies have found that 90% of [teachers in Denmark][18] and [students in the United Kingdom][19] learned to code by using the Microbit. As pressure mounts for programming to become a larger part of the K-12 school curriculum, inexpensive devices like the Microbit can play an important role in achieving that goal. If you want to get involved with the Microbit, be sure to join its [developer community][20]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/getting-started-bbc-microbit + +作者:[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/bbc_microbit_board_hardware.jpg?itok=3HiIupG- (BBC Microbit board) +[2]: https://microbit.org/ +[3]: https://tech.microbit.org/hardware/ +[4]: https://opensource.com/sites/default/files/uploads/image-1.jpg (BBC Microbit board) +[5]: https://microbit.org/code/ +[6]: https://microbit.org/code-alternative-editors/ +[7]: https://makecode.microbit.org/ +[8]: https://python.microbit.org/v/1.1 +[9]: https://microbit-micropython.readthedocs.io/en/latest/tutorials/introduction.html +[10]: https://codewith.mu/en/ +[11]: https://opensource.com/article/18/8/getting-started-mu-python-editor-beginners +[12]: https://opensource.com/sites/default/files/uploads/microbit1_frommicrobitimport.png (Beginning a Microbit project) +[13]: https://microbit.org/ideas/ +[14]: https://opensource.com/sites/default/files/uploads/microbit2_hello.png (Flash button loads new code) +[15]: https://microbit-micropython.readthedocs.io/en/latest/tutorials/images.html +[16]: https://opensource.com/sites/default/files/uploads/microbit3_bills.png (Code for Microbit to display Buffalo Bills tribute) +[17]: https://opensource.com/sites/default/files/uploads/microbit4_buttons.png (Code to program Microbit buttons) +[18]: https://microbit.org/assets/2019-03-05-ultrabit.pdf +[19]: https://www.bbc.co.uk/mediacentre/latestnews/2017/microbit-first-year +[20]: https://tech.microbit.org/get-involved/where-to-find/ diff --git a/sources/tech/20190802 New research article type embeds live code and data.md b/sources/tech/20190802 New research article type embeds live code and data.md new file mode 100644 index 0000000000..a6e256f9b4 --- /dev/null +++ b/sources/tech/20190802 New research article type embeds live code and data.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New research article type embeds live code and data) +[#]: via: (https://opensource.com/article/19/8/reproducible-research) +[#]: author: (Giuliano Maciocci https://opensource.com/users/gmacioccihttps://opensource.com/users/etsang) + +New research article type embeds live code and data +====== +The non-profit scientific research publication platform eLife recently +announced the Reproducible Document Stack (RDS). +![magnifying glass on computer screen][1] + +While science is supposed to be about building on each other's findings to improve our understanding of the world around us, reproducing and reusing previously published results remains challenging, even in the age of the internet. The basic format of the scientific paper—the primary means through which scientists communicate their findings—has more or less remained the same since the first papers were published in the 18th century. + +This is particularly problematic because, thanks to the technological advancements in research over the last two decades, the richness and sophistication of the methods used by researchers have far outstripped the publishing industry's ability to publish them in full. Indeed, the Methods section in research articles remains primarily a huge section of text that does not reflect the complexity or facilitate the reuse of the methods used to obtain the published results. + +### Working together on a solution + +To counter these challenges, eLife [teamed up][2] with [Substance][3] and [Stencila][4] in 2017 to develop a stack of open source tools for authoring, compiling, and publishing computationally reproducible manuscripts online. Our vision for the project is to create a new type of research article that embeds live code, data, and interactive figures within the flow of the traditional manuscript and to provide authors and publishers with the tools to support this new format throughout the publishing lifecycle. + +As a result of our collaboration, we published eLife's [first computationally reproducible article][5] in February 2019. It was based on [a paper][6] in the [Reproducibility Project: Cancer Biology][7] collection. The reproducible version of the article showcases some of the possibilities with the new RDS tools: scientists can share the richness of their research more fully, telling the complete story of their work, while others can directly interact with the authors, interrogate them, and build on their code and data with minimal effort. + +The response from the research community to the release of our first reproducible manuscript was overwhelmingly positive. Thousands of scientists explored the paper's inline code re-execution abilities by manipulating its plots, and several authors approached us directly to ask how they might publish a reproducible version of their own manuscripts. + +Encouraged by this interest and feedback, [in May we announced][8] our roadmap towards an open, scalable infrastructure for the publication of computationally reproducible articles. The goal of this next phase in the RDS project is to ship researcher-centered, publisher-friendly open source solutions that will allow for the hosting and publication of reproducible documents, at scale, by anyone. This includes: + + 1. Developing conversion, rendering, and authoring tools to allow researchers to compose articles from multiple starting points, including GSuite tools, Microsoft Word, and Jupyter notebooks + 2. Optimizing containerization tools to provide reliant and performant reproducible computing environments + 3. Building the backend infrastructure needed to enable the options for live-code re-execution in the browser and PDF export at the same time + 4. Formalizing an open, portable format (DAR) for reproducible document archives + + + +### What's next, and how can you get involved? + +Our first step is to publish reproducible articles as companions of already accepted papers. We will endeavor to accept submissions of reproducible manuscripts in the form of DAR files by the end of 2019. You can learn more about the key areas of innovation in this next phase of development in our article "[Reproducible Document Stack: Towards a scalable solution for reproducible articles][8]." + +The RDS project is being built with three core principles in mind: + + * **Openness:** We prioritize building on top of existing open technologies as well as engaging and involving a community of open source technologists and researchers to create an inclusive tool stack that evolves continuously based on user needs. + * **Interoperability:** We want to make it easy for scientists to create and for publishers to publish reproducible documents from multiple starting points. + * **Modularity:** We're developing tools within the stack in such a way that they can be taken out and integrated into other publisher workflows. + + + +And you can help. We welcome all developers and researchers who wish to contribute to this exciting project. Since the release of eLife's first reproducible article, we have been actively collecting feedback from both the research and open source communities, and this has been (and will continue to be) crucial to shaping the development of the RDS. + +If you'd like to stay up to date on our progress, please sign up for the [RDS community newsletter][9]. For any questions or comments, please [contact us][10]. We look forward to having you with us on the journey. + +* * * + +_This article is based in part on "[Reproducible Document Stack: Towards a scalable solution for reproducible articles][8]" by Giuliano Maciocci, Emmy Tsang, Nokome Bentley, and Michael Aufreiter._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/reproducible-research + +作者:[Giuliano Maciocci][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/gmacioccihttps://opensource.com/users/etsang +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_issue_bug_programming.png?itok=XPrh7fa0 (magnifying glass on computer screen) +[2]: https://elifesciences.org/for-the-press/e6038800/elife-supports-development-of-open-technology-stack-for-publishing-reproducible-manuscripts-online +[3]: https://substance.io/ +[4]: https://stenci.la/ +[5]: https://repro.elifesciences.org/example.html +[6]: https://elifesciences.org/articles/30274 +[7]: https://osf.io/e81xl/wiki/home/ +[8]: https://elifesciences.org/labs/b521cf4d/reproducible-document-stack-towards-a-scalable-solution-for-reproducible-articles +[9]: https://crm.elifesciences.org/crm/RDS-updates +[10]: mailto:innovation@elifesciences.org diff --git a/sources/tech/20190802 Understanding file paths and how to use them in Linux.md b/sources/tech/20190802 Understanding file paths and how to use them in Linux.md new file mode 100644 index 0000000000..1332b99161 --- /dev/null +++ b/sources/tech/20190802 Understanding file paths and how to use them in Linux.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding file paths and how to use them in Linux) +[#]: via: (https://opensource.com/article/19/8/understanding-file-paths-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/jrbarnett) + +Understanding file paths and how to use them in Linux +====== +If you're used to drag-and-drop environments, then file paths may be +frustrating. Learn here how they work, and some basic tricks to make +using them easier. +![open source button on keyboard][1] + +A file path is the human-readable representation of a file or folder’s location on a computer system. You’ve seen file paths, although you may not realize it, on the internet: An internet URL, despite ancient battles fought by proprietary companies like AOL and CompuServe, is actually just a path to a (sometimes dynamically created) file on someone else’s computer. For instance, when you navigate to example.com/index.html, you are actually viewing the HTML file index.html, probably located in the **var** directory on the example.com server. Files on your computer have file paths, too, and this article explains how to understand them, and why they’re important. + +When computers became a household item, they took on increasingly stronger analogies to real-world models. For instance, instead of accounts and directories, personal computers were said to have _desktops_ and _folders_, and eventually, people developed the latent impression that the computer was a window into a virtual version of the real world. It’s a useful analogy, because everyone is familiar with the concept of desktops and file cabinets, while fewer people understand digital storage and memory addresses. + +Imagine for a moment that you invented computers or operating systems. You would probably have created a way to group common files together, because humans love to classify and organize things. Since all files on a computer are on the hard drive, the biggest container you probably would have designated is the drive itself; that is, all files on a drive are in the drive. + +As it turns out, the creators of UNIX had the same instinct, only they called these units of organization _directories_ or _folders_. All files on your computer’s drive are in the system’s base (root) directory. Even external drives are brought into this root directory, just as you might place important related items into one container if you were organizing your office space or hobby room. + +Files and folders on Linux are given names containing the usual components like the letters, numbers, and other characters on a keyboard. But when a file is inside a folder, or a folder is inside another folder, the **/** character shows the relationship between them. That’s why you often see files listed in the format **/usr/bin/python3** or **/etc/os-release**. The forward slashes indicate that one item is stored inside of the item preceding it. + +Every file and folder on a [POSIX][2] system can be expressed as a path. If I have the file **penguin.jpg** in the **photos** folder within my home directory, and my username is **seth**, then the file path can be expressed as **/home/seth/Pictures/penguin.jpg**. + +Most users interact primarily with their home directory, so the tilde (**~**) character is used as a shorthand. That fact means that I can express my example penguin picture as either **/home/seth/Pictures/penguin.jpg** or as **~/Pictures/penguin.jpg**. + +### Practice makes perfect + +Computers use file paths whether you’re thinking of what that path is or not. There’s not necessarily a reason for you to have to think of files in terms of a path. However, file paths are part of a useful framework for understanding how computers work, and learning to think of files in a path can be useful if you’re looking to become a developer (you need to understand the paths to support libraries), a web designer (file paths ensure you’re pointing your HTML to the appropriate CSS), a system administrator, or just a power user. + +#### When in doubt, drag and drop + +If you’re not used to thinking of the structure of your hard drive as a path, then it can be difficult to construct a full path for an arbitrary file. On Linux, most file managers either natively display (or have the option to) the full file path to where you are, which helps reinforce the concept on a daily basis: + +![Dolphin file manager][3] + +opensource.com + +If you’re using a terminal, it might help to know that modern terminals, unlike the teletype machines they emulate, can accept files by way of drag-and-drop. When you copying a file to a server over SSH, for instance, and you’re not certain of how to express the file path, try dragging the file from your GUI file manager into your terminal. The GUI object representing the file gets translated into a text file path in the terminal: + +![Terminals accept drag and drop actions][4] + +opensource.com + +Don’t waste time typing in guesses. Just drag and drop. + +#### **Tab** is your friend + +On a system famous for eschewing three-letter commands when two or even one-letter commands will do, rest assured that no seasoned POSIX user _ever_ types out everything. In the Bash shell, the **Tab** key means _autocomplete_, and autocomplete never lies. For instance, to type the example **penguin.jpg** file’s location, you can start with: + + +``` +$ ~/Pi +``` + +and then press the **Tab** key. As long as there is only one item starting with Pi, the folder **Pictures** autocompletes for you. + +If there are two or more items starting with the letters you attempt to autocomplete, then Bash displays what those items are. You manually type more until you reach a unique string that the shell can safely autocomplete. The best thing about this process isn’t necessarily that it saves you from typing (though that’s definitely a selling point), but that autocomplete is never wrong. No matter how much you fight the computer to autocomplete something that isn’t there, in the end, you’ll find that autocomplete understands paths better than anyone. + +Assume that you, in a fit of late-night reorganization, move **penguin.jpg** from your **~/Pictures** folder to your **~/Spheniscidae** directory. You fall asleep and wake up refreshed, but with no memory that you’ve reorganized, so you try to copy **~/Pictures/penguin.jpg** to your web server, in the terminal, using autocomplete. + +No matter how much you pound on the **Tab** key, Bash refuses to autocomplete. The file you want simply does not exist in the location where you think it exists. That feature can be helpful when you’re trying to point your web page to a font or CSS file _you were sure_ you’d uploaded, or when you’re pointing a compiler to a library you’re _100% positive_ you already compiled. + +#### This isn’t your grandma’s autocompletion + +If you like Bash’s autocompletion, you’ll come to scoff at it once you try the autocomplete in [Zsh][5]. The Z shell, along with the [Oh My Zsh][6] site, provides a dynamic experience filled with plugins for specific programming languages and environments, visual themes packed with useful feedback, and a vibrant community of passionate shell users: + +![A modest Zsh configuration.][7] + +If you’re a visual thinker and find the display of most terminals stagnant and numbing, Zsh may well change the way you interact with your computer. + +### Practice more + +File paths are important on any system. You might be a visual thinker who prefers to think of files as literal documents inside of literal folders, but the computer sees files and folders as named tags in a pool of data. The way it identifies one collection of data from another is by following its designated path. If you understand these paths, you can also come to visualize them, and you can speak the same language as your OS, making file operations much, much faster. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/understanding-file-paths-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/sethhttps://opensource.com/users/jrbarnett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/sites/default/files/images/dolphin-file-path.jpg +[4]: https://opensource.com/sites/default/files/images/terminal-drag-drop.jpg +[5]: https://opensource.com/article/18/9/tips-productivity-zsh +[6]: https://ohmyz.sh/ +[7]: https://opensource.com/sites/default/files/uploads/zsh-simple.jpg (A modest Zsh configuration.) diff --git a/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md new file mode 100644 index 0000000000..b4e1a2667b --- /dev/null +++ b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md @@ -0,0 +1,508 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn how to Install LXD / LXC Containers in Ubuntu) +[#]: via: (https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/) +[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/) + +Learn how to Install LXD / LXC Containers in Ubuntu +====== + +Let me start by explaining what a container is, it is normal process on the host machine (any Linux based m/c) with following characteristics, + + * It feels like a VM, but it is not. + * Uses the host Kernel. + * Cannot boot a different Operating System. + * Can’t have its own modules. + * Does not need “**init”** as PID (Process id) as “1” + + + +[![Learn-LXD-LXC-Containers][1]][2] + +LXC (**LinuX Containers**) technology was developed long ago and is an Operating System level virtualization technology. This was existing from the days of BSD and System-V Release 4 (Popular Unix flavors during 1980-90’s). But until recently, no one new how much it can help us in saving in terms of resource utilization. Because of this technology change, all enterprises are moving towards adoption of virtualization (be it Cloud or be it Docker containers). This also helped in better management of **OpEX(Operational expenditures)** and **CaPEX(Captial expenditures)** costs. Using this technique, we can create and run multiple and isolated Linux virtual environments on a single Linux host machine (called control host). LXC mainly uses Linux’s cgroups and namespaces functionalities, which were introduced in version 2.6.24(kernel version) onwards. In parallel many advancements in hypervisors happened like that of **KVM**, **QEMU**, **Hyper-V**, **ESXi** etc. Especially KVM (Kernel Virtual Machine) which is core of Linux OS, helped in this kind of advancement. + +Difference between LXC and LXD is that LXC is the original and older way to manage containers but it is still supported, all commands of LXC starts with “**lxc-“** like “**lxc-create**” & “**lxc-info**“, whereas LXD is a new way to manage containers and lxc command is used for all containers operations and management. + +All of us know that “**Docker**” utilizes LXC and was developed using Go language, cgroups, namespaces and finally the Linux Kernel itself. Complete Docker has been built and developed using LXC as the basic foundation block. Docker is completely dependent on underlying infrastructure & hardware and using the Operating System as the medium. However, Docker is a portable and easily deployable container engine; all its dependencies are run using a virtual container on most of the Linux based servers. Groups, and Namespaces are the building block concepts for both LXC and Docker containers. Following are the brief description of these concepts. + +### C Groups (Control Groups) + +With Cgroups each resource will have its own hierarchy. + + * CPU, Memory, I/O etc will have their own control group hierarchy. Following are various characterics of Cgroups, + *  Each process is in each node + * Each hierarchy starts with one node + * Initially all processes start at the root node. Therefore “each node” is equivalent to “group of processes”. + * Hierarchies are independent, ex: CPU, Block I/O, memory etc + + + +As explained earlier there are various Cgroup types as listed below, + +1) **Memory Cgroups** + +a) Keeps track of pages used by each group. + +b) File read/write/mmap from block devices + +c) Anonymous memory(stack, heap etc) + +d) Each memory page is charged to a group + +e) Pages can be shared across multiple groups + +2) **CPU Cgroups** + +a) Track users/system cpu time + +b)  Track usage per CPU + +c) Allows set to weights + +d) Can’t set cpu limits + +3) **Block IO Cgroup** + +a) Keep track of read/write(I/O’s) + +b) Set throttle (limits) for each group (per block device) + +c) Set real weights for each group (per block device) + +4) **Devices Cgroup** + +a) Controls what the group can do on device nodes + +b) Permission include /read/write/mknode + +5) **Freezer Cgroup** + +a) Allow to freeze/thaw a group  of processes + +b) Similar to SIGSTOP/SIGCONT + +c) Cannot be detected by processes + +### NameSpaces + +Namespaces provide processes with their own system view. Each process is in name space of each type. + +There are multiple namespaces like, + + * PID – Process within a PID name space only see processes in the same PID name space + * Net – Processes within a given network namespace get their own private network stack. + * Mnt – Processes can have their own “root” and private “mount” points. + * Uts –  Have container its own hostname + * IPC – Allows processes to have own IPC semaphores, IPC message queues and shared memory + * USR – Allows to map UID/GID + + + +### Installation and configuration of LXD containers + +To have LXD installed on Ubuntu system (18.04 LTS) , we can start with LXD installation using below apt command + +``` +root@linuxtechi:~$ sudo apt update +root@linuxtechi:~$ sudo apt install lxd -y +``` + +Once the LXD is installed, we can start with its initialization as below, (most of the times use the default options) + +``` +root@linuxtechi:~$ sudo lxd init +``` + +![lxc-init-ubuntu-system][1] + +Once the LXD is initialized successfully, run the below command to verify information + +``` +root@linuxtechi:~$ sudo lxc info | more +``` + +![lxc-info-command][1] + +Use below command to list if there is any container is downloaded on our host, + +``` +root@linuxtechi:~$ sudo lxc image list ++-------+-------------+--------+-------------+------+------+-------------+ +| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | ++-------+-------------+--------+-------------+------+------+-------------+ +root@linuxtechi:~$ +``` + +Quick and easy way to start the first container on Ubuntu 18.04 (or any supported Ubuntu flavor) use the following command. The container name we have provided is “shashi” + +``` +root@linuxtechi:~$ sudo lxc launch ubuntu:18.04 shashi +Creating shashi +Starting shashi +root@linuxtechi:~$ +``` + +To list out what are the LXC containers that are in the system + +``` +root@linuxtechi:~$ sudo lxc list ++--------+---------+-----------------------+-----------------------------------------------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++--------+---------+-----------------------+-----------------------------------------------+------------+-----------+ +| shashi | RUNNING | 10.122.140.140 (eth0) | fd42:49da:7c44:cebe:216:3eff:fea4:ea06 (eth0) | PERSISTENT | 0 | ++--------+---------+-----------------------+-----------------------------------------------+------------+-----------+ +root@linuxtechi:~$ +``` + +Other Container management commands for LXD are listed below : + +**Note:** In below examples, shashi is my container name + +**How to take bash shell of your LXD Container?** + +``` +root@linuxtechi:~$ sudo lxc exec shashi bash +root@linuxtechi:~# +``` + +**How Stop, Start & Restart LXD Container?** + +``` +root@linuxtechi:~$ sudo lxc stop shashi +root@linuxtechi:~$ sudo lxc list ++--------+---------+------+------+------------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++--------+---------+------+------+------------+-----------+ +| shashi | STOPPED | | | PERSISTENT | 0 | ++--------+---------+------+------+------------+-----------+ +root@linuxtechi:~$ +root@linuxtechi:~$ sudo lxc start shashi +root@linuxtechi:~$ sudo lxc restart shashi +``` + +**How to delete a LXD Container?** + +``` +root@linuxtechi:~$ sudo lxc stop shashi +root@linuxtechi:~$ sudo lxc delete shashi +root@linuxtechi:~$ sudo lxc list ++------+-------+------+------+------+-----------+ +| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS | ++------+-------+------+------+------+-----------+ +root@linuxtechi:~$ +``` + +**How to take snapshot of LXD container and then restore it?** + +Let’s assume we have pkumar container based on centos7 image, so to take the snapshot use the following, + +``` +root@linuxtechi:~$ sudo lxc snapshot pkumar pkumar_snap0 +``` + +Use below command to verify the snapshot + +``` +root@linuxtechi:~$ sudo lxc info pkumar | grep -i Snapshots -A2 +Snapshots: + pkumar_snap0 (taken at 2019/08/02 19:39 UTC) (stateless) +root@linuxtechi:~$ +``` + +Use below command to restore the LXD container from their snapshot + +Syntax: + +$ lxc restore {container_name} {snapshot_name} + +``` +root@linuxtechi:~$ sudo lxc restore pkumar pkumar_snap0 +root@linuxtechi:~$ +``` + +**How to delete LXD container snapshot?** + +``` +$ sudo lxc delete +``` + +**How to set Memory, CPU and Disk Limit on LXD container?** + +Syntax to set Memory limit: + +# lxc config set <container_name> limits.memory <Memory_Size>KB/MB/GB + +Syntax to set CPU limit: + +# lxc config set <container_name>  limits.cpu {Number_of_CPUs} + +Syntax to Set Disk limit: + +# lxc config device set <container_name> root size <Size_MB/GB> + +**Note:** To set a disk limit (it requires btrfs or ZFS filesystem) + +Let’s set limit on Memory and CPU on container shashi using the following commands, + +``` +root@linuxtechi:~$ sudo lxc config set shashi limits.memory 256MB +root@linuxtechi:~$ sudo lxc config set shashi limits.cpu 2 +``` + +### Install and configure LXC container (commands and operations) + +To install lxc on your ubuntu system, use the beneath apt command, + +``` +root@linuxtechi:~$ sudo apt install lxc -y +``` + +In earlier version of LXC, the command “**lxc-clone**” was used and later it was deprecated. Now, “**lxc-copy**” command is widely used for cloning operation. + +**Note:** To get “lxc-copy” command working, use the following installation steps, + +``` +root@linuxtechi:~$ sudo apt install lxc1 -y +``` + +**Creating Linux Containers using the templates** + +LXC provides ready-made templates for easy installation of Linux containers. Templates are usually found in the directory path /usr/share/lxc/templates, but in fresh installation we will not get the templates, so to download the templates in your local system , run the beneath command, + +``` +root@linuxtechi:~$ sudo apt install lxc-templates -y +``` + +Once the lxc-templates are installed successfully then templates will be available, + +``` +root@linuxtechi:~$ sudo ls /usr/share/lxc/templates/ +lxc-alpine lxc-centos lxc-fedora lxc-oci lxc-plamo lxc-sparclinux lxc-voidlinux +lxc-altlinux lxc-cirros lxc-fedora-legacy lxc-openmandriva lxc-pld lxc-sshd +lxc-archlinux lxc-debian lxc-gentoo lxc-opensuse lxc-sabayon lxc-ubuntu +lxc-busybox lxc-download lxc-local lxc-oracle lxc-slackware lxc-ubuntu-cloud +root@linuxtechi:~$ +``` + +Let’s Launch a container using template, + +Syntax: lxc-create -n <container_name> lxc -t <template_name> + +``` +root@linuxtechi:~$ sudo lxc-create -n shashi_lxc -t ubuntu +……………………… +invoke-rc.d: could not determine current runlevel +invoke-rc.d: policy-rc.d denied execution of start. +Current default time zone: 'Etc/UTC' +Local time is now: Fri Aug 2 11:46:42 UTC 2019. +Universal Time is now: Fri Aug 2 11:46:42 UTC 2019. + +## +# The default user is 'ubuntu' with password 'ubuntu'! +# Use the 'sudo' command to run tasks as root in the container. +## +……………………………………… +root@linuxtechi:~$ +``` + +Once the complete template is created, we can login into this console using the following steps + +``` +root@linuxtechi:~$ sudo lxc-start -n shashi_lxc -d +root@linuxtechi:~$ sudo lxc-console -n shashi_lxc + +Connected to tty 1 +Type to exit the console, to enter Ctrl+a itself + +Ubuntu 18.04.2 LTS shashi_lxc pts/0 + +shashi_lxc login: ubuntu +Password: +Last login: Fri Aug 2 12:00:35 UTC 2019 on pts/0 +Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-20-generic x86_64) +To run a command as administrator (user "root"), use "sudo ". +See "man sudo_root" for details. + +root@linuxtechi_lxc:~$ free -h + total used free shared buff/cache available +Mem: 3.9G 23M 3.8G 112K 8.7M 3.8G +Swap: 1.9G 780K 1.9G +root@linuxtechi_lxc:~$ grep -c processor /proc/cpuinfo +1 +root@linuxtechi_lxc:~$ df -h / +Filesystem Size Used Avail Use% Mounted on +/dev/sda1 40G 7.4G 31G 20% / +root@linuxtechi_lxc:~$ +``` + +Now logout or exit from the container and go back to host machine login window. With the lxc-ls command we can see that shashi-lxc container is created. + +``` +root@linuxtechi:~$ sudo lxc-ls +shashi_lxc +root@linuxtechi:~$ +``` + +“**lxc-ls -f**” command provides details with ip address of the container and the same is as below, + +``` +root@linuxtechi:~$ sudo lxc-ls -f +NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED +shashi_lxc RUNNING 0 - 10.0.3.190 - false +root@linuxtechi:~$ +``` + +“**lxc-info -n <container_name>**” command provides with all the required details along with State, ip address etc. + +``` +root@linuxtechi:~$ sudo lxc-info -n shashi_lxc +Name: shashi_lxc +State: RUNNING +PID: 6732 +IP: 10.0.3.190 +CPU use: 2.38 seconds +BlkIO use: 240.00 KiB +Memory use: 27.75 MiB +KMem use: 5.04 MiB +Link: vethQ7BVGU + TX bytes: 2.01 KiB + RX bytes: 9.52 KiB + Total bytes: 11.53 KiB +root@linuxtechi:~$ +``` + +**How to Start, Stop, Restart and Delete LXC containers** + +``` +$ lxc-start -n +$ lxc-stop -n +$ lxc-destroy -n +``` + +**LXC Cloning operation** + +Now the main cloning operation to be performed on the LXC container. The following steps are followed + +As described earlier LXC offers a feature of cloning a container from the existing container, by running the following command to clone an existing “shashi_lxc” container to a new container “shashi_lxc_clone”. + +**Note:** We have to make sure that before starting the cloning operation, first we have to stop the existing container using the “**lxc-stop**” command. + +``` +root@linuxtechi:~$ sudo lxc-stop -n shashi_lxc +root@linuxtechi:~$ sudo lxc-copy -n shashi_lxc -N shashi_lxc_clone +root@linuxtechi:~$ sudo lxc-ls +shashi_lxc shashi_lxc_clone +root@linuxtechi:~$ +``` + +Now start the cloned container + +``` +root@linuxtechi:~$ sudo lxc-start -n shashi_lxc_clone +root@linuxtechi:~$ sudo lxc-ls -f +NAME STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED +shashi_lxc STOPPED 0 - - - false +shashi_lxc_clone RUNNING 0 - 10.0.3.201 - false +root@linuxtechi:~$ +``` + +With the above set of commands, cloning operation is done and the new clone “shashi_lxc_clone” got created. We can login into this lxc container console with below steps, + +``` +root@linuxtechi:~$ sudo lxc-console -n shashi_lxc_clone + +Connected to tty 1 +Type to exit the console, to enter Ctrl+a itself +Ubuntu 18.04.2 LTS shashi_lxc pts/0 + +shashi_lxc login: +``` + +**LXC Network configuration and commands** + +We can attach to the newly created container, but to remotely login into this container using SSH or any other means, we have to do some minimal configuration changes as explained below, + +``` +root@linuxtechi:~$ sudo lxc-attach -n shashi_lxc_clone +root@linuxtechi_lxc:/# +root@linuxtechi_lxc:/# useradd -m shashi +root@linuxtechi_lxc:/# passwd shashi +Enter new UNIX password: +Retype new UNIX password: +passwd: password updated successfully +root@linuxtechi_lxc:/# +``` + +First install the ssh server using the following command so that smooth “ssh” connect can be established. + +``` +root@linuxtechi_lxc:/# apt install openssh-server -y +``` + +Now get the IP address of the existing lxc container using the following command, + +``` +root@linuxtechi_lxc:/# ip addr show eth0|grep inet + inet 10.0.3.201/24 brd 10.0.3.255 scope global dynamic eth0 + inet6 fe80::216:3eff:fe82:e251/64 scope link +root@linuxtechi_lxc:/# +``` + +From the host machine with a new console window, use the following command to connect to this container over ssh + +``` +root@linuxtechi:~$ ssh 10.0.3.201 +root@linuxtechi's password: +$ +``` + +Now, we have logged in a container using ssh session. + +**LXC process related commands** + +``` +root@linuxtechi:~$ ps aux|grep lxc|grep -v grep +``` + +![lxc-process-ubuntu-system][1] + +**LXC snapshot operation** + +Snapshotting is one of the main operations which will help in taking point in time snapshot of the lxc container images. These same snapshot images can be used later for further use. + +``` +root@linuxtechi:~$ sudo lxc-stop -n shashi_lxc +root@linuxtechi:~$ sudo lxc-snapshot -n shashi_lxc +root@linuxtechi:~$ +``` + +The snapshot path can be located using the following command. + +``` +root@linuxtechi:~$ sudo lxc-snapshot -L -n shashi_lxc +snap0 (/var/lib/lxc/shashi_lxc/snaps) 2019:08:02 20:28:49 +root@linuxtechi:~$ +``` + +**Conclusion:** + +LXC, LinuX containers is one of the early container technologies. Understanding the concepts and learning about LXC will help in deeper understanding of any other containers like Docker Containers. This article has provided deeper insights on Cgroup and Namespaces which are also very much required concepts for better understanding of Containers and like. Many of the LXC operations like cloning, snapshotting, network operation etc are covered with command line examples. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/ + +作者:[Shashidhar Soppin][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/shashidhar/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Learn-LXD-LXC-Containers.jpg diff --git a/sources/tech/20190805 How To Magnify Screen Areas On Linux Desktop.md b/sources/tech/20190805 How To Magnify Screen Areas On Linux Desktop.md new file mode 100644 index 0000000000..cd53bf8941 --- /dev/null +++ b/sources/tech/20190805 How To Magnify Screen Areas On Linux Desktop.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Magnify Screen Areas On Linux Desktop) +[#]: via: (https://www.ostechnix.com/how-to-magnify-screen-areas-on-linux-desktop/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +How To Magnify Screen Areas On Linux Desktop +====== + +Have you ever been in a situation where you wanted to magnify a particular portion of your screen? If you’re a graphic designer, you might be definitely in this situation often. Please note that I am not talking about enlarging a text. Magnifying the screen area is different than merely enlarging the text size. Magnification is the process of enlarging something (E.g. Images) only in appearance, not in physical size. Fortunately, there are many applications available to magnify screen areas on Linux systems. The magnifiers can help the artists or graphic designers for accurate graphical design and/or detail work. This can also help to those who have poor eyesight or small screen size monitor with low resolutions in general. + +### Magnify Screen Areas On Linux Desktop + +There could be several ways, applications to do this. I am aware of the following two methods as of writing this guide. I will keep looking for more ways and applications which will help to magnify, try them out and update this guide in future. + +##### Method 1 – Using Magnus + +Magnus is a small and simple desktop magnifier application for Linux. It literally follows the mouse cursor, allowing you to move around by zooming in on parts of the screen. It shows the screen areas around the mouse pointer in a separate window magnified up to five times. Magnus is free, open source application released under MIT license. + +Magnus is available as [**snap**][1] application. So we can install it on Linux distributions that supports snaps using command: + +``` +$ sudo snap install magnus +``` + +There is also a PPA for Magnus is available. + +``` +$ sudo add-apt-repository ppa:flexiondotorg/magnus + +$ sudo apt update + +$ sudo apt install magnus +``` + +Once Magnus is installed, launch it from menu or application launcher. + +You will see a small window on the top left corner of your screen. You can move it to any side of the screen and increase its size by simply dragging the hot corners windows. + +![][3] + +Magnus screen magnifier Interface + +Now, move the mouse pointer around the screen areas to magnify them. + +![][4] + +Magnify Screen Areas On Linux Desktop Using Magnus + +You can increase the zooming level (by 2x, 3x, 4x and 5x) from the drop-down box in the tool bar of Magnus app. By default, Magnus will magnify the areas in 2x size. + +##### Method 2 – Using Universal Access menu + +If you’re a GNOME user, you need not to install any external applications. GNOME desktop comes with a built-in feature called **Universal Access** which will provide many accessibility features such as, + + * Magnifying screen areas, + * Read screen aloud, + * Read screen in Braille, + * Change text size, + * Adjust contrast, + * Adjust speed of mouse/touchpad, + * Use on-screen keyboard, + * And many. + + + +We will look into only one feature i.e magnifying screen areas. + +Launch Universal Access menu. It is usually found under System Settings. Or, click on a person-like icon on the top bar. + +There are many accessibility options available in Universal access menu as shown in the picture below. To enable magnification, click on **Zoom** tab. + +![][5] + +Universal Access menu + +In the Zoom options window, simply enable Zoom option. Just click the **ON/OFF slider button** to enable/disable zoom option. + +![][6] + +Magnify Screen Areas On Linux Desktop Using Universal Access menu + +Once you enabled the zoom option, the screen areas will simply magnify when you move the mouse pointer around them. You can increase or decrease the zooming level by simply clicking on the +/- buttons besides Magnification option. + +Unlike Magnus application, Universal access menu offers a few additional functionalities as listed below. + + * Change mouse tracking. This setting can be applied in the **Magnifier tab** of Zoom options window. + * Change position of the magnified view on the screen i.e entire screen or part of the screen like top half, bottom half, left half and right half. To adjust these settings, go to **Magnifier tab**. + * Activate crosshairs to help you find the mouse or touchpad pointer. Also, we can adjust mouse or touchpad thickness, length and color. These settings can be changed in the **Crosshairs tab**. + * Adjust color effects such as brightness, contrast, color. All of these settings can be adjusted in **Color effects tab**. + + + +I tested these two methods on Ubuntu 18.04 desktop and I could easily magnify the screen areas. + +To be honest, I never knew that we can magnify a screen area in Linux. Before I know about this, all I would do is just screenshot the area and zoom in/out using an image viewer application. Well, not anymore! I know now how to magnify a screen area on Linux desktop and I hope this will be useful to you too. + +**Resources:** + + * [**Magnus GitHub Repository**][7] + * [**Ubuntu documentation**][8] + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-magnify-screen-areas-on-linux-desktop/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/introduction-ubuntus-snap-packages/ +[3]: https://www.ostechnix.com/wp-content/uploads/2019/07/Magnus-launch.png +[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/Magnify-Screen-Areas-On-Linux-Desktop-Using-Magnus.gif +[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/Universal-Access-menu.png +[6]: https://www.ostechnix.com/wp-content/uploads/2019/07/Magnify-Screen-Areas-On-Linux-Desktop-Using-Universal-Access-menu.png +[7]: https://github.com/stuartlangridge/magnus +[8]: https://help.ubuntu.com/stable/ubuntu-help/a11y-mag.html.en diff --git a/sources/tech/20190805 How To Screenshot Right Click Context Menu On Linux.md b/sources/tech/20190805 How To Screenshot Right Click Context Menu On Linux.md new file mode 100644 index 0000000000..17f13338dc --- /dev/null +++ b/sources/tech/20190805 How To Screenshot Right Click Context Menu On Linux.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Screenshot Right Click Context Menu On Linux) +[#]: via: (https://www.ostechnix.com/how-to-screenshot-right-click-context-menu-on-linux/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +How To Screenshot Right Click Context Menu On Linux +====== + +![How To Screenshot Right Click Context Menu On Linux][1] + +Taking screenshots is part of my work. I take a lot of screenshots daily to use them in my guides. The other day, I had to screenshot the right-click context menu while writing a guide to show our readers how to [**add ‘New Document’ option in right click context menu in Ubuntu 18.04 LTS desktop**][2]. Usually, I take screenshots with **Print screen** button in the keyboard and **Deepin Screenshot** application. While trying to screenshot the context menu using Deepin Screenshot app, the context menu automatically disappeared as soon as I clicked the Deepin Screenshot. Printscreen also doesn’t work when the context menu is open. If you happened to be in this situation, here are two simple workarounds to screenshot right click context menu on Linux systems with GNOME DE. + +### Screenshot Right-click Context Menu On Linux + +If you want to take the screenshot of right click context menu when it is open, simply instruct the screenshot apps to wait for a particular seconds before taking a screenshot. + +We can do this in two ways, the CLI way and GUI way. First, we will see the CLI way. + +##### 1\. Schedule screenshots using Scrot + +As you might already know, [**Scrot**][3] (short for **SCR** eensh **OT** ) is a command-line screenshot tool for taking screenshots in Unix-like operating systems. Scrot comes pre-installed in most Linux distributions. Just in case, if it is not installed already, you can install it using your distribution’s default package manager. For example, run the following command to install Scrot on Ubuntu and its derivatives: + +``` +$ sudo apt install scrot +``` + +Now we are going to instruct Scrot to wait for X seconds, for example 5 seconds, before taking a screenshot using command: + +``` +$ scrot -d 5 +``` + +Now, right click anywhere to open the context menu and wait for 5 seconds. Scrot will take screenshot exactly after 5 seconds. + +![][4] + +Screenshot Right-click Context Menu On Linux Using Scrot + +You can set the timeout value as you wish. + +If you’re not comfortable with CLI way, no problem! We can do this in GUI way as well. + +##### 2\. Schedule screenshots using Gnome Screenshot + +Open Gnome Screenshot application. it comes pre-installed with GNOME desktop. Now, set a time (E.g. 5 seconds) after which the picture has to be taken, click **Take screenshot** button, open the right click context menu and simply wait for 5 seconds. The screenshot will be taken in 5 seconds. + +![][5] + +Screenshot Right-click Context Menu On Linux Using Gnome screenshot + +And, that’s all. This is how we can take screenshots when a menu is open or running. Of course, some advanced screenshot applications like **Shutter** can do this as well. But I find these two ways much easier. + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-screenshot-right-click-context-menu-on-linux/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/07/Screenshot-Right-Click-Context-Menu-720x340.png +[2]: https://www.ostechnix.com/how-to-add-new-document-option-in-right-click-context-menu-in-ubuntu-18-04/ +[3]: https://www.ostechnix.com/take-screenshots-command-line-using-scrot-linux/ +[4]: https://www.ostechnix.com/wp-content/uploads/2019/07/Screenshot-Right-click-Context-Menu-On-Linux.gif +[5]: https://www.ostechnix.com/wp-content/uploads/2019/07/Screenshot-Right-click-Context-Menu-On-Linux-Using-Gnome-screenshot.gif diff --git a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md new file mode 100644 index 0000000000..8b9677ba83 --- /dev/null +++ b/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md @@ -0,0 +1,267 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) +[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Install and Configure PostgreSQL on Ubuntu +====== + +_**In this tutorial, you’ll learn how to install and use the open source database PostgreSQL on Ubuntu Linux.**_ + +[PostgreSQL][1] (or Postgres) is a powerful, free and open-source relational database management system ([RDBMS][2]) that has a strong reputation for reliability, feature robustness, and performance. It is designed to handle various tasks, of any size. It is cross-platform, and the default database for [macOS Server][3]. + +PostgreSQL might just be the right tool for you if you’re a fan of a simple to use SQL database manager. It supports SQL standards and offers additional features, while also being heavily extendable by the user as the user can add data types, functions, and do many more things. + +Earlier I discussed [installing MySQL on Ubuntu][4]. In this article, I’ll show you how to install and configure PostgreSQL, so that you are ready to use it to suit whatever your needs may be. + +![][5] + +### Installing PostgreSQL on Ubuntu + +PostgreSQL is available in Ubuntu main repository. However, like many other development tools, it may not be the latest version. + +First check the PostgreSQL version available in [Ubuntu repositories][6] using this [apt command][7] in the terminal: + +``` +apt show postgresql +``` + +In my Ubuntu 18.04, it showed that the available version of PostgreSQL is version 10 (10+190 means version 10) whereas PostgreSQL version 11 is already released. + +``` +Package: postgresql +Version: 10+190 +Priority: optional +Section: database +Source: postgresql-common (190) +Origin: Ubuntu +``` + +Based on this information, you can make your mind whether you want to install the version available from Ubuntu or you want to get the latest released version of PostgreSQL. + +I’ll show both methods to you. + +#### Method 1: Install PostgreSQL from Ubuntu repositories + +In the terminal, use the following command to install PostgreSQL + +``` +sudo apt update +sudo apt install postgresql postgresql-contrib +``` + +Enter your password when asked and you should have it installed in a few seconds/minutes depending on your internet speed. Speaking of that, feel free to check various [network bandwidth in Ubuntu][8]. + +What is postgresql-contrib? + +The postgresql-contrib or the contrib package consists some additional utilities and functionalities that are not part of the core PostgreSQL package. In most cases, it’s good to have the contrib package installed along with the PostgreSQL core. + +[][9] + +Suggested read  Fix gvfsd-smb-browse Taking 100% CPU In Ubuntu 16.04 + +#### Method 2: Installing the latest version 11 of PostgreSQL in Ubuntu + +To install PostgreSQL 11, you need to add the official PostgreSQL repository in your sources.list, add its certificate and then install it from there. + +Don’t worry, it’s not complicated. Just follow these steps. + +Add the GPG key first: + +``` +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +``` + +Now add the repository with the below command. If you are using Linux Mint, you’ll have to manually replace the `lsb_release -cs` the Ubuntu version your Mint release is based on. + +``` +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' +``` + +Everything is ready now. Install PostgreSQL with the following commands: + +``` +sudo apt update +sudo apt install postgresql postgresql-contrib +``` + +PostgreSQL GUI application + +You may also install a GUI application (pgAdmin) for managing PostgreSQL databases: + +_sudo apt install pgadmin4_ + +### Configuring PostgreSQL + +You can check if **PostgreSQL** is running by executing: + +``` +service postgresql status +``` + +Via the **service** command you can also **start**, **stop** or **restart** **postgresql**. Typing in **service postgresql** and pressing **Enter** should output all options. Now, onto the users. + +By default, PostgreSQL creates a special user postgres that has all rights. To actually use PostgreSQL, you must first log in to that account: + +``` +sudo su postgres +``` + +Your prompt should change to something similar to: + +``` +[email protected]:/home/ubuntu$ +``` + +Now, run the **PostgreSQL Shell** with the utility **psql**: + +``` +psql +``` + +You should be prompted with: + +``` +postgress=# +``` + +You can type in **\q** to **quit** and **\?** for **help**. + +To see all existing tables, enter: + +``` +\l +``` + +The output will look similar to this (Hit the key **q** to exit this view): + +![PostgreSQL Tables][10] + +With **\du** you can display the **PostgreSQL users**: + +![PostgreSQLUsers][11] + +You can change the password of any user (including **postgres**) with: + +``` +ALTER USER postgres WITH PASSWORD 'my_password'; +``` + +**Note:** _Replace **postgres** with the name of the user and **my_password** with the wanted password._ Also, don’t forget the **;** (**semicolumn**) after every statement. + +It is recommended that you create another user (it is bad practice to use the default **postgres** user). To do so, use the command: + +``` +CREATE USER my_user WITH PASSWORD 'my_password'; +``` + +If you run **\du**, you will see, however, that **my_user** has no attributes yet. Let’s add **Superuser** to it: + +``` +ALTER USER my_user WITH SUPERUSER; +``` + +You can **remove users** with: + +``` +DROP USER my_user; +``` + +To **log in** as another user, quit the prompt (**\q**) and then use the command: + +``` +psql -U my_user +``` + +You can connect directly to a database with the **-d** flag: + +``` +psql -U my_user -d my_db +``` + +You should call the PostgreSQL user the same as another existing user. For example, my use is **ubuntu**. To log in, from the terminal I use: + +``` +psql -U ubuntu -d postgres +``` + +**Note:** _You must specify a database (by default it will try connecting you to the database named the same as the user you are logged in as)._ + +If you have a the error: + +``` +psql: FATAL: Peer authentication failed for user "my_user" +``` + +Make sure you are logging as the correct user and edit **/etc/postgresql/11/main/pg_hba.conf** with administrator rights: + +``` +sudo vim /etc/postgresql/11/main/pg_hba.conf +``` + +**Note:** _Replace **11** with your version (e.g. **10**)._ + +Here, replace the line: + +``` +local all postgres peer +``` + +With: + +``` +local all postgres md5 +``` + +Then restart **PostgreSQL**: + +``` +sudo service postgresql restart +``` + +Using **PostgreSQL** is the same as using any other **SQL** type database. I won’t go into the specific commands, since this article is about getting you started with a working setup. However, here is a [very useful gist][12] to reference! Also, the man page (**man psql**) and the [documentation][13] are very helpful. + +[][14] + +Suggested read  [How To] Share And Sync Any Folder With Dropbox in Ubuntu + +**Wrapping Up** + +Reading this article has hopefully guided you through the process of installing and preparing PostgreSQL on an Ubuntu system. If you are new to SQL, you should read this article to know the [basic SQL commands][15]: + +[Basic SQL Commands][15] + +If you have any issues or questions, please feel free to ask in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-postgresql-ubuntu/ + +作者:[Sergiu][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/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.postgresql.org/ +[2]: https://www.codecademy.com/articles/what-is-rdbms-sql +[3]: https://www.apple.com/in/macos/server/ +[4]: https://itsfoss.com/install-mysql-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1 +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://itsfoss.com/apt-command-guide/ +[8]: https://itsfoss.com/network-speed-monitor-linux/ +[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1 +[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546 +[13]: https://www.postgresql.org/docs/manuals/ +[14]: https://itsfoss.com/sync-any-folder-with-dropbox/ +[15]: https://itsfoss.com/basic-sql-commands/ diff --git a/sources/tech/20190805 Navigating the filesystem with relative paths at the command line.md b/sources/tech/20190805 Navigating the filesystem with relative paths at the command line.md new file mode 100644 index 0000000000..f532ad8571 --- /dev/null +++ b/sources/tech/20190805 Navigating the filesystem with relative paths at the command line.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Navigating the filesystem with relative paths at the command line) +[#]: via: (https://opensource.com/article/19/8/navigating-filesystem-relative-paths) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) + +Navigating the filesystem with relative paths at the command line +====== +Learn the difference between absolute and relative paths and how to use +them, and save yourself a lot of time and potential trouble. +![Blue folders flying in the clouds above a city skyline][1] + +If you’re on your way to work, but you stop by a deli for breakfast first, you don’t go back home after breakfast so you can restart your journey. Instead, you continue from where you are because you understand where your office is located relative to your current location. Navigating your computer is the same way. If you change your working directory in a terminal to a subdirectory, such as **Pictures**, you don’t necessarily have to go home again just to make your way into **Documents**. Instead, you use a _relative_ path. + +Conversely, absolute paths always begin from the start of your hard drive. You know that you’ve reached the start by a lone forward slash (**/**) with nothing to its left, because your drive’s root level is the biggest container, holding all your folders and files within it. For that reason, the path **/home/seth** (and its shorthand version **~**, although that’s less clear, because it lacks the leftmost slash) is considered an absolute path. It represents your hard drive’s base level, which contains the **home** directory, which in turn contains **seth** (my username). + +Anything starting with a forward slash is an absolute path, which is the digital equivalent of you going 12 blocks back home just to reach a location that’s two blocks away from where you are now. That fact doesn’t mean absolute paths are bad, though. There are many valid reasons to use absolute paths, not the least of which is their clarity. If you can navigate your drive from absolute paths, then use that as a wayfinder. With auto-completion, typing a full path can be as quick as using a relative path, [especially with autocompletion][2]. + +That said, relative paths can be convenient, and in some cases vital. For instance, you can never be sure of a web server’s absolute path. If a web designer knows they keep [web fonts in a local directory][3] and they link to those fonts on their development laptop using the absolute path **/home/webdev/Public/[www.example.com/fonts][4]**, then all of their links break when the code is pushed to **/var/www/example.com/fonts** on the server. + +Besides that, sometimes it really is quicker and easier to type **cd ../Documents** instead of **cd /home/seth/Documents**. + +Relative paths use two control sequences: the single (**.**) and the double (**..**) dot. A single dot means _don’t move_. The double dot means _take one step back_. These dots work best when you’re somewhat familiar with what’s on your drive, and provided that you can visualize the corresponding paths. + +It may help to visualize each directory as a room in a house. For instance, knowing that you have a home directory that contains both a **Pictures** and a **Documents** folder, you can visualize each subdirectory as a step forward from home: + +![Stepping into a directory.][5] + +To get from one room to the other, you must go back to the common area using the _step back_ control sequence, and then step forward into the other. You can get your current location at any time with the **pwd** (print working directory) command: + + +``` +$ pwd +/home/seth/Pictures +$ cd ../Documents +$ pwd +/home/seth/Documents +``` + +Remember that a single dot means _don’t move_, and it does exactly that: + + +``` +$ pwd +/home/seth +$ cd . +$ pwd +/home/seth +``` + +It might seem odd to have a special command representing a state of no change, but it’s a usefully explicit directive. For instance, were you to create a custom application to [list a directory’s contents][6] and save it in your home directory, foolishly naming the application **reboot**, then any time you used that custom application you would want to be careful that your computer knew _exactly_ which **reboot** command to execute. + +One way you can specify which version is to provide an explicit path to your custom and poorly named application. The single dot reinforces your desire not to stray from your intended path when you’re already in the directory: + + +``` +$ pwd +/home/seth +$ ./reboot +Documents/     Downloads/ +Music/         Pictures/ +Public/        Spheniscidae/ +Videos/        Yugolothae/ +``` + +Sometimes the single dot can be useful as a filler character in paths that you expect to contain a number of levels. For instance, take a web developer who used several links to a **font** directory that was once three steps back. Recently, though, this developer moved the **font** directory into the same directory as their HTML. If the developer doesn’t replace all instances of **../../../fonts** with **./././fonts**, their site will break. + +**Note:** In the case of this example, changing **../../../fonts** to **./fonts** would work, but assume for the sake of this example that doing so would break a script that expects to see three levels before the **fonts** directory. + +Relative paths can be confusing at first, so stick to absolute paths when navigating your computer until you’re comfortable with the concept of relativity. Many people find them useful, while others do not use them. It’s all relative. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/navigating-filesystem-relative-paths + +作者:[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/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO (Blue folders flying in the clouds above a city skyline) +[2]: https://opensource.com/article/19/7/understanding-file-paths-and-how-use-them#autocomplete +[3]: https://opensource.com/article/19/3/webfonts +[4]: http://www.example.com/fonts +[5]: https://opensource.com/sites/default/files/uploads/path-layout.jpg (Stepping into a directory.) +[6]: https://opensource.com/article/19/7/master-ls-command diff --git a/sources/tech/20190805 What-s your favorite open source BI software.md b/sources/tech/20190805 What-s your favorite open source BI software.md new file mode 100644 index 0000000000..b7ea3e1046 --- /dev/null +++ b/sources/tech/20190805 What-s your favorite open source BI software.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's your favorite open source BI software?) +[#]: via: (https://opensource.com/article/19/8/favorite-open-source-bi-software) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeohttps://opensource.com/users/seth) + +What's your favorite open source BI software? +====== +What business intelligence applications are you using to gather and +share insights from your data? Please let us know in our poll. +![Open for business][1] + +Open source software has come a long way since the [Open Source Initiative][2] was founded in February 1998. Back then, the thought of releasing source code anyone could change scared many commercial software vendors. Now, according to Red Hat's 2019 [State of Enterprise Open Source survey][3], 99% of IT leaders say open source software plays at least a "somewhat important" role in their enterprise IT strategy. + +Open source principles play an equally key role in business intelligence (BI). [Gartner's Magic Quadrant for Data Science and Machine Learning][4] said the market is in the midst of a "big bang" that's redefining the "who" and "how" of data science and ML. In this report (available for clients), the authors cite open source software as one reason for the growth of [citizen data scientists][5]—"'power users' who can perform both simple and moderately sophisticated analytical tasks that would previously have required more expertise." + +### What is open source BI software? + +Open source business intelligence (BI) software helps users upload, visualize, and make decisions based on data that is pulled from several sources. Like all open source software, its source code is public. That's because the copyright holder allows anyone to review, revise, and run the software at any time, for any reason. These benefits extend to users and non-users alike. + +BI involves [turning data into insights][6] that help your business make better decisions. This type of software allows users to pull data from a range of sources, then share it with colleagues and clients. + +[Dashboards and reports][7] are two standard features you should look for. Advanced BI tools like [Kibana][8] also offer data visualizations, while others (like [Sisense][9]) pride themselves on the ability to be set up in-house. + +One big benefit of open source software is having so many developers fixing code at once. Likewise, open source BI software democratizes data. With countless people working on—and within—the same tool, open source BI software gives teams the power to share data with more colleagues from one centralized resource. + +The quality of the data used to make decisions is a top concern for small business leaders GetApp [surveyed][10] in Spring 2019. So, before choosing which open source BI tool to adopt, it's worth weighing the pros and cons of each tool against your business needs. + +_Which open source BI software does your team use? What's your main goal for using it? (Boost collaboration, visualize data, use a wider range of data, etc.?) Which challenges (if any) have you encountered bringing BI software into your business? Keep this conversation going in the comments!_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/favorite-open-source-bi-software + +作者:[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/lmaffeohttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_openseries.png?itok=rCtTDz5G (Open for business) +[2]: https://opensource.org/ +[3]: https://www.redhat.com/en/enterprise-open-source-report/2019 +[4]: https://www.gartner.com/en/documents/3899464/magic-quadrant-for-data-science-and-machine-learning-pla +[5]: https://blogs.gartner.com/carlie-idoine/2018/05/13/citizen-data-scientists-and-why-they-matter/ +[6]: https://www.getapp.com/business-intelligence-analytics-software/business-intelligence/#guide +[7]: https://www.getapp.com/business-intelligence-analytics-software/business-intelligence/#features-to-watch-for +[8]: https://www.elastic.co/products/kibana +[9]: https://www.getapp.com/business-intelligence-analytics-software/a/sisense-prism/ +[10]: https://lab.getapp.com/data-driven-decision-making/ diff --git a/sources/tech/20190806 3 tools for doing presentations from the command line.md b/sources/tech/20190806 3 tools for doing presentations from the command line.md new file mode 100644 index 0000000000..d77d756611 --- /dev/null +++ b/sources/tech/20190806 3 tools for doing presentations from the command line.md @@ -0,0 +1,207 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 tools for doing presentations from the command line) +[#]: via: (https://opensource.com/article/19/8/command-line-presentation-tools) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitthttps://opensource.com/users/murphhttps://opensource.com/users/scottnesbitthttps://opensource.com/users/scottnesbitt) + +3 tools for doing presentations from the command line +====== +mdp, tpp, and sent may not win you any design awards, but they'll give +you basic slides that you can run from a terminal. +![Files in a folder][1] + +Tired of creating and displaying presentation slides using [LibreOffice Impress][2] or various slightly geeky [tools][3] and [frameworks][4]? Instead, consider running the slides for your next talk from a terminal window. + +Using the terminal to present slides sounds strange, but it isn't. Maybe you want to embrace your inner geek a bit more. Perhaps you want your audience to focus on your ideas rather than your slides. Maybe you're a devotee of the [Takahashi method][5]. Whatever your reasons for turning to the terminal, there's a (presentation) tool for you. + +Let's take a look at three of them. + +### mdp + +Seeing as how I'm something of a Markdown person, I took [mdp][6] for a spin the moment I heard about it. + +You create your slides in a text editor, prettying the text up with Markdown. mpd recognizes most Markdown formatting—from headings and lists to code blocks to character formatting and URLs. + +You can also add a [Pandoc metadata block][7], which can contain your name, the title of your presentation, and the date you're giving your talk. That adds the title to the top of every slide and your name and the date to the bottom. + +Your slides are in a single text file. To let mdp know where a slide starts, add a line of dashes after each slide. + +Here's a very simple example: + + +``` +%title: Presentation Title +%author: Your Name +%date: YYYY-MM-DD + +-> # Slide 1 <- + +Intro slide + +\-------------------------------------------------- +-> # Slide 2 <- +============== + +* Item 1 +* Item 2 +* Item 3 + +\------------------------------------------------- +-> # Slide 3  <- + +This one with a numbered list + +1\. Item 1 +2\. Item 2 +3\. Item 3 + +\------------------------------------------------- + +-> # Conclusion  <- + +mdp supports *other* **formatting**, too. Give it a try! +``` + +See the **->** and **<-** surrounding the titles of each slide? Any text between those characters is centered in a terminal window. + +Run your slideshow by typing **mdp slides.md** (or whatever you named your file) in a terminal window. Here's what the example slides I cobbled together look like: + +![Example mdp slide][8] + +Cycle through them by pressing the arrow keys or the spacebar on your keyboard. + +### tpp + +[tpp][9] is another simple, text-based presentation tool. It eschews Markdown for its own formatting. While the formatting is simple, it's very concise and offers a couple of interesting—and useful—surprises. + +You use dashes to indicate most of the formatting. You can add a metadata block at the top of your slide file to create the title slide for your presentation. Denote headings by typing **\--heading** followed by the heading's text. Center text on a slide by typing **\--center** and then the text. + +To create a new slide, type: + + +``` +\--- +\--newpage +``` + +Here's an example of some basic slides: + + +``` +\--title Presentation Title +\--date YYYY-MM-DD +\--author Your Name + +\--- +\--newpage + +\--heading Slide 1 + +  * Item 1 + +\--- +\--newpage + +\--heading Slide 2 +  * Item 1 +  * Item 2 + +\--- +\--newpage + +\--heading Slide 3 + +  * Item 1 +  * Item 2 +  * Item 3 +``` + +Here's what they look like in a terminal window: + +![tpp slide example][10] + +Move through your slides by pressing the arrow keys on your keyboard. + +What about those interesting and useful surprises I mentioned earlier? You can add a splash of color to the text on a slide by typing **\--color** and then the name of the color you want to use—for example, **red**. Below that, add the text whose color you want to change, like this: + + +``` +\--color red +Some text +``` + +If you have a terminal command that you want to include on a slide, wrap it between **\--beginoutput** and **\--endoutput**. Taking that a step further, you can simulate typing the command by putting it between **\--beginshelloutput** and **\--endshelloutput**. Here's an example: + +![Typing a command on a slide with tpp][11] + +### Sent + +[Sent][12] isn't strictly a command-line presentation tool. You run it from the command line, but it opens an X11 window containing your slides. + +Sent is built around the Takahashi method for presenting that I mentioned at the beginning of this article. The core idea behind the Takahashi method is to have one or two keywords in large type on a slide. The keywords distill the idea you're trying to get across at that point in your presentation. + +As with mpd and tpp, you craft your slides in [plain text][13] in a text editor. Sent doesn't use markup, and there are no special characters to indicate where a new slide begins. Sent assumes each new paragraph is a slide. + +You're not limited to using text. Sent also supports images. To add an image to a slide, type **@** followed by the name of the image—for example, **@mySummerVacation.jpg**. + +Here's an excerpt from a slide file: + + +``` +On Writing Evergreen Articles + +Evergreen? + +8 Keys to Good Evergreen Articles + +@images/typewriter.jpg + +Be Passionate + +Get Your Hands Dirty + +Focus +``` + +Fire up your slides by typing **sent filename** in a terminal window. The X11 window that opens goes into full-screen mode and displays text in as large a font as possible. Any images in your slides are centered in the window. + +![Example Sent slide][14] + +### Drawbacks of these tools + +You're not going to win any design awards for the slides you create with mdp, tpp, or sent. They're plain. They're utilitarian. But, as I pointed out at the beginning of this article, the slides you create and present with those tools can help your audience focus on what you're saying rather than your visuals. + +If you use mdp or tpp, you need to do some fiddling with your terminal emulator's settings to get the fonts and sizes right. Out of the box, the fonts might be too small—as you see in the screen captures above. If your terminal emulator supports profiles, create one for presentations with the font you want to use at the size you want. Then go full-screen. + +Neither mdp, tpp, nor sent will appeal to everyone. That's fine. There's no one presentation tool to rule them all, no matter what some people say. But if you need, or just want, to go back to basics, these three tools are good options. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/command-line-presentation-tools + +作者:[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/scottnesbitthttps://opensource.com/users/murphhttps://opensource.com/users/scottnesbitthttps://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://www.libreoffice.org/discover/impress/ +[3]: https://opensource.com/article/18/5/markdown-slide-generators +[4]: https://opensource.com/article/18/2/how-create-slides-emacs-org-mode-and-revealjs +[5]: https://presentationzen.blogs.com/presentationzen/2005/09/living_large_ta.html +[6]: https://github.com/visit1985/mdp +[7]: https://pandoc.org/MANUAL.html#metadata-blocks +[8]: https://opensource.com/sites/default/files/uploads/mdp-slides.png (Example mdp slide) +[9]: https://synflood.at/tpp.html +[10]: https://opensource.com/sites/default/files/uploads/tpp-example.png (tpp slide example) +[11]: https://opensource.com/sites/default/files/uploads/tpp-code_1.gif (Typing a command on a slide with tpp) +[12]: https://tools.suckless.org/sent/ +[13]: https://plaintextproject.online +[14]: https://opensource.com/sites/default/files/uploads/sent-example.png (Example Sent slide) diff --git a/sources/tech/20190806 Avoiding burnout- 4 considerations for a more energetic organization.md b/sources/tech/20190806 Avoiding burnout- 4 considerations for a more energetic organization.md new file mode 100644 index 0000000000..4dc46b8845 --- /dev/null +++ b/sources/tech/20190806 Avoiding burnout- 4 considerations for a more energetic organization.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Avoiding burnout: 4 considerations for a more energetic organization) +[#]: via: (https://opensource.com/open-organization/19/8/energy-fatigue-burnout) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarlandhttps://opensource.com/users/jonobaconhttps://opensource.com/users/marcobravohttps://opensource.com/users/ron-mcfarland) + +Avoiding burnout: 4 considerations for a more energetic organization +====== +Being open requires a certain kind of energy—and if you don't take time +to replenish that energy, your organization will suffer. +![Light bulb][1] + +In both personal and organizational life, energy levels are important. This is no less true of open organizations. Consider this: When you're tired, you'll have trouble _adapting_ when challenges arise. When your energy is low, you'll have trouble _collaborating_ with others. When you're feeling fatigued, building and energizing an open organization _community_ is difficult. + +At a time when [the World Health Organization (WHO) has recently formalized its definition for burnout][2], this issue seems more important than ever. In this article, I'll address the important issue of managing daily energy—both at the personal and organizational levels. + +### Energy management + +Having spent most of my career in overseas sales and sales training, I've learned that both individual and company energy levels are very important. In the early part of the career, I was traveling approximately every two months. Most trips were two to four weeks long. When teaching during those trips, I'd find myself standing six hours every day as I presented selling techniques to salespeople. It was exhausting. + +But I loved the work, and I knew I had to do something to keep my energy up. At a physical level, I knew I had to strengthen my legs and my heart, as well as change my diet to be able to sleep deeper at odd times of the day. Interestingly, I was not alone, as I heard many jet lag and exhaustion complaints in airport business lounges regularly. But I had to think about energy at an emotional level, too. I knew that the outside retail sales people I was training had to take rejection every day; they had to be able to control their levels of emotion and energy to be productive. + +Whether for companies or individuals, exhaustion is counter-productive, resulting in errors, frustration, and poor performance. This could be even more true in open organizations, as many participants are contributing for a wide range of reasons outside of basic monetary rewards. Many organizations emphasize time-management, stress-management, crisis-management, and resource-management—but I've never heard of a company that has adopted and introduced an "energy management" program. + +Why not? + +In my case, in order to keep both myself and the sales people I was training energized and productive, I had to address the issue of energy. So I started studying and reading about the subject. Eventually I found the book [_The Way We're Working Isn't Working_][3] by Tony Schwartz, and still consider it the most helpful. Schwartz went on to develop [The Energy Project][4],"a consulting firm that helps individuals and organizations grow and transform so together they can prosper, add more value in the world, and do less harm." It addresses this issue of fatigue head on. + +Schwartz distinguishes four separate and distinct categories of energy: physical, emotional, mental, and spiritual. Let me explain each and add some comments along the way. + +### Four categories of energy + +#### Physical health + +First, to have adequate energy every day, you've got to take care of your physical health. That means you _must_ address issues like nutrition, posture, sleep, and exercise (I found the book _Farewell to Fatigue_ by Donald Norfolk especially helpful for learning how to get over jet lag quickly.) To use an automotive term: You should always have a good "power to weight ratio." In other words, you must increase the driveline power/efficiency or reduce the overall weight of the vehicle to improve performance. + +I decided to work on both, keeping my legs strong and my weight down. I started jogging four to five times per week and improved my diet, which really helped me get a lot more out of my days and reduce fatigue. + +#### Emotional well-being + +Our energy grows when we feel appreciated by others. When the environment is exciting, we are motivated—which also leads to added energy. Conversely, when we don't feel that others appreciate us—or we find ourselves in a dull, even toxic environment—our energy levels suffer. In [_Every Word Has Power_][5], author Yvonne Oswald writes that the words we use and hear can make a big difference to our energy levels and well-being. She writes that simply reframing our everyday speech can help us boost energy levels. Instead of speaking excessively with the word "not" ("Don't strike out," "Don't double-fault,"), we should form sentences that paint a positive (energy-creating) image or picture in our minds. ("Hit a home run," "Serve an ace"). The former statements _consume_ our energy; the latter _enhance_ it. + +Regarding energy generation in a working environment, the book [_The Progress Principle_ by Teresa Amabile][6] taught me an important insight. Amabile's research shows that generating a feeling of upward progress is the most powerful way to increase energy in an organization. A feeling of progress, learning, developing, and moving upward is extremely important. The opposite is true for declining organizations. I've consulted a lot of companies over the years, and when I'm seeking to get a feeling for an organization's energy level, all I have to do is ask one question: "What is your company's project or product development program and its future prospects?" If I can't get a clear, detailed answer to that question throughout the organization, I know that people are just biding their time and aren't energized. + +#### Mental clarity + +Our minds consume more energy than any other part of our body, just like computers that consume a lot of electricity. That is why we're so tired after studying for many hours or taking long tests. We didn't move around much, but we're tired just the same because we consumed energy through concentration and mental activity. When our mental energy is low, our ability to focus intensely, prioritize, and think creatively suffer. We therefore must know when to relax and re-energize our brains. + +Whether for companies or individuals, exhaustion is counter-productive, resulting in errors, frustration, and poor performance. This could be even more true in open organizations, as many participants are contributing for a wide range of reasons outside of basic monetary rewards. + +Additionally, consider mental energy and the concept of "multi-tasking." Some people proudly report that they're good at multi-tasking—but they shouldn't be, as it wastes mental energy. I am not saying we shouldn't listen to music while driving the car, but when it comes to cognitive mental processing, we can only do one thing at a time. The concept of "multi-tasking" is actually a misnomer in the context of deep thinking. Human brains process information sequentially (one issue at a time). We simply _cannot_ conduct two thinking tasks at the same time. Instead, what we're _really_ doing is task "switching," a back-and-forth movement between tasks that has a significant mental energy cost for the value gained. First and foremost, it is less efficient. Also, it consumes a great deal of energy. Best is to start a task and completely finish it before moving on to the next task, reducing shut-down and recall waste. + +Just like overworking a muscle, mental clarity, strength, and energy can be used up. Therefore, mental recovery is important. Many people have found “power naps” or meditating extremely helpful. Going into a relax mode for only 20 minutes can be very helpful. It is just enough time to build your mental energy, but not long enough to make you groggy. + +#### Spiritual significance + +Spiritual significance creates energy, and it comes from the feeling of serving a mission beyond financial rewards. Put simply, it is doing something we consider important (an internal desire or goal). In the case of my sales training career, for example, I had a purpose of building the _careers_ of salespeople who had very little formal education. Teaching in countless developing countries really offered an inspiring purpose for me. At that time, this dimension of my work provided "spiritual significance". It generated a great deal of energy in me. As I grow older, I'm finding this spiritual significance becoming extremely important while financial rewards start to weaken. I'm sure this is true for many people that are contributing to open organizations. This contribution is where their energy comes from. + +Not just for me, not just for open organization, but for _people in general_, I've found these four types of energy very important—so much so that I've prepared and delivered [presentations][7] on them. + +### Energy across four zones + +In _[The Way We're Working Isn't Working][3],_ Tony Schwartz mentions four zones that people operate in, which I've diagrammed in Figure 1. + +![][8] + +Here we see four quadrants useful in evaluating a working environment. From left to right we see an assessment of the environment, with a negative environment (energy-consuming) on the left and a positive environment (energizing) on the right. From top to bottom, then, is an assessment of the organization's (or individual's) energy level. Obviously, you want to be in the upper-right zone as much as possible and out of the bottom-left zone as much as possible. + +To move from the Survival Zone (left) to the Performance Zone (right), Schwartz suggests you can manage your attitude by looking through three "lenses": + + * **Reflection lens.** Ask two very simple questions: 1. What are the facts? and 2. What assumptions am I making? Stand back, observe the environment, and give yourself a chance to consider other, more positive ways of thinking about the situation. + * **Reverse lens.** How do you think other people (particularly the person creating the negative environment) feel about the situation? Try to find ways to see or feel that person's perspective. + * **Long lens.** Even after learning and confirming the facts and considering other people's perspectives, if you still feel like you're in the Survival Zone or Burnout Zone, consider the future. Imagine how you can make the best of a bad situation and move above it. No matter how badly you feel right now, how can you learn from this experience and excel in the future? Try to see value in the experience. + + + +Do yourself a favor when you wake up in the morning. Evaluate yourself on the four energy types I mentioned in this article. Rate yourself from 1 to 10 on your current "morning physical health energy level." Then, do the same thing for your "emotional well-being energy level," "mental clarity energy level" and "spiritual significance energy level." That will give you some idea of what you'll have to work on to get the most out of both your day and life. + +Jono Bacon shares some quite ridiculous life choices from his early years that illustrate important... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/8/energy-fatigue-burnout + +作者:[Ron McFarland][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/ron-mcfarlandhttps://opensource.com/users/jonobaconhttps://opensource.com/users/marcobravohttps://opensource.com/users/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bulb-light-energy-power-idea.png?itok=zTEEmTZB (Light bulb) +[2]: https://icd.who.int/browse11/l-m/en#/http://id.who.int/icd/entity/129180281 +[3]: https://www.simonandschuster.com/books/The-Way-Were-Working-Isnt-Working/Tony-Schwartz/9781451610260 +[4]: https://theenergyproject.com/team/tony-schwartz/ +[5]: https://www.simonandschuster.com/books/Every-Word-Has-Power/Yvonne-Oswald/9781582701813 +[6]: http://progressprinciple.com/books/single/the_progress_principle +[7]: https://www.slideshare.net/RonMcFarland1/increasing-company-energy?qid=e3c251fc-be71-4185-b216-3c7e5b48f7b1&v=&b=&from_search=2 +[8]: https://opensource.com/sites/default/files/images/open-org/energy_zones.png diff --git a/sources/tech/20190806 Bash Script to Automatically Start a Services When it Goes Down on Linux.md b/sources/tech/20190806 Bash Script to Automatically Start a Services When it Goes Down on Linux.md new file mode 100644 index 0000000000..fda3063c02 --- /dev/null +++ b/sources/tech/20190806 Bash Script to Automatically Start a Services When it Goes Down on Linux.md @@ -0,0 +1,545 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Automatically Start a Services When it Goes Down on Linux) +[#]: via: (https://www.2daygeek.com/linux-bash-script-auto-restart-services-when-down/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Automatically Start a Services When it Goes Down on Linux +====== + +There are many open source monitoring tools are currently available in market to monitor Linux systems performance. + +Those are send an email alert when the system reaches the specified threshold limit for CPU, Memory, and Disk space or any service is down. + +But, it doesn’t have an intelligence to auto start the services, if it crash/goes down. + +There are various reasons for the process to crash, which you can investigate and fix the issue but it may take a while. + +If you don’t want to make your service down for a while and if you would like to bring them up immediately whenever it goes down? + +If so, what to do in this situation? How to mitigate this? + +We can write our own bash script to start a service whenever it goes down. Writing a shell script is not a big deal and you have to understand few things to achieve this. + +Once you familiar on this, you can write your own shell script to automate the day to day activities, which will save lots of time. + +We had added many useful shell scripts in the past. If you want to check those, navigate to the below link. + + * **[How to automate day to day activities using shell scripts?][1]** + + + +I have added totally six shell scripts for this usage and you can choose which one is suitable for you. + +I had applied different commands and methodology in each shell script. + +**`Note:`**` ` You need to change the email id instead of ours. + +### 1) How to Automatically Start a Service When it Goes Down on SysVinit Linux System? + +Use the following bash script, if you would like to start a single service in SysVinit Linux System. + +I have added **`httpd`**` ` service in this script but you can add the service, which you want to monitor. + +``` +# vi /opt/scripts/service-monitor.sh + +#!/bin/bash + +serv=httpd + +sstat=stopped + +service $serv status | grep -i 'running\|stopped' | awk '{print $3}' | while read output; + +do + +echo $output + +if [ "$output" == "$sstat" ]; then + + service $serv start + + echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + + else + + echo "$serv service is running" + + fi + +done +``` + +Set an executable permission to **`service-monitor.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor.sh +``` + +Alternatively, you can use the following script. + +``` +# vi /opt/scripts/service-monitor-1.sh + +#!/bin/bash + +serv=httpd + +sstat=$(pidof $serv | wc -l ) + +if [ $sstat -gt 0 ] + +then + +echo "$serv is running fine!!!" + +else + +echo "$serv is down/dead" + +service $serv start + +echo "$serv service is UP now!!!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +fi +``` + +Set an executable permission to **`service-monitor-1.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-1.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-1.sh +``` + +### 2) How to Automatically Start a Service When it Goes Down on systemd Linux System? + +Use the following bash script, if you would like to start a single service in systemd Linux System. + +I have added **`httpd`**` ` service in this script but you can add the service, which you want to monitor. + +``` +# vi /opt/scripts/service-monitor-2.sh + +#!/bin/bash + +serv=httpd + +sstat=dead + +systemctl status $serv | grep -i 'running\|dead' | awk '{print $3}' | sed 's/[()]//g' | while read output; + +do + +echo $output + +if [ "$output" == "$sstat" ]; then + + systemctl start $serv + + echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + + else + + echo "$serv service is running" + + fi + +done +``` + +Set an executable permission to **`service-monitor-2.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-2.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-2.sh +``` + +Alternatively, you can use the following script. + +``` +# vi /opt/scripts/service-monitor-3.sh + +#!/bin/bash + +serv=httpd + +sstat=$(pidof $serv | wc -l ) + +if [ $sstat -gt 0 ] + +then + +echo "$serv is running fine!!!" + +else + +echo "$serv is down/dead" + +systemctl start $serv + +echo "$serv service is UP now!!!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +fi +``` + +Set an executable permission to **`service-monitor-3.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-3.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-3.sh +``` + +### 3) How to Automatically Start Multiple Services When it Goes Down on SysVinit Linux System? + +Use the following bash script, if you would like to start multiple service in SysVinit Linux System. + +I have added **`httpd`**` ` and **`rsyslog`**` ` services in this script but you can add the service, which you want to monitor. + +``` +# vi /opt/scripts/service-monitor-4.sh + +#!/bin/bash + +sstat=stopped + +for serv in httpd rsyslog + +do + +service $serv status | grep -i 'running\|stopped' | awk '{print $3}' | while read output; + +do + +echo $output + +if [ "$output" == "$sstat" ]; then + + service $serv start + + echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + + else + + echo "$serv service is running" + + fi + +done +done +``` + +Set an executable permission to **`service-monitor-4.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-4.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-4.sh +``` + +Alternatively, you can use the following script. + +``` +# vi /opt/scripts/service-monitor-5.sh + +#!/bin/bash + +for serv in rsyslog httpd + +do + +sstat=$(pgrep $serv | wc -l ) + +if [ $sstat -gt 0 ] + +then + +echo "$serv is running!!!" + +else + +echo "$serv is down/dead" + +service $serv start + +echo "$serv serv is UP now!!!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +fi + +done +``` + +Set an executable permission to **`service-monitor-5.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-5.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-5.sh +``` + +### 4) How to Automatically Start Multiple Service When it Goes Down on systemd Linux System? + +Use the following bash script, if you would like to start multiple services in systemd Linux System. + +I have added **`httpd`**` ` and **`rsyslog`**` ` services in this script but you can add the service, which you want to monitor. + +``` +# vi /opt/scripts/service-monitor-6.sh + +#!/bin/bash + +sstat=dead + +for serv in httpd rsyslog + +do + +systemctl status $serv | grep -i 'running\|dead' | awk '{print $3}' | sed 's/[()]//g' | while read output; + +do + +echo $output + +if [ "$output" == "$sstat" ]; then + + systemctl start $serv + + echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + + else + + echo "$serv service is running" + + fi + +done + +done +``` + +Set an executable permission to **`service-monitor-6.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-6.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-6.sh +``` + +Alternatively, you can use the following script. + +``` +# vi /opt/scripts/service-monitor-7.sh + +#!/bin/bash + +for serv in rsyslog httpd + +do + +sstat=$(pgrep $serv | wc -l ) + +if [ $sstat -gt 0 ] + +then + +echo "$serv is running!!!" + +else + +echo "$serv is down/dead" + +systemctl start $serv + +echo "$serv serv is UP now!!!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +fi + +done +``` + +Set an executable permission to **`service-monitor-7.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-7.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-7.sh +``` + +### 5) How to Automatically Start a Service When it Goes Down on systemd and SysVinit Linux System? + +Use the following bash script, if you would like to start a service in systemd and SysVinit Linux System. + +I have added **`httpd`**` ` service in this script but you can add the service, which you want to monitor. + +``` +# vi /opt/scripts/service-monitor-8.sh + +#!/bin/bash + +smanager=$(ps -p1 | grep "init\|systemd" | awk '{print $4}') + +serv=httpd + +if (( $(pidof $serv | wc -l) > 0 )) + +then + +echo "$serv is running!!!" + +elif [ "$smanager" == "init" ] + +then + +service $serv start + +echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +else + +systemctl start $serv + +echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +fi +``` + +Set an executable permission to **`service-monitor-8.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-8.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-8.sh +``` + +### 6) How to Automatically Start Multiple Services When it Goes Down on systemd and SysVinit Linux System? + +Use the following bash script, if you would like to start multiple services in systemd and SysVinit Linux System. + +I have added **`httpd`**` ` and **`rsyslog`**` ` services in this script but you can add the service, which you want to monitor. + +``` +# vi /opt/scripts/service-monitor-9.sh + +#!/bin/bash + +smanager=$(ps -p1 | grep "init\|systemd" | awk '{print $4}') + +for serv in rsyslog httpd + +do + +if (( $(pgrep $serv | wc -l) > 0 )) + +then + +echo "$serv is running!!!" + +elif [ "$smanager" == "init" ] + +then + +service $serv start + +echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +else + +systemctl start $serv + +echo "$serv service is UP now.!" | mail -s "$serv service is DOWN and restarted now On $(hostname)" [email protected] + +fi + +done +``` + +Set an executable permission to **`service-monitor-9.sh`**` ` file. + +``` +$ chmod +x /opt/scripts/service-monitor-9.sh +``` + +Finally add a cronjob to automate this. It will run every 5 minutes. + +``` +# crontab -e + +*/5 * * * * /bin/bash /opt/scripts/service-monitor-9.sh +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-bash-script-auto-restart-services-when-down/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/shell-script/ diff --git a/sources/tech/20190806 Linux Mint 19.2 -Tina- Released- Here-s What-s New and How to Get it.md b/sources/tech/20190806 Linux Mint 19.2 -Tina- Released- Here-s What-s New and How to Get it.md new file mode 100644 index 0000000000..8f9371e787 --- /dev/null +++ b/sources/tech/20190806 Linux Mint 19.2 -Tina- Released- Here-s What-s New and How to Get it.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux Mint 19.2 “Tina” Released: Here’s What’s New and How to Get it) +[#]: via: (https://itsfoss.com/linux-mint-19-2-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Mint 19.2 “Tina” Released: Here’s What’s New and How to Get it +====== + +_**Linux Mint 19.2 “Tina” has been released. See what’s new in it and learn how to upgrade to Linux Mint 19.2.**_ + +Recently, the Linux Mint team [announced][1] the release of Linux Mint 19 Cinnamon with significant improvements and feature additions. I’ll show you some of the main features of the new release and how to upgrade to it. + +### Linux Mint 19.2: What’s new? + +What matters the most is that Linux Mint 19.2 is also a Long Term Support release which will be supported till 2023. The new version includes updated software and lot of improvements along with added features. + +What are the key highlights among the added features? Let us take a look. + +#### Enhanced Update Manager + +![][2] + +Now, you can easily manage kernel updates from the update manager like never before. You get to know how long the kernels are supported. It is also possible to install/remove multiple kernels in a single queue. + +Linux Mint 19.2 also supports multiple kernel flavors, so you can switch between them when you want. + +![][3] + +In addition to all this, you can choose to automate the removal of kernels which are no longer needed and blacklist specific update packages (without blacklisting the future updates for that). + +#### Revamped ‘System Tools’ + +![][4] + +A new tab was added to the System Tools window – “**System Information**” – which will come in handy for users to easily copy/paste their configuration onto a forum to seek support. And, the layout has been improved. + +#### Other Improvements + +With Linux 19.2, the performance has greatly improved due to optimizations done in the window manager. Their aim was to reduce the input lag and make it feel smoother. + +You can now configure the scrollbar to how you want it to be. Sharing files on Linux Mint 19.2 is has improved as well with Cinnamon 4.2. + +Linux Mint 19.2 uses Noto fonts now instead of the Ubuntu fonts. + +With these, there are numerous other improvements under the hood (and some customization ability) – you can check the full details in the [blog post][5] of their official website. + +### Linux Mint 19 vs 19.1 vs 19.2: What’s the difference? + +You probably already know that Linux Mint releases are based on Ubuntu long term support releases. Linux Mint 19 series is based on Ubuntu 18.04 LTS. + +[][6] + +Suggested read  Five Tiny Features of Linux Mint Cinnamon I’ve Come to Love + +Ubuntu LTS releases get ‘point releases’ on the interval of a few months. Point release basically consists of bug fixes and security updates that have been pushed since the last release of the LTS version. This is similar to the Service Pack concept in Windows XP, if you remember it. + +If you are going to download Ubuntu 18.04 which was released in April, 2018 in 2019, you’ll get Ubuntu 18.04.2. The ISO image of 18.04.2 will consists of 18.04 and the bug fixes and security updates applied till 18.04.2. Imagine if there was no point releases, then right after [installing Ubuntu 18.04][7], you’ll have to install a few gigabytes of system updates. Not very convenient, right? + +But Linux Mint has it slightly different. Linux Mint has a major release based on Ubuntu LTS release and then it has three minor releases based on Ubuntu LTS point releases. + +Mint 19 was based on Ubuntu 18.04, 19.1 was based on 18.04.1 and Mint 19.2 is based on Ubuntu 18.04.2. There should be 19.3 in the Mint 19 series before the release of Mint 20 based on Ubuntu 20.04 LTS. All Mint 19.x releases are long term support releases and will get security updates till 2023. + +Now, if you are using Ubuntu 18.04 and keep your system updated, you’ll automatically get updated to 18.04.1, 18.04.2 etc. That’s not the case in Linux Mint. + +Linux Mint minor releases also consists of _feature changes_ along with bug fixes and security updates and this is the reason why updating Linux Mint 19 won’t automatically put you on 19.1. + +Linux Mint gives you the option if you want the new features or not. For example, Mint 19.2 has Cinnamon 4.2 and several other visual changes. If you are happy with the existing features, you can stay on Mint 19. You’ll still get the necessary security and maintenance updates on Mint 19 till 2023. + +Now that you understand the concept of minor releases and want the latest minor release, let’s see how to upgrade to Mint 19.2. + +### Linux Mint 19.2: How to Upgrade? + +No matter whether you have Linux Mint 19.1 or 19, you can follow these steps to [upgrade Linux Mint version][8]. + +[][9] + +Suggested read  Fedora 24 released! + +**Note**: _You should consider making a system snapshot (just in case) for backup. In addition, the Linux Mint team advises you to disable the screensaver and upgrade Cinnamon spices (if installed) from the System settings._ + +![][10] + + 1. Launch the Update Manager. + 2. Now, refresh it to load up the latest available updates (or you can change the mirror if you want). + 3. Once done, simply click on the Edit button to find “**Upgrade to Linux Mint 19.2 Tina**” button. + 4. Finally, just follow the on-screen instructions to easily update it. + + + +Based on your internet connection, it should take anything between a couple of minutes to 30 minutes. + +#### Don’t see Mint 19.2 update yet? Here’s what you can do + +If you don’t see the option to upgrade to Linux Mint 19.2 Tina, don’t lose hope. Here are a couple of things you can do. + +**Step 1: Make sure to use mint-upgrade-info version 1.1.3** + +Make sure that mint-upgrade-info is updated to version 1.1.3. You can try the install command that will update it to a newer version (if there is any). + +``` +sudo apt install mint-upgrade-info +``` + +**Step 2: Switch to default software sources** + +Chances are that you are using a mirror closer to you to get faster software downloads. But this could cause a problem as the mirrors might not have the new upgrade info yet. + +Go to Software Source and change the sources to default. Now run the update manager again and see if Mint 19.2 upgrade is available. + +**Wrapping Up** + +Linux Mint 19.2 is a solid upgrade. The new feature additions are very useful and it’s always good to see them working on the performance (so that it consumes less RAM) and appears to be smoother. + +What do you think about the latest release – Linux Mint 19.2 “Tina”? Have you upgraded yet? If yes, how is your experience so far? Feel free to let us know in the comments below. + +![][11] + +### Ankush Das + +co-author + +![][12] + +### Abhishek Prakash + +co-author + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-19-2-release/ + +作者:[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://blog.linuxmint.com/?p=3786 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-mint-tina-kernel.png?resize=800%2C523&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-mint-tina-update.png?resize=800%2C515&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-mint-tina.jpg?ssl=1 +[5]: https://www.linuxmint.com/rel_tina_cinnamon_whatsnew.php +[6]: https://itsfoss.com/tiny-features-linux-mint-cinnamon/ +[7]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ +[8]: https://itsfoss.com/upgrade-linux-mint-version/ +[9]: https://itsfoss.com/fedora-24-released/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/mintupgrade.png?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/ankush_das.jpg?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2016/11/14883680_10154845158472952_6433939564474062315_o.jpg?ssl=1 diff --git a/sources/tech/20190807 Navigating the Bash shell with pushd and popd.md b/sources/tech/20190807 Navigating the Bash shell with pushd and popd.md new file mode 100644 index 0000000000..333f313bcd --- /dev/null +++ b/sources/tech/20190807 Navigating the Bash shell with pushd and popd.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Navigating the Bash shell with pushd and popd) +[#]: via: (https://opensource.com/article/19/8/navigating-bash-shell-pushd-popd) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/dnearyhttps://opensource.com/users/greg-phttps://opensource.com/users/shishz) + +Navigating the Bash shell with pushd and popd +====== +Pushd and popd are the fastest navigational commands you've never heard +of. +![bash logo on green background][1] + +The **pushd** and **popd** commands are built-in features of the Bash shell to help you "bookmark" directories for quick navigation between locations on your hard drive. You might already feel that the terminal is an impossibly fast way to navigate your computer; in just a few key presses, you can go anywhere on your hard drive, attached storage, or network share. But that speed can break down when you find yourself going back and forth between directories, or when you get "lost" within your filesystem. Those are precisely the problems **pushd** and **popd** can help you solve. + +### pushd + +At its most basic, **pushd** is a lot like **cd**. It takes you from one directory to another. Assume you have a directory called **one**, which contains a subdirectory called **two**, which contains a subdirectory called **three**, and so on. If your current working directory is **one**, then you can move to **two** or **three** or anywhere with the **cd** command: + + +``` +$ pwd +one +$ cd two/three +$ pwd +three +``` + +You can do the same with **pushd**: + + +``` +$ pwd +one +$ pushd two/three +~/one/two/three ~/one +$ pwd +three +``` + +The end result of **pushd** is the same as **cd**, but there's an additional intermediate result: **pushd** echos your destination directory and your point of origin. This is your _directory stack_, and it is what makes **pushd** unique. + +### Stacks + +A stack, in computer terminology, refers to a collection of elements. In the context of this command, the elements are directories you have recently visited by using the **pushd** command. You can think of it as a history or a breadcrumb trail. + +You can move all over your filesystem with **pushd**; each time, your previous and new locations are added to the stack: + + +``` +$ pushd four +~/one/two/three/four ~/one/two/three ~/one +$ pushd five +~/one/two/three/four/five ~/one/two/three/four ~/one/two/three ~/one +``` + +### Navigating the stack + +Once you've built up a stack, you can use it as a collection of bookmarks or fast-travel waypoints. For instance, assume that during a session you're doing a lot of work within the **~/one/two/three/four/five** directory structure of this example. You know you've been to **one** recently, but you can't remember where it's located in your **pushd** stack. You can view your stack with the **+0** (that's a plus sign followed by a zero) argument, which tells **pushd** not to change to any directory in your stack, but also prompts **pushd** to echo your current stack: + + +``` +$ pushd +0 +~/one/two/three/four ~/one/two/three ~/one ~/one/two/three/four/five +``` + +The first entry in your stack is your current location. You can confirm that with **pwd** as usual: + + +``` +$ pwd +~/one/two/three/four +``` + +Starting at 0 (your current location and the first entry of your stack), the _second_ element in your stack is **~/one**, which is your desired destination. You can move forward in your stack using the **+2** option: + + +``` +$ pushd +2 +~/one ~/one/two/three/four/five ~/one/two/three/four ~/one/two/three +$ pwd +~/one +``` + +This changes your working directory to **~/one** and also has shifted the stack so that your new location is at the front. + +You can also move backward in your stack. For instance, to quickly get to **~/one/two/three** given the example output, you can move back by one, keeping in mind that **pushd** starts with 0: + + +``` +$ pushd -0 +~/one/two/three ~/one ~/one/two/three/four/five ~/one/two/three/four +``` + +### Adding to the stack + +You can continue to navigate your stack in this way, and it will remain a static listing of your recently visited directories. If you want to add a directory, just provide the directory's path. If a directory is new to the stack, it's added to the list just as you'd expect: + + +``` +$ pushd /tmp +/tmp ~/one/two/three ~/one ~/one/two/three/four/five ~/one/two/three/four +``` + +But if it already exists in the stack, it's added a second time: + + +``` +$ pushd ~/one +~/one /tmp ~/one/two/three ~/one ~/one/two/three/four/five ~/one/two/three/four +``` + +While the stack is often used as a list of directories you want quick access to, it is really a true history of where you've been. If you don't want a directory added redundantly to the stack, you must use the **+N** and **-N** notation. + +### Removing directories from the stack + +Your stack is, obviously, not immutable. You can add to it with **pushd** or remove items from it with **popd**. + +For instance, assume you have just used **pushd** to add **~/one** to your stack, making **~/one** your current working directory. To remove the first (or "zeroeth," if you prefer) element: + + +``` +$ pwd +~/one +$ popd +0 +/tmp ~/one/two/three ~/one ~/one/two/three/four/five ~/one/two/three/four +$ pwd +~/one +``` + +Of course, you can remove any element, starting your count at 0: + + +``` +$ pwd ~/one +$ popd +2 +/tmp ~/one/two/three ~/one/two/three/four/five ~/one/two/three/four +$ pwd ~/one +``` + +You can also use **popd** from the back of your stack, again starting with 0. For example, to remove the final directory from your stack: + + +``` +$ popd -0 +/tmp ~/one/two/three ~/one/two/three/four/five +``` + +When used like this, **popd** does not change your working directory. It only manipulates your stack. + +### Navigating with popd + +The default behavior of **popd**, given no arguments, is to remove the first (zeroeth) item from your stack and make the next item your current working directory. + +This is most useful as a quick-change command, when you are, for instance, working in two different directories and just need to duck away for a moment to some other location. You don't have to think about your directory stack if you don't need an elaborate history: + + +``` +$ pwd +~/one +$ pushd ~/one/two/three/four/five +$ popd +$ pwd +~/one +``` + +You're also not required to use **pushd** and **popd** in rapid succession. If you use **pushd** to visit a different location, then get distracted for three hours chasing down a bug or doing research, you'll find your directory stack patiently waiting (unless you've ended your terminal session): + + +``` +$ pwd ~/one +$ pushd /tmp +$ cd {/etc,/var,/usr}; sleep 2001 +[...] +$ popd +$ pwd +~/one +``` + +### Pushd and popd in the real world + +The **pushd** and **popd** commands are surprisingly useful. Once you learn them, you'll find excuses to put them to good use, and you'll get familiar with the concept of the directory stack. Getting comfortable with **pushd** was what helped me understand **git stash**, which is entirely unrelated to **pushd** but similar in conceptual intangibility. + +Using **pushd** and **popd** in shell scripts can be tempting, but generally, it's probably best to avoid them. They aren't portable outside of Bash and Zsh, and they can be obtuse when you're re-reading a script (**pushd +3** is less clear than **cd $HOME/$DIR/$TMP** or similar). + +Aside from these warnings, if you're a regular Bash or Zsh user, then you can and should try **pushd** and **popd**. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/navigating-bash-shell-pushd-popd + +作者:[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/dnearyhttps://opensource.com/users/greg-phttps://opensource.com/users/shishz +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) diff --git a/sources/tech/20190807 Trace code in Fedora with bpftrace.md b/sources/tech/20190807 Trace code in Fedora with bpftrace.md new file mode 100644 index 0000000000..bead04655e --- /dev/null +++ b/sources/tech/20190807 Trace code in Fedora with bpftrace.md @@ -0,0 +1,210 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Trace code in Fedora with bpftrace) +[#]: via: (https://fedoramagazine.org/trace-code-in-fedora-with-bpftrace/) +[#]: author: (Augusto Caringi https://fedoramagazine.org/author/acaringi/) + +Trace code in Fedora with bpftrace +====== + +![][1] + +bpftrace is [a new eBPF-based tracing tool][2] that was first included in Fedora 28. It was developed by Brendan Gregg, Alastair Robertson and Matheus Marchini with the help of a loosely-knit team of hackers across the Net. A tracing tool lets you analyze what a system is doing behind the curtain. It tells you which functions in code are being called, with which arguments, how many times, and so on. + +This article covers some basics about bpftrace, and how it works. Read on for more information and some useful examples. + +### eBPF (extended Berkeley Packet Filter) + +[eBPF][3] is a tiny virtual machine, or a virtual CPU to be more precise, in the Linux Kernel. The eBPF can load and run small programs in a safe and controlled way in kernel space. This makes it safer to use, even in production systems. This virtual machine has its own instruction set architecture ([ISA][4]) resembling a subset of modern processor architectures. The ISA makes it easy to translate those programs to the real hardware. The kernel performs just-in-time translation to native code for main architectures to improve the performance. + +The eBPF virtual machine allows the kernel to be extended programmatically. Nowadays several kernel subsystems take advantage of this new powerful Linux Kernel capability. Examples include networking, seccomp, tracing, and more. The main idea is to attach eBPF programs into specific code points, and thereby extend the original kernel behavior. + +eBPF machine language is very powerful. But writing code directly in it is extremely painful, because it’s a low level language. This is where bpftrace comes in. It provides a high-level language to write eBPF tracing scripts. The tool then translates these scripts to eBPF with the help of clang/LLVM libraries, and then attached to the specified code points. + +## Installation and quick start + +To install bpftrace, run the following command in a terminal [using][5] _[sudo][5]_: + +``` +$ sudo dnf install bpftrace +``` + +Try it out with a “hello world” example: + +``` +$ sudo bpftrace -e 'BEGIN { printf("hello world\n"); }' +``` + +Note that you must run _bpftrace_ as _root_ due to the privileges required. Use the _-e_ option to specify a program, and to construct the so-called “one-liners.” This example only prints _hello world_, and then waits for you to press **Ctrl+C**. + +_BEGIN_ is a special probe name that fires only once at the beginning of execution. Every action inside the curly braces _{ }_ fires whenever the probe is hit — in this case, it’s just a _printf_. + +Let’s jump now to a more useful example: + +``` +$ sudo bpftrace -e 't:syscalls:sys_enter_execve { printf("%s called %s\n", comm, str(args->filename)); }' +``` + +This example prints the parent process name _(comm)_ and the name of every new process being created in the system. _t:syscalls:sys_enter_execve_ is a kernel tracepoint. It’s a shorthand for _tracepoint:syscalls:sys_enter_execve_, but both forms can be used. The next section shows you how to list all available tracepoints. + +_comm_ is a bpftrace builtin that represents the process name. _filename_ is a field of the _t:syscalls:sys_enter_execve_ tracepoint. You can access these fields through the _args_ builtin. + +All available fields of the tracepoint can be listed with this command: + +``` +bpftrace -lv "t:syscalls:sys_enter_execve" +``` + +## Example usage + +### Listing probes + +A central concept for _bpftrace_ are **probe points**. Probe points are instrumentation points in code (kernel or userspace) where eBPF programs can be attached. They fit into the following categories: + + * _kprobe_ – kernel function start + * _kretprobe_ – kernel function return + * _uprobe_ – user-level function start + * _uretprobe_ – user-level function return + * _tracepoint_ – kernel static tracepoints + * _usdt_ – user-level static tracepoints + * _profile_ – timed sampling + * _interval_ – timed output + * _software_ – kernel software events + * _hardware_ – processor-level events + + + +All available _kprobe/kretprobe_, _tracepoints_, _software_ and _hardware_ probes can be listed with this command: + +``` +$ sudo bpftrace -l +``` + +The _uprobe/uretprobe_ and _usdt_ probes are userspace probes specific to a given executable. To use them, use the special syntax shown later in this article. + +The _profile_ and _interval_ probes fire at fixed time intervals. Fixed time intervals are not covered in this article. + +### Counting system calls + +**Maps** are special BPF data types that store counts, statistics, and histograms. You can use maps to summarize how many times each syscall is being called: + +``` +$ sudo bpftrace -e 't:syscalls:sys_enter_* { @[probe] = count(); }' +``` + +Some probe types allow wildcards to match multiple probes. You can also specify multiple attach points for an action block using a comma separated list. In this example, the action block attaches to all tracepoints whose name starts with _t:syscalls:sys_enter__, which means all available syscalls. + +The bpftrace builtin function _count()_ counts the number of times this function is called. _@[]_ represents a map (an associative array). The key of this map is _probe_, which is another bpftrace builtin that represents the full probe name. + +Here, the same action block is attached to every syscall. Then, each time a syscall is called the map will be updated, and the entry is incremented in the map relative to this same syscall. When the program terminates, it automatically prints out all declared maps. + +This example counts the syscalls called globally, it’s also possible to filter for a specific process by _PID_ using the bpftrace filter syntax: + +``` +$ sudo bpftrace -e 't:syscalls:sys_enter_* / pid == 1234 / { @[probe] = count(); }' +``` + +### Write bytes by process + +Using these concepts, let’s analyze how many bytes each process is writing: + +``` +$ sudo bpftrace -e 't:syscalls:sys_exit_write /args->ret > 0/ { @[comm] = sum(args->ret); }' +``` + +_bpftrace_ attaches the action block to the write syscall return probe (_t:syscalls:sys_exit_write_). Then, it uses a filter to discard the negative values, which are error codes _(/args->ret > 0/)_. + +The map key _comm_ represents the process name that called the syscall. The _sum()_ builtin function accumulates the number of bytes written for each map entry or process. _args_ is a bpftrace builtin to access tracepoint’s arguments and return values. Finally, if successful, the _write_ syscall returns the number of written bytes. _args->ret_ provides access to the bytes. + +### Read size distribution by process (histogram): + +_bpftrace_ supports the creation of histograms. Let’s analyze one example that creates a histogram of the _read_ size distribution by process: + +``` +$ sudo bpftrace -e 't:syscalls:sys_exit_read { @[comm] = hist(args->ret); }' +``` + +Histograms are BPF maps, so they must always be attributed to a map (_@_). In this example, the map key is _comm_. + +The example makes _bpftrace_ generate one histogram for every process that calls the _read_ syscall. To generate just one global histogram, attribute the _hist()_ function just to _‘@’_ (without any key). + +bpftrace automatically prints out declared histograms when the program terminates. The value used as base for the histogram creation is the number of read bytes, found through _args->ret_. + +### Tracing userspace programs + +You can also trace userspace programs with _uprobes/uretprobes_ and _USDT_ (User-level Statically Defined Tracing). The next example uses a _uretprobe_, which probes to the end of a user-level function. It gets the command lines issued in every _bash_ running in the system: + +``` +$ sudo bpftrace -e 'uretprobe:/bin/bash:readline { printf("readline: \"%s\"\n", str(retval)); }' +``` + +To list all available _uprobes/uretprobes_ of the _bash_ executable, run this command: + +``` +$ sudo bpftrace -l "uprobe:/bin/bash" +``` + +_uprobe_ instruments the beginning of a user-level function’s execution, and _uretprobe_ instruments the end (its return). _readline()_ is a function of _/bin/bash_, and it returns the typed command line. _retval_ is the return value for the instrumented function, and can only be accessed on _uretprobe_. + +When using _uprobes_, you can access arguments with _arg0..argN_. A _str()_ call is necessary to turn the _char *_ pointer to a _string_. + +## Shipped Scripts + +There are many useful scripts shipped with bpftrace package. You can find them in the _/usr/share/bpftrace/tools/_ directory. + +Among them, you can find: + + * _killsnoop.bt_ – Trace signals issued by the kill() syscall. + * _tcpconnect.bt_ – Trace all TCP network connections. + * _pidpersec.bt_ – Count new procesess (via fork) per second. + * _opensnoop.bt_ – Trace open() syscalls. + * _vfsstat.bt_ – Count some VFS calls, with per-second summaries. + + + +You can directly use the scripts. For example: + +``` +$ sudo /usr/share/bpftrace/tools/killsnoop.bt +``` + +You can also study these scripts as you create new tools. + +## Links + + * bpftrace reference guide – + * bpftrace (DTrace 2.0) for Linux 2018 – + * BPF: the universal in-kernel virtual machine – + * Linux Extended BPF (eBPF) Tracing Tools – + * Dive into BPF: a list of reading material – [https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf][6] + + + +* * * + +_Photo by _[_Roman Romashov_][7]_ on _[_Unsplash_][8]_._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/trace-code-in-fedora-with-bpftrace/ + +作者:[Augusto Caringi][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/acaringi/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/bpftrace-816x345.jpg +[2]: https://github.com/iovisor/bpftrace +[3]: https://lwn.net/Articles/740157/ +[4]: https://github.com/iovisor/bpf-docs/blob/master/eBPF.md +[5]: https://fedoramagazine.org/howto-use-sudo/ +[6]: https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/ +[7]: https://unsplash.com/@wehavemegapixels?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[8]: https://unsplash.com/search/photos/trace?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md new file mode 100644 index 0000000000..fb8e0d3938 --- /dev/null +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -0,0 +1,257 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sending custom emails with Python) +[#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) +[#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) + +Sending custom emails with Python +====== +Customize your group emails with Mailmerge, a command-line program that +can handle simple and complex emails. +![Chat via email][1] + +Email remains a fact of life. Despite all its warts, it's still the best way to send information to most people, especially in automated ways that allow messages to queue for recipients. + +One of the highlights of my work as the [Fedora Community Action and Impact Coordinator][2] is giving people good news about travel funding. I often send this information over email. Here, I'll show you how I send custom messages to groups of people using [Mailmerge][3], a command-line Python program that can handle simple and complex emails. + +### Install Mailmerge + +Mailmerge is packaged and available in Fedora, and you can install it from the command line with **sudo dnf install python3-mailmerge**. You can also install it from PyPI using **pip**, as the project's [README explains][4]. + +### Configure your Mailmerge files + +Three files control how Mailmerge works. If you run **mailmerge --sample**, it will create template files for you. The files are: + + * **mailmerge_server.conf:** This contains the configuration details for your SMTP host to send emails. Your password is _not_ stored in this file. + * **mailmerge_database.csv:** This holds the custom data for each email, including the recipients' email addresses. + * **mailmerge_template.txt:** This is your email's text with placeholder fields that will be replaced using the data from **mailmerge_database.csv**. + + + +#### Server.conf + +The sample **mailmerge_server.conf** file includes several examples that should be familiar. If you've ever added email to your phone or set up a desktop email client, you've seen this data before. The big thing to remember is to update your username in the file, especially if you are using one of the example configurations. + +#### Database.csv + +The **mailmerge_database.csv** file is a bit more complicated. It must contain (at minimum) the recipients' email addresses and any other custom details necessary to replace the fields in your email. It is a good idea to write the **mailmerge_template.txt** file at the same time you create the fields list for this file. I find it helpful to use a spreadsheet to capture this data and export it as a CSV file when I am done. This sample file: + + +``` +email,name,number +[myself@mydomain.com][5],"Myself",17 +[bob@bobdomain.com][6],"Bob",42 +``` + +allows you to send emails to two people, using their first name and telling them a number. This file, while not terribly interesting, illustrates an important habit: Always make yourself the first recipient in the file. This enables you to send yourself a test email to verify everything works as expected before you email the entire list. + +If any of your values contain commas, you _**must**_ enclose the entire value in double-quotes (**"**). If you need to include a double-quote in a double-quoted field, use two double-quotes in a row. Quoting rules are fun, so read about [CSVs in Python 3][7] for specifics. + +#### Template.txt + +As part of my work, I get to share news about travel-funding decisions for our Fedora contributor conference, [Flock][8]. A simple email tells people they've been selected for travel funding and their specific funding details. One user-specific detail is how much money we can allocate for their airfare. Here is an abbreviated version of my template file (I've snipped out a lot of the text for brevity): + + +``` +$ cat mailmerge_template.txt +TO: {{Email}} +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> + +Hi {{Name}}, + +I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: + +Travel Budget: {{Travel_Budget}} + +<<snip>> +``` + +The top of the template specifies the recipient, sender, and subject. After the blank line, there's the body of the email. This email needs the recipients' **Email**, **Name**, and **Travel_Budget** from the **database.csv** file. Notice that those fields are surrounded by double curly braces (**{{** and **}}**). The corresponding **mailmerge_database.csv** looks like this: + + +``` +$ cat mailmerge_database.csv +Name,Email,Travel_Budget +Brian,[bexelbie@redhat.com][9],1000 +PersonA,[persona@fedoraproject.org][10],1500 +PèrsonB,[personb@fedoraproject.org][11],500 +``` + +Notice that I listed myself first (for testing) and there are two other people in the file. The second person, PèrsonB, has an accented character in their name; Mailmerge will automatically encode it. + +That's the whole template concept: Write your email and put placeholders in double curly braces. Then create a database that provides those values. Now let's test the email. + +### Test and send simple email merges + +#### Do a dry-run + +Start by doing a dry-run that prints the emails, with the placeholder fields completed, to the screen. By default, if you run the command **mailmerge**, it will do a dry-run of the first email: + + +``` +$ mailmerge +>>> encoding ascii +>>> message 0 +TO: [bexelbie@redhat.com][9] +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Date: Sat, 20 Jul 2019 18:17:15 -0000 + +Hi Brian, + +I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: + +Travel Budget: 1000 + +<<snip>> + +>>> sent message 0 DRY RUN +>>> No attachments were sent with the emails. +>>> Limit was 1 messages.  To remove the limit, use the --no-limit option. +>>> This was a dry run.  To send messages, use the --no-dry-run option. +``` + +Reviewing the first email (**message 0**, as counting starts from zero, like many things in computer science), you can see my name and travel budget are correct. If you want to review every email, enter **mailmerge --no-limit** to tell Mailmerge not to limit itself to the first email. Here's the dry-run of the third email, which shows the special character encoding: + + +``` +>>> message 2 +TO: [personb@fedoraproject.org][11] +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> +MIME-Version: 1.0 +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Date: Sat, 20 Jul 2019 18:22:48 -0000 + +Hi P=E8rsonB, +``` + +That's not an error; **P=E8rsonB** is the encoded form of **PèrsonB**. + +#### Send a test message + +Now, send a test email with the command **mailmerge --no-dry-run**, which tells Mailmerge to send a message to the first email on the list: + + +``` +$ mailmerge --no-dry-run +>>> encoding ascii +>>> message 0 +TO: [bexelbie@redhat.com][9] +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Date: Sat, 20 Jul 2019 18:25:45 -0000 + +Hi Brian, + +I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: + +Travel Budget: 1000 + +<<snip>> + +>>> Read SMTP server configuration from mailmerge_server.conf +>>>   host = smtp.gmail.com +>>>   port = 587 +>>>   username = [bexelbie@redhat.com][9] +>>>   security = STARTTLS +>>> password for [bexelbie@redhat.com][9] on smtp.gmail.com: +>>> sent message 0 +>>> No attachments were sent with the emails. +>>> Limit was 1 messages.  To remove the limit, use the --no-limit option. +``` + +On the fourth to last line, you can see it prompts you for your password. If you're using two-factor authentication or domain-managed logins, you will need to create an application password that bypasses these controls. If you're using Gmail and similar systems, you can do it directly from the interface; otherwise, contact your email system administrator. This will not compromise the security of your email system, but you should still keep the password complex and secret. + +When I checked my email account, I received a beautifully formatted test email. If your test email looks ready, send all the emails by entering **mailmerge --no-dry-run --no-limit**. + +### Send complex emails + +You can really see the power of Mailmerge when you take advantage of [Jinja2 templating][12]. I've found it useful for including conditional text and sending attachments. Here is a complex template and the corresponding database: + + +``` +$ cat mailmerge_template.txt +TO: {{Email}} +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> +ATTACHMENT: attachments/{{File}} + +Hi {{Name}}, + +I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: + +Travel Budget: {{Travel_Budget}} +{% if Hotel == "Yes" -%} +Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) +{%- endif %} + +<<snip>> + +$ cat mailmerge_database.csv +Name,Email,Travel_Budget,Hotel,File +Brian,[bexelbie@redhat.com][9],1000,Yes,visa_bex.pdf +PersonA,[persona@fedoraproject.org][10],1500,No,visa_person_a.pdf +PèrsonB,[personb@fedoraproject.org][11],500,Yes,visa_person_b.pdf +``` + +There are two new things in this email. First, there's an attachment. I have to send visa invitation letters to international travelers to help them come to Flock, and the **ATTACHMENT** part of the header specifies which file to attach. To keep my directory clean, I put all of them in my Attachments subdirectory. Second, it includes conditional information about a hotel, because some people receive funding for their hotel stay, and I need to include those details for those who do. This is done with the **if** construction: + + +``` +{% if Hotel == "Yes" -%} +Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) +{%- endif %} +``` + +This works just like an **if** in most programming languages. Jinja2 is very expressive and can do multi-level conditions. Experiment with making your life easier by including database elements that control the contents of the email. Using whitespace is important for email readability. The minus (**-**) symbols in **if** and **endif** are part of how Jinja2 controls [whitespace][13]. There are lots of options, so experiment to see what looks best for you. + +Also note that I extended the database with two fields, **Hotel** and **File**. These are the values that control the inclusion of the hotel text and provide the name of the attachment. In my example, PèrsonB and I got hotel funding, while PersonA didn't. + +Doing a dry-run and sending the emails is the same whether you're using a simple or a complex template. Give it a try! + +You can also experiment with using conditionals (**if** … **endif**) in the header. You can, for example, have an attachment only if one is in the database, or maybe you need to change the sender's name for some emails but not others. + +### Mailmerge's advantages + +The Mailmerge program provides a powerful but simple method of sending lots of customized emails. Everyone gets only the information they need, and extraneous steps and details are omitted. + +Even for simple group emails, I have found this method much more effective than sending one email to a bunch of people using CC or BCC. A lot of people filter their email and delay reading anything not sent directly to them. Using Mailmerge ensures that every person gets their own email. Messages will filter properly for the recipient and no one can accidentally "reply all" to the entire group. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/sending-custom-emails-python + +作者:[Brian "bex" Exelbierd][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/bexelbie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://docs.fedoraproject.org/en-US/council/fcaic/ +[3]: https://github.com/awdeorio/mailmerge +[4]: https://github.com/awdeorio/mailmerge#install +[5]: mailto:myself@mydomain.com +[6]: mailto:bob@bobdomain.com +[7]: https://docs.python.org/3/library/csv.html +[8]: https://flocktofedora.org/ +[9]: mailto:bexelbie@redhat.com +[10]: mailto:persona@fedoraproject.org +[11]: mailto:personb@fedoraproject.org +[12]: http://jinja.pocoo.org/docs/latest/templates/ +[13]: http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control diff --git a/sources/tech/20190809 Mutation testing is the evolution of TDD.md b/sources/tech/20190809 Mutation testing is the evolution of TDD.md new file mode 100644 index 0000000000..766d2a4285 --- /dev/null +++ b/sources/tech/20190809 Mutation testing is the evolution of TDD.md @@ -0,0 +1,285 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mutation testing is the evolution of TDD) +[#]: via: (https://opensource.com/article/19/8/mutation-testing-evolution-tdd) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +Mutation testing is the evolution of TDD +====== +Since test-driven development is modeled on how nature works, mutation +testing is the natural next step in the evolution of DevOps. +![Ants and a leaf making the word "open"][1] + +In "[Failure is a feature in blameless DevOps][2]," I discussed the central role of failure in delivering quality by soliciting feedback. This is the failure agile DevOps teams rely on to guide them and drive development. [Test-driven development (TDD)][3] is the _[conditio sine qua non][4]_ of any agile DevOps value stream delivery. Failure-centric TDD methodology only works if it is paired with measurable tests. + +TDD methodology is modeled on how nature works and how nature produces winners and losers in the evolutionary game. + +### Natural selection + +![Charles Darwin][5] + +In 1859, [Charles Darwin][6] proposed the theory of evolution in his book _[On the Origin of Species][7]_. Darwin's thesis was that natural variability is caused by the combination of spontaneous mutations in individual organisms and environmental pressures. These pressures eliminate less-adapted organisms while favoring other, more fit organisms. Each and every living being mutates its chromosomes, and those spontaneous mutations are carried to the next generation (the offspring). The newly emerged variability is then tested under natural selection—the environmental pressures that exist due to the variability of environmental conditions. + +This simplified diagram illustrates the process of adjusting to environmental conditions. + +![Environmental pressures on fish][8] + +Fig. 1. Different environmental pressures result in different outcomes governed by natural selection. Image screenshot from a [video by Richard Dawkins][9]. + +This illustration shows a school of fish in their natural habitat. The habitat varies (darker or lighter gravel at the bottom of the sea or riverbed), as does each fish (darker or lighter body patterns and colors). + +It also shows two situations (i.e., two variations of the environmental pressure): + + 1. The predator is present + 2. The predator is absent + + + +In the first situation, fish that are easier to spot against the gravel shade are at higher risk of being picked off by predators. When the gravel is darker, the lighter portion of the fish population is thinned out. And vice versa—when the gravel is a lighter shade, the darker portion of the fish population suffers the thinning out scenario. + +In the second situation, fish are sufficiently relaxed to engage in mating. In the absence of predators and in the presence of the mating ritual, the opposite results can be expected: The fish that stand out against the background have a better chance of being picked for mating and transferring their characteristics to offspring. + +### Selection criteria + +When selecting among variability, the process is never arbitrary, capricious, whimsical, nor random. The decisive factor is always measurable. That decisive factor is usually called a _test_ or a _goal_. + +A simple mathematical example can illustrate this process of decision making. (Only in this case it won't be governed by natural selection, but by artificial selection.) Suppose someone asks you to build a little function that will take a positive number and calculate that number's square root. How would you go about doing that? + +The agile DevOps way is to _fail fast_. Start with humility, admitting upfront that you don't really know how to develop that function. All you know, at this point, is how to _describe_ what you'd like to do. In technical parlance, you are ready to engage in crafting a _unit test_. + +"Unit test" describes your specific expectation. It could simply be formulated as "given the number 16, I expect the square root function to return number 4." You probably know that the square root of 16 is 4. However, you don't know the square root for some larger numbers (such as 533). + +At the very least, you have formulated your selection criteria, your test or goal. + +### Implement the failing test + +The [.NET Core][10] platform can illustrate the implementation. .NET typically uses [xUnit.net][11] as a unit-testing framework. (To follow the coding examples, please install .NET Core and xUnit.net.) + +Open the command line and create a folder where your square root solution will be implemented. For example, type: + + +``` +`mkdir square_root` +``` + +Then type: + + +``` +`cd square_root` +``` + +Create a separate folder for unit tests: + + +``` +`mkdir unit_tests` +``` + +Move into the **unit_tests** folder (**cd unit_tests**) and initiate the xUnit framework: + + +``` +`dotnet new xunit` +``` + +Now, move one folder up to the **square_root** folder, and create the **app** folder: + + +``` +mkdir app +cd app +``` + +Create the scaffold necessary for the C# code: + + +``` +`dotnet new classlib` +``` + +Now open your favorite editor and start cracking! + +In your code editor, navigate to the **unit_tests** folder and open **UnitTest1.cs**. + +Replace auto-generated code in **UnitTest1.cs** with: + + +``` +using System; +using Xunit; +using app; + +namespace unit_tests{ + +   public class UnitTest1{ +       Calculator calculator = new Calculator(); + +       [Fact] +       public void GivenPositiveNumberCalculateSquareRoot(){ +           var expected = 4; +           var actual = calculator.CalculateSquareRoot(16); +           Assert.Equal(expected, actual); +       } +   } +} +``` + +This unit test describes the expectation that the variable **expected** should be 4. The next line describes the **actual** value. It proposes to calculate the **actual** value by sending a message to the component called **calculator**. This component is described as capable of handling the **CalculateSquareRoot** message by accepting a numeric value. That component hasn't been developed yet. But it doesn't really matter, because this merely describes the expectations. + +Finally, it describes what happens when the message is triggered to be sent. At that point, it asserts whether the **expected** value is equal to the **actual** value. If it is, the test passed and the goal is reached. If the **expected** value isn't equal to the **actual value**, the test fails. + +Next, to implement the component called **calculator**, create a new file in the **app** folder and call it **Calculator.cs**. To implement a function that calculates the square root of a number, add the following code to this new file: + + +``` +namespace app { +   public class Calculator { +       public double CalculateSquareRoot(double number) { +           double bestGuess = number; +           return bestGuess; +       } +   } +} +``` + +Before you can test this implementation, you need to instruct the unit test how to find this new component (**Calculator**). Navigate to the **unit_tests** folder and open the **unit_tests.csproj** file. Add the following line in the **<ItemGroup>** code block: + + +``` +`` +``` + +Save the **unit_test.csproj** file. Now you are ready for your first test run. + +Go to the command line and **cd** into the **unit_tests** folder. Run the following command: + + +``` +`dotnet test` +``` + +Running the unit test will produce the following output: + +![xUnit output after the unit test run fails][12] + +Fig. 2. xUnit output after the unit test run fails. + +As you can see, the unit test failed. It expected that sending number 16 to the **calculator** component would result in the number 4 as the output, but the output (the **actual** value) was the number 16. + +Congratulations! You have created your first failure. Your unit test provided strong, immediate feedback urging you to fix the failure. + +### Fix the failure + +To fix the failure, you must improve **bestGuess**. Right now, **bestGuess** merely takes the number the function receives and returns it. Not good enough. + +But how do you figure out a way to calculate the square root value? I have an idea—how about looking at how Mother Nature solves problems. + +### Emulate Mother Nature by iterating + +It is extremely hard (pretty much impossible) to guess the correct value from the first (and only) attempt. You must allow for several attempts at guessing to increase your chances of solving the problem. And one way to allow for multiple attempts is to _iterate_. + +To iterate, store the **bestGuess** value in the **previousGuess** variable, transform the **bestGuess** value, and compare the difference between the two values. If the difference is 0, you solved the problem. Otherwise, keep iterating. + +Here is the body of the function that produces the correct value for the square root of any positive number: + + +``` +double bestGuess = number; +double previousGuess; + +do { +   previousGuess = bestGuess; +   bestGuess = (previousGuess + (number/previousGuess))/2; +} while((bestGuess - previousGuess) != 0); + +return bestGuess; +``` + +This loop (iteration) converges bestGuess values to the desired solution. Now your carefully crafted unit test passes! + +![Unit test successful][13] + +Fig. 3. Unit test successful, 0 tests failed. + +### The iteration solves the problem + +Just like Mother Nature's approach, in this exercise, iteration solves the problem. An incremental approach combined with stepwise refinement is the guaranteed way to arrive at a satisfactory solution. The decisive factor in this game is having a measurable goal and test. Once you have that, you can keep iterating until you hit the mark. + +### Now the punchline! + +OK, this was an amusing experiment, but the more interesting discovery comes from playing with this newly minted solution. Until now, your starting **bestGuess** was always equal to the number the function receives as the input parameter. What happens if you change the initial **bestGuess**? + +To test that, you can run a few scenarios. First, observe the stepwise refinement as the iteration loops through a series of guesses as it tries to calculate the square root of 25: + +![Code iterating for the square root of 25][14] + +Fig. 4. Iterating to calculate the square root of 25. + +Starting with 25 as the **bestGuess**, it takes eight iterations for the function to calculate the square root of 25. But what would happen if you made a comical, ridiculously wrong stab at the **bestGuess**? What if you started with a clueless second guess, that 1 million might be the square root of 25? What would happen in such an obviously erroneous situation? Would your function be able to deal with such idiocy? + +Take a look at the horse's mouth. Rerun the scenario, this time starting from 1 million as the **bestGuess**: + +![Stepwise refinement][15] + +Fig. 5. Stepwise refinement when calculating the square root of 25 by starting with 1 million as the initial **bestGuess**. + +Oh wow! Starting with a ludicrously large number, the number of iterations only tripled (from eight iterations to 23). Not nearly as dramatic an increase as you might intuitively expect. + +### The moral of the story + +The _Aha!_ moment arrives when you realize that, not only is iteration guaranteed to solve the problem, but it doesn't matter whether your search for the solution begins with a good or a terribly botched initial guess. However erroneous your initial understanding, the process of iteration, coupled with a measurable test/goal, puts you on the right track and delivers the solution. Guaranteed. + +Figures 4 and 5 show a steep and dramatic burndown. From a wildly incorrect starting point, the iteration quickly burns down to an absolutely correct solution. + +This amazing methodology, in a nutshell, is the essence of agile DevOps. + +### Back to some high-level observations + +Agile DevOps practice stems from the recognition that we live in a world that is fundamentally based on uncertainty, ambiguity, incompleteness, and a healthy dose of confusion. From the scientific/philosophical point of view, these traits are well documented and supported by [Heisenberg's Uncertainty Principle][16] (covering the uncertainty part), [Wittgenstein's Tractatus Logico-Philosophicus][17] (the ambiguity part), [Gödel's incompleteness theorems][18] (the incompleteness aspect), and the [Second Law of Thermodynamics][19] (the confusion caused by relentless entropy). + +In a nutshell, no matter how hard you try, you can never get complete information when trying to solve any problem. It is, therefore, more profitable to abandon an arrogant stance and adopt a more humble approach to solving problems. Humility pays big dividends in rewarding you—not only with the hoped-for solution but also with the byproduct of a well-structured solution. + +### Conclusion + +Nature works incessantly—it's a continuous flow. Nature has no master plan; everything happens as a response to what happened earlier. The feedback loops are very tight, and apparent progress/regress is piecemeal. Everywhere you look in nature, you see stepwise refinement, in one shape or form or another. + +Agile DevOps is a very interesting outcome of the engineering model's gradual maturation. DevOps is based on the recognition that the information you have available is always incomplete, so you'd better proceed cautiously. Obtain a measurable test (e.g., a hypothesis, a measurable expectation), make a humble attempt at satisfying it, most likely fail, then collect the feedback, fix the failure, and continue. There is no plan other than agreeing that, with each step of the way, there must be a measurable hypothesis/test. + +In the next article in this series, I'll take a closer look at how mutation testing provides much-needed feedback that drives value. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/mutation-testing-evolution-tdd + +作者:[Alex Bunardzic][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/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520X292_openanttrail-2.png?itok=xhD3WmUd (Ants and a leaf making the word "open") +[2]: https://opensource.com/article/19/7/failure-feature-blameless-devops +[3]: https://en.wikipedia.org/wiki/Test-driven_development +[4]: https://www.merriam-webster.com/dictionary/conditio%20sine%20qua%20non +[5]: https://opensource.com/sites/default/files/uploads/darwin.png (Charles Darwin) +[6]: https://en.wikipedia.org/wiki/Charles_Darwin +[7]: https://en.wikipedia.org/wiki/On_the_Origin_of_Species +[8]: https://opensource.com/sites/default/files/uploads/environmentalconditions2.png (Environmental pressures on fish) +[9]: https://www.youtube.com/watch?v=MgK5Rf7qFaU +[10]: https://dotnet.microsoft.com/ +[11]: https://xunit.net/ +[12]: https://opensource.com/sites/default/files/uploads/xunit-output.png (xUnit output after the unit test run fails) +[13]: https://opensource.com/sites/default/files/uploads/unit-test-success.png (Unit test successful) +[14]: https://opensource.com/sites/default/files/uploads/iterating-square-root.png (Code iterating for the square root of 25) +[15]: https://opensource.com/sites/default/files/uploads/bestguess.png (Stepwise refinement) +[16]: https://en.wikipedia.org/wiki/Uncertainty_principle +[17]: https://en.wikipedia.org/wiki/Tractatus_Logico-Philosophicus +[18]: https://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems +[19]: https://en.wikipedia.org/wiki/Second_law_of_thermodynamics diff --git a/sources/tech/20190810 EndeavourOS Aims to Fill the Void Left by Antergos in Arch Linux World.md b/sources/tech/20190810 EndeavourOS Aims to Fill the Void Left by Antergos in Arch Linux World.md new file mode 100644 index 0000000000..b993c4d1dc --- /dev/null +++ b/sources/tech/20190810 EndeavourOS Aims to Fill the Void Left by Antergos in Arch Linux World.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (EndeavourOS Aims to Fill the Void Left by Antergos in Arch Linux World) +[#]: via: (https://itsfoss.com/endeavouros/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +EndeavourOS Aims to Fill the Void Left by Antergos in Arch Linux World +====== + +![][1] + +I’m sure that most of our readers are aware of the [end of the Antergos project][2]. In the wake of the announcement, the members of the Antergos community created several successors. Today, we will be looking at one of the ‘spiritual successors’ of Antergos: [EndeavourOS][3]. + +### EndeavourOS is not a fork of Antergos + +Before we start, I would like to make it very clear that EndeavourOS is not a fork of Antergos. The developers used Antergos as their inspiration to create a light Arch-based distro. + +![Endeavouros First Boot][4] + +According to the [project’s site][5], EndeavourOS came into existence because people in the Antergos community wanted to keep the spirit of Antergos alive. Their goal was simply to “have Arch installed with an easy to use installer and a friendly, helpful community to fall back on during the journey to master the system”. + +Unlike many Arch-based distros, EndeavourOS is intending to work [like vanilla Arch][5], “so no one-click solutions to install your favorite app or a bunch of preinstalled apps you’ll eventually don’t need”. For most people, especially those new to Linux and Arch, there will be a learning curve, but EndeavourOS aims to have a large friendly community where people are encouraged to ask questions and learn about their systems. + +![Endeavouros Installing][6] + +### A Work in Progress + +EndeavourOS was [first released on July 15th][7] of this year after the project was first announced on [May 23rd][8]. Unfortunately, this means that the developers were unable to incorporate all of the features that they have planned. + +For example, they want to have an online install similar to the one used by Antergos but ran into [issues with the current options][9]. “Cnchi has caused serious problems to be working outside the Antergos eco system and it needs a complete rewrite to work. The Fenix installer by RebornOS is getting more into shape, but needs more time to properly function.” For now, EndeavourOS will ship with the [Calamares installer][10]. + +[][11] + +Suggested read  Velt/OS: A Material Design-Themed Desktop Environment + +EndeavourOS will also offer [less stuff than Antergos][9]: It’s repo is smaller than Antergos though they ship with some AUR packages. Their goal is to deliver a system that’s close to Arch an not vanilla Arch. + +![Endeavouros Updating With Kalu][12] + +The developers [stated further][13]: + +> “Linux and specifically Arch are all about freedom of choice, we provide a basic install that lets you explore those choices with a small layer of convenience. We will never judge you by installing GUI apps like Pamac or even work with sandbox solutions like Flatpak or Snaps. It’s up to you what you are installing to make EndeavourOS work in your circumstances, that’s the main difference we have with Antergos or Manjaro, but like Antergos we will try to help you if you run into a problem with one of your installed packages.” + +### Experiencing EndeavourOS + +I installed EndeavourOS in [VirtualBox][14] and took a look around. When I first booted from the image, I was greeted by a little box with links to the EndeavourOS site about installing. It also has a button to install and one to manually partition the drive. The Calamares installer worked very smoothly for me. + +After I rebooted into a fresh install of EndeavourOS, I was greeted by a colorful themed XFCE desktop. I was also treated to a bunch of notification balloons. Most Arch-based distros I’ve used come with a GUI tool like [pamac][15] or [octopi][16] to keep the system up-to-date. EndeavourOS comes with [kalu][17]. (kalu stands for “Keeping Arch Linux Up-to-date”.) It checks for updated packages, Arch Linux News, updated AUR packages and more. Once it sees an update for any of those areas, it will create a notification balloon. + +I took a look through the menu to see what was installed by default. The answer is not much, not even an office suite. If they intend for EndeavourOS to be a blank canvas for anyone to create the system they want. they are headed in the right direction. + +![Endeavouros Desktop][18] + +### Final Thoughts + +EndeavourOS is still very young. The first stable release was issued only 3 weeks ago. It is missing some stuff, most importantly an online installer. That being said, it is possible to gauge where EndeavourOS will be heading. + +[][19] + +Suggested read  An Overview of Intel's Clear Linux, its Features and Installation Procedure + +While it is not an exact clone of Antergos, EndeavourOS wants to replicate the most important part of Antergos the welcoming, friendly community. All to often, the Linux community can seem to be unwelcoming and downright hostile to the beginner. I’ve seen more and more people trying to combat that negativity and bring more people into Linux. With the EndeavourOS team making that their main focus, a great distro can be the only result. + +If you are currently using Antergos, there is a way for you to [switch to EndeavourOS without performing a clean install.][20] + +If you want an exact clone of Antergos, I would recommend checking out [RebornOS][21]. They are currently working on a replacement of the Cnchi installer named Fenix. + +Have you tried EndeavourOS already? How’s your experience with it? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/endeavouros/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/endeavouros-logo.png?ssl=1 +[2]: https://itsfoss.com/antergos-linux-discontinued/ +[3]: https://endeavouros.com/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/endeavouros-first-boot.png?resize=800%2C600&ssl=1 +[5]: https://endeavouros.com/info-2/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/endeavouros-installing.png?resize=800%2C600&ssl=1 +[7]: https://endeavouros.com/endeavouros-first-stable-release-has-arrived/ +[8]: https://forum.antergos.com/topic/11780/endeavour-antergos-community-s-next-stage +[9]: https://endeavouros.com/what-to-expect-on-the-first-release/ +[10]: https://calamares.io/ +[11]: https://itsfoss.com/veltos-linux/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/endeavouros-updating-with-kalu.png?resize=800%2C600&ssl=1 +[13]: https://endeavouros.com/second-week-after-the-stable-release/ +[14]: https://itsfoss.com/install-virtualbox-ubuntu/ +[15]: https://aur.archlinux.org/packages/pamac-aur/ +[16]: https://octopiproject.wordpress.com/ +[17]: https://github.com/jjk-jacky/kalu +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/endeavouros-desktop.png?resize=800%2C600&ssl=1 +[19]: https://itsfoss.com/clear-linux/ +[20]: https://forum.endeavouros.com/t/how-to-switch-from-antergos-to-endevouros/105/2 +[21]: https://rebornos.org/ diff --git a/sources/tech/20190811 How to Setup Disk Quota on XFS File System in Linux Servers.md b/sources/tech/20190811 How to Setup Disk Quota on XFS File System in Linux Servers.md new file mode 100644 index 0000000000..056d130074 --- /dev/null +++ b/sources/tech/20190811 How to Setup Disk Quota on XFS File System in Linux Servers.md @@ -0,0 +1,310 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Setup Disk Quota on XFS File System in Linux Servers) +[#]: via: (https://www.linuxtechi.com/disk-quota-xfs-file-system-linux-servers/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Setup Disk Quota on XFS File System in Linux Servers +====== + +Managing Disk quota on file systems is one of the most common day to day operation tasks for Linux admins, in this article we will demonstrate how to setup disk quota on XFS file system / partition on Linux Servers like **CentOS**, **RHEL**, **Ubuntu** and **Debian**. Here Disk quota means implementing limit on disk usage and file or inode usage. + +[![Setup-Disk-Quota-XFS-Linux-Servers][1]][2] + +Disk quota on XFS file system is implemented as followings: + + * User Quota + * Group Quota + * Project Quota (or Directory Quota) + + + +To setup disk quota on XFS file system, first we must enable quota using following mount options: + + * **uquota**: Enable user quota & also enforce usage limits. + * **uqnoenforce**: Enable user quota and report usage but don’t enforce usage limits. + * **gquota**: Enable group quota & also enforce usage limits. + * **gqnoenforce**: Enable group quota and report usage, but don’t enforce usage limits. + * **prjquota / pquota**:  Enable project quota & enforce usage limits. + * **pqnoenforce**:  Enable project quota and report usage but don’t enforce usage limits. + + + +In article we will implement user & group disk quota on /home partition and apart from this we will also see how to setup  inode quota on /home file system and project quota on /var file system. + +``` +[root@linuxtechi ~]# df -Th /home /var +Filesystem Type Size Used Avail Use% Mounted on +/dev/mapper/Vol-home xfs 16G 33M 16G 1% /home +/dev/mapper/Vol-var xfs 18G 87M 18G 1% /var +[root@linuxtechi ~]# +``` + +### Enable User and Group Quota on /home + +Unmount /home partition and then edit the /etc/fstab file, + +``` +[root@linuxtechi ~]# umount /home/ +``` + +Add uquota and gquota after default keyword for /home partition in /etc/fstab file, example is shown below + +``` +[root@linuxtechi ~]# vi /etc/fstab +…………………………… +/dev/mapper/Vol-home /home xfs defaults,uquota,gquota 0 0 +…………………………… +``` + +![user-group-quota-fstab-file][1] + +Now mount the /home partition using below “**mount -a**” command, + +``` +[root@linuxtechi ~]# mount -a +[root@linuxtechi ~]# +``` + +Verify whether quota is enabled on /home or not, + +``` +[root@linuxtechi ~]# mount | grep /home +/dev/mapper/Vol-home on /home type xfs (rw,relatime,seclabel,attr2,inode64,usrquota,grpquota) +[root@linuxtechi ~]# +``` + +**Note :** While umounting /home partition if you get /home is busy then edit the fstab file, add uquota and gquota keywords after default keyword for /home partition and then reboot your system. After reboot we will see that quota is enabled on /home. + +Quota on XFS file system is managed by the command line tool called “**xfs_quota**“. xfs_quota works in two modes: + + * **Basic Mode** – For this mode, simply type xfs_quota then you will enter basic mode there you can print disk usage of all file system and disk quota for users, example is show below + + + +![xfs-quota-basic-mode][1] + + * **Expert Mode** – This mode is invoked using “-x” option in “xfs_quota” command, as the name suggests this mode is used to configure disk and file quota for local users on xfs file system. + + + +To print disk quota on any file system, let’s say /home, use the following command, + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'report -h' /home +User quota on /home (/dev/mapper/Vol-home) + Blocks +User ID Used Soft Hard Warn/Grace +---------- --------------------------------- +root 0 0 0 00 [------] +pkumar 12K 0 0 00 [------] + +Group quota on /home (/dev/mapper/Vol-home) + Blocks +Group ID Used Soft Hard Warn/Grace +---------- --------------------------------- +root 0 0 0 00 [------] +pkumar 12K 0 0 00 [------] +[root@linuxtechi ~]# +``` + +### Configure User Quota + +Let’s assume we have a user named “pkumar”, let’s set disk and file quota on his home directory using “xfs_quota” command + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'limit bsoft=4250m bhard=4550m pkumar' /home +``` + +In above command, **bsoft** is block soft limit in MBs and **bhard** is block hard limit in MBs, limit is a keyword to implement disk or file limit on a file system for a specific user. + +Let’s set file or inode limit for user pkumar on his home directory, + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'limit isoft=400 ihard=500 pkumar' /home +``` + +In above command isoft is inode or file soft limit and ihard is inode or file hard limit. + +Both block (disk) limit and Inode (file) limit can be applied using a single command, example is shown below, + +``` +root@linuxtechi ~]# xfs_quota -x -c 'limit bsoft=4250m bhard=4550m isoft=400 ihard=500 pkumar' /home +[root@linuxtechi ~]# +``` + +Now verify whether disk and inode limits are implemented on pkumar user using the following xfs_quota command, + +``` +[root@linuxtechi ~]# xfs_quota -x -c "report -bih" /home +``` + +![User-Quota-Details-xfs-linux][1] + +In above xfs_quota command, report is a keyword , b is for block report , i is for inode report and h is for to display report in human readable format, + +### Configure Group Quota + +Let’s assume we have a group named called “**engineering**” and two local users (shashi & rakesh) whose secondary group is engineering + +Now set the following quotas: + + * Soft block limit: 6 GB (or 6144 MB), + * Hard block limit :8 GB (or 8192 MB), + * Soft file limit: 1000 + * Hard file limit: 1200 + + + +So to configure disk and file quota on engineering group, use the beneath xfs_quota command, + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'limit -g bsoft=6144m bhard=8192m isoft=1000 ihard=1200 engineering' /home +[root@linuxtechi ~]# +``` + +**Note:** In xfs_quota we can also specify the block limit size in GB like “bsoft=6g and bhard=8g” + +Now verify the Quota details for group engineering using the following command, + +``` +[root@linuxtechi ~]# xfs_quota -x -c "report -gbih" /home +Group quota on /home (/dev/mapper/Vol-home) + Blocks Inodes +Group ID Used Soft Hard Warn/Grace Used Soft Hard Warn/Grace +---------- --------------------------------- --------------------------------- +root 0 0 0 00 [------] 3 0 0 00 [------] +pkumar 12K 0 0 00 [------] 4 0 0 00 [------] +engineering 0 6G 8G 00 [------] 0 1000 1.2k 00 [------] +shashi 12K 0 0 00 [------] 4 0 0 00 [------] +rakesh 12K 0 0 00 [------] 4 0 0 00 [------] +[root@linuxtechi ~]# +``` + +As we can see above command output, disk and file quota is implemented on engineering group and under the engineering group, we have two users. + +### Configure Project (or Directory) Quota + +Let’s assume we want to set project quota or directory Quota on “**/var/log**“, So first enable project quota(**prjquota**) on /var file system, edit the /etc/fstab file, add “**prjquota**” after default keyword for /var file system, example is shown below, + +``` +[root@linuxtechi ~]# vi /etc/fstab +………………………………. +/dev/mapper/Vol-var /var xfs defaults,prjquota 0 0 +………………………………… +``` + +Save & exit the file + +To make the above changes into the effect, we must reboot our system, + +``` +[root@linuxtechi ~]# init 6 +``` + +After reboot, we can verify whether project quota is enabled or not on /var file system using below mount command + +``` +[root@linuxtechi ~]# mount | grep /var +/dev/mapper/Vol-var on /var type xfs (rw,relatime,seclabel,attr2,inode64,prjquota) +[root@linuxtechi ~]# +``` + +As we can see in above output, project quota is enabled now, so to configure quota /var/log directory, first we must define directory path and its unique id in the file /etc/projects ( In my case i am taking 151 as unique id for /var/log) + +``` +[root@linuxtechi ~]# vi /etc/projects +51:/var/log +``` + +Save & exit the file + +Now associate the above id “151” to a project called “**Logs**”, create a file **/etc/projid** and add the following content to it, + +``` +[root@linuxtechi ~]# vi /etc/projid +Logs:151 +``` + +Save & exit the file + +Initialize “Logs” project directory using the xfs_quota command, + +**Syntax: #**  xfs_quota -x -c ‘project -s project_name’ project_directory + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'project -s Logs' /var +Setting up project Logs (path /var/log)... +Processed 1 (/etc/projects and cmdline) paths for project Logs with recursion depth infinite (-1). +[root@linuxtechi ~]# +``` + +Let’s suppose we want to implement 10 GB hard disk limit and 8 GB soft limit on /var/log directory, run the following xfs_quota command, + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'limit -p bsoft=8g bhard=10g Logs' /var +[root@linuxtechi ~]# +``` + +In above command we have used “-p” after limit keyword which shows that we want to implement project quota + +Use below xfs_quota command to set file or inode limit on /var/log directory + +``` +[root@linuxtechi ~]# xfs_quota -x -c 'limit -p isoft=1800 ihard=2000 Logs' /var +[root@linuxtechi ~]# +``` + +Use below command to print Project quota details + +``` +[root@linuxtechi ~]# xfs_quota -xc 'report -pbih' /var +Project quota on /var (/dev/mapper/Vol-var) + Blocks Inodes +Project ID Used Soft Hard Warn/Grace Used Soft Hard Warn/Grace +---------- --------------------------------- --------------------------------- +#0 137.6M 0 0 00 [------] 1.5k 0 0 00 [------] +Logs 3.1M 8G 10G 00 [------] 33 1.8k 2k 00 [------] +[root@linuxtechi ~]# +``` + +Test Project quota by creating big files under /var/log folder and see whether you can cross 10GB block limit, + +``` +[root@linuxtechi ~]# cd /var/log/ +[root@linuxtechi log]# dd if=/dev/zero of=big_file bs=1G count=9 +9+0 records in +9+0 records out +9663676416 bytes (9.7 GB) copied, 37.8915 s, 255 MB/s +[root@linuxtechi log]# dd if=/dev/zero of=big_file2 bs=1G count=5 +dd: error writing ‘big_file2’: No space left on device +1+0 records in +0+0 records out +1069219840 bytes (1.1 GB) copied, 3.90945 s, 273 MB/s +[root@linuxtechi log]# +``` + +Above dd error command confirms that configured project quota is working fine, we can also confirm the same from xfs_quota command, + +![xfs-project-quota-details][1] + +That’s all from this tutorial, I hope these steps helps you to understand about quota on XFS file system, please do share your feedback and comments in the comments section below. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/disk-quota-xfs-file-system-linux-servers/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Setup-Disk-Quota-XFS-Linux-Servers.jpg diff --git a/sources/tech/20190812 Cloud-native Java, open source security, and more industry trends.md b/sources/tech/20190812 Cloud-native Java, open source security, and more industry trends.md new file mode 100644 index 0000000000..58791aba9c --- /dev/null +++ b/sources/tech/20190812 Cloud-native Java, open source security, and more industry trends.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cloud-native Java, open source security, and more industry trends) +[#]: via: (https://opensource.com/article/19/8/cloud-native-java-and-more) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Cloud-native Java, open source security, 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. + +## [Why is modern web development so complicated?][2] + +> Modern frontend web development is a polarizing experience: many love it, others despise it. +> +> I am a huge fan of modern web development, though I would describe it as "magical"—and magic has its upsides and downsides... Recently I’ve been needing to explain “modern web development workflows” to folks who only have a cursory of vanilla web development workflows and… It is a LOT to explain! Even a hasty explanation ends up being pretty long. So in the effort of writing more of my explanations down, here is the beginning of a long yet hasty explanation of the evolution of web development.. + +**The impact:** Specific enough to be useful to (especially new) frontend developers, but simple and well explained enough to help non-developers understand better some of the frontend developer problems. By the end, you'll (kinda) know the difference between Javascript and WebAPIs and how 2019 Javascript is different than 2006 Javascript. + +## [Open sourcing the Kubernetes security audit][3] + +> Last year, the Cloud Native Computing Foundation (CNCF) began the process of performing and open sourcing third-party security audits for its projects in order to improve the overall security of our ecosystem. The idea was to start with a handful of projects and gather feedback from the CNCF community as to whether or not this pilot program was useful. The first projects to undergo this process were [CoreDNS][4], [Envoy][5] and [Prometheus][6]. These first public audits identified security issues from general weaknesses to critical vulnerabilities. With these results, project maintainers for CoreDNS, Envoy and Prometheus have been able to address the identified vulnerabilities and add documentation to help users. +> +> The main takeaway from these initial audits is that a public security audit is a great way to test the quality of an open source project along with its vulnerability management process and more importantly, how resilient the open source project’s security practices are. With CNCF [graduated projects][7] especially, which are used widely in production by some of the largest companies in the world, it is imperative that they adhere to the highest levels of security best practices. + +**The impact:** A lot of companies are placing big bets on Kubernetes being to the cloud what Linux is to that data center. Seeing 4 of those companies working together to make sure the project is doing what it should be from a security perspective inspires confidence. Sharing that research shows that open source is so much more than code in a repository; it is the capturing and sharing of expert opinions in a way that benefits the community at large rather than the interests of a few. + +## [Quarkus—what's next for the lightweight Java framework?][8] + +> What does “container first” mean? What are the strengths of Quarkus? What’s new in 0.20.0? What features can we look forward to in the future? When will version 1.0.0 be released? We have so many questions about Quarkus and Alex Soto was kind enough to answer them all. _With the release of Quarkus 0.20.0, we decided to get in touch with [JAX London speaker][9], Java Champion, and Director of Developer Experience at Red Hat – Alex Soto. He was kind enough to answer all our questions about the past, present, and future of Quarkus. It seems like we have a lot to look forward to with this exciting lightweight framework!_ + +**The impact**: Someone clever recently told me that Quarkus has the potential to make Java "possibly one of the best languages for containers and serverless environments". That made me do a double-take; while Java is one of the most popular programming languages ([if not the most popular][10]) it probably isn't the first one that jumps to mind when you hear the words "cloud native." Quarkus could extend and grow the value of the skills held by a huge chunk of the developer workforce by allowing them to apply their experience to new challenges. + +## [Julia programming language: Users reveal what they love and hate the most about it][11] + +> The most popular technical feature of Julia is speed and performance followed by ease of use, while the most popular non-technical feature is that users don't have to pay to use it.  +> +> Users also report their biggest gripes with the language. The top one is that packages for add-on features aren't sufficiently mature or well maintained to meet their needs.  + +**The impact:** The Julia 1.0 release has been out for a year now, and has seen impressive growth in a bunch of relevant metrics (downloads, GitHub stars, etc). It is a language aimed squarely at some of our biggest current and future challenges ("scientific computing, machine learning, data mining, large-scale linear algebra, distributed and parallel computing") so finding out how it's users are feeling about it gives an indirect read on how well those challenges are being addressed. + +## [Multi-cloud by the numbers: 11 interesting stats][12] + +> If you boil our recent dive into [interesting stats about Kubernetes][13] down to its bottom line, it looks something like this: [Kubernetes'][14] popularity will continue for the foreseeable future. +> +> Spoiler alert: When you dig up recent numbers about [multi-cloud][15] usage, they tell a similar story: Adoption is soaring. +> +> This congruity makes sense. Perhaps not every organization will use Kubernetes to manage its multi-cloud and/or [hybrid cloud][16] infrastructure, but the two increasingly go hand-in-hand. Even when they don’t, they both reflect a general shift toward more distributed and heterogeneous IT environments, as well as [cloud-native development][17] and other overlapping trends. + +**The impact**: Another explanation of increasing adoption of "multi-cloud strategies" is they retroactively legitimize decisions taken in separate parts of an organization without consultation as "strategic." "Wait, so you bought hours from who? And you bought hours from the other one? Why wasn't that in the meeting minutes? I guess we're a multi-cloud company now!" Of course I'm joking, I'm sure most big companies are a lot better coordinated than that, right? + +_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/8/cloud-native-java-and-more + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者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.vrk.dev/2019/07/11/why-is-modern-web-development-so-complicated-a-long-yet-hasty-explanation-part-1/ +[3]: https://www.cncf.io/blog/2019/08/06/open-sourcing-the-kubernetes-security-audit/ +[4]: https://coredns.io/2018/03/15/cure53-security-assessment/ +[5]: https://github.com/envoyproxy/envoy/blob/master/docs/SECURITY_AUDIT.pdf +[6]: https://cure53.de/pentest-report_prometheus.pdf +[7]: https://www.cncf.io/projects/ +[8]: https://jaxenter.com/quarkus-whats-next-for-the-lightweight-java-framework-160793.html +[9]: https://jaxlondon.com/cloud-kubernetes-serverless/java-particle-acceleration-using-quarkus/ +[10]: https://opensource.com/article/19/8/possibly%20one%20of%20the%20best%20languages%20for%20containers%20and%20serverless%20environments. +[11]: https://www.zdnet.com/article/julia-programming-language-users-reveal-what-they-love-and-hate-the-most-about-it/#ftag=RSSbaffb68 +[12]: https://enterprisersproject.com/article/2019/8/multi-cloud-statistics +[13]: https://enterprisersproject.com/article/2019/7/kubernetes-statistics-13-compelling +[14]: https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA +[15]: https://www.redhat.com/en/topics/cloud-computing/what-is-multicloud?intcmp=701f2000000tjyaAAA +[16]: https://enterprisersproject.com/hybrid-cloud +[17]: https://enterprisersproject.com/article/2018/10/how-explain-cloud-native-apps-plain-english diff --git a/sources/tech/20190812 What open source is not.md b/sources/tech/20190812 What open source is not.md new file mode 100644 index 0000000000..72788635a0 --- /dev/null +++ b/sources/tech/20190812 What open source is not.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What open source is not) +[#]: via: (https://opensource.com/article/19/8/what-open-source-not) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +What open source is not +====== +Here are some things that are not central to what open source is and +where it’s going. +![Open here.][1] + +From its early days, the availability of source code was one of the defining characteristics of open source software. Indeed, Brian Behlendorf of the Apache web server project, an early open source software success, favored "source code available software." + +Another important aspect related to user rights. Hence, the "free software" terminology that came out of Richard Stallman’s GNU Manifesto and GNU Public License (GPL). As the shorthand went, free was about freedom, not price. [Christine Peterson would later coin "open source"][2] as an alternative that avoided the confusion that regularly arose between these two meanings of free. And that’s the term that’s most widely used today. + +These and other historical contexts still flavor how many think about open source today. Where open source came from should still inform today’s thinking about open source. But it also shouldn’t overly constrain that thinking. + +With that background, here are some things that open source is not, or at least that aren’t central to what open source is and where it’s going. + +### Open source is not licenses + +Licenses as a legal concept remain an important part of open source software’s foundations. But, recent hullabaloo on the topic notwithstanding, licenses are mostly not the central topic that they once were. It’s generally understood that the gamut of licenses from copyleft ones like the GPL family to the various permissionless licenses like the Apache, BSD, and MIT licenses come with various strengths and tradeoffs. + +Today’s projects tend to choose licenses based on practical concerns—with a general overall rise in using permissionless licenses for new projects. The proliferation of new open source licenses has also largely subsided given a broad recognition that the [Open Source Definition (OSD)][3] is well-covered by existing license options. + +(The OSD and the set of approved licenses maintained by the Open Source Initiative (OSI) serve as a generally accepted standard for what constitutes an open source software license. Core principles include free redistribution, providing a means to obtain source code, allowing modifications, and a lack of prohibitions about who can use the software and for what purpose.) + +### Open source is not a buzzword + +Words matter. + +Open source software is popular with users for many reasons. They can acquire the software for free and modify it as needed. They can also purchase commercial products that package up open source projects and support them through a life cycle in ways that are needed for many enterprise production deployments. + +Many users of open source software also view it as a great way to get [access to all of the innovation][4] happening in upstream community projects. + +The term "open source" carries a generally positive vibe in other words. + +But open source also has a specific definition, according to the aforementioned OSD. So you can’t just slap an open source label on your license and software and call it open source if it is not, in fact, open source. Well, no one can stop you, but they can call you out for it. Proprietary software with an open source label doesn’t confer any of the advantages of an open source approach for either you or your users. + +### Open source is not viewing code + +The ability to obtain and view open source code is inherent to open source’s definition. But viewing isn’t the interesting part. + +If I write something and put it up on a public repo under an open source license and call it a day, that’s not a very interesting act. It’s _possible_ that there’s enough value in just the code that someone else will fork the software and do something useful with it. + +However, for the most part, if I don’t invite contributions or otherwise make an effort to form a community around the project and codebase, it’s unlikely to gain traction. And, if no one is around to look at the code, does it really matter that it’s possible to do so? + +### Open source is not a business model + +It’s common to hear people talk about "open source business models." I’m going to be just a bit pedantic and argue that there’s no such thing. + +It’s not that open source doesn’t intersect with and influence business models. Of course, it does. Most obviously, open source tends to preclude business models that depend in whole—or in significant part—on restricting access to software that has not been purchased in some manner. + +Conversely, participation in upstream open source communities can create opportunities that otherwise wouldn’t exist. For example, companies can share the effort of writing common infrastructure software with competitors while focusing on those areas of their business where they think they can add unique value—their secret sauce if you will. + +However, thinking of open source itself as a business model is, I would argue, the wrong framing. It draws attention away from thinking about business models in terms of sustainable company objectives and differentiation. + +### Open source is... + +Which brings us to a key aspect of open source, as it’s developed into such an important part of the software landscape. + +Open source preserves user freedoms and provides users with the strategic flexibility to shift vendors and technologies to a degree that’s rarely possible with proprietary software. That’s a given. + +Open source has also emerged as a great model for collaborative software development. + +But taking full advantage of that model requires embracing it and not just adopting some superficial trappings. + +Are there challenges associated with creating and executing business models that depend in large part on open source software today? Certainly. But those challenges have always existed even if large cloud providers have arguably dialed up the degree of difficulty. And, truly, building sustainable software businesses has never been easy. + +Open source software is increasingly an integral part of most software businesses. That fact introduces some new challenges. But it also opens up new possibilities. + +**Watch: Gordon Haff and Spender Krum discuss this topic IBM Think 2019** + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/what-open-source-not + +作者:[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/OPENHERE_green.png?itok=4kTXtbNP (Open here.) +[2]: https://opensource.com/article/18/2/coining-term-open-source-software +[3]: https://opensource.org/osd +[4]: https://www.redhat.com/en/enterprise-open-source-report/2019 diff --git a/sources/tech/20190813 A comprehensive guide to agile project management.md b/sources/tech/20190813 A comprehensive guide to agile project management.md new file mode 100644 index 0000000000..d26b5ed2a9 --- /dev/null +++ b/sources/tech/20190813 A comprehensive guide to agile project management.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A comprehensive guide to agile project management) +[#]: via: (https://opensource.com/article/19/8/guide-agile-project-management) +[#]: author: (Matt ShealyDaniel OhLeigh Griffin https://opensource.com/users/mshealyhttps://opensource.com/users/jkriegerhttps://opensource.com/users/daniel-ohhttps://opensource.com/users/mtakanehttps://opensource.com/users/ahmadnassrihttps://opensource.com/users/agagancarczykhttps://opensource.com/users/lgriffin) + +A comprehensive guide to agile project management +====== +Agile project management's 12 guiding principles can help your team move +faster together. +![A diagram of a branching process][1] + +With a focus on continuous improvements, agile project management upends the traditional linear way of developing products and services. Increasingly, organizations are adopting agile project management because it utilizes a series of shorter development cycles to deliver features and improve continually. This management style allows for rapid development, continuous integration (CI), and continuous delivery (CD). + +Agile project management allows cross-functional teams to work on chunks of projects, solving problems and moving projects forward in shorter phases. This enables them to iterate more quickly and deliver more frequent updates. + +The agile methodology provides a higher level of quality improvements on an incremental basis instead of waiting to distribute finished projects. And agile project management works. For example, PWC reports [agile projects are 28% more successful][2] than traditional project methodologies. + +### Adopting agile methodology + +When agile methodology was introduced, it met skepticism and resistance. With today's rapid pace of innovation, it has become an accepted standard. The Project Management Institute's annual Pulse of the Profession survey finds that [71% of organizations report using an agile approach][3] in project management, whether it is a fully agile project or hybrid model. + +"We cannot afford anymore to have projects taking two to five years to deliver," says Michelin's Phillippe Husser in the Pulse of the Profession report. "During this time, the initial requirements have changed." + +### The 12 agile principles + +While agile project management is very different from traditional project management, it doesn't have to be daunting to make the switch. Agile project management relies on [12 guiding principles][4] that can help your team move faster together. + +#### 1\. Customer-first + +One of the first principles for groups using agile management is that the "highest priority is to [satisfy the customer through early and continuous delivery][5]." This means that above all else, the team works to solve problems for the customer, not to build features and tools that are cool but hard to use. This strategy encourages all product decisions to be data-driven from a customer's perspective. It may mean that many team members regularly interact with end users (including with interviews) or have access to data that shows usage. + +The agile methodology drastically reduces the time from project initiation to customer feedback. As customers' needs or how they interact with the product change, the team is flexible in responding to these needs to build customer-focused technology. This process creates a feedback loop for continuous improvement. + +#### 2\. The only thing constant is change + +While it may seem radical to change requirements, the agile methodology allows for changing requirements, even late into development. + +This principle is closely tied to the first. If the end goal of the team is to serve the end user best, the team must be flexible and able to make changes based on customers' behaviors and needs. Flexibility also allows an organization to capitalize on an emerging technology or new trends and gain competitive advantage. + +#### 3\. Deliver faster + +Instead of annual or semi-annual product updates and patches, agile encourages regular updates when a need is identified or to improve operations. Waiting to do significant releases can bloat the technology and create unforeseen issues, no matter how much it has been tested. + +Agile encourages the team to deliver working software frequently within a short time frame. Smaller, more frequent releases allow for regular updates to the technology without huge risk. If something goes out and doesn't work, it requires a slight pullback. The agile methodology also encourages automation to help push out updates continuously. + +#### 4\. Build cross-functional teams + +Agile methodology believes that the most well-thought-out, usable, and sellable technologies require cross-functional teams working towards a shared goal. DevOps (development and operations) and DevSecOps (development, security, and operations) teams work in concert instead of in a linear progression. This allows the business team, the developers, QA, and other essential teams to work together from start to finish. + +This change in perspective means all teams have skin in the game and makes it harder to push errors or low-quality tech onto the next team. Rather than making excuses, everyone works together on the same goals. + +For cross-functional teams to work, it takes involvement from the top. A third of projects [fail because of a lack of participation from senior management][6]. + +#### 5\. Encourage independent work + +Another tenet of agile management is that individuals can stretch their job and learn new skills while working on projects. Because the teams are cross-functional, individuals are exposed to different abilities, roles, and styles. This exposure creates better-rounded workers who can attack problems from different perspectives. + +Agile teams are typically self-directed. It takes the right team with a focused goal. + +Agile allows managers to (per the Agile Manifesto) "build projects around motivated individuals. Give them the environment and support they need and trust them to get the job done." + +#### 6\. Meet in person + +While this principle may seem strange in the era of increased remote workers, agile management does encourage in-person meetings. This is because many managers believe the most efficient and effective method of conveying information is a face-to-face conversation. + +For non-remote teams, this can mean having different team members sitting close together or even creating war rooms of different groups to communicate more effectively. Co-location means faster interactions. Instead of waiting for an email or call to be returned, talk to each other. + +This goal can still be accomplished for remote teams. By using tools like Slack or Zoom, you can simulate in-person meetings and find the right answers quickly. + +#### 7\. Go live + +Organizations may have several ways to document the plan and measure success against goals. However, one of the best ways to measure a team's success in agile is via working software. Agile teams don't look at future forecasts to see how they are doing. Instead, live code is the primary measure of progress. + +Planning and documentation are great, but without software that does the job, everything else is irrelevant. + +#### 8\. Sustainable development + +While agile development encourages fast releases, it is still vital that the team makes sustainable and scalable code. Because the first principle is to serve the customer, the team must think about creating technology and tools that can be used for the long haul. + +The team should also be managed in a way that supports individuals. While long hours may be required for a short time, maintaining overall work-life balance is essential to avoid burnout. + +#### 9\. Technical excellence + +Agile methodology also believes that every member of the team is responsible for continuous attention to technical excellence. Even those without technical ability should QA work and ensure it is being built in a simple and accessible way. While bells and whistles may be nice, an agile methodology believes that good design enhances agility. + +Additionally, code should improve with each iteration. Everyone is responsible for providing clear code or instructions throughout the process—not just at the end. + +#### 10\. Simplify + +Agile teams believe that simplicity is essential. There's a saying in agile circles: "maximize the amount of work not done." Eliminate and automate anything you can, and build tools that are straightforward for the end user. + +#### 11\. Let teams self-organize + +"The best architectures, requirements, and designs emerge from self-organizing teams," says the Agile Manifesto. While management is needed for oversight, the best agile teams figure out what needs to be done—and how it gets done—themselves. + +#### 12\. Take time to reflect + +At regular intervals, the best teams reflect on how to become more effective, then adjust accordingly. + +Agile teams are introspective and evaluate their efficiency. When they discover a better way, they evolve. + +### Agile evolves with automation + +Agile management has many benefits for the team and the end user. While the basic principles (like the nature of agile) have been established, the strategy is always evolving. Agile project management is evolving now by leveraging different types of automation. + +For example, IT teams are leveraging [IT process automation to manage repetitive tasks][7] that used to take significant human resources. This allows teams to work more efficiently and focus on the bigger picture rather than monitoring, managing, and maintaining the software, hardware, infrastructure, and cloud services. + +The more tasks that can be handled efficiently by your process automation rules, the quicker you will be able to iterate, test, and improve. + +### Getting started + +Overall, agile project management presents many benefits. It provides a faster way for teams to deliver a better product with fewer bugs. It can encourage diverse teams to work together and learn from each other. It fosters better team communication, both in-person and remotely. And it can ultimately create a better experience for the end user. + +Agile, however, has some drawbacks. If a team is still exploring what technology or solutions to build or doesn't have a firm grasp of the target customer, agile may not be the best methodology. Agile may also have too many requirements for very small teams and may be too flexible for extremely large teams. + +Always complete due diligence to identify which management style is best for your team, and consider combining agile with other methodologies to create the best structure for you. + +The open development method is better for business. Scrum is dead. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/guide-agile-project-management + +作者:[Matt ShealyDaniel OhLeigh Griffin][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/mshealyhttps://opensource.com/users/jkriegerhttps://opensource.com/users/daniel-ohhttps://opensource.com/users/mtakanehttps://opensource.com/users/ahmadnassrihttps://opensource.com/users/agagancarczykhttps://opensource.com/users/lgriffin +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freesoftwareway_law3.png?itok=wyze_0fV (A diagram of a branching process) +[2]: https://www.pwc.com/gx/en/actuarial-insurance-services/assets/agile-project-delivery-confidence.pdf +[3]: https://www.pmi.org/-/media/pmi/documents/public/pdf/learning/thought-leadership/pulse/pulse-of-the-profession-2017.pdf +[4]: http://agilemanifesto.org/principles.html +[5]: https://heleo.com/ericries-5-reasons-continuously-update-product/5110/ +[6]: https://www.business2community.com/strategy/project-management-statistics-45-stats-you-cant-ignore-02168819 +[7]: https://www.atera.com/blog/it-automation/ diff --git a/sources/tech/20190813 Apache Hive vs. Apache HBase- Which is the query performance champion.md b/sources/tech/20190813 Apache Hive vs. Apache HBase- Which is the query performance champion.md new file mode 100644 index 0000000000..585cb2875e --- /dev/null +++ b/sources/tech/20190813 Apache Hive vs. Apache HBase- Which is the query performance champion.md @@ -0,0 +1,245 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Apache Hive vs. Apache HBase: Which is the query performance champion?) +[#]: via: (https://opensource.com/article/19/8/apache-hive-vs-apache-hbase) +[#]: author: (Alex Bekker https://opensource.com/users/egor14https://opensource.com/users/sachinpb) + +Apache Hive vs. Apache HBase: Which is the query performance champion? +====== +Let's look closely at the Apache Hive and Apache HBase to understand +which one can cope better with query performance. +![computer screen ][1] + +It's super easy to get lost in the world of big data technologies. There are so many of them that it seems a day never passes without the advent of a new one. Still, such fast development is only half the trouble. The real problem is that it's difficult to understand the functionality and the intended use of the existing technologies. + +To find out what technology suits their needs, IT managers often contrast them. We've also conducted an academic study to make a clear distinction between Apache Hive and Apache HBase—two important technologies that are frequently used in [Hadoop implementation projects][2]. + +### Data model comparison + +#### Apache Hive's data model + +To understand Apache Hive's data model, you should get familiar with its three main components: a table, a partition, and a bucket. + +Hive's **table** doesn't differ a lot from a relational database table (the main difference is that there are no relations between the tables). Hive's tables can be managed or external. To understand the difference between these two types, let's look at the _load data_ and _drop a table_ operations. When you load data into a **managed table**, you actually move the data from Hadoop Distributed File System's (HDFS) inner data structures into the Hive directory (which is also in HDFS). And when you drop such a table, you delete the data it contains from the directory. In the case of **external tables**, Hive doesn't load the data into the Hive directory but creates a "ghost-table" that indicates where actual data is physically stored in HDFS. So, when you drop an external table, the data is not affected. + +Both managed and external tables can be further broken down to **partitions**. A partition represents the rows of the table grouped together based on a **partition key**. Each partition is stored as a separate folder in the Hive directory. For instance, the table below can be partitioned based on a country, and the rows for each country will be stored together. Of course, this example is simplified. In real life, you'll deal with more than three partitions and much more than four rows in each, and partitioning will help you significantly reduce your partition key query execution time. + +**Customer ID** | **Country** | **State/Province** | **City** | **Gender** | **Family status** | … +---|---|---|---|---|---|--- +00001 | US | Nebraska | Beatrice | F | Single | … +00002 | Canada | Ontario | Toronto | F | Married | … +00003 | Brasil | Para | Belem | M | Married | … +00004 | Canada | Ontario | Toronto | M | Married | … +00005 | US | Nebraska | Aurora | M | Single | … +00006 | US | Arizona | Phoenix | F | Single | … +| | | | | | +00007 | US | Texas | Austin | F | Married | +… | … | | | … | … | … + +You can break your data further into **buckets**, which are even easier to manage and enable faster query execution. Let's take the partition with the US data from our previous example and cluster it into buckets based on the Customer ID column. When you specify the number of buckets, Hive applies a hash function to the chosen column, which assigns a hash value to each row in the partition and then "packs" the rows into a certain number of buckets. So, if we have 10 million Customer IDs in the partition and specify the number of buckets as 50, each bucket will contain about 200,000 rows. As a result, if you need to find the data about a particular customer, Hive will directly go to the relevant bucket to find the info. + +#### Apache HBase's data model + +HBase also stores data in **tables**. The cells in an HBase table are organized by **row keys** and **column families*****.*** Each column family has a set of storage properties (for example, row keys encryption and data compression rules). In addition, there are **column qualifiers** to ease data management. Neither row keys nor column qualifiers have a data type assigned (they are always treated as bytes). + +**Row key** + +**Geography** + +**Demographics** + +**Customer ID** + +**Country** + +**State** + +**City** + +**Gender** + +**Family status** + +… + +00001 + +US + +Texas + +Austin + +F + +Single + +… + +00002 + +Canada + +Ontario + +Toronto + +F + +Married + +… + +00003 + +Brasil + +Para + +Belem + +M + +Married + +… + +00004 + +Canada + +Ontario + +Toronto + +M + +Married + +… + +00005 + +US + +Arizona + +Phoenix + +M + +Single + +… + +00006 + +US + +Nebraska + +Aurora + +F + +Single + +… + +00007 + +US + +Nebraska + +Beatrice + +F + +Married + +  + +  + +… + +  + +  + +… + +… + +… + +Every **cell** has a timestamp, or, in other words, bears the mark of when it was created. This info is crucial during the read operations, as it allows identifying the most recent (and therefore more up-to-date) data versions. You can specify a timestamp during a write operation, otherwise, HBase gives the cell a current timestamp automatically. + +Data in a table is **lexicographically sorted based on row keys**, and to store closely related data together, a developer needs to design a good algorithm for row key composition. + +_As to_ **partitioning**, HBase does it automatically based on the row keys. Still, you can manage the process by changing the start and end row keys for each partition. + +#### Key takeaways on data models + + 1. Both Hive and HBase are capable of organizing data in a way to enable quick access to the required data and reduce query execution time (though their approach to partitioning is different). + 2. Both Hive and HBase act as data management agents. When somebody says that Hive or HBase stores data, it really means the data is stored in a data store (usually in HDFS). This means the success of your Hadoop endeavor goes beyond either/or technology choices and strongly depends on other [important factors][3], such as calculating the required cluster size correctly and integrating all the architectural components seamlessly. + + + +### Query performance + +#### Hive as an analytical query engine + +Hive is specifically designed to enable data analytics. To successfully perform this task, it uses its dedicated **Hive Query Language** (HiveQL), which is very similar to analytics-tuned SQL. + +Initially, Hive converted HiveQL queries into Hadoop MapReduce jobs, simplifying the lives of developers who could bypass more complicated MapReduce code. Running queries in Hive usually took some time, since Hive scanned all the available data sets, if not specified otherwise. It was possible to limit the volume of scanned data by specifying the partitions and buckets that Hive had to address. Anyway, that was batch processing. Nowadays, Apache Hive is also able to convert queries into Apache Tez or Apache Spark jobs. + +The earliest versions of Hive did not provide **record-level updates, inserts, and deletes**, which was one of the most serious limitations in Hive. This functionality appeared only in version 0.14.0 (though with some [constraints][4]: for example, your table's file format should be [ORC][5]). + +#### HBase as a data manager that supports queries + +Being a data manager, HBase alone is not intended for analytical queries. It doesn't have a dedicated query language. To run CRUD (create, read, update, and delete) and search queries, it has a JRuby-based shell, which offers **simple data manipulation possibilities**, such as Get, Put, and Scan. For the first two operations, you should specify the row key, while scans run over a whole range of rows. + +HBase's primary purpose is to offer a random data input/output for HDFS. At the same time, one can surely say that HBase contributes to fast analytics by enabling consistent reads. This is possible due to the fact that HBase writes data to only one server, which doesn't require comparing multiple data versions from different nodes. Besides, HBase **handles append operations very well.** It also enables **updates and deletes**, but copes with these two not so perfectly. + +#### Indexing + +In Hive 3.0.0, indexing was removed. Prior to that, it was possible to create indexes on columns, though the advantages of faster queries should have been weighted against the cost of indexing during write operations and extra space for storing the indexes. Anyway, Hive's data model, with its ability to group data into buckets (which can be created for any column, not only for the keyed one), offers an approach similar to the one that indexing provides. + +HBase enables multi-layered indexing. But again, you have to think about the trade-off between gaining read query response vs. slower writes and the costs associated with storing indexes. + +#### Key takeaways on query performance + + 1. Running analytical queries is exactly the task for Hive. HBase's initial task is to ingest data as well as run CRUD and search queries. + 2. While HBase handles row-level updates, deletes, and inserts well, the Hive community is working to eliminate this stumbling block. + + + +### To sum it up + +There are many similarities between Hive and HBase. Both are data management agents, and both are strongly interconnected with HDFS. The main difference between these two is that HBase is tailored to perform CRUD and search queries while Hive does analytical ones. These two technologies complement each other and are frequently used together in Hadoop consulting projects so businesses can make the most of both applications' strengths. + +Introduction to Apache Hadoop, an open source software framework for storage and large scale... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/apache-hive-vs-apache-hbase + +作者:[Alex Bekker][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/egor14https://opensource.com/users/sachinpb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) +[2]: https://www.scnsoft.com/services/big-data/hadoop +[3]: https://www.scnsoft.com/blog/hadoop-implementation-milestones +[4]: http://community.cloudera.com/t5/Batch-SQL-Apache-Hive/Update-and-Delete-are-not-working-in-Hive/td-p/57358/page/3 +[5]: https://orc.apache.org/ diff --git a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md b/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md new file mode 100644 index 0000000000..1c33c05a68 --- /dev/null +++ b/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a non-breaking breakpoint for Python debugging) +[#]: via: (https://opensource.com/article/19/8/debug-python) +[#]: author: (Liran Haimovitch https://opensource.com/users/liranhaimovitch) + +Building a non-breaking breakpoint for Python debugging +====== +Have you ever wondered how to speed up a debugger? Here are some lessons +learned while building one for Python. +![Real python in the graphic jungle][1] + +This is the story of how our team at [Rookout][2] built non-breaking breakpoints for Python and some of the lessons we learned along the way. I'll be presenting all about the nuts and bolts of debugging in Python at [PyBay 2019][3] in San Francisco this month. Let's dig in. + +### The heart of Python debugging: sys.set_trace + +There are many Python debuggers out there. Some of the more popular include: + + * **pdb**, part of the Python standard library + * **PyDev**, the debugger behind the Eclipse and PyCharm IDEs + * **ipdb**, the IPython debugger + + + +Despite the range of choices, almost every Python debugger is based on just one function: **sys.set_trace**. And let me tell you, **[sys.settrace][4]** might just be the most complex function in the Python standard library. + +![set_trace Python 2 docs page][5] + +In simpler terms, **settrace** registers a trace function for the interpreter, which may be called in any of the following cases: + + * Function call + * Line execution + * Function return + * Exception raised + + + +A simple trace function might look like this: + + +``` +def simple_tracer(frame, event, arg): +  co = frame.f_code +  func_name = co.co_name +  line_no = frame.f_lineno +  print("{e} {f} {l}".format( +e=event, f=func_name, l=line_no)) +  return simple_tracer +``` + +When looking at this function, the first things that come to mind are its arguments and return values. The trace function arguments are: + + * **frame** object, which is the full state of the interpreter at the point of the function's execution + * **event** string, which can be **call**, **line**, **return**, or **exception** + * **arg** object, which is optional and depends on the event type + + + +The trace function returns itself because the interpreter keeps track of two kinds of trace functions: + + * **Global trace function (per thread):** This trace function is set for the current thread by **sys.settrace** and is invoked whenever a new **frame** is created by the interpreter (essentially on every function call). While there's no documented way to set the trace function for a different thread, you can call **threading.settrace** to set the trace function for all newly created **threading** module threads. + * **Local trace function (per frame):** This trace function is set by the interpreter to the value returned by the global trace function upon frame creation. There's no documented way to set the local trace function once the frame has been created. + + + +This mechanism is designed to allow the debugger to have more granular control over which frames are traced to reduce performance impact. + +### Building our debugger in three easy steps (or so we thought) + +With all that background, writing your own debugger using a custom trace function looks like a daunting task. Luckily, **pdb**, the standard Python debugger, is built on top of **Bdb**, a base class for building debuggers. + +A naive breakpoints debugger based on **Bdb** might look like this: + + +``` +import bdb +import inspect + +class Debugger(bdb.Bdb): +  def __init__(self): +      Bdb.__init__(self) +      self.breakpoints = dict() +      self.set_trace() + +def set_breakpoint(self, filename, lineno, method): +  self.set_break(filename, lineno) +  try : +      self.breakpoints[(filename, lineno)].add(method) +  except KeyError: +      self.breakpoints[(filename, lineno)] = [method] + +def user_line(self, frame): +  if not self.break_here(frame): +      return + +  # Get filename and lineno from frame +  (filename, lineno, _, _, _) = inspect.getframeinfo(frame) + +  methods = self.breakpoints[(filename, lineno)] +  for method in methods: +      method(frame) +``` + +All this does is: + + 1. Inherits from **Bdb** and write a simple constructor initializing the base class and tracing. + 2. Adds a **set_breakpoint** method that uses **Bdb** to set the breakpoint and keeps track of our breakpoints. + 3. Overrides the **user_line** method that is called by **Bdb** on certain user lines. The function makes sure it is being called for a breakpoint, gets the source location, and invokes the registered breakpoints + + + +### How well did the simple Bdb debugger work? + +Rookout is about bringing a debugger-like user experience to production-grade performance and use cases. So, how well did our naive breakpoint debugger perform? + +To test it and measure the global performance overhead, we wrote two simple test methods and executed each of them 16 million times under multiple scenarios. Keep in mind that no breakpoint was executed in any of the cases. + + +``` +def empty_method(): +   pass + +def simple_method(): +   a = 1 +   b = 2 +   c = 3 +   d = 4 +   e = 5 +   f = 6 +   g = 7 +   h = 8 +   i = 9 +   j = 10 +``` + +Using the debugger takes a shocking amount of time to complete. The bad results make it clear that our naive **Bdb** debugger is not yet production-ready. + +![First Bdb debugger results][6] + +### Optimizing the debugger + +There are three main ways to reduce debugger overhead: + + 1. **Limit local tracing as much as possible:** Local tracing is very costly compared to global tracing due to the much larger number of events per line of code. + 2. **Optimize "call" events and return control to the interpreter faster:** The main work in **call** events is deciding whether or not to trace. + 3. **Optimize "line" events and return control to the interpreter faster:** The main work in **line** events is deciding whether or not we hit a breakpoint. + + + +So we forked **Bdb**, reduced the feature set, simplified the code, optimized for hot code paths, and got impressive results. However, we were still not satisfied. So, we took another stab at it, migrated and optimized our code to **.pyx**, and compiled it using [Cython][7]. The final results (as you can see below) were still not good enough. So, we ended up diving into CPython's source code and realizing we could not make tracing fast enough for production use. + +![Second Bdb debugger results][8] + +### Rejecting Bdb in favor of bytecode manipulation + +After our initial disappointment from the trial-and-error cycles of standard debugging methods, we decided to look into a less obvious option: bytecode manipulation. + +The Python interpreter works in two main stages: + + 1. **Compiling Python source code into Python bytecode:** This unreadable (for humans) format is optimized for efficient execution and is often cached in those **.pyc** files we have all come to love. + 2. **Iterating through the bytecode in the _interpreter loop_:** This executes one instruction at a time. + + + +This is the pattern we chose: use **bytecode manipulation** to set **non-breaking breakpoints** with no global overhead. This is done by finding the bytecode in memory that represents the source line we are interested in and inserting a function call just before the relevant instruction. This way, the interpreter does not have to do any extra work to support our breakpoints. + +This approach is not magic. Here's a quick example. + +We start with a very simple function: + + +``` +def multiply(a, b): +   result = a * b +   return result +``` + +In documentation hidden in the **[inspect][9]** module (which has several useful utilities), we learn we can get the function's bytecode by accessing **multiply.func_code.co_code**: + + +``` +`'|\x00\x00|\x01\x00\x14}\x02\x00|\x02\x00S'` +``` + +This unreadable string can be improved using the **[dis][10]** module in the Python standard library. By calling **dis.dis(multiply.func_code.co_code)**, we get: + + +``` +  4          0 LOAD_FAST               0 (a) +             3 LOAD_FAST               1 (b) +             6 BINARY_MULTIPLY     +             7 STORE_FAST              2 (result) + +  5         10 LOAD_FAST               2 (result) +            13 RETURN_VALUE       +``` + +This gets us closer to understanding what happens behind the scenes of debugging but not to a straightforward solution. Unfortunately, Python does not offer a method for changing a function's bytecode from within the interpreter. You can overwrite the function object, but that's not good enough for the majority of real-world debugging scenarios. You have to go about it in a roundabout way using a native extension. + +### Conclusion + +When building a new tool, you invariably end up learning a lot about how stuff works. It also makes you think out of the box and keep your mind open to unexpected solutions. + +Working on non-breaking breakpoints for Rookout has taught me a lot about compilers, debuggers, server frameworks, concurrency models, and much much more. If you are interested in learning more about bytecode manipulation, Google's open source **[cloud-debug-python][11]** has tools for editing bytecode. + +* * * + +_Liran Haimovitch will present "[Understanding Python’s Debugging Internals][12]" at [PyBay][3], which will be held August 17-18 in San Francisco. Use code [OpenSource35][13] for a discount when you purchase your ticket to let them know you found out about the event from our community._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/debug-python + +作者:[Liran Haimovitch][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/liranhaimovitch +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_jungle_lead.jpeg?itok=pFKKEvT- (Real python in the graphic jungle) +[2]: https://rookout.com/ +[3]: https://pybay.com/ +[4]: https://docs.python.org/3/library/sys.html#sys.settrace +[5]: https://opensource.com/sites/default/files/uploads/python2docs.png (set_trace Python 2 docs page) +[6]: https://opensource.com/sites/default/files/uploads/debuggerresults1.png (First Bdb debugger results) +[7]: https://cython.org/ +[8]: https://opensource.com/sites/default/files/uploads/debuggerresults2.png (Second Bdb debugger results) +[9]: https://docs.python.org/2/library/inspect.html +[10]: https://docs.python.org/2/library/dis.html +[11]: https://github.com/GoogleCloudPlatform/cloud-debug-python +[12]: https://pybay.com/speaker/liran-haimovitch/ +[13]: https://ti.to/sf-python/pybay2019/discount/OpenSource35 diff --git a/sources/tech/20190813 How to Install - Use VirtualBox Guest Additions on Ubuntu.md b/sources/tech/20190813 How to Install - Use VirtualBox Guest Additions on Ubuntu.md new file mode 100644 index 0000000000..0f6fdce7f8 --- /dev/null +++ b/sources/tech/20190813 How to Install - Use VirtualBox Guest Additions on Ubuntu.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install & Use VirtualBox Guest Additions on Ubuntu) +[#]: via: (https://itsfoss.com/virtualbox-guest-additions-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Install & Use VirtualBox Guest Additions on Ubuntu +====== + +_**Brief: Install VirtualBox Guest Additions in Ubuntu and with this you’ll be able to copy-paste, drag and drop between the host and guest system. It makes using Ubuntu in virtual machine a lot easier.**_ + +The VirtualBox Guest Additions consist of device drivers and system applications that optimize the operating system for better performance and usability. These drivers provide a tighter integration between the guest and host systems. + +No matter how you are using your Virtual Machine, Guest Additions can be very helpful for you. For example, I test many installations and applications inside a VM and take a lot of screenshots. It comes in very handy to be able to move those screenshots freely between the Host OS and the Guest OS. + +Guest? Host? What’s that? + +If you are not aware already, you should know the terminology first. +Host system is your actual operating system installed on your physical system. +Guest system is the virtual machine you have installed inside your host operating system. + +Before you see the steps to install VirtualBox Guest Additions in Ubuntu, let’s first talk about its features. + +### Why should you use VirtualBox Guest Additions? + +![][1] + +With VirtualBox Guest Additions enabled, using the virtual machine becomes a lot more comfortable. Don’t believe me? Here are the important features that the Guest Additions offer: + + * **Mouse pointer integration**: You no longer need to press any key to “free” the cursor from the Guest OS. + * **Shared clipboard**: With the Guest Additions installed, you can copy-paste between the guest and the host operating systems. + * **Drag and drop**: You can also drag and drop files between the host and the guest OS. + * **Shared folders**: My favorite feature; this feature allows you to exchange files between the host and the guest. You can tell VirtualBox to treat a certain host directory as a shared folder, and the program will make it available to the guest operating system as a network share, irrespective of whether guest actually has a network. + * **Better video support**: The custom video drivers that are installed with the Guest Additions provide you with extra high and non-standard video modes, as well as accelerated video performance. It also allows you to resize the virtual machine’s window. The video resolution in the guest will be automatically adjusted, as if you had manually entered an arbitrary resolution in the guest’s Display settings. + * **Seamless windows**: The individual windows that are displayed on the desktop of the virtual machine can be mapped on the host’s desktop, as if the underlying application was actually running on the host. + * **Generic host/guest communication channels**: The Guest Additions enable you to control and monitor guest execution. The “guest properties” provide a generic string-based mechanism to exchange data bits between a guest and a host, some of which have special meanings for controlling and monitoring the guest. Applications can be started in the Guest machine from the Host. + * **Time synchronization**: The Guest Additions will resynchronize the time with that of the Host machine regularly. The parameters of the time synchronization mechanism can be configured. + * **Automated logins**: Basically credentials passing, it can be a useful feature. + + + +[][2] + +Suggested read  How To Extract Audio From Video In Ubuntu Linux + +Impressed by the features it provides? Let’s see how you can install VirtualBox Guest Additions on Ubuntu Linux. + +### Installing VirtualBox Guest Additions on Ubuntu + +The scenario here is that you have [Ubuntu Linux installed inside VirtualBox][3]. The host system could be any operating system. + +I’ll demonstrate the installation process on a minimal install of a Ubuntu virtual machine. First run your virtual machine: + +![VirtualBox Ubuntu Virtual Machine][4] + +To get started, select **Device > Insert Guest Additions CD image…**: + +![Insert Guest Additions CD Image][5] + +This will provide you with the required installer inside the guest system (i.e. the virtual operating system). It will try auto-running, so just click **Run**: + +![AutoRun Guest Additions Installation][6] + +This should open up the installation in a terminal window. Follow the on-screen instructions and you’ll have the Guest Additions installed in a few minutes at most. + +**Troubleshooting tips:** + +If you get an error like this one, it means you are missing some kernel modules (happens in some cases, such as minimal installs): + +![Error while installing Guest Additions in Ubuntu][7] + +You need to install a few more packages here. Just to clarify, you need to run these commands in the virtual Ubuntu system: + +``` +sudo apt install build-essential dkms linux-headers-$(uname -r) +``` + +Now run the Guest Addition setup again: + +``` +sudo rcvboxadd setup +``` + +### Using VirtualBox Guest Addition features + +Here are some screenshots for enabling/using helpful features of VirtualBox Guest Additions in use: + +#### Change the Virtual Screen Resolution + +![Change Virtual Screen Resolution][8] + +#### Configure Drag And Drop (any files) + +You can enable drag and drop from the top menu -> Devices ->Drag and Drop -> Bidirectional. + +With Bidirectional, you can drag and drop from guest to host and from host to guest, both. + +![Drag and Drop][9] + +##### Configure Shared Clipboard (for copy-pasting) + +Similarly, you can enable shared clipboard from the top menu -> Devices -> Shared Clipboard -> Bidirectional. + +![Shared Clipboard][10] + +### Uninstalling VirtualBox Guest Additions + +Navigate to the CD image and open it in terminal (**Right Click** inside directory > **Open in Terminal**): + +![Open in Terminal][11] + +Now enter: + +``` +sh ./VBoxLinuxAdditions.run uninstall +``` + +However, in some cases you might have to do some more cleanup. Use the command: + +``` +/opt/VBoxGuestAdditions-version/uninstall.sh +``` + +**Note:** _Replace **VBoxGuestAdditions-version** with the right version (you can hit **tab** to autocomplete; in my case it is **VBoxGuestAdditions-6.0.4**)._ + +### Wrapping Up + +Hopefully by now you have learned how to install and use the VirtualBox Guest Additions in Ubuntu. Let us know if you use these Additions, and what feature you find to be the most helpful! + +[][12] + +Suggested read  Fix Grub Not Showing For Windows 10 Linux Dual Boot + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/virtualbox-guest-additions-ubuntu/ + +作者:[Sergiu][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/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/virtual-box-guest-additions-ubuntu.png?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/extract-audio-video-ubuntu/ +[3]: https://itsfoss.com/install-linux-in-virtualbox/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/virtualbox_ubuntu_virtual_machine.png?fit=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/install_guest_additions.png?fit=800%2C504&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/autorun_guest_additions_installation.png?fit=800%2C602&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/guest_additions_terminal_output.png?fit=800%2C475&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/change_virtual_screen_resolution.png?fit=744%2C800&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/drag_and_drop.png?fit=800%2C352&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/07/shared_clipboard.png?fit=800%2C331&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/open_in_terminal.png?fit=800%2C537&ssl=1 +[12]: https://itsfoss.com/no-grub-windows-linux/ diff --git a/sources/tech/20190813 To equip tomorrow-s cybersecurity experts, we-ll need an open approach.md b/sources/tech/20190813 To equip tomorrow-s cybersecurity experts, we-ll need an open approach.md new file mode 100644 index 0000000000..8878b7b6c2 --- /dev/null +++ b/sources/tech/20190813 To equip tomorrow-s cybersecurity experts, we-ll need an open approach.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (To equip tomorrow's cybersecurity experts, we'll need an open approach) +[#]: via: (https://opensource.com/open-organization/19/8/open-cybersecurity-education) +[#]: author: (rjoyce https://opensource.com/users/rjoycehttps://opensource.com/users/hypercoyotehttps://opensource.com/users/debbryant) + +To equip tomorrow's cybersecurity experts, we'll need an open approach +====== +An open approach to training the next generation of cybersecurity +experts can fully equip them to combat a constantly shifting threat +landscape. +![Locks and a fingerprint][1] + +Today's world—marked by an increase of Internet-connected devices, digital assets, and information systems infrastructure—demands more cybersecurity professionals. Cybersecurity is the practice of defending these devices, assets, and systems against malicious cyberattacks from both internal and external entities. Often these cyberattacks are linked to cybercrimes, or crimes committed using a computer to generate profit or to affect the integrity, availability, and confidentiality of the data or system. In 2016, cybercrimes [cost the global economy more than $450 billion][2]. + +Developing a robust cybersecurity workforce is therefore essential for mitigating the effects of cybercrime on the global economy. The United States Bureau of Labor Statistics has predicted [a shortage of 1.8 million cybersecurity professionals by the year 2022][3]. The United States has already developed a working group, the National Initiative for Cybersecurity Education (NICE), to promote cybersecurity education. Educators play a critical role helping promote cybersecurity as early as possible in academic organizations. And they should take an open approach to doing it. + +It's critical for students to not only become acquainted with the advantages of open source software but also to develop strong skills working openly, since open source software is not only common in the IT industry in general, but is specifically necessary in the field of cybersecurity. With this approach, students can learn within the safety and guidance of the classroom while also naturally acquiring research and troubleshooting skills by facing challenges that are presented or arise during exercises. + +In this article, we'll explain how experiencing these challenges in the classroom environment is imperative for preparing students for the industry and equipping them to face the unforgiving challenges that await them in the IT industry—especially in the rapidly evolving cybersecurity field. + +### Developing an open approach to cybersecurity education + +Open source software, open source communities, and open source principles have been pivotal in the adoption of computer automation that is so common today. For instance, most smart devices are running a version of the Linux kernel. In the cybersecurity field, it's common to find Linux at the heart of most operating systems that are running on security appliances. But going beyond the operating system, Ansible has taken the management scene by storm, allowing for simplified automation of management tasks that even professionals without programming or scripting experience can quickly grasp and begin to implement. In addition to the benefits of automation, a variety of open source applications provide seemingly limitless capabilities for computer users—such as the ability to create video, music, games, or graphic designs on par with proprietary software. Open source software has often been the creative spark that has enabled countless individuals to pursue goals that would have otherwise been unobtainable. + +Open source has had the same democratizing effect for cybersecurity professionals. Like other open source projects, open source cybersecurity tools receive extensive community support, so they're often some of the most-used security tools in existence today. Such tools include Nmap, OpenVAS, OSSEC, Metasploit Framework, Wireshark, and the Kali Linux distribution, to name a few. These open source tools are an invaluable asset for educators, as they provide an opportunity for students to use the same cybersecurity tools currently being used in industry—but within a safe learning environment, a factor that is critical for student growth in the field. + +Open source software has often been the creative spark that has enabled countless individuals to pursue goals that would have otherwise been unobtainable. + +In Murray State University's Telecommunications Systems Management (TSM) program, we're developing curricula and resources aimed at getting students excited about cybersecurity and motivated to pursue it. But students often enter the program with little or no understanding of open source principles or software, so bringing participants up to speed has been one of our biggest challenges. That's why we've partnered with [Red Hat Academy][4] to supplement our materials and instill fundamental Linux skills and knowledge into our students. This foundation not only prepares students to use the open source security tools that are based on Linux operating systems but also equips them to experiment with a wider variety of Linux-based open source cybersecurity tools, giving them valuable, hands-on experience. And since these tools are freely available, they can continue practicing their skills outside the classroom. + +### Equipping students for a collaborative industry + +As we've said, open source software's ubiquity and ample community support makes it critical to the field of cybersecurity. In the TSM program, our courses incorporate open tools and open practices to simulate the environments students should expect to find if they choose to enter the cybersecurity industry. By creating this type of learning experience in the classroom—a place where instructors can offer immediate guidance and the stakes are low—we're able to help students can gain the critical thinking skills needed for the variety of challenges they'll encounter in the field. + +Chief among these, for example, are the skills associated with seeking, assessing, understanding resources from cybersecurity communities. In our courses, we emphasize the process of researching community forums and reading software documentation. Because no one could ever hope to prepare students for every situation they might encounter in the field, we help students _train themselves_ how to use the tools at their disposal to resolve different situations that may arise. Because open source cybersecurity tools often give rise to engaged and supportive communities, students have the opportunity to develop troubleshooting skills when they encounter challenges by discovering solutions in conversation with people outside the classroom. Developing the ability to quickly and efficiently research problems and solutions is critical for a cybersecurity student, since technology (and the threat landscape) is always evolving. + +### A more authentic operating system experience + +Because no one could ever hope to prepare students for every situation they might encounter in the field, we help students train themselves how to use the tools at their disposal to resolve different situations that may arise. + +Most operating systems courses take a narrow approach focused on proprietary software, which is an injustice to students as it denies them access to the diversity of the operating systems found in the IT industry. For instance, as companies are moving their services to the cloud, they are increasingly running on open source, Linux-based operating systems. Additionally, since open source software enables developers to repackage the software and customize distributions, many are adopting these varying distributions of Linux simply because they are a better fit for a particular application. Still others are moving their servers from proprietary platforms to Linux due to the attraction of the accountability that comes with open source software—especially in light of frustrations that occur when proprietary vendors push updates that cause major issues in their infrastructure. + +In the TSM courses, our students gain a strong understanding of foundational Linux concepts. In particular, the curricula from Red Hat Academy gives students granular experience with many of the foundational commands, and it allows them to gain an understanding of a popular open source system design. Linux has a well-developed community of other users, developers, and tinkerers that provide an excellent forum for students to engage other open source users for help. Having students develop a strong foundational knowledge in Linux is critical as they progress through the TSM program. As students work through their courses, they naturally develop their knowledge and skills, and by obtaining this hand-on experience they also gain a foundation that prepares the student for a variety of careers—becoming traditional security analysts, for example, or pursuing careers in penetration testing using Kali Linux. No matter their path, having a strong Linux background is essential for students. + +### Embracing community-driven development + +One of the major frustrations in the IT field is being forced to use tools that simply do not work or quickly become unusable. Often, software purchased to accomplish some particular task will quickly become obsolete as the vendor offers "upgrades" and "add-ons" to accommodate the changing needs of their customer—at a price. This experience isn't limited to IT experts; end users also experience this frustration. Driving this practice this is, naturally, a desire to maintain long-term profits, as companies must continue to sell software to survive or must lock their users into subscription models. + +The fact that much of the open source software in use today is provided free of charge is enough to draw industry experts to use it. However, open source software is more than just freeware. Because the users of those tools have formed such large communities, they receive proportional support from their communities as well. It's not unusual to see small projects grow into full software suites as users submit feedback to community driven development. This type of feedback often creates products that are superior to their paid counterparts, which do not have such a direct line into the community they seek to serve. This is absolutely true in the case of cybersecurity tools, where the majority of the most popular tools are all open source, community-driven projects. In the TSM program, students are well-versed in tools such as these, thanks to the availability and free distribution model that open source software affords. The result is that through hands-on use, students gain a firm understanding of how to utilize these types of tools. + +### Future proofing + +Open source software provides students, who come from a variety of socio-economic backgrounds, with the opportunity to expand their experience without needing to be employed in a particular field. + +Staying relevant in the IT industry is a constant battle, especially when dealing with the many products and solutions that are always seeking to gain market share. This battle extends as well to the "soldiers on the ground," who may find keeping a diversified toolset difficult when many of the solutions are kept out of their hands due to a price ceiling. + +Open source software provides students, who come from a variety of socio-economic backgrounds, with the opportunity to expand their experience without needing to be employed in a particular field, as the software is readily available to them through open source distribution channels. Similarly, graduates who find jobs in one particular segment of the market still have the opportunity to train their skills in _other_ areas in which they may be interested, thanks to the breadth of open source software commonly used in the IT industry. + +As we train these students how to train themselves, expose them to the variety of tools at their disposal, and educate them on how widely used these tools are, the students are not only equipped to enter the workforce, but are also empowered to stay ahead of the game as well. + +_(This article is part of the_ [Open Organization Guide for Educators][5] _project.)_ + +Working on cybersecurity and looking for support for your project? The Homeland Open Security... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/8/open-cybersecurity-education + +作者:[rjoyce][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/rjoycehttps://opensource.com/users/hypercoyotehttps://opensource.com/users/debbryant +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx (Locks and a fingerprint) +[2]: http://www.hiscox.com/cyber-readiness-report.pdf +[3]: https://iamcybersafe.org/wpcontent/uploads/2017/06/Europe-GISWS-Report.pdf +[4]: https://www.redhat.com/en/services/training/red-hat-academy +[5]: https://github.com/open-organization-ambassadors/open-org-educators-guide diff --git a/sources/tech/20190814 4 misconceptions about ethics and bias in AI.md b/sources/tech/20190814 4 misconceptions about ethics and bias in AI.md new file mode 100644 index 0000000000..d7710fc765 --- /dev/null +++ b/sources/tech/20190814 4 misconceptions about ethics and bias in AI.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 misconceptions about ethics and bias in AI) +[#]: via: (https://opensource.com/article/19/8/4-misconceptions-ethics-and-bias-ai) +[#]: author: (Rachel Thomas https://opensource.com/users/rachel-thomas) + +4 misconceptions about ethics and bias in AI +====== +As artificial intelligence increasingly affects our lives, we must +consider how algorithms affect real people. Join us at PyBay 2019 to +continue the conversation. +![A brain design in a head][1] + +At [PyBay 2019][2] in August, I will continue a conversation I started at PyBay 2018 about the importance of ethics in the artificial intelligence (AI) we're developing, especially as it gains more and more influence in our everyday lives. In last year's keynote, I dug into how we're overlooking the essential role humans play in AI's future. + +Ethical discussions around technology are more and more common, and I come to them from my first love, math. Math usually gives us a sense of certainty, but I have found that the more challenging, human parts of my work offer me the greatest potential to improve the world. If you're curious about the more technical side, here's a list of resources I put together: + +> Deep Learning: +> NLP: +> Comp Linear Algebra: +> Bias, Ethics, & AI: +> Debunk Pipeline Myth: +> AI Needs You:   +> 67 Questions: +> +> — Rachel Thomas (@math_rachel) [July 9, 2019][3] + +Misconceptions about the impact of all types and parts of technology have been common for a long time, but they are hitting home ever harder as AI systems gain increasing popularity and influence over our everyday lives. In this article, I'll walk through some common misconceptions about AI ethics then offer some healthy principles we can use to make AI work with us toward a better future. + +### 1\. Misconception: Engineers are only responsible for the code + +There is an idea that engineers are only responsible for their code, not how the code is used nor the quality of the outcomes it produces. The problem is that in complicated, real-world systems, which involve a mixture of software and various administrative processes, often nobody feels responsible for the outcome.  For example, a software program that had bugs decreased essential healthcare services to people with serious disabilities, including cerebral palsy and diabetes, as reported in [The Verge][4].  In this case, the creator of the algorithm blamed state officials for their process, and state officials could blame the team that implemented the software, and so on, with nobody taking responsibility. + +Systems where nobody feels responsible and there is no accountability do not lead to good outcomes. I don't bring up responsibility in order to point fingers, but because I want to help ensure good outcomes. Our code often interacts with very messy, real-world systems and can accidentally amplify those problems in an undesirable way. + +### 2\. Misconception: Humans and computers are interchangeable + +People often talk about human and computer decision makers as though they are plug-and-play interchangeable, or have the mindset of building machines to replicate exactly what humans do.  However, humans and computers are typically used in different ways in practice. + +One powerful example pertains to AI's value proposition—the idea that companies could scale services with AI that would be unaffordable if humans did all the work. Whether it's faster health insurance signups or recommending items on consumer sites, AI is meant to make life simpler for us and cheaper for service providers. The Trojan horse hiding here is that algorithms may be implemented in such a way that the outcome is a dead end with no appeals process and no way to catch or address mistakes. This can be incredibly harmful if a person is [fired from a job][5] or [denied needed healthcare][4] based on an algorithm without explanation or recourse.  + +People remain at risk even when we add humans back into the equation. Studies show that when given an option to override a harmful AI conclusion, people are likely to assume the code is objective or error-free and are reluctant to override "the system."  In many cases, AI is being used because it is cheap, not because it is more accurate or leads to better outcomes. As [Cathy O'Neil][6] puts it, we are creating a world where "the privileged are processed by people; the poor are processed by algorithms." + +> The privileged are processed by people; the poor are processed by algorithms. - [@mathbabedotorg][7] [pic.twitter.com/ZMEDTEPOvK][8] +> +> — Rachel Thomas (@math_rachel) [December 16, 2016][9] + +Another angle posits that humans and computers are at odds with one another. That's fun in a story like competing in chess or Go, but the better issue is figuring out how machines can augment and complement human goals. Ultimately, algorithms are designed by human beings with human ends in mind. + +### 3\. Misconception: We can't regulate the tech industry + +I regularly hear that the tech industry is too hard to regulate and regulation won't be effective. It reminds me of a [99% Invisible podcast episode][10] about the early days of the automobile. When cars came out, there were no speed limits, licenses, or drunk driving laws, and they were made with a lot of sharp metal and shatterable glass. At the time, the idea of making cars safer was a tough conversation. People would argue that cars are inherently dangerous because the people driving them were dangerous, and that danger had nothing to do with the vehicle. At the time, the idea of making cars safer was a tough conversation, and car companies were strongly resistent to anyone discussing safety. People argued that cars were inherently dangerous because the people driving them were dangerous, and that the danger had nothing to do with the vehicle. Consumer safety advocates worked for decades to change the mindset and laws around car safety, addressing many of these previous issues. + +Consider a case study on what is effective at spurring action: people warned executives of a large social media company for years (beginning as early as 2013) of how their platform was being used to incite ethnic violence in Myanmar, and executives took little action. After the UN determined in 2018 that the site had played a "determining role" in the Myanmar genocide, the company said they would hire "dozens" of additional moderators. Contrast this to when Germany passed a hate speech law with significant finacial penalties, and that same social media site hired 1,200 moderators in under a year to avoid being fined. The different orders of magnitude in response to [a potential fine vs a genocide][11] may provide insight into the potential effectiveness of regulation. + +### 4\. Misconception: Tech is only about optimizing metrics + +It can be easy to think of our job in tech being to optimize metrics and respond to consumer demand.  + +> _"Recommendation systems and collaborative filtering are never neutral; they are always ranking one video, pin, or group against another when they're deciding what to show you."_ +> –Renee Diresta, _[Wired][12]_ + +Metrics are just a proxy for the things we truly care about, and over-emphasizing metrics can lead to unintended consequences. When optimizing for viewing time, a popular video site was found to be pushing the most controversial, conspiracy-centric videos because they were the ones people on the site watched for the longest time. That metrics-only perspective resulted, for example, in people interested in lawnmower reviews being recommended extremist, white supremacist conspiracy theories. + +We can choose to not just optimize for metrics, but also to consider desired outcomes. [Evan Estola][13] discussed what that looked like for his team at [Meetup.com][14], in his 2016 Machine Learning Conference presentation [When Recommendations Systems Go Bad][15]. Meetup's data showed that fewer women than men were going to technology-focused meetups. There was a risk that they could create an algorithm that recommended fewer tech meetups to women, which would cause fewer women to find out about tech meetups, decreasing attendance further, and then recommending even fewer tech meetups to women. That feedback loop would result in even fewer women going to tech events. Meetup decided to short-circuit that feedback loop before it was created. + +Technology impacts the world and exposes us to new ideas. We need to think more about the values we stand for and the broader systems we want to build rather than solely optimizing for metrics. + +### Better principles for AI + +I share these misconceptions so we can move past them and make the world a better place. We can improve our world through the ethical use of AI.Keep the following ideas in mind to create a better future with AI: + + * We have a responsibility to think about the whole system. + * We need to work with domain experts and with those impacted by AI. + * We have to find ways to leverage the strengths of computers and humans and bring them together for the best outcomes. + * We must acknowledge regulation is both possible and has been impactful in the past. + * We can't be afraid of hard and messy problems. + * We can choose to optimize for impact on the world, not just for metrics. + + + +By internalizing these concepts in our work and our daily lives, we can make the future a better place for everyone. + +* * * + +_Rachel Thomas will present [Getting Specific About Algorithmic Bias][16] at [PyBay 2019][17] August 17–18 in San Francisco. Use the [OpenSource35][18] discount code when purchasing tickets._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/4-misconceptions-ethics-and-bias-ai + +作者:[Rachel Thomas][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/rachel-thomas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_patents4abstract_B.png?itok=6RHeRaYh (A brain design in a head) +[2]: http://pybay.com/ +[3]: https://twitter.com/math_rachel/status/1148385754982363136?ref_src=twsrc%5Etfw +[4]: https://www.theverge.com/2018/3/21/17144260/healthcare-medicaid-algorithm-arkansas-cerebral-palsy +[5]: https://www.washingtonpost.com/local/education/creative--motivating-and-fired/2012/02/04/gIQAwzZpvR_story.html +[6]: https://twitter.com/math_rachel/status/809810694065385472 +[7]: https://twitter.com/mathbabedotorg?ref_src=twsrc%5Etfw +[8]: https://t.co/ZMEDTEPOvK +[9]: https://twitter.com/math_rachel/status/809810694065385472?ref_src=twsrc%5Etfw +[10]: https://99percentinvisible.org/episode/nut-behind-wheel/ +[11]: https://www.fast.ai/2018/04/19/facebook/#myanmar +[12]: https://www.wired.com/story/creating-ethical-recommendation-engines/ +[13]: https://mlconf.com/speakers/evan-estola/ +[14]: http://meetup.com/ +[15]: https://mlconf.com/sessions/when-recommendations-systems-go-bad-machine-learn/ +[16]: https://pybay.com/speaker/rachel-thomas/ +[17]: https://pybay.com/ +[18]: https://ti.to/sf-python/pybay2019/discount/OpenSource35 diff --git a/sources/tech/20190814 9 open source cloud native projects to consider.md b/sources/tech/20190814 9 open source cloud native projects to consider.md new file mode 100644 index 0000000000..8f95262799 --- /dev/null +++ b/sources/tech/20190814 9 open source cloud native projects to consider.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (9 open source cloud native projects to consider) +[#]: via: (https://opensource.com/article/19/8/cloud-native-projects) +[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo) + +9 open source cloud native projects to consider +====== +Work with containers? Get familiar with these projects from the Cloud +Native Computing Foundation +![clouds in the sky with blue pattern][1] + +As the practice of developing applications with containers is getting more popular, [cloud-native applications][2] are also on the rise. By [definition][3]: + +> "Cloud-native technologies are used to develop applications built with services packaged in containers, deployed as microservices, and managed on elastic infrastructure through agile DevOps processes and continuous delivery workflows." + +This description includes four elements that are integral to cloud-native applications: + + 1. Container + 2. Microservice + 3. DevOps + 4. Continuous integration and continuous delivery (CI/CD) + + + +Although these technologies have very distinct histories, they complement each other well and have led to surprisingly exponential growth of cloud-native applications and toolsets in a short time. This [Cloud Native Computing Foundation][4] (CNCF) infographic shows the size and breadth of the cloud-native application ecosystem today. + +![Cloud-Native Computing Foundation applications ecosystem][5] + +Cloud-Native Computing Foundation projects + +I mean, just look at that! And this is just a start. Just as NodeJS’s creation sparked the explosion of endless JavaScript tools, the popularity of container technology started the exponential growth of cloud-native applications. + +The good news is that there are several organizations that oversee and connect these dots together. One is the [**Open Containers Initiative (OCI)**][6], which is a lightweight, open governance structure (or project), "formed under the auspices of the Linux Foundation for the express purpose of creating open industry standards around container formats and runtime." The other is the **CNCF**, "an open source software foundation dedicated to making cloud native computing universal and sustainable." + +In addition to building a community around cloud-native applications generally, CNCF also helps projects set up structured governance around their cloud-native applications. CNCF created the concept of maturity levels—Sandbox, Incubating, or Graduated—which correspond to the Innovators, Early Adopters, and Early Majority tiers on the diagram below. + +![CNCF project maturity levels][7] + +CNCF project maturity levels + +The CNCF has detailed [criteria][8] for each maturity level (included below for readers’ convenience). A two-thirds supermajority of the Technical Oversight Committee (TOC) is required for a project to be Incubating or Graduated. + +### Sandbox stage + +> To be accepted in the sandbox, a project must have at least two TOC sponsors. See the CNCF Sandbox Guidelines v1.0 for the detailed process. + +### Incubating stage + +> Note: The incubation level is the point at which we expect to perform full due diligence on projects. +> +> To be accepted to incubating stage, a project must meet the sandbox stage requirements plus: +> +> * Document that it is being used successfully in production by at least three independent end users which, in the TOC’s judgement, are of adequate quality and scope. +> * Have a healthy number of committers. A committer is defined as someone with the commit bit; i.e., someone who can accept contributions to some or all of the project. +> * Demonstrate a substantial ongoing flow of commits and merged contributions. +> * Since these metrics can vary significantly depending on the type, scope, and size of a project, the TOC has final judgement over the level of activity that is adequate to meet these criteria +> + + +### Graduated stage + +> To graduate from sandbox or incubating status, or for a new project to join as a graduated project, a project must meet the incubating stage criteria plus: +> +> * Have committers from at least two organizations. +> * Have achieved and maintained a Core Infrastructure Initiative Best Practices Badge. +> * Have completed an independent and third party security audit with results published of similar scope and quality as the following example (including critical vulnerabilities addressed): and all critical vulnerabilities need to be addressed before graduation. +> * Adopt the CNCF Code of Conduct. +> * Explicitly define a project governance and committer process. This preferably is laid out in a GOVERNANCE.md file and references an OWNERS.md file showing the current and emeritus committers. +> * Have a public list of project adopters for at least the primary repo (e.g., ADOPTERS.md or logos on the project website). +> * Receive a supermajority vote from the TOC to move to graduation stage. Projects can attempt to move directly from sandbox to graduation, if they can demonstrate sufficient maturity. Projects can remain in an incubating state indefinitely, but they are normally expected to graduate within two years. +> + + +## 9 projects to consider + +While it’s impossible to cover all of the CNCF projects in this article, I’ll describe are nine of most interesting Graduated and Incubating open source projects. + +Name | License | What It Is +---|---|--- +[Kubernetes][9] | Apache 2.0 | Orchestration platform for containers +[Prometheus][10] | Apache 2.0 | Systems and service monitoring tool +[Envoy][11] | Apache 2.0 | Edge and service proxy +[rkt][12] | Apache 2.0 | Pod-native container engine +[Jaeger][13] | Apache 2.0 | Distributed tracing system +[Linkerd][14] | Apache 2.0 | Transparent service mesh +[Helm][15] | Apache 2.0 | Kubernetes package manager +[Etcd][16] | Apache 2.0 | Distributed key-value store +[CRI-O][17] | Apache 2.0 | Lightweight runtime for Kubernetes + +I also created this video tutorial to walk through these projects. + +## Graduated projects + +Graduated projects are considered mature—adopted by many organizations—and must adhere to the CNCF’s guidelines. Following are three of the most popular open source CNCF Graduated projects. (Note that some of these descriptions are adapted and reused from the projects' websites.) + +### Kubernetes + +Ah, Kubernetes. How can we talk about cloud-native applications without mentioning Kubernetes? Invented by Google, Kubernetes is undoubtedly the most famous container-orchestration platform for container-based applications, and it is also an open source tool. + +What is a container orchestration platform? Basically, a container engine on its own may be okay for managing a few containers. However, when you are talking about thousands of containers and hundreds of services, managing those containers becomes super complicated. This is where the container engine comes in. The container-orchestration engine helps scale containers by automating the deployment, management, networking, and availability of containers. + +Docker Swarm and Mesosphere Marathon are other container-orchestration engines, but it is safe to say that Kubernetes has won the race (at least for now). Kubernetes also gave birth to Container-as-a-Service (CaaS) platforms like [OKD][18], the Origin community distribution of Kubernetes that powers [Red Hat OpenShift][19]. + +To get started, visit the [Kubernetes GitHub repository][9], and access its documentation and learning resources from the [Kubernetes documentation][20] page. + +### Prometheus + +Prometheus is an open source system monitoring and alerting toolkit built at SoundCloud in 2012. Since then, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project that is maintained independently of the company. + +![Prometheus’ architecture][21] + +Prometheus’ architecture + +The easiest way to think about Prometheus is to visualize a production system that needs to be up 24 hours a day and 365 days a year. No system is perfect, and there are techniques to reduce failures (called fault-tolerant systems). However, if an issue occurs, the most important thing is to identify it as soon as possible. That is where a monitoring tool like Prometheus comes in handy. Prometheus is more than a container-monitoring tool, but it is most popular among cloud-native application companies. In addition, other open source monitoring tools, including [Grafana][22], leverage Prometheus. + +The best way to get started with Prometheus is to check out its [GitHub repo][10]. Running Prometheus locally is easy, but you need to have a container engine installed. You can access detailed documentation on [Prometheus’ website][23]. + +### Envoy + +Envoy (or Envoy Proxy) is an open source edge and service proxy designed for cloud-native applications. Created at Lyft, Envoy is a high-performance, C++, distributed proxy designed for single services and applications, as well as a communications bus and a universal data plane designed for large microservice service mesh architectures. Built on the learnings of solutions such as Nginx, HAProxy, hardware load balancers, and cloud load balancers, Envoy runs alongside every application and abstracts the network by providing common features in a platform-agnostic manner. + +When all service traffic in an infrastructure flows through an Envoy mesh, it becomes easy to visualize problem areas via consistent observability, tune overall performance, and add substrate features in a single place. Basically, Envoy Proxy is a service mesh tool that helps organizations build a fault-tolerant system for production environments. + +There are numerous alternatives for service mesh applications, such as Uber’s [Linkerd][24] (discussed below) and [Istio][25]. Istio extends Envoy Proxy by deploying as a [Sidecar][26] and leveraging the [Mixer][27] configuration model. Notable Envoy features are: + + * All the "table stakes" features (when paired with a control plane, like Istio) are included + * Low, 99th percentile latencies at scale when running under load + * Acts as an L3/L4 filter at its core with many L7 filters provided out of the box + * Support for gRPC and HTTP/2 (upstream/downstream) + * It’s API-driven and supports dynamic configuration and hot reloads + * Has a strong focus on metric collection, tracing, and overall observability + + + +Understanding Envoy, proving its capabilities, and realizing its full benefits require extensive experience with running production-level environments. You can learn more in its [detailed documentation][28] and by accessing its [GitHub][11] repository. + +## Incubating projects + +Following are six of the most popular open source CNCF Incubating projects. + +### rkt + +rkt, pronounced "rocket," is a pod-native container engine. It has a command-line interface (CLI) for running containers on Linux. In a sense, it is similar to other containers, like [Podman][29], Docker, and CRI-O. + +rkt was originally developed by CoreOS (later acquired by Red Hat), and you can find detailed [documentation][30] on its website and access the source code on [GitHub][12]. + +### Jaeger + +Jaeger is an open source, end-to-end distributed tracing system for cloud-native applications. In one way, it is a monitoring solution like Prometheus. Yet it is different because its use cases extend into: + + * Distributed transaction monitoring + * Performance and latency optimization + * Root-cause analysis + * Service dependency analysis + * Distributed context propagation + + + +Jaeger is an open source technology built by Uber. You can find [detailed documentation][31] on its website and its [source code][13] on GitHub. + +### Linkerd + +Like Lyft with Envoy Proxy, Uber developed Linkerd as an open source solution to maintain its service at the production level. In some ways, Linkerd is just like Envoy, as both are service mesh tools designed to give platform-wide observability, reliability, and security without requiring configuration or code changes. + +However, there are some subtle differences between the two. While Envoy and Linkerd function as proxies and can report over services that are connected, Envoy isn’t designed to be a Kubernetes Ingress controller, as Linkerd is. Notable features of Linkerd include: + + * Support for multiple platforms (Docker, Kubernetes, DC/OS, Amazon ECS, or any stand-alone machine) + * Built-in service discovery abstractions to unite multiple systems + * Support for gRPC, HTTP/2, and HTTP/1.x requests plus all TCP traffic + + + +You can read more about it on [Linkerd’s website][32] and access its source code on [GitHub][14]. + +### Helm + +Helm is basically the package manager for Kubernetes. If you’ve used Apache Maven, Maven Nexus, or a similar service, you will understand Helm’s purpose. Helm helps you manage your Kubernetes application. It uses "Helm Charts" to define, install, and upgrade even the most complex Kubernetes applications. Helm isn’t the only method for this; another concept becoming popular is [Kubernetes Operators][33], which are used by Red Hat OpenShift 4. + +You can try Helm by following the [quickstart guide][34] in its documentation or its [GitHub guide][15]. + +### Etcd + +Etcd is a distributed, reliable key-value store for the most critical data in a distributed system. Its key features are: + + * Well-defined, user-facing API (gRPC) + * Automatic TLS with optional client certificate authentication + * Speed (benchmarked at 10,000 writes per second) + * Reliability (distributed using Raft) + + + +Etcd is used as a built-in default data storage for Kubernetes and many other technologies. That said, it is rarely run independently or as a separate service; instead, it utilizes the one integrated into Kubernetes, OKD/OpenShift, or another service. There is also an [etcd Operator][35] to manage its lifecycle and unlock its API management capabilities: + +You can learn more in [etcd’s documentation][36] and access its [source code][16] on GitHub. + +### CRI-O + +CRI-O is an Open Container Initiative (OCI)-compliant implementation of the Kubernetes runtime interface. CRI-O is used for various functions including: + + * Runtime using runc (or any OCI runtime-spec implementation) and OCI runtime tools + * Image management using containers/image + * Storage and management of image layers using containers/storage + * Networking support through the Container Network Interface (CNI) + + + +CRI-O provides plenty of [documentation][37], including guides, tutorials, articles, and even podcasts, and you can also access its [GitHub page][17]. + +* * * + +Did I miss an interesting open source cloud-native project? Please let me know in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/cloud-native-projects + +作者:[Bryant Son][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/brsonhttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://opensource.com/article/18/7/what-are-cloud-native-apps +[3]: https://thenewstack.io/10-key-attributes-of-cloud-native-applications/ +[4]: https://www.cncf.io +[5]: https://opensource.com/sites/default/files/uploads/cncf_1.jpg (Cloud-Native Computing Foundation applications ecosystem) +[6]: https://www.opencontainers.org +[7]: https://opensource.com/sites/default/files/uploads/cncf_2.jpg (CNCF project maturity levels) +[8]: https://github.com/cncf/toc/blob/master/process/graduation_criteria.adoc +[9]: https://github.com/kubernetes/kubernetes +[10]: https://github.com/prometheus/prometheus +[11]: https://github.com/envoyproxy/envoy +[12]: https://github.com/rkt/rkt +[13]: https://github.com/jaegertracing/jaeger +[14]: https://github.com/linkerd/linkerd +[15]: https://github.com/helm/helm +[16]: https://github.com/etcd-io/etcd +[17]: https://github.com/cri-o/cri-o +[18]: https://www.okd.io/ +[19]: https://www.openshift.com +[20]: https://kubernetes.io/docs/home +[21]: https://opensource.com/sites/default/files/uploads/cncf_3.jpg (Prometheus’ architecture) +[22]: https://grafana.com +[23]: https://prometheus.io/docs/introduction/overview +[24]: https://linkerd.io/ +[25]: https://istio.io/ +[26]: https://istio.io/docs/reference/config/networking/v1alpha3/sidecar +[27]: https://istio.io/docs/reference/config/policy-and-telemetry +[28]: https://www.envoyproxy.io/docs/envoy/latest +[29]: https://podman.io +[30]: https://coreos.com/rkt/docs/latest +[31]: https://www.jaegertracing.io/docs/1.13 +[32]: https://linkerd.io/2/overview +[33]: https://coreos.com/operators +[34]: https://helm.sh/docs +[35]: https://github.com/coreos/etcd-operator +[36]: https://etcd.io/docs/v3.3.12 +[37]: https://github.com/cri-o/cri-o/blob/master/awesome.md diff --git a/sources/tech/20190814 How to install Python on Windows.md b/sources/tech/20190814 How to install Python on Windows.md new file mode 100644 index 0000000000..a3b7ea2454 --- /dev/null +++ b/sources/tech/20190814 How to install Python on Windows.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install Python on Windows) +[#]: via: (https://opensource.com/article/19/8/how-install-python-windows) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) + +How to install Python on Windows +====== +Install Python, run an IDE, and start coding right from your Microsoft +Windows desktop. +![Hands programming][1] + +So you want to learn to program? One of the most common languages to start with is [Python][2], popular for its unique blend of [object-oriented][3] structure and simple syntax. Python is also an _interpreted_ _language_, meaning you don't need to learn how to compile code into machine language: Python does that for you, allowing you to test your programs sometimes instantly and, in a way, while you write your code. + +Just because Python is easy to learn doesn't mean you should underestimate its potential power. Python is used by [movie][4] [studios][5], financial institutions, IT houses, video game studios, makers, hobbyists, [artists][6], teachers, and many others. + +On the other hand, Python is also a serious programming language, and learning it takes dedication and practice. Then again, you don't have to commit to anything just yet. You can install and try Python on nearly any computing platform, so if you're on Windows, this article is for you. + +If you want to try Python on a completely open source operating system, you can [install Linux][7] and then [try Python][8]. + +### Get Python + +Python is available from its website, [Python.org][9]. Once there, hover your mouse over the **Downloads** menu, then over the **Windows** option, and then click the button to download the latest release. + +![Downloading Python on Windows][10] + +Alternatively, you can click the **Downloads** menu button and select a specific version from the downloads page. + +### Install Python + +Once the package is downloaded, open it to start the installer. + +It is safe to accept the default install location, and it's vital to add Python to PATH. If you don't add Python to your PATH, then Python applications won't know where to find Python (which they require in order to run). This is _not_ selected by default, so activate it at the bottom of the install window before continuing! + +![Select "Add Python 3 to PATH"][11] + +Before Windows allows you to install an application from a publisher other than Microsoft, you must give your approval. Click the **Yes** button when prompted by the **User Account Control** system. + +![Windows UAC][12] + +Wait patiently for Windows to distribute the files from the Python package into the appropriate locations, and when it's finished, you're done installing Python. + +Time to play. + +### Install an IDE + +To write programs in Python, all you really need is a text editor, but it's convenient to have an integrated development environment (IDE). An IDE integrates a text editor with some friendly and helpful Python features. IDLE 3 and NINJA-IDE are two options to consider. + +#### IDLE 3 + +Python comes with an IDE called IDLE. You can write code in any text editor, but using an IDE provides you with keyword highlighting to help detect typos, a **Run** button to test code quickly and easily, and other code-specific features that a plain text editor like [Notepad++][13] normally doesn't have. + +To start IDLE, click the **Start** (or **Window**) menu and type **python** for matches. You may find a few matches, since Python provides more than one interface, so make sure you launch IDLE. + +![IDLE 3 IDE][14] + +If you don't see Python in the Start menu, launch the Windows command prompt by typing **cmd** in the Start menu, then type: + + +``` +`C:\Windows\py.exe` +``` + +If that doesn't work, try reinstalling Python. Be sure to select **Add Python to PATH** in the install wizard. Refer to the [Python docs][15] for detailed instructions. + +#### Ninja-IDE + +If you already have some coding experience and IDLE seems too simple for you, try [Ninja-IDE][16]. Ninja-IDE is an excellent Python IDE. It has keyword highlighting to help detect typos, quotation and parenthesis completion to avoid syntax errors, line numbers (helpful when debugging), indentation markers, and a **Run** button to test code quickly and easily. + +![Ninja-IDE][17] + +To install it, visit the Ninja-IDE website and [download the Windows installer][18]. The process is the same as with Python: start the installer, allow Windows to install a non-Microsoft application, and wait for the installer to finish. + +Once Ninja-IDE is installed, double-click the Ninja-IDE icon on your desktop or select it from the Start menu. + +### Tell Python what to do + +Keywords tell Python what you want it to do. In either IDLE or Ninja-IDE, go to the File menu and create a new file. + +Ninja users: Do not create a new project, just a new file. + +In your new, empty file, type this into IDLE or Ninja-IDE: + + +``` +`print("Hello world.")` +``` + + * If you are using IDLE, go to the Run menu and select the Run Module option. + * If you are using Ninja, click the Run File button in the left button bar. + + + +![Running code in Ninja-IDE][19] + +Any time you run code, your IDE prompts you to save the file you're working on. Do that before continuing. + +The keyword **print** tells Python to print out whatever text you give it in parentheses and quotes. + +That's not very exciting, though. At its core, Python has access to only basic keywords like **print** and **help**, basic math functions, and so on. + +Use the **import** keyword to load more keywords. Start a new file in IDLE or Ninja and name it **pen.py**. + +**Warning**: Do not call your file **turtle.py**, because **turtle.py** is the name of the file that contains the turtle program you are controlling. Naming your file **turtle.py** confuses Python because it thinks you want to import your own file. + +Type this code into your file and run it: + + +``` +`import turtle` +``` + +[Turtle][20] is a fun module to use. Add this code to your file: + + +``` +turtle.begin_fill() +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.end_fill() +``` + +See what shapes you can draw with the turtle module. + +To clear your turtle drawing area, use the **turtle.clear()** keyword. What do you think the keyword **turtle.color("blue")** does? + +Try more complex code: + + +``` +import turtle as t +import time + +t.color("blue") +t.begin_fill() + +counter = 0 + +while counter < 4: +    t.forward(100) +    t.left(90) +    counter = counter+1 + +t.end_fill() +time.sleep(2) +``` + +As a challenge, try changing your script to get this result: + +![Example Python turtle output][21] + +Once you complete that script, you're ready to move on to more exciting modules. A good place to start is this [introductory dice game][22]. + +### Stay Pythonic + +Python is a fun language with modules for practically anything you can think to do with it. As you can see, it's easy to get started with Python, and as long as you're patient with yourself, you may find yourself understanding and writing Python code with the same fluidity as you write your native language. Work through some [Python articles][23] here on Opensource.com, try scripting some small tasks for yourself, and see where Python takes you. To really integrate Python with your daily workflow, you might even try Linux, which is natively scriptable in ways no other operating system is. You might find yourself, given enough time, using the applications you create! + +Good luck, and stay Pythonic. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-install-python-windows + +作者:[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/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://www.python.org/ +[3]: https://opensource.com/article/19/7/get-modular-python-classes +[4]: https://github.com/edniemeyer/weta_python_db +[5]: https://www.python.org/about/success/ilm/ +[6]: https://opensource.com/article/19/7/rgb-cube-python-scribus +[7]: https://opensource.com/article/19/7/ways-get-started-linux +[8]: https://opensource.com/article/17/10/python-101 +[9]: https://www.python.org/downloads/ +[10]: https://opensource.com/sites/default/files/uploads/win-python-install.jpg (Downloading Python on Windows) +[11]: https://opensource.com/sites/default/files/uploads/win-python-path.jpg (Select "Add Python 3 to PATH") +[12]: https://opensource.com/sites/default/files/uploads/win-python-publisher.jpg (Windows UAC) +[13]: https://notepad-plus-plus.org/ +[14]: https://opensource.com/sites/default/files/uploads/idle3.png (IDLE 3 IDE) +[15]: http://docs.python.org/3/using/windows.html +[16]: http://ninja-ide.org/ +[17]: https://opensource.com/sites/default/files/uploads/win-python-ninja.jpg (Ninja-IDE) +[18]: http://ninja-ide.org/downloads/ +[19]: https://opensource.com/sites/default/files/uploads/ninja_run.png (Running code in Ninja-IDE) +[20]: https://opensource.com/life/15/8/python-turtle-graphics +[21]: https://opensource.com/sites/default/files/uploads/win-python-idle-turtle.jpg (Example Python turtle output) +[22]: https://opensource.com/article/17/10/python-101#python-101-dice-game +[23]: https://opensource.com/sitewide-search?search_api_views_fulltext=Python diff --git a/sources/tech/20190814 Taz Brown- How Do You Fedora.md b/sources/tech/20190814 Taz Brown- How Do You Fedora.md new file mode 100644 index 0000000000..4de9ec93c5 --- /dev/null +++ b/sources/tech/20190814 Taz Brown- How Do You Fedora.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Taz Brown: How Do You Fedora?) +[#]: via: (https://fedoramagazine.org/taz-brown-how-do-you-fedora/) +[#]: author: (Charles Profitt https://fedoramagazine.org/author/cprofitt/) + +Taz Brown: How Do You Fedora? +====== + +![Taz Brown: How Do You Fedora?][1] + +We recently interviewed Taz Brown on how she uses Fedora. This is part of a series on the Fedora Magazine. The series profiles Fedora users and how they use Fedora to get things done. Contact us on the [feedback][2] form to express your interest in becoming a interviewee. + +Taz Brown is a seasoned IT professional with over 15 years of experience. “I have worked as a systems administrator, senior Linux administrator, DevOps engineer and I now work as a senior Ansible automation consultant at Red Hat with the Automation Practice Team.” Originally Taz started using Ubuntu, but she started using CentOS, Red Hat Enterprise Linux and Fedora as a Linux administrator in the IT industry. + +Taz is relatively new to contributing to open source, but she found that code was not the only way to contribute. “I prefer to contribute through documentation as I am not a software developer or engineer. I found that there was more than one way to contribute to open source than just through code.” + +### All about Taz + +Her childhood hero is Wonder Woman. Her favorite movie is Hackers. “My favorite scene is the beginning of the movie,” Taz tells the Magazine. “The movie starts with a group of special agents breaking into a house to catch the infamous hacker, Zero Cool. We soon discover that Zero Cool is actually 11-year-old Dade Murphy, who managed to crash 1,507 computer systems in one day. He is charged for his crimes and his family is fined $45,000. Additionally, he is banned from using computers or touch-tone telephones until he is 18.” + +Her favorite character in the movie is Paul Cook. “Paul Cook, Lord Nikon, played by Laurence Mason was my favorite character. One of the main reasons is that I never really saw a hacker movie that had characters that looked like me so I was fascinated by his portrayal. He was enigmatic. It was refreshing to see and it made me real proud that I was passionate about IT and that I was a geek of sorts.” + +Taz is an amateur photographer and uses a Nikon D3500. “I definitely like vintage things so I am looking to add a new one to my collection soon.” She also enjoys 3D printing, and drawing. “I use open source tools in my hobbies such as Wekan, which is an open-source kanban utility.” + +![][3] + +### The Fedora community + +Taz first started using Linux about 8 years ago. “I started using Ubuntu and then graduated to Fedora and its community and I was hooked. I have been using Fedora now for about 5 years.” + +When she became a Linux Administrator, Linux turned into a passion. “I was trying to find my way in terms of contributing to open source. I didn’t know where to go so I wondered if I could truly be an open source enthusiast and influencer because the community is so vast, but once I found a few people who embraced my interests and could show me the way, I was able to open up and ask questions and learn from the community.” + +Taz first became involved with the Fedora community through her work as a Linux systems engineer while working at Mastercard. “My first impressions of the Fedora community was one of true collaboration, respect and sharing.” + +When Brown talked about the Fedora Project she gave an excellent analogy. “America is an melting pot and that’s how I see open source projects like the Fedora Project. There is plenty of room for diverse contributions to the Fedora Project. There are so many ways in which to get and stay involved and there is also room for new ideas.” + +When we asked Brown about what she would like to see improved in the Fedora community, she commented on making others more aware of the opportunities. “I wish those who are typically underrepresented in tech were more aware of the amazing commitment that the Fedora Project has to diversity and inclusion in open source and in the Fedora community.” + +Next Taz had some advice for people looking to join the Fedora Community. “It’s a great decision and one that you likely will not regret joining. Fedora is a project with a very large supportive community and if you’re new to open source, it’s definitely a great place to start. There is a lot of cool stuff in Fedora. I believe there are limitless opportunities for The Fedora Project.” + +### What hardware? + +Taz uses an Lenovo Thinkserver TS140 with 64 GB of ram, 4 1 TB SSDs and a 1 TB HD for data storage. The server is currently running Fedora 30. She also has a Synology NAS with 164 TB of storage using a RAID 5 configuration. Taz also has a Logitech MX Master and MX Master 2S. “For my keyboard, I use a Kinesis Advantage 2.” She also uses two 38 inch LG ultrawide curved monitors and a single 34 inch LG ultrawide monitor. + +She owns a System76 laptop. “I use the 16.1-inch Oryx Pro by System76 with IPS Display with i7 processor with 6 cores and 12 threads.” It has 6 GB GDDR6 RTX 2060 w/ 1920 CUDA Cores and also 64 GB of DDR4 RAM and a total of 4 TB of SSD storage. “I love the way Fedora handles my peripherals and like my mouse and keyboard. Everything works seamlessly. Plug and play works as it should and performance never suffers.” + +![][4] + +### What software? + +Brown is currently running Fedora 30. She has a variety of software in her everyday work flow. “I use Wekan, which is an open-source kanban, which I use to manage my engagements and projects. My favorite editor is [Atom][5], though I use to use Sublime at one point in time.” + +And as for terminals? “I use Terminator as my go-to terminal because of grid arrangement as well as it’s many keyboard shortcuts and its tab formation.” Taz continues, “I love using neofetch which comes up with a nifty fedora logo and system information every time I log in to the terminal. I also have my terminal pimped out using [powerline][6] and powerlevel9k and vim-powerline as well.” + +![][7] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/taz-brown-how-do-you-fedora/ + +作者:[Charles Profitt][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/cprofitt/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/header-use-this-816x345.png +[2]: https://fedoramag.wpengine.com/submit-an-idea-or-tip/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/Image-1.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/20190517_171809-1-1024x768.jpg +[5]: https://fedoramagazine.org/install-atom-fedora/ +[6]: https://fedoramagazine.org/add-power-terminal-powerline/ +[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/screens-1024x421.jpg diff --git a/sources/tech/20190815 12 extensions for your GNOME desktop.md b/sources/tech/20190815 12 extensions for your GNOME desktop.md new file mode 100644 index 0000000000..307cac4ebe --- /dev/null +++ b/sources/tech/20190815 12 extensions for your GNOME desktop.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (12 extensions for your GNOME desktop) +[#]: via: (https://opensource.com/article/19/8/extensions-gnome-desktop) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdosshttps://opensource.com/users/erezhttps://opensource.com/users/alanfdosshttps://opensource.com/users/patrickhttps://opensource.com/users/liamnairn) + +12 extensions for your GNOME desktop +====== +Add functionality and features to your Linux desktop with these add-ons. +![A person working.][1] + +The GNOME desktop is the default graphical user interface for most of the popular Linux distributions and some of the BSD and Solaris operating systems. Currently at version 3, GNOME provides a sleek user experience, and extensions are available for additional functionality. + +We've covered [GNOME extensions][2] at Opensource.com before, but to celebrate GNOME's 22nd anniversary, I decided to revisit the topic. Some of these extensions may already be installed, depending on your Linux distribution; if not, check your package manager. + +### How to add extensions from the package manager + +To install extensions that aren't in your distro, open the package manager and click **Add-ons**. Then click **Shell Extensions** at the top-right of the Add-ons screen, and you will see a button for **Extension Settings** and a list of available extensions. + +![Package Manager Add-ons Extensions view][3] + +Use the Extension Settings button to enable, disable, or configure the extensions you have installed. + +Now that you know how to add and enable extensions, here are some good ones to try. + +## 1\. GNOME Clocks + +[GNOME Clocks][4] is an application that includes a world clock, alarm, stopwatch, and timer. You can configure clocks for different geographic locations. For example, if you regularly work with colleagues in another time zone, you can set up a clock for their location. You can access the World Clocks section in the top panel's drop-down menu by clicking the system clock. It shows your configured world clocks (not including your local time), so you can quickly check the time in other parts of the world. + +## 2\. GNOME Weather + +[GNOME Weather][5] displays the weather conditions and forecast for your current location. You can access local weather conditions from the top panel's drop-down menu. You can also check the weather in other geographic locations using Weather's Places menu. + +GNOME Clocks and Weather are small applications that have extension-like functionality. Both are installed by default on Fedora 30 (which is what I'm using). If you're using another distribution and don't see them, check the package manager. + +You can see both extensions in action in the image below. + +![Clocks and Weather shown in the drop-down][6] + +## 3\. Applications Menu + +I think the GNOME 3 interface is perfectly enjoyable in its stock form, but you may prefer a traditional application menu. In GNOME 30, the [Applications Menu][7] extension was installed by default but not enabled. To enable it, click the Extensions Settings button in the Add-ons section of the package manager and enable the Applications Menu extension. + +![Extension Settings][8] + +Now you can see the Applications Menu in the top-left corner of the top panel. + +![Applications Menu][9] + +## 4\. More columns in applications view + +The Applications view is set by default to six columns of icons, probably because GNOME needs to accommodate a wide array of displays. If you're using a wide-screen display, you can use the [More columns in applications menu][10] extension to increase the columns. I find that setting it to eight makes better use of my screen by eliminating the empty columns on either side of the icons when I launch the Applications view. + +## Add system info to the top panel + +The next three extensions provide basic system information to the top panel. + + * 5. [Harddisk LED][11] shows a small hard drive icon with input/output (I/O) activity. + * 6. [Load Average][12] indicates Linux load averages taken over three time intervals. + * 7. [Uptime Indicator][13] shows system uptime; when it's clicked, it shows the date and time the system was started. + + + +## 8\. Sound Input and Output Device Chooser + +Your system may have more than one audio device for input and output. For example, my laptop has internal speakers and sometimes I use a wireless Bluetooth speaker. The [Sound Input and Output Device Chooser][14] extension adds a list of your sound devices to the System Menu so you can quickly select which one you want to use. + +## 9\. Drop Down Terminal + +Fellow Opensource.com writer [Scott Nesbitt][15] recommended the next two extensions. The first, [Drop Down Terminal][16], enables a terminal window to drop down from the top panel by pressing a certain key; the default is the key above Tab; on my keyboard, that's the tilde (~) character. Drop Down Terminal has a settings menu for customizing transparency, height, the activation keystroke, and other configurations. + +## 10\. Todo.txt + +[Todo.txt][17] adds a menu to the top panel for maintaining a file for Todo.txt task tracking. You can add or delete a task from the menu or mark it as completed. + +![Drop-down menu for Todo.txt][18] + +## 11\. Removable Drive Menu + +Opensource.com editor [Seth Kenlon][19] suggested [Removable Drive Menu][20]. It provides a drop-down menu for managing removable media, such as USB thumb drives. From the extension's menu, you can access a drive's files and eject it. The menu only appears when removable media is inserted. + +![Removable Drive Menu][21] + +## 12\. GNOME Internet Radio + +I enjoy listening to internet radio streams with the [GNOME Internet Radio][22] extension, which I wrote about in [How to Stream Music with GNOME Internet Radio][23]. + +* * * + +What are your favorite GNOME extensions? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/extensions-gnome-desktop + +作者:[Alan Formy-Duval][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/alanfdosshttps://opensource.com/users/erezhttps://opensource.com/users/alanfdosshttps://opensource.com/users/patrickhttps://opensource.com/users/liamnairn +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) +[2]: https://opensource.com/article/17/2/top-gnome-shell-extensions +[3]: https://opensource.com/sites/default/files/uploads/add-onsextensions_6.png (Package Manager Add-ons Extensions view) +[4]: https://wiki.gnome.org/Apps/Clocks +[5]: https://wiki.gnome.org/Apps/Weather +[6]: https://opensource.com/sites/default/files/uploads/clocksweatherdropdown_6.png (Clocks and Weather shown in the drop-down) +[7]: https://extensions.gnome.org/extension/6/applications-menu/ +[8]: https://opensource.com/sites/default/files/uploads/add-onsextensionsettings_6.png (Extension Settings) +[9]: https://opensource.com/sites/default/files/uploads/applicationsmenuextension_5.png (Applications Menu) +[10]: https://extensions.gnome.org/extension/1305/more-columns-in-applications-view/ +[11]: https://extensions.gnome.org/extension/988/harddisk-led/ +[12]: https://extensions.gnome.org/extension/1381/load-average/ +[13]: https://extensions.gnome.org/extension/508/uptime-indicator/ +[14]: https://extensions.gnome.org/extension/906/sound-output-device-chooser/ +[15]: https://opensource.com/users/scottnesbitt +[16]: https://extensions.gnome.org/extension/442/drop-down-terminal/ +[17]: https://extensions.gnome.org/extension/570/todotxt/ +[18]: https://opensource.com/sites/default/files/uploads/todo.txtmenu_3.png (Drop-down menu for Todo.txt) +[19]: https://opensource.com/users/seth +[20]: https://extensions.gnome.org/extension/7/removable-drive-menu/ +[21]: https://opensource.com/sites/default/files/uploads/removabledrivemenu_3.png (Removable Drive Menu) +[22]: https://extensions.gnome.org/extension/836/internet-radio/ +[23]: https://opensource.com/article/19/6/gnome-internet-radio diff --git a/sources/tech/20190815 Clementine Music Player for All Your Audio Needs.md b/sources/tech/20190815 Clementine Music Player for All Your Audio Needs.md new file mode 100644 index 0000000000..f2f90a1ca6 --- /dev/null +++ b/sources/tech/20190815 Clementine Music Player for All Your Audio Needs.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Clementine Music Player for All Your Audio Needs) +[#]: via: (https://itsfoss.com/clementine-music-player/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Clementine Music Player for All Your Audio Needs +====== + +[VLC][1] is a mainstay for most fans of FOSS technology and most Linux distros. It’s a great little player, don’t get me wrong, but if you have a large library of audio files, some times you need something more powerful. + +The [Clementine Music Player][2] is a full-service audio player with all the tools you need to keep track of your audio library. According to the [project’s website][3], Clementine “inspired by Amarok 1.4, focusing on a fast and easy-to-use interface for searching and playing your music.” + +![Clementine Music Player][4] + +Clementine contains the following features: + + * Search and play your local music library + * Listen to internet radio from Spotify, Grooveshark, SomaFM, Magnatune, Jamendo, SKY.fm, Digitally Imported, JAZZRADIO.com, Soundcloud, Icecast and Subsonic servers + * Search and play songs you’ve uploaded to Box, Dropbox, Google Drive, and OneDrive + * Create smart playlists and dynamic playlists + * Tabbed playlists, import and export M3U, XSPF, PLS and ASX + * CUE sheet support + * Play audio CDs + * Visualizations from projectM. + * Lyrics and artist biographies and photos + * Transcode music into MP3, Ogg Vorbis, Ogg Speex, FLAC or AAC + * Edit tags on MP3 and OGG files, organize your music + * Fetch missing tags from MusicBrainz + * Discover and download Podcasts + * Download missing album cover art from Last.fm and Amazon + * Cross-platform – works on Windows, Mac OS X and Linux + * Native desktop notifications on Linux (libnotify) and Mac OS X (Growl) + * Remote control using an [Android device][5], a Wii Remote, MPRIS or the command-line + * Copy music to your iPod, iPhone, MTP or mass-storage USB player. Queue manager + + + +Clementine is released under the GPL v3. The most recent version of Clementine (1.3.1) was released in April of 2016. + +### Installing Clementine music player in Linux + +Now let’s take a look at how you can install Clementine on your system. Clementine is a popular application and is available in almost all major Linux distributions. + +You can search for it on your distribution’s software center: + +![Clementine in Ubuntu Software Center][6] + +If you are feeling a little geeky, you can always hop on the terminal train and use your distribution’s package manger to install Clementine. + +[][7] + +Suggested read  Clementine Version 1.3 Released After 2 Years + +In Ubuntu, Clementine is available in the [Universe repository][8]. You can [use the apt command][9] in this fashion: + +``` +sudo apt install clementine +``` + +In Fedora, you can use this command: + +``` +sudo dnf clementine +``` + +In Manjaro or other Arch-based distributions, you can use: + +``` +sudo pacman -S clementine +``` + +You can find a list of Linux distros that have Clementine in their repos [here][10]. You can also download packages directly from the [Clementine site][11]. + +If you have a Windows system, you can download a .exe from the [project’s download page][11]. + +### Experience with Clementine music player + +I have installed Clementine on multiple Linux and Windows systems. I have a large collection of Old Time Radio shows, audio drama, and some music. Clementine does a good job of keeping it all organized. + +![Clementine Library][12] + +I also used it to download and listen to podcasts. It worked well for that. However, I did not use that part very much. + +I didn’t use the cloud options because I don’t trust the cloud with my audio stuff. + +![Clementine Cloud Settings][13] + +### Final Thoughts on Clementine + +I like Clementine. I installed it on multiple systems. I only used a small portion of the wide range of tools it offers and they worked great. + +The only thing that concerns me is that the developers haven’t updated the project in three years. The [project’s GitHub page][14] has almost 2,000 open issues and 40 pending pull requests. I can understand that the developers might think that the project is stable and mature, but it looks like some users are having issues that are not being addressed. + +I guess this is the reason why Clementine has been forked into [Strawberry music player][15]. + +If you are looking for an audio management program that is updated regularly, you may check out [Sayonara music player][16]. + +Have you ever used Clementine? What is your favorite music player/manager? Please let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][17]. + +[][18] + +Suggested read  UberWriter: Uber Cool Markdown Editor for Linux + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clementine-music-player/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-latest-vlc/ +[2]: https://www.clementine-player.org/ +[3]: https://www.clementine-player.org/about +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/clementine-music-player.jpg?ssl=1 +[5]: https://play.google.com/store/apps/details?id=de.qspool.clementineremote +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/clementine-ubuntu-software-center.jpg?resize=800%2C391&ssl=1 +[7]: https://itsfoss.com/clementine-version-1-3-released/ +[8]: https://itsfoss.com/ubuntu-repositories/ +[9]: https://itsfoss.com/apt-command-guide/ +[10]: https://repology.org/project/clementine-player/versions +[11]: https://www.clementine-player.org/downloads +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/clementine-library.png?resize=800%2C579&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/clementine-cloud-settings.png?resize=800%2C488&ssl=1 +[14]: https://github.com/clementine-player/Clementine +[15]: https://itsfoss.com/strawberry-music-player/ +[16]: https://itsfoss.com/sayonara-music-player/ +[17]: http://reddit.com/r/linuxusersgroup +[18]: https://itsfoss.com/uberwriter/ diff --git a/sources/tech/20190815 How To Type Indian Rupee Sign (-) In Linux.md b/sources/tech/20190815 How To Type Indian Rupee Sign (-) In Linux.md new file mode 100644 index 0000000000..be51ea65ae --- /dev/null +++ b/sources/tech/20190815 How To Type Indian Rupee Sign (-) In Linux.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Type Indian Rupee Sign (₹) In Linux) +[#]: via: (https://www.ostechnix.com/type-indian-rupee-sign-%e2%82%b9-linux/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +How To Type Indian Rupee Sign (₹) In Linux +====== + +This brief guide explains how to type Indian Rupee sign in Unix-like operating systems. The other day, I wanted to type **“Indian Rupee Sign (₹)”**. My keyboard has rupee symbol on it, but I didn’t know how to type it. After a few google searches, I found a way to do this. If you ever wondered how to type rupee symbol in Linux, follow the steps given below. + +### Type Indian Rupee Sign In Linux + +The default keyboard layout in most GNU/Linux and other operating systems is **English (US)**. To type Indian rupee symbol, you need to change the Keyboard layout to **English (India, with rupee)**. I have given the steps to do this in three Desktop environments – **GNOME** , **MATE** and **KDE Plasma**. However, the steps are same for other DEs and other operating systems as well. Just find where the Keyboard layout settings is and change the layout to English (India, with rupee sign). + +##### In GNOME Desktop Environment: + +I tested this on Ubuntu 18.04 LTS desktop. This may work on other Linux distros with GNOME DE. + +Click the drop down arrow on the top right corner of your Ubuntu desktop and choose **Settings** icon in the bottom left corner. + +![][2] + +Launch System’s settings from top panel + +From the Settings section, click on **Region & Language** option in the left pane. Then click the **+** (plus) sign button on the right side under **Input Sources** tab. + +![][3] + +Region & language section in Settings section + +In the next window, click on the **three vertical dots** button and choose the input language you’d like to add from the list. + +![][4] + +Add input source in Ubuntu + +Scroll down a bit and search for **English (India)**. Click on it and then select **English (India, with rupee)** from list and finally click Add button. + +![][5] + +Choose “English (India, with rupee)” option + +You will see it under Input Sources tab. If you want to make it as default, just choose it and click “UP” arrow button. + +Close the Settings window and Log off and Log in back once. + +Now choose the “English (India, with rupee)” from the language drop down box on the top bar of your Ubuntu desktop. + +![][6] + +Choose “English (India, with rupee)” option + +Alternatively, you can use **SUPER+SPACE** keys from the Keyboard to choose it. + +![][7] + +Choose “English (India, with rupee)” option using super+space keys + +Now, you can be able to type Indian rupee symbol by pressing **“Right ALT+4”**. + +If your keyboard has the **AltGr key** on it, then press **AltGr+4** to type Indian rupee symbol. + +Alternatively, you can use the key combination **“CTRL+SHIFT+u+20b9”** to type rupee symbol (Just hold CTRL+SHIFT keys and type **u20b9** letters and leave the keys). This will work everywhere. + +##### In MATE Desktop Environment: + +If you use MATE DE, go to **System - > Preferences -> Hardware -> Keyboard** from the Menu. Then, click on **Layouts** tab and click **Add** button to add a Indian keyboard layout. + +![][8] + +Add Keyboard layout in Keyboard preferences + +Choose **India** from Country drop-down box and **Indian English (India, with rupee)** from Variants drop-down box. Click Add to add the chosen layout. + +![][9] + +Choose Indian English (India, with rupee) option + +The Indian layout will be added to the Keyboard layout section. Choose it and click “Move up” to make it as default. Then, click “Options” button to choose the Keyboard layout options. + +![][10] + +From the Keyboard layout options windows, click on “Key to choose the 3rd level” and choose a key of your choice to apply for rupee symbol. I have chosen **“Any Alt”** key (So, I can use either left or right ALT keys). + +![][11] + +Close the keyboard preferences window. + +Now, you can be able to type Indian rupee symbol by pressing **“ALT+4”**. Alternatively, you can use the key combination **“CTRL+SHIFT+u+20b9”** to type rupee symbol (Just hold CTRL+SHIFT keys and type **u20b9** letters and leave the keys). This will work everywhere. + +Please note that this will work, only if your keyboard has **₹** symbol on **4**. If your keyboard doesn’t has this symbol or very old, it won’t work. + +##### On KDE Plasma desktop environment: + +If you use KDE Plasma, go to **Application Launcher - > System Settings -> Hardware -> Input Devices -> Keyboard -> Layouts**. + +Check the box “Configure Layouts” and click “Add”. + +![][12] + +Choose “Indian” from Layout drop-down box and “English (India, rupee sign”) from Variant drop-down box. + +![][13] + +The chosen layout will be added to Layouts section. Choose it and click “Move up” to make it as default keyboard layout. + +Then, click **Advanced** and click **“Key to choose the 3rd level”** and choose a key of your choice to apply for rupee symbol. I have chosen **“Any Alt”** key. Finally, click **“Apply”**. + +![][14] + +Now, you can be able to type Indian rupee symbol by pressing **“ALT+4”**. This procedure is same for all other DEs. All you have to do is find where keyboard layout is and change the layout to **English (India, rupee sign)**. + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/type-indian-rupee-sign-%e2%82%b9-linux/ + +作者:[sk][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.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.ostechnix.com/wp-content/uploads/2019/07/Ubuntu-system-settings.png +[3]: https://www.ostechnix.com/wp-content/uploads/2019/08/Region-language-in-Settings-ubuntu.png +[4]: https://www.ostechnix.com/wp-content/uploads/2019/08/Add-input-source-in-Ubuntu.png +[5]: https://www.ostechnix.com/wp-content/uploads/2017/08/English-India-with-rupee-option.png +[6]: https://www.ostechnix.com/wp-content/uploads/2017/08/Choose-English-India-with-rupee-option-from-language-bar.png +[7]: https://www.ostechnix.com/wp-content/uploads/2017/08/Choose-English-India-with-rupee-option-using-superspace-keys.png +[8]: https://www.ostechnix.com/wp-content/uploads/2017/08/Keyboard-Preferences_001.png +[9]: https://www.ostechnix.com/wp-content/uploads/2017/08/Choose-a-Layout_002.png +[10]: https://www.ostechnix.com/wp-content/uploads/2017/08/Keyboard-Preferences_003-1.png +[11]: https://www.ostechnix.com/wp-content/uploads/2017/08/Keyboard-Layout-Options_004.png +[12]: https://www.ostechnix.com/wp-content/uploads/2017/08/Keyboard-%E2%80%94-System-Settings_001.png +[13]: https://www.ostechnix.com/wp-content/uploads/2017/08/Add-Layout-%E2%80%94-System-Settings_002.png +[14]: https://www.ostechnix.com/wp-content/uploads/2017/08/Keyboard-layout-settings.png diff --git a/sources/tech/20190815 How to create a vanity Tor .onion web address.md b/sources/tech/20190815 How to create a vanity Tor .onion web address.md new file mode 100644 index 0000000000..77d13a1811 --- /dev/null +++ b/sources/tech/20190815 How to create a vanity Tor .onion web address.md @@ -0,0 +1,282 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create a vanity Tor .onion web address) +[#]: via: (https://opensource.com/article/19/8/how-create-vanity-tor-onion-address) +[#]: author: (Kc Nwaezuoke https://opensource.com/users/areahintshttps://opensource.com/users/sethhttps://opensource.com/users/bexelbiehttps://opensource.com/users/bcotton) + +How to create a vanity Tor .onion web address +====== +Generate a vanity .onion website to protect your anonymity—and your +visitors' privacy, too. +![Password security with a mask][1] + +[Tor][2] is a powerful, open source network that enables anonymous and non-trackable (or difficult to track) browsing of the internet. It's able to achieve this because of users running Tor nodes, which serve as intentional detours between two otherwise direct paths. For instance, if you are in New Zealand and visit python.nz, instead of being routed next door to the data center running python.nz, your traffic might be routed to Pittsburgh and then Berlin and then Vanuatu and finally to python.nz. The Tor network, being built upon opt-in participant nodes, has an ever-changing structure. Only within this dynamic network space can there exist an exciting, transient top-level domain identifier: the .onion address. + +If you own or are looking to create a website, you can generate a vanity .onion site to protect your and your visitors' anonymity. + +### What are onion addresses? + +Because Tor is dynamic and intentionally re-routes traffic in unpredictable ways, an onion address makes both the information provider (you) and the person accessing the information (your traffic) difficult to trace by one another, by intermediate network hosts, or by an outsider. Generally, an onion address is unattractive, with 16-character names like 8zd335ae47dp89pd.onion. Not memorable, and difficult to identify when spoofed, but a few projects that culminated with Shallot (forked as eschalot) provides "vanity" onion addresses to solve those issues. + +Creating a vanity onion URL on your own is possible but computationally expensive. Getting the exact 16 characters you want could take a single computer billions of years to achieve. + +Here's a rough example (courtesy of [Shallot][3]) of how much time it takes to generate certain lengths of characters on a 1.5GHz processor: + +Characters | Time +---|--- +1 | Less than 1 second +2 | Less than 1 second +3 | Less than 1 second +4 | 2 seconds +5 | 1 minute +6 | 30 minutes +7 | 1 day +8 | 25 days +9 | 2.5 years +10 | 40 years +11 | 640 years +12 | 10 millennia +13 | 160 millennia +14 | 2.6 million years + +I love how this table goes from 25 days to 2.5 years. If you wanted to generate 56 characters, it would take 1078 years. + +An onion address with 16 characters is referred to as a version 2 onion address, and one with 56 characters is a version 3 onion address. If you're using the Tor browser, you can check out this [v2 address][4] or this [v3 address][5]. + +A v3 address has several advantages over v2: + + * Better crypto (v3 replaced SHA1/DH/RSA1024 with SHA3/ed25519/curve25519) + * Improved directory protocol that leaks much less information to directory servers + * Improved directory protocol with a smaller surface for targeted attacks + * Better onion address security against impersonation + + + +However, the downside (supposedly) of v3 is the marketing effort you might need to get netizens to type that marathon-length URL in their browser. + +You can [learn more about v3][6] in the Tor docs. + +### Why you might need an onion address + +A .onion domain has a few key advantages. Its key feature is that it can be accessed only with a Tor browser. Many people don't even know Tor exists, so you shouldn't expect massive traffic on your .onion site. However, the Tor browser provides numerous layers of anonymity not available on more popular browsers. If you want to ensure near-total anonymity for both you and your visitors, onion addresses are built for it. + +With Tor, you do not need to register with ICANN to create your own domain. You don't need to hide your details from Whois searches, and your ICANN account won't be vulnerable to malicious takeovers. You are completely in control of your privacy and your domain. + +An onion address is also an effective way to bypass censorship restrictions imposed by a government or regime. Its privacy helps protect you if your site may be viewed as a threat to the interests of the political class. Sites like Wikileaks are the best examples. + +### What you need to generate a vanity URL + +To configure a vanity onion address, you need to generate a new private key to match a custom hostname. + +Two applications that you can use for generating .onion addresses are [eschalot][7] for v2 addresses and [mkp224o][8] for v3 addresses. + +Eschalot is a Tor hidden service name generator. It allows you to produce a (partially) customized vanity .onion address using a brute-force method. Eschalot is distributed in source form under the BSD license and should compile on any Unix or Linux system. + +mkp224o is a vanity address generator for ed25519 .onion services that's available on GitHub with the CC0 1.0 Universal license. It generates vanity 56-character onion addresses. + +Here's a simple explanation of how these applications work. (This assumes you are comfortable with Git.) + +#### Eschalot + +Eschalot requires [OpenSSL][9] 0.9.7 or later libraries with source headers. Confirm your version with this command: + + +``` +$ openssl version +OpenSSL 1.1.1c FIPS  28 May 2019 +``` + +You also need a [Make][10] utility (either BSD or GNU Make will do) and a C compiler (GCC, PCC, or LLVM/Clang). + +Clone the eschalot repo to your system, and then compile: + + +``` +$ git clone +$ cd eschalot-1.2.0 +$ make +``` + +If you're not using GCC, you must set the **CC** environment variable. For example, to use PCC instead: + + +``` +$ make clean +$ env CC=pcc make +``` + +##### Using eschalot + +To see Echalot's Help pages, type **./eschalot** in the terminal: + + +``` +$ ./eschalot +Version: 1.2.0 + +usage: +eschalot [-c] [-v] [-t count] ([-n] [-l min-max] -f filename) | (-r regex) | (-p prefix) +  -v         : verbose mode - print extra information to STDERR +  -c         : continue searching after the hash is found +  -t count   : number of threads to spawn default is one) +  -l min-max : look for prefixes that are from 'min' to 'max' characters long +  -n         : Allow digits to be part of the prefix (affects wordlist mode only) +  -f filename: name of the text file with a list of prefixes +  -p prefix  : single prefix to look for (1-16 characters long) +  -r regex   : search for a POSIX-style regular expression + +Examples: +  eschalot -cvt4 -l8-12 -f wordlist.txt >> results.txt +  eschalot -v -r '^test|^exam' +  eschalot -ct5 -p test + +  base32 alphabet allows letters [a-z] and digits [2-7] +  Regex pattern examples: +    xxx           must contain 'xxx' +    ^foo          must begin with 'foo' +    bar$          must end with 'bar' +    b[aoeiu]r     must have a vowel between 'b' and 'r' +    '^ab|^cd'     must begin with 'ab' or 'cd' +    [a-z]{16}     must contain letters only, no digits +    ^dusk.*dawn$  must begin with 'dusk' and end with 'dawn' +    [a-z2-7]{16}  any name - will succeed after one iteration +``` + +You can use eschalot to generate an address using the prefix **-p** for _privacy_. Assuming your system has multiple CPU cores, use _multi-threading_ (**-t**) to speed up the URL generation. To _get verbose output_, use the **-v** option. Write the results of your calculation to a file named **newonion.txt**: + + +``` +`./eschalot -v -t4 -p privacy >> newonion.txt` +``` + +The script executes until it finds a suitable match: + + +``` +$ ./eschalot -v -t4 -p privacy >> newonion.txt +Verbose, single result, no digits, 4 threads, prefixes 7-7 characters long. +Thread #1 started. +Thread #2 started. +Thread #3 started. +Thread #4 started. +Running, collecting performance data... +Found a key for privacy (7) - privacyzofgsihx2.onion +``` + +To access the public and private keys eschalot generates, locate **newonion.txt** in the eschalot folder. + +#### mkp224o + +mkp224o requires a C99 compatible compiler, Libsodium, GNU Make, GNU Autoconf, and a Unix-like platform. It has been tested on Linux and OpenBSD. + +To get started, clone the mkp224o repo onto your system, generate the required [Autotools infrastructure][11], configure, and compile: + + +``` +$ git clone +$ cd mkp224o +$ ./autogen.sh +$ ./configure +$ make +``` + +##### Using mkp224o + +Type **./mkp224o -h** to view Help: + + +``` +$ ./mkp224o -h +Usage: ./mkp224o filter [filter...] [options] +       ./mkp224o -f filterfile [options] +Options: +        -h  - print help to stdout and quit +        -f  - specify filter file which contains filters separated by newlines +        -D  - deduplicate filters +        -q  - do not print diagnostic output to stderr +        -x  - do not print onion names +        -v  - print more diagnostic data +        -o filename  - output onion names to specified file (append) +        -O filename  - output onion names to specified file (overwrite) +        -F  - include directory names in onion names output +        -d dirname  - output directory +        -t numthreads  - specify number of threads to utilise (default - CPU core count or 1) +        -j numthreads  - same as -t +        -n numkeys  - specify number of keys (default - 0 - unlimited) +        -N numwords  - specify number of words per key (default - 1) +        -z  - use faster key generation method; this is now default +        -Z  - use slower key generation method +        -B  - use batching key generation method (>10x faster than -z, experimental) +        -s  - print statistics each 10 seconds +        -S t  - print statistics every specified ammount of seconds +        -T  - do not reset statistics counters when printing +        -y  - output generated keys in YAML format instead of dumping them to filesystem +        -Y [filename [host.onion]]  - parse YAML encoded input and extract key(s) to filesystem +``` + +One or more filters are required for mkp224o to work. When executed, mkp224o creates a directory with secret and public keys, plus a hostname for each discovered service. By default, **root** is the current directory, but that can be overridden with the **-d** switch. + +Use the **-t numthreads** option to define how many threads you want to use during processing, and **-v** to see verbose output. Use the **fast** filter, and generate four keys by setting the **-n** option: + + +``` +$ ./mkp224o filter fast -t 4 -v -n 4 -d ~/Extracts +set workdir: /home/areahints/Extracts/ +sorting filters... done. +filters: +        fast +        filter +in total, 2 filters +using 4 threads +fastrcl5totos3vekjbqcmgpnias5qytxnaj7gpxtxhubdcnfrkapqad.onion +fastz7zvpzic6dp6pvwpmrlc43b45usm2itkn4bssrklcjj5ax74kaad.onion +fastqfj44b66mqffbdfsl46tg3c3xcccbg5lfuhr73k7odfmw44uhdqd.onion +fast4xwqdhuphvglwic5dfcxoysz2kvblluinr4ubak5pluunduy7qqd.onion +waiting for threads to finish... done. +``` + +In the directory path set with **-d**, mkp224o creates a folder with the v3 address name it has generated, and within it you see your hostname, secret, and public files. + +Use the **-s** switch to enable printing statistics, which may be useful when benchmarking different ed25519 implementations on your machine. Also, read the **OPTIMISATION.txt** file in mkp224o for performance-related tips. + +### Notes about security + +If you're wondering about the security of v2 generated keys, [Shallot][3] provides an interesting take: + +> It is sometimes claimed that private keys generated by Shallot are less secure than those generated by Tor. This is false. Although Shallot generates a keypair with an unusually large public exponent **e**, it performs all of the sanity checks specified by PKCS #1 v2.1 (directly in **sane_key**), and then performs all of the sanity checks that Tor does when it generates an RSA keypair (by calling the OpenSSL function **RSA_check_key**). + +"[Zooko's Triangle][12]" (which is discussed in [Stiegler's Petname Systems][13]) argues that names cannot be global, secure, and memorable at the same time. This means while .onion names are unique and secure, they have the disadvantage that they cannot be meaningful to humans. + +Imagine that an attacker creates an .onion name that looks similar to the .onion of a different onion service and replaces its hyperlink on the onion wiki. How long would it take for someone to recognize it? + +The onion address system has trade-offs, but vanity addresses may be a reasonable balance among them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-create-vanity-tor-onion-address + +作者:[Kc Nwaezuoke][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/areahintshttps://opensource.com/users/sethhttps://opensource.com/users/bexelbiehttps://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_mask_secret.png?itok=EjqwosxY (Password security with a mask) +[2]: https://www.torproject.org/ +[3]: https://github.com/katmagic/Shallot +[4]: http://6zdgh5a5e6zpchdz.onion/ +[5]: http://vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion/ +[6]: https://www.torproject.org/docs/tor-onion-service.html.en#four +[7]: https://github.com/ReclaimYourPrivacy/eschalot +[8]: https://github.com/cathugger/mkp224o +[9]: https://www.openssl.org/ +[10]: https://en.wikipedia.org/wiki/Make_(software) +[11]: https://opensource.com/article/19/7/introduction-gnu-autotools +[12]: https://en.wikipedia.org/wiki/Zooko%27s_triangle +[13]: http://www.skyhunter.com/marcs/petnames/IntroPetNames.html diff --git a/sources/tech/20190815 Keeping track of Linux users- When do they log in and for how long.md b/sources/tech/20190815 Keeping track of Linux users- When do they log in and for how long.md new file mode 100644 index 0000000000..0c8378902d --- /dev/null +++ b/sources/tech/20190815 Keeping track of Linux users- When do they log in and for how long.md @@ -0,0 +1,195 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keeping track of Linux users: When do they log in and for how long?) +[#]: via: (https://www.networkworld.com/article/3431864/keeping-track-of-linux-users-when-do-they-log-in-and-for-how-long.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Keeping track of Linux users: When do they log in and for how long? +====== +Getting an idea how often your users are logging in and how much time they spend on a Linux server is pretty easy with a couple commands and maybe a script or two. +![Adikos \(CC BY 2.0\)][1] + +The Linux command line provides some excellent tools for determining how frequently users log in and how much time they spend on a system. Pulling information from the **/var/log/wtmp** file that maintains details on user logins can be time-consuming, but with a couple easy commands, you can extract a lot of useful information on user logins. + +One of the commands that helps with this is the **last** command. It provides a list of user logins that can go quite far back. The output looks like this: + +``` +$ last | head -5 | tr -s " " +shs pts/0 192.168.0.14 Wed Aug 14 09:44 still logged in +shs pts/0 192.168.0.14 Wed Aug 14 09:41 - 09:41 (00:00) +shs pts/0 192.168.0.14 Wed Aug 14 09:40 - 09:41 (00:00) +nemo pts/1 192.168.0.18 Wed Aug 14 09:38 still logged in +shs pts/0 192.168.0.14 Tue Aug 13 06:15 - 18:18 (00:24) +``` + +Note that the **tr -s " "** portion of the command above reduces strings of blanks to single blanks, and in this case, it keeps the output shown from being so wide that it would be wrapped around on this web page. Without the **tr** command, that output would look like this: + +``` +$ last | head -5 +shs pts/0 192.168.0.14 Wed Aug 14 09:44 still logged in +shs pts/0 192.168.0.14 Wed Aug 14 09:41 - 09:41 (00:00) +shs pts/0 192.168.0.14 Wed Aug 14 09:40 - 09:41 (00:00) +nemo pts/1 192.168.0.18 Wed Aug 14 09:38 still logged in +shs pts/0 192.168.0.14 Wed Aug 14 09:15 - 09:40 (00:24) +``` + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][2] ]** + +While it’s easy to generate and review login activity records like these for all users with the **last** command or for some particular user with a **last username** command, without the pipe to **head**, these commands will generally result in a _lot_ of data. In this case, a listing for all users would have 908 lines. + +``` +$ last | wc -l +908 +``` + +### Counting logins with last + +If you don't need all of the login detail, you can view user login sessions as a simple count of logins for all users on the system with a command like this: + +``` +$ for user in `ls /home`; do echo -ne "$user\t"; last $user | wc -l; done +dorothy 21 +dory 13 +eel 29 +jadep 124 +jdoe 27 +jimp 42 +nemo 9 +shark 17 +shs 423 +test 2 +waynek 201 +``` + +The list above shows how many times each user has logged since the current **/var/log/wtmp** file was initiated. Notice, however, that the command to generate it does depend on user accounts being set up in the default /home directory. + +Depending on how much data has been accumulated in your current **wtmp** file, you may see a lot of logins or relatively few. To get a little more insight into how relevant the number of logins are, you could turn this command into a script, adding a command that shows when the first login in the current file occurred to provide a little perspective. + +``` +#!/bin/bash + +echo -n "Logins since " +who /var/log/wtmp | head -1 | awk '{print $3}' +echo "=======================" + +for user in `ls /home` +do + echo -ne "$user\t" + last $user | wc -l +done +``` + +When you run the script, the "Logins since" line will let you know how to interpret the stats shown. + +``` +$ ./show_user_logins +Logins since 2018-10-05 +======================= +dorothy 21 +dory 13 +eel 29 +jadep 124 +jdoe 27 +jimp 42 +nemo 9 +shark 17 +shs 423 +test 2 +waynek 201 +``` + +### Looking at accumulated login time with **ac** + +The **ac** command provides a report on user login time — hours spent logged in. As with the **last** command, **ac** reports on user logins since the last rollover of the **wtmp** file since **ac**, like **last**, gets its details from **/var/log/wtmp**. The **ac** command, however, provides a much different view of user activity than the number of logins. For a single user, we might use a command like this one: + +``` +$ ac nemo + total 31.61 +``` + +This tells us that nemo has spent nearly 32 hours logged in. To use the command to generate a listing of the login times for all users, you might use a command like this: + +``` +$ for user in `ls /home`; do ac $user | sed "s/total/$user\t/" ; done + dorothy 9.12 + dory 1.67 + eel 4.32 + … +``` + +In this command, we are replacing the word “total” in each line with the relevant username. And, as long as usernames are fewer than 8 characters, the output will line up nicely. To left justify the output, you can modify that command to this: + +``` +$ for user in `ls /home`; do ac $user | sed "s/^\t//" | sed "s/total/$user\t/" ; done +dorothy 9.12 +dory 1.67 +eel 4.32 +... +``` + +The first used of **sed** in that string of commands strips off the initial tabs. + +To turn this command into a script and display the initial date for the **wtmp** file to add more relevance to the hour counts, you could use a script like this: + +``` +#!/bin/bash + +echo -n "hours online since " +who /var/log/wtmp | head -1 | awk '{print $3}' +echo "=============================" + +for user in `ls /home` +do + ac $user | sed "s/^\t//" | sed "s/total/$user\t/" +done +``` + +If you run the script, you'll see the hours spent by each user over the lifespan of the **wtmp** file: + +``` +$ ./show_user_hours +hours online since 2018-10-05 +============================= +dorothy 70.34 +dory 4.67 +eel 17.05 +jadep 186.04 +jdoe 28.20 +jimp 11.49 +nemo 11.61 +shark 13.04 +shs 3563.60 +test 1.00 +waynek 312.00 +``` + +The difference between the user activity levels in this example is pretty obvious with one user spending only one hour on the system since October and another dominating the system. + +### Wrap-up + +Reviewing how often users log into a system and how many hours they spend online can both give you an overview of how a system is being used and who are likely the heaviest users. Of course, login time does not necessarily correspond to how much work each user is getting done, but it's likely close and commands such as **last** and **ac **can help you identify the most active users. + +### More Linux advice: Sandra Henry-Stocker explains how to use the rev command in this 2-Minute Linux Tip video + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3431864/keeping-track-of-linux-users-when-do-they-log-in-and-for-how-long.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/08/keyboard-adikos-100808324-large.jpg +[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md b/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md new file mode 100644 index 0000000000..267a54e8d7 --- /dev/null +++ b/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cockpit and the evolution of the Web User Interface) +[#]: via: (https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Cockpit and the evolution of the Web User Interface +====== + +![][1] + +Over 3 years ago the Fedora Magazine published an article entitled [Cockpit: an overview][2]. Since then, the interface has see some eye-catching changes. Today’s Cockpit is cleaner and the larger fonts makes better use of screen real-estate. + +This article will go over some of the changes made to the UI. It will also explore some of the general tools available in the web interface to simplify those monotonous sysadmin tasks. + +### Cockpit installation + +Cockpit can be installed using the **dnf install cockpit** command. This provides a minimal setup providing the basic tools required to use the interface. + +Another option is to install the Headless Management group. This will install additional packages used to extend the usability of Cockpit. It includes extensions for NetworkManager, software packages, disk, and SELinux management. + +Run the following commands to enable the web service on boot and open the firewall port: + +``` +$ sudo systemctl enable --now cockpit.socket +Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket -> /usr/lib/systemd/system/cockpit.socket + +$ sudo firewall-cmd --permanent --add-service cockpit +success +$ sudo firewall-cmd --reload +success +``` + +### Logging into the web interface + +To access the web interface, open your favourite browser and enter the server’s domain name or IP in the address bar followed by the service port (9090). Because Cockpit uses HTTPS, the installation will create a self-signed certificate to encrypt passwords and other sensitive data. You can safely accept this certificate, or request a CA certificate from your sysadmin or a trusted source. + +Once the certificate is accepted, the new and improved login screen will appear. Long-time users will notice the username and password fields have been moved to the top. In addition, the white background behind the credential fields immediately grabs the user’s attention. + +![][3] + +A feature added to the login screen since the previous article is logging in with **sudo** privileges — if your account is a member of the wheel group. Check the box beside _Reuse my password for privileged tasks_ to elevate your rights. + +Another edition to the login screen is the option to connect to remote servers also running the Cockpit web service. Click _Other Options_ and enter the host name or IP address of the remote machine to manage it from your local browser. + +### Home view + +Right off the bat we get a basic overview of common system information. This includes the make and model of the machine, the operating system, if the system is up-to-date, and more. + +![][4] + +Clicking the make/model of the system displays hardware information such as the BIOS/Firmware. It also includes details about the components as seen with **lspci**. + +![][5] + +Clicking on any of the options to the right will display the details of that device. For example, the _% of CPU cores_ option reveals details on how much is used by the user and the kernel. In addition, the _Memory & Swap_ graph displays how much of the system’s memory is used, how much is cached, and how much of the swap partition active. The _Disk I/O_ and _Network Traffic_ graphs are linked to the Storage and Networking sections of Cockpit. These topics will be revisited in an upcoming article that explores the system tools in detail. + +#### Secure Shell Keys and authentication + +Because security is a key factor for sysadmins, Cockpit now has the option to view the machine’s MD5 and SHA256 key fingerprints. Clicking the **Show fingerprints** options reveals the server’s ECDSA, ED25519, and RSA fingerprint keys. + +![][6] + +You can also add your own keys by clicking on your username in the top-right corner and selecting **Authentication**. Click on **Add keys** to validate the machine on other systems. You can also revoke your privileges in the Cockpit web service by clicking on the **X** button to the right. + +![][7] + +#### Changing the host name and joining a domain + +Changing the host name is a one-click solution from the home page. Click the host name currently displayed, and enter the new name in the _Change Host Name_ box. One of the latest features is the option to provide a _Pretty name_. + +Another feature added to Cockpit is the ability to connect to a directory server. Click _Join a domain_ and a pop-up will appear requesting the domain address or name, organization unit (optional), and the domain admin’s credentials. The Domain Membership group provides all the packages required to join an LDAP server including FreeIPA, and the popular Active Directory. + +To opt-out, click on the domain name followed by _Leave Domain_. A warning will appear explaining the changes that will occur once the system is no longer on the domain. To confirm click the red _Leave Domain_ button. + +![][8] + +#### Configuring NTP and system date and time + +Using the command-line and editing config files definitely takes the cake when it comes to maximum tweaking. However, there are times when something more straightforward would suffice. With Cockpit, you have the option to set the system’s date and time manually or automatically using NTP. Once synchronized, the information icon on the right turns from red to blue. The icon will disappear if you manually set the date and time. + +To change the timezone, type the continent and a list of cities will populate beneath. + +![][9] + +#### Shutting down and restarting + +You can easily shutdown and restart the server right from home screen in Cockpit. You can also delay the shutdown/reboot and send a message to warn users. + +![][10] + +#### Configuring the performance profile + +If the _tuned_ and _tuned-utils_ packages are installed, performance profiles can be changed from the main screen. By default it is set to a recommended profile. However, if the purpose of the server requires more performance, we can change the profile from Cockpit to suit those needs. + +![][11] + +### Terminal web console + +A Linux sysadmin’s toolbox would be useless without access to a terminal. This allows admins to fine-tune the server beyond what’s available in Cockpit. With the addition of themes, admins can quickly adjust the text and background colours to suit their preference. + +Also, if you type **exit** by mistake, click the _Reset_ button in the top-right corner*.* This will provide a fresh screen with a flashing cursor. + +![][12] + +### Adding a remote server and the Dashboard overlay + +The Headless Management group includes the Dashboard module (**cockpit-dashboard**). This provides an overview the of the CPU, memory, network, and disk performance in a real-time graph. Remote servers can also be added and managed through the same interface. + +For example, to add a remote computer in Dashboard, click the **+** button. Enter the name or IP address of the server and select the colour of your choice. This helps to differentiate the stats of the servers in the graph. To switch between servers, click on the host name (as seen in the screen-cast below). To remove a server from the list, click the check-mark icon, then click the red trash icon. The example below demonstrates how Cockpit manages a remote machine named _server02.local.lan_. + +![][13] + +### Documentation and finding help + +As always, the _man_ pages are a great place to find documentation. A simple search in the command-line results with pages pertaining to different aspects of using and configuring the web service. + +``` +$ man -k cockpit +cockpit (1) - Cockpit +cockpit-bridge (1) - Cockpit Host Bridge +cockpit-desktop (1) - Cockpit Desktop integration +cockpit-ws (8) - Cockpit web service +cockpit.conf (5) - Cockpit configuration file +``` + +The Fedora repository also has a package called **cockpit-doc**. The package’s description explains it best: + +> The Cockpit Deployment and Developer Guide shows sysadmins how to deploy Cockpit on their machines as well as helps developers who want to embed or extend Cockpit. + +For more documentation visit + +### Conclusion + +This article only touches upon some of the main functions available in Cockpit. Managing storage devices, networking, user account, and software control will be covered in an upcoming article. In addition, optional extensions such as the 389 directory service, and the _cockpit-ostree_ module used to handle packages in Fedora Silverblue. + +The options continue to grow as more users adopt Cockpit. The interface is ideal for admins who want a light-weight interface to control their server(s). + +What do you think about Cockpit? Share your experience and ideas in the comments below. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-816x345.jpg +[2]: https://fedoramagazine.org/cockpit-overview/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-login-screen.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-home-screen.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-system-info.gif +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-ssh-key-fingerprints.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-authentication.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-hostname-domain.gif +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-date-time.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-power-options.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-tuned.gif +[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-terminal.gif +[13]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-add-remote-servers.gif diff --git a/sources/tech/20190816 Designing open audio hardware as DIY kits.md b/sources/tech/20190816 Designing open audio hardware as DIY kits.md new file mode 100644 index 0000000000..2cec3a5675 --- /dev/null +++ b/sources/tech/20190816 Designing open audio hardware as DIY kits.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Designing open audio hardware as DIY kits) +[#]: via: (https://opensource.com/article/19/8/open-audio-kit-developer) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansenhttps://opensource.com/users/alanfdosshttps://opensource.com/users/clhermansen) + +Designing open audio hardware as DIY kits +====== +Did you know you can build your own speaker systems? Muffsy creator +shares how he got into making open audio hardware and why he started +selling his designs to other DIYers. +![Colorful sound wave graph][1] + +Previously in this series about people who are developing audio technology in the open, I interviewed [Juan Rios, developer and maintainer of Guayadeque][2] and [Sander Jansen, developer and maintainer of Goggles Music Manager][3]. These conversations have broadened my thinking and helped me enjoy their software even more than before. + +For this article, I contacted Håvard Skrödahl, founder of [Muffsy][4]. His hobby is designing open source audio hardware, and he offers his designs as kits for those of us who can't wait to wind up the soldering iron for another adventure. + +I've built two of Håvard's kits: a [moving coil (MC) cartridge preamp][5] and a [moving magnet (MM) cartridge phono preamp][6]. Both were a lot of fun to build and sound great. They were also a bit of a stroll down memory lane for me. In my 20s, I built some other audio kits, including a [Hafler DH-200 power amplifier][7] and a [DH-110 preamplifier][8]. Before that, I built a power amplifier using a Motorola circuit design; both the design and the amplifier were lost along the way, but they were a lot of fun! + +### Meet Håvard Skrödahl, open audio hardware maker + +**Q: How did you get started designing music playback hardware?** + +**A:** I was a teenager in the mid-'80, and listening to records and cassettes were the only options we had. Vinyl was, of course, the best quality, while cassettes were more portable. About five years ago, I was getting back into vinyl and found myself lacking the equipment I needed. So, I decided to make my own phono stage (also called a phono preamp). The first iteration was bulky and had a relatively bad [RIAA filter][9], but I improved it during the first few months. + +The first version was completely homemade. I was messing about with toner transfer and chemicals and constantly breaking drill bits to create this board.  + +![Phono stage board top][10] + +Top of the phono stage board + +![Bottom of the phono stage board][11] + +Bottom of the phono stage board + +I was over the moon with this phono stage. It worked perfectly, even though the RIAA curve was out by quite a bit. It also had variable input impedance (greatly inspired by the [Audiokarma CNC phono stage][12]). + +When I moved on to getting boards professionally made, I found that the impedance settings could be improved quite a bit. My setup needed adjustable gain, so I added it. The RIAA filter was completely redesigned, and it is (to my knowledge) the only accurate RIAA filter circuit that uses [standard E24 component values][13]. + +![Muffsy audio hardware boards][14] + +Various iterations of boards in development. + +**Q: How did you decide to offer your work as kits? And how did you go from kits to open source?** + +**A:** The component values being E24 came from a lack of decent, component providers in my area (or so I thought, as it turned out I have a great provider nearby), so I had to go for standard values. This meant my circuit was well suited for DIY, and I started selling blank printed circuit boards on [Tindie][15]. + +What really made the phono stage suitable as a kit was a power supply that didn't require messing about with [mains electricity][16]. It's basically an AC adapter, a voltage doubler, and a couple of three-pin voltage regulators. + +So there I was; I had a phono stage, a power supply, and the right (and relatively easy to source) components. The boards fit straight into the enclosure I'd selected, and I made a suitable back panel. I could now sell a DIY kit that turns into a working device once it is assembled. This is pretty unique; you won't see many kit suppliers provide everything that's needed to make a functional product. + +![Phono stage kit with the power supply and back panel][17] + +The assembled current phono stage kit with the power supply and back panel. + +As a bonus, since this is just my hobby, I'm not even aiming for profit. This is also partly why my designs are open source. Not revealing who is using the designs, but you'll find them in more than one professional vinyl mastering studio, in governmental digitization projects, and even at a vinyl player manufacturer that you will have heard of. + +**Q: Tell us a bit about your educational background. Are you an electrical engineer? Where did your interest in circuits come from?** + +**A:** I went to a military school of electrical engineering (EE). My career has been pretty void of EE though, apart from a few years as a telephony switch technician. The music interest has stayed with me, though, and I've been dreaming of making something all my life. I would rather avoid mains electricity though, so signal level and below is where I'm happy. + +**Q: In your day job, do you do hardware stuff as well? Or software? What about open source—does it matter to your day job?** + +**A:** My profession is IT management, system architecture, and security. So I'm not doing any hardware designs at work. I wouldn't be where I am today without open source, so that is the other part of the reason why my designs are openly available. + +**Q: Can you tell us a bit about what it takes to go from a design, to a circuit board, to producing a kit?** + +**A:** I am motivated by my own needs when it comes to starting a new project. Or if I get inspired, like I was when I made a constant current [LED][18] tester. The LED tester required a very specific sub-milliampere meter, and it was kind of hard to find an enclosure for it. So the LED tester wasn't suited for a kit. + +![LED tester][19] + +LED tester + +I made a [notch filter][20] that requires matched precision capacitors, and the potentiometers are quite hard to fine-tune. Besides, I don't see people lining up to buy this product, so it's not suited to be a kit. + +![Notch filter][21] + +Notch filter + +I made an inverse RIAA filter using only surface-mount device [(SMD) components][22]—not something I would offer as a kit. I built an SMD vacuum pickup tool for this project, so it wasn't all for nothing. + +![SMD vacuum pickup tool][23] + +SMD vacuum pickup tool + +I've made various PSU/transformer breakout boards, which are not suitable as kits because they require mains electricity. + +![PSU/transformer breakout board][24] + +PSU/transformer breakout boards + +I designed and built the [MC Head Amp][25] without even owning an [MC cartridge][26]. I even built the [O2 headphone amp][27] without owning a pair of headphones, although people much smarter than me suspect it was a clever excuse for buying a pair of Sennheisers. + +Kits need to be something I think people need, they must be easy to assemble (or rather difficult to assemble incorrectly), not too expensive nor require exotic components, and can't weigh too much because of the very expensive postage from Sweden. + +Most importantly, I need to have time and space for another kit. This picture shows pretty much all the space I have available for my kits, two boxes deep, IKEA all the way. + +![A shelf filled with boxed of Muffsy kits][28] + +**Q: Are you a musician or audiophile? What kind of equipment do you have?** + +**A:** I'm not a musician, and I am not an audiophile in the way most people would define such a person. I do know, from education and experience, that good sound doesn't have to cost a whole lot. It can be quite cheap, actually. A lot of the cost is in transformers, enclosures, and licenses (the stickers on the front of your gear). Stay away from those, and you're back at signal level audio that can be really affordable. + +Don't get me wrong; there are a lot of gifted designers who spend an awful lot of time and creativity making the next great piece of equipment. They deserve to get paid for their work. What I mean is that the components that go into this equipment can be bought for not much money at all. + +My equipment is a simple [op-amp][29]-based preamp with a rotational input-switch and a sub-$25 class-D amp based on the TPA3116 chip (which I will be upgrading to an IcePower 125ASX2). I'm using both the Muffsy Phono Preamp and the Muffsy MC Head Amp. Then I've got some really nice Dynaco A25 loudspeakers that I managed to refurbish through nothing more than good old dumb luck. I went for the cheapest Pro-Ject turntable that's still a "real" turntable. That's it. No surround, no remote control (yet), unless you count the Chromecast Audio that's connected to the back of my amp. + +![Håvard Skrödahl's A/V setup][30] + +Håvard's A/V setup + +I'll happily shell out for quality components, good connectors, and shielded signal cables. But, to be diplomatic, I'd rather use the correct component for the job instead of the most expensive one. I do get questions about specific resistors and expensive "boutique" components now and then. I keep my answer short and remind people that my own builds are identical to what I sell on Tindie. + +My preamp uses my MC Head Amp as a building block. + +![Preamp internals][31] + +Preamp internals + +**Q: What kind of software do you use for hardware design?** + +**A:** I've been using [Eagle][32] for many years. Getting into a different workflow takes a lot of time and requires a whole lot of mistakes, so no [KiCad][33] yet. + +**Q: Can you tell us a bit about where your kits are going? Is there a new head amplifier? A new phono amplifier? What about a line-level pre-amp or power amp?** + +**A:** If I were to do a power amp, I wouldn't dream of selling it because of what I said about mains electricity. Chip amps and [Class-D][34] seem to have taken over the DIY segment anyway, and I'm really happy with Class-D. + +My latest kit is an input selector. It's something that's a cross between hardware and software as it uses an [ESP32][35] system on a chip microcontroller. And it's something that I want for myself. + +The kit includes everything you need. It's got a rotational encoder, an infrared receiver, and I'm even adding a remote control to the kit. The software and hardware are available on GitHub, also under a permissive open source license, and will soon include Alexa voice support and [MQTT][36] for app or command line remote control. + +![Input selector][37] + +Input selector kit + +My lineup now consists of preamps for MC and MM cartridges, a power supply and a back panel for them, and the input selector. I'm even selling bare circuit boards for a tube preamp and accompanying power supply. + +These components make up pretty much all the internals of a complete preamplifier, which has become one of my main motivational factors. + +I have nothing new or significantly better to provide in terms of an ordinary preamplifier, so I'm using a modified version of a well-known circuit. I cannot, and would not, sell this circuit, as it's proprietary. + +Anyhow, here's my personal goal. It's still a work in progress, using an S3207 enclosure and a front panel made at Frontpanel Express. + +![Muffsy preamp][38] + +New Muffsy preamp prototype + +* * * + +Thanks, Håvard, that looks pretty great! I'd be happy to have something like that sitting on my Hi-Fi shelf. + +I hope there are people out there just waiting to try their hand at audio kit building or even board layout from proven open source schematics, and they find Håvard's story motivating. As for me, I think my next project could be an [active crossover][39]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/open-audio-kit-developer + +作者:[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/clhermansenhttps://opensource.com/users/alanfdosshttps://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://opensource.com/article/19/6/creator-guayadeque-music-player +[3]: https://opensource.com/article/19/6/gogglesmm-developer-sander-jansen +[4]: https://www.muffsy.com/ +[5]: https://opensource.com/article/18/5/building-muffsy-phono-head-amplifier-kit +[6]: https://opensource.com/article/18/7/diy-amplifier-vinyl-records +[7]: https://kenrockwell.com/audio/hafler/dh-200.htm +[8]: https://www.hifiengine.com/manual_library/hafler/dh-110.shtml +[9]: https://en.wikipedia.org/wiki/RIAA_equalization +[10]: https://opensource.com/sites/default/files/uploads/phono-stagetop.png (Phono stage board top) +[11]: https://opensource.com/sites/default/files/uploads/phono-stagebottom.png (Bottom of the phono stage board) +[12]: https://forum.psaudio.com/t/the-cnc-phono-stage-diy/3613 +[13]: https://en.wikipedia.org/wiki/E_series_of_preferred_numbers +[14]: https://opensource.com/sites/default/files/uploads/boards.png (Muffsy audio hardware boards) +[15]: https://www.tindie.com/stores/skrodahl/ +[16]: https://en.wikipedia.org/wiki/Mains_electricity +[17]: https://opensource.com/sites/default/files/uploads/phonostage-kit.png (Phono stage kit with the power supply and back panel) +[18]: https://en.wikipedia.org/wiki/Light-emitting_diode +[19]: https://opensource.com/sites/default/files/uploads/led-tester.png (LED tester) +[20]: https://en.wikipedia.org/wiki/Band-stop_filter +[21]: https://opensource.com/sites/default/files/uploads/notch-filter.png (Notch filter) +[22]: https://en.wikipedia.org/wiki/Surface-mount_technology +[23]: https://opensource.com/sites/default/files/uploads/smd-vacuum-pick-tool.png (SMD vacuum pickup tool) +[24]: https://opensource.com/sites/default/files/uploads/psu-transformer-breakout-board.png (PSU/transformer breakout board) +[25]: https://leachlegacy.ece.gatech.edu/headamp/ +[26]: https://blog.audio-technica.com/audio-solutions-question-week-differences-moving-magnet-moving-coil-phono-cartridges/ +[27]: http://nwavguy.blogspot.com/2011/07/o2-headphone-amp.html +[28]: https://opensource.com/sites/default/files/uploads/kit-shelves.png (Muffsy kits on shelves) +[29]: https://en.wikipedia.org/wiki/Operational_amplifier +[30]: https://opensource.com/sites/default/files/uploads/av-setup.png (Håvard Skrödahl's A/V setup) +[31]: https://opensource.com/sites/default/files/uploads/preamp-internals.png (Preamp internals) +[32]: https://en.wikipedia.org/wiki/EAGLE_(program) +[33]: https://en.wikipedia.org/wiki/KiCad +[34]: https://en.wikipedia.org/wiki/Class-D_amplifier +[35]: https://en.wikipedia.org/wiki/ESP32 +[36]: http://mqtt.org/ +[37]: https://opensource.com/sites/default/files/uploads/input-selector.png (Input selector) +[38]: https://opensource.com/sites/default/files/uploads/muffsy-preamp.png (Muffsy preamp) +[39]: https://www.youtube.com/watch?v=7u9OKPL1ezA&feature=youtu.be diff --git a/sources/tech/20190816 How to encrypt files with gocryptfs on Linux.md b/sources/tech/20190816 How to encrypt files with gocryptfs on Linux.md new file mode 100644 index 0000000000..6c2cc6a2fd --- /dev/null +++ b/sources/tech/20190816 How to encrypt files with gocryptfs on Linux.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to encrypt files with gocryptfs on Linux) +[#]: via: (https://opensource.com/article/19/8/how-encrypt-files-gocryptfs) +[#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbiehttps://opensource.com/users/sethhttps://opensource.com/users/marcobravo) + +How to encrypt files with gocryptfs on Linux +====== +Gocryptfs encrypts at the file level, so synchronization operations can +work efficiently on each file. +![Filing papers and documents][1] + +[Gocryptfs][2] is a Filesystem in Userspace (FUSE)-mounted file-level encryption program. FUSE-mounted means that the encrypted files are stored in a single directory tree that is mounted, like a USB key, using the [FUSE][3] interface. This allows any user to do the mount—you don't need to be root. Because gocryptfs encrypts at the file level, synchronization operations that copy your files can work efficiently on each file. This contrasts with disk-level encryption, where the whole disk is encrypted as a single, large binary blob. + +When you use gocryptfs in its normal mode, your files are stored on your disk in an encrypted format. However, when you mount the encrypted files, you get unencrypted access to your files, just like any other file on your computer. This means all your regular tools and programs can use your unencrypted files. Changes, new files, and deletions are reflected in real-time in the encrypted version of the files stored on your disk. + +### Install gocryptfs + +Installing gocryptfs is easy on [Fedora][4] because it is packaged for Fedora 30 and Rawhide. Therefore, **sudo dnf install gocryptfs** does all the required installation work. If you're not using Fedora, you can find details on installing from source, on Debian, or via Homebrew in the [Quickstart][5]. + +### Initialize your encrypted filesystem + +To get started, you need to decide where you want to store your encrypted files. This example will keep the files in **~/.sekrit_files** so that they don't show up when doing a normal **ls**. + +Start by initializing the filesystem. This will require you to choose a password. You are strongly encouraged to use a unique password you've never used anywhere else, as this is your key to unlocking your files. The project's authors recommend a password with between 64 and 128 bits of entropy. Assuming you use upper and lower case letters and numbers, this means your password should be between [11 and 22 characters long][6]. If you're using a password manager, this should be easy to accomplish with a generated password. + +When you initialize the filesystem, you will see a unique key. Store this key somewhere securely, as it will allow you to access your files if you need to recover your files but have forgotten your password. The key works without your password, so keep it private! + +The initialization routine looks like this: + + +``` +$ mkdir ~/.sekrit_files +$ gocryptfs -init ~/.sekrit_files +Choose a password for protecting your files. +Password: +Repeat: + +Your master key is: + +    XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX- +    XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX + +If the gocryptfs.conf file becomes corrupted or you ever forget your password, +there is only one hope for recovery: The master key. Print it to a piece of +paper and store it in a drawer. This message is only printed once. +The gocryptfs filesystem has been created successfully. +You can now mount it using: gocryptfs .sekrit_files MOUNTPOINT +``` + +If you look in the **~/.sekrit_files** directory, you will see two files: a configuration file and a unique directory-level initialization vector. You will not need to edit these two files by hand. Make sure you do not delete these files. + +### Use your encrypted filesystem + +To use your encrypted filesystem, you need to mount it. This requires an empty directory where you can mount the filesystem. For example, use the **~/my_files** directory. As you can see from the initialization, mounting is easy: + + +``` +$ gocryptfs ~/.sekrit_files ~/my_files +Password: +Decrypting master key +Filesystem mounted and ready. +``` + +If you check out the **~/my_files** directory, you'll see it is empty. The configuration and initialization vector files aren't data, so they don't show up. Let's put some data in the filesystem and see what happens: + + +``` +$ cp /usr/share/dict/words ~/my_files/ +$ ls -la ~/my_files/ ~/.sekrit_files/ +~/my_files/: +.rw-r--r-- 5.0M bexelbie 19 Jul 17:48 words + +~/.sekrit_files/: +.r--------@  402 bexelbie 19 Jul 17:39 gocryptfs.conf +.r--------@   16 bexelbie 19 Jul 17:39 gocryptfs.diriv +.rw-r--r--@ 5.0M bexelbie 19 Jul 17:48 xAQrtlyYSFeCN5w7O3-9zg +``` + +Notice that there is a new file in the **~/.sekrit_files** directory. This is the encrypted copy of the dictionary you copied in (the file name will vary). Feel free to use **cat** and other tools to examine these files and experiment with adding, deleting, and modifying files. Make sure to test with a few applications, such as LibreOffice. + +Remember, this a filesystem mount, so the contents of **~/my_files** aren't saved to disk. You can verify this by running **mount | grep my_files** and observing the output. Only the encrypted files are written to your disk. The FUSE interface is doing real-time encryption and decryption of the files and presenting them to your applications and shell as a filesystem. + +### Unmount the filesystem + +When you're done with your files, you can unmount them. This causes the unencrypted filesystem to no longer be available. The encrypted files in **~/.sekrit_files** are unaffected. Unmount the filesystem using the FUSE mounter program with **fusermount -u ~/my_files** . + +### Back up your data + +One of the cool benefits of gocryptfs using file-level encryption is that it makes backing up your encrypted data easier. The files are safe to store on a synchronizing system, such as OwnCloud or Dropbox. The standard disclaimer about not modifying the same file at the same time applies. However, the files can be backed up even if they are mounted. You can also save your data any other way you would typically back up files. You don't need anything special. + +When you do backups, make sure to include the **gocryptfs.diriv** file. This file is not a secret and can be saved with the backup. However, your **gocryptfs.conf** is a secret. When you control the entirety of the backup chain, such as with tape, you can back it up with the rest of the files. However, when the files are backed up to the cloud or publicly, you may wish to omit this file. In theory, if someone gets this file, the only thing protecting your files is the strength of your password. If you have chosen a [strong password][6], that may be enough; however, you need to consider your situation carefully. More details are in this gocryptfs [upstream issue][7]. + +### Bonus: Reverse mode + +A neat feature of gocryptfs is the reverse mode function. In reverse mode, point gocryptfs at your unencrypted data, and it will create a mount point with an encrypted view of this data. This is useful for things such as creating encrypted backups. This is easy to do: + + +``` +$ gocryptfs -reverse -init my_files +Choose a password for protecting your files. +Password: +Repeat: + +Your master key is: + +    XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX- +    XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX + +If the gocryptfs.conf file becomes corrupted or you ever forget your password, +there is only one hope for recovery: The master key. Print it to a piece of +paper and store it in a drawer. This message is only printed once. +The gocryptfs-reverse filesystem has been created successfully. +You can now mount it using: gocryptfs -reverse my_files MOUNTPOINT + +$ gocryptfs -reverse my_files sekrit_files +Password: +Decrypting master key +Filesystem mounted and ready. +``` + +Now **sekrit_files** contains an encrypted view of your unencrypted data from **my_files**. This can be backed up, shared, or handled as needed. The directory is read-only, as there is nothing useful you can do with those files except back them up. + +A new file, **.gocryptfs.reverse.conf**, has been added to **my_files** to provide a stable encrypted view. This configuration file will ensure that each reverse mount will use the same encryption key. This way you could, for example, back up only changed files. + +Gocryptfs is a flexible file encryption tool that allows you to store your data in an encrypted manner without changing your workflow or processes significantly. The design has undergone a security audit, and the developers have experience with other systems, such as **encfs**. I encourage you to add gocryptfs to your system today and start protecting your data. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-encrypt-files-gocryptfs + +作者:[Brian "bex" Exelbierd][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/bexelbiehttps://opensource.com/users/sethhttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/documents_papers_file_storage_work.png?itok=YlXpAqAJ (Filing papers and documents) +[2]: https://nuetzlich.net/gocryptfs/ +[3]: https://en.wikipedia.org/wiki/Filesystem_in_Userspace +[4]: https://getfedora.org +[5]: https://nuetzlich.net/gocryptfs/quickstart/ +[6]: https://github.com/rfjakob/gocryptfs/wiki/Password-Strength +[7]: https://github.com/rfjakob/gocryptfs/issues/50 diff --git a/sources/tech/20190816 How to plan your next IT career move.md b/sources/tech/20190816 How to plan your next IT career move.md new file mode 100644 index 0000000000..320444d056 --- /dev/null +++ b/sources/tech/20190816 How to plan your next IT career move.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to plan your next IT career move) +[#]: via: (https://opensource.com/article/19/8/plan-next-IT-career-move) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/marcobravo) + +How to plan your next IT career move +====== +Ask yourself these essential career questions about cloud, DevOps, +coding, and where you're going next in IT. +![Two hands holding a resume with computer, clock, and desk chair ][1] + +Being part of technology-oriented communities has been an essential part of my career development. The first community that made a difference for me was focused on virtualization. Less than a year into my first career-related job, I met a group of friends who were significant contributors to this "vCommunity," and I found their enthusiasm to be contagious. That began our daily "nerd herd," where a handful of us met nearly every day for coffee before our shifts in tech support. We often discussed the latest software releases or hardware specs of a related storage array, and other times we strategized about how we could help each other grow in our careers. + +> Any community worth being a part of will lift you up as you lift others up in the process. + +In those years, I learned a foundational truth that's as true for me today as it was then: Any community worth being a part of will lift you up as you lift others up in the process. + +![me with friends at New England VTUG meeting][2] + +Matthew with friends [Jonathan][3] and [Paul][4] (L-R) at a New England VTUG meeting. + +We began going to conferences together, with the first major effort by being the volunteer social team for a user group out of New England. We set up a Twitter account, sending play-by-plays as the event happened, but we also were there, in person, to welcome new members into our community of practice. While it wasn't my intention, finding that intersection of community and technology taught me the skills that led to my next job offer. And my story wasn't unique; many of us supported each other, and many of us advanced in our careers along the way. + +While I remained connected to the vCommunity, I haven't kept up with the (mostly proprietary) technology stack we used to talk about. + +My preferred technology shifted direction drastically when I fell in love with open source. It's been about five years since I knew virtualization deeply and two years since I spoke at an event centered on the topic. So it was a surprise and honor to be invited to give the opening keynote to the last edition of the [New England Virtualization Technology User Group][5]'s (VTUG) Summer Slam in July. Here's what I spoke about. + +### Technology and, more importantly, employment + +When I heard the user group was hosting its last-ever event, I said I'd love to be part of it. The challenge was that I didn't know how I would. While there is plenty of open source virtualization technology, I had shifted further up the stack toward applications and programming languages of late, so my technical angle wouldn't make for a good talk. The organizer said, "Good, that's what people need to hear." + +Being further away from the vCommunity meant I had missed some of the context of the last few years. A noticeable amount of the community was facing unemployment. When they went to apply for a new job, there were new titles like [DevOps Engineer][6] and [SRE][7]. Not only that, I was told that the deep focus on a single vendor of proprietary virtualization technology is no longer enough. Virtualization and storage administration (my first area of expertise) appear to be the hardest hit by this shift. One story I heard at the event was that over 50% of a local user group's attendees were looking, and there was a gap in awareness of how to move forward. + +So while I enjoy having lighthearted conversations with people learning to contribute to open source, this talk was different. It had more to do with people's lives than usual. The stakes were higher. + +### 3 trends worth exploring + +There are a thousand ways to summarize the huge waves of change that are taking place in the tech industry. In my talk, I offered the idea that cloud, DevOps, and coding are three distinct trends making some of those waves and worth considering as you plan the next steps in your IT-oriented career. + + * Cloud, including the new operational model of IT that is often Kubernetes-based + * DevOps, which rejects the silos, ticket systems, and blame of legacy IT departments + * Coding, including the practice of infrastructure as code (accompanied by a ton of YAML) + + + +I imagine them as literal waves, crashing down upon the ships of the old way to make way for the new. + +![Adaption of The Great Wave Off Kanagawa][8] + +Adaption of [The Great Wave Off Kanagawa][9] + +We have two mutually exclusive options as we consider how to respond to these shifts. We can paddle hard, feeling like we're going against the current, or we can stay put and be crushed by the wave. One is uncomfortable in the short term, while the other is more comfortable for now. Only one option is survivable. It sounds scary, and I'm okay with that. The stakes are real. + +![Adaption of The Great Wave Off Kanagawa][10] + +Adaption of [The Great Wave Off Kanagawa][9] + +Cloud, DevOps, and coding are each massive topics with a ton of nuance to unpack. But if want to retool your skills for the future, I'm confident that focusing on **any** of them will set you up for a successful next step. + +### Finding the right adoption timeline + +One of the most challenging aspects of this is the sheer onslaught of information. It's reasonable to ask what you should learn, specifically, and when. I'm reminded of the work of [Nassim Taleb][11] who, among his deeply thoughtful insights into risk, makes note of a powerful concept: + +> "The longer a technology lives, the longer it can be expected to live." +> – Nassim Taleb, [_Antifragile_][12] (2012) + +This sticking power of technology may offer insight into the right time to jump on a wave of newness. It doesn't have to be right away, given that early adopters may find their efforts don't have enough stick-to-it-ness to linger beyond a passing trend. That aligns well with my style: I'm rarely an early adopter, and I'm comfortable with that fact. I leave a lot of the early testing and debugging of new projects to those who are excited by the uncertainty of it all, and I'll be around for the phase when the brilliant idea needs to be refined (or, as [Simon Wardley][13] puts it, I prefer the [Settling phase over the Pioneer one][14]). That also aligns well with the perspective of most admin-centric professionals I know. They're wary of new things because they know saying yes to something in production is easier than supporting it after it gets there. + +![One theory on when to adopt technology as its being displaced][15] + +What I also love about Taleb's words is they offer a reasonable equation to make sure you're not the last to adopt a technology. Why not be last? Because you'll be so far behind that no one will want to hire you. + +So what does that equation look like? I think it's taking Taleb's theory, more broadly called the [Lindy effect][16], and doing the math: you can expect that any technology will be in existence at least as long as it was before a competitor came into play. So if X technology excited for 30 years before Y threatened its dominance, you can expect X to be in existence for another 30 years (even if Y is way more popular, powerful, and trendy). It takes a long time for technology to "die." + +My observation is more of a half-life of that concept: you can expect broad adoption of Y technology halfway through the adoption curve. By that point, companies hiring will start to signal they want this knowledge on their team, and it's reasonable for even the most skeptical of Sysadmins to learn said technology. In practice, that may look like this, where ETOA is the estimated time of mass adoption: + +![IP4 to IP6 estimated time of mass adoption][17] + +Many would love for IPv6 to be widely adopted sooner than 2027, and this theory offers a potential reason why it takes so long. Change is going somewhere, but the pace more aligned with the Lindy effect than to those people's expectations. + +To paraphrase statistician [George Box][18], "all models are wrong, but some are more useful than others." Taleb's adaptation of the Lindy effect helps me think about how I need to prioritize my learning relative to the larger waves of change happening in the industry. + +### Asking the right questions + +The thing I cannot say often enough is that _people who have IT admin skills have a ton of options when they look at the industry_. + +Every person who has been an admin has had to learn new technology. They excel at it. And while mastery takes time, a decent amount of familiarity and a willingness to learn are very hirable skills. Learning a new technology and inspecting its operational model to anticipate its failures in production are hugely valuable to any project. I look at open source software projects on GitHub and GitLab regularly, and many are looking for feedback on how to get their projects ready for production environments. Admins are experts at operational improvement. + +All that said, it can still be paralyzing to decide what to learn. When people are feeling stuck, I recommend asking yourself these questions to jumpstart your thinking: + + 1. What technology do you want to know? + 2. What's your next career? + + + +The first question is full of important reminders. First off, many of us in IT have the privilege of choosing to study the things that bring us joy to learn. It's a wonderful feeling to be excited by our work, and I love when I see that in someone I'm mentoring. + +Another favorite takeaway is that no one is born knowing any specific technology. All technology skills are learned skills. So, your back-of-the-mind thought that "I don't understand that" is often masking the worry that "I can't learn it." Investigate further, and you'll find that your nagging sense of impossibility is easily disproven by everything you've accomplished until this point. I find a gentle and regular reminder that all technology is learned is a great place to start. You've done this before; you will do so again. + +Here's one more piece of advice: stick with one thing and go deep. Skills—and the stories we tell about them to potential employers—are more interesting the deeper we can go. Therefore, when you're learning to code in your language of choice, find a way to build something that you can talk about at length in a job interview. Maybe it's an Ansible module in Python or a Go module for Terraform. Either one is a lot more powerful than saying you can code Hello World in seven languages. + +There is also power in asking yourself what your next career will be. It's a reminder that you have one and, to survive and advance, you have to continue learning. What got you here will not get you where you're going next. + +It's freeing to find that your next career can be an evolution of what you know now or a doubling-down on something much larger. I advocate for evolutionary, not revolutionary. There is a lot of foundational knowledge in everything we know, and it can be powerful to us and the story we tell others when we stay connected to our past. + +### Community is key + +All careers evolve and skills develop. Many of us are drawn to IT because it requires continual learning. Know that you can do it, and stick with your community to help you along the way. + +If you're looking for a way to apply your background in IT administration and you have an open source story to tell, we would love to help you share it. Read our [information for writers][19] to learn how. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/plan-next-IT-career-move + +作者:[Matthew Broberg][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/mbbroberghttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) +[2]: https://opensource.com/sites/default/files/uploads/vtug.png (Matthew with friends at New England VTUG meeting) +[3]: https://twitter.com/jfrappier +[4]: https://twitter.com/paulbraren +[5]: https://vtug.com/ +[6]: https://opensource.com/article/19/7/how-transition-career-devops-engineer +[7]: https://opensource.com/article/19/7/sysadmins-vs-sres +[8]: https://opensource.com/sites/default/files/uploads/greatwave.png (Adaption of The Great Wave Off Kanagawa) +[9]: https://en.wikipedia.org/wiki/The_Great_Wave_off_Kanagawa +[10]: https://opensource.com/sites/default/files/uploads/greatwave2.png (Adaption of The Great Wave Off Kanagawa) +[11]: https://en.wikipedia.org/wiki/Nassim_Nicholas_Taleb +[12]: https://en.wikipedia.org/wiki/Antifragile +[13]: https://twitter.com/swardley +[14]: https://blog.gardeviance.org/2015/03/on-pioneers-settlers-town-planners-and.html +[15]: https://opensource.com/sites/default/files/articles/displacing-technology-lindy-effect-opensource.com_.png (One theory on when to adopt technology as its being displaced) +[16]: https://en.wikipedia.org/wiki/Lindy_effect +[17]: https://opensource.com/sites/default/files/uploads/ip4-to-etoa.png (IP4 to IP6 estimated time of mass adoption) +[18]: https://en.wikipedia.org/wiki/George_E._P._Box +[19]: https://opensource.com/how-submit-article diff --git a/sources/tech/20190817 Share Your Keyboard and Mouse Between Linux and Raspberry Pi.md b/sources/tech/20190817 Share Your Keyboard and Mouse Between Linux and Raspberry Pi.md new file mode 100644 index 0000000000..71c1e77b02 --- /dev/null +++ b/sources/tech/20190817 Share Your Keyboard and Mouse Between Linux and Raspberry Pi.md @@ -0,0 +1,209 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Share Your Keyboard and Mouse Between Linux and Raspberry Pi) +[#]: via: (https://itsfoss.com/keyboard-mouse-sharing-between-computers/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Share Your Keyboard and Mouse Between Linux and Raspberry Pi +====== + +_**This DIY tutorial teaches you to share mouse and keyboard between multiple computers using open source software Barrier.**_ + +I have a multi-monitor setup where my [Dell XPS running Ubuntu][1] is connected to two external monitors. I recently got a [Raspberry Pi 4][2] that has the capability to double up as a desktop. I bought a new screen so that I could set it up for monitoring the performance of my cloud servers. + +Now the problem is that I have fours screens and one pair of keyboard and mouse. I could use a new keyboard-mouse pair but my desk doesn’t have enough free space and it’s not very convenient to switch keyboards and mouse all the time. + +One way to tackle this problem would be to buy a kvm switch. This is a handy gadget that allows you to use same display screen, keyboard and mouse between several computers running various operating systems. You can easily find one for around $30 on Amazon. + +Bestseller No. 1 + +[][3] + +[UGREEN USB Switch Selector 2 Computers Sharing 4 USB Devices USB 2.0 Peripheral Switcher Box Hub for Mouse, Keyboard, Scanner, Printer, PCs with One-Button Swapping and 2 Pack USB A to A Cable][3] + +Ugreen Group Limited - Electronics + +$18.99 [][4] + +But I didn’t go for the hardware solution. I opted for a software based approach to share the keyboard and mouse between computers. + +I used [Barrier][5], an open source fork of the now proprietary software [Synergy][6]. Synergy Core is still open source but you can’t get encryption option in its GUI. With all its limitation, Barrier works fine for me. + +Let’s see how you can use Barrier to share mouse and keyboard with multiple computers. Did I mention that you can even share clipboard and thus copy paste text between the computers? + +### Set up Barrier to share keyboard and mouse between Linux and Raspberry Pi or other devices + +![][7] + +I have prepared this tutorial with Ubuntu 18.04.3 and Raspbian 10. Some installation instructions may differ based on your distribution and version but you’ll get the idea of what you need to do here. + +#### Step 1: Install Barrier + +The first step is obvious. You need to install Barrier in your computer. + +Barrier is available in the universe repository starting Ubuntu 19.04 so you can easily install it using apt command. + +You’ll have to use the snap version of Barrier in Ubuntu 18.04. Open Software Center and search for Barrier. I recommend using barrier-maxiberta + +![Install this Barrier version][8] + +On other distributions, you should [enable Snap][9] first and then use this command: + +``` +sudo snap install barrier-maxiberta +``` + +Barrier is available in Debian 10 repositories. So installing barrier on Raspbian was easy with the [apt command][10]: + +``` +sudo apt install barrier +``` + +Once you have installed the software, it’s time to configure it. + +[][11] + +Suggested read  Fix Application Installation Issues In elementary OS + +#### Step 2: Configure Barrier server + +Barrier works on server-client model. You should configure your main computer as server and the secondary computer as client. + +In my case, my Ubuntu 18.04 is my main system so I set it up as the server. Search for Barrier in menu and start it. + +![Setup Barrier as server][12] + +You should see an IP address and an SSL fingerprint. It’s not entirely done because you have to configure the server a little. Click on Configure Server option. + +![Configure the Barrier server][13] + +In here, you should see your own system in the center. Now you have to drag and drop the computer icon from the top right to a suitable position. The position is important because that’s how your mouse pointer will move between screens. + +![Setup Barrier server with client screens][14] + +Do note that you should provide the [hostname][15] of the client computer. In my case, it was raspberrypi. It won’t work if the hostname is not correct. Don’t know the client’s hostname? Don’t worry, you can get it from the client system. + +#### Step 3: Setup barrier client + +On the second computer, start Barrier and choose to use it as client. + +![Setup Barrier Client on Raspberry Pi][16] + +You need to provide the IP address of Barrier server. You can find this IP address on the Barrier application running on the main system (see the screenshots in previous section). + +![Setup Barrier Client on Raspberry Pi][17] + +If you see an option to accept secure connection from another computer, accept it. + +You should be now able to move your mouse pointer between the screens connected to two different computers running two different operating systems. How cool is that! + +### Optional: Autostart Barrier [Intermediate to Advanced Users] + +Now that you have setup Barrier and enjoying by using the same mouse and keyboard for more than one computers, what happens when you reboot your system? You need to start Barrier in both the systems again, right? This means that you need to connect keyboard-mouse to the second computer as well. + +[][18] + +Suggested read  How To Fix Windows Updates Stuck At 0% + +Since I use Wireless mouse and keyboard, this is still easier as all I need to do is to take the adapter from my laptop and plug it in the Raspberry Pi. This works but I don’t want to do this extra step. This is why I made Barrier running at the start on both systems so that I could use the same mouse and keyboard without any additional step. + +There is no autostart option in the Barrier application. But it’s easy to [add an application to autostart in Ubuntu][19]. Just open the Startup Applications program and add the command _**barrier-maxiberta.barrier**_ here. + +![Adding Barrier To Startup applications in Ubuntu][20] + +That was the easy part. It’s not the same in Raspberry Pi though. Since Raspbian uses systemd, you can use it to create a new service that will run at the boot time. + +Open a terminal and create a new file named barrier.service in /etc/systemd/system directory. If this directory doesn’t exist, create it. You can use your favorite command line text editor for this task. I used Vim here. + +``` +sudo vim /etc/systemd/system/barrier.service +``` + +Now add lines like these to your file. _**You must replace 192.168.0.109 with your barrier server’s IP address.**_ + +``` +[Unit] +Description=Barrier Client mouse/keyboard share +Requires=display-manager.service +After=display-manager.service +StartLimitIntervalSec=0 + +[Service] +Type=forking +ExecStart=/usr/bin/barrierc --no-restart --name raspberrypi --enable-crypto 192.168.0.109 +Restart=always +RestartSec=10 +User=pi + +[Install] +WantedBy=multi-user.target +``` + +Save your file. I would advise to run the command mentioned in ExecStart line manually to see if it works or not. This will save you some headache later. + +Reload the systemd daemon: + +``` +sudo systemctl daemon-reload +``` + +Now start this new service + +``` +systemctl start barrier.service +``` + +Check its status to see if its running fine: + +``` +systemctl status barrier.service +``` + +If it works, add it to startup services: + +``` +systemctl enable barrier.service +``` + +This should take care of things for you. Now you should be able to control the Raspberry Pi (or any other second computer) with a single keyboard mouse pair. + +I know that these DIY stuff may not work straightforward for everyone so if you face issues, let me know in the comments and I’ll try to help you out. + +If it worked for you or if you use some other solution to share the mouse and keyboard between the computers, do mention it in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/dell-xps-13-ubuntu-review/ +[2]: https://itsfoss.com/raspberry-pi-4/ +[3]: https://www.amazon.com/UGREEN-Selector-Computers-Peripheral-One-Button/dp/B01MXXQKGM?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01MXXQKGM&keywords=kvm%20switch (UGREEN USB Switch Selector 2 Computers Sharing 4 USB Devices USB 2.0 Peripheral Switcher Box Hub for Mouse, Keyboard, Scanner, Printer, PCs with One-Button Swapping and 2 Pack USB A to A Cable) +[4]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[5]: https://github.com/debauchee/barrier +[6]: https://symless.com/synergy +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/Share-Keyboard-and-Mouse.jpg?resize=800%2C450&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/barrier-ubuntu-snap.jpg?ssl=1 +[9]: https://itsfoss.com/install-snap-linux/ +[10]: https://itsfoss.com/apt-command-guide/ +[11]: https://itsfoss.com/fix-application-installation-issues-elementary-os-loki/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/barrier-2.jpg?resize=800%2C512&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/barrier-server-ubuntu.png?resize=800%2C450&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/barrier-server-configuration.png?ssl=1 +[15]: https://itsfoss.com/change-hostname-ubuntu/ +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/setup-barrier-client.jpg?resize=800%2C400&ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/setup-barrier-client-2.jpg?resize=800%2C400&ssl=1 +[18]: https://itsfoss.com/fix-windows-updates-stuck-0/ +[19]: https://itsfoss.com/manage-startup-applications-ubuntu/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/adding-barrier-to-startup-apps-ubuntu.jpg?ssl=1 diff --git a/sources/tech/20190818 How to Create Availability Zones in OpenStack from Command Line.md b/sources/tech/20190818 How to Create Availability Zones in OpenStack from Command Line.md new file mode 100644 index 0000000000..dc49daebd7 --- /dev/null +++ b/sources/tech/20190818 How to Create Availability Zones in OpenStack from Command Line.md @@ -0,0 +1,321 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Create Availability Zones in OpenStack from Command Line) +[#]: via: (https://www.linuxtechi.com/create-availability-zones-openstack-command-line/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Create Availability Zones in OpenStack from Command Line +====== + +In **OpenStack** terminology, **Availability Zones (AZ**) is defined as a logical partition of compute(nova), block storage (cinder) and network Service (neutron). Availability zones are required to segregate the work load of environments like production and non-production, let me elaborate this statement. + +[![Availability-Zones-OpenStack-Command-Line][1]][2] + +let’s suppose we have a tenant in OpenStack who wants to deploy their VMs in Production and Non-Production, so to create this type of setup in openstack , first we have to identify which computes will be considered as Production and Non-production then we have to create host-aggregate group where we will add the computes to the host-aggregate group and then we will map th host aggregate group to the Availability Zone. + +In this tutorial we will demonstrate how to create and use computes availability zones in openstack via command line. + +### Creating compute availability zones + +Whenever OpenStack is deployed, Nova is the default Availability Zone(AZ) created automatically and all the compute nodes belongs to Nova AZ. Run the below openstack command from the controller node to list Availability zones, + +``` +~# source openrc +~# openstack availability zone list ++-----------+-------------+ +| Zone Name | Zone Status | ++-----------+-------------+ +| internal | available | +| nova | available | +| nova | available | +| nova | available | ++-----------+-------------+ +~# +``` + +To list only compute’s availability zones, run the beneath openstack command, + +``` +~# openstack availability zone list --compute ++-----------+-------------+ +| Zone Name | Zone Status | ++-----------+-------------+ +| internal | available | +| nova | available | ++-----------+-------------+ +~# +``` + +To list all compute hosts which are mapped to nova availability zone execute the below command, + +``` +~# openstack host list | grep -E "Zone|nova" +| Host Name | Service | Zone | +| compute-0-1 | compute | nova | +| compute-0-2 | compute | nova | +| compute-0-4 | compute | nova | +| compute-0-3 | compute | nova | +| compute-0-8 | compute | nova | +| compute-0-6 | compute | nova | +| compute-0-9 | compute | nova | +| compute-0-5 | compute | nova | +| compute-0-7 | compute | nova | +~# +``` + +Let’s create a two host-aggregate group with name **production** and **non-production**, add compute-4,5 & 6 to production host aggregate group and compute-7,8 & 9 to non-production host aggregate group. + +Create Production and Non-Production Host aggregate using following OpenStack commands, + +``` +~# openstack aggregate create production ++-------------------+----------------------------+ +| Field | Value | ++-------------------+----------------------------+ +| availability_zone | None | +| created_at | 2019-08-17T03:02:41.561259 | +| deleted | False | +| deleted_at | None | +| id | 7 | +| name | production | +| updated_at | None | ++-------------------+----------------------------+ + +~# openstack aggregate create non-production ++-------------------+----------------------------+ +| Field | Value | ++-------------------+----------------------------+ +| availability_zone | None | +| created_at | 2019-08-17T03:02:53.806713 | +| deleted | False | +| deleted_at | None | +| id | 10 | +| name | non-production | +| updated_at | None | ++-------------------+----------------------------+ +~# +``` + +Now create the availability zones and associate it to its respective host aggregate groups + +**Syntax:** + +# openstack aggregate set –zone <az_name>  <host_aggregate_name> + +``` +~# openstack aggregate set --zone production-az production +~# openstack aggregate set --zone non-production-az non-production +``` + +Finally add the compute host to its host-aggregate group + +**Syntax:** + +# openstack aggregate add host <host_aggregate_name>  <compute_host> + +``` +~# openstack aggregate add host production compute-0-4 +~# openstack aggregate add host production compute-0-5 +~# openstack aggregate add host production compute-0-6 +``` + +Similarly add compute host to non-production host aggregation group, + +``` +~# openstack aggregate add host non-production compute-0-7 +~# openstack aggregate add host non-production compute-0-8 +~# openstack aggregate add host non-production compute-0-9 +``` + +Execute the beneath openstack commands to verify Host aggregate group and its availability zone + +``` +~# openstack aggregate list ++----+----------------+-------------------+ +| ID | Name | Availability Zone | ++----+----------------+-------------------+ +| 7 | production | production-az | +| 10 | non-production | non-production-az | ++----+----------------+-------------------+ +~# +``` + +Run below commands to list computes associated to AZ and host aggregate group + +``` +~# openstack aggregate show production ++-------------------+--------------------------------------------+ +| Field | Value | ++-------------------+--------------------------------------------+ +| availability_zone | production-az | +| created_at | 2019-08-17T03:02:42.000000 | +| deleted | False | +| deleted_at | None | +| hosts | [u'compute-0-4', u'compute-0-5', u'compute-0-6'] | +| id | 7 | +| name | production | +| properties | | +| updated_at | None | ++-------------------+--------------------------------------------+ + +~# openstack aggregate show non-production ++-------------------+---------------------------------------------+ +| Field | Value | ++-------------------+---------------------------------------------+ +| availability_zone | non-production-az | +| created_at | 2019-08-17T03:02:54.000000 | +| deleted | False | +| deleted_at | None | +| hosts | [u'compute-0-7', u'compute-0-8', u'compute-0-9'] | +| id | 10 | +| name | non-production | +| properties | | +| updated_at | None | ++-------------------+---------------------------------------------+ +~# +``` + +Above command’s output confirm that we have successfully create host aggregate group and availability zones. + +### Launch Virtual Machines in Availability Zones + +Now let’s create couple virtual machines in these two availability zones, to create a vm in particular availability zone use below command, + +**Syntax:** + +# openstack server create –flavor <flavor-name> –image <Image-Name-Or-Image-ID>  –nic net-id=<Network-ID> –security-group <Security-Group-ID> –key-name <Keypair-Name> –availability-zone <AZ-Name>   <VM-Name> + +Example is shown below: + +``` +~# openstack server create --flavor m1.small --image Cirros --nic net-id=37b9ab9a-f198-4db1-a5d6-5789b05bfb4c --security-group f8dda7c3-f7c3-423b-923a-2b21fe0bbf3c --key-name mykey --availability-zone production-az test-vm-prod-az +``` + +Run below command to verify virtual machine details: + +``` +~# openstack server show test-vm-prod-az +``` + +![Openstack-Server-AZ-command][1] + +To create a virtual machine in a specific compute node under availability zone, use the below command, + +**Syntax:** + +# openstack server create –flavor <flavor-name> –image <Image-Name-Or-Image-ID>  –nic net-id=<Network-ID> –security-group <Security-Group-ID> –key-name {Keypair-Name} –availability-zone <AZ-Name>:<Compute-Host> <VM-Name> + +Let suppose we want to spin a vm under production AZ on specific compute (compute-0-6), so to accomplish this, run the beneath command, + +``` +~# openstack server create --flavor m1.small --image Cirros --nic net-id=37b9ab9a-f198-4db1-a5d6-5789b05bfb4c --security-group f8dda7c3-f7c3-423b-923a-2b21fe0bbf3c --key-name mykey --availability-zone production-az:compute-0-6 test-vm-prod-az-host +``` + +Execute following command to verify the VM details: + +``` +~# openstack server show test-vm-prod-az-host +``` + +Output above command would be something like below: + +![OpenStack-VM-AZ-Specific-Host][1] + +Similarly, we can create virtual machines in non-production AZ, example is shown below + +``` +~# openstack server create --flavor m1.small --image Cirros --nic net-id=37b9ab9a-f198-4db1-a5d6-5789b05bfb4c --security-group f8dda7c3-f7c3-423b-923a-2b21fe0bbf3c --key-name mykey --availability-zone non-production-az vm-nonprod-az +``` + +Use below command verify the VM details, + +``` +~# openstack server show vm-nonprod-az +``` + +Output of above command would be something like below, + +![OpenStack-Non-Production-AZ-VM][1] + +### Removing Host aggregate group and Availability Zones + +Let’s suppose we want to remove /delete above created host aggregate group and availability zones, for that first we must remove host from the host aggregate group, use the below command, + +``` +~# openstack aggregate show production +``` + +Above command will give u the list of compute host which are added to production host aggregate group. + +Use below command to remove host from the host aggregate group + +**Syntax:** + +# openstack aggregate remove host <host-aggregate-name> <compute-name> + +``` +~# openstack aggregate remove host production compute-0-4 +~# openstack aggregate remove host production compute-0-5 +~# openstack aggregate remove host production compute-0-6 +``` + +Once you remove all host from the group, then re-run the below command, + +``` +~# openstack aggregate show production ++-------------------+----------------------------+ +| Field | Value | ++-------------------+----------------------------+ +| availability_zone | production-az | +| created_at | 2019-08-17T03:02:42.000000 | +| deleted | False | +| deleted_at | None | +| hosts | [] | +| id | 7 | +| name | production | +| properties | | +| updated_at | None | ++-------------------+----------------------------+ +~# +``` + +As we can see in above output there is no compute host associated to production host aggregate group, now we are good to remove the group + +Use below command to delete host aggregate group and its associated availability zone + +``` +~# openstack aggregate delete production +``` + +Run the following command to check whether availability zone has been removed or not, + +``` +~# openstack availability zone list | grep -i production-az +~# +``` + +Similarly, you can refer the above steps to remove or delete non-production host aggregate and its availability zone. + +That’s all from this tutorial, in case above content helps you to understand OpenStack host aggregate and availability zones then please do share your feedback and comments. + +**Read Also: [Top 30 OpenStack Interview Questions and Answers][3]** + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/create-availability-zones-openstack-command-line/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/08/Availability-Zones-OpenStack-Command-Line.jpg +[3]: https://www.linuxtechi.com/openstack-interview-questions-answers/ diff --git a/sources/tech/20190819 An introduction to bpftrace for Linux.md b/sources/tech/20190819 An introduction to bpftrace for Linux.md new file mode 100644 index 0000000000..d5be0703b4 --- /dev/null +++ b/sources/tech/20190819 An introduction to bpftrace for Linux.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An introduction to bpftrace for Linux) +[#]: via: (https://opensource.com/article/19/8/introduction-bpftrace) +[#]: author: (Brendan Gregg https://opensource.com/users/brendanghttps://opensource.com/users/marcobravo) + +An introduction to bpftrace for Linux +====== +New Linux tracer analyzes production performance problems and +troubleshoots software. +![Linux keys on the keyboard for a desktop computer][1] + +Bpftrace is a new open source tracer for Linux for analyzing production performance problems and troubleshooting software. Its users and contributors include Netflix, Facebook, Red Hat, Shopify, and others, and it was created by [Alastair Robertson][2], a talented UK-based developer who has won various coding competitions. + +Linux already has many performance tools, but they are often counter-based and have limited visibility. For example, [iostat(1)][3] or a monitoring agent may tell you your average disk latency, but not the distribution of this latency. Distributions can reveal multiple modes or outliers, either of which may be the real cause of your performance problems. [Bpftrace][4] is suited for this kind of analysis: decomposing metrics into distributions or per-event logs and creating new metrics for visibility into blind spots. + +You can use bpftrace via one-liners or scripts, and it ships with many prewritten tools. Here is an example that traces the distribution of read latency for PID 181 and shows it as a power-of-two histogram: + + +``` +# bpftrace -e 'kprobe:vfs_read /pid == 30153/ { @start[tid] = nsecs; } +kretprobe:vfs_read /@start[tid]/ { @ns = hist(nsecs - @start[tid]); delete(@start[tid]); }' +Attaching 2 probes... +^C + +@ns: +[256, 512)         10900 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@                      | +[512, 1k)          18291 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| +[1k, 2k)            4998 |@@@@@@@@@@@@@@                                      | +[2k, 4k)              57 |                                                    | +[4k, 8k)             117 |                                                    | +[8k, 16k)             48 |                                                    | +[16k, 32k)           109 |                                                    | +[32k, 64k)             3 |                                                    | +``` + +This example instruments one event out of thousands available. If you have some weird performance problem, there's probably some bpftrace one-liner that can shed light on it. For large environments, this ability can help you save millions. For smaller environments, it can be of more use in helping to eliminate latency outliers. + +I [previously][5] wrote about bpftrace vs. other tracers, including [BCC][6] (BPF Compiler Collection). BCC is great for canned complex tools and agents. Bpftrace is best for short scripts and ad hoc investigations. In this article, I'll summarize the bpftrace language, variable types, probes, and tools. + +Bpftrace uses BPF (Berkeley Packet Filter), an in-kernel execution engine that processes a virtual instruction set. BPF has been extended (aka eBPF) in recent years for providing a safe way to extend kernel functionality. It also has become a hot topic in systems engineering, with at least 24 talks on BPF at the last [Linux Plumber's Conference][7]. BPF is in the Linux kernel, and bpftrace is the best way to get started using BPF for observability. + +See the bpftrace [INSTALL][8] guide for how to install it, and get the latest version; [0.9.2][9] was just released. For Kubernetes clusters, there is also [kubectl-trace][10] for running it. + +### Syntax + + +``` +`probe[,probe,...] /filter/ { action }` +``` + +The probe specifies what events to instrument. The filter is optional and can filter down the events based on a boolean expression, and the action is the mini-program that runs. + +Here's hello world: + + +``` +`# bpftrace -e 'BEGIN { printf("Hello eBPF!\n"); }'` +``` + +The probe is **BEGIN**, a special probe that runs at the beginning of the program (like awk). There's no filter. The action is a **printf()** statement. + +Now a real example: + + +``` +`# bpftrace -e 'kretprobe:sys_read /pid == 181/ { @bytes = hist(retval); }'` +``` + +This uses a **kretprobe** to instrument the return of the **sys_read()** kernel function. If the PID is 181, a special map variable **@bytes** is populated with a log2 histogram function with the return value **retval** of **sys_read()**. This produces a histogram of the returned read size for PID 181. Is your app doing lots of one byte reads? Maybe that can be optimized. + +### Probe types + +These are libraries of related probes. The currently supported types are (more will be added): + +Type | Description +---|--- +**tracepoint** | Kernel static instrumentation points +**usdt** | User-level statically defined tracing +**kprobe** | Kernel dynamic function instrumentation +**kretprobe** | Kernel dynamic function return instrumentation +**uprobe** | User-level dynamic function instrumentation +**uretprobe** | User-level dynamic function return instrumentation +**software** | Kernel software-based events +**hardware** | Hardware counter-based instrumentation +**watchpoint** | Memory watchpoint events (in development) +**profile** | Timed sampling across all CPUs +**interval** | Timed reporting (from one CPU) +**BEGIN** | Start of bpftrace +**END** | End of bpftrace + +Dynamic instrumentation (aka dynamic tracing) is the superpower that lets you trace any software function in a running binary without restarting it. This lets you get to the bottom of just about any problem. However, the functions it exposes are not considered a stable API, as they can change from one software version to another. Hence static instrumentation, where event points are hard-coded and become a stable API. When you write bpftrace programs, try to use the static types first, before the dynamic ones, so your programs are more stable. + +### Variable types + +Variable | Description +---|--- +**@name** | global +**@name[key]** | hash +**@name[tid]** | thread-local +**$name** | scratch + +Variables with an **@** prefix use BPF maps, which can behave like associative arrays. They can be populated in one of two ways: + + * Variable assignment: **@name = x;** + * Function assignment: **@name = hist(x);** + + + +Various map-populating functions are built in to provide quick ways to summarize data. + +### Built-in variables and functions + +Here are some of the built-in variables and functions, but there are many more. + +**Built-in variables:** + +Variable | Description +---|--- +**pid** | process ID +**comm** | Process or command name +**nsecs** | Current time in nanoseconds +**kstack** | Kernel stack trace +**ustack** | User-level stack trace +**arg0...argN** | Function arguments +**args** | Tracepoint arguments +**retval** | Function return value +**name** | Full probe name + +**Built-in functions:** + +Function | Description +---|--- +**printf("...")** | Print formatted string +**time("...")** | Print formatted time +**system("...")** | Run shell command +**@ = count()** | Count events +**@ = hist(x)** | Power-of-2 histogram for x +**@ = lhist(x, min, max, step)** | Linear histogram for x + +See the [reference guide][11] for details. + +### One-liners tutorial + +A great way to learn bpftrace is via one-liners, which I turned into a [one-liners tutorial][12] that covers the following: + +Listing probes | **bpftrace -l 'tracepoint:syscalls:sys_enter_*'** +---|--- +Hello world | **bpftrace -e 'BEGIN { printf("hello world\n") }'** +File opens | **bpftrace -e 'tracepoint:syscalls:sys_enter_open { printf("%s %s\n", comm, str(args->filename)) }'** +Syscall counts by process | **bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @[comm] = count() }'** +Distribution of read() bytes | **bpftrace -e 'tracepoint:syscalls:sys_exit_read /pid == 18644/ { @bytes = hist(args->retval) }'** +Kernel dynamic tracing of read() bytes | **bpftrace -e 'kretprobe:vfs_read { @bytes = lhist(retval, 0, 2000, 200) }'** +Timing read()s | **bpftrace -e 'kprobe:vfs_read { @start[tid] = nsecs } kretprobe:vfs_read /@start[tid]/ { @ns[comm] = hist(nsecs - @start[tid]); delete(@start[tid]) }'** +Count process-level events | **bpftrace -e 'tracepoint:sched:sched* { @[name] = count() } interval:s:5 { exit() }'** +Profile on-CPU kernel stacks | **bpftrace -e 'profile:hz:99 { @[stack] = count() }'** +Scheduler tracing | **bpftrace -e 'tracepoint:sched:sched_switch { @[stack] = count() }'** +Block I/O tracing | **bpftrace -e 'tracepoint:block:block_rq_issue { @ = hist(args->bytes); }** +Kernel struct tracing (a script, not a one-liner) | Command: **bpftrace path.bt**, where the path.bt file is: + +**#include <linux/path.h> +#include <linux/dcache.h>** + +**kprobe:vfs_open { printf("open path: %s\n", str(((path *)arg0)->dentry->d_name.name)); }** + +See the tutorial for an explanation of each. + +### Provided tools + +Apart from one-liners, bpftrace programs can be multi-line scripts. Bpftrace ships with 28 of them as tools: + +![bpftrace/eBPF tools][13] + +These can be found in the **[/tools][14]** directory: + + +``` +tools# ls *.bt +bashreadline.bt  dcsnoop.bt         oomkill.bt    syncsnoop.bt   vfscount.bt +biolatency.bt    execsnoop.bt       opensnoop.bt  syscount.bt    vfsstat.bt +biosnoop.bt      gethostlatency.bt  pidpersec.bt  tcpaccept.bt   writeback.bt +bitesize.bt      killsnoop.bt       runqlat.bt    tcpconnect.bt  xfsdist.bt +capable.bt       loads.bt           runqlen.bt    tcpdrop.bt +cpuwalk.bt       mdflush.bt         statsnoop.bt  tcpretrans.bt +``` + +Apart from their use in diagnosing performance issues and general troubleshooting, they also provide another way to learn bpftrace. Here are some examples. + +#### Source + +Here's the code to **biolatency.bt**: + + +``` +tools# cat -n biolatency.bt +     1  /* +     2   * biolatency.bt    Block I/O latency as a histogram. +     3   *                  For Linux, uses bpftrace, eBPF. +     4   * +     5   * This is a bpftrace version of the bcc tool of the same name. +     6   * +     7   * Copyright 2018 Netflix, Inc. +     8   * Licensed under the Apache License, Version 2.0 (the "License") +     9   * +    10   * 13-Sep-2018  Brendan Gregg   Created this. +    11   */ +    12 +    13  BEGIN +    14  { +    15          printf("Tracing block device I/O... Hit Ctrl-C to end.\n"); +    16  } +    17 +    18  kprobe:blk_account_io_start +    19  { +    20          @start[arg0] = nsecs; +    21  } +    22 +    23  kprobe:blk_account_io_done +    24  /@start[arg0]/ +    25 +    26  { +    27          @usecs = hist((nsecs - @start[arg0]) / 1000); +    28          delete(@start[arg0]); +    29  } +    30  +    31  END +    32  { +    33          clear(@start); +    34  } +``` + +It's straightforward, easy to read, and short enough to include on a slide. This version uses kernel dynamic tracing to instrument the **blk_account_io_start()** and **blk_account_io_done()** functions, and it passes a timestamp between them keyed on **arg0** to each. **arg0** on **kprobe** is the first argument to that function, which is the struct request *****, and its memory address is used as a unique identifier. + +#### Example files + +You can see screenshots and explanations of these tools in the [GitHub repo][14] as ***_example.txt** files. For [example][15]: + + +``` +tools# more biolatency_example.txt +Demonstrations of biolatency, the Linux BPF/bpftrace version. + +This traces block I/O, and shows latency as a power-of-2 histogram. For example: + +# biolatency.bt +Attaching 3 probes... +Tracing block device I/O... Hit Ctrl-C to end. +^C + +@usecs: +[256, 512)             2 |                                                    | +[512, 1K)             10 |@                                                   | +[1K, 2K)             426 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| +[2K, 4K)             230 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@                        | +[4K, 8K)               9 |@                                                   | +[8K, 16K)            128 |@@@@@@@@@@@@@@@                                     | +[16K, 32K)            68 |@@@@@@@@                                            | +[32K, 64K)             0 |                                                    | +[64K, 128K)            0 |                                                    | +[128K, 256K)          10 |@                                                   | + +While tracing, this shows that 426 block I/O had a latency of between 1K and 2K +usecs (1024 and 2048 microseconds), which is between 1 and 2 milliseconds. +There are also two modes visible, one between 1 and 2 milliseconds, and another +between 8 and 16 milliseconds: this sounds like cache hits and cache misses. +There were also 10 I/O with latency 128 to 256 ms: outliers. Other tools and +instrumentation, like biosnoop.bt, can shed more light on those outliers. +[...] +``` + +Sometimes it can be most effective to switch straight to the example file when trying to understand these tools, since the output may be self-evident (by design!). + +#### Man pages + +There are also man pages for every tool in the GitHub repo under [/man/man8][16]. They include sections on the output fields and the tool's expected overhead. + + +``` +# nroff -man man/man8/biolatency.8 +biolatency(8)               System Manager's Manual              biolatency(8) + +NAME +       biolatency.bt - Block I/O latency as a histogram. Uses bpftrace/eBPF. + +SYNOPSIS +       biolatency.bt + +DESCRIPTION +       This  tool  summarizes  time  (latency) spent in block device I/O (disk +       I/O) as a power-of-2 histogram. This  allows  the  distribution  to  be +       studied,  including  modes and outliers. There are often two modes, one +       for device cache hits and one for cache misses, which can be  shown  by +       this tool. Latency outliers will also be shown. +[...] +``` + +Writing all these man pages was the least fun part of developing these tools, and some took longer to write than the tool took to develop, but it's nice to see the final result. + +### bpftrace vs. BCC + +Since eBPF has been merging in the kernel, most effort has been placed on the [BCC][6] frontend, which provides a BPF library and Python, C++, and Lua interfaces for writing programs. I've developed a lot of [tools][17] in BCC/Python; it works great, although coding in BCC is verbose. If you're hacking away at a performance issue, bpftrace is better for your one-off custom queries. If you're writing a tool with many command-line options or an agent that uses Python libraries, you'll want to consider using BCC. + +On the Netflix performance team, we use both: BCC for developing canned tools that others can easily use and for developing agents; and bpftrace for ad hoc analysis. The network engineering team has been using BCC to develop an agent for its needs. The security team is most interested in bpftrace for quick ad hoc instrumentation for detecting zero-day vulnerabilities. And I expect the developer teams will use both without knowing it, via the self-service GUIs we are building (Vector), and occasionally may SSH into an instance and run a canned tool or ad hoc bpftrace one-liner. + +### Learn more + + * The [bpftrace][4] repository on GitHub + * The bpftrace [one-liners tutorial][12] + * The bpftrace [reference guide][11] + * The [BCC][6] repository for more complex BPF-based tools + + + +I also have a book coming out this year that covers bpftrace: _[BPF Performance Tools: Linux System and Application Observability][18]_, to be published by Addison Wesley, and which contains many new bpftrace tools. + +* * * + +_Thanks to Alastair Robertson for creating bpftrace, and the bpftrace, BCC, and BPF communities for all the work over the past five years._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/introduction-bpftrace + +作者:[Brendan Gregg][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/brendanghttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) +[2]: https://ajor.co.uk/bpftrace/ +[3]: https://linux.die.net/man/1/iostat +[4]: https://github.com/iovisor/bpftrace +[5]: http://www.brendangregg.com/blog/2018-10-08/dtrace-for-linux-2018.html +[6]: https://github.com/iovisor/bcc +[7]: https://www.linuxplumbersconf.org/ +[8]: https://github.com/iovisor/bpftrace/blob/master/INSTALL.md +[9]: https://github.com/iovisor/bpftrace/releases/tag/v0.9.2 +[10]: https://github.com/iovisor/kubectl-trace +[11]: https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md +[12]: https://github.com/iovisor/bpftrace/blob/master/docs/tutorial_one_liners.md +[13]: https://opensource.com/sites/default/files/uploads/bpftrace_tools_early2019.png (bpftrace/eBPF tools) +[14]: https://github.com/iovisor/bpftrace/tree/master/tools +[15]: https://github.com/iovisor/bpftrace/blob/master/tools/biolatency_example.txt +[16]: https://github.com/iovisor/bcc/tree/master/man/man8 +[17]: https://github.com/iovisor/bcc#tools +[18]: http://www.brendangregg.com/blog/2019-07-15/bpf-performance-tools-book.html diff --git a/sources/tech/20190820 A brief introduction to learning agility.md b/sources/tech/20190820 A brief introduction to learning agility.md new file mode 100644 index 0000000000..08ce7da414 --- /dev/null +++ b/sources/tech/20190820 A brief introduction to learning agility.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A brief introduction to learning agility) +[#]: via: (https://opensource.com/open-organization/19/8/introduction-learning-agility) +[#]: author: (Jen Kelchner https://opensource.com/users/jenkelchnerhttps://opensource.com/users/marcobravohttps://opensource.com/users/jenkelchner) + +A brief introduction to learning agility +====== +The ability to learn and adapt quickly isn't something our hiring +algorithms typically identify. But by ignoring it, we're overlooking +insightful and innovative job candidates. +![Teacher or learner?][1] + +I think everyone can agree that the workplace has changed dramatically in the last decade—or is in the process of changing, depending on where you're currently working. The landscape has evolved. Distributed leadership, project-based work models, and cross-functional solution building are commonplace. In essence, the world is going [open][2]. + +And yet our talent acquisition strategies, development models, and internal systems have shifted little (if at all) to meet the demands these shifts in our external work have created. + +In this three-part series, let's take a look at what is perhaps the game-changing key to acquisition, retention, engagement, innovation, problem-solving, and leadership in this emerging future: learning agility. We'll discuss not only what learning agility _is_, but how your organization's leaders can create space for agile learning on teams and in departments. + +### Algorithmed out of opportunities + +For the last decade, I've freelanced as an independent consultant. Occasionally, when the stress of entrepreneurial, project-based work gets heavy, I search out full-time positions. As I'm sure you know, job searching requires hours of research—and often concludes in dead-ends. On a rare occasion, you find a great fit (the culture looks right and you have every skill the role could need and more!), except for one small thing: a specific educational degree. + +Sticking with these outdated practices puts us in danger of overlooking amazing candidates capable of accelerating innovation and becoming amazing leaders in our organizations. + +More times than I can count, I've gotten "algorithmed out" of even an initial conversation about a new position. What do I mean by that exactly? + +If your specific degree—or, in my case, lack thereof—doesn't meet the one listed, the algorithmically driven job portal spits me back out. I've received a "no thank you" email within thirty seconds of hitting submit. + +So why is calling this out so important? + +Hiring practices have changed very little in both closed _and_ open organizations. Sticking with these outdated practices puts us in danger of overlooking amazing candidates capable of accelerating innovation and becoming amazing leaders in our organizations. + +Developing more inclusive and open hiring processes will require work. For starters, it'll require focus on a key competency so often overlooked as part of more traditional, "closed" processes: Learning agility. + +### Just another buzzword or key performance indicator? + +While "learning agility" [is not a new term][3], it's one that organizations clearly still need help taking into account. Even in open organizations, we tend to overlook this element by focusing too rigidly on a candidate's degree history or _current role_ when we should be taking a more holistic view of the individual. + +One crucial element of [adaptability][4] is learning agility. It is the capacity for adapting to situations and applying knowledge from prior experience—even when you don't know what to do. In short, it's a willingness to learn from all your experiences and then apply that knowledge to tackle new challenges in new situations. + +Every experience we encounter in life can teach us something if we pay attention to it. All of these experiences are educational and useful in organizational life. In fact, as Colin Willis notes in his recent article on [informal learning][5], 70%‒80% of all job-related knowledge isn't learned in formal training programs. And yet we're conditioned to think that _only what you were paid to do in a formal role_ or _the degree you once earned_ speaks solely to your potential value or fit for a particular role. + +Likewise, in extensive research conducted over years, Korn Ferry has shown that learning agility is also a [predictor of long-term performance][6] and leadership potential. In an [article on leadership][7], Korn Ferry notes that "individuals exhibiting high levels of learning agility can adapt quickly in unfamiliar situations and even thrive amid chaos." [Chaos][8]—there's a word I think we would all use to describe the world we live in today. + +Every experience we encounter in life can teach us something if pay attention to it. + +Organizations continue to overlook this critical skill ([too few U.S. companies consider candidates without college degrees][9]), even though it's a proven component of success in a volatile, complex, ambiguous world? Why? + +And as adaptability and collaboration—[two key open principles][2]—sit at the top of the list of job [skills needed in 2019][10], perhaps talent acquisition conversations should stop focusing on _how to measure adaptability_ and shift to _sourcing learning agile people_ so problems can get solved faster. + +### Learning agility has dimensions + +A key to unlocking our adaptability during rapid change is learning agility. Agile people are great at integrating information from their experiences and then using that information to navigate unfamiliar situations. This complex set of skills allows us to draw patterns from one context and apply them to another context. + +So when you're looking for an agile person to join your team, what exactly are you looking for? + +Start with getting to know someone _beyond_ a resume, because learning-agile people have more lessons, more tools, and more solutions in their history that can be valuable when your organization is facing new challenges. + +Next, understand the [five dimensions of learning agility][11], according to Korn Ferry's research. + +**Mental Agility:** This looks like _thinking critically to decipher complex problems and expanding possibilities by seeing new connections_. + +**People Agility:** This looks like _understanding and relating to other people to empower collective performance_. + +**Change Agility**: This looks like _experimentation, being curious, and effectively dealing with uncertainty_. + +**Results Agility:** This looks like _delivering results in first-time situations by inspiring teams and exhibiting a presence that builds confidence in themselves and others_. + +**Self-Awareness:** This looks like _the ability to reflect on oneself, knowing oneself well, and understanding how one's behaviors impact others._ + +While finding someone with all these traits may seem like sourcing a unicorn, you'll find learning agility is more common than you think. In fact, your organization is likely _already_ full of agile people, but your culture and systems don't support agile learning. + +In the next part of this series, we'll explore how you can tap into this crucial skill and create space for agile learning every day. Until then, do what you can to become more aware of the lessons you encounter _today_ that will help you solve problems _tomorrow_. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/8/introduction-learning-agility + +作者:[Jen Kelchner][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/jenkelchnerhttps://opensource.com/users/marcobravohttps://opensource.com/users/jenkelchner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-teacher-learner.png?itok=rMJqBN5G (Teacher or learner?) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: https://www.researchgate.net/publication/321438460_Learning_agility_Its_evolution_as_a_psychological_construct_and_its_empirical_relationship_to_leader_success +[4]: https://opensource.com/open-organization/resources/open-org-maturity-model +[5]: https://opensource.com/open-organization/19/7/informal-learning-adaptability +[6]: https://cmo.cm/2TDofV4 +[7]: https://focus.kornferry.com/leadership-and-talent/learning-agility-a-highly-prized-quality-in-todays-marketplace/ +[8]: https://opensource.com/open-organization/19/6/innovation-delusion +[9]: https://www.cnbc.com/2018/08/16/15-companies-that-no-longer-require-employees-to-have-a-college-degree.html +[10]: https://www.weforum.org/agenda/2019/01/the-hard-and-soft-skills-to-futureproof-your-career-according-to-linkedin/ +[11]: https://www.forbes.com/sites/kevincashman/2013/04/03/the-five-dimensions-of-learning-agile-leaders/#7b003b737457 diff --git a/sources/tech/20190820 A project manager-s guide to Ansible.md b/sources/tech/20190820 A project manager-s guide to Ansible.md new file mode 100644 index 0000000000..e422740ed4 --- /dev/null +++ b/sources/tech/20190820 A project manager-s guide to Ansible.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A project manager's guide to Ansible) +[#]: via: (https://opensource.com/article/19/8/project-managers-guide-ansible) +[#]: author: (Rich Butkevic https://opensource.com/users/rich-butkevic) + +A project manager's guide to Ansible +====== +Ansible is best known for IT automation, but it can streamline +operations across the entire organization. +![Coding on a computer][1] + +From application deployment to provisioning, [Ansible][2] is a powerful open source tool for automating routine IT tasks. It can help an organization's IT run smoothly, with core IT processes networked and maintained. Ansible is an advanced IT orchestration solution, and it can be deployed even over a large, complex network infrastructure. + +### Project management applications for Ansible + +The Ansible platform can improve an entire business' operations by streamlining the company's infrastructure. Apart from directly contributing to the efficiency of the IT team, Ansible also contributes to the productivity and efficiency of development teams. + +As such, it can be used for a number of project management applications: + + * Ansible Tower helps teams manage the entirety of their application lifecycle. It can take applications from development into production, giving teams more control over applications being deployed. + * Ansible Playbook enables teams to keep their applications deployed and properly configured. A Playbook can be easily programmed using Ansible's simple markup language. + * Defined automated security policies allow Ansible to detect and remediate security issues automatically. By automating security policies, the company can improve its security substantially and without increasing its administrative burden. + * Automation and systemization of processes reduce project risk by improving the precision of [project and task estimation][3]. + * Ansible can update applications, reducing the time the team needs to manage and maintain its systems. Keeping applications updated can be a constant time sink, and failing to update applications reduces overall security and productivity. + + + +### Ansible's core benefits + +There are many IT solutions for automating tasks or managing IT infrastructure. But Ansible is so popular because of its advantages over other IT automation solutions: + + 1. Ansible is free. As an open source solution, you don't have to pay for Ansible. Many commercial products require per-seat licensing or annual licensing subscriptions, which can add up. + 2. Ansible doesn't require an agent. It can be installed server-side only, requiring less interaction from end users. Other solutions require both server-side and endpoint installations, which takes a significant amount of time to manage. Not only do end users have to install these solutions on their own devices, but they also need to keep them updated and patched. Ansible doesn't require this type of maintenance. + 3. Ansible is easy to install and manage out of the box. It can be quickly installed, configured, and customized, so organizations can begin reaping its benefits in managing and monitoring IT solutions immediately. + 4. Ansible is flexible and can automate and control many types of IT tasks. The Ansible Playbook makes it easy to quickly code new tasks in a human-readable scripting language. Many other automation solutions require in-depth knowledge of programming languages, possibly even learning a proprietary programming language. + 5. Ansible has an active community with nearly 3,000 contributors contributing to the project. The robust open source community provides pre-programmed solutions and answers for more niche problems. Ansible's community ensures that it is stable, reliable, and constantly growing. + 6. Ansible is versatile and can be used in virtually any IT environment. Since it is both reliable and scalable, it is suitable for rapidly growing network environments. + + + +### Ansible makes IT automation easier + +Ansible is an out-of-the-box, open source automation solution that can schedule tasks and manage configurations over complex networks. Although it's intuitive and easy to use, it's also very robust; it has its own scripting language that can be used to program more complex functionality. + +As an open source tool, Ansible is cost-effective and well-supported. The Ansible community is large and active, providing solutions for most common use cases and providing support as needed. Companies working towards IT automation can begin with an Ansible deployment and save a significant amount of money and time compared to commercial solutions. + +For project managers, it's important to know that deploying Ansible will improve the effectiveness of a company's IT. Employees will spend less time trying to troubleshoot their own configuration, deployment, and provisioning. Ansible is designed to be a straightforward, reliable way to automate a network's IT tasks. + +Further, development teams can use the Ansible Tower to track applications from development to production. Ansible Tower includes everything from role-based access to graphical inventory management and enables teams to remain on the same page even with complex tasks. + +Ansible has a number of fantastic use cases and provides substantial productivity gains for both internal teams and the IT infrastructure as a whole. It's free, easy to use, and robust. By automating IT with Ansible, project managers will find that their teams can work more effectively without the burden of having to manage their own IT—and that IT works more smoothly overall. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/project-managers-guide-ansible + +作者:[Rich Butkevic][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/rich-butkevic +[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]: https://www.ansible.com/ +[3]: https://www.projecttimes.com/articles/avoiding-the-planning-fallacy-improving-your-project-estimates.html diff --git a/sources/tech/20190820 Go compiler intrinsics.md b/sources/tech/20190820 Go compiler intrinsics.md new file mode 100644 index 0000000000..f381a0073a --- /dev/null +++ b/sources/tech/20190820 Go compiler intrinsics.md @@ -0,0 +1,307 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go compiler intrinsics) +[#]: via: (https://dave.cheney.net/2019/08/20/go-compiler-intrinsics) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Go compiler intrinsics +====== + +Go allows authors to write functions in assembly if required. This is called a _stub_ or _forward_ declaration. + +``` +package asm + +// Add returns the sum of a and b. +func Add(a int64, b int64) int64 +``` + +Here we’re declaring `Add`, a function which takes two `int64`‘s and returns their sum.`Add` is a normal Go function declaration, except it is missing the function body. + +If we were to try to compile this package the compiler, justifiably, complains; + +``` +% go build +examples/asm +./decl.go:4:6: missing function body +``` + +To satisfy the compiler we must supply a body for `Add` via assembly, which we do by adding a `.s` file in the same package. + +``` +TEXT ·Add(SB),$0-24 + MOVQ a+0(FP), AX + ADDQ b+8(FP), AX + MOVQ AX, ret+16(FP) + RET +``` + +Now we can build, test, and use our `Add` function just like normal Go code. But, there’s a problem, assembly functions cannot be inlined. + +This has long been a complaint by Go developers who want to use assembly either for performance or to access operations which are not exposed in the language. Some examples would be vector instructions, atomic instructions, and so on. Without the ability to inline assembly functions writing these functions in Go can have a relatively large overhead. + +``` +var Result int64 + +func BenchmarkAddNative(b *testing.B) { + var r int64 + for i := 0; i < b.N; i++ { + r = int64(i) + int64(i) + } + Result = r +} + +func BenchmarkAddAsm(b *testing.B) { + var r int64 + for i := 0; i < b.N; i++ { + r = Add(int64(i), int64(i)) + } + Result = r + } +``` + +``` +BenchmarkAddNative-8    1000000000               0.300 ns/op +BenchmarkAddAsm-8       606165915                1.93 ns/op +``` + +Over the years there have been various proposals for an inline assembly syntax similar to gcc’s `asm(...)` directive. None have been accepted by the Go team. Instead, Go has added _intrinsic functions_[1][1]. + +An intrinsic function is Go code written in regular Go. These functions are known the the Go compiler which contains replacements which it can substitute during compilation. As of Go 1.13 the packages which the compiler knows about are: + + * `math/bits` + * `sync/atomic` + + + +The functions in these packages have baroque signatures but this lets the compiler, if your architecture supports a more efficient way of performing the operation, transparently replace the function call with comparable native instructions. + +For the remainder of this post we’ll study two different ways the Go compiler produces more efficient code using intrinsics. + +### Ones count + +Population count, the number of `1` bits in a word, is an important cryptographic and compression primitive. Because this is an important operation most modern CPUs provide a native hardware implementation. + +The `math/bits` package exposes support for this operation via the `OnesCount` series of functions. The various `OnesCount` functions are recognised by the compiler and, depending on the CPU architecture and the version of Go, will be replaced with the native hardware instruction. + +To see how effective this can be lets compare three different ones count implementations. The first is Kernighan’s Algorithm[2][2]. + +``` +func kernighan(x uint64) int { + var count int + for ; x > 0; x &= (x - 1) { + count++ +       } +       return count                 +}     +``` + +This algorithm has a maximum loop count of the number of bits set; the more bits set, the more loops it will take. + +The second algorithm is taken from Hacker’s Delight via [issue 14813][3]. + +``` +func hackersdelight(x uint64) int { + const m1 = 0x5555555555555555 + const m2 = 0x3333333333333333 + const m4 = 0x0f0f0f0f0f0f0f0f + const h01 = 0x0101010101010101 + + x -= (x >> 1) & m1 + x = (x & m2) + ((x >> 2) & m2) + x = (x + (x >> 4)) & m4 + return int((x * h01) >> 56) + } +``` + +Lots of clever bit twiddling allows this version to run in constant time and optimises very well if the input is a constant (the whole thing optimises away if the compiler can figure out the answer at compiler time). + +Let’s benchmark these implementations against `math/bits.OnesCount64`. + +``` +var Result int + +func BenchmarkKernighan(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = kernighan(uint64(i)) + } + Result = r +} + +func BenchmarkPopcnt(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = hackersdelight(uint64(i)) + } + Result = r +} + +func BenchmarkMathBitsOnesCount64(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = bits.OnesCount64(uint64(i)) + } + Result = r +} +``` + +To keep it fair, we’re feeding each function under test the same input; a sequence of integers from zero to `b.N`. This is fairer to Kernighan’s method as its runtime increases with the number of one bits in the input argument.[3][4] + +``` +BenchmarkKernighan-8                    100000000               11.2 ns/op +BenchmarkPopcnt-8                       618312062                2.02 ns/op +BenchmarkMathBitsOnesCount64-8          1000000000               0.565 ns/op +``` + +The winner by nearly 4x is `math/bits.OnesCount64`, but is this really using a hardware instruction, or is the compiler just doing a better job at optimising this code? Let’s check the assembly + +``` +% go test -c +% go tool objdump -s MathBitsOnesCount popcnt-intrinsic.test +TEXT examples/popcnt-intrinsic.BenchmarkMathBitsOnesCount64(SB) /examples/popcnt-intrinsic/popcnt_test.go +   popcnt_test.go:45     0x10f8610               65488b0c2530000000      MOVQ GS:0x30, CX +   popcnt_test.go:45     0x10f8619               483b6110                CMPQ 0x10(CX), SP +   popcnt_test.go:45     0x10f861d               7668                    JBE 0x10f8687 +   popcnt_test.go:45     0x10f861f               4883ec20                SUBQ $0x20, SP +   popcnt_test.go:45     0x10f8623               48896c2418              MOVQ BP, 0x18(SP) +   popcnt_test.go:45     0x10f8628               488d6c2418              LEAQ 0x18(SP), BP +   popcnt_test.go:47     0x10f862d               488b442428              MOVQ 0x28(SP), AX +   popcnt_test.go:47     0x10f8632               31c9                    XORL CX, CX +   popcnt_test.go:47     0x10f8634               31d2                    XORL DX, DX +   popcnt_test.go:47     0x10f8636               eb03                    JMP 0x10f863b +   popcnt_test.go:47     0x10f8638               48ffc1                  INCQ CX +   popcnt_test.go:47     0x10f863b               48398808010000          CMPQ CX, 0x108(AX) +   popcnt_test.go:47     0x10f8642               7e32                    JLE 0x10f8676 +   popcnt_test.go:48     0x10f8644               803d29d5150000          CMPB $0x0, runtime.x86HasPOPCNT(SB) +   popcnt_test.go:48     0x10f864b               740a                    JE 0x10f8657 +   popcnt_test.go:48     0x10f864d               4831d2                  XORQ DX, DX +   popcnt_test.go:48     0x10f8650               f3480fb8d1              POPCNT CX, DX // math/bits.OnesCount64 +   popcnt_test.go:48     0x10f8655               ebe1                    JMP 0x10f8638 +   popcnt_test.go:47     0x10f8657               48894c2410              MOVQ CX, 0x10(SP) +   popcnt_test.go:48     0x10f865c               48890c24                MOVQ CX, 0(SP) +   popcnt_test.go:48     0x10f8660               e87b28f8ff              CALL math/bits.OnesCount64(SB) +   popcnt_test.go:48     0x10f8665               488b542408              MOVQ 0x8(SP), DX +   popcnt_test.go:47     0x10f866a               488b442428              MOVQ 0x28(SP), AX +   popcnt_test.go:47     0x10f866f               488b4c2410              MOVQ 0x10(SP), CX +   popcnt_test.go:48     0x10f8674               ebc2                    JMP 0x10f8638 +   popcnt_test.go:50     0x10f8676               48891563d51500          MOVQ DX, examples/popcnt-intrinsic.Result(SB) +   popcnt_test.go:51     0x10f867d               488b6c2418              MOVQ 0x18(SP), BP +   popcnt_test.go:51     0x10f8682               4883c420                ADDQ $0x20, SP +   popcnt_test.go:51     0x10f8686               c3                      RET +   popcnt_test.go:45     0x10f8687               e884eef5ff              CALL runtime.morestack_noctxt(SB) +   popcnt_test.go:45     0x10f868c               eb82                    JMP examples/popcnt-intrinsic.BenchmarkMathBitsOnesCount64(SB) +   :-1                   0x10f868e               cc                      INT $0x3 +   :-1                   0x10f868f               cc                      INT $0x3 +``` + +There’s quite a bit going on here, but the key take away is on line 48 (taken from the source code of the `_test.go` file) the program is using the x86 `POPCNT` instruction as we hoped. This turns out to be faster than bit twiddling. + +Of interest is the comparison two instructions prior to the `POPCNT`, + +``` +CMPB $0x0, runtime.x86HasPOPCNT(SB) +``` + +As not all intel CPUs support `POPCNT` the Go runtime records at startup if the CPU has the necessary support and stores the result in `runtime.x86HasPOPCNT`. Each time through the benchmark loop the program is checking _does the CPU have POPCNT support_ before it issues the `POPCNT` request. + +The value of `runtime.x86HasPOPCNT` isn’t expected to change during the life of the program’s execution so the result of the check should be highly predictable making the check relatively cheap. + +### Atomic counter + +As well as generating more efficient code, intrinsic functions are just regular Go code, the rules of inlining (including mid stack inlining) apply equally to them. + +Here’s an example of an atomic counter type. It’s got methods on types, method calls several layers deep, multiple packages, etc. + +``` +import ( + "sync/atomic" +) + +type counter uint64 + +func (c counter) get() uint64 { + return atomic.LoadUint64((uint64)(c)) +} + +func (c counter) inc() uint64 { + return atomic.AddUint64((uint64)(c), 1) +} + +func (c counter) reset() uint64 { + return atomic.SwapUint64((uint64)(c), 0) +} + +var c counter + +func f() uint64 { + c.inc() + c.get() + return c.reset() +} +``` + +You’d be forgiven for thinking this would have a lot of overhead. However, because of the interaction between inlining and compiler intrinsics, this code collapses down to efficient native code on most platforms. + +``` +TEXT main.f(SB) examples/counter/counter.go +   counter.go:23         0x10512e0               90                      NOPL +   counter.go:29         0x10512e1               b801000000              MOVL $0x1, AX +   counter.go:13         0x10512e6               488d0d0bca0800          LEAQ main.c(SB), CX +   counter.go:13         0x10512ed               f0480fc101              LOCK XADDQ AX, 0(CX) // c.inc +   counter.go:24         0x10512f2               90                      NOPL +   counter.go:10         0x10512f3               488b05fec90800          MOVQ main.c(SB), AX // c.get +   counter.go:25         0x10512fa               90                      NOPL +   counter.go:16         0x10512fb               31c0                    XORL AX, AX +   counter.go:16         0x10512fd               488701                  XCHGQ AX, 0(CX) // c.reset +   counter.go:16         0x1051300               c3                      RET +``` + +By way of explanation. The first operation, `counter.go:13` is `c.inc` a `LOCK`ed `XADDQ`, which on x86 is an atomic increment. The second, `counter.go:10` is `c.get` which on x86, due to its strong memory consistency model, is a regular load from memory. The final operation, `counter.go:16`, `c.reset` is an atomic exchange of the address in `CX` with `AX` which was zeroed on the previous line. This puts the value in `AX`, zero, into the address stored in `CX`. The value previously stored at `(CX)` is discarded. + +### Conclusion + +Intrinsics are a neat solution that give Go programmers access to low level architectural operations without having to extend the specification of the language. If an architecture doesn’t have a specific `sync/atomic` primitive (like some ARM variants), or a `math/bits` operation, then the compiler transparently falls back to the operation written in pure Go. + + 1. This may not be their official name, however the word is in common use inside the compiler and its tests[][5] + 2. The C Programming Language 2nd Ed, 1998[][6] + 3. As extra credit homework, try passing `0xdeadbeefdeadbeef` to each function under test and observe the results.[][7] + + + +#### Related posts: + + 1. [Notes on exploring the compiler flags in the Go compiler suite][8] + 2. [Padding is hard][9] + 3. [Should methods be declared on T or *T][10] + 4. [Wednesday pop quiz: spot the race][11] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/08/20/go-compiler-intrinsics + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: tmp.OyARdRB2s8#easy-footnote-bottom-1-3803 (This may not be their official name, however the word is in common use inside the compiler and its tests) +[2]: tmp.OyARdRB2s8#easy-footnote-bottom-2-3803 (The C Programming Language 2nd Ed, 1998) +[3]: https://github.com/golang/go/issues/14813 +[4]: tmp.OyARdRB2s8#easy-footnote-bottom-3-3803 (As extra credit homework, try passing 0xdeadbeefdeadbeef to each function under test and observe the results.) +[5]: tmp.OyARdRB2s8#easy-footnote-1-3803 +[6]: tmp.OyARdRB2s8#easy-footnote-2-3803 +[7]: tmp.OyARdRB2s8#easy-footnote-3-3803 +[8]: https://dave.cheney.net/2012/10/07/notes-on-exploring-the-compiler-flags-in-the-go-compiler-suite (Notes on exploring the compiler flags in the Go compiler suite) +[9]: https://dave.cheney.net/2015/10/09/padding-is-hard (Padding is hard) +[10]: https://dave.cheney.net/2016/03/19/should-methods-be-declared-on-t-or-t (Should methods be declared on T or *T) +[11]: https://dave.cheney.net/2015/11/18/wednesday-pop-quiz-spot-the-race (Wednesday pop quiz: spot the race) diff --git a/sources/tech/20190820 The infrastructure is code- A story of COBOL and Go.md b/sources/tech/20190820 The infrastructure is code- A story of COBOL and Go.md new file mode 100644 index 0000000000..629d36ee31 --- /dev/null +++ b/sources/tech/20190820 The infrastructure is code- A story of COBOL and Go.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The infrastructure is code: A story of COBOL and Go) +[#]: via: (https://opensource.com/article/19/8/command-line-heroes-cobol-golang) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg) + +The infrastructure is code: A story of COBOL and Go +====== +COBOL remains the dominant language of mainframes. What can Go learn +from its history to dominate the cloud? +![Listen to the Command Line Heroes Podcast][1] + +Old challenges are new again. In [this week's Command Line Heroes podcast][2] (Season 3, Episode 5), that thought comes with a twist of programming languages and platforms. + +### COBOL dominates the mainframe + +One of the most brilliant minds in all of computer science is [Grace Murray Hopper][3]. Every time we don't have to write in binary to talk to computers, I recommend saying out loud: "Thank you, Rear Admiral Grace Murray Hopper." Try it next time, for she is the one who invented the first compiler (the software that translates programming code to machine language). + +Hopper was essential to the invention and adoption of high-level programming languages, the first of which was COBOL. She helped create the **CO**mmon **B**usiness-**O**riented **L**anguage (COBOL for short) in 1959. As Ritika Trikha put it on [HackerRank][4]: + +> "Grace Hopper, the mother of COBOL, helped champion the creation of this brand-new programming language that aimed to function across all business systems, saving an immense amount of time and money. Hopper was also the first to believe that programming languages should read just like English instead of computer jargon. Hence why COBOL's syntax is so wordy. But it helped humanize the computing process for businesses during an era when computing was intensive and prevalent only in research facilities." + +In the early 1960s, mainframes were a wild new architecture for sharing powerful amounts of computation. And in the era of mainframe computing, COBOL dominated the landscape. + +### COBOL in today's world + +But what about today? With the decline of mainframes and the rise of newer and more innovative languages designed for the web and cloud, where does COBOL sit? + +As last week's episode of Command Line Heroes mentioned, in the late 1990s, [Perl][5] (as well as JavaScript and C++) was outpacing COBOL. And, as Perl's creator, [Larry Wall stated then][6]: "COBOL is no big deal these days since demand for COBOL seems to be trailing off, for some strange reason." + +Fast forward to 2019, and COBOL has far from "trailed off." As David Cassel wrote on [The New Stack][7] in 2017: + +> "About 95% of ATM swipes use COBOL code, Reuters [reported in April][8], and the 58-year-old language even powers 80% of in-person transactions. In fact, Reuters calculates that there's still 220 billion lines of COBOL code currently being used in production today, and that every day, COBOL systems handle $3 trillion in commerce." + +Given its continued significance in the business world, knowing COBOL can be a great career move. Top COBOL programmers can expect to [make six figures][9] due to the limited number of people who specialize in the language. + +### Go dominates in the cloud, for now + +That story of COBOL's early dominance rings a bell for me. If we survey the most influential projects of this cloud computing era, you'd be hard-pressed to miss Go sitting at the top of the pack. Kubernetes and much of its related technology—from Etcd to Prometheus—are written in Go. As [RedMonk explored][10] back in 2014: + +> "Go's rapidly closing in on 1% of total commits and half a percent of projects and contributors. While the trend is obviously interesting, at first glance, numbers well under one percent look inconsequential relative to overall adoption. To provide some context, however, each of the most popular languages on Ohloh (C, C++, Java, JavaScript) only constitute ~10% of commits and ~5% of projects and contributors. **That means Go, a seemingly very minor player, is already used nearly one-tenth as much in FOSS as the most popular languages in existence**." + +In two of my previous jobs, my team (re)wrote infrastructure software in Go to be part of this monumental wave. Influential projects continue to live in the space that Go can fill, as [Uday Hiwarale explained][11] well in 2018: + +> "Things that make Go a great language [are] its simple concurrency model, its package-based code management, and its non-strict (type inference) typing system. Go does not support out-of-the box object-oriented programming experience, but [its] support structures (structs) …, with the help of methods and pointers, can help us achieve the same [outcomes]." + +It looks to me like Go could be following in COBOL's footsteps, but questions remain about where it's going. In June 2019, [RedMonk ranked][12] Go in 16th place, with a future that could lead either direction. + +### What can Go learn from COBOL? + +If Go were to see into its future, would it look like COBOL's, with such staying power? + +The stories told this season by Command Line Heroes illustrate how languages are born, how communities form around them, how they rise in popularity and standardize, and how some slowly decline. What can we learn about the lifespan of programming languages? Do they have a similar arc? Or do they differ? + +I think this podcast is well worth [subscribing so that you don't miss a single one][2]. I would love to hear your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/command-line-heroes-cobol-golang + +作者:[Matthew Broberg][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/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command-line-heroes-520x292.png?itok=s_F6YEoS (Listen to the Command Line Heroes Podcast) +[2]: https://www.redhat.com/en/command-line-heroes +[3]: https://www.biography.com/scientist/grace-hopper +[4]: https://blog.hackerrank.com/the-inevitable-return-of-cobol/ +[5]: https://opensource.com/article/19/8/command-line-heroes-perl +[6]: http://www.wall.org/~larry/onion3/talk.html +[7]: https://thenewstack.io/cobol-everywhere-will-maintain/ +[8]: http://fingfx.thomsonreuters.com/gfx/rngs/USA-BANKS-COBOL/010040KH18J/index.html +[9]: https://www.laserfiche.com/ecmblog/looking-job-hows-your-cobol/ +[10]: https://redmonk.com/dberkholz/2014/03/18/go-the-emerging-language-of-cloud-infrastructure/ +[11]: https://medium.com/rungo/introduction-to-go-programming-language-golang-89d16ca72bbf +[12]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ diff --git a/sources/tech/20190821 5 notable open source 3D printers.md b/sources/tech/20190821 5 notable open source 3D printers.md new file mode 100644 index 0000000000..6424143ad2 --- /dev/null +++ b/sources/tech/20190821 5 notable open source 3D printers.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 notable open source 3D printers) +[#]: via: (https://opensource.com/article/19/8/3D-printers) +[#]: author: (Michael Weinberg https://opensource.com/users/mweinberg) + +5 notable open source 3D printers +====== +A roundup of the latest notable open source 3D printers. +![Open source 3D printed coin][1] + +Open source hardware and 3D printers go together like, well, open source hardware and 3D printers. Not only are 3D printers used to create all sorts of open source hardware—there are also a huge number of 3D printers that have been [certified as open source][2] by the [Open Source Hardware Association][3]. That fact means that they are freely available to improve and build upon. + +There are plenty of open source 3D printers out there, with more being certified on a regular basis. Here’s a look at some of the latest. + +### BigFDM + +![The BigFDM 3D printer by Daniele Ingrassia.][4] + +_The BigFDM 3D printer by Daniele Ingrassia._ + +German-designed and UAE-built, the [Big FDM][5] is both the second-newest and the biggest certified open 3D printer. It was certified on July 14, and has a massive 800x800x900mm printing area, making it possibly big enough to print a full replica of many of the other printers on this list. + +### Creatable 3D + +![The Creatable 3D printer by Creatable Labs.][6] + +_The Creatable 3D printer by Creatable Labs._ + +Certified on July 30, the [Creatable 3D][7] is the most recently certified printer on this list. It is the only [delta-style][8] 3D printer, which is a design that makes it faster. It is also the first piece of certified open source hardware from South Korea, sporting the certification UID SK000001. + +### Ender CR-10 + +![The Ender CR-10 3D printer by Creality3d.][9] + +_The Ender CR-10 3D printer by Creality3d._ + +[Ender’s CR-10][10] is a well-known certified as open source 3D printer. That means that this Chinese 3D printer is fully documented and licensed to allow others to build upon it. Ender also certified its [Ender 3][11] printer as open source hardware. + +### LulzBot TAZ Workhorse + +![The LulzBot TAZ Workhorse by Aleph Objects.][12] + +_The LulzBot TAZ Workhorse by Aleph Objects._ + +Colorado-based Aleph Objects—creators of the LulzBot line of 3D printers—is the most prolific certifier of open source 3D printers and printer components. Their [TAZ Workhorse][13] was just certified in June, making it the latest in a long line of printers and printer elements that LulzBot has certified as open source hardware. If you are in the market for a hot end, extruder, board, or pretty much any other 3D printer component, and want to make sure that it is certified open source hardware, you will likely find something from Aleph Objects in their [certification directory][2]. + +### Nautilus + +![The Nautilus 3D printer by Hydra Research.][14] + +_The Nautilus 3D printer by Hydra Research._ + +Hydra Research’s [Nautilus][15] was just certified on July 10, making it the third-most recently certified printer of the bunch. It features removable build plates and a fully enclosed build area and hails from Oregon. + +#### IC3D open source filament + +![IC3D open source 3D printer filament.][16] + +_The IC3D Open Source Filament._ + +What will you put in your open source 3D printer? Open source 3D printing filament, of course. Ohio’s IC3D certified a full line of open source 3D printing filament for all of your open source 3D printing needs, including their: + + * [ABS 3D Printing Filament][17] + * [PETG 3D Printing Filament][18] + * [PLA 3D Printing Filament][19] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/3D-printers + +作者:[Michael Weinberg][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/mweinberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_source_print_resize.jpg?itok=v6z2FtLS (Open source 3D printed coin) +[2]: https://certification.oshwa.org/list.html +[3]: https://www.oshwa.org/ +[4]: https://opensource.com/sites/default/files/uploads/bigfdm.png (The BigFDM 3D printer by Daniele Ingrassia.) +[5]: https://certification.oshwa.org/de000013.html +[6]: https://opensource.com/sites/default/files/uploads/creatable_3d.png (The Creatable 3D printer by Creatable Labs.) +[7]: https://certification.oshwa.org/kr000001.html +[8]: https://www.youtube.com/watch?v=BTU6UGm15Zc +[9]: https://opensource.com/sites/default/files/uploads/ender_cr-10.png (The Ender CR-10 3D printer by Creality3d.) +[10]: https://certification.oshwa.org/cn000005.html +[11]: https://certification.oshwa.org/cn000003.html +[12]: https://opensource.com/sites/default/files/uploads/lulzbot_taz_workhorse.png (The LulzBot TAZ Workhorse by Aleph Objects.) +[13]: https://certification.oshwa.org/us000161.html +[14]: https://opensource.com/sites/default/files/uploads/hydra_research_nautilus.png (The Nautilus 3D printer by Hydra Research.) +[15]: https://certification.oshwa.org/us000166.html +[16]: https://opensource.com/sites/default/files/uploads/ic3d_open_source_filament.png (The IC3D Open Source Filament.) +[17]: https://certification.oshwa.org/us000066.html +[18]: https://certification.oshwa.org/us000131.html +[19]: https://certification.oshwa.org/us000130.html diff --git a/sources/tech/20190821 Build a distributed NoSQL database with Apache Cassandra.md b/sources/tech/20190821 Build a distributed NoSQL database with Apache Cassandra.md new file mode 100644 index 0000000000..bfb90d51a1 --- /dev/null +++ b/sources/tech/20190821 Build a distributed NoSQL database with Apache Cassandra.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a distributed NoSQL database with Apache Cassandra) +[#]: via: (https://opensource.com/article/19/8/how-set-apache-cassandra-cluster) +[#]: author: (James Farrell https://opensource.com/users/jamesfhttps://opensource.com/users/ben-bromhead) + +Build a distributed NoSQL database with Apache Cassandra +====== +Set up a basic three-node Cassandra cluster from scratch with some extra +bits for replication and future expansion. +![Woman programming][1] + +Recently, I got a rush request to get a three-node [Apache Cassandra][2] cluster with a replication factor of two working for a development job. I had little idea what that meant but needed to figure it out quickly—a typical day in a sysadmin's job. + +Here's how to set up a basic three-node Cassandra cluster from scratch with some extra bits for replication and future node expansion. + +### Basic nodes needed + +To start, you need some basic Linux machines. For a production install, you would likely put physical machines into racks, data centers, and diverse locations. For development, you just need something suitably sized for the scale of your development. I used three CentOS 7 virtual machines on VMware that have 20GB thin provisioned disks, two processors, and 4GB of RAM. These three machines are called: CS1 (192.168.0.110), CS2 (192.168.0.120), and CS3 (192.168.0.130). + +First, do a minimal install of CentOS 7 as an operating system on each machine. To run this in production with CentOS, consider [tweaking][3] your [firewalld][4] and [SELinux][5]. Since this cluster would be used just for initial development, I turned them off. + +The only other requirement is an OpenJDK 1.8 installation, which is available from the CentOS repository. + +### Installation + +Create a **cass** user account on each machine. To ensure no variation between nodes, force the same UID on each install: + + +``` +$ useradd --create-home \ +\--uid 1099 cass +$ passwd cass +``` + +[Download][6] the current version of Apache Cassandra (3.11.4 as I'm writing this). Extract the Cassandra archive in the **cass** home directory like this: + + +``` +`$ tar zfvx apache-cassandra-3.11.4-bin.tar.gz` +``` + +The complete software is contained in **~cass/apache-cassandra-3.11.4**. For a quick development trial, this is fine. The data files are there, and the **conf/** directory has the important bits needed to tune these nodes into a real cluster. + +### Configuration + +Out of the box, Cassandra runs as a localhost one-node cluster. That is convenient for a quick look, but the goal here is a real cluster that external clients can access and that provides the option to add additional nodes when development and tests need to broaden. The two configuration files to look at are **conf/cassandra.yaml** and **conf/cassandra-rackdc.properties**. + +First, edit **conf/cassandra.yaml** to set the cluster name, network, and remote procedure call (RPC) interfaces; define peers; and change the strategy for routing requests and replication. + +Edit **conf/cassandra.yaml** on each of the cluster nodes. + +Change the cluster name to be the same on each node:  + + +``` +`cluster_name: 'DevClust'` +``` + +Change the following two entries to match the primary IP address of the node you are working on: + + +``` +listen_address: 192.168.0.110 +rpc_address:  192.168.0.110 +``` + +Find the **seed_provider** entry and look for the **\- seeds:** configuration line. Edit each node to include all your nodes: + + +``` +`        - seeds: "192.168.0.110, 192.168.0.120, 192.168.0.130"` +``` + +This enables the local Cassandra instance to see all its peers (including itself). + +Look for the **endpoint_snitch** setting and change it to: + + +``` +`endpoint_snitch: GossipingPropertyFileSnitch` +``` + +The **endpoint_snitch** setting enables flexibility later on if new nodes need to be joined. The Cassandra documentation indicates that **GossipingPropertyFileSnitch** is the preferred setting for production use; it is also necessary to set the replication strategy that will be presented below. + +Save and close the **cassandra.yaml** file. + +Open the **conf/cassandra-rackdc.properties** file and change the default values for **dc=** and **rack=**. They can be anything that is unique and does not conflict with other local installs. For production, you would put more thought into how to organize your racks and data centers. For this example, I used generic names like: + + +``` +dc=NJDC +rack=rack001 +``` + +### Start the cluster + +On each node, log into the account where Cassandra is installed (**cass** in this example), enter **cd apache-cassandra-3.11.4/bin**, and run **./cassandra**. A long list of messages will print to the terminal, and the Java process will run in the background. + +### Confirm the cluster + +While logged into the Cassandra user account, go to the **bin** directory and run **$ ./nodetool status**. If everything went well, you would see something like: + + +``` +$ ./nodetool status +INFO  [main] 2019-08-04 15:14:18,361 Gossiper.java:1715 - No gossip backlog; proceeding +Datacenter: NJDC +================ +Status=Up/Down +|/ State=Normal/Leaving/Joining/Moving +\--  Address       Load       Tokens       Owns (effective)  Host ID                               Rack +UN  192.168.0.110  195.26 KiB  256          69.2%             0abc7ad5-6409-4fe3-a4e5-c0a31bd73349  rack001 +UN  192.168.0.120  195.18 KiB  256          63.0%             b7ae87e5-1eab-4eb9-bcf7-4d07e4d5bd71  rack001 +UN  192.168.0.130  117.96 KiB  256          67.8%             b36bb943-8ba1-4f2e-a5f9-de1a54f8d703  rack001 +``` + +This means the cluster sees all the nodes and prints some interesting information. + +Note that if **cassandra.yaml** uses the default **endpoint_snitch: SimpleSnitch**, the **nodetool** command above indicates the default locations as **Datacenter: datacenter1** and the racks as **rack1**. In the example output above, the **cassandra-racdc.properties** values are evident. + +### Run some CQL + +This is where the replication factor setting comes in. + +Create a keystore with a replication factor of two. From any one of the cluster nodes, go to the **bin** directory and run **./cqlsh 192.168.0.130** (substitute the appropriate cluster node IP address). You can see the default administrative keyspaces with the following: + + +``` +cqlsh> SELECT * FROM system_schema.keyspaces; + + keyspace_name      | durable_writes | replication +\--------------------+----------------+------------------------------------------------------------------------------------- +        system_auth |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '1'} +      system_schema |           True |                             {'class': 'org.apache.cassandra.locator.LocalStrategy'} + system_distributed |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} +             system |           True |                             {'class': 'org.apache.cassandra.locator.LocalStrategy'} +      system_traces |           True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '2'} +``` + +Create a new keyspace with replication factor two, insert some rows, then recall some data: + + +``` +cqlsh> CREATE KEYSPACE TestSpace WITH replication = {'class': 'NetworkTopologyStrategy', 'NJDC' : 2}; +cqlsh> select * from system_schema.keyspaces where keyspace_name='testspace'; + + keyspace_name | durable_writes | replication +\---------------+----------------+-------------------------------------------------------------------------------- +     testspace |           True | {'NJDC': '2', 'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy'} +cqlsh> use testspace; +cqlsh:testspace> create table users ( userid int PRIMARY KEY, email text, name text ); +cqlsh:testspace> insert into users (userid, email, name) VALUES (1, '[jd@somedomain.com][7]', 'John Doe'); +cqlsh:testspace> select * from users; + + userid | email             | name +\--------+-------------------+---------- +      1 | [jd@somedomain.com][7] | John Doe +``` + +Now you have a basic three-node Cassandra cluster running and ready for some development and testing work. The CQL syntax is similar to standard SQL, as you can see from the familiar commands to create a table, insert, and query data. + +### Conclusion + +Apache Cassandra seems like an interesting NoSQL clustered database, and I'm looking forward to diving deeper into its use. This simple setup only scratches the surface of the options available. I hope this three-node primer helps you get started with it, too. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-set-apache-cassandra-cluster + +作者:[James Farrell][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/jamesfhttps://opensource.com/users/ben-bromhead +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: http://cassandra.apache.org/ +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd +[5]: https://opensource.com/business/13/11/selinux-policy-guide +[6]: https://cassandra.apache.org/download/ +[7]: mailto:jd@somedomain.com diff --git a/sources/tech/20190821 Open Policy Agent- Cloud-native security and compliance.md b/sources/tech/20190821 Open Policy Agent- Cloud-native security and compliance.md new file mode 100644 index 0000000000..acde3fc805 --- /dev/null +++ b/sources/tech/20190821 Open Policy Agent- Cloud-native security and compliance.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Policy Agent: Cloud-native security and compliance) +[#]: via: (https://opensource.com/article/19/8/open-policy-agent) +[#]: author: (Tim Hinrichs https://opensource.com/users/thinrich) + +Open Policy Agent: Cloud-native security and compliance +====== +A look at three use cases where organizations used Open Policy Agent to +reliably automate cloud-based access policy control. +![clouds in the sky with blue pattern][1] + +Every product or service has a unique way of handling policy and authorization: who-can-do-what and what-can-do-what. In the cloud-native world, authorization and policy are more complex than ever before. As the cloud-native ecosystem evolves, there’s a growing need for DevOps and DevSecOps teams to identify and address security and compliance issues earlier in development and deployment cycles. Businesses need to release software on the order of minutes (instead of months). For this to happen, those security and compliance policies—which in the past were written in PDFs or email—need to be checked and enforced by machines. That way, every few minutes when software goes out the door, it’s obeying all of the necessary policies. + +This problem was at the top of our minds when Teemu Koponen, Torin Sandall, and I founded the [Open Policy Agent project (OPA)][2] as a practical solution for the critical security and policy challenges of the cloud-native ecosystem. As the list of OPA’s successful integrations grows—thanks to active involvement by the open source community—the time is right to re-introduce OPA and offer a look at how it addresses business and policy pain points in varied contexts. + +### What is OPA? + +OPA is a general-purpose policy engine that makes policy a first-class citizen within the cloud-native ecosystem, putting it on par with servers, networks, and storage. Its uses range from authorization and admission control to data filtering. The community uses OPA for Kubernetes admission control across all major cloud providers, as well as on on-premises deployments, along with HTTP API authorization, remote access policy, and data filtering. Since OPA’s RESTful APIs use JSON over HTTP, OPA can be integrated with any programming language, making it extremely flexible across services. + +OPA gives policy its own lifecycle and toolsets, so policy can be managed separately from the underlying systems that the policy applies to. Launched in 2016, OPA provides local enforcement for the sake of higher availability, better performance, greater flexibility, and more expressiveness than hard-coded service logic or ad-hoc domain-specific languages. With dedicated tooling for new users and experienced practitioners, combined with many integrations to third-party systems, OPA empowers administrators with unified, flexible, and granular policy control across their entire software stack. OPA also provides policy guardrails around Kubernetes admission control, HTTP API authorization, entitlement management, remote access, and data filtering. In 2018, we donated OPA to the [Cloud Native Computing Foundation][3], a vendor-neutral home, and since then it has graduated from the sandbox to the incubating stage. + +### What can OPA do in the real world? + +In short, OPA provides unified, context-aware policy controls for cloud-native environments. OPA policy is context-aware, meaning that the administrator can make policy decisions based on what is happening in the real world, such as: + + * Is there currently an outage? + * Is there a new vulnerability that’s been released? + * Who are the people on call right now? + + + +Its policies are flexible enough to accommodate arbitrary context and arbitrary. OPA has been proven in production in some of the largest cloud-native deployments in the world—from global financial firms with trillions under management to technology giants and household names—but is also in use at emerging startups and regional healthcare organizations. + +Beyond our own direct experiences, and thanks to the open source community’s innovations, OPA continues to mature and solve varied and evolving customer authorization and policy problems, such as Kubernetes admission control, microservice authorization, and entitlements management for both end-user and employee-facing applications. We’re thrilled by both the depth and breadth of innovative use cases unfolding in front of our eyes. To better articulate some of the real-world problems OPA is solving, we looked across OPA’s business-critical deployments in the user community to provide the following examples. + +#### Provide regulatory compliance that role-based access control (RBAC) can’t. + +This lesson came to us through a global bank with trillions in assets. Their problem: A breach that occurred because a third-party broker had too much access. The bank’s relationship with the public was under significant stress, and it was also penalized with nearly $100 million in fines. + +How did such a breach happen? In short, due to the complexity of trying to map decades of role-based access control (RBAC) onto every sprawling monolithic app. With literally millions of roles across thousands of internal and external applications, the bank’s situation was—not unlike most large, established corporations—impossible to manage or troubleshoot. What started out as a best practice (RBAC) could no longer scale. Static roles, based on business logic, cannot be tested. They can’t be deployed inline. They can’t be validated like today’s modern code can. Simply put, RBAC cannot alone manage access at cloud scale. + +OPA facilitated a solution: Rearchitect and simplify application access with a local context-based authorization that’s automated, tested, audited, and scalable. There are both technology and business benefits to this approach. The main technology benefit is that the authorization policy (rules that establish what a given user can do) is built, tested, and deployed as part of continuous integration and continuous delivery (CI/CD). Every decision is tied directly to microservices and apps for auditing and validation, and all access is based not on role, but on the current context. + +Instead of creating thousands of roles to cover every permutation of what’s allowed, a simple policy can determine whether or not the user should have access, and to a very fine degree. This simplified policy greatly, since context drives access decisions. Versioning and backtesting aren’t required, since every time a new policy is needed the entire policy set is re-created, eliminating nested issues and legacy role sprawl. The local-only policy also eliminates the presence of conflicting rules/roles across repositories. + +The major business benefit is that compliance became easier through the separation of duties (with security teams—not developers—writing policy) and by providing clear, testable visibility into access policy across applications. This process accelerated development since AppDev teams were freed from having to code Authz or policy directly into applications, and central RBAC repositories no longer need to be updated, maintained, and made available. + +#### Provide regulatory compliance and safety by default. + +Another large bank, with nearly 20,000 employees, was in the untenable scenario of managing policy with spreadsheets. This situation may sound comical, but it‘s far more common than you might think. Access is often "managed" via best effort and tribal knowledge. Teams document access policy in PDFs, on Wikis, or in spreadsheets. They then rely on well-intentioned developers to read, understand, and remember access rules and guidelines. The bank had business reasons to move from monolithic apps to Kubernetes (K8s)—primarily improving differentiation and time to market—but it's legacy compliance solutions weren’t compatible with K8s. + +The bank knew that while it was a financial institution, it was _really_ a software organization. Rather than relying on human memory and best effort, the staff started thinking of policy with a GitOps mindset (pull requests, comments, and peer review to get to consensus and commitment). OPA became the single source of truth behind what was (or wasn’t) allowed with policy, implementing a true policy-as-code solution where effort was removed from the equation entirely, thanks to automation. + +The K8s platform that the bank created was compliant by default, as it executed company regulatory policies exactly, every time. With OPA, the bank could build, deploy, and version its regulatory policy through an agile process, ensuring that all users, teams, and services were always obeying policy. The infrastructure is now compliant because compliance is literally built into the infrastructure. + +#### Streamline and strengthen institutional knowledge. + +A major telecommunications company had an education problem that was sapping time and money. Its pain points: It had created and maintained its own admission control (AC) service; had a slow, costly, HR-heavy support model that couldn’t scale as its developer base grew; and it had a hammer-like enforcement model that wasn’t efficient, slowing time to market. + +OPA was deployed to replace the custom AC, thereby saving resources. The guardrails OPA provided allowed management to discover and deploy key policies that they developed from world events (and problems) that they wanted to eliminate moving forward. + +Management has now become accustomed to using policy-as-code and is able to hone in on the specific policies that developers trip over most. The primary benefit for this company was in the person-hours saved by not having to talk to the same developers about the same problems over and over again, and by being able to educate about and enforce policies automatically. The insights from these efforts allow the company to target education (not enforcement) to the teams that need it, proactively focusing on providing help to struggling teams. + +### Learn More about OPA + +To learn how to use OPA to help with your authorization and policy or to learn how to contribute, check out the [Open Policy Agent on Github][4] or check out the tutorials on different usecases at the [OPA homepage][2]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/open-policy-agent + +作者:[Tim Hinrichs][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/thinrich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://www.openpolicyagent.org/ +[3]: https://www.cncf.io/ +[4]: https://github.com/open-policy-agent/opa diff --git a/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md new file mode 100644 index 0000000000..4e2693f079 --- /dev/null +++ b/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know) +[#]: via: (https://itsfoss.com/google-chrome-shortcuts/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know +====== + +_**Brief: Master these Google Chrome keyboard shortcuts for a better, smoother and more productive web browsing experience. Downloadable cheatsheet is also included.**_ + +Google Chrome is the [most popular web browser][1] and there is no denying it. It’s open source version [Chromium][2] is also getting popularity and some Linux distributions now include it as the default web browser. + +If you use it on desktop a lot, you can improve your browsing experience by using Google Chrome keyboard shortcuts. No need to go up to your mouse and spend time finding your way around. Just master these shortcuts and you’ll even save some time and be more productive. + +I am using the term Google Chrome but these shortcuts are equally applicable to the Chromium browser. + +### 11 Cool Chrome Keyboard shortcuts you should be using + +If you are a pro, you might know a few of these Chrome shortcuts already but the chances are that you may still find some hidden gems here. Let’s see. + +**Keyboard Shortcuts** | **Action** +---|--- +Ctrl+T | Open a new tab +Ctrl+N | Open a new window +Ctrl+Shift+N | Open incognito window +Ctrl+W | Close current tab +Ctrl+Shift+T | Reopen last closed tab +Ctrl+Shift+W | Close the window +Ctrl+Tab and Ctrl+Shift+Tab | Switch to right or left tab +Ctrl+L | Go to search/address bar +Ctrl+D | Bookmark the website +Ctrl+H | Access browsing history +Ctrl+J | Access downloads history +Shift+Esc | Open Chrome task manager + +You can [download this list of useful Chrome keyboard shortcut for quick reference][3]. + +#### 1\. Open a new tab with Ctrl+T + +Need to open a new tab? Just press Ctrl and T keys together and you’ll have a new tab opened. + +#### 2\. Open a new window with Ctrl+N + +Too many tabs opened already? Time to open a fresh new window. Use Ctrl and N keys to open a new browser window. + +#### 3\. Go incognito with Ctrl+Shift+N + +Checking flight or hotel prices online? Going incognito might help. Open an incognito window in Chrome with Ctrl+Shift+N. + +[][4] + +Suggested read  Best Text Editors for Linux Command Line + +#### 4\. Close a tab with Ctrl+W + +Close the current tab with Ctrl and W key. No need to take the mouse to the top and look for the x button. + +#### 5\. Accidentally closed a tab? Reopen it with Ctrl+Shift+T + +This is my favorite Google Chrome shortcut. No more ‘oh crap’ when you close a tab you didn’t mean to. Use the Ctrl+Shift+T and it will open the last closed tab. Keep hitting this key combination and it will keep on bringing the closed tabs. + +#### 6\. Close the entire browser window with Ctrl+Shift+W + +Done with you work? Time to close the entire browser window with all the tabs. Use the keys Ctrl+Shift+W and the browser window will disappear like it never existed. + +#### 7\. Switch between tabs with Ctrl+Tab + +Too many tabs open? You can move to right tab with Ctrl+Tab. Want to move left? Use Ctrl+Shift+Tab. Press these keys repeatedly and you can move between all the open tabs in the current browser window. + +You can also use Ctrl+0 till Ctrl+9 to go to one of the first 10 tabs. But this Chrome keyboard shortcut doesn’t work for the 11th tabs onward. + +#### 8\. Go to the search/address bar with Ctrl+L + +Want to type a new URL or search something quickly. You can use Ctrl+L and it will highlight the address bar on the top. + +#### 9\. Bookmark the current website with Ctrl+D + +Found something interesting? Save it in your bookmarks with Ctrl+D keys combination. + +#### 10\. Go back in history with Ctrl+H + +You can open up your browser history with Ctrl+H keys. Search through the history if you are looking for a page visited some time ago or delete something that you don’t want to be seen anymore. + +#### 11\. See your downloads with Ctrl+J + +Pressing the Ctrl+J keys in Chrome will take you to the Downloads page. This page will show you all the downloads action you performed. + +[][5] + +Suggested read  Get Rid Of Two Google Chrome Icons From Dock In Elementary OS Freya [Quick Tip] + +#### Bonus shortcut: Open Chrome task manager with Shift+Esc + +Many people doesn’t even know that there is a task manager in Chrome browser. Chrome is infamous for eating up your system’s RAM. And when you have plenty of tabs opened, finding the culprit is not easy. + +With Chrome task manager, you can see all the open tabs and their system utilization stats. You can also see various hidden processes such as Chrome extensions and other services. + +![Google Chrome Task Manager][6] + +I am going to this table here for a quick reference. + +### Download Chrome shortcut cheatsheet + +I know that mastering keyboard shortcuts depends on habit and you can make it a habit by using it again and again. To help you in this task, I have created this Google Chrome keyboard shortcut cheatsheet. + +You can download the below image in PDF form, print it and put it on your desk. This way you can use practice the shortcuts all the time. + +![Google Chrome Keyboard Shortcuts Cheat Sheet][7] + +[Download Chrome Shortcut Cheatsheet][8] + +If you are interested in mastering shortcuts, you may also have a look at [Ubuntu keyboard shortcuts][9]. + +By the way, what’s your favorite Chrome shortcut? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/google-chrome-shortcuts/ + +作者:[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://en.wikipedia.org/wiki/Usage_share_of_web_browsers +[2]: https://www.chromium.org/Home +[3]: tmp.3qZNXSy2FC#download-cheatsheet +[4]: https://itsfoss.com/command-line-text-editors-linux/ +[5]: https://itsfoss.com/rid-google-chrome-icons-dock-elementary-os-freya/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/google-chrome-task-manager.png?resize=800%2C300&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/google-chrome-keyboard-shortcuts-cheat-sheet.png?ssl=1 +[8]: https://drive.google.com/open?id=1lZ4JgRuFbXrnEXoDQqOt7PQH6femIe3t +[9]: https://itsfoss.com/ubuntu-shortcuts/ diff --git a/sources/tech/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md b/sources/tech/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md new file mode 100644 index 0000000000..ab12c95ddd --- /dev/null +++ b/sources/tech/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Raspberry Pi Based Open Source Tablet is in Making and it’s Called CutiePi) +[#]: via: (https://itsfoss.com/cutiepi-open-source-tab/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +A Raspberry Pi Based Open Source Tablet is in Making and it’s Called CutiePi +====== + +CutiePie is an 8-inch open-source tablet built on top of Raspberry Pi. For now, it is just a working prototype which they announced on [Raspberry Pi forums][1]. + +In this article, you’ll get to know more details on the specifications, price, and availability of CutiePi. + +They have made the Tablet using a custom-designed Compute Model (CM3) carrier board. The [official website][2] mentions the purpose of a custom CM3 carrier board as: + +> A custom CM3/CM3+ carrier board designed for portable use, with enhanced power management and Li-Po battery level monitoring features; works with selected HDMI or MIPI DSI displays. + +So, this is what makes the Tablet thin enough while being portable. + +### CutiePi Specifications + +![CutiePi Board][3] + +I was surprised to know that it rocks an 8-inch IPS LCD display – which is a good thing for starters. However, you won’t be getting a true HD screen because the resolution is 1280×800 – as mentioned officially. + +It is also planned to come packed with Li-Po 4800 mAh battery (the prototype had a 5000 mAh battery). Well, for a Tablet, that isn’t bad at all. + +Connectivity options include the support for Wi-Fi and Bluetooth 4.0. In addition to this, a USB Type-A, 6x GPIO pins, and a microSD card slot is present. + +![CutiePi Specifications][4] + +The hardware is officially compatible with [Raspbian OS][5] and the user interface is built with [Qt][6] for a fast and intuitive user experience. Also, along with the in-built apps, it is expected to support Raspbian PIXEL apps via XWayland. + +### CutiePi Source Code + +You can second-guess the pricing of this tablet by analyzing the bill for the materials used. CutiePi follows a 100% open-source hardware design for this project. So, if you are curious, you can check out their GitHub page for more information on the hardware design and stuff. + +[CutiePi on GitHub][7] + +### CutiePi Pricing, Release Date & Availability + +CutiePi plans to work on [DVT][8] batch PCBs in August (this month). And, they target to launch the final product by the end of 2019. + +Officially, they expect it to launch it at around $150-$250. This is just an approximate for the range and should be taken with a pinch of salt. + +Obviously, the price will be a major factor in order to make it a success – even though the product itself sounds promising. + +**Wrapping Up** + +CutiePi is not the first project to use a [single board computer like Raspberry Pi][9] to make a tablet. We have the upcoming [PineTab][10] which is based on Pine64 single board computer. Pine also has a laptop called [Pinebook][11] based on the same. + +Judging by the prototype – it is indeed a product that we can expect to work. However, the pre-installed apps and the apps that it will support may turn the tide. Also, considering the price estimate – it sounds promising. + +What do you think about it? Let us know your thoughts in the comments below or just play this interactive poll. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cutiepi-open-source-tab/ + +作者:[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.raspberrypi.org/forums/viewtopic.php?t=247380 +[2]: https://cutiepi.io/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/cutiepi-board.png?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/cutiepi-specifications.jpg?ssl=1 +[5]: https://itsfoss.com/raspberry-pi-os-desktop/ +[6]: https://en.wikipedia.org/wiki/Qt_%28software%29 +[7]: https://github.com/cutiepi-io/cutiepi-board +[8]: https://en.wikipedia.org/wiki/Engineering_validation_test#Design_verification_test +[9]: https://itsfoss.com/raspberry-pi-alternatives/ +[10]: https://www.pine64.org/pinetab/ +[11]: https://itsfoss.com/pinebook-pro/ diff --git a/sources/tech/20190822 How to move a file in Linux.md b/sources/tech/20190822 How to move a file in Linux.md new file mode 100644 index 0000000000..c38f9445e1 --- /dev/null +++ b/sources/tech/20190822 How to move a file in Linux.md @@ -0,0 +1,286 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to move a file in Linux) +[#]: via: (https://opensource.com/article/19/8/moving-files-linux-depth) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/doni08521059) + +How to move a file in Linux +====== +Whether you're new to moving files in Linux or experienced, you'll learn +something in this in-depth writeup. +![Files in a folder][1] + +Moving files in Linux can seem relatively straightforward, but there are more options available than most realize. This article teaches beginners how to move files in the GUI and on the command line, but also explains what’s actually happening under the hood, and addresses command line options that many experience users have rarely explored. + +### Moving what? + +Before delving into moving files, it’s worth taking a closer look at what actually happens when _moving_ file system objects. When a file is created, it is assigned to an _inode_, which is a fixed point in a file system that’s used for data storage. You can what inode maps to a file with the [ls][2] command: + + +``` +$ ls --inode example.txt +7344977 example.txt +``` + +When you move a file, you don’t actually move the data from one inode to another, you only assign the file object a new name or file path. In fact, a file retains its permissions when it’s moved, because moving a file doesn’t change or re-create it. + +File and directory inodes never imply inheritance and are dictated by the filesystem itself. Inode assignment is sequential based on when the file was created and is entirely independent of how you organize your computer. A file "inside" a directory may have a lower inode number than its parent directory, or a higher one. For example: + + +``` +$ mkdir foo +$ mv example.txt foo +$ ls --inode +7476865 foo +$ ls --inode foo +7344977 example.txt +``` + +When moving a file from one hard drive to another, however, the inode is very likely to change. This happens because the new data has to be written onto a new filesystem. For this reason, in Linux the act of moving and renaming files is literally the same action. Whether you move a file to another directory or to the same directory with a new name, both actions are performed by the same underlying program. + +This article focuses on moving files from one directory to another. + +### Moving with a mouse + +The GUI is a friendly and, to most people, familiar layer of abstraction on top of a complex collection of binary data. It’s also the first and most intuitive way to move files on Linux. If you’re used to the desktop experience, in a generic sense, then you probably already know how to move files around your hard drive. In the GNOME desktop, for instance, the default action when dragging and dropping a file from one window to another is to move the file rather than to copy it, so it’s probably one of the most intuitive actions on the desktop: + +![Moving a file in GNOME.][3] + +The Dolphin file manager in the KDE Plasma desktop defaults to prompting the user for an action. Holding the **Shift** key while dragging a file forces a move action: + +![Moving a file in KDE.][4] + +### Moving on the command line + +The shell command intended for moving files on Linux, BSD, Illumos, Solaris, and MacOS is **mv**. A simple command with a predictable syntax, **mv <source> <destination>** moves a source file to the specified destination, each defined by either an [absolute][5] or [relative][6] file path. As mentioned before, **mv** is such a common command for [POSIX][7] users that many of its additional modifiers are generally unknown, so this article brings a few useful modifiers to your attention whether you are new or experienced. + +Not all **mv** commands were written by the same people, though, so you may have GNU **mv**, BSD **mv**, or Sun **mv**, depending on your operating system. Command options differ from implementation to implementation (BSD **mv** has no long options at all) so refer to your **mv** man page to see what’s supported, or install your preferred version instead (that’s the luxury of open source). + +#### Moving a file + +To move a file from one folder to another with **mv**, remember the syntax **mv <source> <destination>**. For instance, to move the file **example.txt** into your **Documents** directory: + + +``` +$ touch example.txt +$ mv example.txt ~/Documents +$ ls ~/Documents +example.txt +``` + +Just like when you move a file by dragging and dropping it onto a folder icon, this command doesn’t replace **Documents** with **example.txt**. Instead, **mv** detects that **Documents** is a folder, and places the **example.txt** file into it. + +You can also, conveniently, rename the file as you move it: + + +``` +$ touch example.txt +$ mv example.txt ~/Documents/foo.txt +$ ls ~/Documents +foo.txt +``` + +That’s important because it enables you to rename a file even when you don’t want to move it to another location, like so: + + +``` +`$ touch example.txt $ mv example.txt foo2.txt $ ls foo2.txt` +``` + +#### Moving a directory + +The **mv** command doesn’t differentiate a file from a directory the way [**cp**][8] does. You can move a directory or a file with the same syntax: + + +``` +$ touch file.txt +$ mkdir foo_directory +$ mv file.txt foo_directory +$ mv foo_directory ~/Documents +``` + +#### Moving a file safely + +If you copy a file to a directory where a file of the same name already exists, the **mv** command replaces the destination file with the one you are moving, by default. This behavior is called _clobbering_, and sometimes it’s exactly what you intend. Other times, it is not. + +Some distributions _alias_ (or you might [write your own][9]) **mv** to **mv --interactive**, which prompts you for confirmation. Some do not. Either way, you can use the **\--interactive** or **-i** option to ensure that **mv** asks for confirmation in the event that two files of the same name are in conflict: + + +``` +$ mv --interactive example.txt ~/Documents +mv: overwrite '~/Documents/example.txt'? +``` + +If you do not want to manually intervene, use **\--no-clobber** or **-n** instead. This flag silently rejects the move action in the event of conflict. In this example, a file named **example.txt** already exists in **~/Documents**, so it doesn't get moved from the current directory as instructed: + + +``` +$ mv --no-clobber example.txt ~/Documents +$ ls +example.txt +``` + +#### Moving with backups + +If you’re using GNU **mv**, there are backup options offering another means of safe moving. To create a backup of any conflicting destination file, use the **-b** option: + + +``` +$ mv -b example.txt ~/Documents +$ ls ~/Documents +example.txt    example.txt~ +``` + +This flag ensures that **mv** completes the move action, but also protects any pre-existing file in the destination location. + +Another GNU backup option is **\--backup**, which takes an argument defining how the backup file is named: + + * **existing**: If numbered backups already exist in the destination, then a numbered backup is created. Otherwise, the **simple** scheme is used. + * **none**: Does not create a backup even if **\--backup** is set. This option is useful to override a **mv** alias that sets the backup option. + * **numbered**: Appends the destination file with a number. + * **simple**: Appends the destination file with a **~**, which can conveniently be hidden from your daily view with the **\--ignore-backups** option for **[ls][2]**. + + + +For example: + + +``` +$ mv --backup=numbered example.txt ~/Documents +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +``` + +A default backup scheme can be set with the environment variable VERSION_CONTROL. You can set environment variables in your **~/.bashrc** file or dynamically before your command: + + +``` +$ VERSION_CONTROL=numbered mv --backup example.txt ~/Documents +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ +``` + +The **\--backup** option still respects the **\--interactive** or **-i** option, so it still prompts you to overwrite the destination file, even though it creates a backup before doing so: + + +``` +$ mv --backup=numbered example.txt ~/Documents +mv: overwrite '~/Documents/example.txt'? y +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:24 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:23 example.txt.~3~ +``` + +You can override **-i** with the **\--force** or **-f** option. + + +``` +$ mv --backup=numbered --force example.txt ~/Documents +$ ls ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:26 example.txt +-rw-rw-r--. 1 seth users 128 Aug  1 17:20 example.txt.~1~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:22 example.txt.~2~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:24 example.txt.~3~ +-rw-rw-r--. 1 seth users 128 Aug  1 17:25 example.txt.~4~ +``` + +The **\--backup** option is not available in BSD **mv**. + +#### Moving many files at once + +When moving multiple files, **mv** treats the final directory named as the destination: + + +``` +$ mv foo bar baz ~/Documents +$ ls ~/Documents +foo   bar   baz +``` + +If the final item is not a directory, **mv** returns an error: + + +``` +$ mv foo bar baz +mv: target 'baz' is not a directory +``` + +The syntax of GNU **mv** is fairly flexible. If you are unable to provide the **mv** command with the destination as the final argument, use the **\--target-directory** or **-t** option: + + +``` +$ mv --target-directory=~/Documents foo bar baz +$ ls ~/Documents +foo   bar   baz +``` + +This is especially useful when constructing **mv** commands from the output of some other command, such as the **find** command, **xargs**, or [GNU Parallel][10]. + +#### Moving based on mtime + +With GNU **mv**, you can define a move action based on whether the file being moved is newer than the destination file it would replace. This option is possible with the **\--update** or **-u** option, and is not available in BSD **mv**: + + +``` +$ ls -l ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:32 example.txt +$ ls -l +-rw-rw-r--. 1 seth users 128 Aug  1 17:42 example.txt +$ mv --update example.txt ~/Documents +$ ls -l ~/Documents +-rw-rw-r--. 1 seth users 128 Aug  1 17:42 example.txt +$ ls -l +``` + +This result is exclusively based on the files’ modification time, not on a diff of the two files, so use it with care. It’s easy to fool **mv** with a mere **touch** command: + + +``` +$ cat example.txt +one +$ cat ~/Documents/example.txt +one +two +$ touch example.txt +$ mv --update example.txt ~/Documents +$ cat ~/Documents/example.txt +one +``` + +Obviously, this isn’t the most intelligent update function available, but it offers basic protection against overwriting recent data. + +### Moving + +There are more ways to move data than just the **mv** command, but as the default program for the job, **mv** is a good universal option.  Now that you know what options you have available, you can use **mv** smarter than ever before. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/moving-files-linux-depth + +作者:[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/doni08521059 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://opensource.com/article/19/7/master-ls-command +[3]: https://opensource.com/sites/default/files/uploads/gnome-mv.jpg (Moving a file in GNOME.) +[4]: https://opensource.com/sites/default/files/uploads/kde-mv.jpg (Moving a file in KDE.) +[5]: https://opensource.com/article/19/7/understanding-file-paths-and-how-use-them +[6]: https://opensource.com/article/19/7/navigating-filesystem-relative-paths +[7]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[8]: https://opensource.com/article/19/7/copying-files-linux +[9]: https://opensource.com/article/19/7/bash-aliases +[10]: https://opensource.com/article/18/5/gnu-parallel diff --git a/sources/tech/20190823 Dive into the life and legacy of Alan Turing- 5 books and more.md b/sources/tech/20190823 Dive into the life and legacy of Alan Turing- 5 books and more.md new file mode 100644 index 0000000000..92b6cfe2b2 --- /dev/null +++ b/sources/tech/20190823 Dive into the life and legacy of Alan Turing- 5 books and more.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Dive into the life and legacy of Alan Turing: 5 books and more) +[#]: via: (https://opensource.com/article/19/8/who-was-alan-turing) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Dive into the life and legacy of Alan Turing: 5 books and more +====== +Turing's theories had a huge impact on the development of the field of +computer science. +![Fire fist breaking glass][1] + +Recently, Bank of England Governor, Mark Carney, [announced][2] that Alan Turning would be the new face on the UK£ 50 note. The name _Alan Turing_ should be familiar to anyone in open source communities: His theories had a huge impact on the development of the field of computer science, and his code-breaking work at [Bletchley Park][3] during World War II was the focus of the 2014 film, [_The Imitation Game_][4], which starred Benedict Cumberbatch as Alan Turing. + +Another well-known fact about Turing was his conviction for "gross indecency" because of his homosexuality, and the posthumous [apology][5] and [pardon][6] issued over more a half a decade after Turing’s death. + +But beyond all of this, who was Alan Turing? + +Here are five books and archival material that delve deeply into the life and legacy of Alan Turing. Collectively, these resources cover his life, both professional and personal, and work others have done to build upon Turing’s ideas. Individually, or collectively, these works allow the reader to learn who Alan Turing was beyond just a few well-known, broad-stroke themes. + +### Alan Turing: The Enigma + +![Alan Turing: The Enigma][7] + +One of the most expansive biographies of Alan Turing, [_Alan Turing: The Enigma_][8], by Andrew Hodges, states on its cover that it is the inspiration for the film _The Imitation Game_. Weighing in at over 750 pages, this is no quick read, but it covers much of Turing’s life. The only drawback is the fact that the first edition was published in 1983. Even the updated edition does not make use of information that has become declassified in the past few years. + +Despite that, if you only read one book from this list, _Alan Turing: The Enigma_ is still an excellent choice. Hodges’s work is the gold standard when it comes to Alan Turing biographies. + +### The Imitation Game: Alan Turing Decoded + +![The Imitation Game: Alan Turing Decoded][9] + +_[The Imitation Game: Alan Turing Decoded][10]_, by Jim Ottaviani and illustrated by Leland Purvis, presents the life of Alan Turing as a graphic novel. Well told and partnered with lovely artwork, this book covers all the major facets of Alan Turing’s life but lacks the depth of a biography like Hodges’. + +That is not to say that there is anything wrong or deficient with Ottaviani’s writing, just that the graphic novel form requires a more streamlined narrative. For anyone wanting a quick introduction to Turing, this graphic novel is the quickest way to read an overview of Turing’s life and works. + +### Prof: Alan Turing Decoded + +![Prof: Alan Turing Decoded][11] + +Written by Alan Turing’s nephew, Durmot Turing, _[Prof: Alan Turing Decoded][12]_ draws upon material from the family, plus declassified material that was not available when Hodges researched his book. This shorter biography provides a more personal look at Alan Turing’s life while still being scholarly. + +Dermot Turing does an excellent job of telling the story of Alan Turing the man, not the myth born from public perceptions based on various dramatic interpretations. _Prof: Alan Turing Decoded_ is an interesting biography owing to its use of letters from members of the Turing family, including Alan Turing himself. + +### The Turing Digital Archive + +Nothing beats archival materials for really learning about a subject. Biographers have done masterful jobs at turning primary sources about Alan Turing’s life into compelling biographies, but reading Turing’s own writings and exploring other material in [The Turing Digital Archive][13]—maintained by King’s College, Cambridge—provides a more intimate look at Turing’s life and works. This archive contains Turing’s scholar papers, personal correspondence, photographs, and more. The collection is well-organized and the site is easy to use, making it simple for anyone to conduct their own archival research about the life of Alan Turing. + +### Turing’s Cathedral + +![Turing’s Cathedral][14] + +In [_Turing’s Cathedral_][15], George Dyson explores the efforts by John von Neumann and his collaborators to construct a computer based on Alan Turing’s theory of a Universal Machine. John von Neumann made many, many contributions to computer science, which are also covered in this book, but the transition of Alan Turing’s Universal Machine from theory to practice is the facet that concerns readers wishing to learn more about Alan Turing’s legacy. + +_Turing’s Cathedral_ is the story of von Neumann constructing one of the earliest modern computers, but it is, like all modern computing, the story of Alan Turing’s influence on everything that developed from his theories. + +### Turing’s Vision: The Birth of Computer Science + +![Turing’s Vision: The Birth of Computer Science][16] + +[_Turing’s Vision: The Birth of Computer Science_][17], like its title states, explores the birth of the field of computer science. Full of diagrams and complex examples, this book might not be for everyone, but it does a masterful job of explaining computer science concepts and Turing’s place in the birth of the discipline. Chris Bernhardt does an excellent job of weaving together the biographical aspects with the technical, but the technical material can be very, very technical. There are mathematical proofs and other things that make this book a poor choice for the non-technical reader, but an excellent choice for someone with a background in computer science. + +For a very technical book, it is an enjoyable read. The biographical aspects are not as broad or as deep as pure biographies, but it is the synthesis of the biographical and the technical that make this book so interesting. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/who-was-alan-turing + +作者:[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/fire_fist_break_glass_smash_fail.jpg?itok=S6hQNLtB (Fire fist breaking glass) +[2]: https://www.bankofengland.co.uk/news/2019/july/50-pound-banknote-character-announcement +[3]: https://www.bletchleypark.org.uk/ +[4]: https://www.imdb.com/title/tt2084970/ +[5]: https://www.telegraph.co.uk/news/politics/gordon-brown/6170112/Gordon-Brown-Im-proud-to-say-sorry-to-a-real-war-hero.html +[6]: https://www.bbc.com/news/technology-25495315 +[7]: https://opensource.com/sites/default/files/uploads/alan_turing-_the_enigma_125.jpeg (Alan Turing: The Enigma) +[8]: https://press.princeton.edu/titles/10413.html +[9]: https://opensource.com/sites/default/files/uploads/the_imitation_game-_alan_turing_decoded_125.jpg (The Imitation Game: Alan Turing Decoded) +[10]: https://www.abramsbooks.com/product/imitation-game_9781419718939/ +[11]: https://opensource.com/sites/default/files/uploads/prof-_alan_turing_decoded_125.jpg (Prof: Alan Turing Decoded) +[12]: https://dermotturing.com/my-recent-books/alan-turing/ +[13]: http://www.turingarchive.org/ +[14]: https://opensource.com/sites/default/files/uploads/turing_s_cathedral_125.jpg (Turing’s Cathedral) +[15]: https://www.penguinrandomhouse.com/books/44425/turings-cathedral-by-george-dyson/9781400075997/ +[16]: https://opensource.com/sites/default/files/uploads/turing_s_vision-_the_birth_of_computer_science_125.jpg (Turing’s Vision: The Birth of Computer Science) +[17]: https://mitpress.mit.edu/books/turings-vision diff --git a/sources/tech/20190823 Four Ways to Check How Long a Process Has Been Running in Linux.md b/sources/tech/20190823 Four Ways to Check How Long a Process Has Been Running in Linux.md new file mode 100644 index 0000000000..457179609f --- /dev/null +++ b/sources/tech/20190823 Four Ways to Check How Long a Process Has Been Running in Linux.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Four Ways to Check How Long a Process Has Been Running in Linux) +[#]: via: (https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Four Ways to Check How Long a Process Has Been Running in Linux +====== + +If you want to figure out how long a process has been running in Linux for some reason. + +Yes, it is possible and can be done with help of ps command. + +It shows, the given process uptime in the form of [[DD-]hh:]mm:ss, in seconds, and exact start date and time. + +There are multiple options are available in ps command to check this. + +Each options comes with different output, which can be used for different purpose. + +``` +# top -b -s -n 1 | grep httpd + +16337 root 20 0 228272 5160 3272 S 0.0 0.1 1:02.27 httpd +30442 apache 20 0 240520 3132 1232 S 0.0 0.1 0:00.00 httpd +30443 apache 20 0 240520 3132 1232 S 0.0 0.1 0:00.00 httpd +30444 apache 20 0 240520 3132 1232 S 0.0 0.1 0:00.00 httpd +30445 apache 20 0 240520 3132 1232 S 0.0 0.1 0:00.00 httpd +30446 apache 20 0 240520 3132 1232 S 0.0 0.1 0:00.00 httpd +``` + +**`Make a note:`**` ` You may think the same details can be found on **[top command output][1]**. No, It shows you the total CPU time the task has used since it started. But it doesn’t include elapsed time. So, don’t confuse on this. + +### What’s ps Command? + +ps stands for processes status, it is display information about the active/running processes on the system. + +It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. + + * **`etime:`**` ` elapsed time since the process was started, in the form of [[DD-]hh:]mm:ss. + * **`etimes:`**` ` elapsed time since the process was started, in seconds. + + + +To do so, you need to **[find out the PID of a process][2]**, we can easily identify it by using pidof command. + +``` +# pidof httpd + +30446 30445 30444 30443 30442 16337 +``` + +### Method-1: Using etime Option + +Use the ps command with **`etime`**` ` option to get detailed elapsed time. + +``` +# ps -p 16337 -o etime + + ELAPSED +13-13:13:26 +``` + +As per the above output, the httpd process has been running in our server `13 days, 13 hours, 13 mins, and 26 sec`****. + +### Method-2: Using Process Name Instead of Process ID (PID) + +If you want to use process name instead of PID, use the following one. + +``` +# ps -eo pid,etime,cmd | grep httpd | grep -v grep + +16337 13-13:13:39 /usr/sbin/httpd -DFOREGROUND +30442 1-02:59:50 /usr/sbin/httpd -DFOREGROUND +30443 1-02:59:49 /usr/sbin/httpd -DFOREGROUND +30444 1-02:59:49 /usr/sbin/httpd -DFOREGROUND +30445 1-02:59:49 /usr/sbin/httpd -DFOREGROUND +30446 1-02:59:49 /usr/sbin/httpd -DFOREGROUND +``` + +### Method-3: Using etimes Option + +The following command will show you the elapsed time in seconds. + +``` +# ps -p 16337 -o etimes + +ELAPSED +1170810 +``` + +It shows the output in Seconds and you need to convert it as per your requirement. + +``` ++---------------------+-------------------------+ +| Human-Readable time | Seconds | ++---------------------+-------------------------+ +| 1 hour | 3600 seconds | +| 1 day | 86400 seconds | ++---------------------+-------------------------+ +``` + +If you would like to know how many hours the process has been running then use, **[Linux command line calculator][3]**. + +``` +# bc -l + +1170810/3600 +325.22500000000000000000 +``` + +If you would like to know how many days the process has been running then use the following format. + +``` +# bc -l + +1170810/86400 +13.55104166666666666666 +``` + +The above commands doesn’t show you the exact start date of the process and if you want to know those information then you can use the following command. As per the below output the httpd process has been running since **`Aug 05`**. + +``` +# ps -ef | grep httpd + +root 16337 1 0 Aug05 ? 00:01:02 /usr/sbin/httpd -DFOREGROUND +root 24999 24902 0 06:34 pts/0 00:00:00 grep --color=auto httpd +apache 30442 16337 0 Aug18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND +apache 30443 16337 0 Aug18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND +apache 30444 16337 0 Aug18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND +apache 30445 16337 0 Aug18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND +apache 30446 16337 0 Aug18 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND +``` + +### Method-4: Using proc filesystem (procfs) + +However, the above command doesn’t show you the exact start time of the process and use the following format to check that. As per the below output the httpd process has been running since **`Aug 05 at 17:20`**. + +The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information. + +It’s sometimes referred to as a process information pseudo-file system. It doesn’t contain ‘real’ files but run time system information (e.g. system memory, devices mounted, hardware configuration, etc). + +``` +# ls -ld /proc/16337 + +dr-xr-xr-x. 9 root root 0 Aug 5 17:20 /proc/16337/ +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ + +作者:[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/understanding-linux-top-command-output-usage/ +[2]: https://www.2daygeek.com/9-methods-to-check-find-the-process-id-pid-ppid-of-a-running-program-in-linux/ +[3]: https://www.2daygeek.com/linux-command-line-calculator-bc-calc-qalc-gcalccmd/ diff --git a/sources/tech/20190823 The lifecycle of Linux kernel testing.md b/sources/tech/20190823 The lifecycle of Linux kernel testing.md new file mode 100644 index 0000000000..65bab32536 --- /dev/null +++ b/sources/tech/20190823 The lifecycle of Linux kernel testing.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The lifecycle of Linux kernel testing) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-testing) +[#]: author: (Major Hayden https://opensource.com/users/mhaydenhttps://opensource.com/users/mhaydenhttps://opensource.com/users/marcobravohttps://opensource.com/users/mhayden) + +The lifecycle of Linux kernel testing +====== +The Continuous Kernel Integration (CKI) project aims to prevent bugs +from entering the Linux kernel. +![arrows cycle symbol for failing faster][1] + +In _[Continuous integration testing for the Linux kernel][2]_, I wrote about the [Continuous Kernel Integration][3] (CKI) project and its mission to change how kernel developers and maintainers work. This article is a deep dive into some of the more technical aspects of the project and how all the pieces fit together. + +### It all starts with a change + +Every exciting feature, improvement, and bug in the kernel starts with a change proposed by a developer. These changes appear on myriad mailing lists for different kernel repositories. Some repositories focus on certain subsystems in the kernel, such as storage or networking, while others focus on broad aspects of the kernel. The CKI project springs into action when developers propose a change, or patchset, to the kernel or when a maintainer makes changes in the repository itself. + +The CKI project maintains triggers that monitor these patchsets and take action. Software projects such as [Patchwork][4] make this process much easier by collating multi-patch contributions into a single patch series. This series travels as a unit through the CKI system and allows for publishing a single report on the series. + +Other triggers watch the repository for changes. This occurs when kernel maintainers merge patchsets, revert patches, or create new tags. Testing these critical changes ensures that developers always have a solid baseline to use as a foundation for writing new patches. + +All of these changes make their way into a GitLab pipeline and pass through multiple stages and multiple systems. + +### Prepare the build + +Everything starts with getting the source ready for compile time. This requires cloning the repository, applying the patchset proposed by the developer, and generating a kernel config file. These config files have thousands of options that turn features on or off, and config files differ incredibly between different system architectures. For example, a fairly standard x86_64 system may have a ton of options available in its config file, but an s390x system (IBM zSeries mainframes) likely has much fewer options. Some options might make sense on that mainframe but they have no purpose on a consumer laptop. + +The kernel moves forward and transforms into a source artifact. The artifact contains the entire repository, with patches applied, and all kernel configuration files required for compiling. Upstream kernels move on as a tarball, while Red Hat kernels become a source RPM for the next step. + +### Piles of compiles + +Compiling the kernel turns the source code into something that a computer can boot up and use. The config file describes what to build, scripts in the kernel describe how to build it, and tools on the system (like GCC and glibc) do the building. This process takes a while to complete, but the CKI project needs it done quickly for four architectures: aarch64 (64-bit ARM), ppc64le (POWER), s390x (IBM zSeries), and x86_64. It's important that we compile kernels quickly so that we keep our backlog manageable and developers receive prompt feedback. + +Adding more CPUs provides plenty of speed improvements, but every system has its limits. The CKI project compiles kernels within containers in an OpenShift deployment; although OpenShift allows for tons of scalability, the deployment still has a finite number of CPUs available. The CKI team allocates 20 virtual CPUs for compiling each kernel. With four architectures involved, this balloons to 80 CPUs! + +Another speed increase comes from a tool called [ccache][5]. Kernel development moves quickly, but a large amount of the kernel remains unchanged even between multiple releases. The ccache tool caches the built objects (small pieces of the overall kernel) during the compile on a disk. When another kernel compile comes along later, ccache looks for unchanged pieces of the kernel that it saw before. Ccache pulls the cached object from the disk and reuses it. This allows for faster compiles and lower overall CPU usage. Kernels that took 20 minutes to compile now race to the finish line in less than a few minutes. + +### Testing time + +The kernel moves onto its last step: testing on real hardware. Each kernel boots up on its native architecture using Beaker, and myriad tests begin poking it to find problems. Some tests look for simple problems, such as issues with containers or error messages on boot-up. Other tests dive deep into various kernel subsystems to find regressions in system calls, memory allocation, and threading. + +Large testing frameworks, such as the [Linux Test Project][6] (LTP), contain tons of tests that look for troublesome regressions in the kernel. Some of these regressions could roll back critical security fixes, and there are tests to ensure those improvements remain in the kernel. + +One critical step remains when tests finish: reporting. Kernel developers and maintainers need a concise report that tells them exactly what worked, what did not work, and how to get more information. Each CKI report contains details about the source code used, the compile parameters, and the testing output. That information helps developers know where to begin looking to fix an issue. Also, it helps maintainers know when a patchset needs to be held for another look before a bug makes its way into their kernel repository. + +### Summary + +The CKI project team strives to prevent bugs from entering the Linux kernel by providing timely, automated feedback to kernel developers and maintainers. This work makes their job easier by finding the low-hanging fruit that leads to kernel bugs, security issues, and performance problems. + +* * * + +_To learn more, you can attend the [CKI Hackfest][7] on September 12-13 following the [Linux Plumbers Conference][8] September 9-11 in Lisbon, Portugal._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-testing + +作者:[Major Hayden][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/mhaydenhttps://opensource.com/users/mhaydenhttps://opensource.com/users/marcobravohttps://opensource.com/users/mhayden +[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]: https://opensource.com/article/19/6/continuous-kernel-integration-linux +[3]: https://cki-project.org/ +[4]: https://github.com/getpatchwork/patchwork +[5]: https://ccache.dev/ +[6]: https://linux-test-project.github.io +[7]: https://cki-project.org/posts/hackfest-agenda/ +[8]: https://www.linuxplumbersconf.org/ diff --git a/sources/tech/20190824 How to compile a Linux kernel in the 21st century.md b/sources/tech/20190824 How to compile a Linux kernel in the 21st century.md new file mode 100644 index 0000000000..5821826706 --- /dev/null +++ b/sources/tech/20190824 How to compile a Linux kernel in the 21st century.md @@ -0,0 +1,225 @@ +[#]: collector: (lujun9972) +[#]: translator: (luming) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to compile a Linux kernel in the 21st century) +[#]: via: (https://opensource.com/article/19/8/linux-kernel-21st-century) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) + +How to compile a Linux kernel in the 21st century +====== +You don't have to compile the Linux kernel but you can with this quick +tutorial. +![and old computer and a new computer, representing migration to new software or hardware][1] + +In computing, a kernel is the low-level software that handles communication with hardware and general system coordination. Aside from some initial firmware built into your computer's motherboard, when you start your computer, the kernel is what provides awareness that it has a hard drive and a screen and a keyboard and a network card. It's also the kernel's job to ensure equal time (more or less) is given to each component so that your graphics and audio and filesystem and network all run smoothly, even though they're running concurrently. + +The quest for hardware support, however, is ongoing, because the more hardware that gets released, the more stuff a kernel must adopt into its code to make the hardware work as expected. It's difficult to get accurate numbers, but the Linux kernel is certainly among the top kernels for hardware compatibility. Linux operates innumerable computers and mobile phones, embedded system on a chip (SoC) boards for hobbyist and industrial uses, RAID cards, sewing machines, and much more. + +Back in the 20th century (and even in the early years of the 21st), it was not unreasonable for a Linux user to expect that when they purchased a very new piece of hardware, they would need to download the very latest kernel source code, compile it, and install it so that they could get support for the device. Lately, though, you'd be hard-pressed to find a Linux user who compiles their own kernel except for fun or profit by way of highly specialized custom hardware. It generally isn't required these days to compile the Linux kernel yourself. + +Here are the reasons why, plus a quick tutorial on how to compile a kernel when you need to. + +### Update your existing kernel + +Whether you've got a brand new laptop featuring a fancy new graphics card or WiFi chipset or you've just brought home a new printer, your operating system (called either GNU+Linux or just Linux, which is also the name of the kernel) needs a driver to open communication channels to that new component (graphics card, WiFi chip, printer, or whatever). It can be deceptive, sometimes, when you plug in a new device and your computer _appears_ to acknowledge it. But don't let that fool you. Sometimes that _is_ all you need, but other times your OS is just using generic protocols to probe a device that's attached. + +For instance, your computer may be able to identify your new network printer, but sometimes that's only because the network card in the printer is programmed to identify itself to a network so it can gain a DHCP address. It doesn't necessarily mean that your computer knows what instructions to send to the printer to produce a page of printed text. In fact, you might argue that the computer doesn't even really "know" that the device is a printer; it may only display that there's a device on the network at a specific address and the device identifies itself with the series of characters _p-r-i-n-t-e-r_. The conventions of human language are meaningless to a computer; what it needs is a driver. + +Kernel developers, hardware manufacturers, support technicians, and hobbyists all know that new hardware is constantly being released. Many of them contribute drivers, submitted straight to the kernel development team for inclusion in Linux. For example, Nvidia graphic card drivers are often written into the [Nouveau][2] kernel module and, because Nvidia cards are common, the code is usually included in any kernel distributed for general use (such as the kernel you get when you download [Fedora][3] or [Ubuntu][4]. Where Nvidia is less common, for instance in embedded systems, the Nouveau module is usually excluded. Similar modules exist for many other devices: printers benefit from [Foomatic][5] and [CUPS][6], wireless cards have [b43, ath9k, wl][7] modules, and so on. + +Distributions tend to include as much as they reasonably can in their Linux kernel builds because they want you to be able to attach a device and start using it immediately, with no driver installation required. For the most part, that's what happens, especially now that many device vendors are now funding Linux driver development for the hardware they sell and submitting those drivers directly to the kernel team for general distribution. + +Sometimes, however, you're running a kernel you installed six months ago with an exciting new device that just hit the stores a week ago. In that case, your kernel may not have a driver for that device. The good news is that very often, a driver for that device may exist in a very recent edition of the kernel, meaning that all you have to do is update what you're running. + +Generally, this is done through a package manager. For instance, on RHEL, CentOS, and Fedora: + + +``` +`$ sudo dnf update kernel` +``` + +On Debian and Ubuntu, first get your current kernel version: + + +``` +$ uname -r +4.4.186 +``` + +Search for newer versions: + + +``` +$ sudo apt update +$ sudo apt search linux-image +``` + +Install the latest version you find. In this example, the latest available is 5.2.4: + + +``` +`$ sudo apt install linux-image-5.2.4` +``` + +After a kernel upgrade, you must [reboot][8] (unless you're using kpatch or kgraft). Then, if the device driver you need is in the latest kernel, your hardware will work as expected. + +### Install a kernel module + +Sometimes a distribution doesn't expect that its users often use a device (or at least not enough that the device driver needs to be in the Linux kernel). Linux takes a modular approach to drivers, so distributions can ship separate driver packages that can be loaded by the kernel even though the driver isn't compiled into the kernel itself. This is useful, although it can get complicated when a driver isn't included in a kernel but is needed during boot, or when the kernel gets updated out from under the modular driver. The first problem is solved with an **initrd** (initial RAM disk) and is out of scope for this article, and the second is solved by a system called **kmod**. + +The kmod system ensures that when a kernel is updated, all modular drivers installed alongside it are also updated. If you install a driver manually, you miss out on the automation that kmod provides, so you should opt for a kmod package whenever it is available. For instance, while Nvidia drivers are built into the kernel as the Nouveau driver, the official Nvidia drivers are distributed only by Nvidia. You can install Nvidia-branded drivers manually by going to the website, downloading the **.run** file, and running the shell script it provides, but you must repeat that same process after you install a new kernel, because nothing tells your package manager that you manually installed a kernel driver. Because Nvidia drives your graphics, updating the Nvidia driver manually usually means you have to perform the update from a terminal, because you have no graphics without a functional graphics driver. + +![Nvidia configuration application][9] + +However, if you install the Nvidia drivers as a kmod package, updating your kernel also updates your Nvidia driver. On Fedora and related: + + +``` +`$ sudo dnf install kmod-nvidia` +``` + +On Debian and related: + + +``` +$ sudo apt update +$ sudo apt install nvidia-kernel-common nvidia-kernel-dkms nvidia-glx nvidia-xconfig nvidia-settings nvidia-vdpau-driver vdpau-va-driver +``` + +This is only an example, but if you're installing Nvidia drivers in real life, you must also blacklist the Nouveau driver. See your distribution's documentation for the best steps. + +### Download and install a driver + +Not everything is included in the kernel, and not everything _else_ is available as a kernel module. In some cases, you have to download a special driver written and bundled by the hardware vendor, and other times, you have the driver but not the frontend to configure driver options. + +Two common examples are HP printers and [Wacom][10] illustration tablets. If you get an HP printer, you probably have generic drivers that can communicate with your printer. You might even be able to print. But the generic driver may not be able to provide specialized options specific to your model, such as double-sided printing, collation, paper tray choices, and so on. [HPLIP][11] (the HP Linux Imaging and Printing system) provides options to manage jobs, adjust printing options, select paper trays where applicable, and so on. + +HPLIP is usually bundled in package managers; just search for "hplip." + +![HPLIP in action][12] + +Similarly, drivers for Wacom tablets, the leading illustration tablet for digital artists, are usually included in your kernel, but options to fine-tune settings, such as pressure sensitivity and button functionality, are only accessible through the graphical control panel included by default with GNOME but installable as the extra package **kde-config-tablet** on KDE. + +There are likely some edge cases that don't have drivers in the kernel but offer kmod versions of driver modules as an RPM or DEB file that you can download and install through your package manager. + +### Patching and compiling your own kernel + +Even in the futuristic utopia that is the 21st century, there are vendors that don't understand open source enough to provide installable drivers. Sometimes, such companies provide source code for a driver but expect you to download the code, patch a kernel, compile, and install manually. + +This kind of distribution model has the same disadvantages as installing packaged drivers outside of the kmod system: an update to your kernel breaks the driver because it must be re-integrated into your kernel manually each time the kernel is swapped out for a new one. + +This has become rare, happily, because the Linux kernel team has done an excellent job of pleading loudly for companies to communicate with them, and because companies are finally accepting that open source isn't going away any time soon. But there are still novelty or hyper-specialized devices out there that provide only kernel patches. + +Officially, there are distribution-specific preferences for how you should compile a kernel to keep your package manager involved in upgrading such a vital part of your system. There are too many package managers to cover each; as an example, here is what happens behind the scenes when you use tools like **rpmdev** on Fedora or **build-essential** and **devscripts** on Debian. + +First, as usual, find out which kernel version you're running: + + +``` +`$ uname -r` +``` + +In most cases, it's safe to upgrade your kernel if you haven't already. After all, it's possible that your problem will be solved in the latest release. If you tried that and it didn't work, then you should download the source code of the kernel you are running. Most distributions provide a special command for that, but to do it manually, you can find the source code on [kernel.org][13]. + +You also must download whatever patch you need for your kernel. Sometimes, these patches are specific to the kernel release, so choose carefully. + +It's traditional, or at least it was back when people regularly compiled their own kernels, to place the source code and patches in **/usr/src/linux**. + +Unarchive the kernel source and the patch files as needed: + + +``` +$ cd /usr/src/linux +$ bzip2 --decompress linux-5.2.4.tar.bz2 +$ cd  linux-5.2.4 +$ bzip2 -d ../patch*bz2 +``` + +The patch file may have instructions on how to do the patch, but often they're designed to be executed from the top level of your tree: + + +``` +`$ patch -p1 < patch*example.patch` +``` + +Once the kernel code is patched, you can use your old configuration to prepare the patched kernel config: + + +``` +`$ make oldconfig` +``` + +The **make oldconfig** command serves two purposes: it inherits your current kernel's configuration, and it allows you to configure new options introduced by the patch. + +You may need to run the **make menuconfig** command, which launches an ncurses-based, menu-driven list of possible options for your new kernel. The menu can be overwhelming, but since it starts with your old config as a foundation, you can look through the menu and disable modules for hardware that you know you do not have and do not anticipate needing. Alternately, if you know that you have some piece of hardware and see it is not included in your current configuration, you may choose to build it, either as a module or directly into the kernel. In theory, this isn't necessary because presumably, your current kernel was treating you well but for the missing patch, and probably the patch you applied has activated all the necessary options required by whatever device prompted you to patch your kernel in the first place. + +Next, compile the kernel and its modules: + + +``` +$ make bzImage +$ make modules +``` + +This leaves you with a file named **vmlinuz**, which is a compressed version of your bootable kernel. Save your old version and place the new one in your **/boot** directory: + + +``` +$ sudo mv /boot/vmlinuz /boot/vmlinuz.nopatch +$ sudo cat arch/x86_64/boot/bzImage > /boot/vmlinuz +$ sudo mv /boot/System.map /boot/System.map.stock +$ sudo cp System.map /boot/System.map +``` + +So far, you've patched and built a kernel and its modules, you've installed the kernel, but you haven't installed any modules. That's the final build step: + + +``` +`$ sudo make modules_install` +``` + +The new kernel is in place, and its modules are installed. + +The final step is to update your bootloader so that the part of your computer that loads before the kernel knows where to find Linux. The GRUB bootloader makes this process relatively simple: + + +``` +`$ sudo grub2-mkconfig` +``` + +### Real-world compiling + +Of course, nobody runs those manual commands now. Instead, refer to your distribution for instructions on modifying a kernel using the developer toolset that your distribution's maintainers use. This toolset will probably create a new installable package with all the patches incorporated, alert the package manager of the upgrade, and update your bootloader for you. + +### Kernels + +Operating systems and kernels are mysterious things, but it doesn't take much to understand what components they're built upon. The next time you get a piece of tech that appears to not work on Linux, take a deep breath, investigate driver availability, and go with the path of least resistance. Linux is easier than ever—and that includes the kernel. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-kernel-21st-century + +作者:[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/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) +[2]: https://nouveau.freedesktop.org/wiki/ +[3]: http://fedoraproject.org +[4]: http://ubuntu.com +[5]: https://wiki.linuxfoundation.org/openprinting/database/foomatic +[6]: https://www.cups.org/ +[7]: https://wireless.wiki.kernel.org/en/users/drivers +[8]: https://opensource.com/article/19/7/reboot-linux +[9]: https://opensource.com/sites/default/files/uploads/nvidia.jpg (Nvidia configuration application) +[10]: https://linuxwacom.github.io +[11]: https://developers.hp.com/hp-linux-imaging-and-printing +[12]: https://opensource.com/sites/default/files/uploads/hplip.jpg (HPLIP in action) +[13]: https://www.kernel.org/ diff --git a/sources/tech/20190826 How RPM packages are made- the source RPM.md b/sources/tech/20190826 How RPM packages are made- the source RPM.md new file mode 100644 index 0000000000..4629db3580 --- /dev/null +++ b/sources/tech/20190826 How RPM packages are made- the source RPM.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How RPM packages are made: the source RPM) +[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +How RPM packages are made: the source RPM +====== + +![][1] + +In a [previous post, we looked at what RPM packages are][2]. They are archives that contain files and metadata. This metadata tells RPM where to create or remove files from when an RPM is installed or uninstalled. The metadata also contains information on “dependencies”, which you will remember from the previous post, can either be “runtime” or “build time”. + +As an example, we will look at _fpaste_. You can download the RPM using _dnf_. This will download the latest version of _fpaste_ that is available in the Fedora repositories. On Fedora 30, this is currently 0.3.9.2: + +``` +$ dnf download fpaste + +... +fpaste-0.3.9.2-2.fc30.noarch.rpm +``` + +Since this is the built RPM, it contains only files needed to use _fpaste_: + +``` +$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.noarch.rpm +/usr/bin/fpaste +/usr/share/doc/fpaste +/usr/share/doc/fpaste/README.rst +/usr/share/doc/fpaste/TODO +/usr/share/licenses/fpaste +/usr/share/licenses/fpaste/COPYING +/usr/share/man/man1/fpaste.1.gz +``` + +### Source RPMs + +The next link in the chain is the source RPM. All software in Fedora must be built from its source code. We do not include pre-built binaries. So, for an RPM file to be made, RPM (the tool) needs to be: + + * given the files that have to be installed, + * told how to generate these files, if they are to be compiled, for example, + * told where these files must be installed, + * what other dependencies this particular software needs to work properly. + + + +The source RPM holds all of this information. Source RPMs are similar archives to RPM, but as the name suggests, instead of holding the built binary files, they contain the source files for a piece of software. Let’s download the source RPM for _fpaste_: + +``` +$ dnf download fpaste --source +... +fpaste-0.3.9.2-2.fc30.src.rpm +``` + +Notice how the file ends with “src.rpm”. All RPMs are built from source RPMs. You can easily check what source RPM a “binary” RPM comes from using dnf too: + +``` +$ dnf repoquery --qf "%{SOURCERPM}" fpaste +fpaste-0.3.9.2-2.fc30.src.rpm +``` + +Also, since this is the source RPM, it does not contain built files. Instead, it contains the sources and instructions on how to build the RPM from them: + +``` +$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.src.rpm +fpaste-0.3.9.2.tar.gz +fpaste.spec +``` + +Here, the first file is simply the source code for _fpaste_. The second is the “spec” file. The spec file is the recipe that tells RPM (the tool) how to create the RPM (the archive) using the sources contained in the source RPM—all the information that RPM (the tool) needs to build RPMs (the archives) are contained in spec files. When we package maintainers add software to Fedora, most of our time is spent writing and perfecting the individual spec files. When a software package needs an update, we go back and tweak the spec file. You can see the spec files for ALL packages in Fedora at our source repository at + +Note that one source RPM may contain the instructions to build multiple RPMs. _fpaste_ is a very simple piece of software, where one source RPM generates one “binary” RPM. Python, on the other hand is more complex. While there is only one source RPM, it generates multiple binary RPMs: + +``` +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3 +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-devel +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-libs +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-idle +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-tkinter +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm +``` + +In RPM jargon, “python3” is the “main package”, and so the spec file will be called “python3.spec”. All the other packages are “sub-packages”. You can download the source RPM for python3 and see what’s in it too. (Hint: patches are also part of the source code): + +``` +$ dnf download --source python3 +python3-3.7.4-1.fc30.src.rpm + +$ rpm -qpl ./python3-3.7.4-1.fc30.src.rpm +00001-rpath.patch +00102-lib64.patch +00111-no-static-lib.patch +00155-avoid-ctypes-thunks.patch +00170-gc-assertions.patch +00178-dont-duplicate-flags-in-sysconfig.patch +00189-use-rpm-wheels.patch +00205-make-libpl-respect-lib64.patch +00251-change-user-install-location.patch +00274-fix-arch-names.patch +00316-mark-bdist_wininst-unsupported.patch +Python-3.7.4.tar.xz +check-pyc-timestamps.py +idle3.appdata.xml +idle3.desktop +python3.spec +``` + +### Building an RPM from a source RPM + +Now that we have the source RPM, and know what’s in it, we can rebuild our RPM from it. Before we do so, though, we should set our system up to build RPMs. First, we install the required tools: + +``` +$ sudo dnf install fedora-packager +``` + +This will install the rpmbuild tool. rpmbuild requires a default layout so that it knows where each required component of the source rpm is. Let’s see what they are: + +``` +# Where should the spec file go? +$ rpm -E %{_specdir} +/home/asinha/rpmbuild/SPECS + +# Where should the sources go? +$ rpm -E %{_sourcedir} +/home/asinha/rpmbuild/SOURCES + +# Where is temporary build directory? +$ rpm -E %{_builddir} +/home/asinha/rpmbuild/BUILD + +# Where is the buildroot? +$ rpm -E %{_buildrootdir} +/home/asinha/rpmbuild/BUILDROOT + +# Where will the source rpms be? +$ rpm -E %{_srcrpmdir} +/home/asinha/rpmbuild/SRPMS + +# Where will the built rpms be? +$ rpm -E %{_rpmdir} +/home/asinha/rpmbuild/RPMS +``` + +I have all of this set up on my system already: + +``` +$ cd +$ tree -L 1 rpmbuild/ +rpmbuild/ +├── BUILD +├── BUILDROOT +├── RPMS +├── SOURCES +├── SPECS +└── SRPMS + +6 directories, 0 files +``` + +RPM provides a tool that sets it all up for you too: + +``` +$ rpmdev-setuptree +``` + +Then we ensure that we have all the build dependencies for _fpaste_ installed: + +``` +sudo dnf builddep fpaste-0.3.9.2-3.fc30.src.rpm +``` + +For _fpaste_ you only need Python and that must already be installed on your system (dnf uses Python too). The builddep command can also be given a spec file instead of an source RPM. Read more in the man page: + +``` +$ man dnf.plugin.builddep +``` + +Now that we have all that we need, building an RPM from a source RPM is as simple as: + +``` +$ rpmbuild --rebuild fpaste-0.3.9.2-3.fc30.src.rpm +.. +.. + +$ tree ~/rpmbuild/RPMS/noarch/ +/home/asinha/rpmbuild/RPMS/noarch/ +└── fpaste-0.3.9.2-3.fc30.noarch.rpm + +0 directories, 1 file +``` + +rpmbuild will install the source RPM and build your RPM from it. You can now install the RPM to use it as you do–using dnf. Of course, as said before, if you want to change anything in the RPM, you must modify the spec file—we’ll cover spec files in next post. + +### Summary + +To summarise this post in two short points: + + * the RPMs we generally install to use software are “binary” RPMs that contain built versions of the software + * these are built from source RPMs that include the source code and the spec file that are needed to generate the binary RPMs. + + + +If you’d like to get started with building RPMs, and help the Fedora community maintain the massive amount of software we provide, you can start here: + +For any queries, post to the [Fedora developers mailing list][3]—we’re always happy to help! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ + +作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://fedoramagazine.org/rpm-packages-explained/ +[3]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ diff --git a/sources/tech/20190826 Introduction to the Linux chown command.md b/sources/tech/20190826 Introduction to the Linux chown command.md new file mode 100644 index 0000000000..cb79c6fec6 --- /dev/null +++ b/sources/tech/20190826 Introduction to the Linux chown command.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to the Linux chown command) +[#]: via: (https://opensource.com/article/19/8/linux-chown-command) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/greg-phttps://opensource.com/users/alanfdoss) + +Introduction to the Linux chown command +====== +Learn how to change a file or directory's ownership with chown. +![Hand putting a Linux file folder into a drawer][1] + +Every file and directory on a Linux system is owned by someone, and the owner has complete control to change or delete the files they own. In addition to having an owning _user_, a file has an owning _group_. + +You can view the ownership of a file using the **ls -l** command: + + +``` +[pablo@workstation Downloads]$ ls -l +total 2454732 +-rw-r--r--. 1 pablo pablo 1934753792 Jul 25 18:49 Fedora-Workstation-Live-x86_64-30-1.2.iso +``` + +The third and fourth columns of the output are the owning user and group, which together are referred to as _ownership_. Both are **pablo** for the ISO file above. + +The ownership settings, set by the [**chmod** command][2], control who is allowed to perform read, write, or execute actions. You can change ownership (one or both) with the **chown** command. + +It is often necessary to change ownership. Files and directories can live a long time on a system, but users can come and go. Ownership may also need to change when files and directories are moved around the system or from one system to another. + +The ownership of the files and directories in my home directory are my user and my primary group, represented in the form **user:group**. Suppose Susan is managing the Delta group, which needs to edit a file called **mynotes**. You can use the **chown** command to change the user to **susan** and the group to **delta**: + + +``` +$ chown susan:delta mynotes +ls -l +-rw-rw-r--. 1 susan delta 0 Aug  1 12:04 mynotes +``` + +Once the Delta group is finished with the file, it can be assigned back to me: + + +``` +$ chown alan mynotes +$ ls -l mynotes +-rw-rw-r--. 1 alan delta 0 Aug  1 12:04 mynotes +``` + +Both the user and group can be assigned back to me by appending a colon (**:**) to the user: + + +``` +$ chown alan: mynotes +$ ls -l mynotes +-rw-rw-r--. 1 alan alan 0 Aug  1 12:04 mynotes +``` + +By prepending the group with a colon, you can change just the group. Now members of the **gamma** group can edit the file: + + +``` +$ chown :gamma mynotes +$ ls -l +-rw-rw-r--. 1 alan gamma 0 Aug  1 12:04 mynotes +``` + +A few additional arguments to chown can be useful at both the command line and in a script. Just like many other Linux commands, chown has a recursive argument ****(**-R**) which tells the command to descend into the directory to operate on all files inside. Without the **-R** flag, you change permissions of the folder only, leaving the files inside it unchanged. In this example, assume that the intent is to change permissions of a directory and all its contents. Here I have added the **-v** (verbose) argument so that chown reports what it is doing: + + +``` +$ ls -l . conf +.: +drwxrwxr-x 2 alan alan 4096 Aug  5 15:33 conf + +conf: +-rw-rw-r-- 1 alan alan 0 Aug  5 15:33 conf.xml + +$ chown -vR susan:delta conf +changed ownership of 'conf/conf.xml' from alan:alan to  susan:delta +changed ownership of 'conf' from alan:alan to  susan:delta +``` + +Depending on your role, you may need to use **sudo** to change ownership of a file. + +You can use a reference file (**\--reference=RFILE**) when changing the ownership of files to match a certain configuration or when you don't know the ownership (as might be the case when running a script). You can duplicate the user and group of another file (**RFILE**, known as a reference file), for example, to undo the changes made above. Recall that a dot (**.**) refers to the present working directory. + + +``` +`$ chown -vR --reference=. conf` +``` + +### Report Changes + +Most commands have arguments for controlling their output. The most common is **-v** (-**-verbose**) to enable verbose, but chown also has a **-c** (**\--changes**) argument to instruct chown to only report when a change is made. Chown still reports other things, such as when an operation is not permitted. + +The argument **-f** (**\--silent**, **\--quiet**) is used to suppress most error messages. I will use **-f** and the **-c** in the next section so that only actual changes are shown. + +### Preserve Root + +The root (**/**) of the Linux filesystem should be treated with great respect. If a mistake is made at this level, the consequences could leave a system completely useless. Particularly when you are running a recursive command that makes any kind of change or worse: deletions. The chown command has an argument that can be used to protect and preserve the root. The argument is **\--preserve-root**. If this argument is used with a recursive chown command on the root, nothing is done and a message appears instead. + + +``` +$ chown -cfR --preserve-root alan / +chown: it is dangerous to operate recursively on '/' +chown: use --no-preserve-root to override this failsafe +``` + +The option has no effect when not used in conjunction with **\--recursive**. However, if the command is run by the root user, the permissions of the **/** itself will be changed, but not of other files or directories within. + + +``` +$ chown -c --preserve-root alan / +chown: changing ownership of '/': Operation not permitted +[root@localhost /]# chown -c --preserve-root alan / +changed ownership of '/' from root to alan +``` + +### Ownership is security + +File and directory ownership is part of good information security, so it's important to occasionally check and maintain file ownership to prevent unwanted access. The chown command is one of the most common and important in the set of Linux security commands. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-chown-command + +作者:[Alan Formy-Duval][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/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/alanfdosshttps://opensource.com/users/sethhttps://opensource.com/users/greg-phttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/19/8/introduction-linux-chmod-command diff --git a/sources/tech/20190826 Using variables in Bash.md b/sources/tech/20190826 Using variables in Bash.md new file mode 100644 index 0000000000..51959ef2ad --- /dev/null +++ b/sources/tech/20190826 Using variables in Bash.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using variables in Bash) +[#]: via: (https://opensource.com/article/19/8/using-variables-bash) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/jpnc) + +Using variables in Bash +====== +Take advantage of Bash variables with our miniseries: Variables in +shells. +![bash logo on green background][1] + +In computer science (and casual computing), a variable is a location in memory that holds arbitrary information for later use. In other words, it’s a temporary storage container for you to put data into and get data out of. In the Bash shell, that data can be a word (a _string_, in computer lingo) or a number (an _integer_). + +You may have never (knowingly) used a variable before on your computer, but you probably have used a variable in other areas of your life. When you say things like "give me that" or "look at this," you’re using grammatical variables (you think of them as _pronouns_), because the meaning of "this" and "that" depends on whatever you’re picturing in your mind, or whatever you’re pointing to so your audience knows what you’re referring to. When you do math, you use variables to stand in for an unknown value, even though you probably don’t call it a variable. + +Here’s a quick and easy demonstration of a Bash variable you may not realize you use every day. The **PS1** variable holds information about how you want your terminal prompt to appear. For instance, you can set it to something very simple—like a percent sign (**%**)—by redefining the **PS1** variable: + + +``` +$ PS1="% " +% +``` + +This article addresses variables in a Bash shell running on Linux, BSD, Mac, or Cygwin. Users of Microsoft’s open source [PowerShell][2] should refer to my article about [variables in PowerShell][3]. + +### What are variables for? + +Whether you need variables in Bash depends on what you do in a terminal. For some users, variables are an essential means of managing data, while for others they’re minor and temporary conveniences, and for still others, they may as well not exist. + +Ultimately, variables are a tool. You can use them when you find a use for them, or leave them alone in the comfort of knowing they’re managed by your OS. Knowledge is power, though, and understanding how variables work in Bash can lead you to all kinds of unexpected creative problem-solving. + +### How to set a variable + +You don’t need special permissions to create a variable. They’re free to create, free to use, and generally harmless. In a Bash shell (on Linux and Mac), you can set them by defining a variable name, and then setting its value. The following example creates a new variable called **FOO** and sets the value to the string **/home/seth/Documents**: + + +``` +`$ declare FOO="/home/seth/Documents"` +``` + +Success is eerily silent, so you may not feel confident that your variable got set. You can see the results for yourself with the **echo command**, recalling your variable by prepending it with a dollar sign (**$**). To ensure that the variable is read exactly as you defined it, you can also wrap it in braces and quotes. Doing this preserves any special characters that might appear in the variable; in this example, that doesn’t apply, but it’s still a good habit to form: + + +``` +$ echo "${FOO}" +/home/seth/Documents +``` + +Setting variables can be a common thing for people who use the shell often, so the process has become somewhat informal. When a string is followed by an equal sign (**=**) and a value, Bash quietly assumes that you’re setting a variable, making the **declare** keyword unnecessary: + + +``` +`$ FOO="/home/seth/Documents"` +``` + +Variables usually are meant to convey information from one system to another. In this simple example, your variable is not very useful, but it can still communicate information. For instance, because the content of the **FOO** variable is a [file path][4], you can use the variable as a shortcut to the **~/Documents** directory: + + +``` +$ pwd +/home/seth +$ cd "${FOO}" +$ pwd +/home/seth/Documents +``` + +Variables can be any non-reserved string (along with integers and underscores). They don't have to be capitalized, but they often are so that they're easy to identify as variables. + +### How to clear a variable + +You can clear a variable with the **unset** command: + + +``` +$ unset FOO +$ echo $FOO +``` + +In practice, this action is not usually necessary. Variables are relatively "cheap," so you can create them and then forget them when you don’t need them anymore. However, there may be times you want to ensure a variable is empty to avoid conveying incorrect information to another process that might read the variable. + +### Create a new variable with collision protection + +Sometimes, you may have reason to believe a variable was already set by you or a process. If you would rather not override it, there’s a special syntax to set a variable to its existing value unless its existing value is empty. + +For this example, assume that **FOO** is set to **/home/seth/Documents**: + + +``` +$ FOO=${FOO:-"bar"} +$ echo $FOO +/home/seth/Documents +``` + +The colon-dash **:-** notation causes **declare** to default to an existing value. To see this process work the other way, clear the variable, and try again: + + +``` +$ unset FOO +$ echo $FOO + +$ FOO=${FOO:-"bar"} +$ echo $FOO +bar +``` + +### Pass variables to a child process + +When you create a variable, you are creating what is called a _local variable_. This means that the variable is known to your current shell and only your current shell. + +This setup is an intentional limitation of a variable’s _scope_. Variables, by design, tend to default to being locally available only, in an attempt to keep information sharing on a need-to-know basis. If you foolishly create a variable containing an important password in clear text, for example, it’s nice to know that your system won’t allow a remote shell or rogue daemon (or anything else outside the one session that created the variable) access that password. + +Use the example from the beginning of this article to change your prompt, but then launch a new shell within your current one: + + +``` +$ PS1="% " +% bash +$ +``` + +When you launch a new shell, the new value of **PS1** is the default prompt instead of your new prompt: A child process does not inherit variables set in its parent. If you kill the child process, you return to the parent shell, and you see your custom **PS1** prompt again: + + +``` +$ exit +% +``` + +If you want to pass a variable to a child process, you can _prepend_ a command with variable definitions, or you can _export_ the variable to the child process. + +### Prepending variables + +You can prepend any number of variables before running a command. ****Whether the variables are used by the child process is up to the process, but you can pass the variables to it no matter what: + + +``` +$ FOO=123 bash +$ echo $FOO +123 +$ +``` + +Prepending can be a useful trick when you’re running an application requiring a special location for certain libraries (using the **LD_LIBRARY_PATH** variable), or when you’re compiling software with a non-standard compiler (using the **CC** variable), and so on. + +### Exporting variables + +Another way to make variables available to a child process is the **export** keyword, a command built into Bash. The **export** command broadens the scope of whatever variable or variables you specify: + + +``` +$ PS1="% " +$ FOO=123 +$ export PS1 +$ export FOO +% bash +% echo $PS1 +% +% echo $FOO +123 +``` + +In both cases, it’s not just a child shell that has access to a local variable that’s been passed to it or exported, it’s any child process of that shell. You can launch an application from the same shell, and that variable is available as an environment variable from within the application. + +Variables exported for everything on your system to use are called _environment variables_, which is a topic for a future article. In the meantime, try using some variables for everyday tasks to see what they bring to your workflow. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/using-variables-bash + +作者:[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/sethhttps://opensource.com/users/sethhttps://opensource.com/users/jpnc +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://github.com/PowerShell/PowerShell +[3]: https://opensource.com/article/19/8/variables-powershell +[4]: https://opensource.com/article/19/8/understanding-file-paths-linux diff --git a/sources/tech/20190827 Best Email Services For Privacy Concerned People.md b/sources/tech/20190827 Best Email Services For Privacy Concerned People.md new file mode 100644 index 0000000000..4cc0c72004 --- /dev/null +++ b/sources/tech/20190827 Best Email Services For Privacy Concerned People.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Email Services For Privacy Concerned People) +[#]: via: (https://itsfoss.com/secure-private-email-services/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Best Email Services For Privacy Concerned People +====== + +Email services like Gmail, Outlook, and a couple of other email service providers are quite popular. Well, they’re definitely secure in a way – but not necessarily private (i.e they do not respect your privacy with utmost care). + +Maybe, you want to share something confidential and you want it to be well-protected. Or, maybe, you just want to talk about Area 51? (_shh, CIA wants to know your location!_) Or you just don’t want to the service providers to read your emails to serve you ads. + +No matter what. If you are concerned about the privacy and security of your email conversation and want them to be as private as possible – this article shall help you find the best email services for the job. + +**Note**: _Judging by the privacy policies and given the work of these services (advocating about privacy & protecting users’ data) – we have hand-picked the services as recommendations for you. But, we advise you to believe that nothing is 100% foolproof and will never be. So, always be cautious – no matter what service it is._ + +### Email Services to Secure Your Privacy + +![][1] + +Our list includes free/paid services which may offer standalone applications for multiple platforms (here – Linux will be the priority) or could be web-based email service providers as usual. + +#### 1\. ProtonMail + +![][2] + +Key Highlights: + + * Open Source + * End-to-end encrypted + * Swiss-based (protected by legal privacy laws) + * Free & Paid options available + * Custom Domain supported (requires premium subscription) + * Self-destruct message functionality + * 2FA Available + + + +ProtonMail is a quite popular Swiss-based email service which follows an ad-free model to protect your privacy. It lets you specify an expiration time for an email to self-destruct itself. In addition to all the security features, it is open source in nature. So, you can review the open-source encryption libraries or other stuff to be sure. + +To add a custom domain, you need to have a premium subscription. You can use it for free with limited features or choose to upgrade it to a premium subscription (and supporting the company behind it). + +[ProtonMail][3] + +#### 2\. Tutanota + +![][4] + +Key Highlights: + + * Open Source + * End-to-end encrypted + * 2FA Available + * Free & Paid options available + * Custom Domains supported (requires premium subscription) + * Whitelabel for business available + + + +Tutanota is yet another privacy-friendly email service provider fit for personal and business use. In contrast to ProtonMail, it provides 1 GB of storage (instead of 500 MB) for free users. And, you can add more storage to your account as well. + +[][5] + +Suggested read  4 Best Free and Open Source Tools for RAW Image Processing in Linux + +You would need a premium subscription in order to add a custom domain. If you want, you can also opt for the ability to whitelabel the service for your business. + +[Tutanota][6] + +#### 3\. Librem Mail + +![][7] + +Key Highlights: + + * Decentralized + * End-to-end encrypted + + + +Librem Mail is a part of [Librem One][8] suite of services by Purism. Unlike others, it isn’t free. You need to opt for the premium subscription of Librem One in order to get access to Librem Mail. + +Personally, I haven’t used it. But, it looks like a decent end-to-end encrypted ad-free email service given the history of Purism to protect users’ privacy. + +[Librem One Suite][8] + +#### 4\. Criptext + +![Criptext][9] + +Key Highlights: + + * Decentralized + * End-to-end encrypted + * Open Source Signal Protocol Encryption + * Standalone Desktop Applications (Linux, Windows, & Mac) + * Real-time email tracking + * Unsend option + + + +Criptext is a completely free email service available across desktops and mobile phones. It does not support custom domains (or Whitelabel). However, it utilizes the open source encryption (Signal Protocol) – which you might have heard of if you have used “Signal” messenger. + +They plan to introduce premium subscriptions with added benefits – but for now as it stands, it is free for all. + +[Criptext][10] + +#### 5\. Mailfence + +![][11] + +Key Highlights: + + * End-to-end encrypted + * Free & Paid options + * Custom domain support available + * 2FA Available + * Browser-based only (no mobile apps) + + + +Mailfence is a decent privacy-focused email service which enforces OpenPGP end-to-end encryption. You can start using it for free with limited storage (500 MB) and features. In either case, you also get the ability to upgrade your subscription to increase the storage space, unlock the ability to use a custom domain and so on. + +The only downside that can be seen here is the lack of mobile apps. So, you need to launch a browser and sign-in in order to use across multiple devices. + +[Mailfence][12] + +#### 6\. TorGuard’s Private-Mail + +![][13] + +Key Highlights: + + * OpenPGP end-to-end encryption + * Standalone Desktop app (Windows for now) + * Free and paid options + * Custom domain option available with premium subscription + + + +Private-mail ticks all the points that you normally look for in a privacy-focused email service. If you want it for free, you will only get 100 MB of storage with encryption and webmail access only. + +[][14] + +Suggested read  11 Open Source Tools for Writers + +If you want to access the service across multiple devices (that includes your smartphone) – you may want to upgrade your subscription. For now, a desktop client for Windows is available. According to their download page – it is coming to Linux soon enough. + +[Private-Mail][15] + +#### 7\. Hushmail + +![][16] + +Key Highlights: + + * 14-Days Trial for Personal Use + * Separate plans & pricing for business users (small businesses, healthcare, law, non-profits, & enterprise) + * OpenPGP end-to-end encryption + * Ability to create 2 web forms to let people reach out to you + + + +Hushmail is an interesting email service provider for privacy concerned people. For personal use, it allows you to access a 14-day trial period. + +But, for businesses – it categorizes them and offers different pricing. For example, if you want to utilize a secure email service for your Healthcare company – it offers you HIPAA compliant service. Similarly, different plans for law firms, non-profits, enterprises, and small businesses. + +In addition to the ability to add a custom domain for businesses, it also lets everyone create web forms (both personal and business users). + +[Hushmail][17] + +#### 8\. CounterMail + +![][18] + +Key Highlights: + + * OpenPGP end-to-end encryption + * Custom domain support + * Web form support + * Windows, Linux, & MacOS X support + + + +CounterMail is yet another alternative as a secure email service to the others mentioned above. It lets you try the service for one week absolutely for free. In addition to the encryption, it lets you have your own domain and create web forms – no matter what level of subscription you have. + +The more you spend, the more storage you get. But, the features remain the same – which is a good thing in a way. + +[CounterMail][19] + +**Wrapping Up** + +You may have to face some inconvenience when using a privacy-focused email service, such as – mediocre UI and some personalization features. However, that’s a trade-off that you have to bear with if you want to prioritize your privacy over anything else. + +Did we miss any of your favorites? Do you hate one of the services mentioned above? Feel free to let us what you think in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/secure-private-email-services/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/secure-email-services.png?resize=800%2C450&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/protonmail.jpg?fit=800%2C424&ssl=1 +[3]: http://proton.go2cloud.org/SH1V +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/tutanota.jpg?fit=800%2C441&ssl=1 +[5]: https://itsfoss.com/raw-image-tools-linux/ +[6]: https://tutanota.com/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/librem-mail.jpg?fit=800%2C470&ssl=1 +[8]: https://librem.one/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/criptext.jpg?fit=800%2C477&ssl=1 +[10]: https://criptext.com +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/mailfence.png?fit=800%2C295&ssl=1 +[12]: https://mailfence.com/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/private-mail.jpg?fit=800%2C304&ssl=1 +[14]: https://itsfoss.com/open-source-tools-writers/ +[15]: https://privatemail.com/ +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/hushmail.png?fit=800%2C357&ssl=1 +[17]: https://www.hushmail.com +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/countermail-1.jpg?fit=800%2C454&ssl=1 +[19]: https://countermail.com/?p=start diff --git a/sources/tech/20190827 curl exercises.md b/sources/tech/20190827 curl exercises.md new file mode 100644 index 0000000000..36eae2743b --- /dev/null +++ b/sources/tech/20190827 curl exercises.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (curl exercises) +[#]: via: (https://jvns.ca/blog/2019/08/27/curl-exercises/) +[#]: author: (Julia Evans https://jvns.ca/) + +curl exercises +====== + +Recently I’ve been interested in how people learn things. I was reading Kathy Sierra’s great book [Badass: Making Users Awesome][1]. It talks about the idea of _deliberate practice_. + +The idea is that you find a small micro-skill that can be learned in maybe 3 sessions of 45 minutes, and focus on learning that micro-skill. So, as an exercise, I was trying to think of a computer skill that I thought could be learned in 3 45-minute sessions. + +I thought that making HTTP requests with `curl` might be a skill like that, so here are some curl exercises as an experiment! + +### what’s curl? + +curl is a command line tool for making HTTP requests. I like it because it’s an easy way to test that servers or APIs are doing what I think, but it’s a little confusing at first! + +Here’s a drawing explaining curl’s most important command line arguments (which is page 6 of my [Bite Size Networking][2] zine). You can click to make it bigger. + + + +### fluency is valuable + +With any command line tool, I think having fluency is really helpful. It’s really nice to be able to just type in the thing you need. For example recently I was testing out the Gumroad API and I was able to just type in: + +``` +curl https://api.gumroad.com/v2/sales \ + -d "access_token=" \ + -X GET -d "before=2016-09-03" +``` + +and get things working from the command line. + +### 21 curl exercises + +These exercises are about understanding how to make different kinds of HTTP requests with curl. They’re a little repetitive on purpose. They exercise basically everything I do with curl. + +To keep it simple, we’re going to make a lot of our requests to the same website: . httpbin is a service that accepts HTTP requests and then tells you what request you made. + + 1. Request + 2. Request . httpbin.org/anything will look at the request you made, parse it, and echo back to you what you requested. curl’s default is to make a GET request. + 3. Make a POST request to + 4. Make a GET request to , but this time add some query parameters (set `value=panda`). + 5. Request google’s robots.txt file ([www.google.com/robots.txt][3]) + 6. Make a GET request to and set the header `User-Agent: elephant`. + 7. Make a DELETE request to + 8. Request and also get the response headers + 9. Make a POST request to with the JSON body `{"value": "panda"}` + 10. Make the same POST request as the previous exercise, but set the Content-Type header to `application/json` (because POST requests need to have a content type that matches their body). Look at the `json` field in the response to see the difference from the previous one. + 11. Make a GET request to and set the header `Accept-Encoding: gzip` (what happens? why?) + 12. Put a bunch of a JSON in a file and then make a POST request to with the JSON in that file as the body + 13. Make a request to and set the header ‘Accept: image/png’. Save the output to a PNG file and open the file in an image viewer. Try the same thing with with different `Accept:` headers. + 14. Make a PUT request to + 15. Request , save it to a file, and open that file in your image editor. + 16. Request . You’ll get an empty response. Get curl to show you the response headers too, and try to figure out why the response was empty. + 17. Make any request to and just set some nonsense headers (like `panda: elephant`) + 18. Request and . Request them again and get curl to show the response headers. + 19. Request and set a username and password (with `-u username:password`) + 20. Download the Twitter homepage () in Spanish by setting the `Accept-Language: es-ES` header. + 21. Make a request to the Stripe API with curl. (see for how, they give you a test API key). Try making exactly the same request to . + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/08/27/curl-exercises/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.amazon.com/Badass-Making-Awesome-Kathy-Sierra/dp/1491919019 +[2]: https://wizardzines.com/zines/bite-size-networking +[3]: http://www.google.com/robots.txt diff --git a/sources/tech/20190828 Introduction to the Linux chmod command.md b/sources/tech/20190828 Introduction to the Linux chmod command.md new file mode 100644 index 0000000000..334158ba6c --- /dev/null +++ b/sources/tech/20190828 Introduction to the Linux chmod command.md @@ -0,0 +1,313 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to the Linux chmod command) +[#]: via: (https://opensource.com/article/19/8/linux-chmod-command) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdosshttps://opensource.com/users/mralexjuarezhttps://opensource.com/users/brsonhttps://opensource.com/users/seth) + +Introduction to the Linux chmod command +====== +Chmod, which sets read, write, and execute permissions, is one of the +most important Linux security commands. +![5 pengiuns floating on iceburg][1] + +Every object on your Linux system has a permission mode that describes what actions a user can perform on it. There are three types of permissions: read (**r**), write (**w**), and execute (**x**). + +To **read** a file is to view its contents. For example, a text file must have **read** permission for someone to read the text within. If the user wants to add a sentence to that file, it needs **write** permission. The **execute** permission enables someone to run a file, such as a shell script or a binary program file. + +### Basic permissions + +The **ls -l** command displays the permissions assigned to a file. For example: + + +``` +ls -l +-rw-rw-r-- 1 bruce bruce    0 Jul 30 16:25 schedule1.txt +``` + +Some permissions (**rw**) appear more than once because they are referring to different entities: _user_, _group_, and _other_. _User_ is synonymous with the owner, and _group_ refers to the user's primary group, both of which are **bruce**. _Other_ refers to all other users. + +The first position denotes the object's type: **-** for a file, **d** for a directory, and **l** for a symbolic link. The next nine positions are grouped in threes and describe the permission mode. The positions are ordered **r**,**w**,**x**, and the groups are ordered **user**, **group**, **other**. + +\--- --- --- | rwx rwx rwx +---|--- +uuu ggg ooo | u=user, g=group, o=other + +#### Files + +A file with read, write, and execute bits set for all entities would appear: + + +``` +`rwxrwxrwx` +``` + +Of course, we don't usually configure files this permissively in the real world; this is just an illustration of how each position is used. + +In the following example, a file is configured for its owner (**pablo**) to have read and write permissions, for members of the group to only have read permission, and for everyone else to have no permissions. + + +``` +`-rw-r----- 1 pablo pablo    0 Jul 30 16:25 textfile` +``` + +The **chmod** command modifies the permission mode of objects in the system. It is one of the most used and important commands in the set of Linux security commands. + +A plus (**+**) symbol adds a permission, and a minus (**-**) symbol removes a permission. You can read **chmod u+r** as "user plus read," as it gives the user _read_ permission. The command **chmod u-r** means "user minus read," as it takes the _read_ permission away from the user. + +#### Directories + +The same three permissions also apply to a directory. A directory must have the _read_ permission for a user to view its contents. It will need _write_ permission for a user to add to the directory (e.g., to create a new file). For a user to change to a directory (**cd**), it must have _execute_ permission. + + +``` +`drw-rw-r-- 2 pablo pablo 4096 Jul 30 15:56 JBOSS` +``` + +Pablo may be the owner of the JBOSS directory, but since he doesn't have execute permission, he can not **cd** into it. He can use the command **chmod u+x** to add the permission, and then he can **cd** into it. + + +``` +$ cd JBOSS +bash: cd: JBOSS: Permission denied +$ chmod u+x JBOSS +$ ls -l +drwxrw-r-- 2 pablo pablo 4096 Jul 30 15:56 JBOSS +$ cd JBOSS +$ pwd +/opt/JBOSS +``` + +#### Combined arguments + +You can combine arguments using a comma. In this example, you only need one command to set permissions so the group cannot write to a file nor can the rest of the world read it: + + +``` +$ chmod o-r,g-w readme.txt +$ ls -l +-rw-r----- 1 pablo share 0 Jul 31 13:34 readme.txt +``` + +You can read this as "others minus read and group minus write." + +Suppose Denise has written a Bash script called **home_backup.sh** and wants to give it _execute_ permission. She also wants to prevent anyone else from reading, writing, or executing it. One way to do this is with the plus and minus symbols: + + +``` +`$ chmod go-rw,u+x home_backup.sh` +``` + +Another way is by using the equals (**=**) symbol. This will set the permissions absolutely without regard for previous settings. Note that there is a space after the second equals; this indicates a value of **none**: + + +``` +`$ chmod u=rwx,go= home_backup.sh` +``` + +You can read this as "permissions for user equal read, write, and execute and permissions for group and other equal none." + +### Numeric mode + +Chmod also supports a numeric mode, which uses values assigned to each position: + +owner + +group + +other + +r + +w + +x + +r + +w + +x + +r + +w + +x + +400 + +200 + +100 + +40 + +20 + +10 + +4 + +2 + +1 + +The total value of a set of permissions can be calculated and passed to the chmod command as a single argument. Take the example with Denise and her backup script. If she uses numeric mode to set the permissions on her script, she must first calculate the value total: + + +``` +`-rwx------ 1 denise denise 0 Jul 31 13:53 home_backup.sh` +``` + +Denise adds the numbers that correspond to each permission she wants to apply: + +**400 + 200 + 100 = 700** + +Her command will be **chmod 700 home_backup.sh**. Suppose Denise wanted to reset the original permissions on the file: + + +``` +`-rw-rw-r-- 1 denise denise 0 Jul 31 13:53 home_backup.sh` +``` + +The value of these permissions calculates to 664: + +**400 + 200 + 40 + 20 + 4 = 664** + +Denise can use the command **chmod 664 home_backup.sh** to restore the original permissions. + +### Special modes + +Three other modes can be set on an object: + +name | symbolic | numeric +---|---|--- +setuid | s | 4000 +setgid | s | 2000 +sticky | t | 1000 + +The **SetUID** bit enforces user ownership on an executable file. When it is set, the file will execute with the file owner's user ID, not the person running it. + + +``` +`$ chmod u+s` +``` + +The **SetGID** bit enforces group ownership on files and directories. When it is set, any file or directory created in a directory will get the directory's group ownership, not the user's. When it is set on a file, the file will always be executed as its owning group rather than as the user: + + +``` +`$ chmod g+s` +``` + +The **sticky** bit, also referred to as the "restricted deletion flag," can be set on a directory to prevent anyone except the directory's owner from deleting a file in that directory: + + +``` +`$ chmod o+t` +``` + +The sticky bit can be set in numerical mode by adding its value to those of the other permissions. If you have an object with a value of 755 and you want to set the sticky bit, add 1000: + +**1000 + 400 + 200 + 100 + 40 + 10 + 4 + 1 = 1755** + +This command would be **chmod 1755**. Several symbolic methods are equivalent; one example is **chmod u=rwx,go=rx,o+t**. + +### Extras + +The letter **a** is a shortcut to assign permissions to all users. The command **chmod a+rwx** is equivalent to **chmod ugo+rwx**. + +#### Recursive + +Like many other Linux commands, chmod has a recursive argument, **-R**, which allows you to operate on a directory and its contents recursively. By recursive, It is meant that the command will attempt to operate on all objects below the specified directory rather than just the directory itself. This example starts in an empty directory and adds the **-v** (verbose) argument, so chmod will report what it is doing: + + +``` +$ ls -l . conf +.: +drwxrwxr-x 2 alan alan 4096 Aug  5 15:33 conf + +conf: +-rw-rw-r-- 1 alan alan 0 Aug  5 15:33 conf.xml +$ chmod -vR 700 conf +mode of 'conf' changed from 0775 (rwxrwxr-x) to 0700 (rwx------) +mode of 'conf/conf.xml' changed from 0664 (rw-rw-r--) to 0700 (rwx------) +``` + +#### Reference + +A reference file command (**\--reference=RFILE**) can be used to duplicate the mode of another file (**RFILE**), known as a reference file. This is handy when you are changing modes on files to match a certain configuration or when you don't know the exact mode—or don't want to take time to calculate it: + + +``` +$ ls -l +-rw-r--r-x 1 alan alan 0 Aug  5 17:10 notes.txt +-rw-rw-r-- 1 alan alan 0 Aug  5 17:10 readme.txt +$ chmod --reference=readme.txt notes.txt +$ ls -l +-rw-rw-r-- 1 alan alan 0 Aug  5 17:10 notes.txt +-rw-rw-r-- 1 alan alan 0 Aug  5 17:10 readme.txt +``` + +#### Report changes + +The chmod command also has a **-c** (**\--changes**) argument, which tells chmod to report only when a change is made (versus **-v**, or **-verbose**, which tells chmod to report all its output). Chmod will still report other things, such as if an operation is not allowed. + +The argument **-f** (**\--silent**, **\--quiet**) suppresses most error messages. Using this argument with **-c** will show only real changes. + +#### Preserve root + +The root (**/**) of the Linux filesystem should be treated with great respect. If someone makes a command mistake at this level, the consequences can be terrible and leave a system completely useless, particularly when you are running a recursive command that will make any kind of change—or worse: deletions. Fortunately, the chmod command's **\--preserve-root** argument will protect and preserve the root. If the argument is used with a recursive chmod command on the root, nothing will happen, and you will see this message: + + +``` +[alan@localhost ~]# chmod -cfR --preserve-root a+w / +chmod: it is dangerous to operate recursively on '/' +chmod: use --no-preserve-root to override this failsafe +``` + +The option has no effect when it is not used with recursive. However, if the root user runs the command, the permissions of the **/** will change, but not those of other files or directories. + + +``` +[alan@localhost ~]$ chmod -c --preserve-root a+w / +chmod: changing permissions of '/': Operation not permitted +[root@localhost /]# chmod -c --preserve-root a+w / +mode of '/' changed from 0555 (r-xr-xr-x) to 0777 (rwxrwxrwx) +``` + +Surprisingly, this is not the default argument; **\--no-preserve-root** is. If you run a command without the "preserve" option, it will default to "no preserve" mode and possibly change permissions on files that shouldn't be changed. + + +``` +[alan@localhost ~]$ chmod -cfR a+x / +mode of '/proc/1525/task/1525/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1541/task/1541/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1541/task/1580/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1541/task/1592/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1557/task/1557/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1558/task/1558/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +mode of '/proc/1561/task/1561/comm' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x) +``` + +### Conclusion + +All objects on a Linux system have a set of permissions. It is important to check and maintain them occasionally to prevent unwanted access. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-chmod-command + +作者:[Alan Formy-Duval][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/alanfdosshttps://opensource.com/users/mralexjuarezhttps://opensource.com/users/brsonhttps://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_linux31x_cc.png?itok=Pvim4U-B (5 pengiuns floating on iceburg) diff --git a/sources/tech/20190828 Using GNS3 with Fedora.md b/sources/tech/20190828 Using GNS3 with Fedora.md new file mode 100644 index 0000000000..70a230f3f9 --- /dev/null +++ b/sources/tech/20190828 Using GNS3 with Fedora.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using GNS3 with Fedora) +[#]: via: (https://fedoramagazine.org/using-gns3-with-fedora/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Using GNS3 with Fedora +====== + +![][1] + +GNS3 is [an amazing tool][2] that allows IT professionals to, quite simply, create a virtual lab. The software can virtualize or emulate a variety of systems called appliances. These appliances range from Cisco routers and switches to nodes such as Windows Server, CentOS, and Fedora. GNS3 also has the capability to utilize [containers][3]. If you’re designing and testing proof-of-concept ideas, recreating environments for troubleshooting, or want to delve into the world of network engineering, GNS3 might be for you. + +As seen on their website, GNS3 is well acquainted in the enterprise world. Companies using it span from tech businesses like Intel, to scientific organizations like NASA. Even renown banks and telecom companies are included in the list. This adds great credibility to the power and reliability this open-source tool provides. + +### Installation + +For Fedora users, GNS3 can be easily installed from the official repository. From the command-line type: + +``` +sudo dnf install gns3-server gns3-gui +``` + +The reason for the separate packages is because GNS3 can be configured as a dedicated server. This is useful for teams to collaborate while working on a project, or problem. The dedicated servers can be installed on bare-metal or as a virtual machine. + +GNS3 requires a computer with virtualization capabilities. This allows the software to utilize the computer’s hardware to increase the performance when running the appliances. To use Spice/VNC as a console install the _virt-viewer_ package. + +When the installation is complete, an icon will be placed among the applications for GNS3. + +![][4] + +### Initial setup + +Opening GNS3 for the first time will open the Setup Wizard. The options on the first screen allow users to either setup an isolated VM environment, run the topologies from the local computer, or to use a remote server. The examples in this article are performed on the local machine. + +The next screen configures the application to connect to the local machine running GNS3 server. Here we see the path to the application installed locally on the server, host binding address, and port. These settings can be tweaked to match your setup. However, for a quick setup it’s best to accept the defaults. + +Once the settings are verified, a confirmation will appear stating the connection to the local server was successful. The last screen in the wizard will provide a summary. Click the **Finish** button to complete the setup. + +![][5] + +### Finding appliances in the GNS3 Marketplace + +Before venturing into the GUI, this would be a good time to visit the [GNS3 Marketplace][6]. The marketplace contains appliances, pre-configured labs, and software for use with GNS3. The options in the Marketplace are vast and beyond the scope of this article. However, let’s download an appliance to see how it works. + +First, select the appliance you want (the examples in this article will use OpenWRT). Select the template for that appliance to download. Appliance templates are JSON files with the extension _gns3a_. + +You can also install OS nodes without a template, or create your own. [OSBoxes.org][7] has a variety of pre-built VMWare images (VMDK) that are compatible with GNS3. For this article we’ll use the Fedora 64-bit VMWare image. You can also find images for many other distributions such as CentOS, Ubuntu, and Kali Linux. + +To use Cisco appliances a service agreement or subscription to VIRL is needed to download the IOS images from Cisco. For links and guides to legally download Cisco IOS, check out David Bombal’s site at . + +You may also need to install Dynamips which is not included in the official repos. However, a simple web search will point to the RPM package. + +![][8] + +### Importing appliances to GNS3 + +Now that we have some appliances let’s build a small and simple topology using the templates and images we just downloaded. + +After the initial setup the **New appliance template** window will open. From here we can import template files like the _gns3a_ file downloaded from the Marketplace. Other options for adding appliances without a template include IOS devices, VMs, and Docker containers. + +To add the OpenWRT router, click **Import an appliance template file**. This will open the **Add appliance** wizard. Review the information on the first screen which shows the category, vendor, architecture, and KVM status for that appliance, and click **Next**. Now select the **Server type** to run the appliance and click **Next**. This is where we can specify whether we want to run it on a remote server, in a GNS3 VM, or on the local machine. After verifying the server requirements click **Next** to continue the installation. + +At this point it’s time to install the image file for the OpenWRT appliance. Select the version and click the **Download** button. This will go to the site containing the image file and download it. This article will use OpenWRT 18.06.4 downloaded from the project’s website. If the version of the image is not in the list, click the button to **Create a new version**, and enter the version number (in this case 18.06.4). Select the filename and click **Import** to import the image. GNS3 will then ask if you would like to copy the image and decompress it (if necessary). Accept it and complete the install. + +![][9] + +### Adding appliances without a template + +To add the Fedora VM downloaded from OSBoxes, click on one of the icons on the left and select **New appliance template** near the bottom. Select **Add a Qemu virtual machine** and click **Next**. Enter a name for the appliance (in this case Fedora 30) then click **Next**. Verify the QEMU binary path and input the amount of RAM to use for the VM, then select the **Console type**. On the next screen select **New image** and browse for the VMDK file. Depending on the file-size it may take a few moments. To copy/import the image select **Yes** and once it’s completed click **Finish**. + +![][10] + +### Adding and connecting nodes in GNS3 + +Now that we have some appliances, let’s build a simple topology with OpenWRT and Fedora in GNS3. The icons on the left represent Routers, Switches, End devices, and Security devices. The second-last shows all appliances, and the bottom option is to _Add a link_ which connects the nodes to each other. + +Click on the **Routers** icon and drag the OpenWRT router onto the empty workspace to the right. Click on the **End devices** icon and do the same for the computer node. Depending on how large the file is, it may take a few moments for the PC node to appear in the workspace. To connect the nodes, click **Add a link** then click on a node, select the interface (i.e. Ethernet0), then do the same with the other node (as seen in the demo below). + +You can customize the consoles by going to the menu bar and selecting **Edit > Preferences > General**. Select the tab for **Console applications** and click the **Edit** button. From here you can choose your favourite terminal in the drop-down menu and even customize it in the text-box below. + +Once everything is in place, start the nodes by clicking the green (play) button at the top. The lights in the Topology Summary section will turn green indicating the nodes are on. To open the consoles for the nodes, click the **Console to all devices** button to the left (it looks like a terminal icon). The Remote Viewer window for Fedora and a terminal window for OpenWRT will open. + +Once complete you can turn off the nodes individually by right-clicking on the node and selecting **Stop**, or to stop all nodes click the red **Stop** button in the top bar. + +![][11] + +### Conclusion + +GNS3 is a powerful piece of software with features that are beyond the scope of this article. The software is similar to Cisco’s Packet Tracer. However, Packet Tracer is a simulator with limitations to the program’s coding. GNS3 on the other hand virtualizes/emulates the nodes using the hardware’s actual OS. This provides full functionality and a closer experience to the actual hardware. + +The [GNS3 documentation][12] site offers an enormous amount of resources that delve further into the workings of the application. They also offer training courses for those interested in digging deep into the workings of the software. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-gns3-with-fedora/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3.png-816x345.jpg +[2]: https://gns3.com +[3]: https://fedoramagazine.org/running-containers-with-podman/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-app-icon-1024x768.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-initial-setup.gif +[6]: https://www.gns3.com/marketplace +[7]: https://www.osboxes.org +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-marketplace.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-adding-appliance-template.gif +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-adding-vm-image-without-template.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/gns3-demo.gif +[12]: https://docs.gns3.com diff --git a/sources/tech/20190828 What are environment variables in Bash.md b/sources/tech/20190828 What are environment variables in Bash.md new file mode 100644 index 0000000000..abe9020362 --- /dev/null +++ b/sources/tech/20190828 What are environment variables in Bash.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What are environment variables in Bash?) +[#]: via: (https://opensource.com/article/19/8/what-are-environment-variables) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +What are environment variables in Bash? +====== +Learn about environment variables in Bash in our miniseries: Variables +in shells. +![x sign ][1] + +Environment variables contain information about your login session, stored for the system shell to use when executing commands. They exist whether you’re using Linux, Mac, or Windows. Many of these variables are set by default during installation or user creation. + +While environment variables apply to all modern systems, this article specifically addresses environment variables in the Bash shell on Linux, BSD, Mac, and Cygwin. + +### Understanding environment variables + +Environment variables are no different, technically, than variables. They can be set, recalled, and cleared with exactly the same syntax used for variables. If you’re not used to using variables in Bash, read my [variables in Bash][2] article before continuing. + +You don’t often use environment variables directly. They’re referenced by individual applications and daemons as needed. For instance, your home directory is set as an environment variable when you log in. For example, on Linux you can see your **HOME** environment variable's contents like this: + + +``` +$ echo $HOME +HOME=/home/seth +``` + +On a Mac: + + +``` +$ echo $HOME +HOME=/Users/bogus +``` + +On Windows: + + +``` +`C:\Users\bogus` +``` + +You can view all environment variables set on your system with the **env** command. ****The list is long, so pipe the output through **more** to make it easier to read: + + +``` +$ env | more +TERM=xterm-256color +LESSOPEN=||/usr/bin/lesspipe.sh %s +USER=seth +SUDO_EDITOR=emacs +WWW_HOME= +VISUAL=emacs +DISPLAY=:0 +PS1=$ +XDG_DATA_DIRS=/home/seth/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/ +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin +GDMSESSION=gnome +MAIL=/var/spool/mail/seth +[...] +``` + +Environment variables can be useful when you want to override default settings, or when you need to manage new settings that your system has no reason to create on its own. For instance, when you type a command, the only reason your computer knows how to _find_ the application corresponding to that command is that the **PATH** environment variable tells it where to look. This variable lists valid directories for your operating system to search for commands, whether that command is [**ls**][3] or [cp][4], or a graphical application like Firefox or [Lutris][5], or anything else. + +Different environment variables get used by different systems. Your **PATH** variable is vital to your terminal emulator, for instance, but a lot less significant to, say, Java (which has its own paths, which point to important Java libraries). However, the **USER** variable is used by several systems as a way to identify who is requesting a service. For example, if you’re on a multiuser system and need to check your local mailbox, your mail command knows which mail spool to retrieve based on the **MAIL** and **USER** variables. + +### Setting an environment variable + +Usually, the installer program, whether it’s **dnf** on Fedora, **apt** on Ubuntu, **brew** on Mac, or a custom installer, updates your environment variables for a new application. Sometimes, though, when you’re installing something outside of your distribution’s intended toolset, you may have to manage an environment variable yourself. Or you might choose to add an environment variable to suit your preferences. If you decide you want to keep some applications in a **bin** folder located in your home directory, then you must add that directory to your **PATH** so your operating system knows to look there for applications to run when you issue a command. + +#### Temporary environment variables + +You can add a location to your path the way you create throw-away variables. It works, but only as long as the shell you used to modify your system path remains open. For instance, open a Bash shell and modify your system path: + + +``` +$ export PATH=$PATH:/home/seth/bin +``` + +Confirm the result: + + +``` +$ echo $PATH +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin:/home/seth/bin +``` + +Close the session: + + +``` +$ exit +``` + +Open a new one and take a look at the **PATH** variable: + + +``` +$ echo $PATH +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin +``` + +This variable has reverted to its default state because **PATH** isn’t getting set with each new shell. For that, you must configure your variables to load any time a shell is launched. + +#### Permanent environment variables + +You can set your own persistent environment variables in your shell configuration file, the most common of which is **~/.bashrc**. If you’re a system administrator managing several users, you can also set environment variables in a script placed in the **/etc/profile.d** directory. + +The syntax for setting a variable by configuration file is the same as setting a variable in your shell: + + +``` +export PATH=$PATH:/snap/bin:/home/seth/bin +``` + +Close the current shell, or else force it to load the updated config: + + +``` +$ . ~/.bashrc +``` + +Finally, take another look at your system path: + + +``` +$ echo $PATH +PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/snap/bin:/home/seth/bin:/home/seth/.local/bin:/snap/bin:/home/seth/bin +``` + +It is now set correctly to include your additional custom directory. + +### Discovering other environment variables + +You can create and manipulate environment variables at will, and some applications do just that. This fact means that many of your environment variables aren’t used by most of your applications, and if you add your own arbitrary variables then some could be used by nothing at all. So the question is: How do you find out which environment variables are meaningful? + +The answer lies in an application’s documentation. For instance, to find out what options are available to you for your general Bash environment, you can read the Bash documentation. While the Bash man page mentions many important variables, the GNU info page for Bash features two exhaustive lists of useful Bourne Shell and Bash environment variables, and how each is used. + +For example, in the info page list: + + +``` +'HISTCONTROL' +     A colon-separated list of values controlling how commands are saved +     on the history list.  If the list of values includes 'ignorespace', +     lines which begin with a space character are not saved in the +     history list.  A value of 'ignoredups' causes lines which match the +     previous history entry to not be saved.  A value of 'ignoreboth' is +     shorthand for 'ignorespace' and 'ignoredups'. +     [...] +``` + +This output tells you that the **HISTCONTROL** environment variable controls how your Bash history is presented, and what values you can use to customize that experience. In this example, the **ignoredups** value tells the output of the **history** command to ignore duplicate lines. + +You can test this one easily. First, issue the same command twice in a row: + + +``` +$ echo "hello world" +hello world +$ echo "hello world" +hello world +``` + +View your history, or at least the most recent entries: + + +``` +$ history | tail -5 + 996  man bash + 997  info bash + 998  echo "hello world" + 999  echo "hello world" + 1000 history +``` + +You can see that duplicate entries are indeed listed now. + +Set a new environment variable in your **.bashrc** file based on what you read in the info page: + + +``` +export HISTCONTROL=$HISTCONTROL:ignorespace:ignoredups +``` + +Save and then load your new configuration: + + +``` +$ source ~/.bashrc +``` + +Issue two commands twice in a row: + + +``` +$ echo "hello once" +hello once +$ echo "hello once" +hello once +``` + +View the most recent entries in your history: + + +``` +$ history | tail -5 + 1000 history + 1001 emacs ~/.bashrc + 1002 source ~/.bashrc + 1003 echo "hello once" + 1004 history +``` + +Duplicate entries are now collapsed into one entry because of your new environment variable, just as the info page specified. + +Finding relevant environment variables is usually a matter of reading the documentation for the application you want to affect. Most environment variables are specific to what one application needs to run smoothly. For general entries, your shell’s documentation is the logical place to look. If you write scripts or applications that require new environment variables, be sure to define those variables in your own documentation. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/what-are-environment-variables + +作者:[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/x_stop_terminate_program_kill.jpg?itok=9rM8i9x8 (x sign ) +[2]: https://opensource.com/article/19/8/using-variables-bash +[3]: https://opensource.com/article/19/7/master-ls-command +[4]: https://opensource.com/article/19/8/copying-files-linux +[5]: https://opensource.com/article/18/10/lutris-open-gaming-platform diff --git a/sources/tech/20190829 Variables in PowerShell.md b/sources/tech/20190829 Variables in PowerShell.md new file mode 100644 index 0000000000..6d522610c1 --- /dev/null +++ b/sources/tech/20190829 Variables in PowerShell.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Variables in PowerShell) +[#]: via: (https://opensource.com/article/19/8/variables-powershell) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Variables in PowerShell +====== +In our miniseries Variables in Shells, learn how to handle local +variables in PowerShell. +![Shells in a competition][1] + +In computer science (and casual computing), a variable is a location in memory that holds arbitrary information for later use. In other words, it’s a temporary storage container for you to put data into and get data out of. In the Bash shell, that data can be a word (a _string_, in computer lingo) or a number (an _integer_). + +You may have never (knowingly) used a variable before on your computer, but you probably have used a variable in another area of your life. When you say things like "give me that" or "look at this," you’re using grammatical variables (you think of them as _pronouns_). The meaning of "this" and "that" depends on whatever you’re picturing in your mind, or whatever you’re pointing to as an indicator for your audience to know what you’re referring to. When you do math, you use variables to stand in for unknown values, even though you probably don’t call them variables. + +This article addresses variables in [PowerShell][2], which runs on Windows, Linux, or Mac. Users of the open source [Bash][3] shell should refer to my article about variables in the Bash shell instead (although you can run PowerShell on Linux, and it is open source, so you can still follow along with this article). + +**Note:** The examples in this article are from a PowerShell session running on the open source operating system Linux, so if you’re on Windows or Mac the file paths will differ. However, Windows converts **/** to **\** automatically, and all examples work across all platforms, provided that you substitute obvious differences (for instance, it is statistically unlikely that your username is **seth**). + +### What are variables for? + +Whether you need variables in PowerShell depends on what you do in a terminal. For some users, variables are an essential means of managing data, while for others they’re minor and temporary conveniences, or for some, they may as well not exist. + +Ultimately, variables are a tool. You can use them when you find a use for them, or leave them alone in the comfort of knowing they’re managed by your OS. Knowledge is power, though, and understanding how variables work in Bash can lead you to all kinds of unexpected creative problem-solving. + +### Set a variable + +You don’t need special permissions to create a variable. They’re free to create, free to use, and generally harmless. In PowerShell, you create a variable by defining a variable name and then setting its value with the **Set-Variable** command. The example below creates a new variable called **FOO** and sets its value to the string **$HOME/Documents**: + + +``` +`PS> Set-Variable -Name FOO -Value "$HOME/Documents"` +``` + +Success is eerily silent, so you may not feel confident that your variable got set. You can see the results for yourself with the **Get-Variable** (**gv** for short) command. To ensure that the variable is read exactly as you defined it, you can also wrap it in quotes. Doing so preserves any special characters that might appear in the variable; in this example, that doesn’t apply, but it’s still a good habit to form: + + +``` +PS> Get-Variable "FOO" -valueOnly +/home/seth/Documents +``` + +Notice that the contents of **FOO** aren’t exactly what you set. The literal string you set for the variable was **$HOME/Documents**, but now it’s showing up as **/home/seth/Documents**. This happened because you can nest variables. The **$HOME** variable points to the current user’s home directory, whether it’s in **C:\Users** on Windows, **/home** on Linux, or **/Users** on Mac. Since **$HOME** was embedded in **FOO**, that variable gets _expanded_ when recalled. Using default variables in this way helps you write portable scripts that operate across platforms. + +Variables usually are meant to convey information from one system to another. In this simple example, your variable is not very useful, but it can still communicate information. For instance, because the content of the **FOO** variable is a [file path][4], you can use **FOO** as a shortcut to the directory its value references. + +To reference the variable **FOO**’s _contents_ and not the variable itself, prepend the variable with a dollar sign (**$**): + + +``` +PS> pwd +/home/seth +PS> cd "$FOO" +PS> pwd +/home/seth/Documents +``` + +### Clear a variable + +You can remove a variable with the **Remove-Variable** command: + + +``` +PS> Remove-Variable -Name "FOO" +PS> gv "FOO" +gv : Cannot find a variable with the name 'FOO'. +[...] +``` + +In practice, removing a variable is not usually necessary. Variables are relatively "cheap," so you can create them and forget them when you don’t need them anymore. However, there may be times you want to ensure a variable is empty to avoid conveying unwanted information to another process that might read that variable. + +### Create a new variable with collision protection + +Sometimes, you may have reason to believe a variable was already set by you or some other process. If you would rather not override it, you can either use **New-Variable**, which is designed to fail if a variable with the same name already exists, or you can use a conditional statement to check for a variable first: + + +``` +PS> New-Variable -Name FOO -Value "example" +New-Variable : A variable with name 'FOO' already exists. +``` + +**Note:** In these examples, assume that **FOO** is set to **/home/seth/Documents**. + +Alternately, you can construct a simple **if** statement to check for an existing variable: + + +``` +PS> if ( $FOO ) +>> { gv FOO } else +>> { Set-Variable -Name "FOO" -Value "quux" } +``` + +### Add to a variable + +Instead of overwriting a variable, you can add to an existing one. In PowerShell, variables have diverse types, including string, integer, and array. When choosing to create a variable with, essentially, more than one value, you must decide whether you need a [character-delimited string][5] or an [array][6]. You may not care one way or the other, but the application receiving the variable’s data may expect one or the other, so make your choice based on your target. + +To append data to a string variable, use the **=+** syntax: + + +``` +PS> gv FOO +foo +PS> $FOO =+ "$FOO,bar" +PS> gv FOO +foo,bar +PS> $FOO.getType().Name +String +``` + +Arrays are special types of variables in PowerShell and require an ArrayList object. That’s out of scope for this article, as it requires delving deeper into PowerShell’s .NET internals. + +### Go global with environment variables + +So far the variables created in this article have been _local_, meaning that they apply only to the PowerShell session you create them in. To create variables that are accessible to other processes, you can create environment variables, which will be covered in a future article. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/variables-powershell + +作者:[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/shelloff.png?itok=L8pjHXjW (Shells in a competition) +[2]: https://en.wikipedia.org/wiki/PowerShell +[3]: https://www.gnu.org/software/bash/ +[4]: https://opensource.com/article/19/8/understanding-file-paths-linux +[5]: https://en.wikipedia.org/wiki/Delimiter +[6]: https://en.wikipedia.org/wiki/Array_data_structure diff --git a/sources/tech/20190829 What is an Object in Java.md b/sources/tech/20190829 What is an Object in Java.md new file mode 100644 index 0000000000..033fdd5403 --- /dev/null +++ b/sources/tech/20190829 What is an Object in Java.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is an Object in Java?) +[#]: via: (https://opensource.com/article/19/8/what-object-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansenhttps://opensource.com/users/mdowdenhttps://opensource.com/users/sethhttps://opensource.com/users/drmjghttps://opensource.com/users/jamesfhttps://opensource.com/users/clhermansen) + +What is an Object in Java? +====== +Java's approach to object-oriented programming is the basis for almost +everything in the language. Here's what you need to know. +![Coffee beans and a cup of coffee][1] + +Java is an object-oriented programming language, which views the world as a collection of objects that have both _properties_ and _behavior_. Java's version of object-orientedness is pretty straightforward, and it's the basis for almost everything in the language. Because it's so essential to Java, I'll explain a bit about what's under the covers to help anyone new to the language. + +### Inheritance + +In general, all [Cartesian geometric objects][2], like circles, squares, triangles, lines, and points, have basic properties, like location and extension. Objects with zero extension, like points, usually don't have anything more than that. Objects like lines have more—e.g., the start and endpoint of a line segment or two points along a line (if it's a "true line"). Objects like squares or triangles have still more—the corner points, for example—whereas circles may have a center and radius. + +We can see there is a simple hierarchy at work here: The general geometric object can be _extended_ into specific geometric objects, like points, lines, squares, etc. Each specific geometric object _inherits_ the basic geometric properties of location and extension and adds its own properties. + +This is an example of _single inheritance_. Java's original object-oriented model allowed only single inheritance, where objects cannot belong to more than one inheritance hierarchy. This design decision comes out of the kinds of ambiguities programmers found themselves facing in [complex multiple-inheritance scenarios][3], typically in cases where "interesting design decisions" led to several possible implementations of the function **foo()** as defined (and re-defined) in the hierarchy. + +Since Java 8, there has been a limited multiple inheritance structure in place that requires specific actions on behalf of the programmer to ensure there are no ambiguities. + +### Strong and static typing + +Java is _strongly_ and _statically_ typed. What does this mean? + +A _statically_ typed language is one where the type of a variable is known at compile time. In this situation, it is not possible to assign a value of type B to a variable whose declared type is A, unless there is a conversion mechanism to turn a value of type B into a value of type A. An example of this type of conversion is turning an integer value, like 1, 2, or 42, into a floating-point value, like 1.0, 2.0, or 42.0. + +A _strongly_ typed language is one where very few (or perhaps no) type conversions are applied automatically. For example, whereas a strongly typed language might permit automatic conversion of _integer_ to _real_, it will never permit automatic conversion of _real_ to _integer_ since that conversion requires either rounding or truncation in the general case. + +### Primitive types, classes, and objects + +Java provides a number of primitive types: _byte_ (an eight-bit signed integer); _short_ (a 16-bit signed integer); _int_ (a 32-bit signed integer); _long_ (a 64-bit signed integer); _float_ (a single precision 32-bit IEEE floating-point number); _double_ (a double precision 64-bit IEEE floating-point number); _boolean_ (true or false); and _char_ (a 16-bit Unicode character). + +Beyond those primitive types, Java allows the programmer to create new types using _class declarations_. Class declarations are used to define object templates, including their properties and behavior. Once a class is declared, _instances_ of that class can generally be created using the **new** keyword. These instances correspond directly to the "objects" we have been discussing. Java comes with a library of useful class definitions, including some simple basic classes such as _String_, which is used to hold a sequence of characters like "Hello, world." + +Let's define a simple message class that contains the name of the sender as well as the message text: + + +``` +class Message { +        [String][4] sender; +        [String][4] text; +        public Message([String][4] sender, [String][4] text) { +                this.sender = sender; +                this.text = text; +        } +} +``` + +There are several important things to note in this class declaration: + + 1. The class is (by convention) always declared with a leading capital letter. + 2. The **Message** class contains two properties (or fields): +– a String field called **sender** +– a String field called **text** +Properties or fields are (by convention) always declared with a leading lower-case letter. + 3. There is some kind of thing that starts with **public Message**. +– It is a _method_ (methods define the behavior of an object). +– It is used to _construct_ instances of the class **Message**. +– Constructor methods always take the same name as the class and are understood to return an instance of the class once it's constructed. +– Other methods are (by convention) always declared with a leading lower-case letter. +– This constructor is "public," meaning any caller can access it. + 4. As part of the construction process, some lines start with **this**. +– **this** refers to the present instance of the class. +– Thus **this.sender** refers to the sender property of the object. +– Whereas plain **sender** refers to the parameter of the **Message** constructor method. +– Therefore, these two lines are copying the values provided in the call to the constructor into the fields of the object itself. + + + +So we have the **Method** class definition. How do we use it? The following code excerpt shows one possible way: + + +``` +`Message message = new Message("system", "I/O error");` +``` + +Here we see: + + 1. The declaration of the variable **message** of type **Message** + 2. The creation of a new instance of the **Message** class with **sender** set to "system" and **text** set to "I/O error" + 3. The assignment of that new instance of **Message** to the variable **message** + 4. If later in the code, the variable **message** is assigned a different value (another instance of **Message**) and no other variable was created that referred to this instance of **Message**, then this instance is no longer used by anything and can be garbage-collected. + + + +The key thing happening here is that we are creating an object of type **Message** and keeping a reference to that object in the variable **message**. + +We can now use that message; for instance, we can print the values in the **sender** and **text** properties, like this: + + +``` +[System][5].out.println("message sender = " + message.sender); +[System][5].out.println("message text = " + message.text); +``` + +This is a very simple and unsophisticated class definition. We can modify this class definition in a number of ways: + + 1. We can make the implementation details of properties invisible to callers by using the keyword **private** in front of the declarations, allowing us to change the implementation without affecting callers. + 2. If we choose to conceal properties in the class, we would then typically define procedures for _getting_ and _setting_ those properties; by convention in Java these would be defined as: +– **public String getSender()** +– **public String getText()** +– **public void setSender(String sender)** +– **public void setText(String text)** + 3. In some cases, we may wish to have "read-only" properties; in those cases, we would not define setters for such properties. + 4. We can make the constructor of the class invisible to callers by using the **private** keyword instead of **public**. We might wish to do this when we have another class whose responsibility is creating and managing a pool of messages (possibly executing in another process or even on another system). + + + +Now, suppose we want a kind of message that records when it was generated. We could declare it this like: + + +``` +class TimedMessage extends Message { +        long creationTime; +        public TimedMessage([String][4] sender, [String][4] text) { +                super(sender, text); +                this.creationTime = [System][5].currentTimeMillis(); +        } +} +``` + +Here we see some new things: + + 1. **TimedMessage** is _extending_ the **Message** class—that is, **TimedMessage** is inheriting properties and behavior from **Message**. + 2. The constructor calls the constructor in its parent, or _superclass_, with the values of **sender** and **text** passed in, as **super(sender, text)**, in order to make sure its inherited properties are properly initialized. + 3. **TimedMessage** adds a new property, **creationTime**, and the constructor sets it to be the current system time in milliseconds. + 4. Time in milliseconds in Java is kept as a long (64-bit) value (0 is 1 January, 1970 00:00:00 UTC). + 5. As a bit of an aside, the name **creationTime** suggests it should be a read-only property, which also suggests that the other properties be read-only; that is, **TimedMessage** instances should probably not be reused nor have their properties altered. + + + +### The Object class + +"The Object class" sounds like a kind of contradiction in terms, doesn't it? But notice that the first class we defined, **Message**, did not _appear_ to extend anything—but it _actually_ did. All classes that don't specifically extend another class have the class **Object** as their immediate and only parent; therefore, all classes have the **Object** class as their ultimate superclass. + +You can [learn more about the **Object** class][6] in Java's docs. Let's (briefly) review some interesting details: + + 1. **Object** has the constructor **Object()**, that is, with no parameters. + 2. **Object** provides some useful methods to all of its subclasses, including: +– **clone()**, which creates and returns a copy of the instance at hand +– **equals(Object anotherObject)**, which determines whether **anotherObject** is equal to the instance of **Object** at hand +– **finalize()**, which is used to garbage-collect the instance at hand when it is no longer used (see above) +– **getClass()**, which returns the class used to declare the instance at hand +— The value returned by this is an instance of the [**Class** class][7], which permits learning about the declaring class at runtime—a process referred to _introspection_. + 3. **hashCode()** is an integer value that gives a nearly unique value for the instance at hand. +– If the hash codes of two distinct instances are equal, then they may be equal; a detailed comparison of the properties (and perhaps methods) is necessary to determine complete equality; +– If the hash codes are not equal, then the instances are also not equal. +– Therefore, hash codes can speed up equality tests. +– A hash code can also be used to create a [**HashMap**][8] (a map is an associative array or dictionary that uses the hash code to speed up lookups) and a [**HashSet**][9] (a set is a collection of objects; the programmer can test whether an instance is in a set or not; hash codes are used to speed up the test). + 4. **notify()**, **notifyAll()**, **wait()**, **wait(long timeout)**, and **wait(long timeout, int nanos)** communicate between collaborating instances executing on separate threads. + 5. **toString()** produces a printable version of the instance. + + + +### Concluding thoughts + +We've touched on some important aspects of object-oriented programming, Java-style. There are six important, related topics that will be covered in future articles: + + * Namespaces and packages + * Overriding methods in subclasses—for instance, the String class has its own specific **hashCode()** method that recognizes its meaning as an array of characters; this is accomplished by overriding the **hashCode()** method inherited from Object + * Interfaces, which permit describing behavior that must be provided by a class that implements the interface; instances of classes that implement a given interface can be referred to by that interface when the only thing of interest is that specific behavior + * Arrays of primitives or classes and collections of classes (such as lists, maps, and sets) + * Overloading of methods—where several methods with the same name and similar behavior have different parameters + * Using libraries that don't come with the Java distribution + + + +Is there anything you would like to read next? Let us know in the comments and stay tuned! + +Michael Dowden takes a look at four Java web frameworks built for scalability. + +Optimizing your Java code requires an understanding of how the different elements in Java interact... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/what-object-java + +作者:[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/clhermansenhttps://opensource.com/users/mdowdenhttps://opensource.com/users/sethhttps://opensource.com/users/drmjghttps://opensource.com/users/jamesfhttps://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-mug.jpg?itok=Bj6rQo8r (Coffee beans and a cup of coffee) +[2]: https://en.wikipedia.org/wiki/Analytic_geometry +[3]: https://en.wikipedia.org/wiki/Multiple_inheritance +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[6]: https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html +[7]: https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html +[8]: https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html +[9]: https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html diff --git a/sources/tech/20190830 Command line quick tips- Using pipes to connect tools.md b/sources/tech/20190830 Command line quick tips- Using pipes to connect tools.md new file mode 100644 index 0000000000..7781fb5a16 --- /dev/null +++ b/sources/tech/20190830 Command line quick tips- Using pipes to connect tools.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Command line quick tips: Using pipes to connect tools) +[#]: via: (https://fedoramagazine.org/command-line-quick-tips-using-pipes-to-connect-tools/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Command line quick tips: Using pipes to connect tools +====== + +![][1] + +One of the most powerful concepts of Linux is carried on from its predecessor, UNIX. Your Fedora system has a bunch of useful, single-purpose utilities available for all sorts of simple operations. Like building blocks, you can attach them in creative and complex ways. _Pipes_ are key to this concept. + +Before you hear about pipes, though, it’s helpful to know the basic concept of input and output. Many utilities in your Fedora system can operate against files. But they can often take input not stored on a disk. You can think of input flowing freely into a process such as a utility as its _standard input_ (also sometimes called _stdin_). + +Similarly, a tool or process can display information to the screen by default. This is often because its default output is connected to the terminal. You can think of the free-flowing output of a process as its _standard output_ (or _stdout_ — go figure!). + +### Examples of standard input and output + +Often when you run a tool, it outputs to the terminal. Take for instance this simple sequence command using the _seq_ tool: + +``` +$ seq 1 6 +1 +2 +3 +4 +5 +6 +``` + +The output, which is simply to count integers up from 1 to 6, one number per line, comes to the screen. But you could also send it to a file using the **>** character. The shell interpreter uses this character to mean “redirect _standard output_ to a file whose name follows.” So as you can guess, this command puts the output into a file called _six.txt:_ + +``` +$ seq 1 6 > six.txt +``` + +Notice nothing comes to the screen. You’ve sent the ouptut into a file instead. If you run the command _cat six.txt_ you can verify that. + +You probably remember the simple use of the _grep_ command [from a previous article][2]. You could ask _grep_ to search for a pattern in a file by simply declaring the file name. But that’s simply a convenience feature in _grep_. Technically it’s built to take _standard input_, and search that. + +The shell uses the **<** character similarly to mean “redirect _standard input_ from a file whose name follows.” So you could just as well search for the number **4** in the file _six.txt_ this way: + +``` +$ grep 4 < six.txt +4 +``` + +Of course the output here is, by default, the content of any line with a match. So _grep_ finds the digit **4** in the file and outputs that line to _standard output_. + +### Introducing pipes + +Now imagine: what if you took the standard output of one tool, and instead of sending it to the terminal, you sent it into another tool’s standard input? This is the essence of the pipe. + +Your shell uses the vertical bar character **|** to represent a pipe between two commands. You can find it on most keyboard above the backslash **\** character. It’s used like this: + +``` +$ command1 | command2 +``` + +For most simple utilities, you wouldn’t use an output filename option on _command1_, nor an input file option on _command2_. (You might use other options, though.) Instead of using files, you’re sending the output of _command1_ directly into _command2_. You can use as many pipes in a row as needed, creating complex pipelines of several commands in a row. + +This (relatively useless) example combines the commands above: + +``` +$ seq 1 6 | grep 4 +4 +``` + +What happened here? The _seq_ command outputs the integers 1 through 6, one line at a time. The _grep_ command processes that output line by line, searching for a match on the digit **4**, and outputs any matching line. + +Here’s a slightly more useful example. Let’s say you want to find out if TCP port 22, the _ssh_ port, is open on your system. You could find this out using the _ss_ command* by looking through its copious output. Or you could figure out its filter language and use that. Or you could use pipes. For example, pipe it through _grep_ looking for the _ssh_ port label: + +``` +$ ss -tl | grep ssh +LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* +LISTEN 0 128 [::]:ssh [::]:* +``` + +_* Those readers familiar with the venerable_ netstat _command may note it is mostly obsolete, as stated in its [man page][3]._ + +That’s a lot easier than reading through many lines of output. And of course, you can combine redirectors and pipes, for instance: + +``` +$ ss -tl | grep ssh > ssh-listening.txt +``` + +This is barely scratching the surface of pipes. Let your imagination run wild. Have fun piping! + +* * * + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/command-line-quick-tips-using-pipes-to-connect-tools/ + +作者:[Paul 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/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/commandlinequicktips-816x345.jpg +[2]: https://fedoramagazine.org/command-line-quick-tips-searching-with-grep/ +[3]: https://linux.die.net/man/8/netstat diff --git a/sources/tech/20190830 How to Install Linux on Intel NUC.md b/sources/tech/20190830 How to Install Linux on Intel NUC.md new file mode 100644 index 0000000000..86d73c5ddc --- /dev/null +++ b/sources/tech/20190830 How to Install Linux on Intel NUC.md @@ -0,0 +1,191 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Linux on Intel NUC) +[#]: via: (https://itsfoss.com/install-linux-on-intel-nuc/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Install Linux on Intel NUC +====== + +The previous week, I got myself an [Intel NUC][1]. Though it is a tiny device, it is equivalent to a full-fledged desktop CPU. Most of the [Linux-based mini PCs][2] are actually built on top of the Intel NUC devices. + +I got the ‘barebone’ NUC with 8th generation Core i3 processor. Barebone means that the device has no RAM, no hard disk and obviously, no operating system. I added an [8GB RAM from Crucial][3] (around $33) and a [240 GB Western Digital SSD][4] (around $45). + +Altogether, I had a desktop PC ready in under $400. I already have a screen and keyboard-mouse pair so I am not counting them in the expense. + +![A brand new Intel NUC NUC8i3BEH at my desk with Raspberry Pi 4 lurking behind][5] + +The main reason why I got Intel NUC is that I want to test and review various Linux distributions on real hardware. I have a [Raspberry Pi 4][6] which works as an entry-level desktop but it’s an [ARM][7] device and thus there are only a handful of Linux distributions available for Raspberry Pi. + +_The Amazon links in the article are affiliate links. Please read our [affiliate policy][8]._ + +### Installing Linux on Intel NUC + +I started with Ubuntu 18.04 LTS version because that’s what I had available at the moment. You can follow this tutorial for other distributions as well. The steps should remain the same at least till the partition step which is the most important one in the entire procedure. + +#### Step 1: Create a live Linux USB + +Download Ubuntu 18.04 from its website. Use another computer to [create a live Ubuntu USB][9]. You can use a tool like [Rufus][10] or [Etcher][11]. On Ubuntu, you can use the default Startup Disk Creator tool. + +#### Step 2: Make sure the boot order is correct + +Insert your USB and power on the NUC. As soon as you see the Intel NUC written on the screen, press F2 to go to BIOS settings. + +![BIOS Settings in Intel NUC][12] + +In here, just make sure that boot order is set to boot from USB first. If not, change the boot order. + +If you had to make any changes, press F10 to save and exit. Else, use Esc to exit the BIOS. + +#### Step 3: Making the correct partition to install Linux + +Now when it boots again, you’ll see the familiar Grub screen that allows you to try Ubuntu live or install it. Choose to install it. + +[][13] + +Suggested read  3 Ways to Check Linux Kernel Version in Command Line + +First few installation steps are simple. You choose the keyboard layout, and the network connection (if any) and other simple steps. + +![Choose the keyboard layout while installing Ubuntu Linux][14] + +You may go with the normal installation that has a handful of useful applications installed by default. + +![][15] + +The interesting screen comes next. You have two options: + + * **Erase disk and install Ubuntu**: Simplest option that will install Ubuntu on the entire disk. If you want to use only one operating system on the Intel NUC, choose this option and Ubuntu will take care of the rest. + * **Something Else**: This is the advanced option if you want to take control of things. In my case, I want to install multiple Linux distribution on the same SSD. So I am opting for this advanced option. + + + +![][16] + +_**If you opt for “Erase disk and install Ubuntu”, click continue and go to the step 4.**_ + +If you are going with the advanced option, follow the rest of the step 3. + +Select the SSD disk and click on New Partition Table. + +![][17] + +It will show you a warning. Just hit Continue. + +![][18] + +Now you’ll see a free space of the size of your SSD disk. My idea is to create an EFI System Partition for the EFI boot loader, a root partition and a home partition. I am not creating a [swap partition][19]. Ubuntu creates a swap file on its own and if the need be, I can extend the swap by creating additional swap files. + +I’ll leave almost 200 GB of free space on the disk so that I could install other Linux distributions here. You can utilize all of it for your home partitions. Keeping separate root and home partitions help you when you want to save reinstall the system + +Select the free space and click on the plus sign to add a partition. + +![][20] + +Usually 100 MB is sufficient for the EFI but some distributions may need more space so I am going with 500 MB of EFI partition. + +![][21] + +Next, I am using 20 GB of root space. If you are going to use only one distributions, you can increase it to 40 GB easily. + +Root is where the system files are kept. Your program cache and installed applications keep some files under the root directory. I recommend [reading about the Linux filesystem hierarchy][22] to get more knowledge on this topic. + +[][23] + +Suggested read  Share Folders On Local Network Between Ubuntu And Windows + +Provide the size, choose Ext4 file system and use / as the mount point. + +![][24] + +The next is to create a home partition. Again, if you want to use only one Linux distribution, go for the remaining free space. Else, choose a suitable disk space for the Home partition. + +Home is where your personal documents, pictures, music, download and other files are stored. + +![][25] + +Now that you have created EFI, root and home partitions, you are ready to install Ubuntu Linux. Hit the Install Now button. + +![][26] + +It will give you a warning about the new changes being written to the disk. Hit continue. + +![][27] + +#### Step 4: Installing Ubuntu Linux + +Things are pretty straightforward from here onward. Choose your time zone right now or change it later. + +![][28] + +On the next screen, choose a username, hostname and the password. + +![][29] + +It’s a wait an watch game for next 7-8 minutes. + +![][30] + +Once the installation is over, you’ll be prompted for a restart. + +![][31] + +When you restart, you should remove the live USB otherwise you’ll boot into the installation media again. + +That’s all you need to do to install Linux on an Intel NUC device. Quite frankly, you can use the same procedure on any other system. + +**Intel NUC and Linux: how do you use it?** + +I am loving the Intel NUC. It doesn’t take space on the desk and yet it is powerful enough to replace the regular bulky desktop CPU. You can easily upgrade it to 32GB of RAM. You can install two SSD on it. Altogether, it provides some scope of configuration and upgrade. + +If you are looking to buy a desktop computer, I highly recommend [Intel NUC][1] mini PC. If you are not comfortable installing the OS on your own, you can [buy one of the Linux-based mini PCs][2]. + +Do you own an Intel NUC? How’s your experience with it? Do you have any tips to share it with us? Do leave a comment below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-linux-on-intel-nuc/ + +作者:[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://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (Intel NUC) +[2]: https://itsfoss.com/linux-based-mini-pc/ +[3]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB RAM from Crucial) +[4]: https://www.amazon.com/Western-Digital-240GB-Internal-WDS240G1G0B/dp/B01M9B2VB7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M9B2VB7 (240 GB Western Digital SSD) +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/intel-nuc.jpg?resize=800%2C600&ssl=1 +[6]: https://itsfoss.com/raspberry-pi-4/ +[7]: https://en.wikipedia.org/wiki/ARM_architecture +[8]: https://itsfoss.com/affiliate-policy/ +[9]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/ +[10]: https://rufus.ie/ +[11]: https://www.balena.io/etcher/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/boot-screen-nuc.jpg?ssl=1 +[13]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-1_tutorial.jpg?ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-2_tutorial.jpg?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-3_tutorial.jpg?ssl=1 +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-4_tutorial.jpg?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-5_tutorial.jpg?ssl=1 +[19]: https://itsfoss.com/swap-size/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-6_tutorial.jpg?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-7_tutorial.jpg?ssl=1 +[22]: https://linuxhandbook.com/linux-directory-structure/ +[23]: https://itsfoss.com/share-folders-local-network-ubuntu-windows/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-8_tutorial.jpg?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-9_tutorial.jpg?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-10_tutorial.jpg?ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-11_tutorial.jpg?ssl=1 +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-12_tutorial.jpg?ssl=1 +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1 +[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1 +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1 diff --git a/sources/tech/20190830 git exercises- navigate a repository.md b/sources/tech/20190830 git exercises- navigate a repository.md new file mode 100644 index 0000000000..bfafd73d66 --- /dev/null +++ b/sources/tech/20190830 git exercises- navigate a repository.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (git exercises: navigate a repository) +[#]: via: (https://jvns.ca/blog/2019/08/30/git-exercises--navigate-a-repository/) +[#]: author: (Julia Evans https://jvns.ca/) + +git exercises: navigate a repository +====== + +I think the [curl exercises][1] the other day went well, so today I woke up and wanted to try writing some Git exercises. Git is a big thing to learn, probably too big to learn in a few hours, so my first idea for how to break it down was by starting by **navigating** a repository. + +I was originally going to use a toy test repository, but then I thought – why not a real repository? That’s way more fun! So we’re going to navigate the repository for the Ruby programming language. You don’t need to know any C to do this exercise, it’s just about getting comfortable with looking at how files in a repository change over time. + +### clone the repository + +To get started, clone the repository: + +``` +git clone https://github.com/ruby/ruby +``` + +The big different thing about this repository (as compared to most of the repositories you’ll work with in real life) is that it doesn’t have branches, but it DOES have lots of tags, which are similar to branches in that they’re both just pointers to a commit. So we’ll do exercises with tags instead of branches. The way you _change_ tags and branches are very different, but the way you _look at_ tags and branches is exactly the same. + +### a git SHA always refers to the same code + +The most important thing to keep in mind while doing these exercises is that a git SHA like `9e3d9a2a009d2a0281802a84e1c5cc1c887edc71` always refers to the same code, as explained in this page. This page is from a zine I wrote with Katie Sylor-Miller called [Oh shit, git!][2]. (She also has a great site called that inspired the zine). + + + +We’ll be using git SHAs really heavily in the exercises to get you used to working with them and to help understand how they correspond to tags and branches. + +### git subcommands we’ll be using + +All of these exercises only use 5 git subcommands: + +``` +git checkout +git log (--oneline, --author, and -S will be useful) +git diff (--stat will be useful) +git show +git status +``` + +### exercises + + 1. Check out matz’s commit of Ruby from 1998. The commit ID is `3db12e8b236ac8f88db8eb4690d10e4a3b8dbcd4`. Find out how many lines of code Ruby was at that time. + 2. Check out the current master branch + 3. Look at the history for the file `hash.c`. What was the last commit ID that changed that file? + 4. Get a diff of how `hash.c` has changed in the last 20ish years: compare that file on the master branch to the file at commit `3db12e8b236ac8f88db8eb4690d10e4a3b8dbcd4`. + 5. Find a recent commit that changed `hash.c` and look at the diff for that commit + 6. This repository has a bunch of **tags** for every Ruby release. Get a list of all the tags. + 7. Find out how many files changed between tag `v1_8_6_187` and tag `v1_8_6_188` + 8. Find a commit (any commit) from 2015 and check it out, look at the files very briefly, then go back to the master branch. + 9. Find out what commit the tag `v1_8_6_187` corresponds to. + 10. List the directory `.git/refs/tags`. Run `cat .git/refs/tags/v1_8_6_187` to see the contents of one of those files. + 11. Find out what commit ID `HEAD` corresponds to right now. + 12. Find out how many commits have been made to the `test/` directory + 13. Get a diff of `lib/telnet.rb` between the commits `65a5162550f58047974793cdc8067a970b2435c0` and `9e3d9a2a009d2a0281802a84e1c5cc1c887edc71`. How many lines of that file were changed? + 14. How many commits were made between Ruby 2.5.1 and 2.5.2 (tags `v2_5_1` and `v2_5_3`) (this one is a tiny bit tricky, there’s more than one step) + 15. How many commits were authored by `matz` (Ruby’s creator)? + 16. What’s the most recent commit that included the word `tkutil`? + 17. Check out the commit `e51dca2596db9567bd4d698b18b4d300575d3881` and create a new branch that points at that commit. + 18. Run `git reflog` to see all the navigating of the repository you’ve done so far + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/08/30/git-exercises--navigate-a-repository/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2019/08/27/curl-exercises/ +[2]: https://wizardzines.com/zines/oh-shit-git/ diff --git a/sources/tech/20190901 Best Linux Distributions For Everyone in 2019.md b/sources/tech/20190901 Best Linux Distributions For Everyone in 2019.md new file mode 100644 index 0000000000..6959b35d60 --- /dev/null +++ b/sources/tech/20190901 Best Linux Distributions For Everyone in 2019.md @@ -0,0 +1,392 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Linux Distributions For Everyone in 2019) +[#]: via: (https://itsfoss.com/best-linux-distributions/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Best Linux Distributions For Everyone in 2019 +====== + +_**Brief: Which is the best Linux distribution? There is no definite answer to that question. This is why we have compiled this list of best Linux in various categories.**_ + +There are a lot of Linux distributions. I can’t even think of coming up with an exact number because you would find loads of Linux distros that differ from one another in one way or the other. + +Some of them just turn out to be a clone of one another while some of them tend to be unique. So, it’s kind of a mess – but that is the beauty of Linux. + +Fret not, even though there are thousands of distributions around, in this article, I have compiled a list of the best Linux distros available right now. Of course, the list can be subjective. But, here, we try to categorize the distros – so there’s something for everyone. + + * [Best distribution for new Linux users][1] + * [Best Linux distros for servers][2] + * [Best Linux distros that can run on old computers][3] + * [Best distributions for advanced Linux users][4] + * [Best evergreen Linux distributions][5] + + + +**Note:** _The list is in no particular order of ranking._ + +### Best Linux Distributions for Beginners + +In this category, we aim to list the distros which are easy-to-use out of the box. You do not need to dig deeper, you can just start using it right away after installation without needing to know any commands or tips. + +#### Ubuntu + +![][6] + +Ubuntu is undoubtedly one of the most popular Linux distributions. You can even find it pre-installed on a lot of laptops available. + +The user interface is easy to get comfortable with. If you play around, you can easily customize the look of it as per your requirements. In either case, you can opt to install a theme as well. You can learn more about [how to install themes in Ubuntu][7] to get started. + +In addition to what it offers, you will find a huge online community of Ubuntu users. So, if you face an issue – head to any of the forums (or a subreddit) to ask for help. If you are looking for direct solutions in no time, you should check out our coverage on [Ubuntu][8] (where we have a lot of tutorials and recommendations for Ubuntu). + +[Ubuntu][9] + +#### Linux Mint + +![Linux Mint 19 Cinnamon desktop screenshot][10] + +Linux Mint Cinnamon is another popular Linux distribution among beginners. The default Cinnamon desktop resembles Windows XP and this is why many users opted for it when Windows XP was discontinued. + +Linux Mint is based on Ubuntu and thus it has all the applications available for Ubuntu. The simplicity and ease of use is why it has become a prominent choice for new Linux users. + +[Linux Mint][11] + +#### elementary OS + +![][12] + +elementary OS is one of the most beautiful Linux distros I’ve ever used. The UI resembles that of Mac OS – so if you have already used a Mac-powered system, it’s easy to get comfortable with. + +This distribution is based on Ubuntu and focuses to deliver a user-friendly Linux environment which looks as pretty as possible while keeping the performance in mind. If you choose to install elementary OS, a list of [11 things to do after installing elementary OS][13] should come in handy. + +[elementary OS][14] + +#### MX Linux + +![][15] + +MX Linux came in the limelight almost a year ago. Now (at the time of publishing this), it is the most popular Linux distro on [DistroWatch.com][16]. If you haven’t used it yet – you will be surprised when you get to use it. + +Unlike Ubuntu, MX Linux is a [rolling release distribution][17] based on Debian with Xfce as its desktop environment. In addition to its impeccable stability – it comes packed with a lot of GUI tools which makes it easier for any user comfortable with Windows/Mac originally. + +Also, the package manager is perfectly tailored to facilitate one-click installations. You can even search for [Flatpak][18] packages and install it in no time (Flathub is available by default in the package manager as one of the sources). + +[MX Linux][19] + +#### Zorin OS + +![][20] + +Zorin OS is yet another Ubuntu-based distribution which happens to be one of the most good-looking and intuitive OS for desktop. Especially, after [Zorin OS 15 release][21] – I would definitely recommend it for users without any Linux background. A lot of GUI-based applications comes baked in as well. + +You can also install it on older PCs – however, make sure to choose the “Lite” edition. In addition, you have “Core”, “Education” & “Ultimate” editions. You can choose to install the Core edition for free – but if you want to support the developers and help improve Zorin, consider getting the Ultimate edition. + +Zorin OS was started by two teenagers based in Ireland. You may [read their story here][22]. + +[Zorin OS][23] + +**Other Options** + +[Deepin][24] and other flavors of Ubuntu (like Kubuntu, Xubuntu) could also be some of the preferred choices for beginners. You can take a look at them if you want to explore more options. + +If you want a challenge, you can indeed try Fedora over Ubuntu – but make sure to follow our article on [Ubuntu vs Fedora][25] to make a better decision from the desktop point of view. + +### Best Linux Server Distributions + +For servers, the choice of a Linux distro comes down to stability, performance, and enterprise support. If you are just experimenting, you can try any distro you want. + +But, if you are installing it for a web server or anything vital – you should take a look at some of our recommendations. + +#### Ubuntu Server + +Depending on where you want it, Ubuntu provides different options for your server. If you are looking for an optimized solution to run on AWS, Azure, Google Cloud Platform, etc., [Ubuntu Cloud][26] is the way to go. + +In either case, you can opt for Ubuntu Server packages and have it installed on your server. Nevertheless, Ubuntu is the most popular Linux distro when it comes to deployment on the cloud (judging by the numbers – [source 1][27], [source 2][28]). + +Do note that we recommend you to go for the LTS editions – unless you have specific requirements. + +[Ubuntu Server][29] + +#### Red Hat Enterprise Linux + +Red Hat Enterprise Linux is a top-notch Linux platform for businesses and organizations. If we go by the numbers, Red Hat may not be the most popular choice for servers. But, there’s a significant group of enterprise users who rely on RHEL (like Lenovo). + +Technically, Fedora and Red Hat are related. Whatever Red Hat supports – gets tested on Fedora before making it available for RHEL. I’m not an expert on server distributions for tailored requirements – so you should definitely check out their [official documentation][30] to know if it’s suitable for you. + +[Red Hat Enterprise Linux][31] + +#### SUSE Linux Enterprise Server + +![Suse Linux Enterprise \(Image: Softpedia\)][32] + +Fret not, do not confuse this with OpenSUSE. Everything comes under a common brand “SUSE” – but OpenSUSE is an open-source distro targeted and yet, maintained by the community. + +SUSE Linux Enterprise Server is one of the most popular solutions for cloud-based servers. You will have to opt for a subscription in order to get priority support and assistance to manage your open source solution. + +[SUSE Linux Enterprise Server][33] + +#### CentOS + +![][34] + +As I mentioned, you need a subscription for RHEL. But, CentOS is more like a community edition of RHEL because it has been derived from the sources of Red Hat Enterprise Linux. And, it is open source and free as well. Even though the number of hosting providers using CentOS is significantly less compared to the last few years – it still is a great choice. + +CentOS may not come loaded with the latest software packages – but it is considered as one of the most stable distros. You should find CentOS images on a variety of cloud platforms. If you don’t, you can always opt for the self-hosted image that CentOS provides. + +[CentOS][35] + +**Other Options** + +You can also try exploring [Fedora Server][36] or [Debian][37] as alternatives to some of the distros mentioned above. + +![Coding][38] + +![Coding][38] + +If you are into programming and software development check out the list of + +[Best Linux Distributions for Programmers][39] + +![Hacking][40] + +![Hacking][40] + +Interested in learning and practicing cyber security? Check out the list of + +[Best Linux Distribution for Hacking and Pen-Testing][41] + +### Best Linux Distributions for Older Computers + +If you have an old PC laying around or if you didn’t really need to upgrade your system – you can still try some of the best Linux distros available. + +We’ve already talked about some of the [best lightweight Linux distributions][42] in details. Here, we shall only mention what really stands out from that list (and some new additions). + +#### Puppy Linux + +![][43] + +Puppy Linux is literally one of the smallest distribution there is. When I first started to explore Linux, my friend recommended me to experiment with Puppy Linux because it can run on older hardware configurations with ease. + +It’s worth checking it out if you want a snappy experience on your good old PC. Over the years, the user experience has improved along with the addition of several new useful features. + +[Puppy Linux][44] + +#### Solus Budgie + +![][45] + +After a recent major release – [Solus 4 Fortitude][46] – it is an impressive lightweight desktop OS. You can opt for desktop environments like GNOME or MATE. However, Solus Budgie happens to be one of my favorites as a full-fledged Linux distro for beginners while being light on system resources. + +[Solus][47] + +#### Bodhi + +![][48] + +Bodhi Linux is built on top of Ubuntu. However, unlike Ubuntu – it does run well on older configurations. + +The main highlight of this distro is its [Moksha Desktop][49] (which is a continuation of Enlightenment 17 desktop). The user experience is intuitive and screaming fast. Even though it’s not something for my personal use – you should give it a try on your older systems. + +[Bodhi Linux][50] + +#### antiX + +![][51] + +antiX – which is also partially responsible for MX Linux is a lightweight Linux distribution tailored for old and new computers. The UI isn’t impressive – but it works as expected. + +It is based on Debian and can be utilized as a live CD distribution without needing to install it. antiX also provides live bootloaders. In contrast to some other distros, you get to save the settings so that you don’t lose it with every reboot. Not just that, you can also save changes to the root directory with its “Live persistence” feature. + +So, if you are looking for a live-USB distro to provide a snappy user experience on old hardware – antiX is the way to go. + +[antiX][52] + +#### Sparky Linux + +![][53] + +Sparky Linux is based on Debian which turns out to be a perfect Linux distro for low-end systems. Along with a screaming fast experience, Sparky Linux offers several special editions (or varieties) for different users. + +For example, it provides a stable release (with varieties) and rolling releases specific to a group of users. Sparky Linux GameOver edition is quite popular for gamers because it includes a bunch of pre-installed games. You can check out our list of [best Linux Gaming distributions][54] – if you also want to play games on your system. + +#### Other Options + +You can also try [Linux Lite][55], [Lubuntu][56], and [Peppermint][57] as some of the lightweight Linux distributions. + +### Best Linux Distro for Advanced Users + +Once you get comfortable with the variety of package managers and commands to help troubleshoot your way to resolve any issue, you can start exploring Linux distros which are tailored for Advanced users only. + +Of course, if you are a professional – you will have a set of specific requirements. However, if you’ve been using Linux for a while as a common user – these distros are worth checking out. + +#### Arch Linux + +![Image Credits: Samiuvic / Deviantart][58] + +Arch Linux is itself a simple yet powerful distribution with a huge learning curve. Unlike others, you won’t have everything pre-installed in one go. You have to configure the system and add packages as needed. + +Also, when installing Arch Linux, you will have to follow a set of commands (without GUI). To know more about it, you can follow our guide on [how to install Arch Linux][59]. If you are going to install it, you should also know about some of the [essential things to do after installing Arch Linux][60]. It will help you get a jump start. + +In addition to all the versatility and simplicity, it’s worth mentioning that the community behind Arch Linux is very active. So, if you run into a problem, you don’t have to worry. + +[Arch Linux][61] + +#### Gentoo + +![Gentoo Linux][62] + +If you know how to compile the source code, Gentoo Linux is a must-try for you. It is also a lightweight distribution – however, you need to have the required technical knowledge to make it work. + +Of course, the [official handbook][63] provides a lot of information that you need to know. But, if you aren’t sure what you’re doing – it will take a lot of your time to figure out how to make the most out of it. + +[Gentoo Linux][64] + +#### Slackware + +![Image Credits: thundercr0w / Deviantart][65] + +Slackware is one of the oldest Linux distribution that still matters. If you are willing to compile or develop software to set up a perfect environment for yourself – Slackware is the way to go. + +In case you’re curious about some of the oldest Linux distros, we have an article on the [earliest linux distributions][66] – go check it out. + +Even though the number of users/developers utilizing it has significantly decreased, it is still a fantastic choice for advanced users. Also, with the recent news of [Slackware getting a Patreon page][67] – we hope that Slackware continues to exist as one of the best Linux distros out there. + +[Slackware][68] + +### Best Multi-purpose Linux Distribution + +There are certain Linux distros which you can utilize as a beginner-friendly / advanced OS for both desktops and servers. Hence, we thought of compiling a separate section for such distributions. + +If you don’t agree with us (or have suggestions to add here) – feel free to let us know in the comments. Here’s what we think could come in handy for every user: + +#### Fedora + +![][69] + +Fedora offers two separate editions – one for desktops/laptops and the other for servers (Fedora Workstation and Fedora Server respectively). + +So, if you are looking for a snappy desktop OS – with a potential learning curve while being user-friendly – Fedora is an option. In either case, if you are looking for a Linux OS for your server – that’s a good choice as well. + +[Fedora][70] + +#### Manjaro + +![][71] + +Manjaro is based on [Arch Linux][72]. Fret not, while Arch Linux is tailored for advanced users, Manjaro makes it easy for a newcomer. It is a simple and beginner-friendly Linux distro. The user interface is good enough and offers a bunch of useful GUI applications built-in. + +You get options to choose a [desktop environment][73] for Manjaro while downloading it. Personally, I like the KDE desktop for Manjaro. + +[Manjaro Linux][74] + +### Debian + +![Image Credits: mrneilypops / Deviantart][75] + +Well, Ubuntu’s based on Debian – so it must be a darn good distribution itself. Debian is an ideal choice for both desktop and servers. + +It may not be the best beginner-friendly OS – but you can easily get started by going through the [official documentation][76]. The recent release of [Debian 10 Buster][77] introduces a lot of changes and necessary improvements. So, you must give it a try! + +**Wrapping Up** + +Overall, these are the best Linux distributions that we recommend you to try. Yes, there are a lot of other Linux distributions that deserve the mention – but to each of their own, depending on personal preferences – the choices will be subjective. + +But, we also have a separate list of distros for [Windows users][78], [hackers and pen testers][41], [gamers][54], [programmers][39], and [privacy buffs.][79] So, if that interest you – do go through them. + +If you think we missed listing one of your favorites that deserves as one of the best Linux distributions out there, let us know your thoughts in the comments below and we’ll keep the article up-to-date accordingly. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-linux-distributions/ + +作者:[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]: tmp.NoRXbIWHkg#for-beginners +[2]: tmp.NoRXbIWHkg#for-servers +[3]: tmp.NoRXbIWHkg#for-old-computers +[4]: tmp.NoRXbIWHkg#for-advanced-users +[5]: tmp.NoRXbIWHkg#general-purpose +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-10.jpg?ssl=1 +[7]: https://itsfoss.com/install-themes-ubuntu/ +[8]: https://itsfoss.com/tag/ubuntu/ +[9]: https://ubuntu.com/download/desktop +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/linux-Mint-19-desktop.jpg?ssl=1 +[11]: https://www.linuxmint.com/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/elementary-os-juno-feat.jpg?ssl=1 +[13]: https://itsfoss.com/things-to-do-after-installing-elementary-os-5-juno/ +[14]: https://elementary.io/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/mx-linux.jpg?ssl=1 +[16]: https://distrowatch.com/ +[17]: https://en.wikipedia.org/wiki/Linux_distribution#Rolling_distributions +[18]: https://flatpak.org/ +[19]: https://mxlinux.org/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/zorin-os-15.png?ssl=1 +[21]: https://itsfoss.com/zorin-os-15-release/ +[22]: https://itsfoss.com/zorin-os-interview/ +[23]: https://zorinos.com/ +[24]: https://www.deepin.org/en/ +[25]: https://itsfoss.com/ubuntu-vs-fedora/ +[26]: https://ubuntu.com/download/cloud +[27]: https://w3techs.com/technologies/details/os-linux/all/all +[28]: https://thecloudmarket.com/stats +[29]: https://ubuntu.com/download/server +[30]: https://developers.redhat.com/products/rhel/docs-and-apis +[31]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/SUSE-Linux-Enterprise.jpg?ssl=1 +[33]: https://www.suse.com/products/server/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/centos.png?ssl=1 +[35]: https://www.centos.org/ +[36]: https://getfedora.org/en/server/ +[37]: https://www.debian.org/distrib/ +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/coding.jpg?ssl=1 +[39]: https://itsfoss.com/best-linux-distributions-progammers/ +[40]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/hacking.jpg?ssl=1 +[41]: https://itsfoss.com/linux-hacking-penetration-testing/ +[42]: https://itsfoss.com/lightweight-linux-beginners/ +[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/puppy-linux-bionic.jpg?ssl=1 +[44]: http://puppylinux.com/ +[45]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/solus-4-featured.jpg?resize=800%2C450&ssl=1 +[46]: https://itsfoss.com/solus-4-release/ +[47]: https://getsol.us/home/ +[48]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/bodhi-linux.png?fit=800%2C436&ssl=1 +[49]: http://www.bodhilinux.com/moksha-desktop/ +[50]: http://www.bodhilinux.com/ +[51]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/10/antix-linux-screenshot.jpg?ssl=1 +[52]: https://antixlinux.com/ +[53]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/sparky-linux.jpg?ssl=1 +[54]: https://itsfoss.com/linux-gaming-distributions/ +[55]: https://www.linuxliteos.com/ +[56]: https://lubuntu.me/ +[57]: https://peppermintos.com/ +[58]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/arch_linux_screenshot.jpg?ssl=1 +[59]: https://itsfoss.com/install-arch-linux/ +[60]: https://itsfoss.com/things-to-do-after-installing-arch-linux/ +[61]: https://www.archlinux.org +[62]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?ssl=1 +[63]: https://wiki.gentoo.org/wiki/Handbook:Main_Page +[64]: https://www.gentoo.org +[65]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/slackware-screenshot.jpg?ssl=1 +[66]: https://itsfoss.com/earliest-linux-distros/ +[67]: https://distrowatch.com/dwres.php?resource=showheadline&story=8743 +[68]: http://www.slackware.com/ +[69]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/fedora-overview.png?ssl=1 +[70]: https://getfedora.org/ +[71]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/manjaro-gnome.jpg?ssl=1 +[72]: https://www.archlinux.org/ +[73]: https://itsfoss.com/glossary/desktop-environment/ +[74]: https://manjaro.org/ +[75]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?ssl=1 +[76]: https://www.debian.org/releases/stable/installmanual +[77]: https://itsfoss.com/debian-10-buster/ +[78]: https://itsfoss.com/windows-like-linux-distributions/ +[79]: https://itsfoss.com/privacy-focused-linux-distributions/ diff --git a/sources/tech/20190901 Different Ways to Configure Static IP Address in RHEL 8.md b/sources/tech/20190901 Different Ways to Configure Static IP Address in RHEL 8.md new file mode 100644 index 0000000000..2f8f6ba711 --- /dev/null +++ b/sources/tech/20190901 Different Ways to Configure Static IP Address in RHEL 8.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Different Ways to Configure Static IP Address in RHEL 8) +[#]: via: (https://www.linuxtechi.com/configure-static-ip-address-rhel8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +Different Ways to Configure Static IP Address in RHEL 8 +====== + +While Working on **Linux Servers**, assigning Static IP address on NIC / Ethernet cards is one of the common tasks that every Linux engineer do. If one configures the **Static IP address** correctly on a Linux server then he/she can access it remotely over network. In this article we will demonstrate what are different ways to assign Static IP address on RHEL 8 Server’s NIC. + +[![Configure-Static-IP-RHEL8][1]][2] + +Following are the ways to configure Static IP on a NIC, + + * nmcli (command line tool) + * Network Scripts files(ifcfg-*) + * nmtui  (text based user interface) + + + +### Configure Static IP Address using nmcli command line tool + +Whenever we install RHEL 8 server then ‘**nmcli**’, a command line tool is installed automatically, nmcli is used by network manager and allows us to configure static ip address on Ethernet cards. + +Run the below ip addr command to list Ethernet cards on your RHEL 8 server + +``` +[root@linuxtechi ~]# ip addr +``` + +![ip-addr-command-rhel8][1] + +As we can see in above command output, we have two NICs enp0s3 & enp0s8. Currently ip address assigned to the NIC is via dhcp server. + +Let’s assume we want to assign the static IP address on first NIC (enp0s3) with the following details, + + * IP address = 192.168.1.4 + * Netmask = 255.255.255.0 + * Gateway= 192.168.1.1 + * DNS = 8.8.8.8 + + + +Run the following nmcli commands one after the another to configure static ip, + +List currently active Ethernet cards using “**nmcli connection**” command, + +``` +[root@linuxtechi ~]# nmcli connection +NAME UUID TYPE DEVICE +enp0s3 7c1b8444-cb65-440d-9bf6-ea0ad5e60bae ethernet enp0s3 +virbr0 3020c41f-6b21-4d80-a1a6-7c1bd5867e6c bridge virbr0 +[root@linuxtechi ~]# +``` + +Use beneath nmcli command to assign static ip on enp0s3, + +**Syntax:** + +# nmcli connection modify <interface_name> ipv4.address  <ip/prefix> + +**Note:** In short form, we usually replace connection with ‘con’ keyword and modify with ‘mod’ keyword in nmcli command. + +Assign ipv4 (192.168.1.4) to enp0s3 interface, + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.addresses 192.168.1.4/24 +[root@linuxtechi ~]# +``` + +Set the gateway using below nmcli command, + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.gateway 192.168.1.1 +[root@linuxtechi ~]# +``` + +Set the manual configuration (from dhcp to static), + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.method manual +[root@linuxtechi ~]# +``` + +Set DNS value as “8.8.8.8”, + +``` +[root@linuxtechi ~]# nmcli con mod enp0s3 ipv4.dns "8.8.8.8" +[root@linuxtechi ~]# +``` + +To save the above changes and to reload the interface execute the beneath nmcli command, + +``` +[root@linuxtechi ~]# nmcli con up enp0s3 +Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4) +[root@linuxtechi ~]# +``` + +Above command output confirms that interface enp0s3 has been configured successfully.Whatever the changes we have made using above nmcli commands, those changes is saved permanently under the file “etc/sysconfig/network-scripts/ifcfg-enp0s3” + +``` +[root@linuxtechi ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 +``` + +![ifcfg-enp0s3-file-rhel8][1] + +To Confirm whether IP address has been to enp0s3 interface use the below ip command, + +``` +[root@linuxtechi ~]#ip addr show enp0s3 +``` + +### Configure Static IP Address manually using network-scripts (ifcfg-) files + +We can configure the static ip address to an ethernet card using its network-script or ‘ifcfg-‘ files. Let’s assume we want to assign the static ip address on our second Ethernet card ‘enp0s8’. + + * IP= 192.168.1.91 + * Netmask / Prefix = 24 + * Gateway=192.168.1.1 + * DNS1=4.2.2.2 + + + +Go to the directory “/etc/sysconfig/network-scripts” and look for the file ‘ifcfg- enp0s8’, if it does not exist then create it with following content, + +``` +[root@linuxtechi ~]# cd /etc/sysconfig/network-scripts/ +[root@linuxtechi network-scripts]# vi ifcfg-enp0s8 +TYPE="Ethernet" +DEVICE="enp0s8" +BOOTPROTO="static" +ONBOOT="yes" +NAME="enp0s8" +IPADDR="192.168.1.91" +PREFIX="24" +GATEWAY="192.168.1.1" +DNS1="4.2.2.2" +``` + +Save and exit the file and then restart network manager service to make above changes into effect, + +``` +[root@linuxtechi network-scripts]# systemctl restart NetworkManager +[root@linuxtechi network-scripts]# +``` + +Now use below ip command to verify whether ip address is assigned to nic or not, + +``` +[root@linuxtechi ~]# ip add show enp0s8 +3: enp0s8: mtu 1500 qdisc fq_codel state UP group default qlen 1000 + link/ether 08:00:27:7c:bb:cb brd ff:ff:ff:ff:ff:ff + inet 192.168.1.91/24 brd 192.168.1.255 scope global noprefixroute enp0s8 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe7c:bbcb/64 scope link + valid_lft forever preferred_lft forever +[root@linuxtechi ~]# +``` + +Above output confirms that static ip address has been configured successfully on the NIC ‘enp0s8’ + +### Configure Static IP Address using ‘nmtui’ utility + +nmtui is a text based user interface for controlling network manager, when we execute nmtui, it will open a text base user interface through which we can add, modify and delete connections. Apart from this nmtui can also be used to set hostname of your system. + +Let’s assume we want to assign static ip address to interface enp0s3 with following details, + + * IP address = 10.20.0.72 + * Prefix = 24 + * Gateway= 10.20.0.1 + * DNS1=4.2.2.2 + + + +Run nmtui and follow the screen instructions, example is show + +``` +[root@linuxtechi ~]# nmtui +``` + +[![nmtui-rhel8][1]][3] + +Select the first option ‘**Edit a connection**‘ and then choose the interface as ‘enp0s3’ + +[![Choose-interface-nmtui-rhel8][1]][4] + +Choose Edit and then specify the IP address, Prefix, Gateway and DNS Server ip, + +[![set-ip-nmtui-rhel8][1]][5] + +Choose OK and hit enter. In the next window Choose ‘**Activate a connection**’ + +[![Activate-option-nmtui-rhel8][1]][6] + +Select **enp0s3**,  Choose **Deactivate** & hit enter + +[![Deactivate-interface-nmtui-rhel8][1]][7] + +Now choose **Activate** & hit enter, + +[![Activate-interface-nmtui-rhel8][1]][8] + +Select Back and then select Quit, + +[![Quit-Option-nmtui-rhel8][1]][9] + +Use below IP command to verify whether ip address has been assigned to interface enp0s3 + +``` +[root@linuxtechi ~]# ip add show enp0s3 +2: enp0s3: mtu 1500 qdisc fq_codel state UP group default qlen 1000 + link/ether 08:00:27:53:39:4d brd ff:ff:ff:ff:ff:ff + inet 10.20.0.72/24 brd 10.20.0.255 scope global noprefixroute enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::421d:5abf:58bd:c47e/64 scope link noprefixroute + valid_lft forever preferred_lft forever +[root@linuxtechi ~]# +``` + +Above output confirms that we have successfully assign the static IP address to interface enp0s3 using nmtui utility. + +That’s all from this tutorial, we have covered three different ways to configure ipv4 address to an Ethernet card on RHEL 8 system. Please do not hesitate to share feedback and comments in comments section below. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-static-ip-address-rhel8/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-Static-IP-RHEL8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/nmtui-rhel8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-interface-nmtui-rhel8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/set-ip-nmtui-rhel8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Activate-option-nmtui-rhel8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Deactivate-interface-nmtui-rhel8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Activate-interface-nmtui-rhel8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Quit-Option-nmtui-rhel8.jpg diff --git a/sources/tech/20190901 How to write zines with simple tools.md b/sources/tech/20190901 How to write zines with simple tools.md new file mode 100644 index 0000000000..05b21f047e --- /dev/null +++ b/sources/tech/20190901 How to write zines with simple tools.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write zines with simple tools) +[#]: via: (https://jvns.ca/blog/2019/09/01/ways-to-write-zines-without-fancy-tools/) +[#]: author: (Julia Evans https://jvns.ca/) + +How to write zines with simple tools +====== + +People often ask me what tools I use to write my zines ([the answer is here][1]). Answering this question as written has always felt slightly off to me, though, and I couldn’t figure out why for a long time. + +I finally realized last week that instead of “what tools do you use to write zines?” some people may have actually wanted to know “how can I do this myself?”! And “buy a $500 iPad” is not a terribly useful answer to that question – it’s not how I got started, iPads are kind of a weird fancy way to write zines, and most people don’t have them. + +So this blog post is about more traditional (and easier to get started with) ways to write zines. + +We’re going to start out by talking about the mechanics of how to write the zine, and then talk about how to assemble it into a booklet. + +### Way 1: Write it on paper + +This is how I made my first zine (spying on your programs with strace) which you can see here: . + +Here’s an example of a page I drew on paper this morning pretty quickly. It looks kind of bad because I scanned it with my phone, but if you use a real scanner (like I did with the strace PDF above), the scanned version comes out better. + + + +### Way 2: Use a Google doc + +The next option is to use a Google doc (or whatever other word processor you prefer). [Here’s the Google doc I wrote for the below image][2], and here’s what it looks like: + + + +They key thing about this Google doc approach is to apply some “less is more”. It’s intended to be printed as part of a booklet on **half** a sheet of letter paper, which means everything needs to be twice as big for it to look good. + +### Way 3: Use an iPad + +This is what I do (use the Notability app on iPad). I’m not going to talk about this method much because this post is about using more readily available tools. + + + +### Way 4: Use a single sheet of paper + +This is a subset of “Write it on paper” – the [Wikibooks page on zine making][3] has a great guide that shows how to write out a tiny zine on 1 piece of paper and then fold it up to make a little booklet. Here are the pictures of the steps from the Wikibooks page: + + + +Sumana Harihareswara’s [Playing with python][4] zine is a nice example of a zine that’s intended to be folded up in that way. + +### Way 5: Adobe Illustrator + +I’ve never used Adobe Illustrator so I’m not going to pretend that I know anything about it or put together an example using it, but I hear it’s a way people do book layout. + +### booklets: the photocopier method + +So you’ve written a bunch of pages and want to assemble them into a booklet. One way to do this (and what I did for my first zine about strace!) is the photocopier method. There’s a great guide by Julia Gfrörer in [this tweet][5], which I’m going to reproduce here: + +![][6] +![][7] +![][8] +![][9] + +That explanation is excellent and I don’t have anything to add. I did it that way and it worked great. + +If you want to buy a print copy of that how-to-make-zines zine from Thruban Press, you can [get it here on Etsy][10]. + +### booklets: the computer method + +If you’ve made your zine in Google Docs or in another computery way, you probably want a more computery way of assembling the pages into a booklet. + +**what I use: pdflatex** + +I do this using the `pdfpages` LaTeX extension. This sounds complicated but it’s not really, you don’t need to learn latex or anything. You just need to have pdflatex on your system, which is a `sudo apt install texlive-base` away on Ubuntu. The steps are: + + 1. Get a PDF with the pages from your zine (pages need to be a multiple of 4) + 2. Get the latex file from [this gist][11] + 3. Replace `/home/bork/http-zine.pdf` with the path to your PDF and `1-28` with `1-however many pages are in your zine`. + 4. run `pdflatex formatted-zine.tex` + 5. Tweak the parameters until it looks the way you want. The [documentation for the pdfpages package is here][12] + + + +I like using this relatively complicated method because there are always small tweaks I want to make like “oh, the right margin is too big, crop it a little bit” and the pdfpages package has tons of options that let me make those tweaks. + +**other methods** + + 1. On Linux you can use the `pdfjam` bash script, which is just a wrapper around the pdfpages latex package. This is what I used to do but today I find it simpler to use the pdfpages latex package directly. + 2. There’s a program called [Booklet Creator][13] for Mac and Windows that [@mrfb uses][14]. It looks pretty simple to use. + 3. If you convert your PDF to a ps file (with `pdf2ps` for instance), `psnup` can do this. I tried `cat file.ps | psbook | psnup -2 > booklet.ps` and it worked, though the resulting PDFs are a little slow to load in my PDF viewer for some reason. + 4. there are probably a ton more ways to do this, if you know more let me know + + + +### making zines is easy and low tech + +That’s all! I mostly wanted to explain that zines are an easy low tech thing to do and if you think making them sounds fun, you definitely 100% do not need to use any fancy expensive tools to do it, you can literally use some sheets of paper, a Sharpie, a pen, and spend $3 at your local print shop to use the photocopier. + +### resources + +summary of the resources I linked to: + + * Guide to putting together zines with a photocopier by Julia Gfrörer: [this tweet][5], [get it on Etsy][10] + * [Wikibooks page on zine making][3] + * Notes on making zines using Google Docs: [this twitter thread][14] + * [Stolen Sharpie Revolution][15] (the first book I read about making zines). You can also get it on Amazon if you want but it’s probably better to buy directly from their site. + * [Booklet Creator][13] + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/09/01/ways-to-write-zines-without-fancy-tools/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/b0rk/status/1160171769833185280 +[2]: https://docs.google.com/document/d/1byzfXC0h6hNFlWXaV9peJpX-GamJOrJ70x9nu1dZ-m0/edit?usp=sharing +[3]: https://en.m.wikibooks.org/wiki/Zine_Making/Putting_pages_together +[4]: https://www.harihareswara.net/pix/playing-with-python-zine/playing-with-python-zine.pdf +[5]: https://twitter.com/thorazos/status/1158556879485906944 +[6]: https://pbs.twimg.com/media/EBQFUC0X4AAPTU1?format=jpg&name=small +[7]: https://pbs.twimg.com/media/EBQFUC0XsAEBhHf?format=jpg&name=small +[8]: https://pbs.twimg.com/media/EBQFUC1XUAAKDIB?format=jpg&name=small +[9]: https://pbs.twimg.com/media/EBQFUDRX4AMkIAr?format=jpg&name=small +[10]: https://www.etsy.com/thorazos/listing/693692176/thuban-press-guide-to-analog-self?utm_source=Copy&utm_medium=ListingManager&utm_campaign=Share&utm_term=so.lmsm&share_time=1565113962419 +[11]: https://gist.github.com/jvns/b3de1d658e2b44aebb485c35fb1a7a0f +[12]: http://texdoc.net/texmf-dist/doc/latex/pdfpages/pdfpages.pdf +[13]: https://www.bookletcreator.com/ +[14]: https://twitter.com/mrfb/status/1159478532545888258 +[15]: http://www.stolensharpierevolution.org/ diff --git a/sources/tech/20190902 How RPM packages are made- the spec file.md b/sources/tech/20190902 How RPM packages are made- the spec file.md new file mode 100644 index 0000000000..c5dace0332 --- /dev/null +++ b/sources/tech/20190902 How RPM packages are made- the spec file.md @@ -0,0 +1,299 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How RPM packages are made: the spec file) +[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +How RPM packages are made: the spec file +====== + +![][1] + +In the [previous article on RPM package building][2], you saw that source RPMS include the source code of the software, along with a “spec” file. This post digs into the spec file, which contains instructions on how to build the RPM. Again, this article uses _fpaste_ as an example. + +### Understanding the source code + +Before you can start writing a spec file, you need to have some idea of the software that you’re looking to package. Here, you’re looking at fpaste, a very simple piece of software. It is written in Python, and is a one file script. When a new version is released, it’s provided here on Pagure: + +The current version, as the archive shows, is 0.3.9.2. Download it so you can see what’s in the archive: + +``` +$ wget https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz +$ tar -tvf fpaste-0.3.9.2.tar.gz +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/ +-rw-rw-r-- root/root 25 2018-07-25 02:58 fpaste-0.3.9.2/.gitignore +-rw-rw-r-- root/root 3672 2018-07-25 02:58 fpaste-0.3.9.2/CHANGELOG +-rw-rw-r-- root/root 35147 2018-07-25 02:58 fpaste-0.3.9.2/COPYING +-rw-rw-r-- root/root 444 2018-07-25 02:58 fpaste-0.3.9.2/Makefile +-rw-rw-r-- root/root 1656 2018-07-25 02:58 fpaste-0.3.9.2/README.rst +-rw-rw-r-- root/root 658 2018-07-25 02:58 fpaste-0.3.9.2/TODO +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/ +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/ +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/ +-rw-rw-r-- root/root 3867 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/fpaste.1 +-rwxrwxr-x root/root 24884 2018-07-25 02:58 fpaste-0.3.9.2/fpaste +lrwxrwxrwx root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/fpaste.py -> fpaste +``` + +The files you want to install are: + + * _fpaste.py_: which should go be installed to /usr/bin/. + * _docs/man/en/fpaste.1_: the manual, which should go to /usr/share/man/man1/. + * _COPYING_: the license text, which should go to /usr/share/license/fpaste/. + * _README.rst, TODO_: miscellaneous documentation that goes to /usr/share/doc/fpaste. + + + +Where these files are installed depends on the Filesystem Hierarchy Standard. To learn more about it, you can either read here: or look at the man page on your Fedora system: + +``` +$ man hier +``` + +#### Part 1: What are we building? + +Now that we know what files we have in the source, and where they are to go, let’s look at the spec file. You can see the full file here: + +Here is the first part of the spec file: + +``` +Name: fpaste +Version: 0.3.9.2 +Release: 3%{?dist} +Summary: A simple tool for pasting info onto sticky notes instances +BuildArch: noarch +License: GPLv3+ +URL: https://pagure.io/fpaste +Source0: https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz + +Requires: python3 + +%description +It is often useful to be able to easily paste text to the Fedora +Pastebin at http://paste.fedoraproject.org and this simple script +will do that and return the resulting URL so that people may +examine the output. This can hopefully help folks who are for +some reason stuck without X, working remotely, or any other +reason they may be unable to paste something into the pastebin +``` + +_Name_, _Version_, and so on are called _tags_, and are defined in RPM. This means you can’t just make up tags. RPM won’t understand them if you do! The tags to keep an eye out for are: + + * _Source0_: tells RPM where the source archive for this software is located. + * _Requires_: lists run-time dependencies for the software. RPM can automatically detect quite a few of these, but in some cases they must be mentioned manually. A run-time dependency is a capability (often a package) that must be on the system for this package to function. This is how _[dnf][3]_ detects whether it needs to pull in other packages when you install this package. + * _BuildRequires_: lists the build-time dependencies for this software. These must generally be determined manually and added to the spec file. + * _BuildArch_: the computer architectures that this software is being built for. If this tag is left out, the software will be built for all supported architectures. The value _noarch_ means the software is architecture independent (like fpaste, which is written purely in Python). + + + +This section provides general information about fpaste: what it is, which version is being made into an RPM, its license, and so on. If you have fpaste installed, and look at its metadata, you can see this information included in the RPM: + +``` +$ sudo dnf install fpaste +$ rpm -qi fpaste +Name : fpaste +Version : 0.3.9.2 +Release : 2.fc30 +... +``` + +RPM adds a few extra tags automatically that represent things that it knows. + +At this point, we have the general information about the software that we’re building an RPM for. Next, we start telling RPM what to do. + +#### Part 2: Preparing for the build + +The next part of the spec is the preparation section, denoted by _%prep_: + +``` +%prep +%autosetup +``` + +For fpaste, the only command here is %autosetup. This simply extracts the tar archive into a new folder and keeps it ready for the next section where we build it. You can do more here, like apply patches, modify files for different purposes, and so on. If you did look at the contents of the source rpm for Python, you would have seen lots of patches there. These are all applied in this section. + +Typically anything in a spec file with the **%** prefix is a macro or label that RPM interprets in a special way. Often these will appear with curly braces, such as _%{example}_. + +#### Part 3: Building the software + +The next section is where the software is built, denoted by “%build”. Now, since fpaste is a simple, pure Python script, it doesn’t need to be built. So, here we get: + +``` +%build +#nothing required +``` + +Generally, though, you’d have build commands here, like: + +``` +configure; make +``` + +The build section is often the hardest section of the spec, because this is where the software is being built from source. This requires you to know what build system the tool is using, which could be one of many: Autotools, CMake, Meson, Setuptools (for Python) and so on. Each has its own commands and style. You need to know these well enough to get the software to build correctly. + +#### Part 4: Installing the files + +Once the software is built, it needs to be installed in the _%install_ section: + +``` +%install +mkdir -p %{buildroot}%{_bindir} +make install BINDIR=%{buildroot}%{_bindir} MANDIR=%{buildroot}%{_mandir} +``` + +RPM doesn’t tinker with your system files when building RPMs. It’s far too risky to add, remove, or modify files to a working installation. What if something breaks? So, instead RPM creates an artificial file system and works there. This is referred to as the _buildroot_. So, here in the buildroot, we create _/usr/bin_, represented by the macro _%{_bindir}_, and then install the files to it using the provided Makefile. + +At this point, we have a built version of fpaste installed in our artificial buildroot. + +#### Part 5: Listing all files to be included in the RPM + +The last section of the spec file is the files section, _%files_. This is where we tell RPM what files to include in the archive it creates from this spec file. The fpaste file section is quite simple: + +``` +%files +%{_bindir}/%{name} +%doc README.rst TODO +%{_mandir}/man1/%{name}.1.gz +%license COPYING +``` + +Notice how, here, we do not specify the buildroot. All of these paths are relative to it. The _%doc_ and _%license_ commands simply do a little more—they create the required folders and remember that these files must go there. + +RPM is quite smart. If you’ve installed files in the _%install_ section, but not listed them, it’ll tell you this, for example. + +#### Part 6: Document all changes in the change log + +Fedora is a community based project. Lots of contributors maintain and co-maintain packages. So it is imperative that there’s no confusion about what changes have been made to a package. To ensure this, the spec file contains the last section, the Changelog, _%changelog_: + +``` +%changelog +* Thu Jul 25 2019 Fedora Release Engineering < ...> - 0.3.9.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering < ...> - 0.3.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Jul 24 2018 Ankur Sinha - 0.3.9.2-1 +- Update to 0.3.9.2 + +* Fri Jul 13 2018 Fedora Release Engineering < ...> - 0.3.9.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering < ..> - 0.3.9.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Sep 10 2017 Vasiliy N. Glazov < ...> - 0.3.9.1-2 +- Cleanup spec + +* Fri Sep 08 2017 Ankur Sinha - 0.3.9.1-1 +- Update to latest release +- fixes rhbz 1489605 +... +.... +``` + +There must be a changelog entry for _every_ change to the spec file. As you see here, while I’ve updated the spec as the maintainer, others have too. Having the changes documented clearly helps everyone know what the current status of the spec is. For all packages installed on your system, you can use rpm to see their changelogs: + +``` +$ rpm -q --changelog fpaste +``` + +### Building the RPM + +Now we are ready to build the RPM. If you want to follow along and run the commands below, please ensure that you followed the steps [in the previous post][2] to set your system up for building RPMs. + +We place the fpaste spec file in _~/rpmbuild/SPECS_, the source code archive in _~/rpmbuild/SOURCES/_ and can now create the source RPM: + +``` +$ cd ~/rpmbuild/SPECS +$ wget https://src.fedoraproject.org/rpms/fpaste/raw/master/f/fpaste.spec + +$ cd ~/rpmbuild/SOURCES +$ wget https://pagure.io/fpaste/archive/0.3.9.2/fpaste-0.3.9.2.tar.gz + +$ cd ~/rpmbuild/SOURCES +$ rpmbuild -bs fpaste.spec +Wrote: /home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm +``` + +Let’s have a look at the results: + +``` +$ ls ~/rpmbuild/SRPMS/fpaste* +/home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm + +$ rpm -qpl ~/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm +fpaste-0.3.9.2.tar.gz +fpaste.spec +``` + +There we are — the source rpm has been built. Let’s build both the source and binary rpm together: + +``` +$ cd ~/rpmbuild/SPECS +$ rpmbuild -ba fpaste.spec +.. +.. +.. +``` + +RPM will show you the complete build output, with details on what it is doing in each section that we saw before. This “build log” is extremely important. When builds do not go as expected, we packagers spend lots of time going through them, tracing the complete build path to see what went wrong. + +That’s it really! Your ready-to-install RPMs are where they should be: + +``` +$ ls ~/rpmbuild/RPMS/noarch/ +fpaste-0.3.9.2-3.fc30.noarch.rpm +``` + +### Recap + +We’ve covered the basics of how RPMs are built from a spec file. This is by no means an exhaustive document. In fact, it isn’t documentation at all, really. It only tries to explain how things work under the hood. Here’s a short recap: + + * RPMs are of two types: _source_ and _binary_. + * Binary RPMs contain the files to be installed to use the software. + * Source RPMs contain the information needed to build the binary RPMs: the complete source code, and the instructions on how to build the RPM in the spec file. + * The spec file has various sections, each with its own purpose. + + + +Here, we’ve built RPMs locally, on our Fedora installations. While this is the basic process, the RPMs we get from repositories are built on dedicated servers with strict configurations and methods to ensure correctness and security. This Fedora packaging pipeline will be discussed in a future post. + +Would you like to get started with building packages, and help the Fedora community maintain the massive amount of software we provide? You can [start here by joining the package collection maintainers][4]. + +For any queries, post to the [Fedora developers mailing list][5]—we’re always happy to help! + +### References + +Here are some useful references to building RPMs: + + * + * + * + * + + + +* * * + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/ + +作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ +[3]: https://fedoramagazine.org/managing-packages-fedora-dnf/ +[4]: https://fedoraproject.org/wiki/Join_the_package_collection_maintainers +[5]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ diff --git a/sources/tech/20190903 Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith.md b/sources/tech/20190903 Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith.md new file mode 100644 index 0000000000..10811483db --- /dev/null +++ b/sources/tech/20190903 Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith) +[#]: via: (https://itsfoss.com/regolith-linux-desktop/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Get a Preconfigured Tiling Window Manager on Ubuntu With Regolith +====== + +_**Brief: Using tiling window manager in Linux can be tricky with all those configuration. Regolith gives you an out of box i3wm experience within Ubuntu.**_ + +Perhaps you have come across desktop screenshot like the one below in some forums. If you haven’t, try checking this [subreddit][1]. You might have wondered how could people make their Linux desktop look so beautiful. + +![Linux Ricing Example | Image Source][2] + +Of course, you can make your own desktop look good by changing the icon, theme and wallpaper but you might still not achieve the same result. + +In majority of cases, a tiling window manager is used instead of the regular floating window manager. Ahmm! what’s a tiling window manager? Let me quickly explain it to you. + +### Tiling window manager + +The concept of tiling window manager is simple. Instead of stacking new program window over the other programs, it tiles the programs side by side. So the first program takes up the entire screen. The next one is tiled to its side either horizontally or vertically and so on. + +![AwesomeWM Tiling Window Manager][3] + +Sounds good but what happens when you have tens of programs open? It will be unusable won’t it? This is where the workspaces save your day. You can switch to new workspace and open new programs here. Switching between workspaces is just one or two keystroke away. + +Tiling window manager can be overwhelming for you if you have never used it. It requires you to remember keyboard shortcuts to use it efficiently. But that’s not the end of trouble. Even if you install a tiling window manager like [i3wm][4] or [awesome][5], you won’t get a beautiful desktop out of the box. In fact, it could even look uglier than before. + +You see, all those mesmerizing desktops are result of personal customization. The [tiling window managers are highly configurable but you need to learn to customize them][6]. That’s not very comforting specially for someone who has never used a tiling window manager. + +If you are one of those people who wanted to have a good looking desktop with tiling window manager but could never configured them properly, the Linux ricing gods have heard your prayers. + +### Regolith is dream come true for tiling window noobs + +![Regolith Linux Desktop][7] + +[Regolith][8] is a Linux distribution that brings Ubuntu’s simplicity, GNOME’s configuration and i3wm’s tiling interface together. + +Wait! Don’t we already have enough of Ubuntu-based distributions that change nothing more than the theme and wallpaper? Regolith doesn’t want to be that kind of distribution. In fact, Regolith doesn’t pretend to be a standalone distribution. + +Its [developer experimented with i3wm][9], tweaked it to his liking but soon realized that he had to do it all over again on all the systems he used. That’s when he decided to package it so that he could use it easily on new system. And hence Regolith Linux was born as a customized version of Ubuntu. + +The developer totally understands that not everyone would be willing to replace their existing Ubuntu system just to get a tiling window manager and this is why he has made it available as a desktop as well. This means if you are already running Ubuntu, you can install Regolith desktop and use it beside your regular desktop environment. + +### Install Regolith desktop on Ubuntu + +Regolith desktop is available through [PPA in Ubuntu][10] 18.04 and higher versions. You can install it using the following commands: + +``` +sudo add-apt-repository -y ppa:kgilmer/regolith-stable +sudo apt install regolith-desktop +``` + +Once you have installed it, reboot your system. At the user login screen, click the username and you should see a gear symbol, Click on it and it would give you the option to change the desktop environment. + +![Switch to Regolith Desktop][11] + +### Using tiling window manager with Regolith + +When you log in to the Regolith desktop, you’ll see a plain simple screen with some keyboard shortcuts displayed on the right side, a thin bottom panel with only a few system information. You can find the keyboard shortcut information on [this page][12] as well. + +The keyboard shortcut will help you get started. You can search for an application or settings by pressing Super (Windows) and space key. + +![Regolith App Launcher][13] + +By default, the new program windows are tiled vertically. You can toggle that with Super+Backspace key. Do note that the tiling and toggling is related to the program window in focus. If you have three program windows and you are using the first program window, the next program will be tiled (vertically or horizontally) after it, not after the third program window. It takes some time in getting used to this concept. + +![Multiple Program Windows in Regolith Desktop][14] + +If you don’t like the layout of the windows, you can move them around using the Super+Shift+Arrow keys. You can move between the application windows using Super and Arrow keys. + +If your screen is filled with applications and you want to breath fresh, press Super key and 2 (or 3 or 4, depending upon number of workspaces in use) and start afresh with a new workspace. The new workspace has the keyboard shortcut on the display. You can toggle it with Super+Shift+? key combination. + +Regolith uses GNOME underneath so you can still use GNOME tools to change the system settings. + +Regolith comes with four different color themes with solarized dark being the default. It uses Arc icon themes. Changing the icon theme is same as Ubuntu but if you want to change the color, you need to do some minor tweaking in the configuration file. You can find the configuration information on [this page][15]. + +![Regolith Desktop With Nord Color Scheme][16] + +You can log out of Regolith using the Super+Shift+E key combination. The keyboard shortcuts displayed on the desktop is not correct for logging out. + +Since I have never used i3wm or any other tiling window manager, I find it weird that there is no shutdown option here. You’ll have to use [command line to shutdown Ubuntu here][17]. + +You can find some [useful information to get started with Regolith desktop here][18]. + +### Getting rid of Regolith desktop + +I can understand if you didn’t like Regolith enough to use it as your main desktop. Tiling window manager is not everyone’s cup of tea (or coffee). The good thing is that you can go back to your regular desktop environment the same way you switch to Regolith. + +Log out of your account. Click on the username and you’ll see the gear icon. Click on it and select the desktop environment you want to use. + +Once you are back to the other desktop environment, you may even choose to remove Regolith completely. Note that you MUST be using some other desktop environment while removing Regolith. + +Open a terminal and use the following commands: + +``` +sudo apt remove regolith-desktop +``` + +You can [remove the PPA][19] as well: + +``` +sudo add-apt-repository --remove ppa:kgilmer/regolith-stable +``` + +### To tile, or not to tile, that is the question + +![Regolith Desktop on my Ubuntu 18.04 LTS][20] + +Personally, I am happy to have discovered Regolith desktop. I have been fascinated by the tiling window managers but I didn’t want to spend time on figuring out the configuration. Regolith gives me the comfort of using i3wm out of the box with my main distribution, Ubuntu. + +I like it more as a desktop than a distribution. It gives the opportunity to try out tiling window manager without a lot of hassle. + +Do you like the concept of Regolith desktop? Are you willing to give it a try? How’s your experience with tiling window manager (if any)? Do share your views in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/regolith-linux-desktop/ + +作者:[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://www.reddit.com/r/unixporn/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/linux-ricing-example.jpg?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/awesome-window-anager.jpg?resize=800%2C450&ssl=1 +[4]: https://i3wm.org/ +[5]: https://awesomewm.org/ +[6]: https://fedoramagazine.org/getting-started-i3-window-manager/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-linux-desktop-screenshot-apps.jpg?ssl=1 +[8]: https://regolith-linux.org/ +[9]: https://regolith-linux.org/motivations.html +[10]: https://itsfoss.com/ppa-guide/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/change-to-regolith-desktop.jpg?resize=800%2C400&ssl=1 +[12]: https://regolith-linux.org/keybindings.html +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-app-launcher.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-desktop-tiled-windows.jpg?ssl=1 +[15]: https://regolith-linux.org/configuring.html +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-desktop-with-nord-color-scheme.jpg?ssl=1 +[17]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[18]: https://regolith-linux.org/getting_started.html +[19]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/regolith-desktop-screenshot.jpg?ssl=1 diff --git a/sources/tech/20190903 Humbleness key to open source success, Kubernetes security struggles, and more industry trends.md b/sources/tech/20190903 Humbleness key to open source success, Kubernetes security struggles, and more industry trends.md new file mode 100644 index 0000000000..b5626f9abb --- /dev/null +++ b/sources/tech/20190903 Humbleness key to open source success, Kubernetes security struggles, and more industry trends.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Humbleness key to open source success, Kubernetes security struggles, and more industry trends) +[#]: via: (https://opensource.com/article/19/9/kubernetes-security-struggles-and-more) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Humbleness key to open source success, Kubernetes security 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. + +## [How will open source deal with success?][2] + +> “The old school model is quarterly growth and never over-extend yourself,” Wright explained. “The newer model is very different. You look at it as a big upfront investment and then capture the most mindshare or market share that you possibly can and growth is more important than profitability. If you flip that from a business context to an open source community context, if the metrics are all about growth and not about sustainability then you are going to incentive the wrong kind of behavior and that’s the thing that worries me.” + +**The impact:** The importance of this could easily be summarized as "be humble." A hot streak can easily change the thinking from "we can do anything together" to "nothing can stop this" and of course pride comes before the fall. + +## [10 Quarkus videos to get you up to speed with supersonic, subatomic Java][3] + +> Maybe you’ve heard about [Quarkus][4], also known as supersonic, subatomic Java. According to [Quarkus.io][5], it’s a [Kubernetes][6]-native Java stack tailored for GraalVM and OpenJDK HotSpot, crafted from the best of breed Java libraries and standards. +> +> To help you learn more, we’ve rounded up 10 talks showing Quarkus in action. These videos will take your Quarkus knowledge to the next level. + +**The impact**: The promise of the second sentence is to help you understand what the first one means. Videos 4 (Taste of serverless application development) and 9 (Build Eclipse MicroProfile apps quickly with Quarkus) are probably the most practical. + +## [exFAT in the Linux kernel? Yes!][7] + +> It’s important to us that the Linux community can make use of exFAT included in the Linux kernel with confidence. To this end, we will be making Microsoft’s technical specification for exFAT publicly available to facilitate development of conformant, interoperable implementations. We also support the eventual inclusion of a Linux kernel with exFAT support in a future revision of the Open Invention Network’s Linux System Definition, where, once accepted, the code will benefit from the defensive patent commitments of OIN’s 3040+ members and licensees. + +**The impact**: exFAT is a lowest common denominator filesystem (your microwave can probably read exFAT-formatted USB drives). At the very least, Apple no longer has to license the format. Open sourcing it could just be a good way to squeeze out the last little bit of juice. + +## [Announcing the CNCF Kubernetes Project Journey Report][8] + +> We wanted to create a series of reports that help explain our nurturing efforts and some of the positive trends and outcomes we see developing around our hosted projects. This report attempts to objectively assess the state of the Kubernetes project and how the CNCF has impacted the progress and growth of Kubernetes. We recognize that it’s impossible to sort out correlation and causation but this report attempts to document correlations. For the report, we pulled data from multiple sources, particularly CNCF’s own [DevStats tool][9], which provides detailed development statistics for all CNCF projects. + +**The impact**: On the one hand the CNCF clearly has an interest in making donor organizations feel like their money is being well spent. On the other hand, the money is clearly being well spent: the year-on-year stats improvement is incredible. + +## [The continuing rise of Kubernetes analysed: Security struggles and lifecycle learnings][10] + +> In an early sign of Kubernetes going mainstream, in 2016 Niantic released the massively popular mobile game Pokémon Go, which was built on Kubernetes and deployed in Google Container Engine. At launch, the game experienced usability issues caused by a massive user interest in U.S—the number of users logging in ended up being 50x the original estimation, and 10x the prediction for worst case scenario. By using the inherent scalability advantages of Kubernetes, Pokémon Go went on to successfully launch in Japan two weeks later despite traffic tripling what was experienced during the U.S launch. + +**The impact**: Two things stood out to me: 1) Kubernetes powers Pokemon (!?!) and 2) 2016 seems like so long ago. Sure, the stuff about containers and Kubernetes pushing organizations to adopt new security approaches and the bit about their biggest security concerns (misconfiguration) is interesting but... Pokemon! + +_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/9/kubernetes-security-struggles-and-more + +作者:[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.sdxcentral.com/articles/opinion-editorial/how-will-open-source-deal-with-success/2019/08/ +[3]: https://developers.redhat.com/blog/2019/08/26/10-quarkus-videos-to-get-you-up-to-speed-with-supersonic-subatomic-java/ +[4]: https://developers.redhat.com/blog/2019/05/09/create-your-first-quarkus-project-with-eclipse-ide-red-hat-codeready-studio/ +[5]: https://quarkus.io/ +[6]: https://developers.redhat.com/topics/kubernetes/ +[7]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[8]: https://www.cncf.io/blog/2019/08/29/announcing-the-cncf-kubernetes-project-journey-report/ +[9]: https://k8s.devstats.cncf.io/d/12/dashboards?orgId=1&refresh=15m +[10]: https://www.cloudcomputing-news.net/news/2019/aug/29/continuing-rise-kubernetes-analysed-security-struggles-and-lifecycle-learnings/ diff --git a/sources/tech/20190904 Environment variables in PowerShell.md b/sources/tech/20190904 Environment variables in PowerShell.md new file mode 100644 index 0000000000..9345aa0230 --- /dev/null +++ b/sources/tech/20190904 Environment variables in PowerShell.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Environment variables in PowerShell) +[#]: via: (https://opensource.com/article/19/9/environment-variables-powershell) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/seth) + +Environment variables in PowerShell +====== +Up your PowerShell game with environment variables, in Part 2.5 of the +"Variables in shells" miniseries. +![Hands programming][1] + +Environment variables are global settings for your Linux, Mac, or Windows computer, stored for the system shell to use when executing commands. Many are set by default during installation or user creation. + +For instance, your home directory is set as an environment variable when you log in. How it looks in PowerShell depends on your operating system. + +On Windows: + + +``` +PS C:\Users\bogus> Get-Variable HOME -valueOnly +C:\Users\bogus +``` + +On Linux: + + +``` +pwsh> Get-Variable HOME -valueOnly +HOME=/home/seth +``` + +On a Mac: + + +``` +pwsh> Get-Variable HOME -valueOnly +HOME=/Users/bogus +``` + +You usually don’t use environment variables directly, but they’re referenced by individual applications and daemons as needed. However, environment variables can be useful when you want to override default settings, or when you need to manage new settings that your system has no reason to create on its own. + +This article is about environment variables in the open source PowerShell environment, and so it’s applicable to PowerShell running on Windows, Linux, and Mac. Users of the Bash shell should refer to my article about [Bash environment variables][2]. + +For this article, I ran PowerShell on the open source operating system Linux. The commands are the same regardless of your platform, although the output will differ (for instance, it is statistically unlikely that your username is **seth**). + +### What are environment variables? + +Environment variables in PowerShell are special kinds of variables that provide the system with information about the operating system environment. With environment variables, you can view and change variables in the Windows registry, as well as variables set for a particular session. + +In PowerShell, environment variables are stored in the **Env:** "drive", accessible through the _PowerShell environment provider_, a subsystem of PowerShell. This isn’t a physical drive, but a virtual file system. + +Because environment variables exist in the **Env:** drive, you must prepend **Env:** to the variable name when you reference them. Alternatively, you can set your working location to the **Env:** drive with the **Set-Location** command so you can treat all environment variables as local variables: + + +``` +PS> Set-Location Env: +PS> pwd + +Path +\---- +Env:/ +``` + +Environment variables convey information about your login session to your computer. For instance, when an application needs to determine where to save a data file by default, it usually calls upon the **HOME** environment variable. You probably never set the **HOME** variable yourself, and yet it exists because most environment variables are managed by your operating system. + +You can view all environment variables set on your system with the **Get-ChildItem** command from within the **Env:** drive. The list is long, so pipe the output through **out-host -paging** to make it easy to read: + + +``` +PS> Get-ChildItem | out-host -paging +LOGNAME      seth +LS_COLORS    rs=0:mh=00:bd=48;5;232;38;5; +MAIL         /var/spool/mail/seth +MODULEPATH   /etc/scl/modulefiles:/etc/scl/modulefiles +MODULESHOME  /usr/share/Modules +OLDPWD       /home/seth +PATH         /opt/microsoft/powershell/6:/usr/share/Modules/bin +PSModulePath /home/seth/.local/share/powershell/Modules +PWD          /home/seth +[...] +``` + +If you’re not in the **Env:** drive, then you can do the same thing by adding **Env: **to your command: + + +``` +PS> Get-ChildItem Env: | out-host -paging +LOGNAME      seth +LS_COLORS    rs=0:mh=00:bd=48;5;232;38;5; +MAIL         /var/spool/mail/seth +MODULEPATH   /etc/scl/modulefiles:/etc/scl/modulefiles +``` + +Environment variables can be set, recalled, and cleared with some of the same syntax used for normal variables. Like other variables, anything you set during a session only applies to that particular session. + +If you want to make permanent changes to a variable, you must change them in Windows Registry on Windows, or in a shell configuration file (such as **~/.bashrc**) on Linux or Mac. If you’re not familiar with using variables in PowerShell, read my [variables in PowerShell][3] article before continuing. + +### What are environment variables used for? + +Different environment variables get used by several different systems within your computer. Your **PATH** variable is vital to your shell, for instance, but a lot less significant to, say, Java (which also has paths, but they’re paths to important Java libraries rather than general system folders). However, the **USER** variable is used by several different processes to identify who is requesting a service. + +An installer wizard, like the open source [Nullsoft Scriptable Install System (NSIS)][4] framework, updates your environment variables when you’re installing a new application. Sometimes, when you’re installing something outside of your operating system’s intended toolset, you may have to manage an environment variable yourself. Or, you might choose to add an environment variable to suit your preferences. + +### How are they different from regular variables? + +When you create a normal variable, the variable is considered local, meaning that it’s not defined outside of the shell that created it. + +For example, create a variable: + + +``` +PS> Set-Variable -Name VAR -Value "example" +PS> gv VAR -valueOnly +example +``` + +Launch a new shell, even from within your current shell: + + +``` +PS> pwsh +PS c:\> gv VAR -valueOnly +gv : Cannot find a variable with the name 'example'. +``` + +Environment variables, on the other hand, are meant to be global in scope. They exist separately from the shell that created them and are available to other processes. + +### How do you set an environment variable? + +When setting an environment variable, you should be explicit that it is an environment variable by using the **$Env:** notation: + + +``` +PS Env:/> $Env:FOO = "hello world" +PS Env:/> Get-ChildItem FOO +hello world +``` + +As a test, launch a new session and access the variable you’ve just created. Because the variable is an environment variable, though, you must prepend it with **$Env:**: + + +``` +PS Env:/> pwsh +PS c:\> $Env.FOO +hello world +``` + +Even though you’ve made a variable available to child processes, it’s still just a temporary variable. It works, you can verify that it exists, you can use it from any process, but it is destroyed when the shell that created it is closed. + +### How do you set environment variables in your profile? + +To force an environment variable to persist across sessions, you must add it to your PowerShell profile, such as your **CurrentUser,AllHosts** profile, located in **HOME/Documents/Profile.ps1**: + + +``` +PS> Add-Content -Path $Profile.CurrentUserAllHosts -Value '$Env:FOO = "hello world"' +``` + +With this line added, any PowerShell session launched instantiates the **FOO** environment variable and sets its value to **hello world**. + +There are currently six default profiles controlling PowerShell sessions, so refer to the [Microsoft dev blog][5] for more information. + +### How do you discover new environment variables? + +You can create and manipulate environment variables at will, and some applications do just that. This fact means that many of your environment variables aren’t used by most of your applications, and if you add your own arbitrary variables then some could be used by nothing at all. + +So the question is: How do you find out which environment variables are meaningful? The answer lies in an application’s documentation. + +Python, for instance, offers to add the appropriate Python path to your **Path** environment variable during install. **[Note: PATH?]** If you decline, you can set the value yourself now that you know how to modify environment variables. + +The same is true for any application you install: The installer is expected to add the appropriate variables to your environment, so you should never need to modify **Env:** manually. If you’re developing an application, then your installer should do the same for your users. + +To discover significant variables for individual applications, refer to their user and developer documentation. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/environment-variables-powershell + +作者:[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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/article/19/8/what-are-environment-variables +[3]: https://opensource.com/article/19/8/variables-powershell +[4]: https://sourceforge.net/projects/nsis/ +[5]: https://devblogs.microsoft.com/scripting/understanding-the-six-powershell-profiles diff --git a/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md new file mode 100644 index 0000000000..44b4d6cd24 --- /dev/null +++ b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md @@ -0,0 +1,255 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building CI/CD pipelines with Jenkins) +[#]: via: (https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +Building CI/CD pipelines with Jenkins +====== +Build continuous integration and continuous delivery (CI/CD) pipelines +with this step-by-step Jenkins tutorial. +![pipelines][1] + +In my article [_A beginner's guide to building DevOps pipelines with open source tools_][2], I shared a story about building a DevOps pipeline from scratch. The core technology driving that initiative was [Jenkins][3], an open source tool to build continuous integration and continuous delivery (CI/CD) pipelines. + +At Citi, there was a separate team that provided dedicated Jenkins pipelines with a stable master-slave node setup, but the environment was only used for quality assurance (QA), staging, and production environments. The development environment was still very manual, and our team needed to automate it to gain as much flexibility as possible while accelerating the development effort. This is the reason we decided to build a CI/CD pipeline for DevOps. And the open source version of Jenkins was the obvious choice due to its flexibility, openness, powerful plugin-capabilities, and ease of use. + +In this article, I will share a step-by-step walkthrough on how you can build a CI/CD pipeline using Jenkins. + +### What is a pipeline? + +Before jumping into the tutorial, it's helpful to know something about CI/CD pipelines. + +To start, it is helpful to know that Jenkins itself is not a pipeline. Just creating a new Jenkins job does not construct a pipeline. Think about Jenkins like a remote control—it's the place you click a button. What happens when you do click a button depends on what the remote is built to control. Jenkins offers a way for other application APIs, software libraries, build tools, etc. to plug into Jenkins, and it executes and automates the tasks. On its own, Jenkins does not perform any functionality but gets more and more powerful as other tools are plugged into it. + +A pipeline is a separate concept that refers to the groups of events or jobs that are connected together in a sequence: + +> A **pipeline** is a sequence of events or jobs that can be executed. + +The easiest way to understand a pipeline is to visualize a sequence of stages, like this: + +![Pipeline example][4] + +Here, you should see two familiar concepts: _Stage_ and _Step_. + + * **Stage:** A block that contains a series of steps. A stage block can be named anything; it is used to visualize the pipeline process. + * **Step:** A task that says what to do. Steps are defined inside a stage block. + + + +In the example diagram above, Stage 1 can be named "Build," "Gather Information," or whatever, and a similar idea is applied for the other stage blocks. "Step" simply says what to execute, and this can be a simple print command (e.g., **echo "Hello, World"**), a program-execution command (e.g., **java HelloWorld**), a shell-execution command (e.g., **chmod 755 Hello**), or any other command—as long as it is recognized as an executable command through the Jenkins environment. + +The Jenkins pipeline is provided as a _codified script_ typically called a **Jenkinsfile**, although the file name can be different. Here is an example of a simple Jenkins pipeline file. + + +``` +// Example of Jenkins pipeline script + +pipeline { +  stages { +    stage("Build") { +       steps { +          // Just print a Hello, Pipeline to the console +          echo "Hello, Pipeline!" +          // Compile a Java file. This requires JDKconfiguration from Jenkins +          javac HelloWorld.java +          // Execute the compiled Java binary called HelloWorld. This requires JDK configuration from Jenkins +          java HelloWorld +          // Executes the Apache Maven commands, clean then package. This requires Apache Maven configuration from Jenkins +          mvn clean package ./HelloPackage +          // List the files in current directory path by executing a default shell command +          sh "ls -ltr" +       } +   } +   // And next stages if you want to define further... + } // End of stages +} // End of pipeline +``` + +It's easy to see the structure of a Jenkins pipeline from this sample script. Note that some commands, like **java**, **javac**, and **mvn**, are not available by default, and they need to be installed and configured through Jenkins. Therefore: + +> A **Jenkins pipeline** is the way to execute a Jenkins job sequentially in a defined way by codifying it and structuring it inside multiple blocks that can include multiple steps containing tasks. + +OK. Now that you understand what a Jenkins pipeline is, I'll show you how to create and execute a Jenkins pipeline. At the end of the tutorial, you will have built a Jenkins pipeline like this: + +![Final Result][5] + +### How to build a Jenkins pipeline + +To make this tutorial easier to follow, I created a sample [GitHub repository][6] and a video tutorial. + +Before starting this tutorial, you'll need: + + * **Java Development Kit:** If you don't already have it, install a JDK and add it to the environment path so a Java command (like **java jar**) can be executed through a terminal. This is necessary to leverage the Java Web Archive (WAR) version of Jenkins that is used in this tutorial (although you can use any other distribution). + * **Basic computer operations:** You should know how to type some code, execute basic Linux commands through the shell, and open a browser. + + + +Let's get started. + +#### Step 1: Download Jenkins + +Navigate to the [Jenkins download page][7]. Scroll down to **Generic Java package (.war)** and click on it to download the file; save it someplace where you can locate it easily. (If you choose another Jenkins distribution, the rest of tutorial steps should be pretty much the same, except for Step 2.) The reason to use the WAR file is that it is a one-time executable file that is easily executable and removable. + +![Download Jenkins as Java WAR file][8] + +#### Step 2: Execute Jenkins as a Java binary + +Open a terminal window and enter the directory where you downloaded Jenkins with **cd <your path>**. (Before you proceed, make sure JDK is installed and added to the environment path.) Execute the following command, which will run the WAR file as an executable binary: + + +``` +`java -jar ./jenkins.war` +``` + +If everything goes smoothly, Jenkins should be up and running at the default port 8080. + +![Execute as an executable JAR binary][9] + +#### Step 3: Create a new Jenkins job + +Open a web browser and navigate to **localhost:8080**. Unless you have a previous Jenkins installation, it should go straight to the Jenkins dashboard. Click **Create New Jobs**. You can also click **New Item** on the left. + +![Create New Job][10] + +#### Step 4: Create a pipeline job + +In this step, you can select and define what type of Jenkins job you want to create. Select **Pipeline** and give it a name (e.g., TestPipeline). Click **OK** to create a pipeline job. + +![Create New Pipeline Job][11] + +You will see a Jenkins job configuration page. Scroll down to find** Pipeline section**. There are two ways to execute a Jenkins pipeline. One way is by _directly writing a pipeline script_ on Jenkins, and the other way is by retrieving the _Jenkins file from SCM_ (source control management). We will go through both ways in the next two steps. + +#### Step 5: Configure and execute a pipeline job through a direct script + +To execute the pipeline with a direct script, begin by copying the contents of the [sample Jenkinsfile][6] from GitHub. Choose **Pipeline script** as the **Destination** and paste the **Jenkinsfile** contents in **Script**. Spend a little time studying how the Jenkins file is structured. Notice that there are three Stages: Build, Test, and Deploy, which are arbitrary and can be anything. Inside each Stage, there are Steps; in this example, they just print some random messages. + +Click **Save** to keep the changes, and it should automatically take you back to the Job Overview. + +![Configure to Run as Jenkins Script][12] + +To start the process to build the pipeline, click **Build Now**. If everything works, you will see your first pipeline (like the one below). + +![Click Build Now and See Result][13] + +To see the output from the pipeline script build, click any of the Stages and click **Log**. You will see a message like this. + +![Visit sample GitHub with Jenkins get clone link][14] + +#### Step 6: Configure and execute a pipeline job with SCM + +Now, switch gears: In this step, you will Deploy the same Jenkins job by copying the **Jenkinsfile** from a source-controlled GitHub. In the same [GitHub repository][6], pick up the repository URL by clicking **Clone or download** and copying its URL. + +![Checkout from GitHub][15] + +Click **Configure** to modify the existing job. Scroll to the **Advanced Project Options** setting, but this time, select the **Pipeline script from SCM** option in the **Destination** dropdown. Paste the GitHub repo's URL in the **Repository URL**, and type **Jenkinsfile** in the **Script Path**. Save by clicking the **Save** button. + +![Change to Pipeline script from SCM][16] + +To build the pipeline, once you are back to the Task Overview page, click **Build Now** to execute the job again. The result will be the same as before, except you have one additional stage called **Declaration: Checkout SCM**. + +![Build again and verify][17] + +To see the pipeline's output from the SCM build, click the Stage and view the **Log** to check how the source control cloning process went. + +![Verify Checkout Procedure][18] + +### Do more than print messages + +Congratulations! You've built your first Jenkins pipeline! + +"But wait," you say, "this is very limited. I cannot really do anything with it except print dummy messages." That is OK. So far, this tutorial provided just a glimpse of what a Jenkins pipeline can do, but you can extend its capabilities by integrating it with other tools. Here are a few ideas for your next project: + + * Build a multi-staged Java build pipeline that takes from the phases of pulling dependencies from JAR repositories like Nexus or Artifactory, compiling Java codes, running the unit tests, packaging into a JAR/WAR file, and deploying to a cloud server. + * Implement the advanced code testing dashboard that will report back the health of the project based on the unit test, load test, and automated user interface test with Selenium.  + * Construct a multi-pipeline or multi-user pipeline automating the tasks of executing Ansible playbooks while allowing for authorized users to respond to task in progress. + * Design a complete end-to-end DevOps pipeline that pulls the infrastructure resource files and configuration files stored in SCM like GitHub and executing the scripts through various runtime programs. + + + +Follow any of the tutorials at the end of this article to get into these more advanced cases. + +#### Manage Jenkins + +From the main Jenkins dashboard, click **Manage Jenkins**. + +![Manage Jenkins][19] + +#### Global tool configuration + +There are many options available, including managing plugins, viewing the system log, etc. Click **Global Tool Configuration**. + +![Global Tools Configuration][20] + +#### Add additional capabilities + +Here, you can add the JDK path, Git, Gradle, and so much more. After you configure a tool, it is just a matter of adding the command into your Jenkinsfile or executing it through your Jenkins script. + +![See Various Options for Plugin][21] + +### Where to go from here? + +This article put you on your way to creating a CI/CD pipeline using Jenkins, a cool open source tool. To find out about many of the other things you can do with Jenkins, check out these other articles on Opensource.com: + + * [Getting started with Jenkins X][22] + * [Install an OpenStack cloud with Jenkins][23] + * [Running Jenkins builds in containers][24] + * [Getting started with Jenkins pipelines][25] + * [How to run JMeter with Jenkins][26] + * [Integrating OpenStack into your Jenkins workflow][27] + + + +You may be interested in some of the other articles I've written to supplement your open source journey: + + * [9 open source tools for building a fault-tolerant system][28] + * [Understanding software design patterns][29] + * [A beginner's guide to building DevOps pipelines with open source tools][2] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pipe-pipeline-grid.png?itok=kkpzKxKg (pipelines) +[2]: https://opensource.com/article/19/4/devops-pipeline +[3]: https://jenkins.io/ +[4]: https://opensource.com/sites/default/files/uploads/diagrampipeline.jpg (Pipeline example) +[5]: https://opensource.com/sites/default/files/uploads/0_endresultpreview_0.jpg (Final Result) +[6]: https://github.com/bryantson/CICDPractice +[7]: https://jenkins.io/download/ +[8]: https://opensource.com/sites/default/files/uploads/2_downloadwar.jpg (Download Jenkins as Java WAR file) +[9]: https://opensource.com/sites/default/files/uploads/3_runasjar.jpg (Execute as an executable JAR binary) +[10]: https://opensource.com/sites/default/files/uploads/4_createnewjob.jpg (Create New Job) +[11]: https://opensource.com/sites/default/files/uploads/5_createpipeline.jpg (Create New Pipeline Job) +[12]: https://opensource.com/sites/default/files/uploads/6_runaspipelinescript.jpg (Configure to Run as Jenkins Script) +[13]: https://opensource.com/sites/default/files/uploads/7_buildnow4script.jpg (Click Build Now and See Result) +[14]: https://opensource.com/sites/default/files/uploads/8_seeresult4script.jpg (Visit sample GitHub with Jenkins get clone link) +[15]: https://opensource.com/sites/default/files/uploads/9_checkoutfromgithub.jpg (Checkout from GitHub) +[16]: https://opensource.com/sites/default/files/uploads/10_runsasgit.jpg (Change to Pipeline script from SCM) +[17]: https://opensource.com/sites/default/files/uploads/11_seeresultfromgit.jpg (Build again and verify) +[18]: https://opensource.com/sites/default/files/uploads/12_verifycheckout.jpg (Verify Checkout Procedure) +[19]: https://opensource.com/sites/default/files/uploads/13_managingjenkins.jpg (Manage Jenkins) +[20]: https://opensource.com/sites/default/files/uploads/14_globaltoolsconfiguration.jpg (Global Tools Configuration) +[21]: https://opensource.com/sites/default/files/uploads/15_variousoptions4plugin.jpg (See Various Options for Plugin) +[22]: https://opensource.com/article/18/11/getting-started-jenkins-x +[23]: https://opensource.com/article/18/4/install-OpenStack-cloud-Jenkins +[24]: https://opensource.com/article/18/4/running-jenkins-builds-containers +[25]: https://opensource.com/article/18/4/jenkins-pipelines-with-cucumber +[26]: https://opensource.com/life/16/7/running-jmeter-jenkins-continuous-delivery-101 +[27]: https://opensource.com/business/15/5/interview-maish-saidel-keesing-cisco +[28]: https://opensource.com/article/19/3/tools-fault-tolerant-system +[29]: https://opensource.com/article/19/7/understanding-software-design-patterns diff --git a/sources/tech/20190905 Don-t force allocations on the callers of your API.md b/sources/tech/20190905 Don-t force allocations on the callers of your API.md new file mode 100644 index 0000000000..eca6cc3732 --- /dev/null +++ b/sources/tech/20190905 Don-t force allocations on the callers of your API.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don’t force allocations on the callers of your API) +[#]: via: (https://dave.cheney.net/2019/09/05/dont-force-allocations-on-the-callers-of-your-api) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Don’t force allocations on the callers of your API +====== + +This is a post about performance. Most of the time when worrying about the performance of a piece of code the overwhelming advice should be (with apologies to Brendan Gregg) _don’t worry about it, yet._ However there is one area where I counsel developers to think about the performance implications of a design, and that is API design. + +Because of the high cost of retrofitting a change to an API’s signature to address performance concerns, it’s worthwhile considering the performance implications of your API’s design on its caller. + +### A tale of two API designs + +Consider these two `Read` methods: + +``` +func (r *Reader) Read(buf []byte) (int, error) +func (r *Reader) Read() ([]byte, error) +``` + +The first method takes a `[]byte` buffer and returns the number of bytes read into that buffer and possibly an `error` that occurred while reading. The second takes no arguments and returns some data as a `[]byte` or an `error`. + +This first method should be familiar to any Go programmer, it’s `io.Reader.Read`. As ubiquitous as `io.Reader` is, it’s not the most convenient API to use. Consider for a moment that `io.Reader` is the only Go interface in widespread use that returns _both_ a result _and_ an error. Meditate on this for a moment. The standard Go idiom, checking the error and iff it is `nil` is it safe to consult the other return values, does not apply to `Read`. In fact the caller must do the opposite. First they must record the number of bytes read into the buffer, reslice the buffer, process that data, and only then, consult the error. This is an unusual API for such a common operation and one that frequently catches out newcomers. + +### A trap for young players? + +Why is it so? Why is one of the central APIs in Go’s standard library written like this? A superficial answer might be `io.Reader`‘s signature is a reflection of the underlying `read(2)` syscall, which is indeed true, but misses the point of this post. + +If we compare the API of `io.Reader` to our alternative, `func Read() ([]byte, error)`, this API seems easier to use. Each call to `Read()` will return the data that was read, no need to reslice buffers, no need to remember the special case to do this before checking the error. Yet this is not the signature of `io.Reader.Read`. Why would one of Go’s most pervasive interfaces choose such an awkward API? The answer, I believe, lies in the performance implications of the APIs signature on the _caller_. + +Consider again our alternative `Read` function, `func Read() ([]byte, error)`. On each call `Read` will read some data into a buffer[1][1] and return the buffer to the caller. Where does this buffer come from? Who allocates it? The answer is the buffer is allocated _inside_ `Read`. Therefore each call to `Read` is guaranteed to allocate a buffer which would escape to the heap. The more the program reads, the faster it reads data, the more streams of data it reads concurrently, the more pressure it places on the garbage collector. + +The standard libraries’ `io.Reader.Read` forces the caller to supply a buffer because if the caller is concerned with the number of allocations their program is making this is precisely the kind of thing they want to control. Passing a buffer into `Read` puts the control of the allocations into the caller’s hands. If they aren’t concerned about allocations they can use higher level helpers like `ioutil.ReadAll` to read the contents into a `[]byte`, or `bufio.Scanner` to stream the contents instead. + +The opposite, starting with a method like our alternative `func Read() ([]byte, error)` API, prevents callers from pooling or reusing allocations–no amount of helper methods can fix this. As an API author, if the API cannot be changed you’ll be forced to add a second form to your API taking a supplied buffer and reimplementing your original API in terms of the newer form. Consider, for example, `io.CopyBuffer`. Other examples of retrofitting APIs for performance reasons are the `fmt` [package][2] and the `net/http` [package][3] which drove the introduction of the `sync.Pool` type precisely because the Go 1 guarantee prevented the APIs of those packages from changing. + +* * * + +If you want to commit to an API for the long run, consider how its design will impact the size and frequency of allocations the caller will have to make to use it. + + 1. This API has other problems, such as, _how much data should be read?_ or _should it try to read as much as possible, or return promptly if the read would block?_[][4] + + + +#### Related posts: + + 1. [Friday pop quiz: the smallest buffer][5] + 2. [Constant errors][6] + 3. [Simple test coverage with Go 1.2][7] + 4. [Struct composition with Go][8] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/09/05/dont-force-allocations-on-the-callers-of-your-api + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: tmp.9E95iAQGkb#easy-footnote-bottom-1-3821 (This API has other problems, such as, how much data should be read? or should it try to read as much as possible, or return promptly if the read would block?) +[2]: https://golang.org/cl/43990043 +[3]: https://golang.org/cl/44080043 +[4]: tmp.9E95iAQGkb#easy-footnote-1-3821 +[5]: https://dave.cheney.net/2015/06/05/friday-pop-quiz-the-smallest-buffer (Friday pop quiz: the smallest buffer) +[6]: https://dave.cheney.net/2016/04/07/constant-errors (Constant errors) +[7]: https://dave.cheney.net/2013/10/07/simple-test-coverage-with-go-1-2 (Simple test coverage with Go 1.2) +[8]: https://dave.cheney.net/2015/05/22/struct-composition-with-go (Struct composition with Go) diff --git a/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md new file mode 100644 index 0000000000..d1523f33c3 --- /dev/null +++ b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Open Source Paint Applications for Linux Users) +[#]: via: (https://itsfoss.com/open-source-paint-apps/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +6 Open Source Paint Applications for Linux Users +====== + +As a child, when I started using computer (with Windows XP), my favorite application was Paint. I spent hours doodling on it. Surprisingly, children still love the paint apps. And not just children, the simple paint app comes handy in a number of situations. + +You will find a bunch of applications that let you draw/paint or manipulate images. However, some of them are proprietary. While you’re a Linux user – why not focus on open source paint applications? + +In this article, we are going to list some of the best open source paint applications which are worthy alternatives to proprietary painting software available on Linux. + +### Open Source paint & drawing applications + +![][1] + +**Note:** _The list is in no particular order of ranking._ + +#### 1\. Pinta + +![][2] + +Key Highlights: + + * Great alternative to Paint.NET / MS Paint + * Add-on support (WebP Image support available) + * Layer Support + + + +[Pinta][3] is an impressive open-source paint application which is perfect for drawing and basic image editing. In other words, it is a simple paint application with some fancy features. + +You may consider [Pinta][4] as an alternative to MS Paint on Linux – but with layer support and more. Not just MS Paint, but it acts as a Linux replacement for Paint.NET software available for Windows. Even though Paint.NET is better – Pinta seems to be a decent alternative to it. + +A couple of add-ons can be utilized to enhance the functionality, like the [support for WebP images on Linux][5]. In addition to the layer support, you can easily resize the images, add effects, make adjustments (brightness, contrast, etc.), and also adjust the quality when exporting the image. + +#### How to install Pinta? + +You should be able to easily find it in the Software Center / App Center / Package Manager. Just type in “**Pinta**” and get started installing it. In either case, try the [Flatpak][6] package. + +Or, you can enter the following command in the terminal (Ubuntu/Debian): + +``` +sudo apt install pinta +``` + +For more information on the download packages and installation instructions, refer the [official download page][7]. + +#### 2\. Krita + +![][8] + +Key Highlights: + + * HDR Painting + * PSD Support + * Layer Support + * Brush stabilizers + * 2D Animation + + + +Krita is one of the most advanced open source paint applications for Linux. Of course, for this article, it helps you draw sketches and wreak havoc upon the canvas. But, in addition to that, it offers a whole lot of features. + +[][9] + +Suggested read  Things To Do After Installing Fedora 24 + +For instance, if you have a shaky hand, it can help you stabilize the brush strokes. You also get built-in vector tools to create comic panels and other interesting things. If you are looking for a full-fledged color management support, drawing assistants, and layer management, Krita should be your preferred choice. + +#### How to install Krita? + +Similar to pinta, you should be able to find it listed in the Software Center/App Center or the package manager. It’s also available in the [Flatpak repository][10]. + +Thinking to install it via terminal? Type in the following command: + +``` +sudo apt install krita +``` + +In either case, you can head down to their [official download page][11] to get the **AppImage** file and run it. + +If you have no idea on AppImage files, check out our guide on – [how to use AppImage][12]. + +#### 3\. Tux Paint + +![][13] + +Key Highlights: + + * A no-nonsense paint application for kids + + + +I’m not kidding, Tux Paint is one of the best open-source paint applications for kids between 3-12 years of age. Of course, you do not want options when you want to just scribble. So, Tux Paint seems to be the best option in that case (even for adults!). + +#### How to install Tuxpaint? + +Tuxpaint can be downloaded from the Software Center or Package manager. In either case, to install it on Ubuntu/Debian, type in the following command in the terminal: + +``` +sudo apt install tuxpaint +``` + +For more information on it, head to the [official site][14]. + +#### 4\. Drawpile + +![][15] + +Key Highlights: + + * Collaborative Drawing + * Built-in chat to interact with other users + * Layer support + * Record drawing sessions + + + +Drawpile is an interesting open-source paint application where you get to collaborate with other users in real-time. To be precise, you can simultaneously draw in a single canvas. In addition to this unique feature, you have the layer support, ability to record your drawing session, and even a chat facility to interact with the users collaborating. + +You can host/join a public session or start a private session with your friend which requires a code. By default, the server will be your computer. But, if you want a remote server, you can select it as well. + +Do note, that you will need to [sign up for a Drawpile account][16] in order to collaborate. + +#### How to install Drawpile? + +As far as I’m aware of, you can only find it listed in the [Flatpak repository][17]. + +[][18] + +Suggested read  OCS Store: One Stop Shop All of Your Linux Software Customization Needs + +#### 5\. MyPaint + +![][19] + +Key Highlights: + + * Easy-to-use tool for digital painters + * Layer management support + * Lots of options to tweak your brush and drawing + + + +[MyPaint][20] is a simple yet powerful tool for digital painters. It features a lot of options to tweak in order to make the perfect digital brush stroke. I’m not much of a digital artist (but a scribbler) but I observed quite a few options to adjust the brush, the colors, and an option to add a scratchpad panel. + +It also supports layer management – in case you want that. The latest stable version hasn’t been updated for a few years now, but the recent alpha build (which I tested) works just fine. If you are looking for an open source paint application on Linux – do give this a try. + +#### How to install MyPaint? + +MyPaint is available in the official repository. However, that’s the old version. If you still want to proceed, you can search for it in the Software Center or type the following command in the terminal: + +``` +sudo apt install mypaint +``` + +You can head to its official [GitHub release page][21] for the latest alpha build and get the [AppImage file][12] (any version) to make it executable and launch the app. + +#### 6\. KolourPaint + +![][22] + +Key Highlights: + + * A simple alternative to MS Paint on Linux + * No layer management support + + + +If you aren’t looking for any Layer management support and just want an open source paint application to draw stuff – this is it. + +[KolourPaint][23] is originally tailored for KDE desktop environments but it works flawlessly on others too. + +#### How to install KolourPaint? + +You can install KolourPaint right from the Software Center or via the terminal using the following command: + +``` +sudo apt install kolourpaint4 +``` + +In either case, you can utilize [Flathub][24] as well. + +**Wrapping Up** + +If you are wondering about applications like GIMP/Inkscape, we have those listed in another separate article on the [best Linux Tools for digital artists][25]. If you’re curious about more options, I recommend you to check that out. + +Here, we try to compile a list of best open source paint applications available for Linux. If you think we missed something, feel free to tell us about it in the comments section below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-paint-apps/ + +作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/open-source-paint-apps.png?resize=800%2C450&ssl=1 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/pinta.png?ssl=1 +[3]: https://pinta-project.com/pintaproject/pinta/ +[4]: https://itsfoss.com/pinta-1-6-ubuntu-linux-mint/ +[5]: https://itsfoss.com/webp-ubuntu-linux/ +[6]: https://www.flathub.org/apps/details/com.github.PintaProject.Pinta +[7]: https://pinta-project.com/pintaproject/pinta/releases +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/krita-paint.png?ssl=1 +[9]: https://itsfoss.com/things-to-do-after-installing-fedora-24/ +[10]: https://www.flathub.org/apps/details/org.kde.krita +[11]: https://krita.org/en/download/krita-desktop/ +[12]: https://itsfoss.com/use-appimage-linux/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/tux-paint.jpg?ssl=1 +[14]: http://www.tuxpaint.org/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/drawpile.png?ssl=1 +[16]: https://drawpile.net/accounts/signup/ +[17]: https://flathub.org/apps/details/net.drawpile.drawpile +[18]: https://itsfoss.com/ocs-store/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/mypaint.png?ssl=1 +[20]: https://mypaint.org/ +[21]: https://github.com/mypaint/mypaint/releases +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/kolourpaint.png?ssl=1 +[23]: http://kolourpaint.org/ +[24]: https://flathub.org/apps/details/org.kde.kolourpaint +[25]: https://itsfoss.com/best-linux-graphic-design-software/ diff --git a/sources/tech/20190906 Introduction to monitoring with Pandora FMS.md b/sources/tech/20190906 Introduction to monitoring with Pandora FMS.md new file mode 100644 index 0000000000..2c88ffc6e5 --- /dev/null +++ b/sources/tech/20190906 Introduction to monitoring with Pandora FMS.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introduction to monitoring with Pandora FMS) +[#]: via: (https://opensource.com/article/19/9/introduction-monitoring-pandora-fms) +[#]: author: (Sancho Lerena https://opensource.com/users/slerenahttps://opensource.com/users/jimmyolanohttps://opensource.com/users/alanfdoss) + +Introduction to monitoring with Pandora FMS +====== +Open source, all-purpose monitoring software monitors network equipment, +servers, virtual environments, applications, and much more. +![A network diagram][1] + +Pandora Flexible Monitoring Solution (FMS) is all-purpose monitoring software, which means it can control network equipment, servers (Linux and Windows), virtual environments, applications, databases, and a lot more. It can do both remote monitoring and monitoring based on agents installed on the servers. You can get collected data in reports and graphs and raise alerts if something goes wrong. + +Pandora FMS is offered in two versions: the [open source community edition][2] is aimed at private users and organizations of any size and is fully functional and totally free, while the [enterprise version][3] is designed to facilitate the work of companies, as it has support services and special features for large environments. Both versions are updated every month and accessible directly from the console. + +### Installing Pandora FMS + +#### Getting started + +Linux is the Pandora FMS's preferred operating system, but it also works perfectly under Windows. CentOS 7 is the recommended distribution, and there are installation packages in Debian/Ubuntu and SUSE Linux. If you feel brave, you can install it from source on other distros or FreeBSD or Solaris, but professional support is available only in Linux. + +For a small test, you will need a server with at least 4GB of RAM and about 20GB of free disk space. With this environment, you can monitor 200 to 300 servers easily. Pandora FMS has different ways to scale, and it can monitor several thousand servers in a single instance. By combining several instances, clients with even 100,000 devices can be monitored. + +#### ISO installation + +The easiest way to install Pandora FMS is to use the ISO image, which contains a CentOS 7 version with all the dependencies. The following steps will get Pandora FMS ready to use in just five minutes. + + 1. [Download][4] the ISO from Pandora FMS's website. + 2. Burn it onto a DVD or USB stick, or boot it from your virtual infrastructure manager (e.g., VMware, Xen, VirtualBox). + 3. Boot the image and proceed to the guided setup (a standard CentOS setup process). Set a unique password for the root user. + 4. Identify the IP address of your new system. + 5. Access the Pandora FMS console, using the IP address of the system where you installed Pandora FMS. Open a web browser and enter **http://<pandora_ip_address>/pandora_console** and log in as **admin** using the default password **pandora**. + + + +Congratulations, you're in! You can skip the other installation methods and [jump ahead][5] to start monitoring something real. + +#### Docker installation + + 1. First, launch Pandora FMS with this command: [code]`curl -sSL http://pandorafms.org/getpandora | sh`[/code] You can also run Pandora FMS as a container by executing: [code] docker run --rm -ti -p 80:80 -p 443:443 \ +  --name pandorafms pandorafms/pandorafms:latest +``` + 2. Once Pandora FMS is running, open your browser and enter  +**http://<ip address>/pandora_console**. Log in as **admin** with the default password **pandora**. + + + +The Docker container is at [hub.docker.com/r/pandorafms/pandorafms][6]. + +### Yum installation + +You can install Pandora FMS for Red Hat Enterprise Linux or CentOS 7 in just five steps. + + 1. Activate CentOS Updates, CentOS Extras, and EPEL in [your repository's library][7]. + + 2. Add the official Pandora FMS repo to your system: [code] [artica_pandorafms] + +name=CentOS7 - PandoraFMS official repo +baseurl= +gpgcheck=0 +enabled=1 +``` + + 3. Install the packages from the repo and solve all dependencies: [code]`yum install pandorafms_console pandorafms_server mariadb-server` +``` + 4. Reload services if you need to install Apache or MySQL/MariaDB: [code] service httpd reload (or equivalent) + +service mysqld reload (or equivalent) +``` + + 5. Open your browser and enter **http://<ip address>/pandora_console**. Proceed with the setup process. After accepting the license and doing a few pre-checks, you should see something like this: + + + + +![Pandora FMS environment and database setup][8] + +This screen is only needed when you install using the RPM, DEB, or source code (Git, tarball, etc.). This step of the console configuration uses MySQL credentials (which you need to know) to create a database and a username and password for Pandora FMS console and server. You need to set up the server password manually (yep! Vim or Nano?) by editing the **/etc/pandora/pandora_server.conf** file (follow the [instructions in the documentation][9]). + +Restart the Pandora FMS server, and everything should be ready. + +#### Other ways to install Pandora FMS + +If none of these installation methods work with your setup, other options include a Git checkout, tarball with sources, DEB package (with the .deb online repo), and SUSE RPM. You can learn more about these installation methods in the [installing wiki][10]. + +Grabbing the code is pretty easy with Git: + + +``` +`git clone https://github.com/pandorafms/pandorafms.git` +``` + +### Monitoring with Pandora FMS + +When you log into the console, you will see a welcome screen. + +![Pandora FMS welcome screen][11] + +#### Monitoring something connected to the network + +Let's begin with the most simple thing to do: ping to a host. First, create an agent by selecting **Resources** then **Manage Agents** from the menu. + +![Locating the Manage Agents menu][12] + +Click on **Create** at the bottom of the page, and fill the basic information (don't go crazy, just add your IP address and name). + +![Enter basic data in the Agent Manager][13] + +Go to the **Modules** tab and create a network module. + +![Create a network module][14] + +Use the Module component (which comes from an internal library pre-defined in Pandora FMS) to choose the ping by selecting **Network Management** and entering **Host Alive**. + +![Choosing Host Alive ping][15] + +Click on **Save** and go back to the "view" interface by clicking the "eye" icon on the right. + +![Menu bar with "eye" icon][16] + +Congratulations! Your ping is running (you know it because it's green). + +![Console showing ping is running][17] + +This is the manual way; you can also use the wizard to grab an entire Simple Network Management Protocol (SNMP) device to show interfaces, or you can use a bulk operation to copy a configuration from one device to another, or you can use the command-line interface (CLI) API to do configurations automatically. Review the [online wiki][18], with over 1200 articles of documentation, to learn more. + +The following shows an old Sonicwall NSA 250M Firewall monitored with the SNMP wizard. It shows data on status interfaces, active connections, CPU usage, active VPN, and a lot more. + +![Console showing firewall monitoring][19] + +Remote monitoring supports SNMP v.1, 2, and 3; Windows Management Instrumentation (WMI); remote SSH calls; SNMP trap capturing; and NetFlow monitoring. + +#### Monitoring a server with an agent + +Installing a Linux agent in Red Hat/CentOS is simple. Enter: + + +``` +`yum install pandorafms_agent_unix` +``` + +Edit **/etc/pandora/pandora_agent.conf** and set up the IP address of your Pandora FMS server: + + +``` +`server_ip   ` +``` + +Restart the agent and wait a few seconds for the console to show the data. + +![Console monitoring a Linux agent][20] + +In the main agent view, you can see events, data, and history; define the threshold for status change; and set up alerts to warn you when something is wrong. Months worth of data is available for graphs, reports, and service-level agreement (SLA) compliance. + +Installing a Windows agent is even easier because the installer supports automation for unattended setups. Start by downloading the agent and doing some usual routines. At some point, it will ask you for your server IP and the name for the agent, but that's all. + +![Pandora FMS Windows setup screen][21] + +Windows agents support grabbing service status and processes, executing local commands to get information, getting Windows events, native WMI calls, obtaining performance counters directly from the system, and providing a lot more information than the basic CPU/RAM/disk stuff. It uses the same configuration file as the Linux version (pandora_agent.conf), which you can edit with a text editor like Notepad. Editing is very easy; you should be able to add your own checks in less than a minute. + +### Creating graphs, reports, and SLA checks + +Pandora FMS has lots of options for graphs and reports, including on SLA compliance, in both the open source and enterprise versions. + +![Pandora FMS SLA compliance report][22] + +Pandora FMS's Visual Map feature allows you to create a map of information that combines status, data, graphs, icons, and more. You can edit it using an online editor. Pandora FMS is 100% operable from the console; no desktop application or Java is needed, nor do you need to execute commands from the console. + +Here are three examples. + +![Pandora FMS support ticket graph][23] + +![Pandora FMS network status graph][24] + +![Pandora FMS server status graph][25] + +If you would like to learn more about Pandora FMS, visit the [website][2] or ask questions in the [forum][26]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-monitoring-pandora-fms + +作者:[Sancho Lerena][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/slerenahttps://opensource.com/users/jimmyolanohttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_fedora_cla.png?itok=O927VLkU (A network diagram) +[2]: https://pandorafms.org/ +[3]: https://pandorafms.com/ +[4]: http://pandorafms.org/features/free-download-monitoring-software/ +[5]: tmp.jGrBq9KQnv#Monitoring +[6]: https://hub.docker.com/r/pandorafms/pandorafms +[7]: https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Installing#Installation_in_Red_Hat_Enterprise_Linux_.2F_Fedora_.2F_CentOS +[8]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-1.png (Pandora FMS environment and database setup) +[9]: https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Installing#Server_Initialization_and_Basic_Configuration +[10]: https://pandorafms.com/docs/index.php?title=Pandora:Documentation_en:Installing +[11]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-2.png (Pandora FMS welcome screen) +[12]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-3.png (Locating the Manage Agents menu) +[13]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-4.png (Enter basic data in the Agent Manager) +[14]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-5.png (Create a network module) +[15]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-6.png (Choosing Host Alive ping) +[16]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-7.png (Menu bar with "eye" icon) +[17]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-8.png (Console showing ping is running) +[18]: https://pandorafms.com/docs/index.php?title=Main_Page +[19]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-9.png (Console showing firewall monitoring) +[20]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-10.png (Console monitoring a Linux agent) +[21]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-11.png (Pandora FMS Windows setup screen) +[22]: https://opensource.com/sites/default/files/uploads/installing-pandora-fms-12.png (Pandora FMS SLA compliance report) +[23]: https://opensource.com/sites/default/files/uploads/pandora-fms-visual-console-1.jpg (Pandora FMS support ticket graph) +[24]: https://opensource.com/sites/default/files/uploads/pandora-fms-visual-console-2.jpg (Pandora FMS network status graph) +[25]: https://opensource.com/sites/default/files/uploads/pandora-fms-visual-console-3.png (Pandora FMS server status graph) +[26]: https://pandorafms.org/forum/ diff --git a/sources/tech/20190906 Performing storage management tasks in Cockpit.md b/sources/tech/20190906 Performing storage management tasks in Cockpit.md new file mode 100644 index 0000000000..133d1437a9 --- /dev/null +++ b/sources/tech/20190906 Performing storage management tasks in Cockpit.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Performing storage management tasks in Cockpit) +[#]: via: (https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Performing storage management tasks in Cockpit +====== + +![][1] + +In the [previous article][2] we touched upon some of the new features introduced to Cockpit over the years. This article will look into some of the tools within the UI to perform everyday storage management tasks. To access these functionalities, install the _cockpit-storaged_ package: + +``` +sudo dnf install cockpit-storaged +``` + +From the main screen, click the **Storage** menu option in the left column. Everything needed to observe and manage disks is available on the main Storage screen. Also, the top of the page displays two graphs for the disk’s reading and writing performance with the local filesystem’s information below. In addition, the options to add or modify RAID devices, volume groups, iSCSI devices, and drives are available as well. In addition, scrolling down will reveal a summary of recent logs. This allows admins to catch any errors that require immediate attention. + +![][3] + +### Filesystems + +This section lists the system’s mounted partitions. Clicking on a partition will display information and options for that mounted drive. Growing and shrinking partitions are available in the **Volume** sub-section. There’s also a filesystem subsection that allows you to change the label and configure the mount. + +If it’s part of a volume group, other logical volumes in that group will also be available. Each standard partition has the option to delete and format. Also, logical volumes have an added option to deactivate the partition. + +![][4] + +### RAID devices + +Cockpit makes it super-easy to manage RAID drives. With a few simple clicks the RAID drive is created, formatted, encrypted, and mounted. For details, or a how-to on creating a RAID device from the CLI check out the article [Managing RAID arrays with mdadm][5]. + +To create a RAID device, start by clicking the add (**+**) button. Enter a name, select the type of RAID level and the available drives, then click **Create**. The RAID section will show the newly created device. Select it to create the partition table and format the drive(s). You can always remove the device by clicking the **Stop** and **Delete** buttons in the top-right corner. + +![][6] + +### Logical volumes + +By default, the Fedora installation uses LVM when creating the partition scheme. This allows users to create groups, and add volumes from different disks to those groups. The article, [Use LVM to Upgrade Fedora][7], has some great tips and explanations on how it works in the command-line. + +Start by clicking the add (**+**) button next to “Volume Groups”. Give the group a name, select the disk(s) for the volume group, and click **Create**. The new group is available in the Volume Groups section. The example below demonstrates a new group named “vgraiddemo”. + +Now, click the newly made group then select the option to **Create a New Logical Volume**. Give the LV a name and select the purpose: Block device for filesystems, or pool for thinly provisioning volumes. Adjust the amount of storage, if necessary, and click the **Format** button to finalize the creation. + +![][8] + +Cockpit can also configure current volume groups. To add a drive to an existing group, click the name of the volume group, then click the add (**+**) button next to “Physical Volumes”. Select the disk from the list and click the **Add** button. In one shot, not only has a new PV, been created, but it’s also added to the group. From here, we can add the available storage to a partition, or create a new LV. The example below demonstrates how the additional space is used to grow the root filesystem. + +![][9] + +### iSCSI targets + +Connecting to an iSCSI server is a quick process and requires two things, the initiator’s name, which is assigned to the client, and the name or IP of the server, or target. Therefore we will need to change the initiator’s name on the system to match the configurations on the target server. + +To change the initiator’s name, click the button with the pencil icon, enter the name, and click **Change**. + +To add the iSCSI target, click the add (**+**) button, enter the server’s address, the username and password, if required, and click **Next**. Select the target — verify the name, address, and port, — and click **Add** to finalize the process. + +To remove a target, click the “checkmark” button. A red trashcan will appear beside the target(s). Click it to remove the target from the setup list. + +![][10] + +### NFS mount + +Cockpit even allows sysadmins to configure NFS shares within the UI. To add NFS shares, click the add (**+**) button in the NFS mounts section. Enter the server’s address, the path of the share on the server, and a location on the local machine to mount the share. Adjust the mount options if needed and click **Add** to view information about the share. We also have the options to unmount, edit, and remove the share. The example below demonstrates how the NFS share on SERVER02 is mounted to the _/mnt_ directory. + +![][11] + +### Conclusion + +As we’ve seen in this article, a lot of the storage-related tasks that require lengthy, and multiple, lines of commands can be easily done within the web UI with just a few clicks. Cockpit is continuously evolving and every new feature makes the project better and better. In the next article we’ll explore the features and components on the networking side of things. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-storage-816x345.png +[2]: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-storage-main-screen.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-filesystem.png +[5]: https://fedoramagazine.org/managing-raid-arrays-with-mdadm/ +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-raid.gif +[7]: https://fedoramagazine.org/use-lvm-upgrade-fedora/ +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-lvm-volgroup.gif.gif +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-lvm-pv_lv.gif.gif +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-iscsi-storage.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-nfs-storage.gif diff --git a/sources/tech/20190909 How to Setup Multi Node Elastic Stack Cluster on RHEL 8 - CentOS 8.md b/sources/tech/20190909 How to Setup Multi Node Elastic Stack Cluster on RHEL 8 - CentOS 8.md new file mode 100644 index 0000000000..f56e708426 --- /dev/null +++ b/sources/tech/20190909 How to Setup Multi Node Elastic Stack Cluster on RHEL 8 - CentOS 8.md @@ -0,0 +1,476 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8) +[#]: via: (https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8 +====== + +Elastic stack widely known as **ELK stack**, it is a group of opensource products like **Elasticsearch**, **Logstash** and **Kibana**. Elastic Stack is developed and maintained by Elastic company. Using elastic stack, one can feed system’s logs to Logstash, it is a data collection engine which accept the logs or data from all the sources and normalize logs and then it forwards the logs to Elasticsearch for **analyzing**, **indexing**, **searching** and **storing** and finally using Kibana one can represent the visualize data, using Kibana we can also create interactive graphs and diagram based on user’s queries. + +[![Elastic-Stack-Cluster-RHEL8-CentOS8][1]][2] + +In this article we will demonstrate how to setup multi node elastic stack cluster on RHEL 8 / CentOS 8 servers. Following are details for my Elastic Stack Cluster: + +### Elasticsearch: + + * Three Servers with Minimal RHEL 8 / CentOS 8 + * IPs & Hostname – 192.168.56.40 (elasticsearch1.linuxtechi. local), 192.168.56.50 (elasticsearch2.linuxtechi. local), 192.168.56.60 (elasticsearch3.linuxtechi. local) + + + +### Logstash: + + * Two Servers with minimal RHEL 8 / CentOS 8 + * IPs & Hostname – 192.168.56.20 (logstash1.linuxtechi. local) , 192.168.56.30 (logstash2.linuxtechi. local) + + + +### Kibana: + + * One Server with minimal RHEL 8 / CentOS 8 + * Hostname – kibana.linuxtechi.local + * IP – 192.168.56.10 + + + +### Filebeat: + + * One Server with minimal CentOS 7 + * IP & hostname – 192.168.56.70 (web-server) + + + +Let’s start with Elasticsearch cluster setup, + +#### Setup 3 node Elasticsearch cluster + +As I have already stated that I have kept nodes for Elasticsearch cluster, login to each node, set the hostname and configure yum/dnf repositories. + +Use the below hostnamectl command to set the hostname on respective nodes, + +``` +[root@linuxtechi ~]# hostnamectl set-hostname "elasticsearch1.linuxtechi. local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +[root@linuxtechi ~]# hostnamectl set-hostname "elasticsearch2.linuxtechi. local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +[root@linuxtechi ~]# hostnamectl set-hostname "elasticsearch3.linuxtechi. local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +``` + +For CentOS 8 System we don’t need to configure any OS package repository and for RHEL 8 Server, if you have valid subscription and then subscribed it with Red Hat for getting package repository.  In Case you want to configure local yum/dnf repository for OS packages then refer the below url: + +[How to Setup Local Yum/DNF Repository on RHEL 8 Server Using DVD or ISO File][3] + +Configure Elasticsearch package repository on all the nodes, create a file elastic.repo  file under /etc/yum.repos.d/ folder with the following content + +``` +~]# vi /etc/yum.repos.d/elastic.repo +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md +``` + +save & exit the file + +Use below rpm command on all three nodes to import Elastic’s public signing key + +``` +~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch +``` + +Add the following lines in /etc/hosts file on all three nodes, + +``` +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +``` + +Install Java on all three Nodes using yum / dnf command, + +``` +[root@linuxtechi ~]# dnf install java-openjdk -y +[root@linuxtechi ~]# dnf install java-openjdk -y +[root@linuxtechi ~]# dnf install java-openjdk -y +``` + +Install Elasticsearch using beneath dnf command on all three nodes, + +``` +[root@linuxtechi ~]# dnf install elasticsearch -y +[root@linuxtechi ~]# dnf install elasticsearch -y +[root@linuxtechi ~]# dnf install elasticsearch -y +``` + +**Note:** In case OS firewall is enabled and running in each Elasticsearch node then allow following ports using beneath firewall-cmd command, + +``` +~]# firewall-cmd --permanent --add-port=9300/tcp +~]# firewall-cmd --permanent --add-port=9200/tcp +~]# firewall-cmd --reload +``` + +Configure Elasticsearch, edit the file “**/etc/elasticsearch/elasticsearch.yml**” on all the three nodes and add the followings, + +``` +~]# vim /etc/elasticsearch/elasticsearch.yml +………………………………………… +cluster.name: opn-cluster +node.name: elasticsearch1.linuxtechi.local +network.host: 192.168.56.40 +http.port: 9200 +discovery.seed_hosts: ["elasticsearch1.linuxtechi.local", "elasticsearch2.linuxtechi.local", "elasticsearch3.linuxtechi.local"] +cluster.initial_master_nodes: ["elasticsearch1.linuxtechi.local", "elasticsearch2.linuxtechi.local", "elasticsearch3.linuxtechi.local"] +…………………………………………… +``` + +**Note:** on Each node, add the correct hostname in node.name parameter and ip address in network.host parameter and other parameters will remain the same. + +Now Start and enable the Elasticsearch service on all three nodes using following systemctl command, + +``` +~]# systemctl daemon-reload +~]# systemctl enable elasticsearch.service +~]# systemctl start elasticsearch.service +``` + +Use below ‘ss’ command to verify whether elasticsearch node is start listening on 9200 port, + +``` +[root@linuxtechi ~]# ss -tunlp | grep 9200 +tcp LISTEN 0 128 [::ffff:192.168.56.40]:9200 *:* users:(("java",pid=2734,fd=256)) +[root@linuxtechi ~]# +``` + +Use following curl commands to verify the Elasticsearch cluster status + +``` +[root@linuxtechi ~]# curl http://elasticsearch1.linuxtechi.local:9200 +[root@linuxtechi ~]# curl -X GET http://elasticsearch2.linuxtechi.local:9200/_cluster/health?pretty +``` + +Output above command would be something like below, + +![Elasticsearch-cluster-status-rhel8][1] + +Above output confirms that we have successfully created 3 node Elasticsearch cluster and status of cluster is also green. + +**Note:** If you want to modify JVM heap size then you have edit the file “**/etc/elasticsearch/jvm.options**” and change the below parameters that suits to your environment, + + * -Xms1g + * -Xmx1g + + + +Now let’s move to Logstash nodes, + +#### Install and Configure Logstash + +Perform the following steps on both Logstash nodes, + +Login to both the nodes set the hostname using following hostnamectl command, + +``` +[root@linuxtechi ~]# hostnamectl set-hostname "logstash1.linuxtechi.local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +[root@linuxtechi ~]# hostnamectl set-hostname "logstash2.linuxtechi.local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +``` + +Add the following entries in /etc/hosts file in both logstash nodes + +``` +~]# vi /etc/hosts +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +``` + +Save and exit the file + +Configure Logstash repository on both the nodes, create a file **logstash.repo** under the folder /ete/yum.repos.d/ with following content, + +``` +~]# vi /etc/yum.repos.d/logstash.repo +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md +``` + +Save and exit the file, run the following rpm command to import the signing key + +``` +~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch +``` + +Install Java OpenJDK on both the nodes using following dnf command, + +``` +~]# dnf install java-openjdk -y +``` + +Run the following dnf command from both the nodes to install logstash, + +``` +[root@linuxtechi ~]# dnf install logstash -y +[root@linuxtechi ~]# dnf install logstash -y +``` + +Now configure logstash, perform below steps on both logstash nodes, + +Create a logstash conf file, for that first we have copy sample logstash file under ‘/etc/logstash/conf.d/’ + +``` +# cd /etc/logstash/ +# cp logstash-sample.conf conf.d/logstash.conf +``` + +Edit conf file and update the following content, + +``` +# vi conf.d/logstash.conf + +input { + beats { + port => 5044 + } +} + +output { + elasticsearch { + hosts => ["http://elasticsearch1.linuxtechi.local:9200", "http://elasticsearch2.linuxtechi.local:9200", "http://elasticsearch3.linuxtechi.local:9200"] + index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}" + #user => "elastic" + #password => "changeme" + } +} +``` + +Under output section, in hosts parameter specify FQDN of all three Elasticsearch nodes, other parameters leave as it is. + +Allow logstash port “5044” in OS firewall using following firewall-cmd command, + +``` +~ # firewall-cmd --permanent --add-port=5044/tcp +~ # firewall-cmd –reload +``` + +Now start and enable Logstash service, run the following systemctl commands on both the nodes + +``` +~]# systemctl start logstash +~]# systemctl eanble logstash +``` + +Use below ss command to verify whether logstash service start listening on 5044, + +``` +[root@linuxtechi ~]# ss -tunlp | grep 5044 +tcp LISTEN 0 128 *:5044 *:* users:(("java",pid=2416,fd=96)) +[root@linuxtechi ~]# +``` + +Above output confirms that logstash has been installed and configured successfully. Let’s move to Kibana installation. + +#### Install and Configure Kibana + +Login to Kibana node, set the hostname with **hostnamectl** command, + +``` +[root@linuxtechi ~]# hostnamectl set-hostname "kibana.linuxtechi.local" +[root@linuxtechi ~]# exec bash +[root@linuxtechi ~]# +``` + +Edit /etc/hosts file and add the following lines + +``` +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +``` + +Setup the Kibana repository using following, + +``` +[root@linuxtechi ~]# vi /etc/yum.repos.d/kibana.repo +[elasticsearch-7.x] +name=Elasticsearch repository for 7.x packages +baseurl=https://artifacts.elastic.co/packages/7.x/yum +gpgcheck=1 +gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch +enabled=1 +autorefresh=1 +type=rpm-md + +[root@linuxtechi ~]# rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch +``` + +Execute below dnf command to install kibana, + +``` +[root@linuxtechi ~]# yum install kibana -y +``` + +Configure Kibana by editing the file “**/etc/kibana/kibana.yml**” + +``` +[root@linuxtechi ~]# vim /etc/kibana/kibana.yml +………… +server.host: "kibana.linuxtechi.local" +server.name: "kibana.linuxtechi.local" +elasticsearch.hosts: ["http://elasticsearch1.linuxtechi.local:9200", "http://elasticsearch2.linuxtechi.local:9200", "http://elasticsearch3.linuxtechi.local:9200"] +………… +``` + +Start and enable kibana service + +``` +[root@linuxtechi ~]# systemctl start kibana +[root@linuxtechi ~]# systemctl enable kibana +``` + +Allow Kibana port ‘5601’ in OS firewall, + +``` +[root@linuxtechi ~]# firewall-cmd --permanent --add-port=5601/tcp +success +[root@linuxtechi ~]# firewall-cmd --reload +success +[root@linuxtechi ~]# +``` + +Access Kibana portal / GUI using the following URL: + + + +[![Kibana-Dashboard-rhel8][1]][4] + +From dashboard, we can also check our Elastic Stack cluster status + +[![Stack-Monitoring-Overview-RHEL8][1]][5] + +This confirms that we have successfully setup multi node Elastic Stack cluster on RHEL 8 / CentOS 8. + +Now let’s send some logs to logstash nodes via filebeat from other Linux servers, In my case I have one CentOS 7 Server, I will push all important logs of this server to logstash via filebeat. + +Login to CentOS 7 server and install filebeat package using following rpm command, + +``` +[root@linuxtechi ~]# rpm -ivh https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.1-x86_64.rpm +Retrieving https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.1-x86_64.rpm +Preparing... ################################# [100%] +Updating / installing... + 1:filebeat-7.3.1-1 ################################# [100%] +[root@linuxtechi ~]# +``` + +Edit the /etc/hosts file and add the following entries, + +``` +192.168.56.20 logstash1.linuxtechi.local +192.168.56.30 logstash2.linuxtechi.local +``` + +Now configure the filebeat so that it can send logs to logstash nodes using load balancing technique, edit the file “**/etc/filebeat/filebeat.yml**” and add the following parameters, + +Under the ‘**filebeat.inputs:**’ section change ‘**enabled: false**‘ to ‘**enabled: true**‘ and under the “**paths**” parameter specify the location log files that we can send to logstash, In output Elasticsearch section comment out “**output.elasticsearch**” and **host** parameter. In Logstash output section, remove the comments for “**output.logstash:**” and “**hosts:**” and add the both logstash nodes in hosts parameters and also “**loadbalance: true**”. + +``` +[root@linuxtechi ~]# vi /etc/filebeat/filebeat.yml +………………………. +filebeat.inputs: +- type: log + enabled: true + paths: + - /var/log/messages + - /var/log/dmesg + - /var/log/maillog + - /var/log/boot.log +#output.elasticsearch: + # hosts: ["localhost:9200"] + +output.logstash: + hosts: ["logstash1.linuxtechi.local:5044", "logstash2.linuxtechi.local:5044"] + loadbalance: true +……………………………………… +``` + +Start and enable filebeat service using beneath systemctl commands, + +``` +[root@linuxtechi ~]# systemctl start filebeat +[root@linuxtechi ~]# systemctl enable filebeat +``` + +Now go to Kibana GUI, verify whether new indices are visible or not, + +Choose Management option from Left side bar and then click on Index Management under Elasticsearch, + +[![Elasticsearch-index-management-Kibana][1]][6] + +As we can see above, indices are visible now, let’s create index pattern, + +Click on “Index Patterns” from Kibana Section, it will prompt us to create a new pattern, click on “**Create Index Pattern**” and specify the pattern name as “**filebeat**” + +[![Define-Index-Pattern-Kibana-RHEL8][1]][7] + +Click on Next Step + +Choose “**Timestamp**” as time filter for index pattern and then click on “Create index pattern” + +[![Time-Filter-Index-Pattern-Kibana-RHEL8][1]][8] + +[![filebeat-index-pattern-overview-Kibana][1]][9] + +Now Click on Discover to see real time filebeat index pattern, + +[![Discover-Kibana-REHL8][1]][10] + +This confirms that Filebeat agent has been configured successfully and we are able to see real time logs on Kibana dashboard. + +That’s all from this article, please don’t hesitate to share your feedback and comments in case these steps help you to setup multi node Elastic Stack Cluster on RHEL 8 / CentOS 8 system. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Elastic-Stack-Cluster-RHEL8-CentOS8.jpg +[3]: https://www.linuxtechi.com/setup-local-yum-dnf-repository-rhel-8/ +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Kibana-Dashboard-rhel8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Stack-Monitoring-Overview-RHEL8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Elasticsearch-index-management-Kibana.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Define-Index-Pattern-Kibana-RHEL8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Time-Filter-Index-Pattern-Kibana-RHEL8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/filebeat-index-pattern-overview-Kibana.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Discover-Kibana-REHL8.jpg diff --git a/sources/tech/20190909 How to use Terminator on Linux to run multiple terminals in one window.md b/sources/tech/20190909 How to use Terminator on Linux to run multiple terminals in one window.md new file mode 100644 index 0000000000..6ee0820fdf --- /dev/null +++ b/sources/tech/20190909 How to use Terminator on Linux to run multiple terminals in one window.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Terminator on Linux to run multiple terminals in one window) +[#]: via: (https://www.networkworld.com/article/3436784/how-to-use-terminator-on-linux-to-run-multiple-terminals-in-one-window.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to use Terminator on Linux to run multiple terminals in one window +====== +Providing an option for multiple GNOME terminals within a single window frame, Terminator lets you flexibly align your workspace to suit your needs. +Sandra Henry-Stocker + +If you’ve ever wished that you could line up multiple terminal windows and organize them in a single window frame, we may have some good news for you. The Linux **Terminator** can do this for you. No problemo! + +### Splitting windows + +Terminator will initially open like a terminal window with a single window. Once you mouse click within that window, however, it will bring up an options menu that gives you the flexibility to make changes. You can choose “**split horizontally**” or “**split vertically**” to split the window you are currently position in into two smaller windows. In fact, with these menu choices, complete with tiny illustrations of the resultant split (resembling **=** and **||**), you can split windows repeatedly if you like. Of course, if you split the overall window into more than six or nine sections, you might just find that they're too small to be used effectively. + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][1] ]** + +Using ASCII art to illustrate the process of splitting windows, you might see something like this: + +``` ++-------------------+ +-------------------+ +-------------------+ +| | | | | | +| | | | | | +| | ==> |-------------------| ==> |-------------------| +| | | | | | | +| | | | | | | ++-------------------+ +-------------------+ +-------------------+ + Original terminal Split horizontally Split vertically +``` + +Another option for splitting windows is to use control sequences like **Ctrl+Shift+e** to split a window vertically and **Ctrl+Shift+o** (“o" as in “open”) to split the screen horizontally. + +Once Terminator has split into smaller windows for you, you can click in any window to use it and move from window to window as your work dictates. + +### Maximizing a window + +If you want to ignore all but one of your windows for a while and focus on just one, you can click in that window and select the "**Maximize**" option from the menu. That window will then grow to claim all of the space. Click again and select "**Restore all terminals**" to return to the multi-window display. **Ctrl+Shift+x** will toggle between the normal and maximized settings. + +The window size indicators (e.g., 80x15) on window labels display the number of characters per line and the number of lines per window that each window provides. + +### Closing windows + +To close any window, bring up the Terminator menu and select **Close**. Other windows will adjust themselves to take up the space until you close the last remaining window. + +### Saving your customized setup(s) + +Setting up your customized terminator settings as your default once you've split your overall window into multiple segments is quite easy. Select **Preferences** from the pop-up menu and then **Layouts** from the tab along the top of the window that opens. You should then see **New Layout** listed. Just click on the **Save** option at the bottom and **Close** on the bottom right. Terminator will save your settings in  **~/.config/terminator/config** and will then use this file every time you use it. + +You can also enlarge your overall window by stretching it with your mouse. Again, if you want to retain the changes, select **Preferences** from the menu, **Layouts** and then **Save** and **Close** again. + +### Choosing between saved configurations + +If you like, you can set up multiple options for your Terminator window arrangements by maintaining a number of config files, renaming each afterwards (e.g., config-1, config-2) and then moving your choice into place as **~/.config/terminator/config** when you want to use that layout. Here's an example script for doing something like this script. It lets you choose between three pre-configured window arrangements: + +``` +#!/bin/bash + +PS3='Terminator options: ' +options=("Split 1" "Split 2" "Split 3" "Quit") +select opt in "${options[@]}" +do + case $opt in + "Split 1") + config=config-1 + break + ;; + "Split 2") + config=config-2 + break + ;; + "Split 3") + config=config-3 + break + ;; + *) + exit + ;; + esac +done + +cd ~/.config/terminator +cp config config- +cp $config config +cd +terminator & +``` + +You could give the options more meaningful names than "config-1" if that helps. + +### Wrap-up + +Terminator is a good choice for setting up multiple windows to work on related tasks. If you've never used it, you'll probably need to install it first with a command such as "sudo apt install terminator" or "sudo yum install -y terminator". + +Hopefully, you will enjoy using Terminator. And, as another character of the same name might say, "I'll be back!" + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3436784/how-to-use-terminator-on-linux-to-run-multiple-terminals-in-one-window.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.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190911 10 Ansible modules you need to know.md b/sources/tech/20190911 10 Ansible modules you need to know.md new file mode 100644 index 0000000000..51b0078f86 --- /dev/null +++ b/sources/tech/20190911 10 Ansible modules you need to know.md @@ -0,0 +1,381 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ansible modules you need to know) +[#]: via: (https://opensource.com/article/19/9/must-know-ansible-modules) +[#]: author: (DirectedSoul https://opensource.com/users/directedsoulhttps://opensource.com/users/markphttps://opensource.com/users/rich-butkevichttps://opensource.com/users/jairojuniorhttps://opensource.com/users/marcobravohttps://opensource.com/users/johnsimcall) + +10 Ansible modules you need to know +====== +See examples and learn the most important modules for automating +everyday tasks with Ansible. +![Text editor on a browser, in blue][1] + +[Ansible][2] is an open source IT configuration management and automation platform. It uses human-readable YAML templates so users can program repetitive tasks to happen automatically without having to learn an advanced programming language. + +Ansible is agentless, which means the nodes it manages do not require any software to be installed on them. This eliminates potential security vulnerabilities and makes overall management smoother. + +Ansible [modules][3] are standalone scripts that can be used inside an Ansible playbook. A playbook consists of a play, and a play consists of tasks. These concepts may seem confusing if you're new to Ansible, but as you begin writing and working more with playbooks, they will become familiar. + +There are some modules that are frequently used in automating everyday tasks; those are the ones that we will cover in this article. + +Ansible has three main files that you need to consider: + + * **Host/inventory file:** Contains the entry of the nodes that need to be managed + * **Ansible.cfg file:** Located by default at **/etc/ansible/ansible.cfg**, it has the necessary privilege escalation options and the location of the inventory file + * **Main file:** A playbook that has modules that perform various tasks on a host listed in an inventory or host file + + + +### Module 1: Package management + +There is a module for most popular package managers, such as DNF and APT, to enable you to install any package on a system. Functionality depends entirely on the package manager, but usually these modules can install, upgrade, downgrade, remove, and list packages. The names of relevant modules are easy to guess. For example, the DNF module is [dnf_module][4], the old YUM module (required for Python 2 compatibility) is [yum_module][5], while the APT module is [apt_module][6], the Slackpkg module is [slackpkg_module][7], and so on. + +Example 1: + + +``` +\- name: install the latest version of Apache and MariaDB +  dnf: +    name: +     - httpd +      - mariadb-server +    state: latest +``` + +This installs the Apache web server and the MariaDB SQL database. + +#### Example 2: + + +``` +\- name: Install a list of packages +  yum: +    name: +     - nginx +      - postgresql +      - postgresql-server +    state: present +``` + +This installs the list of packages and helps download multiple packages. + +### Module 2: Service + +After installing a package, you need a module to start it. The [service module][8] enables you to start, stop, and reload installed packages; this comes in pretty handy. + +#### Example 1: + + +``` +\- name: Start service foo, based on running process /usr/bin/foo +  service: +    name: foo +    pattern: /usr/bin/foo +    state: started +``` + +This starts the service **foo**. + +#### Example 2: + + +``` +\- name: Restart network service for interface eth0 +  service: +    name: network +    state: restarted +    args: eth0 +``` + +This restarts the network service of the interface **eth0**. + +### Module 3: Copy + +The [copy module][9] copies a file from the local or remote machine to a location on the remote machine. + +#### Example 1: + + +``` +\- name: Copy a new "ntp.conf file into place, backing up the original if it differs from the copied version +  copy: +    src: /mine/ntp.conf +    dest: /etc/ntp.conf +    owner: root +    group: root +    mode: '0644' +    backup: yes +``` + +#### Example 2: + + +``` +\- name: Copy file with owner and permission, using symbolic representation +  copy: +    src: /srv/myfiles/foo.conf +    dest: /etc/foo.conf +    owner: foo +    group: foo +    mode: u=rw,g=r,o=r +``` + +### Module 4: Debug + +The [debug module][10] prints statements during execution and can be useful for debugging variables or expressions without having to halt the playbook. + +#### Example 1: + + +``` +\- name: Display all variables/facts known for a host +  debug: +    var: hostvars[inventory_hostname] +    verbosity: 4 +``` + +This displays all the variable information for a host that is defined in the inventory file. + +#### Example 2: + + +``` +\- name: Write some content in a file /tmp/foo.txt +  copy: +    dest: /tmp/foo.txt +    content: | +     Good Morning! +      Awesome sunshine today. +    register: display_file_content +\- name: Debug display_file_content +    debug: +      var: display_file_content +      verbosity: 2 +``` + +This registers the content of the copy module output and displays it only when you specify verbosity as 2. For example: + + +``` +`ansible-playbook demo.yaml -vv` +``` + +### Module 5: File + +The [file module][11] manages the file and its properties. + + * It sets attributes of files, symlinks, or directories. + * It also removes files, symlinks, or directories. + + + +#### Example 1: + + +``` +\- name: Change file ownership, group and permissions +  file: +    path: /etc/foo.conf +    owner: foo +    group: foo +    mode: '0644' +``` + +This creates a file named **foo.conf** and sets the permission to **0644**. + +#### Example 2: + + +``` +\- name: Create a directory if it does not exist +  file: +    path: /etc/some_directory +    state: directory +    mode: '0755' +``` + +This creates a directory named **some_directory** and sets the permission to **0755**. + +### Module 6: Lineinfile + +The [lineinfile module][12] manages lines in a text file. + + * It ensures a particular line is in a file or replaces an existing line using a back-referenced regular expression. + * It's primarily useful when you want to change just a single line in a file. + + + +#### Example 1: + + +``` +\- name: Ensure SELinux is set to enforcing mode +  lineinfile: +    path: /etc/selinux/config +    regexp: '^SELINUX=' +    line: SELINUX=enforcing +``` + +This sets the value of **SELINUX=enforcing**. + +#### Example 2: + + +``` +\- name: Add a line to a file if the file does not exist, without passing regexp +  lineinfile: +    path: /etc/resolv.conf +    line: 192.168.1.99 foo.lab.net foo +    create: yes +``` + +This adds an entry for the IP and hostname in the **resolv.conf** file. + +### Module 7: Git + +The [git module][13] manages git checkouts of repositories to deploy files or software. + +#### Example 1: + + +``` +# Example Create git archive from repo +\- git: +    repo: +    dest: /src/ansible-examples +    archive: /tmp/ansible-examples.zip +``` + +#### Example 2: + + +``` +\- git: +    repo: +    dest: /src/ansible-examples +    separate_git_dir: /src/ansible-examples.git +``` + +This clones a repo with a separate Git directory. + +### Module 8: Cli_command + +The [cli_command module][14], first available in Ansible 2.7, provides a platform-agnostic way of pushing text-based configurations to network devices over the **network_cli connection** plugin. + +#### Example 1: + + +``` +\- name: commit with comment +  cli_config: +    config: set system host-name foo +    commit_comment: this is a test +``` + +This sets the hostname for a switch and exits with a commit message. + +#### Example 2: + + +``` +\- name: configurable backup path +  cli_config: +    config: "{{ lookup('template', 'basic/config.j2') }}" +    backup: yes +    backup_options: +      filename: backup.cfg +      dir_path: /home/user +``` + +This backs up a config to a different destination file. + +### Module 9: Archive + +The [archive module][15] creates a compressed archive of one or more files. By default, it assumes the compression source exists on the target. + +#### Example 1: + + +``` +\- name: Compress directory /path/to/foo/ into /path/to/foo.tgz +  archive: +    path: /path/to/foo +    dest: /path/to/foo.tgz +``` + +#### Example 2: + + +``` +\- name: Create a bz2 archive of multiple files, rooted at /path +  archive: +    path: +   - /path/to/foo +    - /path/wong/foo +    dest: /path/file.tar.bz2 +    format: bz2 +``` + +### Module 10: Command + +One of the most basic but useful modules, the [command module][16] takes the command name followed by a list of space-delimited arguments. + +#### Example 1: + + +``` +\- name: return motd to registered var +  command: cat /etc/motd +  register: mymotd +``` + +#### Example 2: + + +``` +\- name: Change the working directory to somedir/ and run the command as db_owner if /path/to/database does not exist. +  command: /usr/bin/make_database.sh db_user db_name +  become: yes +  become_user: db_owner +  args: +    chdir: somedir/ +    creates: /path/to/database +``` + +### Conclusion + +There are tons of modules available in Ansible, but these ten are the most basic and powerful ones you can use for an automation job. As your requirements change, you can learn about other useful modules by entering **ansible-doc <module-name>** on the command line or refer to the [official documentation][17]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/must-know-ansible-modules + +作者:[DirectedSoul][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/directedsoulhttps://opensource.com/users/markphttps://opensource.com/users/rich-butkevichttps://opensource.com/users/jairojuniorhttps://opensource.com/users/marcobravohttps://opensource.com/users/johnsimcall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://www.ansible.com/ +[3]: https://docs.ansible.com/ansible/latest/user_guide/modules.html +[4]: https://docs.ansible.com/ansible/latest/modules/dnf_module.html +[5]: https://docs.ansible.com/ansible/latest/modules/yum_module.html +[6]: https://docs.ansible.com/ansible/latest/modules/apt_module.html +[7]: https://docs.ansible.com/ansible/latest/modules/slackpkg_module.html +[8]: https://docs.ansible.com/ansible/latest/modules/service_module.html +[9]: https://docs.ansible.com/ansible/latest/modules/copy_module.html +[10]: https://docs.ansible.com/ansible/latest/modules/debug_module.html +[11]: https://docs.ansible.com/ansible/latest/modules/file_module.html +[12]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html +[13]: https://docs.ansible.com/ansible/latest/modules/git_module.html#git-module +[14]: https://docs.ansible.com/ansible/latest/modules/cli_command_module.html +[15]: https://docs.ansible.com/ansible/latest/modules/archive_module.html +[16]: https://docs.ansible.com/ansible/latest/modules/command_module.html +[17]: https://docs.ansible.com/ diff --git a/sources/tech/20190911 4 open source cloud security tools.md b/sources/tech/20190911 4 open source cloud security tools.md new file mode 100644 index 0000000000..5a9e6d9d83 --- /dev/null +++ b/sources/tech/20190911 4 open source cloud security tools.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 open source cloud security tools) +[#]: via: (https://opensource.com/article/19/9/open-source-cloud-security) +[#]: author: (Alison NaylorAaron Rinehart https://opensource.com/users/asnaylorhttps://opensource.com/users/ansilvahttps://opensource.com/users/sethhttps://opensource.com/users/bretthunoldtcomhttps://opensource.com/users/aaronrineharthttps://opensource.com/users/marcobravo) + +4 open source cloud security tools +====== +Find and eliminate vulnerabilities in the data you store in AWS and +GitHub. +![Tools in a cloud][1] + +If your day-to-day as a developer, system administrator, full-stack engineer, or site reliability engineer involves Git pushes, commits, and pulls to and from GitHub and deployments to Amazon Web Services (AWS), security is a persistent concern. Fortunately, open source tools are available to help your team avoid common mistakes that could cost your organization thousands of dollars. + +This article describes four open source tools that can help improve your security practices when you're developing on GitHub and AWS. Also, in the spirit of open source, I've joined forces with three security experts—[Travis McPeak][2], senior cloud security engineer at Netflix; [Rich Monk][3], senior principal information security analyst at Red Hat; and [Alison Naylor][4], principal information security analyst at Red Hat—to contribute to this article. + +We've separated each tool by scenario, but they are not mutually exclusive. + +### 1\. Find sensitive data with Gitrob + +You need to find any potentially sensitive information present in your team's Git repos so you can remove it. It may make sense for you to use tools that are focused towards attacking an application or a system using a red/blue team model, in which an infosec team is divided in two: an attack team (a.k.a. a red team) and a defense team (a.k.a. a blue team). Having a red team to try to penetrate your systems and applications is lots better than waiting for an adversary to do so. Your red team might try using [Gitrob][5], a tool that can clone and crawl through your Git repositories looking for credentials and sensitive files. + +Even though tools like Gitrob could be used for harm, the idea here is for your infosec team to use it to find inadvertently disclosed sensitive data that belongs to your organization (such as AWS keypairs or other credentials that were committed by mistake). That way, you can get your repositories fixed and sensitive data expunged—hopefully before an adversary finds them. Remember to remove not only the affected files but [also their history][6]! + +### 2\. Avoid committing sensitive data with git-secrets + +While it's important to find and remove sensitive information in your Git repos, wouldn't it be better to avoid committing those secrets in the first place? Mistakes happen, but you can protect yourself from public embarrassment by using [git-secrets][7]. This tool allows you to set up hooks that scan your commits, commit messages, and merges looking for common patterns for secrets. Choose patterns that match the credentials your team uses, such as AWS access keys and secret keys. If it finds a match, your commit is rejected and a potential crisis averted. + +It's simple to set up git-secrets for your existing repos, and you can apply a global configuration to protect all future repositories you initialize or clone. You can also use git-secrets to scan your repos (and all previous revisions) to search for secrets before making them public. + +### 3\. Create temporary credentials with Key Conjurer + +It's great to have a little extra insurance to prevent inadvertently publishing stored secrets, but maybe we can do even better by not storing credentials at all. Keeping track of credentials generally—including who has access to them, where they are stored, and when they were last rotated—is a hassle. However, programmatically generating temporary credentials can avoid a lot of those issues altogether, neatly side-stepping the issue of storing secrets in Git repos. Enter [Key Conjurer][8], which was created to address this need. For more on why Riot Games created Key Conjurer and how they developed it, read _[Key conjurer: our policy of least privilege][9]_. + +### 4\. Apply least privilege automatically with Repokid + +Anyone who has taken a security 101 course knows that least privilege is the best practice for role-based access control configuration. Sadly, outside school, it becomes prohibitively difficult to apply least-privilege policies manually. An application's access requirements change over time, and developers are too busy to trim back their permissions manually. [Repokid][10] uses data that AWS provides about identity and access management (IAM) use to automatically right-size policies. Repokid helps even the largest organizations apply least privilege automatically in AWS. + +### Tools, not silver bullets + +These tools are by no means silver bullets, but they are just that: tools! So, make sure you work with the rest of your organization to understand the use cases and usage patterns for your cloud services before trying to implement any of these tools or other controls. + +Becoming familiar with the best practices documented by all your cloud and code repository services should be taken seriously as well. The following articles will help you do so. + +**For AWS:** + + * [Best practices for managing AWS access keys][11] + * [AWS security audit guidelines][12] + + + +**For GitHub:** + + * [Introducing new ways to keep your code secure][13] + * [GitHub Enterprise security best practices][14] + + + +Last but not least, reach out to your infosec team; they should be able to provide you with ideas, recommendations, and guidelines for your team's success. Always remember: security is everyone's responsibility, not just theirs. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/open-source-cloud-security + +作者:[Alison NaylorAaron Rinehart][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/asnaylorhttps://opensource.com/users/ansilvahttps://opensource.com/users/sethhttps://opensource.com/users/bretthunoldtcomhttps://opensource.com/users/aaronrineharthttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT (Tools in a cloud) +[2]: https://twitter.com/travismcpeak?lang=en +[3]: https://github.com/rmonk +[4]: https://www.linkedin.com/in/alperkins/ +[5]: https://github.com/michenriksen/gitrob +[6]: https://help.github.com/en/articles/removing-sensitive-data-from-a-repository +[7]: https://github.com/awslabs/git-secrets +[8]: https://github.com/RiotGames/key-conjurer +[9]: https://technology.riotgames.com/news/key-conjurer-our-policy-least-privilege +[10]: https://github.com/Netflix/repokid +[11]: https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html +[12]: https://docs.aws.amazon.com/general/latest/gr/aws-security-audit-guide.html +[13]: https://github.blog/2019-05-23-introducing-new-ways-to-keep-your-code-secure/ +[14]: https://github.blog/2015-10-09-github-enterprise-security-best-practices/ diff --git a/sources/tech/20190911 How to Collect System and Application Metrics using Metricbeat.md b/sources/tech/20190911 How to Collect System and Application Metrics using Metricbeat.md new file mode 100644 index 0000000000..194fd077e6 --- /dev/null +++ b/sources/tech/20190911 How to Collect System and Application Metrics using Metricbeat.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Collect System and Application Metrics using Metricbeat) +[#]: via: (https://www.linuxtechi.com/collect-system-application-metrics-metricbeat/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Collect System and Application Metrics using Metricbeat +====== + +**Metricbeat** is a lightweight shipper (or agent) which is used to collect system’s metrics and application metrics and send them to Elastic Stack Server (i.e **Elasticsearch**). Here system’s metrics refers to CPU, Memory, Disk and Network Stats (IOPS) and application metrics means monitoring and collecting metrics of applications like **Apache**, **NGINX**, **Docker**, **Kubernetes** and **Redis** etc. For metricbeat to work first we must make sure that we have a healthy elastic stack setup up and running.  Please refer the below url to setup elastic stack: + +**[How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8][1]** + +In this article we will demonstrate how install metricbeat on linux servers and then how metricbeat sends data to Elastic Stack Server (i.e Elasticsearch) and then we will verify from kiabana GUI whether metrics data is visible or not. + +### Install Metricbeat on CentOS / RHEL Servers + +On CentOS / RHEL Servers, metricbeat is installed using the following rpm command, + +``` +[root@linuxtechi ~]# rpm -ivh https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.3.1-x86_64.rpm +``` + +For Debian based systems, use below command to install metricbeat. + +``` +~]# curl -L -O https://artifacts.elastic.co/downloads/beats/metricbeat/metricbeat-7.3.1-amd64.deb +~]# dpkg -i metricbeat-7.3.1-amd64.deb +``` + +Add the following lines in /etc/hosts file, as we will be using FQDN of Elasticsearch and Kibana in metricbeat config file and command, + +**Note:** Change the IPs and Hostname as per  your setup + +``` +192.168.56.40 elasticsearch1.linuxtechi.local +192.168.56.50 elasticsearch2.linuxtechi.local +192.168.56.60 elasticsearch3.linuxtechi.local +192.168.56.10 kibana.linuxtechi.local +``` + +### Configure Metricbeat on Linux Server (CentOS / RHEL / Debian) + +Whenever metricbeat rpm & deb package is installed then its configuration file (**metricbeat.yml**) is created under “**/etc/metricbeat/**“. Let’s edit this configuration file and inform system to send system and application metrics data to Elasticsearch servers. + +``` +[root@linuxtechi ~]# vi /etc/metricbeat/metricbeat.yml + +setup.kibana: + host: "kibana.linuxtechi.local:5601" +output.elasticsearch: + hosts: ["elasticsearch1.linuxtechi.local:9200","elasticsearch2.linuxtechi.local:9200","elasticsearch3.linuxtechi.local:9200"] +``` + +Save and exit the file + +**Note:** Replace Elasticsearch and Kibana details that suits to your environment. + +Run following metricbeat command so that metric dashboard become available in Kibana GUI. + +``` +[root@linuxtechi ~]# metricbeat setup -e -E output.elasticsearch.hosts=['elasticsearch1.linuxtechi.local:9200','elasticsearch2.linuxtechi.local:9200','elasticsearch3.linuxtechi.local:9200'] -E setup.kibana.host=kibana.linuxtechi.local:5601 +``` + +Output of above command would be something like below: + +![metricbeat-command-output-linuxserver][2] + +Above output confirms that metrics dashboard is loaded successfully in Kibana GUI. Now via metricbeat it will send the metrics data to Elastic Stack server every 10 seconds. + +Let’s start and enable metricbeat service using following commands, + +``` +[root@linuxtechi ~]# systemctl start metricbeat +[root@linuxtechi ~]# systemctl enable metricbeat +``` + +Now go to Kibana GUI and click on Dashboard from left side bar, + +[![Kibana-GUI-Dashbaord-Option][2]][3] + +In the next window we will see available metrics dashboards, search ‘**system**’ and then choose System Metrics Dashboard, + +[![Choose-Metric-Dashbaord-Kibana][2]][4] + +[![Metricbeat-System-Overview-ECS-Kibana][2]][5] + +As we can see System’s metrics data is available on the dashboard, these metrics are collected based on entries mentioned in the file “**/etc/metricbeat/modules.d/system.yml**” + +Let’s suppose we want to collect application’s metrics data as well then we have to first enable their respective modules, to enable Apache and MySQL metric module ,run the following command from client machine, + +``` +[root@linuxtechi ~]# metricbeat modules enable apache mysql +Enabled apache +Enabled mysql +[root@linuxtechi ~]# +``` + +Once we enable the modules, we can edit their yml file, + +``` +[root@linuxtechi ~]# vi /etc/metricbeat/modules.d/apache.yml +… +- module: apache + period: 10s + hosts: ["http://192.168.56.70"] +… +``` + +Change IP in host parameter that suits to your environment. + +Similarly edit mysql yml file, Change mysql root credentials that suits to your environment + +``` +[root@linuxtechi ~]# vi /etc/metricbeat/modules.d/mysql.yml +……… +- module: mysql + metricsets: + - status + - galera_status + period: 10s +hosts: ["root:root@linuxtechi(127.0.0.1:3306)/"] +……… +``` + +After making the changes restart the metricbeat service, + +``` +[root@linuxtechi ~]# systemctl restart metricbeat +``` + +Now Go to Kibana GUI and under Dashboard option, look for MySQL metrics, + +[![Metricbeat-MySQL-Overview-ECS-Kibana][2]][6] + +As we can see above, MySQL metrics data is visible, this confirms that we have successfully installed and configure metricbeat. + +That’s all from tutorial, If these steps help you to setup metricbeat then please do share your feedback and comment. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/collect-system-application-metrics-metricbeat/ + +作者:[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/setup-multinode-elastic-stack-cluster-rhel8-centos8/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Kibana-GUI-Dashbaord-Option.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Metric-Dashbaord-Kibana.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Metricbeat-System-Overview-ECS-Kibana.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Metricbeat-MySQL-Overview-ECS-Kibana.jpg diff --git a/sources/tech/20190912 An introduction to Markdown.md b/sources/tech/20190912 An introduction to Markdown.md new file mode 100644 index 0000000000..1e0a990913 --- /dev/null +++ b/sources/tech/20190912 An introduction to Markdown.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An introduction to Markdown) +[#]: via: (https://opensource.com/article/19/9/introduction-markdown) +[#]: author: (Juan Islas https://opensource.com/users/xislashttps://opensource.com/users/mbbroberghttps://opensource.com/users/scottnesbitthttps://opensource.com/users/scottnesbitthttps://opensource.com/users/f%C3%A1bio-emilio-costahttps://opensource.com/users/don-watkinshttps://opensource.com/users/greg-phttps://opensource.com/users/marcobravohttps://opensource.com/users/alanfdosshttps://opensource.com/users/scottnesbitthttps://opensource.com/users/jamesf) + +An introduction to Markdown +====== +Write once and convert your text into multiple formats. Here's how to +get started with Markdown. +![Woman programming][1] + +For a long time, I thought all the files I saw on GitLab and GitHub with an **.md** extension were written in a file type exclusively for developers. That changed a few weeks ago when I started using Markdown. It quickly became the most important tool in my daily work. + +Markdown makes my life easier. I just need to add a few symbols to what I'm already writing and, with the help of a browser extension or an open source program, I can transform my text into a variety of commonly used formats such as ODT, email (more on that later), PDF, and EPUB. + +### What is Markdown? + +A friendly reminder from [Wikipedia][2]: + +> Markdown is a lightweight markup language with plain text formatting syntax. + +What this means to you is that by using just a few extra symbols in your text, Markdown helps you create a document with an explicit structure. When you take notes in plain text (in a notepad application, for example), there's nothing to indicate which text is meant to be bold or italic. In ordinary text, you might write a link as **** one time, then as just **example.com**, and later **go to the website (example.com)**. There's no internal consistency. + +But if you write the way Markdown prescribes, your text has internal consistency. Computers like consistency because it enables them to follow strict instructions without worrying about exceptions. + +Trust me; once you learn to use Markdown, every writing task will be, in some way, easier and better than before. So let's learn it. + +### Markdown basics + +The following rules are the basics for writing in Markdown. + + 1. Create a text file with an **.md** extension (for example, **example.md**.) You can use any text editor (even a word processor like LibreOffice or Microsoft Word), as long as you remember to save it as a _text_ file. + + + +![Names of Markdown files][3] + + 2. Write whatever you want, just as you usually do: + + +``` +Lorem ipsum + +Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +De Finibus Bonorum et Malorum + +Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. +Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. + +  Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. +``` + + 3. Make sure to place an empty line between paragraphs. That might feel unnatural if you're used to writing business letters or traditional prose, where paragraphs have only one new line and maybe even an indentation before the first word. For Markdown, an empty line (some word processors mark this with **¶**, called a Pilcrow symbol) guarantees a new paragraph is created when you convert it to another format like HTML. + + 4. Designate titles and subtitles. For the document's title, add a pound or hash (**#**) symbol and a space before the text (e.g., **# Lorem ipsum**). The first subtitle level uses two (**## De Finibus Bonorum et Malorum**), the next level gets three (**### Third Subtitle**), and so on. Note that there is a space between the pound sign and the first word. + + +``` +# Lorem ipsum + +Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +## De Finibus Bonorum et Malorum + +Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. +Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. + +  Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. +``` + + 5. If you want **bold** letters, just place the letters between two asterisks (stars) with no spaces: ****This will be in bold****. + + + + +![Bold text in Markdown][4] + + 6. For _italics_, put the text between underline symbols with no spaces: **_I want this text to be in italics_**. + + + +![Italics text in Markdown][5] + + 7. To insert a link (like [Markdown Tutorial][6]), put the text you want to link in brackets and the URL in parentheses with no spaces between them: +**[Markdown Tutorial]()**. + + + +![Hyperlinks in Markdown][7] + + 8. Blockquotes are written with a greater-than (**>**) symbol and a space before the text you want to quote: **> A famous quote**. + + + +![Blockquote text in Markdown][8] + +### Markdown tutorials and tip sheets + +These tips will get you started writing in Markdown, but it has a lot more functions than just bold and italics and links. The best way to learn Markdown is to use it, but I recommend investing 15 minutes stepping through the simple [Markdown Tutorial][6] to practice these rules and learn a couple more. + +Because modern Markdown is an amalgamation of many different interpretations of the idea of structured text, the [CommonMark][9] project defines a spec with a rigid set of rules to bring clarity to Markdown. It might be helpful to keep a [CommonMark-compliant cheatsheet][10] on hand when writing. + +### What you can do with Markdown + +Markdown lets you write anything you want—once—and transform it into almost any kind of format you want to use. The following examples show how to turn simple text written in MD into different formats. You don't need multiple formats of your text—you can start from a single source and then… rule the world! + + 1. **Simple note-taking:** You can write your notes in Markdown and, the moment you save them, the open source note application [Turtl][11] interprets your text file and shows you the formatted result. You can have your notes anywhere! + + + +![Turtl application][12] + + 2. **PDF files:** With the [Pandoc][13] application, you can convert your Markdown into a PDF with one simple command: **pandoc <file.md> -o <file.pdf>**. + + + +![Markdown text converted to PDF with Pandoc][14] + + 3. **Email:** You can also convert Markdown text into an HTML-formatted email by installing the browser extension [Markdown Here][15]. To use it, just select your Markdown text, use Markdown Here to translate it into HTML, and send your message using your favorite email client. + + + +![Markdown text converted to email with Markdown Here][16] + +### Start using it + +You don't need a special application to use Markdown—you just need a text editor and the tips above. It's compatible with how you already write; all you need to do is use it, so give it a try. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/introduction-markdown + +作者:[Juan Islas][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/xislashttps://opensource.com/users/mbbroberghttps://opensource.com/users/scottnesbitthttps://opensource.com/users/scottnesbitthttps://opensource.com/users/f%C3%A1bio-emilio-costahttps://opensource.com/users/don-watkinshttps://opensource.com/users/greg-phttps://opensource.com/users/marcobravohttps://opensource.com/users/alanfdosshttps://opensource.com/users/scottnesbitthttps://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: https://en.wikipedia.org/wiki/Markdown +[3]: https://opensource.com/sites/default/files/uploads/markdown_names_md-1.png (Names of Markdown files) +[4]: https://opensource.com/sites/default/files/uploads/markdown_bold.png (Bold text in Markdown) +[5]: https://opensource.com/sites/default/files/uploads/markdown_italic.png (Italics text in Markdown) +[6]: https://www.markdowntutorial.com/ +[7]: https://opensource.com/sites/default/files/uploads/markdown_link.png (Hyperlinks in Markdown) +[8]: https://opensource.com/sites/default/files/uploads/markdown_blockquote.png (Blockquote text in Markdown) +[9]: https://commonmark.org/help/ +[10]: https://opensource.com/downloads/cheat-sheet-markdown +[11]: https://turtlapp.com/ +[12]: https://opensource.com/sites/default/files/uploads/markdown_turtl_02.png (Turtl application) +[13]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[14]: https://opensource.com/sites/default/files/uploads/markdown_pdf.png (Markdown text converted to PDF with Pandoc) +[15]: https://markdown-here.com/ +[16]: https://opensource.com/sites/default/files/uploads/markdown_mail_02.png (Markdown text converted to email with Markdown Here) diff --git a/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md new file mode 100644 index 0000000000..c373e85502 --- /dev/null +++ b/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to fix common pitfalls with the Python ORM tool SQLAlchemy) +[#]: via: (https://opensource.com/article/19/9/common-pitfalls-python) +[#]: author: (Zach Todd https://opensource.com/users/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez) + +How to fix common pitfalls with the Python ORM tool SQLAlchemy +====== +Seemingly small choices made when using SQLAlchemy can have important +implications on the object-relational mapping toolkit's performance. +![A python with a package.][1] + +Object-relational mapping ([ORM][2]) makes life easier for application developers, in no small part because it lets you interact with a database in a language you may know (such as Python) instead of raw SQL queries. [SQLAlchemy][3] is a Python ORM toolkit that provides access to SQL databases using Python. It is a mature ORM tool that adds the benefit of model relationships, a powerful query construction paradigm, easy serialization, and much more. Its ease of use, however, makes it easy to forget what is going on behind the scenes. Seemingly small choices made using SQLAlchemy can have important performance implications. + +This article explains some of the top performance issues developers encounter when using SQLAlchemy and how to fix them. + +### Retrieving an entire result set when you only need the count + +Sometimes a developer just needs a count of results, but instead of utilizing a database count, all the results are fetched and the count is done with **len** in Python. + + +``` +`count = len(User.query.filter_by(acct_active=True).all())` +``` + +Using SQLAlchemy's **count** method instead will do the count on the server side, resulting in far less data sent to the client. Calling **all()** in the prior example also results in the instantiation of model objects, which can become expensive quickly, given enough rows. + +Unless more than the count is required, just use the **count** method. + + +``` +`count = User.query.filter_by(acct_active=True).count()` +``` + +### Retrieving entire models when you only need a few columns + +In many cases, only a few columns are needed when issuing a query. Instead of returning entire model instances, SQLAlchemy can fetch only the columns you're interested in. This not only reduces the amount of data sent but also avoids the need to instantiate entire objects. Working with tuples of column data instead of models can be quite a bit faster. + + +``` +result = User.query.all() +for user in result: +    print(user.name, user.email) +``` + +Instead, select only what is needed using the **with_entities** method. + + +``` +result = User.query.with_entities(User.name, User.email).all() +for (username, email) in result: +    print(username, email) +``` + +### Updating one object at a time inside a loop + +Avoid using loops to update collections individually. While the database may execute a single update very quickly, the roundtrip time between the application and database servers will quickly add up. In general, strive for fewer queries where reasonable. + + +``` +for user in users_to_update: +  user.acct_active = True +  db.session.add(user) +``` + +Use the bulk update method instead. + + +``` +query = User.query.filter(user.id.in_([user.id for user in users_to_update])) +query.update({"acct_active": True}, synchronize_session=False) +``` + +### Triggering cascading deletes + +ORM allows easy configuration of relationships on models, but there are some subtle behaviors that can be surprising. Most databases maintain relational integrity through foreign keys and various cascade options. SQLAlchemy allows you to define models with foreign keys and cascade options, but the ORM has its own cascade logic that can preempt the database. + +Consider the following models. + + +``` +class Artist(Base): +    __tablename__ = "artist" + +    id = Column(Integer, primary_key=True) +    songs = relationship("Song", cascade="all, delete") + +class Song(Base): +    __tablename__ = "song" + +    id = Column(Integer, primary_key=True) +    artist_id = Column(Integer, ForeignKey("artist.id", ondelete="CASCADE")) +``` + +Deleting artists will cause the ORM to issue **delete** queries on the Song table, thus preventing the deletes from happening as a result of the foreign key. This behavior can become a bottleneck with complex relationships and a large number of records. + +Include the **passive_deletes** option to ensure that the database is managing relationships. Be sure, however, that your database is capable of this. SQLite, for example, does not manage foreign keys by default. + + +``` +`songs = relationship("Song", cascade="all, delete", passive_deletes=True)` +``` + +### Relying on lazy loading when eager loading should be used + +Lazy loading is the default SQLAlchemy approach to relationships. Building from the last example, this implies that loading an artist does not simultaneously load his or her songs. This is usually a good idea, but the separate queries can be wasteful if certain relationships always need to be loaded. + +Popular serialization frameworks like [Marshmallow][4] can trigger a cascade of queries if relationships are allowed to load in a lazy fashion. + +There are a few ways to control this behavior. The simplest method is through the relationship function itself. + + +``` +`songs = relationship("Song", lazy="joined", cascade="all, delete")` +``` + +This will cause a left join to be added to any query for artists, and as a result, the **songs** collection will be immediately available. Although more data is returned to the client, there are potentially far fewer roundtrips. + +SQLAlchemy offers finer-grained control for situations where such a blanket approach can't be taken. The **joinedload()** function can be used to toggle joined loading on a per-query basis. + + +``` +from sqlalchemy.orm import joinedload + +artists = Artist.query.options(joinedload(Artist.songs)) +print(artists.songs) # Does not incur a roundtrip to load +``` + +### Using the ORM for a bulk record import + +The overhead of constructing full model instances becomes a major bottleneck when importing thousands of records. Imagine, for example, loading thousands of song records from a file where each song has first been converted to a dictionary. + + +``` +for song in songs: +    db.session.add(Song(**song)) +``` + +Instead, bypass the ORM and use just the parameter binding functionality of core SQLAlchemy. + + +``` +batch = [] +insert_stmt = Song.__table__.insert() +for song in songs: +    if len(batch) > 1000: +       db.session.execute(insert_stmt, batch) +       batch.clear() +    batch.append(song) +if batch: +    db.session.execute(insert_stmt, batch) +``` + +Keep in mind that this method naturally skips any client-side ORM logic you might depend on, such as Python-based column defaults. While this method is faster than loading objects as full model instances, your database may have bulk loading methods that are faster. PostgreSQL, for example, has the **COPY** command that offers perhaps the best performance for loading large numbers of records. + +### Calling commit or flush prematurely + +There are many occasions when you need to associate a child record to its parent, or vice versa. One obvious way of doing this is to flush the session so that the record in question will be assigned an ID. + + +``` +artist = Artist(name="Bob Dylan") +song = Song(title="Mr. Tambourine Man") + +db.session.add(artist) +db.session.flush() + +song.artist_id = artist.id +``` + +Committing or flushing more than once per request is usually unnecessary and undesirable. A database flush involves forcing disk writes on the database server, and in most circumstances, the client will block until the server can acknowledge that the data has been written. + +SQLAlchemy can track relationships and manage keys behind the scenes. + + +``` +artist = Artist(name="Bob Dylan") +song = Song(title="Mr. Tambourine Man") + +artist.songs.append(song) +``` + +### Wrapping up + +I hope this list of common pitfalls can help you avoid these issues and keep your application running smoothly. As always, when diagnosing a performance problem, measurement is key. Most databases offer performance diagnostics that can help you pinpoint issues, such as the PostgreSQL **pg_stat_statements** module. + +* * * + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/common-pitfalls-python + +作者:[Zach Todd][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/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_snake_file_box.jpg?itok=UuDVFLX- (A python with a package.) +[2]: https://en.wikipedia.org/wiki/Object-relational_mapping +[3]: https://www.sqlalchemy.org/ +[4]: https://marshmallow.readthedocs.io/en/stable/ diff --git a/sources/tech/20190912 New zine- HTTP- Learn your browser-s language.md b/sources/tech/20190912 New zine- HTTP- Learn your browser-s language.md new file mode 100644 index 0000000000..85e3a6428a --- /dev/null +++ b/sources/tech/20190912 New zine- HTTP- Learn your browser-s language.md @@ -0,0 +1,197 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New zine: HTTP: Learn your browser's language!) +[#]: via: (https://jvns.ca/blog/2019/09/12/new-zine-on-http/) +[#]: author: (Julia Evans https://jvns.ca/) + +New zine: HTTP: Learn your browser's language! +====== + +Hello! I’ve released a new zine! It’s called “HTTP: Learn your browsers language!” + +You can get it for $12 at . If you buy it, you’ll get a PDF that you can either read on your computer or print out. + +Here’s the cover and table of contents: + +[![][1]][2] + +### why http? + +I got the idea for this zine from talking to [Marco Rogers][3] – he mentioned that he thought that new web developers / mobile developers would really benefit from understanding the fundamentals of HTTP better, I thought “OOH I LOVE TALKING ABOUT HTTP”, wrote a few pages about HTTP, saw they were helping people, and decided to write a whole zine about HTTP. + +HTTP is important to understand because it runs the entire web – if you understand how HTTP requests and responses work, then it makes it WAY EASIER to debug why your web application isn’t working properly. Caching, cookies, and a lot of web security are implemented using HTTP headers, so if you don’t understand HTTP headers those things seem kind of like impenetrable magic. But actually the HTTP protocol is fundamentally pretty simple – there are a lot of complicated details but the basics are pretty easy to understand. + +So the goal of this zine is to teach you the basics so you can easily look up and understand the details when you need them. + +### what it looks like printed out + +All of my zines are best printed out (though you get a PDF you can read on your computer too!), so here are a couple of pictures of what it looks like when printed. I always ask my illustrator to make both a black and white version and a colour version of the cover so that it looks great when printed on a black and white printer. + +[![][4]][2] + +(if you click on that “same origin policy” image, you can make it bigger) + +The zine comes with 4 print PDFs in addition to a PDF you can just read on your computer/phone: + + * letter / colour + * letter / b&w + * a4 / colour + * a4 / b&w + + + +### zines for your team + +You can also buy this zine for your team members at work to help them learn HTTP! + +I’ve been trying to get the pricing right for this for a while – I used to do it based on size of company, but that didn’t seem quite right because sometimes people would want to buy the zine for a small team at a big company. So I’ve switched to pricing based on the number of copies you want to distribute at your company. + +Here’s the link: [zines for your team!][5]. + +### the tweets + +When I started writing zines, I would just sit down, write down the things I thought were important, and be done with it. + +In the last year and a half or so I’ve taken a different approach – instead of writing everything and then releasing it, instead I write a page at a time, post the page to Twitter, and then improve it and decide what page to write next based on the questions/comments I get on Twitter. If someone replies to the tweet and asks a question that shows that what I wrote is unclear, I can improve it! (I love getting replies on twitter asking clarifiying questions!). + +Here are all the initial drafts of the pages I wrote and posted on twitter, in chronological order. Some of the pages didn’t make it into the zine at all, and I needed to do a lot of editing at the end to figure out the right order and make them all work coherently together in a zine instead of being a bunch of independent tweets. + + * Jul 1: [http status codes][6] + * Jul 2: [anatomy of a HTTP response][7] + * Jul 2: [POST requests][8] + * Jul 2: [an example POST request][9] + * Jul 28: [the same origin policy][10] + * Jul 28: [what’s HTTP?][11] + * Jul 30: [the most important HTTP request headers][12] + * Jun 30: [anatomy of a HTTP request][13] + * Aug 4: [content delivery networks][14] + * Aug 6: [caching headers][15] + * Aug 6: [how cookies work][16] + * Aug 7: [redirects][17] + * Aug 8: [45 seconds on the Accept-Language HTTP header][18] + * Aug 9: [HTTPS: HTTP + security][19] + * Aug 9: [today in 45 second video experiments: the Range header][20] + * Aug 9: [some HTTP exercises to try][21] + * Aug 10: [some security headers][22] + * Aug 12: [using HTTP APIs][23] + * Aug 13: [what’s with those headers that start with x-?][24] + * Aug 13: [important HTTP response headers][25] + * Aug 14: [HTTP request methods (part 1)][26] + * Aug 14: [HTTP request methods (part 2)][27] + * Aug 15: [how URLs work][28] + * Aug 16: [CORS][29] + * Aug 19: [why the same origin policy matters][30] + * Aug 21: [HTTP headers][31] + * Aug 24: [how to learn more about HTTP][32] + * Aug 25: [HTTP/2][33] + * Aug 27: [certificates][34] + + + +Writing zines one tweet at a time has been really fun. I think it improves the quality a lot, because I get a ton of feedback along the way that I can use to make the zine better. There are also some experimental 45 second tiny videos in that list, which are definitely not part of the zine, but which were fun to make and which I might expand on in the future. + +### examplecat.com + +One tiny easter egg in the zine: I have a lot of examples of HTTP requests, and I wasn’t sure for a long time what domain I should use for the examples. I used example.com a bunch, and google.com and twitter.com sometimes, but none of those felt quite right. + +A couple of days before publishing the zine I finally had an epiphany – my example on the cover was requesting a picture of a cat, so I registered which just has a single picture of a cat. It also has an ASCII cat if you’re browsing in your terminal. + +``` +$ curl https://examplecat.com/cat.txt -i +HTTP/2 200 +accept-ranges: bytes +cache-control: public, max-age=0, must-revalidate +content-length: 33 +content-type: text/plain; charset=UTF-8 +date: Thu, 12 Sep 2019 16:48:16 GMT +etag: "ac5affa59f554a1440043537ae973790-ssl" +strict-transport-security: max-age=31536000 +age: 5 +server: Netlify +x-nf-request-id: c5060abc-0399-4b44-94bf-c481e22c2b50-1772748 + +\ /\ + ) ( ') +( / ) + \(__)| +``` + +### more zines at wizardzines.com + +If you’re interested in the idea of programming zines and haven’t seen my zines before, I have a bunch more at . There are 6 free zines there: + + * [so you want to be a wizard][35] + * [let’s learn tcpdump!][36] + * [spying on your programs with strace][37] + * [networking! ACK!][38] + * [linux debugging tools you’ll love][39] + * [profiling and tracing with perf][40] + + + +### next zine: not sure yet! + +Some things I’m considering for the next zine: + + * debugging skills (I started writing a bunch of pages about debugging but switched gears to the HTTP zine because I got really excited about that. but debugging is my favourite thing so I’d like to get this done at some point) + * gdb (a short zine in the spirit of [let’s learn tcpdump][36]) + * relational databases (what’s up with transactions?) + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/09/12/new-zine-on-http/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/images/http-zine-cover.png +[2]: https://gum.co/http-zine +[3]: https://twitter.com/polotek +[4]: https://jvns.ca/images/http-zine-cover.jpeg +[5]: https://wizardzines.com/zines-team/ +[6]: https://twitter.com/b0rk/status/1145824140462608387 +[7]: https://twitter.com/b0rk/status/1145896193077256197 +[8]: https://twitter.com/b0rk/status/1146054159214567424 +[9]: https://twitter.com/b0rk/status/1146065212560179202 +[10]: https://twitter.com/b0rk/status/1155493682885341184 +[11]: https://twitter.com/b0rk/status/1155318552129396736 +[12]: https://twitter.com/b0rk/status/1156048630220017665 +[13]: https://twitter.com/b0rk/status/1145362860136177664 +[14]: https://twitter.com/b0rk/status/1158012032651862017 +[15]: https://twitter.com/b0rk/status/1158726129508868097 +[16]: https://twitter.com/b0rk/status/1158848054142873603 +[17]: https://twitter.com/b0rk/status/1159163613938167808 +[18]: https://twitter.com/b0rk/status/1159492669384658944 +[19]: https://twitter.com/b0rk/status/1159812119099060224 +[20]: https://twitter.com/b0rk/status/1159829608595804160 +[21]: https://twitter.com/b0rk/status/1159839824594915335 +[22]: https://twitter.com/b0rk/status/1160185182323970050 +[23]: https://twitter.com/b0rk/status/1160933788949655552 +[24]: https://twitter.com/b0rk/status/1161283690925834241 +[25]: https://twitter.com/b0rk/status/1161262574031265793 +[26]: https://twitter.com/b0rk/status/1161679906415218690 +[27]: https://twitter.com/b0rk/status/1161680137865367553 +[28]: https://twitter.com/b0rk/status/1161997141876903936 +[29]: https://twitter.com/b0rk/status/1162392625057583104 +[30]: https://twitter.com/b0rk/status/1163460967067541504 +[31]: https://twitter.com/b0rk/status/1164181027469832196 +[32]: https://twitter.com/b0rk/status/1165277002791829510 +[33]: https://twitter.com/b0rk/status/1165623594917007362 +[34]: https://twitter.com/b0rk/status/1166466933912494081 +[35]: https://wizardzines.com/zines/wizard/ +[36]: https://wizardzines.com/zines/tcpdump/ +[37]: https://wizardzines.com/zines/strace/ +[38]: https://wizardzines.com/zines/networking/ +[39]: https://wizardzines.com/zines/debugging/ +[40]: https://wizardzines.com/zines/perf/ diff --git a/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md new file mode 100644 index 0000000000..877845b87a --- /dev/null +++ b/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md @@ -0,0 +1,197 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) +[#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Configure SFTP Server with Chroot in Debian 10 +====== + +**SFTP** stands for Secure File Transfer Protocol / SSH File Transfer Protocol, it is one of the most common method which is used to transfer files securely over ssh from our local system to remote server and vice-versa. The main advantage of sftp is that we don’t need to install any additional package except ‘**openssh-server**’, in most of the Linux distributions ‘openssh-server’ package is the part of default installation. Other benefit of sftp is that we can allow user to use sftp only not ssh. + +[![Configure-sftp-debian10][1]][2] + +Recently Debian 10, Code name ‘Buster’ has been released, in this article we will demonstrate how to configure sftp with Chroot ‘Jail’ like environment in Debian 10 System. Here Chroot Jail like environment means that user’s cannot go beyond from their respective home directories or users cannot change directories from their home directories.  Following are the lab details: + + * OS = Debian 10 + * IP Address = 192.168.56.151 + + + +Let’s jump into SFTP Configuration Steps, + +### Step:1) Create a Group for sftp using groupadd command + +Open the terminal, create a group with a name “**sftp_users**” using below groupadd command, + +``` +root@linuxtechi:~# groupadd sftp_users +``` + +### Step:2) Add Users to Group ‘sftp_users’ and set permissions + +In case you want to create new user and want to add that user to ‘sftp_users’ group, then run the following command, + +**Syntax:** #  useradd -m -G sftp_users <user_name> + +Let’s suppose user name is ’Jonathan’ + +``` +root@linuxtechi:~# useradd -m -G sftp_users jonathan +``` + +set the password using following chpasswd command, + +``` +root@linuxtechi:~# echo "jonathan:" | chpasswd +``` + +In case you want to add existing users to ‘sftp_users’ group then run beneath usermod command, let’s suppose already existing user name is ‘chris’ + +``` +root@linuxtechi:~# usermod -G sftp_users chris +``` + +Now set the required permissions on Users, + +``` +root@linuxtechi:~# chown root /home/jonathan /home/chris/ +``` + +Create an upload folder in both the user’s home directory and set the correct ownership, + +``` +root@linuxtechi:~# mkdir /home/jonathan/upload +root@linuxtechi:~# mkdir /home/chris/upload +root@linuxtechi:~# chown jonathan /home/jonathan/upload +root@linuxtechi:~# chown chris /home/chris/upload +``` + +**Note:** User like Jonathan and Chris can upload files and directories to upload folder from their local systems. + +### Step:3) Edit sftp configuration file (/etc/ssh/sshd_config) + +As we have already stated that sftp operations are done over the ssh, so it’s configuration file is “**/etc/ssh/sshd_config**“, Before making any changes I would suggest first take the backup and then edit this file and add the following content, + +``` +root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org +root@linuxtechi:~# vim /etc/ssh/sshd_config +……… +#Subsystem sftp /usr/lib/openssh/sftp-server +Subsystem sftp internal-sftp + +Match Group sftp_users + X11Forwarding no + AllowTcpForwarding no + ChrootDirectory %h + ForceCommand internal-sftp +………… +``` + +Save & exit the file. + +To make above changes into the affect, restart ssh service using following systemctl command + +``` +root@linuxtechi:~# systemctl restart sshd +``` + +In above ‘sshd_config’ file we have commented out the line which starts with “Subsystem” and added new entry “Subsystem       sftp    internal-sftp” and new lines like, + +“**Match Group sftp_users”**  –> It means if a user is a part of ‘sftp_users’ group then apply rules which are mentioned below to this entry. + +“**ChrootDierctory %h**” –> It means users can only change directories within their respective home directories, they cannot go beyond their home directories, or in other words we can say users are not permitted to change directories, they will get jai like environment within their directories and can’t access any other user’s and system’s directories. + +“**ForceCommand internal-sftp**” –> It means users are limited to sftp command only. + +### Step:4) Test and Verify sftp + +Login to any other Linux system which is on the same network of your sftp server and then try to ssh sftp server via the users that we have mapped in ‘sftp_users’ group. + +``` +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# +``` + +Above confirms that users are not allowed to SSH , now try sftp using following commands, + +``` +[root@linuxtechi ~]# sftp root@linuxtechi +root@linuxtechi's password: +Connected to 192.168.56.151. +sftp> ls -l +drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs +-rw-r--r-- 1 root 1001 155 Sep 14 07:52 devops-actions.txt +drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload +``` + +Let’s try to download a file using sftp ‘**get**‘ command + +``` +sftp> get devops-actions.txt +Fetching /devops-actions.txt to devops-actions.txt +/devops-actions.txt 100% 155 0.2KB/s 00:00 +sftp> +sftp> cd /etc +Couldn't stat remote file: No such file or directory +sftp> cd /root +Couldn't stat remote file: No such file or directory +sftp> +``` + +Above output confirms that we are able to download file from our sftp server to local machine and apart from this we have also tested that users cannot change directories. + +Let’s try to upload a file under “**upload**” folder, + +``` +sftp> cd upload/ +sftp> put metricbeat-7.3.1-amd64.deb +Uploading metricbeat-7.3.1-amd64.deb to /upload/metricbeat-7.3.1-amd64.deb +metricbeat-7.3.1-amd64.deb 100% 38MB 38.4MB/s 00:01 +sftp> ls -l +-rw-r--r-- 1 1001 1002 40275654 Sep 14 09:18 metricbeat-7.3.1-amd64.deb +sftp> +``` + +This confirms that we have successfully uploaded a file from our local system to sftp server. + +Now test the SFTP server with winscp tool, enter the sftp server ip address along user’s credentials, + +[![Winscp-sftp-debian10][1]][3] + +Click on Login and then try to download and upload files + +[![Download-file-winscp-debian10-sftp][1]][4] + +Now try to upload files in upload folder, + +[![Upload-File-using-winscp-Debian10-sftp][1]][5] + +Above window confirms that uploading is also working fine, that’s all from this article. If these steps help you to configure SFTP server with chroot environment in Debian 10 then please do share your feedback and comments. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ + +作者:[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]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-sftp-debian10.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Winscp-sftp-debian10.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Download-file-winscp-debian10-sftp.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Upload-File-using-winscp-Debian10-sftp.jpg diff --git a/sources/tech/20190916 Constraint programming by example.md b/sources/tech/20190916 Constraint programming by example.md new file mode 100644 index 0000000000..c434913c5e --- /dev/null +++ b/sources/tech/20190916 Constraint programming by example.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Constraint programming by example) +[#]: via: (https://opensource.com/article/19/9/constraint-programming-example) +[#]: author: (Oleksii Tsvietnov https://opensource.com/users/oleksii-tsvietnovhttps://opensource.com/users/oleksii-tsvietnov) + +Constraint programming by example +====== +Understand constraint programming with an example application that +converts a character's case and ASCII codes. +![Math formulas in green writing][1] + +There are many different ways to solve problems in computing. You might "brute force" your way to a solution by calculating as many possibilities as you can, or you might take a procedural approach and carefully establish the known factors that influence the correct answer. In [constraint programming][2], a problem is viewed as a series of limitations on what could possibly be a valid solution. This paradigm can be applied to effectively solve a group of problems that can be translated to variables and constraints or represented as a mathematic equation. In this way, it is related to the Constraint Satisfaction Problem ([CSP][3]). + +Using a declarative programming style, it describes a general model with certain properties. In contrast to the imperative style, it doesn't tell _how_ to achieve something, but rather _what_ to achieve. Instead of defining a set of instructions with only one obvious way to compute values, constraint programming declares relationships between variables within constraints. A final model makes it possible to compute the values of variables regardless of direction or changes. Thus, any change in the value of one variable affects the whole system (i.e., all other variables), and to satisfy defined constraints, it leads to recomputing the other values. + +As an example, let's take Pythagoras' theorem: **a² + b² = c²**. The _constraint_ is represented by this equation, which has three _variables_ (a, b, and c), and each has a _domain_ (non-negative). Using the imperative programming style, to compute any of the variables if we have the other two, we would need to create three different functions (because each variable is computed by a different equation): + + * c = √(a² + b²) + * a = √(c² - b²) + * b = √(c² - a²) + + + +These functions satisfy the main constraint, and to check domains, each function should validate the input. Moreover, at least one more function would be needed for choosing an appropriate function according to the provided variables. This is one of the possible solutions: + + +``` +def pythagoras(*, a=None, b=None, c=None): +    ''' Computes a side of a right triangle ''' + +    # Validate +    if len([i for i in (a, b, c) if i is None or i <= 0]) != 1: +        raise SystemExit("ERROR: you need to define any of two non-negative variables") + +    # Compute +    if a is None: +        return (c**2 - b**2)**0.5 +    elif b is None: +        return (c**2 - a**2)**0.5 +    else: +        return (a**2 + b**2)**0.5 +``` + +To see the difference with the constraint programming approach, I'll show an example of a "problem" with four variables and a constraint that is not represented by a straight mathematic equation. This is a converter that can change characters' cases (lower-case to/from capital/upper-case) and return the ASCII codes for each. Hence, at any time, the converter is aware of all four values and reacts immediately to any changes. The idea of creating this example was fully inspired by John DeNero's [Fahrenheit-Celsius converter][4]. + +Here is a diagram of a constraint system: + +![Constraint system model][5] + +The represented "problem" is translated into a constraint system that consists of nodes (constraints) and connectors (variables). Connectors provide an interface for getting and setting values. They also check the variables' domains. When one value changes, that particular connector notifies all its connected nodes about the change. Nodes, in turn, satisfy constraints, calculate new values, and propagate them to other connectors across the system by "asking" them to set a new value. Propagation is done using the message-passing technique that means connectors and nodes get messages (synchronously) and react accordingly. For instance, if the system gets the **A** letter on the "capital letter" connector, the other three connectors provide an appropriate result according to the defined constraint on the nodes: 97, a, and 65. It's not allowed to set any other lower-case letters (e.g., b) on that connector because each connector has its own domain. + +When all connectors are linked to nodes, which are defined by constraints, the system is fully set and ready to get values on any of four connectors. Once it's set, the system automatically calculates and sets values on the rest of the connectors. There is no need to check what variable was set and which functions should be called, as is required in the imperative approach—that is relatively easy to achieve with a few variables but gets interesting in case of tens or more. + +### How it works + +The full source code is available in my [GitHub repo][6]. I'll dig a little bit into the details to explain how the system is built. + +First, define the connectors by giving them names and setting domains as a function of one argument: + + +``` +import constraint_programming as cp + +small_ascii = cp.connector('Small Ascii', lambda x: x >= 97 and x <= 122) +small_letter = cp.connector('Small Letter', lambda x: x >= 'a' and x <= 'z') +capital_ascii = cp.connector('Capital Ascii', lambda x: x >= 65 and x <= 90) +capital_letter = cp.connector('Capital Letter', lambda x: x >= 'A' and x <= 'Z') +``` + +Second, link these connectors to nodes. There are two types: _code_ (translates letters back and forth to ASCII codes) and _aA_ (translates small letters to capital and back): + + +``` +code(small_letter, small_ascii) +code(capital_letter, capital_ascii) +aA(small_letter, capital_letter) +``` + +These two nodes differ in which functions should be called, but they are derived from a general constraint function: + + +``` +def code(conn1, conn2): +    return cp.constraint(conn1, conn2, ord, chr) + +def aA(conn1, conn2): +    return cp.constraint(conn1, conn2, str.upper, str.lower) +``` + +Each node has only two connectors. If there is an update on a first connector, then a first function is called to calculate the value of another connector (variable). The same happens if a second connector's value changes. For example, if the _code_ node gets **A** on the **conn1** connector, then the function **ord** will be used to get its ASCII code. And, the other way around, if the _aA_ node gets **A** on the **conn2** connector, then it needs to use the **str.lower** function to get the correct small letter on the **conn1**. Every node is responsible for computing new values and "sending" a message to another connector that there is a new value to set. This message is conveyed with the name of a node that is asking to set a new value and also a new value. + + +``` +def set_value(src_constr, value): +    if (not domain is None) and (not domain(value)): +        raise ValueOutOfDomain(link, value) +    link['value'] = value +    for constraint in constraints: +        if constraint is not src_constr: +            constraint['update'](link) +``` + +When a connector receives the **set** message, it runs the **set_value** function to check a domain, sets a new value, and sends the "update" message to another node. It is just a notification that the value on that connector has changed. + + +``` +def update(src_conn): +    if src_conn is conn1: +        conn2['set'](node, constr1(conn1['value'])) +    else: +        conn1['set'](node, constr2(conn2['value'])) +``` + +Then, the notified node requests this new value on the connector, computes a new value for another connector, and so on until the whole system changes. That's how the propagation works. + +But how does the message passing happen? It is implemented as accessing keys of dictionaries. Both functions (connector and constraint) return a _dispatch dictionary_. Such a dictionary contains _messages_ as keys and _closures_ as values. By accessing a key, let's say, **set**, a dictionary returns the function **set_value** (closure) that has access to all local names of the "connector" function. + + +``` +# A dispatch dictionary +link = { 'name': name, +         'value': None, +         'connect': connect, +         'set': set_value, +         'constraints': get_constraints } + +return link +``` + +Having a dictionary as a return value makes it possible to create multiple closures (functions) with access to the same local state to operate on. Then these closures are callable by using keys as a type of message. + +### Why use Constraint programming? + +Constraint programming can give you a new perspective to difficult problems. It's not something you can use in every situation, but it may well open new opportunities for solutions in certain situations. If you find yourself up against an equation that seems difficult to reliably solve in code, try looking at it from a different angle. If the angle that seems to work best is constraint programming, you now have an example of how it can be implemented. + +* * * + +_This article was originally published on [Oleksii Tsvietnov's blog][7] and is reprinted with his permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/constraint-programming-example + +作者:[Oleksii Tsvietnov][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/oleksii-tsvietnovhttps://opensource.com/users/oleksii-tsvietnov +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/edu_math_formulas.png?itok=B59mYTG3 (Math formulas in green writing) +[2]: https://en.wikipedia.org/wiki/Constraint_programming +[3]: https://vorakl.com/articles/csp/ +[4]: https://composingprograms.com/pages/24-mutable-data.html#propagating-constraints +[5]: https://opensource.com/sites/default/files/uploads/constraint-system.png (Constraint system model) +[6]: https://github.com/vorakl/composingprograms.com/tree/master/char_converter +[7]: https://vorakl.com/articles/char-converter/ diff --git a/sources/tech/20190916 Copying large files with Rsync, and some misconceptions.md b/sources/tech/20190916 Copying large files with Rsync, and some misconceptions.md new file mode 100644 index 0000000000..ae314e2a2e --- /dev/null +++ b/sources/tech/20190916 Copying large files with Rsync, and some misconceptions.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Copying large files with Rsync, and some misconceptions) +[#]: via: (https://fedoramagazine.org/copying-large-files-with-rsync-and-some-misconceptions/) +[#]: author: (Daniel Leite de Abreu https://fedoramagazine.org/author/dabreu/) + +Copying large files with Rsync, and some misconceptions +====== + +![][1] + +There is a notion that a lot of people working in the IT industry often copy and paste from internet howtos. We all do it, and the copy-and-paste itself is not a problem. The problem is when we run things without understanding them. + +Some years ago, a friend who used to work on my team needed to copy virtual machine templates from site A to site B. They could not understand why the file they copied was 10GB on site A but but it became 100GB on-site B. + +The friend believed that _rsync_ is a magic tool that should just “sync” the file as it is. However, what most of us forget is to understand what _rsync_ really is, and how is it used, and the most important in my opinion is, where it come from. This article provides some further information about rsync, and an explanation of what happened in that story. + +### About rsync + +_rsync_ is a tool was created by Andrew Tridgell and Paul Mackerras who were motivated by the following problem: + +Imagine you have two files, _file_A_ and _file_B_. You wish to update _file_B_ to be the same as _file_A_. The obvious method is to copy _file_A_ onto _file_B_. + +Now imagine that the two files are on two different servers connected by a slow communications link, for example, a dial-up IP link. If _file_A_ is large, copying it onto _file_B_ will be slow, and sometimes not even possible. To make it more efficient, you could compress _file_A_ before sending it, but that would usually only gain a factor of 2 to 4. + +Now assume that _file_A_ and _file_B_ are quite similar, and to speed things up, you take advantage of this similarity. A common method is to send just the differences between _file_A_ and _file_B_ down the link and then use such list of differences to reconstruct the file on the remote end. + +The problem is that the normal methods for creating a set of differences between two files rely on being able to read both files. Thus they require that both files are available beforehand at one end of the link. If they are not both available on the same machine, these algorithms cannot be used. (Once you had copied the file over, you don’t need the differences). This is the problem that _rsync_ addresses. + +The _rsync_ algorithm efficiently computes which parts of a source file match parts of an existing destination file. Matching parts then do not need to be sent across the link; all that is needed is a reference to the part of the destination file. Only parts of the source file which are not matching need to be sent over. + +The receiver can then construct a copy of the source file using the references to parts of the existing destination file and the original material. + +Additionally, the data sent to the receiver can be compressed using any of a range of common compression algorithms for further speed improvements. + +The rsync algorithm addresses this problem in a lovely way as we all might know. + +After this introduction on _rsync_, Back to the story! + +### Problem 1: Thin provisioning + +There were two things that would help the friend understand what was going on. + +The problem with the file getting significantly bigger on the other size was caused by Thin Provisioning (TP) being enabled on the source system — a method of optimizing the efficiency of available space in Storage Area Networks (SAN) or Network Attached Storages (NAS). + +The source file was only 10GB because of TP being enabled, and when transferred over using _rsync_ without any additional configuration, the target destination was receiving the full 100GB of size. _rsync_ could not do the magic automatically, it had to be configured. + +The Flag that does this work is _-S_ or _–sparse_ and it tells _rsync_ to handle sparse files efficiently. And it will do what it says! It will only send the sparse data so source and destination will have a 10GB file. + +### Problem 2: Updating files + +The second problem appeared when sending over an updated file. The destination was now receiving just the 10GB, but the whole file (containing the virtual disk) was always transferred. Even when a single configuration file was changed on that virtual disk. In other words, only a small portion of the file changed. + +The command used for this transfer was: + +``` +rsync -avS vmdk_file syncuser@host1:/destination +``` + +Again, understanding how _rsync_ works would help with this problem as well. + +The above is the biggest misconception about rsync. Many of us think _rsync_ will simply send the delta updates of the files, and that it will automatically update only what needs to be updated. But this is not the default behaviour of _rsync_. + +As the man page says, the default behaviour of _rsync_ is to create a new copy of the file in the destination and to move it into the right place when the transfer is completed. + +To change this default behaviour of _rsync_, you have to set the following flags and then rsync will send only the deltas: + +``` +--inplace update destination files in-place +--partial keep partially transferred files +--append append data onto shorter files +--progress show progress during transfer +``` + +So the full command that would do exactly what the friend wanted is: + +``` +rsync -av --partial --inplace --append --progress vmdk_file syncuser@host1:/destination +``` + +Note that the sparse flag _-S_ had to be removed, for two reasons. The first is that you can not use _–sparse_ and _–inplace_ together when sending a file over the wire. And second, when you once sent a file over with _–sparse_, you can’t updated with _–inplace_ anymore. Note that versions of rsync older than 3.1.3 will reject the combination of _–sparse_ and _–inplace_. + +So even when the friend ended up copying 100GB over the wire, that only had to happen once. All the following updates were only copying the difference, making the copy to be extremely efficient. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/copying-large-files-with-rsync-and-some-misconceptions/ + +作者:[Daniel Leite de Abreu][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/dabreu/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/rsync-816x345.jpg diff --git a/sources/tech/20190916 How to freeze and lock your Linux system (and why you would want to).md b/sources/tech/20190916 How to freeze and lock your Linux system (and why you would want to).md new file mode 100644 index 0000000000..886974a8c0 --- /dev/null +++ b/sources/tech/20190916 How to freeze and lock your Linux system (and why you would want to).md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to freeze and lock your Linux system (and why you would want to)) +[#]: via: (https://www.networkworld.com/article/3438818/how-to-freeze-and-lock-your-linux-system-and-why-you-would-want-to.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to freeze and lock your Linux system (and why you would want to) +====== +What it means to freeze a terminal window and lock a screen -- and how to manage these activities on your Linux system. +Sandra Henry-Stocker + +How you freeze and "thaw out" a screen on a Linux system depends a lot on what you mean by these terms. Sometimes “freezing a screen” might mean freezing a terminal window so that activity within that window comes to a halt. Sometimes it means locking your screen so that no one can walk up to your system when you're fetching another cup of coffee and type commands on your behalf. + +In this post, we'll examine how you can use and control these actions. + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][1] ]** + +### How to freeze a terminal window on Linux + +You can freeze a terminal window on a Linux system by typing **Ctrl+S** (hold control key and press "s"). Think of the "s" as meaning "start the freeze". If you continue typing commands after doing this, you won't see the commands you type or the output you would expect to see. In fact, the commands will pile up in a queue and will be run only when you reverse the freeze by typing **Ctrl+Q**. Think of this as "quit the freeze". + +One easy way to view how this works is to use the date command and then type **Ctrl+S**. Then type the date command again and wait a few minutes before typing **Ctrl+Q**. You'll see something like this: + +``` +$ date +Mon 16 Sep 2019 06:47:34 PM EDT +$ date +Mon 16 Sep 2019 06:49:49 PM EDT +``` + +The gap between the two times shown will indicate that the second date command wasn't run until you unfroze your window. + +Terminal windows can be frozen and unfrozen whether you're sitting at the computer screen or running remotely using a tool such as PuTTY. + +And here's a little trick that can come in handy. If you see that a terminal window appears to be inactive, one possibility is that you or someone else inadvertently typed **Ctrl+S**. In any case, entering **Ctrl+Q** just in case this resolves the problem is not a bad idea. + +### How to lock your screen + +To lock your screen before you leave your desk, either **Ctrl+Alt+L** or **Super+L** (i.e., holding down the Windows key and pressing L) should work. Once your screen is locked, you will have to enter your password to log back in. + +### Automatic screen locking on Linux systems + +While best practice suggests that you lock your screen whenever you are about to leave your desk, Linux systems usually automatically lock after a period of no activity. The timing for "blanking" a screen (making it go dark) and actually locking the screen (requiring a login to use it again) depend on settings that you can set to your personal preferences. + +To change how long it takes for your screen to go dark when using GNOME screensaver, open your settings window and select **Power** and then **Blank screen**. You can choose times between 1 and 15 minutes or never. To select how long after the blanking the screen locks, go to settings, select **Privacy** and then **Blank screen.** Settings should include 1, 2, 3, 5 and 30 minutes or one hour. + +### How to lock your screen from the command line + +If you are using Gnome screensaver, you can also lock the screen from the command line using this command: + +``` +gnome-screensaver-command -l +``` + +That's a lowercase L for "lock". + +### How to check your lockscreen state + +You can also use the gnome screensaver command to check whether your screen is locked,. With the **\--query** option, the command tells you whether screen is currently locked (i.e., active). With the --time option, it tells you how long the lock has been in effect. Here's an sample sctipt: + +``` +#!/bin/bash + +gnome-screensaver-command --query +gnome-screensaver-command --time +``` + +Running the script will show output like this: + +``` +$ ./check_lockscreen +The screensaver is active +The screensaver has been active for 1013 seconds. +``` + +#### Wrap-up + +Freezing your terminal window is easy if you remember the proper control sequences. For screen locking, how well it works depends on the controls you put in place for yourself or whether you're comfortable working with the defaults. + +**[ Also see: [Invaluable tips and tricks for troubleshooting Linux][2] ]** + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438818/how-to-freeze-and-lock-your-linux-system-and-why-you-would-want-to.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.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[2]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190916 How to start developing with .NET.md b/sources/tech/20190916 How to start developing with .NET.md new file mode 100644 index 0000000000..8dae5addd0 --- /dev/null +++ b/sources/tech/20190916 How to start developing with .NET.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to start developing with .NET) +[#]: via: (https://opensource.com/article/19/9/getting-started-net) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/alex-bunardzichttps://opensource.com/users/alex-bunardzic) + +How to start developing with .NET +====== +Learn the basics to get up and running with the .NET development +platform. +![Coding on a computer][1] + +The .NET framework was released in 2000 by Microsoft. An open source implementation of the platform, [Mono][2], was the center of controversy in the early 2000s because Microsoft held several patents for .NET technology and could have used those patents to end Mono implementations. Fortunately, in 2014, Microsoft declared that the .NET development platform would be open source under the MIT license from then on, and in 2016, Microsoft purchased Xamarin, the company that produces Mono. + +Both .NET and Mono have grown into cross-platform programming environments for C#, F#, GTK#, Visual Basic, Vala, and more. Applications created with .NET and Mono have been delivered to Linux, BSD, Windows, MacOS, Android, and even some gaming consoles. You can use either .NET or Mono to develop .NET applications. Both are open source, and both have active and vibrant communities. This article focuses on getting started with Microsoft's implementation of the .NET environment. + +### How to install .NET + +The .NET downloads are divided into packages: one containing just a .NET runtime, and the other a .NET software development kit (SDK) containing the .NET Core and runtime. Depending on your platform, there may be several variants of even these packages, accounting for architecture and OS version. To start developing with .NET, you must [install the SDK][3]. This gives you the [dotnet][4] terminal or PowerShell command, which you can use to create and build projects. + +#### Linux + +To install .NET on Linux, first, add the Microsoft Linux software repository to your computer. + +On Fedora: + + +``` +$ sudo rpm --import +$ sudo wget -q -O /etc/yum.repos.d/microsoft-prod.repo +``` + +On Ubuntu: + + +``` +$ wget -q -O packages-microsoft-prod.deb +$ sudo dpkg -i packages-microsoft-prod.deb +``` + +Next, install the SDK using your package manager, replacing **<X.Y>** with the current version of the .NET release: + +On Fedora: + + +``` +`$ sudo dnf install dotnet-sdk-` +``` + +On Ubuntu: + + +``` +$ sudo apt install apt-transport-https +$ sudo apt update +$ sudo apt install dotnet-sdk-<X.Y> +``` + +Once all the packages are downloaded and installed, confirm the installation by opening a terminal and typing: + + +``` +$ dotnet --version +X.Y.Z +``` + +#### Windows + +If you're on Microsoft Windows, you probably already have the .NET runtime installed. However, to develop .NET applications, you must also install the .NET Core SDK. + +First, [download the installer][3]. To keep your options open, download .NET Core for cross-platform development (the .NET Framework is Windows-only). Once the **.exe** file is downloaded, double-click it to launch the installation wizard, and click through the two-step install process: accept the license and allow the install to proceed. + +![Installing dotnet on Windows][5] + +Afterward, open PowerShell from your Application menu in the lower-left corner. In PowerShell, type a test command: + + +``` +`PS C:\Users\osdc> dotnet` +``` + +If you see information about a dotnet installation, .NET has been installed correctly. + +#### MacOS + +If you're on an Apple Mac, [download the Mac installer][3], which comes in the form of a **.pkg** package. Download and double-click on the **.pkg** file and click through the installer. You may need to grant permission for the installer since the package is not from the App Store. + +Once all packages are downloaded and installed, confirm the installation by opening a terminal and typing: + + +``` +$ dotnet --version +X.Y.Z +``` + +### Hello .NET + +A sample "hello world" application written in .NET is provided with the **dotnet** command. Or, more accurately, the command provides the sample application. + +First, create a project directory and the required code infrastructure using the **dotnet** command with the **new** and **console** options to create a new console-only application. Use the **-o** option to specify a project name: + + +``` +`$ dotnet new console -o hellodotnet` +``` + +This creates a directory called **hellodotnet** in your current directory. Change into your project directory and have a look around: + + +``` +$ cd hellodotnet +$ dir +hellodotnet.csproj  obj  Program.cs +``` + +The file **Program.cs** is an empty C# file containing a simple Hello World application. Open it in a text editor to view it. Microsoft's Visual Studio Code is a cross-platform, open source application built with dotnet in mind, and while it's not a bad text editor, it also collects a lot of data about its user (and grants itself permission to do so in the license applied to its binary distribution). If you want to try out Visual Studio Code, consider using [VSCodium][6], a distribution of Visual Studio Code that's built from the MIT-licensed source code _without_ the telemetry (read the [documentation][7] for options to disable other forms of tracking in even this build). Alternatively, just use your existing favorite text editor or IDE. + +The boilerplate code in a new console application is: + + +``` +using System; + +namespace hellodotnet +{ +    class Program +    { +        static void Main(string[] args) +        { +            Console.WriteLine("Hello World!"); +        } +    } +} +``` + +To run the program, use the **dotnet run** command: + + +``` +$ dotnet run +Hello World! +``` + +That's the basic workflow of .NET and the **dotnet** command. The full [C# guide for .NET][8] is available, and everything there is relevant to .NET. For examples of .NET in action, follow [Alex Bunardzic][9]'s mutation testing articles here on opensource.com. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/getting-started-net + +作者:[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/alex-bunardzichttps://opensource.com/users/alex-bunardzic +[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]: https://www.monodevelop.com/ +[3]: https://dotnet.microsoft.com/download +[4]: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet?tabs=netcore21 +[5]: https://opensource.com/sites/default/files/uploads/dotnet-windows-install.jpg (Installing dotnet on Windows) +[6]: https://vscodium.com/ +[7]: https://github.com/VSCodium/vscodium/blob/master/DOCS.md +[8]: https://docs.microsoft.com/en-us/dotnet/csharp/tutorials/intro-to-csharp/ +[9]: https://opensource.com/users/alex-bunardzic (View user profile.) diff --git a/sources/tech/20190916 Linux commands to display your hardware information.md b/sources/tech/20190916 Linux commands to display your hardware information.md new file mode 100644 index 0000000000..f0a13905e5 --- /dev/null +++ b/sources/tech/20190916 Linux commands to display your hardware information.md @@ -0,0 +1,417 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux commands to display your hardware information) +[#]: via: (https://opensource.com/article/19/9/linux-commands-hardware-information) +[#]: author: (Howard Fosdick https://opensource.com/users/howtechhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/seth) + +Linux commands to display your hardware information +====== +Get the details on what's inside your computer from the command line. +![computer screen ][1] + +There are many reasons you might need to find out details about your computer hardware. For example, if you need help fixing something and post a plea in an online forum, people will immediately ask you for specifics about your computer. Or, if you want to upgrade your computer, you'll need to know what you have and what you can have. You need to interrogate your computer to discover its specifications. + +The easiest way is to do that is with one of the standard Linux GUI programs: + + * [i-nex][2] collects hardware information and displays it in a manner similar to the popular [CPU-Z][3] under Windows. + * [HardInfo][4] displays hardware specifics and even includes a set of eight popular benchmark programs you can run to gauge your system's performance. + * [KInfoCenter][5] and [Lshw][6] also display hardware details and are available in many software repositories. + + + +Alternatively, you could open up the box and read the labels on the disks, memory, and other devices. Or you could enter the boot-time panels—the so-called UEFI or BIOS panels. Just hit [the proper program function key][7] during the boot process to access them. These two methods give you hardware details but omit software information. + +Or, you could issue a Linux line command. Wait a minute… that sounds difficult. Why would you do this? + +Sometimes it's easy to find a specific bit of information through a well-targeted line command. Perhaps you don't have a GUI program available or don't want to install one. + +Probably the main reason to use line commands is for writing scripts. Whether you employ the Linux shell or another programming language, scripting typically requires coding line commands. + +Many line commands for detecting hardware must be issued under root authority. So either switch to the root user ID, or issue the command under your regular user ID preceded by **sudo**: + + +``` +`sudo ` +``` + +and respond to the prompt for the root password. + +This article introduces many of the most useful line commands for system discovery. The quick reference chart at the end summarizes them. + +### Hardware overview + +There are several line commands that will give you a comprehensive overview of your computer's hardware. + +The **inxi** command lists details about your system, CPU, graphics, audio, networking, drives, partitions, sensors, and more. Forum participants often ask for its output when they're trying to help others solve problems. It's a standard diagnostic for problem-solving: + + +``` +`inxi -Fxz` +``` + +The **-F** flag means you'll get full output, **x** adds details, and **z** masks out personally identifying information like MAC and IP addresses. + +The **hwinfo** and **lshw** commands display much of the same information in different formats: + + +``` +`hwinfo --short` +``` + +or + + +``` +`lshw -short` +``` + +The long forms of these two commands spew out exhaustive—but hard to read—output: + + +``` +`hwinfo` +``` + +or + + +``` +`lshw` +``` + +### CPU details + +You can learn everything about your CPU through line commands. View CPU details by issuing either the **lscpu** command or its close relative **lshw**: + + +``` +`lscpu` +``` + +or + + +``` +`lshw -C cpu` +``` + +In both cases, the last few lines of output list all the CPU's capabilities. Here you can find out whether your processor supports specific features. + +With all these commands, you can reduce verbiage and narrow any answer down to a single detail by parsing the command output with the **grep** command. For example, to view only the CPU make and model: + + +``` +`lshw -C cpu | grep -i product` +``` + +To view just the CPU's speed in megahertz: + + +``` +`lscpu | grep -i mhz` +``` + +or its [BogoMips][8] power rating: + + +``` +`lscpu | grep -i bogo` +``` + +The **-i** flag on the **grep** command simply ensures your search ignores whether the output it searches is upper or lower case. + +### Memory + +Linux line commands enable you to gather all possible details about your computer's memory. You can even determine whether you can add extra memory to the computer without opening up the box. + +To list each memory stick and its capacity, issue the **dmidecode** command: + + +``` +`dmidecode -t memory | grep -i size` +``` + +For more specifics on system memory, including type, size, speed, and voltage of each RAM stick, try: + + +``` +`lshw -short -C memory` +``` + +One thing you'll surely want to know is is the maximum memory you can install on your computer: + + +``` +`dmidecode -t memory | grep -i max` +``` + +Now find out whether there are any open slots to insert additional memory sticks. You can do this without opening your computer by issuing this command: + + +``` +`lshw -short -C memory | grep -i empty` +``` + +A null response means all the memory slots are already in use. + +Determining how much video memory you have requires a pair of commands. First, list all devices with the **lspci** command and limit the output displayed to the video device you're interested in: + + +``` +`lspci | grep -i vga` +``` + +The output line that identifies the video controller will typically look something like this: + + +``` +`00:02.0 VGA compatible controller: Intel Corporation 82Q35 Express Integrated Graphics Controller (rev 02)` +``` + +Now reissue the **lspci** command, referencing the video device number as the selected device: + + +``` +`lspci -v -s 00:02.0` +``` + +The output line identified as _prefetchable_ is the amount of video RAM on your system: + + +``` +... +Memory at f0100000 (32-bit, non-prefetchable) [size=512K] +I/O ports at 1230 [size=8] +Memory at e0000000 (32-bit, prefetchable) [size=256M] +Memory at f0000000 (32-bit, non-prefetchable) [size=1M] +... +``` + +Finally, to show current memory use in megabytes, issue: + + +``` +`free -m` +``` + +This tells how much memory is free, how much is in use, the size of the swap area, and whether it's being used. For example, the output might look like this: + + +``` +              total        used        free     shared    buff/cache   available +Mem:          11891        1326        8877      212        1687       10077 +Swap:          1999           0        1999 +``` + +The **top** command gives you more detail on memory use. It shows current overall memory and CPU use and also breaks it down by process ID, user ID, and the commands being run. It displays full-screen text output: + + +``` +`top` +``` + +### Disks, filesystems, and devices + +You can easily determine whatever you wish to know about disks, partitions, filesystems, and other devices. + +To display a single line describing each disk device: + + +``` +`lshw -short -C disk` +``` + +Get details on any specific SATA disk, such as its model and serial numbers, supported modes, sector count, and more with: + + +``` +`hdparm -i /dev/sda` +``` + +Of course, you should replace **sda** with **sdb** or another device mnemonic if necessary. + +To list all disks with all their defined partitions, along with the size of each, issue: + + +``` +`lsblk` +``` + +For more detail, including the number of sectors, size, filesystem ID and type, and partition starting and ending sectors: + + +``` +`fdisk -l` +``` + +To start up Linux, you need to identify mountable partitions to the [GRUB][9] bootloader. You can find this information with the **blkid** command. It lists each partition's unique identifier (UUID) and its filesystem type (e.g., ext3 or ext4): + + +``` +`blkid` +``` + +To list the mounted filesystems, their mount points, and the space used and available for each (in megabytes): + + +``` +`df -m` +``` + +Finally, you can list details for all USB and PCI buses and devices with these commands: + + +``` +`lsusb` +``` + +or + + +``` +`lspci` +``` + +### Network + +Linux offers tons of networking line commands. Here are just a few. + +To see hardware details about your network card, issue: + + +``` +`lshw -C network` +``` + +Traditionally, the command to show network interfaces was **ifconfig**: + + +``` +`ifconfig -a` +``` + +But many people now use: + + +``` +`ip link show` +``` + +or + + +``` +`netstat -i` +``` + +In reading the output, it helps to know common network abbreviations: + +**Abbreviation** | **Meaning** +---|--- +**lo** | Loopback interface +**eth0** or **enp*** | Ethernet interface +**wlan0** | Wireless interface +**ppp0** | Point-to-Point Protocol interface (used by a dial-up modem, PPTP VPN connection, or USB modem) +**vboxnet0** or **vmnet*** | Virtual machine interface + +The asterisks in this table are wildcard characters, serving as a placeholder for whatever series of characters appear from system to system. **** + +To show your default gateway and routing tables, issue either of these commands: + + +``` +`ip route | column -t` +``` + +or + + +``` +`netstat -r` +``` + +### Software + +Let's conclude with two commands that display low-level software details. For example, what if you want to know whether you have the latest firmware installed? This command shows the UEFI or BIOS date and version: + + +``` +`dmidecode -t bios` +``` + +What is the kernel version, and is it 64-bit? And what is the network hostname? To find out, issue: + + +``` +`uname -a` +``` + +### Quick reference chart + +This chart summarizes all the commands covered in this article: + +Display info about all hardware | **inxi -Fxz**              _\--or--_ +**hwinfo --short**     _\--or--_ +**lshw  -short** +---|--- +Display all CPU info | **lscpu**                  _\--or--_ +**lshw -C cpu** +Show CPU features (e.g., PAE, SSE2) | **lshw -C cpu | grep -i capabilities** +Report whether the CPU is 32- or 64-bit | **lshw -C cpu | grep -i width** +Show current memory size and configuration | **dmidecode -t memory | grep -i size**    _\--or--_ +**lshw -short -C memory** +Show maximum memory for the hardware | **dmidecode -t memory | grep -i max** +Determine whether memory slots are available | **lshw -short -C memory | grep -i empty** +(a null answer means no slots available) +Determine the amount of video memory | **lspci | grep -i vga** +then reissue with the device number; +for example:  **lspci -v -s 00:02.0** +The VRAM is the _prefetchable_ value. +Show current memory use | **free -m**    _\--or--_ +**top** +List the disk drives | **lshw -short -C disk** +Show detailed information about a specific disk drive | **hdparm -i /dev/sda** +(replace **sda** if necessary) +List information about disks and partitions | **lsblk **     (simple)      _\--or--_ +**fdisk -l**   (detailed) +List partition IDs (UUIDs) | **blkid** +List mounted filesystems, their mount points, +and megabytes used and available for each | **df -m** +List USB devices | **lsusb** +List PCI devices | **lspci** +Show network card details | **lshw -C network** +Show network interfaces | **ifconfig -a**       _\--or--_ +**ip link show   **_\--or--_ +**netstat -i** +Display routing tables | **ip route | column -t`  `**_\--or--_ +**netstat -r** +Display UEFI/BIOS info | **dmidecode -t bios** +Show kernel version, network hostname, more | **uname -a** + +Do you have a favorite command that I overlooked? Please add a comment and share it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/linux-commands-hardware-information + +作者:[Howard Fosdick][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/howtechhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/features_solutions_command_data.png?itok=4_VQN3RK (computer screen ) +[2]: http://sourceforge.net/projects/i-nex/ +[3]: https://www.cpuid.com/softwares/cpu-z.html +[4]: http://sourceforge.net/projects/hardinfo.berlios/ +[5]: https://userbase.kde.org/KInfoCenter +[6]: http://www.binarytides.com/linux-lshw-command/ +[7]: http://www.disk-image.com/faq-bootmenu.htm +[8]: https://en.wikipedia.org/wiki/BogoMips +[9]: https://www.dedoimedo.com/computers/grub.html diff --git a/sources/tech/20190916 The Emacs Series Exploring ts.el.md b/sources/tech/20190916 The Emacs Series Exploring ts.el.md new file mode 100644 index 0000000000..06e724d4ab --- /dev/null +++ b/sources/tech/20190916 The Emacs Series Exploring ts.el.md @@ -0,0 +1,366 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Emacs Series Exploring ts.el) +[#]: via: (https://opensourceforu.com/2019/09/the-emacs-series-exploring-ts-el/) +[#]: author: (Shakthi Kannan https://opensourceforu.com/author/shakthi-kannan/) + +The Emacs Series Exploring ts.el +====== + +[![][1]][2] + +_In this article, the author reviews the ts.el date and time library for Emacs. Written by Adam Porter, ts.el is still in the development phase and has been released under the GNU General Public License v3.0._ + +The ts.el package uses intuitive names for date and time functions. It internally uses UNIX timestamps and depends on both the ‘dash’ and ‘s’ Emacs libraries. The parts of the date are computed lazily and also cached for performance. The source code is available at __. In this article, we will explore the API functions available from the ts.el library. + +**Installation** +The package does not have a tagged release yet; hence, you should download it from and add it to your Emacs load path to use it. You should also have the ‘dash’ and ‘s’ libraries installed and loaded in your Emacs environment. You can then load the library using the following command: + +``` +(require ‘ts) +``` + +**Usage** +Let us explore the various functions available to retrieve parts of the date from the ts.el library. When the examples were executed, the date was ‘Friday July 5, 2019’. The ts-dow function can be used to obtain the day of the week, as shown below: + +``` +(ts-dow (ts-now)) +5 +``` + +_ts-now_ is a Lisp construct that returns a timestamp set. It is defined in ts.el as follows: + +``` +(defsubst ts-now () +“Return `ts’ struct set to now.” +(make-ts :unix (float-time))) +``` + +The day of the week starts from Monday (1) and hence Friday has the value of 5. An abbreviated form of the day can be fetched using the _ts-day-abbr_ function. In the following example, ‘Friday’ is shortened to‘Fri’. + +``` +(ts-day-abbr (ts-now)) +"Fri" +``` + +The day of the week in full form can be obtained using the _ts-day-name_ function, as shown below: + +``` +(ts-day-name (ts-now)) +“Friday” +``` + +The twelve months from January to December are numbered from 1 to 12 respectively. Hence, for the month of July, the index number is 7. This numeric value for the month can be retrieved using the ‘ts-month’ API. For example: + +``` +(ts-month (ts-now)) +7 +``` + +If you want a three-character abbreviation for the month’s name, you can use the ts-month-abbr function as shown below: + +``` +(ts-month-abbr (ts-now)) +“Jul” +``` + +The _ts-month-name_ function can be used to obtain the full name of the month. For example: + +``` +(ts-month-name (ts-now)) +“July” +``` + +The day of the week starts from Monday and has an index 1, while Sunday has an index 7. If you need the numeric value for the day of the week, use the ts-day function as indicated below: + +``` +(ts-day (ts-now)) +5 +``` + +The _ts-year_ API returns the year. In our example, it is ‘2019’ as shown below: + +``` +(ts-year (ts-now)) +2019 +``` + +The hour, minute and seconds can be retrieved using the _ts-hour, ts-minute_ and _ts-second_ functions, respectively. Examples of these functions are given below: + +``` +(ts-hour (ts-now)) +18 + +(ts-minute (ts-now)) +19 + +(ts-second (ts-now)) +5 +``` + +The UNIX timestamps are in UTC, by default. The _ts-tz-offset_ function returns the offset from UTC. The Indian Standard Time (IST) is five-and-a-half-hours ahead of UTC and hence this function returns ‘+0530’ as shown below: + +``` +(ts-tz-offset (ts-now)) +"+0530" +``` + +The _ts-tz-abbr_ API returns an abbreviated form of the time zone. In our case, ‘IST’ is returned for the Indian Standard Time. + +``` +(ts-tz-abbr (ts-now)) +"IST" +``` + +The _ts-adjustf_ function applies the time adjustments passed to the timestamp and the _ts-format_ function formats the timestamp as a string. A couple of examples are given below: + +``` +(let ((ts (ts-now))) +(ts-adjustf ts ‘day 1) +(ts-format nil ts)) +“2019-07-06 18:23:24 +0530” + +(let ((ts (ts-now))) +(ts-adjustf ts ‘year 1 ‘month 3 ‘day 5) +(ts-format nil ts)) +“2020-10-10 18:24:07 +0530” +``` + +You can use the _ts-dec_ function to decrement the timestamp. For example: + +``` +(ts-day-name (ts-dec ‘day 1 (ts-now))) +“Thursday” +``` + +The threading macro syntax can also be used with the ts-dec function as shown below: + +``` +(->> (ts-now) (ts-dec ‘day 2) ts-day-name) +“Wednesday” +``` + +The UNIX epoch is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT). The ts-unix function returns an epoch UNIX timestamp as illustrated below: + +``` +(ts-unix (ts-adjust ‘day -2 (ts-now))) +1562158551.0 ;; Wednesday, July 3, 2019 6:25:51 PM GMT+05:30 +``` + +An hour has 3600 seconds and a day has 86400 seconds. You can compare epoch timestamps as shown in the following example: + +``` +(/ (- (ts-unix (ts-now)) +(ts-unix (ts-adjust ‘day -4 (ts-now)))) +86400) +4 +``` + +The _ts-difference_ function returns the difference between two timestamps, while the _ts-human-duration_ function returns the property list (_plist_) values of years, days, hours, minutes and seconds. For example: + +``` +(ts-human-duration +(ts-difference (ts-now) +(ts-dec ‘day 3 (ts-now)))) +(:years 0 :days 3 :hours 0 :minutes 0 :seconds 0) +``` + +A number of aliases are available for the hour, minute, second, year, month and day format string constructors. A few examples are given below: + +``` +(ts-hour (ts-now)) +18 +(ts-H (ts-now)) +18 + + +(ts-minute (ts-now)) +46 +(ts-min (ts-now)) +46 +(ts-M (ts-now)) +46 + +(ts-second (ts-now)) +16 +(ts-sec (ts-now)) +16 +(ts-S (ts-now)) +16 + +(ts-year (ts-now)) +2019 +(ts-Y (ts-now)) +2019 + +(ts-month (ts-now)) +7 +(ts-m (ts-now)) +7 + +(ts-day (ts-now)) +5 +(ts-d (ts-now)) +5 +``` + +You can parse a string into a timestamp object using the ts-parse function. For example: + +``` +(ts-format nil (ts-parse “Fri Dec 6 2019 18:48:00”)) +“2019-12-06 18:48:00 +0530” +``` + +You can also format the difference between two timestamps in a human readable format as shown in the following example: + +``` +(ts-human-format-duration +(ts-difference (ts-now) +(ts-adjust ‘day -1 ‘hour -3 ‘minute -2 ‘second -4 (ts-now)))) +“1 days, 3 hours, 2 minutes, 4 seconds” +``` + +The timestamp comparator operations are also defined in ts.el. The ts< function compares if one epoch UNIX timestamp is less than the other. Its definition is as follows: + +``` +(defun ts< (a b) +“Return non-nil if timestamp A is less than timestamp B.” +(< (ts-unix a) (ts-unix b))) +``` + +In the example given below, the current timestamp is not less than the previous day and hence it returns nil. + +``` +(ts< (ts-now) (ts-adjust ‘day -1 (ts-now))) +nil +``` + +Similarly, we have other comparator functions like ts>, ts=, ts>= and ts<=. A few examples of these function use cases are given below: + +``` +(ts> (ts-now) (ts-adjust ‘day -1 (ts-now))) +t + +(ts= (ts-now) (ts-now)) +nil + +(ts>= (ts-now) (ts-adjust ‘day -1 (ts-now))) +t + +(ts<= (ts-now) (ts-adjust ‘day -2 (ts-now))) +nil +``` + +**Benchmarking** +A few performance tests can be conducted to compare the Emacs internal time values versus the UNIX timestamps. The benchmarking tests can be executed by including the bench-multi macro and bench-multi-process-results function available from __ in your Emacs environment. +You will also need to load the dash-functional library to use the -on function. + +``` +(require ‘dash-functional) +``` + +The following tests have been executed on an Intel(R) Core(TM) i7-3740QM CPU at 2.70GHz with eight cores, 16GB RAM and running Ubuntu 18.04 LTS. + +**Formatting** +The first benchmarking exercise is to compare the formatting of the UNIX timestamp and the Emacs internal time. The Emacs Lisp code to run the test is shown below: + +``` +(let ((format “%Y-%m-%d %H:%M:%S”)) +(bench-multi :times 100000 +:forms ((“Unix timestamp” (format-time-string format 1544311232)) +(“Internal time” (format-time-string format ‘(23564 20962 864324 108000)))))) +``` + +The output appears as an s-expression: + +``` +((“Form” “x faster than next” “Total runtime” “# of GCs” “Total GC runtime”) +hline + +(“Internal time” “1.11” “2.626460” 13 “0.838733”) +(“Unix timestamp” “slowest” “2.921408” 13 “0.920814”)) +``` + +The abbreviation ‘GC’ refers to garbage collection. A tabular representation of the above results is given below: + +[![][3]][4] + +We observe that formatting the internal time is slightly faster. + +**Getting the current time** +The functions to obtain the current time can be compared using the following test: + +``` +(bench-multi :times 100000 +:forms ((“Unix timestamp” (float-time)) +(“Internal time” (current-time)))) +``` + +The results are shown below: + +[![][5]][6] + +We observe that using the Unix timestamp is faster. + +**Parsing** +The third benchmarking exercise is to compare parsing functions on a date timestamp string. The corresponding test code is given below: + +``` +(let* ((s “Wed 10 Jul 2019”)) +(bench-multi :times 100000 +:forms ((“ts-parse” (ts-parse s)) +(“ts-parse ts-unix” (ts-unix (ts-parse s)))))) +``` + +The _ts-parse_ function is slightly faster than the ts-parse _ts-unix_ function, as seen in the results: + +[![][7]][8] + +**A new timestamp versus blanking fields** +The last performance comparison is between creating a new timestamp and blanking the fields. The relevant test code is as follows: + +``` +(let* ((a (ts-now))) +(bench-multi :times 100000 +:ensure-equal t +:forms ((“New” (let ((ts (copy-ts a))) +(setq ts (ts-fill ts)) +(make-ts :unix (ts-unix ts)))) +(“Blanking” (let ((ts (copy-ts a))) +(setq ts (ts-fill ts)) +(ts-reset ts)))))) +``` + +The output of the benchmarking exercise is given below: + +[![][9]][10] + +We observe that creating a new timestamp is slightly faster than blanking the fields. +You are encouraged to read the ts.el README and notes.org from the GitHub repository __ for more information. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/the-emacs-series-exploring-ts-el/ + +作者:[Shakthi Kannan][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/shakthi-kannan/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/GPL-emacs-1.jpg?resize=696%2C435&ssl=1 (GPL emacs) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/GPL-emacs-1.jpg?fit=800%2C500&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1-1.png?resize=350%2C151&ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1-1.png?ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2-1.png?resize=350%2C191&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2-1.png?ssl=1 +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3.png?resize=350%2C144&ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3.png?ssl=1 +[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4.png?resize=350%2C149&ssl=1 +[10]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/4.png?ssl=1 diff --git a/sources/tech/20190917 Getting started with Zsh.md b/sources/tech/20190917 Getting started with Zsh.md new file mode 100644 index 0000000000..d48391eab7 --- /dev/null +++ b/sources/tech/20190917 Getting started with Zsh.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Zsh) +[#]: via: (https://opensource.com/article/19/9/getting-started-zsh) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/falm) + +Getting started with Zsh +====== +Improve your shell game by upgrading from Bash to Z-shell. +![bash logo on green background][1] + +Z-shell (or Zsh) is an interactive Bourne-like POSIX shell known for its abundance of innovative features. Z-Shell users often cite its many conveniences and credit it for increased efficiency and extensive customization. + +If you're relatively new to Linux or Unix but experienced enough to have opened a terminal and run a few commands, you have probably used the Bash shell. Bash is arguably the definitive free software shell, partly because of its progressive features and partly because it ships as the default shell on most of the popular Linux and Unix operating systems. However, the more you use a shell, the more you start to find small things that might be better for the way you want to use it. If there's one thing open source is famous for, it's _choice_. Many people choose to "graduate" from Bash to Z. + +### What is Zsh? + +A shell is just an interface to your operating system. An interactive shell allows you to type in commands through what is called _standard input_, or **stdin**, and get output through _standard output_ and _standard error_, or **stdout** and **stderr**. There are many shells, including Bash, Csh, Ksh, Tcsh, Dash, and Zsh. Each has features based on what its programmers thought would be best for a shell. Whether those features are good or bad is up to you, the end user. + +Zsh has features like interactive Tab completion, automated file searching, regex integration, advanced shorthand for defining command scope, and a rich theme engine. These features are included in an otherwise familiar Bourne-like shell environment, meaning that if you already know and love Bash, you'll find Zsh familiar—except with more features. You might think of it as a kind of Bash++. + +### Installing Zsh + +Install Zsh with your package manager. + +On Fedora, RHEL, and CentOS: + + +``` +`$ sudo dnf install zsh` +``` + +On Ubuntu and Debian: + + +``` +`$ sudo apt install zsh` +``` + +On MacOS, you can install it using MacPorts: + + +``` +`$ sudo port install zsh` +``` + +Or with Homebrew: + + +``` +`$ brew install zsh` +``` + +It's possible to run Zsh on Windows, but only on top of a Linux or Linux-like layer such as [Windows Subsystem for Linux][2] (WSL) or [Cygwin][3]. That installation is out of scope for this article, so refer to Microsoft documentation. + +### Setting up Zsh + +Zsh is not a terminal emulator; it's a shell that runs inside a terminal emulator. So, to launch Zsh, you must first launch a terminal window such as GNOME Terminal, Konsole, Terminal, iTerm2, rxvt, or another terminal of your preference. Then you can launch Zsh by typing: + + +``` +`$ zsh` +``` + +The first time you launch Zsh, you're asked to choose some configuration options. These can all be changed later, so press **1** to continue. + + +``` +This is the Z Shell configuration function for new users, zsh-newuser-install. + +(q)  Quit and do nothing. + +(0)  Exit, creating the file ~/.zshrc + +(1)  Continue to the main menu. +``` + +There are four categories of preferences, so just start at the top. + + 1. The first category lets you choose how many commands are retained in your shell history file. By default, it's set to 1,000 lines. + 2. Zsh completion is one of its most exciting features. To keep things simple, consider activating it with its default options until you get used to how it works. Press **1** for default options, **2** to set options manually. + 3. Choose Emacs or Vi key bindings. Bash uses Emacs bindings, so you may be used to that already. + 4. Finally, you can learn about (and set or unset) some of Zsh's subtle features. For instance, you can stop using the **cd** command by allowing Zsh to initiate a directory change when you provide a non-executable path with no command. To activate one of these extra options, type the option number and enter **s** to _set_ it. Try turning on all options to get the full Zsh experience. You can unset them later by editing **~/.zshrc**. + + + +To complete configuration, press **0**. + +### Using Zsh + +At first, Zsh feels a lot like using Bash, which is unmistakably one of its many features. There are serious differences between, for instance, Bash and Tcsh, so being able to switch between Bash and Zsh is a convenience that makes Zsh easy to try and easy to use at home if you have to use Bash at work or on your server. + +#### Change directory with Zsh + +It's the small differences that make Zsh nice. First, try changing the directory to your Documents folder _without the **cd** command_. It seems too good to be true; but if you enter a directory path with no further instruction, Zsh changes to that directory: + + +``` +% Documents +% pwd +/home/seth/Documents +``` + +That renders an error in Bash or any other normal shell. But Zsh is far from normal, and this is just the beginning. + +#### Search with Zsh + +When you want to find a file using a normal shell, you probably resort to the **find** or **locate** command. At the very least, you may have used **ls -R** for a recursive listing of a set of directories. Zsh has a built-in feature allowing it to find a file in the current or any other subdirectory. + +For instance, assume you have two files called **foo.txt**. One is located in your current directory, and the other is in a subdirectory called **foo**. In a Bash shell, you can list the file in the current directory with: + + +``` +$ ls +foo.txt +``` + +and you can list the other one by stating the subdirectory's path explicitly: + + +``` +$ ls foo +foo.txt +``` + +To list both, you must use the **-R** switch, maybe combined with **grep**: + + +``` +$ ls -R | grep foo.txt +foo.txt +foo.txt +``` + +But in Zsh, you can use the ****** shorthand: + + +``` +% ls **/foo.txt +foo.txt +foo.txt +``` + +And you can use this syntax with any command, not just with **ls**. Imagine your increased efficiency when moving specific file types from one collection of directories to a single location, or concatenating snippets of text into a file, or grepping through logs. + +### Using Zsh Tab completion + +Tab completion is a power-user feature in Bash and some other shells, and it took the Unix world by storm when it became commonplace. No longer did Unix users have to resort to wildcards when typing long and tedious paths (such as **/h*/s*h/V*/SCS/sc*/comp*/t*/a*/*9/04/LS*boat*v**, which is a lot easier than typing **/home/seth/Videos/SCS/scenes/composite/takes/approved/109/04/LS_boat-port-cargo-mover.mkv**). Instead, they could just press the Tab key when they entered enough of a unique string. For example, if you know there's only one directory starting with an **h** at the root level of your system, you might type **/h** and then hit Tab. It's fast, it's simple, it's efficient. It also confirms a path exists; if Tab doesn't complete anything, you know you're looking in the wrong place or you mistyped part of the path. + +However, if you have many directories that share five or more of the same first letters, Tab staunchly refuses to complete. While in most modern terminals it will (at least) reveal the files blocking it from guessing what you mean, it usually takes two Tab presses to reveal them; therefore, Tab completion often becomes such an interplay of letters and Tabs across your keyboard that you feel like you're training for a piano recital. + +Zsh solves this minor annoyance by cycling through possible completions. If you type **ls ~/D** and press Tab, Zsh completes your command with **Documents** first; if you press Tab again, it offers **Downloads**, and so on until you find the one you want. + +### Wildcards in Zsh + +Wildcards behave differently in Zsh than what Bash users are used to. First of all, they can be modified. For example, if you want to list all folders in your current directory, you can use a modified wildcard: + + +``` +% ls +dir0   dir1   dir2   file0   file1 +% ls *(/) +dir0   dir1   dir2 +``` + +In this example, the **(/)** qualifies the results of the wildcard so Zsh will display only directories. To list just the files, use **(.)**. To list symlinks, use **(@)**. To list executable files, use **(*)**. + + +``` +% ls ~/bin/*(*) +fop  exify  tt +``` + +Zsh isn't aware of file types only. It can also list according to modification time, using the same wildcard modifier convention. For example, if you want to find a file that was modified within the past eight hours, use the **mh** modifier (for **modified** and **hours**) and the negative integer of hours: + + +``` +% ls ~/Documents/*(mh-8) +cal.org   game.org   home.org +``` + +To find a file modified more than (for instance) two days ago, the modifiers change to **md** (for **modified** and **day**) with a positive integer: + + +``` +% ls ~/Documents/*(+2) +holiday.org +``` + +There's a lot more you can do with wildcard modifiers and qualifiers, so read the [Zsh man page][4] for full details. + +#### The wildcard side effect + +To use wildcards the way you would use them in Bash, sometimes they must be escaped in Zsh. For instance, if you're copying some files to your server in Bash, you might use a wildcard like this: + + +``` +`$ scp IMG_*.JPG seth@example.com:~/www/ph*/*19/09/14` +``` + +That works in Bash, but Zsh returns an error because it tries to expand the variables on the remote side before issuing the **scp** command. To avoid this, you must escape the remote variables: + + +``` +`% scp IMG_*.JPG seth@example.com:~/www/ph\*/\*19/09/14` +``` + +It's these types of little exceptions that can frustrate you when you're switching to a new shell. There aren't many when using Zsh (there are probably more when switching back to Bash after experiencing Zsh) but when they happen, remain calm and be explicit. Rarely will you go wrong to adhere strictly to POSIX—but if that fails, look up the problem to solve it and move on. [Hyperpolyglot.org][5] has proven invaluable to many users stuck on one shell at work and another at home. + +In my next Zsh article, I'll show you how to install themes and plugins to make your Z-Shell even Z-ier. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/getting-started-zsh + +作者:[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/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/falm +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://devblogs.microsoft.com/commandline/category/bash-on-ubuntu-on-windows/ +[3]: https://www.cygwin.com/ +[4]: https://linux.die.net/man/1/zsh +[5]: http://hyperpolyglot.org/unix-shells diff --git a/sources/tech/20190917 Talking to machines- Lisp and the origins of AI.md b/sources/tech/20190917 Talking to machines- Lisp and the origins of AI.md new file mode 100644 index 0000000000..795f4c731b --- /dev/null +++ b/sources/tech/20190917 Talking to machines- Lisp and the origins of AI.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Talking to machines: Lisp and the origins of AI) +[#]: via: (https://opensource.com/article/19/9/command-line-heroes-lisp) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg) + +Talking to machines: Lisp and the origins of AI +====== +The Command Line Heroes podcast explores the invention of Lisp and the +rise of thinking computers powered by open source software. +![Listen to the Command Line Heroes Podcast][1] + +Artificial intelligence (AI) is all the rage today, and its massive impact on the world is still to come, says the[ Association for the Advancement of Artificial Intelligence][2] (AAAI). According to an article on [Nanalyze][3]: + +> "The vast majority of nearly 2,000 experts polled by the Pew Research Center in 2014 said they anticipate robotics and artificial intelligence will permeate wide segments of daily life by 2025. A 2015 study covering 17 countries found that artificial intelligence and related technologies added an estimated 0.4 percentage point on average to those countries' annual GDP growth between 1993 and 2007, accounting for just over one-tenth of those countries' overall GDP growth during that time." + +However, this is the second time has AI garnered so much attention. When was AI first popular, and what does that have to do with the obscure-but-often-loved programming language Lisp? + +The second-to-last podcast of [Command Line Heroes][4]' third season dives into these topics and leaves us thinking about open source at the core of AI. + +### Before the term AI + +Thinking machines have been a curiosity for centuries, long before they could be realized. In the 1800s, computer science pioneers Charles Babbage and Ada Lovelace imagined an analytical engine capable of predictions far beyond human skills, such as correctly selecting the winning horse in a race. + +In the 1940s and '50s, Alan Turing defined what it would look like for intelligent machines to emulate human intelligence; that's what we now call the Turing Test. In his 1950 [research paper][5], Turing's "imitation game" set out to convince someone they were communicating with a human in another room when, in reality, it was a machine. + +While these theories inspired imaginative debate, they became less theoretical as computer hardware began providing enough power to begin experimenting. + +### Why Lisp is at the heart of AI theory + +John McCarthy, the person to coin the term "artificial intelligence," is also the person who reinvented how we program to create thinking machines. His reimagined approach was codified into the Lisp programming language. As [Paul Graham][6] wrote: + +> "In 1960, [John McCarthy][7] published a remarkable paper in which he did for programming something like what Euclid did for geometry. He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for 'List Processing,' because one of his key ideas was to use a simple data structure called a list for both code and data. +> +> "It's worth understanding what McCarthy discovered, not just as a landmark in the history of computers, but as a model for what programming is tending to become in our own time. It seems to me that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been [moving steadily][8] toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add to it, piecemeal, parts taken from the Lisp model, like runtime typing and garbage collection." + +I remember when I first wrote Lisp for a computer science class. After wrapping my head around its seemingly infinite number of parentheses, I uncovered a beautiful pattern of thought: Can I think through what I want this software to do? + +![The elegance of Lisp programming is timeless][9] + +That sounds silly: computers process what we code them to do, but there's something about recursion that made me think in a wildly different light. It's exciting to learn that 15 years ago, I may have been tapping into the big-picture changes McCarthy was describing. + +### Why the slowdown in AI? + +By the mid-to-late 1960s, McCarthy's work made way to a new field of research, where AI, machine learning (ML), and deep learning all became possibilities. And Lisp became the accepted standard in this emerging field. It's said that in 1968, McCarthy made a wager with David Levy, a Scottish chess master, that in 10 years a computer would be able to beat Levy in a chess match. Why did it take nearly 30 years to get to the famous [Deep Blue vs. Garry Kasparov][10] match? + +Command Line Heroes explores one theory: that for-profit investment in AI pulled essential talent from academia, where they were advancing the science, and pushed them onto a different path. Whether or not this was the reason, the world of AI fell into a "winter," where the people pursuing it were considered unrealistic. + +This AI winter lasted for quite some time. In 2005, The [_New York Times_ reported][11] that AI had become so stigmatized that "some computer scientists and software engineers avoided the term artificial intelligence for fear of being viewed as wild-eyed dreamers." + +### Where is AI now? + +Fast forward to today, when talking about AI or ML is a fast pass to getting people's attention—but that attention isn't always positive. Many are concerned that AI will remove millions of jobs from the world. Others say it will [create][12] millions of more jobs than are lost. + +The verdict is still out. [McKinsey's research][13] on the job loss vs. job gain debate is fascinating. When you take into account growing world consumption, aging populations, "marketization" of previously unpaid domestic work, and other factors, you find that the answer depends on your outlook. + +One thing is for sure: AI will be a significant part of our lives, and it will have much wider implications than other areas of tech. For this reason (among others), examining the [misconceptions around ethics and bias in AI][14] is essential. + +### Open source and AI + +McCarthy had a dream that machines could have common sense. His AI goals included open source from the very beginning; this is visualized on Red Hat's beautifully animated webpage on the [origins of AI and its open source roots][15]. + +[![Origins of AI and open source screenshot][16]][15] + +If we are to achieve the goals of McCarthy, Turing, or other AI pioneers, I believe it will be because of the open source community behind the technology. Part of the reason AI's popularity bounced back is because of open source: languages, frameworks, and the datasets we analyze are increasingly open. Here are a handful of things to explore: + + * [Learn enough Python and R][17] to be part of this future + * [Explore Python libraries][18] that will bulk up your skills + * Understand how [AI and ML are related][19] + * Explore [free and open datasets][20] + * Use modern implementations of Lisp, [available under open source licenses][21] + + + +It's possible that early AI explored the right ideas in the wrong decade. World-class computers back then weren't even as powerful as today's cellphones, and each one was shared by dozens of individuals. Today, many of us own multiple supercomputers and carry them with us all the time. For this reason, among others, the future of AI is strong and its highest achievements are yet to come. + +_Command Line Heroes has covered programming languages for all of Season 3. [Subscribe so that you don't miss the last episode of the season][4], and I would love to hear your thoughts in the comments below._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/command-line-heroes-lisp + +作者:[Matthew Broberg][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/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberghttps://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_hereoes_ep7_blog-header-292x521.png?itok=lI4DXvq2 (Listen to the Command Line Heroes Podcast) +[2]: http://aaai.org/ +[3]: https://www.nanalyze.com/2016/11/artificial-intelligence-definition/ +[4]: https://www.redhat.com/en/command-line-heroes +[5]: https://www.csee.umbc.edu/courses/471/papers/turing.pdf +[6]: http://www.paulgraham.com/rootsoflisp.html +[7]: http://www-formal.stanford.edu/jmc/index.html +[8]: http://www.paulgraham.com/diff.html +[9]: https://opensource.com/sites/default/files/uploads/lisp_cycles.png (The elegance of Lisp programming is timeless) +[10]: https://en.wikipedia.org/wiki/Deep_Blue_versus_Garry_Kasparov +[11]: https://www.nytimes.com/2005/10/14/technology/behind-artificial-intelligence-a-squadron-of-bright-real-people.html +[12]: https://singularityhub.com/2019/01/01/ai-will-create-millions-more-jobs-than-it-will-destroy-heres-how/ +[13]: https://www.mckinsey.com/featured-insights/future-of-work/jobs-lost-jobs-gained-what-the-future-of-work-will-mean-for-jobs-skills-and-wages +[14]: https://opensource.com/article/19/8/4-misconceptions-ethics-and-bias-ai +[15]: https://www.redhat.com/en/open-source-stories/ai-revolutionaries/origins-ai-open-source +[16]: https://opensource.com/sites/default/files/uploads/origins_aiopensource.png (Origins of AI and open source screenshot) +[17]: https://opensource.com/article/19/5/learn-python-r-data-science +[18]: https://opensource.com/article/18/5/top-8-open-source-ai-technologies-machine-learning +[19]: https://opensource.com/tags/ai-and-machine-learning +[20]: https://opensource.com/article/19/2/learn-data-science-ai +[21]: https://www.cliki.net/Common+Lisp+implementation diff --git a/sources/tech/20190917 What-s Good About TensorFlow 2.0.md b/sources/tech/20190917 What-s Good About TensorFlow 2.0.md new file mode 100644 index 0000000000..a00306d6c5 --- /dev/null +++ b/sources/tech/20190917 What-s Good About TensorFlow 2.0.md @@ -0,0 +1,328 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What’s Good About TensorFlow 2.0?) +[#]: via: (https://opensourceforu.com/2019/09/whats-good-about-tensorflow-2-0/) +[#]: author: (Siva Rama Krishna Reddy B https://opensourceforu.com/author/siva-krishna/) + +What’s Good About TensorFlow 2.0? +====== + +[![][1]][2] + +_Version 2.0 of TensorFlow is focused on simplicity and ease of use. It has been strengthened with updates like eager execution and intuitive higher level APIs accompanied by flexible model building. It is platform agnostic, and makes APIs more consistent, while removing those that are redundant._ + +Machine learning and artificial intelligence are experiencing a revolution these days, primarily due to three major factors. The first is the increased computing power available within small form factors such as GPUs, NPUs and TPUs. The second is the breakthrough in machine learning algorithms. State-of-art algorithms and hence models are available to infer faster. Finally, huge amounts of labelled data is essential for deep learning models to perform better, and this is now available. + +TensorFlow is an open source AI framework from Google which arms researchers and developers with the right tools to build novel models. It was made open source in 2015 and, in the past few years, has evolved with various enhancements covering operator support, programming languages, hardware support, data sets, official models, and distributed training and deployment strategies. + +TensorFlow 2.0 was released recently at the TensorFlow Developer Summit. It has major changes across the stack, some of which will be discussed from the developers’ point of view. + +TensorFlow 2.0 is primarily focused on the ease-of-use, power and scalability aspects. Ease is ensured in terms of simplified APIs, Keras being the main high level API interface; eager execution is available by default. Version 2.0 is powerful in the sense of being flexible and running much faster than earlier, with more optimisation. Finally, it is more scalable since it can be deployed on high-end distributed environments as well as on small edge devices. + +This new release streamlines the various components involved, from data preparation all the way up to deployment on various targets. High speed data processing pipelines are offered by tf.data, high level APIs are offered by tf.keras, and there are simplified APIs to access various distribution strategies on targets like the CPU, GPU and TPU. TensorFlow 2.0 offers a unique packaging format called SavedModel that can be deployed over the cloud through a TensorFlow Serving. Edge devices can be deployed through TensorFlow Lite, and Web applications through the newly introduced TensorFlow.js and various other language bindings that are also available. + +![Figure 1: The evolution of TensorFlow][3] + +TensorFlow.js was announced at the developer summit with off-the-shelf pretrained models for the browser, node, desktop and mobile native applications. The inclusion of Swift was also announced. Looking at some of the performance improvements since last year, the latest release claims a training speedup of 1.8x on NVIDIA Tesla V100, a 1.6x training speedup on Google Cloud TPUv2 and a 3.3.x inference speedup on Intel Skylake. + +**Upgrade to 2.0** +The new release offers a utility _tf_upgrade_v2_ to convert a 1.x Python application script to a 2.0 compatible script. It does most of the job in converting the 1.x deprecated API to a newer compatibility API. An example of the same can be seen below: + +``` +test-pc:~$cat test-infer-v1.py + +# Tensorflow imports +import tensorflow as tf + +save_path = ‘checkpoints/dev’ +with tf.gfile.FastGFile(“./trained-graph.pb”, ‘rb’) as f: +graph_def = tf.GraphDef() +graph_def.ParseFromString(f.read()) +tf.import_graph_def(graph_def, name=’’) + +with tf.Session(graph=tf.get_default_graph()) as sess: +input_data = sess.graph.get_tensor_by_name(“DecodeJPGInput:0”) +output_data = sess.graph.get_tensor_by_name(“final_result:0”) + +image = ‘elephant-299.jpg’ +if not tf.gfile.Exists(image): +tf.logging.fatal(‘File does not exist %s’, image) +image_data = tf.gfile.FastGFile(image, ‘rb’).read() + +result = sess.run(output_data, {‘DecodeJPGInput:0’: image_data}) +print(result) + +test-pc:~$ tf_upgrade_v2 --infile test-infer-v1.py --outfile test-infer-v2.py + +INFO line 5:5: Renamed ‘tf.gfile.FastGFile’ to ‘tf.compat.v1.gfile.FastGFile’ +INFO line 6:16: Renamed ‘tf.GraphDef’ to ‘tf.compat.v1.GraphDef’ +INFO line 10:9: Renamed ‘tf.Session’ to ‘tf.compat.v1.Session’ +INFO line 10:26: Renamed ‘tf.get_default_graph’ to ‘tf.compat.v1.get_default_graph’ +INFO line 15:15: Renamed ‘tf.gfile.Exists’ to ‘tf.io.gfile.exists’ +INFO line 16:12: Renamed ‘tf.logging.fatal’ to ‘tf.compat.v1.logging.fatal’ +INFO line 17:21: Renamed ‘tf.gfile.FastGFile’ to ‘tf.compat.v1.gfile.FastGFile’ +TensorFlow 2.0 Upgrade Script +----------------------------- +Converted 1 files +Detected 0 issues that require attention +------------------------------------------------------------- +Make sure to read the detailed log ‘report.txt’ + +test-pc:~$ cat test-infer-v2.py + +# Tensorflow imports +import tensorflow as tf + +save_path = ‘checkpoints/dev’ +with tf.compat.v1.gfile.FastGFile(“./trained-graph.pb”, ‘rb’) as f: +graph_def = tf.compat.v1.GraphDef() +graph_def.ParseFromString(f.read()) +tf.import_graph_def(graph_def, name=’’) + +with tf.compat.v1.Session(graph=tf.compat.v1.get_default_graph()) as sess: +input_data = sess.graph.get_tensor_by_name(“DecodeJPGInput:0”) +output_data = sess.graph.get_tensor_by_name(“final_result:0”) + +image = ‘elephant-299.jpg’ +if not tf.io.gfile.exists(image): +tf.compat.v1.logging.fatal(‘File does not exist %s’, image) +image_data = tf.compat.v1.gfile.FastGFile(image, ‘rb’).read() + +result = sess.run(output_data, {‘DecodeJPGInput:0’: image_data}) +print(result) +``` + +As we can see here, the _tf_upgrade_v2_ utility converts all the deprecated APIs to compatible v1 APIs, to make them work with 2.0. + +**Eager execution:** Eager execution allows real-time evaluation of Tensors without calling _session.run_. A major advantage with eager execution is that we can print the Tensor values any time for debugging. +With TensorFlow 1.x, the code is: + +``` +test-pc:~$python3 +Python 3.6.7 (default, Oct 22 2018, 11:32:17) +[GCC 8.2.0] on linux +Type “help”, “copyright”, “credits” or “license” for more information. +>>> import tensorflow as tf +>>> print(tf.__version__) +1.14.0 +>>> tf.add(2,3) + +``` + +TensorFlow 2.0, on the other hand, evaluates the result that we call the API: + +``` +test-pc:~$python3 +Python 3.6.7 (default, Oct 22 2018, 11:32:17) +[GCC 8.2.0] on linux +Type “help”, “copyright”, “credits” or “license” for more information. +>>> import tensorflow as tf +>>> print(tf.__version__) +2.0.0-beta1 +>>> tf.add(2,3) + +``` + +In v1.x, the resulting Tensor doesn’t display the value and we need to execute the graph under a session to get the value, but in v2.0 the values are implicitly computed and available for debugging. + +**Keras** +Keras (_tf.keras_) is now the official high level API. It has been enhanced with many compatible low level APIs. The redundancy across Keras and TensorFlow is removed, and most of the APIs are now available with Keras. The low level operators are still accessible through tf.raw_ops. +We can now save the Keras model directly as a Tensorflow SavedModel, as shown below: + +``` +# Save Model to SavedModel +saved_model_path = tf.keras.experimental.export_saved_model(model, ‘/path/to/model’) + +# Load the SavedModel +new_model = tf.keras.experimental.load_from_saved_model(saved_model_path) + +# new_model is now keras Model object. +new_model.summary() +``` + +Earlier, APIs related to various layers, optimisers, metrics and loss functions were distributed across Keras and native TensorFlow. Latest enhancements unify them as _tf.keras.optimizer.*, tf.keras.metrics.*, tf.keras.losses.* and tf.keras.layers.*._ +The RNN layers are now much more simplified compared to v 1.x. +With TensorFlow 1.x, the commands given are: + +``` +if tf.test.is_gpu_available(): +model.add(tf.keras.layers.CudnnLSTM(32)) +else +model.add(tf.keras.layers.LSTM(32)) +``` + +With TensorFlow 2.0, the commands given are: + +``` +# This will use Cudnn kernel when the GPU is available. +model.add(tf.keras.layer.LSTM(32)) +``` + +TensorBoard integration is now a simple call back, as shown below: + +``` +tb_callbaclk = tf.keras.callbacks.TensorBoard(log_dir=log_dir) + +model.fit( +x_train, y_train, epocha=5, +validation_data = [x_test, y_test], +Callbacks = [tb_callbacks]) +``` + +With this simple call back addition, TensorBoard is up on the browser to look for all the statistics in real-time. +Keras offers unified distribution strategies, and a few lines of code can enable the required strategy as shown below: + +``` +strategy = tf.distribute.MirroredStrategy() + +with strategy.scope() +model = tf.keras.models.Sequential([ +tf.keras.layers.Dense(64, input_shape=[10]), +tf.keras.layers.Dense(64, activation=’relu’), +tf.keras.layers.Dense(10, activation=’softmax’)]) + +model.compile(optimizer=’adam’, +loss=’categorical_crossentropy’, +metrics=[‘accuracy’]) +``` + +As shown above, the model definition under the desired scope is all we need to apply the desired strategy. Very soon, there will be support for multi-node synchronous and TPU strategy, and later, for parameter server strategy. + +![Figure 2: Coral products with edge TPU][4] + +**TensorFlow function** +Function is a major upgrade that impacts the way we write TensorFlow applications. The new version introduces tf.function, which simplifies the applications and makes it very close to writing a normal Python application. +A sample _tf.function_ definition looks like what’s shown in the code snippet below. Here the _tf.function_ declaration makes the user define a function as a TensorFlow operator, and all optimisation is applied automatically. Also, the function is faster than eager execution. APIs like _tf.control_dependencies_, _tf.global_variable_initializer_, and _tf.cond, tf.while_loop_ are no longer needed with _tf.function_. The user defined functions are polymorphic by default, i.e., we may pass mixed type tensors. + +``` +test-pc:~$ cat tf-test.py +import tensorflow as tf + +print(tf.__version__) + +@tf.function +def add(a, b): +return (a+b) + +print(add(tf.ones([2,2]), tf.ones([2,2]))) + +test-pc:~$ python3 tf-test.py +2.0.0-beta1 +tf.Tensor( +[[2. 2.] +[2. 2.]], shape=(2, 2), dtype=float32) +``` + +Here is another example to demonstrate automatic control flows and Autograph in action. Autograph automatically converts the conditions, while it loops Python to TensorFlow operators. + +``` +test-pc:~$ cat tf-test-control.py +import tensorflow as tf + +print(tf.__version__) + +@tf.function +def f(x): +while tf.reduce_sum(x) > 1: +x = tf.tanh(x) +return x + +print(f(tf.random.uniform([10]))) + +test-pc:~$ python3 tf-test-control.py + +2.0.0-beta1 +tf.Tensor( +[0.10785562 0.11102211 0.11347286 0.11239681 0.03989326 0.10335539 +0.11030331 0.1135259 0.11357211 0.07324989], shape=(10,), dtype=float32) +``` + +We can see Autograph in action with the following API over the function. + +``` +print(tf.autograph.to_code(f)) # f is the function name +``` + +**TensorFlow Lite** +The latest advancements in edge devices add neural network accelerators. Google has released EdgeTPU, Intel has the edge inference platform Movidius, Huawei mobile devices have the Kirin based NPU, Qualcomm has come up with NPE SDK to accelerate on the Snapdragon chipsets using Hexagon power and, recently, Samsung released Exynos 9 with NPU. An edge device optimised framework is necessary to support these hardware ecosystems. + +Unlike TensorFlow, which is widely used in high power-consuming server infrastructure, edge devices are challenging in terms of reduced computing power, limited memory and battery constraints. TensorFlow Lite is aimed at bringing in TensorFlow models directly onto the edge with minimal effort. The TF Lite model format is different from TensorFlow. A TF Lite converter is available to convert a TensorFlow SavedBundle to a TF Lite model. + +Though TensorFlow Lite is evolving, there are limitations too, such as in the number of operations supported, and the unsupported semantics like control-flows and RNNs. In its early days, TF Lite used a TOCO converter and there were a few challenges for the developer community. A brand new 2.0 converter is planned to be released soon. There are claims that using TF Lite results in huge improvements across the CPU, GPU and TPU. + +TF Lite introduces delegates to accelerate parts of the graph on an accelerator. We may choose a specific delegate for a specific sub-graph, if needed. + +``` +#import “tensorflow/lite/delegates/gpu/metal_delegate.h” + +// Initialize interpreter with GPU delegate +std::unique_ptr interpreter; +InterpreterBuilder(*model, resolver)(&interpreter); +auto* delegate = NewGpuDelegate(nullptr); // default config +if (interpreter->ModifyGraphWithDelegate(delegate) != kTfLiteOk) return false; + +// Run inference +while (true) { +WriteToInputTensor(interpreter->typed_input_tensor(0)); +if (interpreter->Invoke() != kTfLiteOk) return false; +ReadFromOutputTensor(interpreter->typed_output_tensor(0)); +} + +// Clean up +interpreter = nullptr; +DeleteGpuDelegate(delegate); +``` + +As shown above, we can choose GPUDelegate, and modify the graph with the respective kernel’s runtime. TF Lite is going to support the Android NNAPI delegate, in order to support all the hardware that is supported by NNAPI. For edge devices, CPU optimisation is also important, as not all edge devices are equipped with accelerators; hence, there is a plan to support further optimisations for ARM and x86. + +Optimisations based on quantisation and pruning are evolving to reduce the size and processing demands of models. Quantisation generally can reduce model size by 4x (i.e., 32-bit to 8-bit). Models with more convolution layers may get faster by 10 to 50 per cent on the CPU. Fully connected and RNN layers may speed up operation by 3x. + +TF Lite now supports post-training quantisation, which reduces the size along with compute demands greatly. TensorFlow 2.0 offers simplified APIs to build models with quantisation and by pruning optimisations. +A normal dense layer without quantisation looks like what follows: + +``` +tf.keras.layers.Dense(512, activation=’relu’) +``` + +Whereas a quality dense layer looks like what’s shown below: + +``` +quantize.Quantize(tf.keras.layers.Dense(512, activation=’relu’)) +``` + +Pruning is a technique used to drop connections that are ineffective. In general, ‘dense’ layers contain lots of connections which don’t influence the output. Such connections can be dropped by making the weight zero. Tensors with lots of zeros may be represented as ‘sparse’ and can be compressed. Also, the number of operations in a sparse tensor is less. +Building a layer with _prune_ is as simple as using the following command: + +``` +prune.Prune(tf.keras.layers.Dense(512, activation=’relu’)) +``` + +In a pipeline, there is Keras based quantised training and Keras based connection pruning. These optimisations may push TF Lite further ahead of the competition, with regard to other frameworks. + +**Coral** +Coral is a new platform for creating products with on-device ML acceleration. The first product here features Google’s Edge TPU in SBC and USB form factors. TensorFlow Lite is officially supported on this platform, with the salient features being very fast inference speed, privacy and no reliance on network connection. + +More details related to hardware specifications, pricing, and a getting started guide can be found at __. + +With these advances as well as a wider ecosystem, it’s very evident that TensorFlow may become the leading framework for artificial intelligence and machine learning, similar to how Android evolved in the mobile world. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/whats-good-about-tensorflow-2-0/ + +作者:[Siva Rama Krishna Reddy B][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/siva-krishna/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2018/09/ML-with-tensorflow.jpg?resize=696%2C328&ssl=1 (ML with tensorflow) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2018/09/ML-with-tensorflow.jpg?fit=1200%2C565&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-1-The-evolution-of-TensorFlow.jpg?resize=350%2C117&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure-2-Coral-products-with-edge-TPU.jpg?resize=350%2C198&ssl=1 diff --git a/sources/tech/20190918 Adding themes and plugins to Zsh.md b/sources/tech/20190918 Adding themes and plugins to Zsh.md new file mode 100644 index 0000000000..9601223452 --- /dev/null +++ b/sources/tech/20190918 Adding themes and plugins to Zsh.md @@ -0,0 +1,210 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290 ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Adding themes and plugins to Zsh) +[#]: via: (https://opensource.com/article/19/9/adding-plugins-zsh) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/sethhttps://opensource.com/users/seth) + +Adding themes and plugins to Zsh +====== +Expand Z-shell's capabilities with themes and plugins installed with Oh +My Zsh. +![Someone wearing a hardhat and carrying code ][1] + +In my [previous article][2], I explained how to get started with [Z-shell][2] (Zsh). For some users, the most exciting thing about Zsh is its ability to adopt new themes. It's so easy to theme Zsh both because of the active community designing visuals for the shell and also because of the [Oh My Zsh][3] project, which makes it trivial to install them. + +Theming is one of those changes you notice immediately, so if you don't feel like you changed shells when you installed Zsh, you'll definitely feel it once you've adopted one of the 100+ themes bundled with Oh My Zsh. There's a lot more to Oh My Zsh than just pretty themes, though; there are also hundreds of plugins that add features to your Z-shell environment. + +### Installing Oh My Zsh + +The [ohmyz.sh][3] website encourages you to install the framework by running a script over the internet from your computer. While the Oh My Zsh project is almost certainly trustworthy, it's generally ill-advised to blindly run scripts on your system. If you want to run the install script, you can download it, read it, and run it after you're satisfied you understand what it's doing. + +If you download the script and read it, you may notice that installation is only a three-step process: + +#### 1\. Clone oh-my-zsh + +First, clone the oh-my-zsh repository into a directory called **~/.oh-my-zsh**: + + +``` +`% git clone http://github.com/robbyrussell/oh-my-zsh ~/.oh-my-zsh` +``` + +#### 2\. Switch the config file + +Next, back up your existing **.zshrc** file and move the default one from the oh-my-zsh install into its place. You can do this in one command using the **-b** (backup) option for **mv**, as long as your version of the **mv** command includes that option: + + +``` +% mv -b \ +~/.oh-my-zsh/templates/zshrc.zsh-template \ +~/.zshrc +``` + +#### 3\. Edit the config + +By default, Oh My Zsh's configuration is pretty bland, so you might want to reintegrate your custom **~/.zshrc** into the **.oh-my-zsh** config. To do that, append your old config to the end of the new one using the [cat command][4]: + + +``` +`% cat ~/.zshrc~ >> ~/.zshrc` +``` + +To see the default configuration and learn about some of the options it provides, open **~/.zshrc** in your favorite text editor. The file is well-commented, so it's a great way to get a good idea of what's possible. + +For instance, you can change the location of your **.oh-my-zsh** directory. At installation, it resides at the base of your home directory, but modern Linux convention, as defined by the [Free Desktop][5] specification, is to place directories that extend the functionality of applications in the **~/.local/share** directory. You can change it in **~/.zshrc** by editing the line: + + +``` +# Path to your oh-my-zsh installation. +export ZSH=$HOME/.local/share/oh-my-zsh +``` + +then moving the directory to that location: + + +``` +% mv ~/.oh-my-zsh \ +$HOME/.local/share/oh-my-zsh +``` + +If you're using MacOS, the specification is less clear, but arguably the most appropriate place for the directory is **$HOME/Library/Application\ Support**. + +### Relaunching Zsh + +After editing the config, you have to relaunch your shell. Before you do that, make sure you've finished any in-progress config changes; for instance, don't change the path of **.oh-my-zsh** then forget to move the directory to its new location. If you don't want to relaunch your shell, you can **source** the config file, just as you can with Bash: + + +``` +% source ~/.zshrc +➜  .oh-my-zsh git:(master) ✗ +``` + +You can ignore any warnings about missing update files; they will be resolved upon relaunch. + +### Changing your theme + +Installing Oh My Zsh sets your Z-shell theme to **robbyrussell**, a theme by the project's maintainer. This theme's changes are minimal, mostly involving the color of your prompt. + +To view all the available themes, list the contents of the **.oh-my-zsh** theme directory: + + +``` +➜  .oh-my-zsh git:(master) ✗ ls \ +~/.local/share/oh-my-zsh/themes +3den.zsh-theme +adben.zsh-theme +af-magic.zsh-theme +afowler.zsh-theme +agnoster.zsh-theme +[...] +``` + +To see screenshots of themes before trying them, visit the Oh My Zsh [wiki][6]. For even more themes, visit the [External themes][7] wiki page. + +Most themes are simple to set up and use. Just change the value of the theme name in **.zshrc** and reload the config: + + +``` +➜ ~ sed -i \ +'s/_THEME=\"robbyrussel\"/_THEME=\"linuxonly\"/g' \ +~/.zshrc +➜ ~ source ~/.zshrc +seth@darkstar:pts/0->/home/skenlon (0) ➜ +``` + +Other themes require extra configuration. For example, to use the **agnoster** theme, you must first install the Powerline font. This is an open source font, and it's probably in your software repository if you're running Linux. Install it with: + + +``` +`➜ ~ sudo dnf install powerline-fonts` +``` + +Set your theme in the config: + + +``` +➜ ~ sed -i \ +'s/_THEME=\"linuxonly\"/_THEME=\"agnoster\"/g' \ +~/.zshrc +``` + +and then relaunch (a simple **source** won't work). Upon relaunch, you will see the new theme: + +![agnoster theme][8] + +### Installing plugins + +Over 200 plugins ship with Oh My Zsh, and you can see them by looking in **.oh-my-zsh/plugins**. Each plugin directory has a README file explaining what the plugin does. + +Some plugins are relatively simple. For instance, the **dnf**, **ubuntu**, **brew**, and **macports** plugins are collections of aliases to simplify interactions with the DNF, Apt, Homebrew, and MacPorts package managers. + +Others are more complex. The **git** plugin, active by default, detects when you're working in a [Git repository][9] and updates your shell prompt so that it lists the current branch and even indicates whether there are unmerged changes. + +To activate a plugin, add it to the plugin setting in **~/.zshrc**. For example, to add the **dnf** and **pass** plugins, open **~/.zshrc** in your favorite text editor: + + +``` +`plugins=(git dnf pass)` +``` + +Save your changes and reload your Zsh session: + + +``` +`% source ~/.zshrc` +``` + +The plugins are now active. You can test the **dnf** plugin by using one of the aliases it provides: + + +``` +% dnfs fop +====== Name Exactly Matched: fop ====== +fop.noarch : XSL-driven print formatter +``` + +Different plugins do different things, so you may want to install only one or two at a time to help you learn the new capabilities of your shell. + +#### Cheating + +Some Oh My Zsh plugins are pretty generic. If you look at a plugin that claims to be a Z-shell plugin and the code is also compatible with Bash, then you can use it in your Bash shell. Some plugins require Z-shell-specific functions, so this won't work with all of them. But you can load plugins like **dnf**, **ubuntu**, **[firewalld][10]**, and others into a Bash shell by using **source** to load the plugin of your choice. For example: + + +``` +if [ -d $HOME/.local/share/oh-my-zsh/plugins ]; then +        source $HOME/.local/share/oh-my-zsh/plugins/dnf/dnf.plugin.zsh +fi +``` + +### To Z or not to Z + +Z-shell is a powerful shell both for its built-in features and the plugins contributed by its passionate community. Whether you use it as your primary shell or just as a shell you visit on weekends or holidays, you owe it to yourself to try it out. + +What are your favorite Z-shell themes and plugins? Tell us in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/adding-plugins-zsh + +作者:[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/sethhttps://opensource.com/users/sethhttps://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag (Someone wearing a hardhat and carrying code ) +[2]: https://opensource.com/article/19/9/getting-started-zsh +[3]: https://ohmyz.sh/ +[4]: https://opensource.com/article/19/2/getting-started-cat-command +[5]: http://freedesktop.org +[6]: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +[7]: https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes +[8]: https://opensource.com/sites/default/files/uploads/zsh-agnoster.jpg (agnoster theme) +[9]: https://opensource.com/resources/what-is-git +[10]: https://opensource.com/article/19/7/make-linux-stronger-firewalls diff --git a/sources/tech/20190918 How to remove carriage returns from text files on Linux.md b/sources/tech/20190918 How to remove carriage returns from text files on Linux.md new file mode 100644 index 0000000000..45b8a8b89d --- /dev/null +++ b/sources/tech/20190918 How to remove carriage returns from text files on Linux.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to remove carriage returns from text files on Linux) +[#]: via: (https://www.networkworld.com/article/3438857/how-to-remove-carriage-returns-from-text-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to remove carriage returns from text files on Linux +====== +When carriage returns (also referred to as Ctrl+M's) get on your nerves, don't fret. There are several easy ways to show them the door. +[Kim Siever][1] + +Carriage returns go back a long way – as far back as typewriters on which a mechanism or a lever swung the carriage that held a sheet of paper to the right so that suddenly letters were being typed on the left again. They have persevered in text files on Windows, but were never used on Linux systems. This incompatibility sometimes causes problems when you’re trying to process files on Linux that were created on Windows, but it's an issue that is very easily resolved. + +The carriage return, also referred to as **Ctrl+M**, character would show up as an octal 15 if you were looking at the file with an **od** octal dump) command. The characters **CRLF** are often used to represent the carriage return and linefeed sequence that ends lines on Windows text files. Those who like to gaze at octal dumps will spot the **\r \n**. Linux text files, by comparison, end with just linefeeds. + +**[ Two-Minute Linux Tips: [Learn how to master a host of Linux commands in these 2-minute video tutorials][2] ]** + +Here's a sample of **od** output with the lines containing the **CRLF** characters in both octal and character form highlighted. + +``` +$ od -bc testfile.txt +0000000 124 150 151 163 040 151 163 040 141 040 164 145 163 164 040 146 + T h i s i s a t e s t f +0000020 151 154 145 040 146 162 157 155 040 127 151 156 144 157 167 163 + i l e f r o m W i n d o w s +0000040 056 015 012 111 164 047 163 040 144 151 146 146 145 162 145 156 <== + . \r \n I t ' s d i f f e r e n <== +0000060 164 040 164 150 141 156 040 141 040 125 156 151 170 040 164 145 + t t h a n a U n i x t e +0000100 170 164 040 146 151 154 145 015 012 167 157 165 154 144 040 142 <== + x t f i l e \r \n w o u l d b <== +``` + +While these characters don’t represent a huge problem, they can sometimes interfere when you want to parse the text files in some way and don’t want to have to code around their presence or absence. + +### 3 ways to remove carriage return characters from text files + +Fortunately, there are several ways to easily remove carriage return characters. Here are three options: + +#### dos2unix + +You might need to go through the trouble of installing it, but **dos2unix** is probably the easiest way to turn Windows text files into Unix/Linux text files. One command with one argument, and you’re done. No second file name is required. The file will be changed in place. + +``` +$ dos2unix testfile.txt +dos2unix: converting file testfile.txt to Unix format... +``` + +You should see the file length decrease, depending on how many lines it contains. A file with 100 lines would likely shrink by 99 characters, since only the last line will not end with the **CRLF** characters. + +Before: + +``` +-rw-rw-r-- 1 shs shs 121 Sep 14 19:11 testfile.txt +``` + +After: + +``` +-rw-rw-r-- 1 shs shs 118 Sep 14 19:12 testfile.txt +``` + +If you need to convert a large collection of files, don't fix them one at a time. Instead, put them all in a directory by themselves and run a command like this: + +``` +$ find . -type f -exec dos2unix {} \; +``` + +In this command, we use find to locate regular files and then run the **dos2unix** command to convert them one at a time. The {} in the command is replaced by the filename. You should be sitting in the directory with the files when you run it. This command could damage other types of files, such as those that contain octal 15 characters in some context other than a text file (e.g., bytes in an image file). + +#### sed + +You can also use **sed**, the stream editor, to remove carriage returns. You will, however, have to supply a second file name. Here’s an example: + +``` +$ sed -e “s/^M//” before.txt > after.txt +``` + +One important thing to note is that you DON’T type what that command appears to be. You must enter **^M** by typing **Ctrl+V** followed by **Ctrl+M**. The “s” is the substitute command. The slashes separate the text we’re looking for (the Ctrl+M) and the text (nothing in this case) that we’re replacing it with. + +#### vi + +You can even remove carriage return (**Ctrl+M**) characters with **vi**, although this assumes you’re not running through hundreds of files and are maybe making some other changes, as well. You would type “**:**” to go to the command line and then type the string shown below. As with **sed**, the **^M** portion of this command requires typing **Ctrl+V** to get the **^** and then **Ctrl+M** to insert the **M**. The **%s** is a substitute operation, the slashes again separate the characters we want to remove and the text (nothing) we want to replace it with. The “**g**” (global) means to do this on every line in the file. + +``` +:%s/^M//g +``` + +#### Wrap-up + +The **dos2unix** command is probably the easiest to remember and most reliable way to remove carriage returns from text files. Other options are a little trickier to use, but they provide the same basic function. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438857/how-to-remove-carriage-returns-from-text-files-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/kmsiever/5895380540/in/photolist-9YXnf5-cNmpxq-2KEvib-rfecPZ-9snnkJ-2KAcDR-dTxzKW-6WdgaG-6H5i46-2KzTZX-7cnSw7-e3bUdi-a9meh9-Zm3pD-xiFhs-9Hz6YM-ar4DEx-4PXAhw-9wR4jC-cihLcs-asRFJc-9ueXvG-aoWwHq-atwL3T-ai89xS-dgnntH-5en8Te-dMUDd9-aSQVn-dyZqij-cg4SeS-abygkg-f2umXt-Xk129E-4YAeNn-abB6Hb-9313Wk-f9Tot-92Yfva-2KA7Sv-awSCtG-2KDPzb-eoPN6w-FE9oi-5VhaNf-eoQgx7-eoQogA-9ZWoYU-7dTGdG-5B1aSS +[2]: https://www.youtube.com/playlist?list=PL7D2RMSmRO9J8OTpjFECi8DJiTQdd4hua +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190919 An introduction to audio processing and machine learning using Python.md b/sources/tech/20190919 An introduction to audio processing and machine learning using Python.md new file mode 100644 index 0000000000..67b4779680 --- /dev/null +++ b/sources/tech/20190919 An introduction to audio processing and machine learning using Python.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An introduction to audio processing and machine learning using Python) +[#]: via: (https://opensource.com/article/19/9/audio-processing-machine-learning-python) +[#]: author: (Jyotika Singh https://opensource.com/users/jyotika-singhhttps://opensource.com/users/jroakeshttps://opensource.com/users/don-watkinshttps://opensource.com/users/clhermansenhttps://opensource.com/users/greg-p) + +An introduction to audio processing and machine learning using Python +====== +The pyAudioProcessing library classifies audio into different categories +and genres. +![abstract illustration with black background][1] + +At a high level, any machine learning problem can be divided into three types of tasks: data tasks (data collection, data cleaning, and feature formation), training (building machine learning models using data features), and evaluation (assessing the model). Features, [defined][2] as "individual measurable propert[ies] or characteristic[s] of a phenomenon being observed," are very useful because they help a machine understand the data and classify it into categories or predict a value. + +![Machine learning at a high level][3] + +Different data types use very different processing techniques. Take the example of an image as a data type: it looks like one thing to the human eye, but a machine sees it differently after it is transformed into numerical features derived from the image's pixel values using different filters (depending on the application). + +![Data types and feature formation in images][4] + +[Word2vec][5] works great for processing bodies of text. It represents words as vectors of numbers, and the distance between two word vectors determines how similar the words are. If we try to apply Word2vec to numerical data, the results probably will not make sense. + +![Word2vec for analyzing a corpus of text][6] + +So, there are processing techniques specific to the audio data type that works well with audio. + +### What are audio signals? + +Audio signals are signals that vibrate in the audible frequency range. When someone talks, it generates air pressure signals; the ear takes in these air pressure differences and communicates with the brain. That's how the brain helps a person recognize that the signal is speech and understand what someone is saying. + +There are a lot of MATLAB tools to perform audio processing, but not as many exist in Python. Before we get into some of the tools that can be used to process audio signals in Python, let's examine some of the features of audio that apply to audio processing and machine learning. + +![Examples of audio terms to learn][7] + +Some data features and transformations that are important in speech and audio processing are Mel-frequency cepstral coefficients ([MFCCs][8]), Gammatone-frequency cepstral coefficients (GFCCs), Linear-prediction cepstral coefficients (LFCCs), Bark-frequency cepstral coefficients (BFCCs), Power-normalized cepstral coefficients (PNCCs), spectrum, cepstrum, spectrogram, and more. + +We can use some of these features directly and extract features from some others, like spectrum, to train a machine learning model. + +### What are spectrum and cepstrum? + +Spectrum and cepstrum are two particularly important features in audio processing. + +![Spectrum and cepstrum][9] + +Mathematically, a spectrum is the [Fourier transform][10] of a signal. A Fourier transform converts a time-domain signal to the frequency domain. In other words, a spectrum is the frequency domain representation of the input audio's time-domain signal. + +A [cepstrum][11] is formed by taking the log magnitude of the spectrum followed by an inverse Fourier transform. This results in a signal that's neither in the frequency domain (because we took an inverse Fourier transform) nor in the time domain (because we took the log magnitude prior to the inverse Fourier transform). The domain of the resulting signal is called the quefrency. + +### What does this have to do with hearing? + +The reason we care about the signal in the frequency domain relates to the biology of the ear. Many things must happen before we can process and interpret a sound. One happens in the cochlea, a fluid-filled part of the ear with thousands of tiny hairs that are connected to nerves. Some of the hairs are short, and some are relatively longer. The shorter hairs resonate with higher sound frequencies, and the longer hairs resonate with lower sound frequencies. Therefore, the ear is like a natural Fourier transform analyzer! + +![How the ear works][12] + +Another fact about human hearing is that as the sound frequency increases above 1kHz, our ears begin to get less selective to frequencies. This corresponds well with something called the Mel filter bank. + +![MFCC][13] + +Passing a spectrum through the Mel filter bank, followed by taking the log magnitude and a [discrete cosine transform][14] (DCT) produces the Mel cepstrum. DCT extracts the signal's main information and peaks. It is also widely used in JPEG and MPEG compressions. The peaks are the gist of the audio information. Typically, the first 13 coefficients extracted from the Mel cepstrum are called the MFCCs. These hold very useful information about audio and are often used to train machine learning models. + +Another filter inspired by human hearing is the Gammatone filter bank. This filter bank is used as a front-end simulation of the cochlea. Thus, it has many applications in speech processing because it aims to replicate how we hear. + +![GFCC][15] + +GFCCs are formed by passing the spectrum through Gammatone filter bank, followed by loudness compression and DCT. The first (approximately) 22 features are called GFCCs. GFCCs have a number of applications in speech processing, such as speaker identification. + +Other features useful in audio processing tasks (especially speech) include LPCC, BFCC, PNCC, and spectral features like spectral flux, entropy, roll off, centroid, spread, and energy entropy. + +### Building a classifier + +As a quick experiment, let's try building a classifier with spectral features and MFCC, GFCC, and a combination of MFCCs and GFCCs using an open source Python-based library called [pyAudioProcessing][16]. + +To start, we want pyAudioProcessing to classify audio into three categories: speech, music, or birds. + +![Segmenting audio into speech, music, and birds][17] + +Using a small dataset (50 samples for training per class) and without any fine-tuning, we can gauge the potential of this classification model to identify audio categories. + +![MFCC of speech, music, and bird signals][18] + +Next, let's try pyAudioProcessing on a music genre classification problem using the [GZTAN][19] audio dataset and audio features: MFCC and spectral features. + +![Music genre classification][20] + +Some genres do well while others have room for improvement. Some things that can be explored from this data include: + + * Data quality check: Is more data needed? + * Features around the beat and other aspects of music audio + * Features other than audio, like transcription and text + * Would a different classifier be better? There has been research on using neural networks to classify music genres. + + + +Regardless of the results of this quick test, it is evident that these features get useful information out of the signal, a machine can work with them, and they form a good baseline to work with. + +### Learn more + +Here are some useful resources that can help in your journey with Python audio processing and machine learning: + + * [pyAudioAnalysis][21] + * [pyAudioProcessing][16] + * [Power-normalized cepstral coefficients (PNCC) for robust speech recognition][22] + * [LPCC features][23] + * [Speech recognition using MFCC][24] + * [Speech/music classification using block-based MFCC features][25] + * [Musical genre classification of audio signals][26] + * Libraries for reading audio in Python: [SciPy][27], [pydub][28], [libROSA][29], pyAudioAnalysis + * Libraries for getting features: libROSA, pyAudioAnalysis (for MFCC); pyAudioProcessing (for MFCC and GFCC) + * Basic machine learning models to use on audio: sklearn, hmmlearn, pyAudioAnalysis, pyAudioProcessing + + + +* * * + +_This article is based on Jyotika Singh's presentation "[Audio processing and ML using Python][30]" from PyBay 2019._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/audio-processing-machine-learning-python + +作者:[Jyotika Singh][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/jyotika-singhhttps://opensource.com/users/jroakeshttps://opensource.com/users/don-watkinshttps://opensource.com/users/clhermansenhttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/FeedbackLoop.png?itok=l7Sa9fHt (abstract illustration with black background) +[2]: https://en.wikipedia.org/wiki/Feature_(machine_learning) +[3]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_1.png (Machine learning at a high level) +[4]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_1a.png (Data types and feature formation in images) +[5]: https://en.wikipedia.org/wiki/Word2vec +[6]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_2b.png (Word2vec for analyzing a corpus of text) +[7]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_4.png (Examples of audio terms to learn) +[8]: https://en.wikipedia.org/wiki/Mel-frequency_cepstrum +[9]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_5.png (Spectrum and cepstrum) +[10]: https://en.wikipedia.org/wiki/Fourier_transform +[11]: https://en.wikipedia.org/wiki/Cepstrum +[12]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_6.png (How the ear works) +[13]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_7.png (MFCC) +[14]: https://en.wikipedia.org/wiki/Discrete_cosine_transform +[15]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_8.png (GFCC) +[16]: https://github.com/jsingh811/pyAudioProcessing +[17]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_10.png (Segmenting audio into speech, music, and birds) +[18]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_11.png (MFCC of speech, music, and bird signals) +[19]: http://marsyas.info/downloads/datasets.html +[20]: https://opensource.com/sites/default/files/uploads/audioprocessing-ml_12.png (Music genre classification) +[21]: https://github.com/tyiannak/pyAudioAnalysis +[22]: http://www.cs.cmu.edu/~robust/Papers/OnlinePNCC_V25.pdf +[23]: https://link.springer.com/content/pdf/bbm%3A978-3-319-17163-0%2F1.pdf +[24]: https://pdfs.semanticscholar.org/3439/454a00ef811b3a244f2b0ce770e80f7bc3b6.pdf +[25]: https://pdfs.semanticscholar.org/031b/84fb7ae3fae3fe51a0a40aed4a0dcb55a8e3.pdf +[26]: https://pdfs.semanticscholar.org/4ccb/0d37c69200dc63d1f757eafb36ef4853c178.pdf +[27]: https://www.scipy.org/ +[28]: https://github.com/jiaaro/pydub +[29]: https://librosa.github.io/librosa/ +[30]: https://pybay.com/speaker/jyotika-singh/ diff --git a/sources/tech/20190919 Why it-s time to embrace top-down cybersecurity practices.md b/sources/tech/20190919 Why it-s time to embrace top-down cybersecurity practices.md new file mode 100644 index 0000000000..2a8d17b1b1 --- /dev/null +++ b/sources/tech/20190919 Why it-s time to embrace top-down cybersecurity practices.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why it's time to embrace top-down cybersecurity practices) +[#]: via: (https://opensource.com/article/19/9/cybersecurity-practices) +[#]: author: (Matt ShealyAnderson Silva https://opensource.com/users/mshealyhttps://opensource.com/users/asnaylorhttps://opensource.com/users/ansilvahttps://opensource.com/users/bexelbiehttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/alanfdoss) + +Why it's time to embrace top-down cybersecurity practices +====== +An open culture doesn't mean being light on security practices. Having +executives on board with cybersecurity, including funding it adequately, +is critical for protecting and securing company data. +![Two different business organization charts][1] + +Cybersecurity is no longer just the domain of the IT staff putting in firewalls and backing up servers. It takes a commitment from the top and a budget to match. The stakes are high when it comes to keeping your customers' information safe. + +The average cost of a data breach in 2018 was $148 for each compromised record. That equals an average cost of [$3.86 million per breach][2]. Because it takes organizations more than six months—196 days on average—to detect breaches, a lot of remediation must happen after discovery. + +With compliance regulations in most industries tightening and stricter security rules, such as the [General Data Protection Regulation][3] (GDPR) becoming law, breaches can lead to large fines as well as loss of reputation. + +To build a cybersecurity solution from the top down, you need to build a solid foundation. This foundation should be viewed not as a technology problem but as a governance issue. Tech solutions will play a role, but it takes more than that—it starts with building a culture of safety. + +### Build a cybersecurity culture + +"A chain is no stronger than its weakest link," Thomas Reid wrote back in 1786. The message still applies when it comes to cybersecurity today. Your systems are only as secure as your least safety-conscious team member. One lapse, by one person, can compromise your data. + +It's important to build a culture where all team members understand the importance of cybersecurity. Security is not just the IT department's job. It is everyone's responsibility. + +Training is a continuous responsibility. When new team members are on-boarded, they need to be trained in security best practices. When team members leave, their access must be restricted immediately. As team members get comfortable in their positions, there should be [strong policies, procedures, and training][4] to keep them safety conscious. + +### Maintain secure systems + +Corporate policies and procedures will establish a secure baseline for your systems. It's important to maintain strict adherence as systems expand or evolve. Secure network design must match these policies. + +A secure system will be able to filter all incoming traffic at the network perimeter. Only traffic required to support your organization should be allowed to get through this perimeter. Unfortunately, threats sometimes still get in. + +Zero-day attacks are increasing in number, and more threat actors are exploiting known defects in software. In 2018, more than [three-quarters of successful endpoint attacks exploited zero-day flaws][5]. While it's difficult to guard against unknown threats, you can minimize your exposure by strictly applying updates and patches immediately when they're released. + +### Manage user privileges + +By limiting each individual user's access and privileges, companies can utilize micro-segmenting to minimize potential damage done by a possible attack. If an attack does get through your secure perimeter, this will limit the number of areas the attacker has access to. + +User access should be limited to only the privileges they need to do their jobs, especially when it comes to sensitive data. Most breaches start with email phishing. Unsuspecting employees click on a malicious link or are tricked into giving up their login credentials. The less access employees have, the less damage a hacker can do. + +Identity and access management (IAM) systems can deploy single sign-on (SSO) to reduce the number of passwords users need to access systems by using an authentication token accepted by different apps. Multi-factor authentication practices combined with reducing privileges can lower risk to the entire system. + +### Implement continuous monitoring + +Your security needs [continuous monitoring across your enterprise][6] to detect and prevent intrusion. This includes servers, networks, Software-as-a-Service (SaaS), cloud services, mobile users, third-party applications, and much more. In reality, it is imperative that every entry point and connection are continuously monitored. + +Your employees are working around the clock, especially if you are a global enterprise. They are working from home and working on the road. This means multiple devices, internet accesses, and servers, all of which need to be monitored. + +Likewise, hackers are working continuously to find any flaw in your system that could lead to a possible cyberattack. Don't wait for your next IT audit to worry about finding the flaws; this should be a continual process and high priority. + +### Conduct regular risk assessments + +Even with continuous monitoring, chief information security officers (CISOs) and IT managers should regularly conduct risk assessments. New devices, hardware, third-party apps, and cloud services are being added all the time. It's easy to forget how all these individual pieces, added one at a time, all fit into the big picture. + +The regularly scheduled, formal risk assessment should take an exhaustive look at infrastructure and access points. It should include penetration testing to identify potential threats. + +Your risk assessment should also analyze backups and data-recovery planning in case a breach occurs. Don't just set up your security and hope it works. Have a plan for what you will do if access is breached, know who will be responsible for what, and establish an expected timeline to implement your plan. + +### Pay attention to remote teams and BYOD users + +More team members than ever work remotely. Whether they are working on the road, at a remote location, or from home, they pose a cybersecurity risk. They are connecting remotely, which can [leave channels open for intrusion or data interception][7]. + +Team members often mix company devices and personal devices almost seamlessly. The advent of BYOD (bring your own device) means company assets may also be vulnerable to apps and software installed on personal devices. While you can manage what's on company devices, when employees check their company email from their personal phone or connect to a company server from their personal laptop, you've increased your overall risk. + +Personal devices and remote connections should always utilize a virtual private network (VPN). A VPN uses encrypted connections to the internet that create a private tunnel that masks the user's IP address. As Douglas Crawford, resident security expert at ProPrivacy.com, [explains][8], "Until the Edward Snowden revelations, people assumed that 128-bit encryption was in practice uncrackable through brute force. They believed it would be so for around another 100 years (taking Moore's Law into account). In theory, this still holds true. However, the scale of resources that the NSA seems willing to throw at cracking encryption has shaken many experts' faith in these predictions. Consequently, system administrators the world over are scrambling to upgrade cipher key lengths." + +### A top-down cybersecurity strategy is essential + +When it comes to cybersecurity, a top-down strategy is essential to providing adequate protection. Building a culture of cybersecurity throughout the organization, maintaining secure systems, and continuous monitoring are essential to safeguarding your systems and your data. + +A top-down approach means your IT department is not solely focused on your company's tech stack while management is solely focused on the company mission and objectives. These are no longer siloed departments; they are interwoven and dependent on each other to ensure success. + +Ultimately, success is defined as keeping your customer information safe and secure. Continuous monitoring and protection of sensitive information are critical to the success of the entire company. With top management on board with funding cybersecurity adequately, IT can ensure optimum security practices. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/cybersecurity-practices + +作者:[Matt ShealyAnderson Silva][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/mshealyhttps://opensource.com/users/asnaylorhttps://opensource.com/users/ansilvahttps://opensource.com/users/bexelbiehttps://opensource.com/users/mkalindepauleduhttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_orgchart2.png?itok=R_cnshU2 (Two different business organization charts) +[2]: https://securityintelligence.com/ponemon-cost-of-a-data-breach-2018/ +[3]: https://ec.europa.eu/info/law/law-topic/data-protection_en +[4]: https://us.norton.com/internetsecurity-how-to-cyber-security-best-practices-for-employees.html +[5]: https://www.ponemon.org/news-2/82 +[6]: https://digitalguardian.com/blog/what-continuous-security-monitoring +[7]: https://www.chamberofcommerce.com/business-advice/ransomeware-the-terrifying-threat-to-small-business +[8]: https://proprivacy.com/guides/the-ultimate-privacy-guide diff --git a/sources/tech/20190920 Deep Learning Based Chatbots are Smarter.md b/sources/tech/20190920 Deep Learning Based Chatbots are Smarter.md new file mode 100644 index 0000000000..f75089648b --- /dev/null +++ b/sources/tech/20190920 Deep Learning Based Chatbots are Smarter.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Deep Learning Based Chatbots are Smarter) +[#]: via: (https://opensourceforu.com/2019/09/deep-learning-based-chatbots-are-smarter/) +[#]: author: (Dharmendra Patel https://opensourceforu.com/author/dharmendra-patel/) + +Deep Learning Based Chatbots are Smarter +====== + +[![][1]][2] + +_Contemporary chatbots extensively use machine learning, natural language processing, artificial intelligence and deep learning. They are typically used in the customer service space for almost all domains. Chatbots based on deep learning are far better than traditional variants. Here’s why._ + +Chatbots are currently being used extensively to change customer behaviour. Usually, traditional artificial intelligence (AI) concepts are used in designing chatbots. However, modern applications generate such vast volumes of data that it becomes arduous to process this with traditional AI algorithms. +Deep learning is a subset of AI and is the most suitable technique to process large quantities of data. Deep learning based systems learn from copious data points. Systems like chatbots are the right contenders for deep learning as they require abundant data points to train the system to reach precise levels of performance. The main purpose of chatbots is to offer the most appropriate reply to any question or message that it receives. The ideal response from a chatbot has multiple aspects to it, such as: + + * It should be able to chat in a pragmatic manner + * Respond to the caller’s query + * Provide the corresponding, relevant information + * Raise follow up questions like in a real conversation + + + +Deep learning simulates the human mind for processing information. It works like the human brain by categorising a variety of information, and automatically discovers the features to be used to classify this information in a way that is perfect for chatbot systems. + +![Figure 1: Steps for designing chatbots using deep learning][3] + +**Steps for designing chatbots using deep learning** +The goal while designing chatbots using deep learning is to entirely automate the system to lessen the need for human management as much as possible. To achieve this, we need to completely replace all human experts with a chatbot, eradicating the need for client service representatives entirely. Figure 1 depicts the steps for designing chatbots using deep learning. + +The first step when designing a chatbot is to collect the existing interactions between clients and service representatives, in order to teach the machine the phrases that are important while interacting with customers. This is called ontology creation. + +The data preparation or data preprocessing is the next step in designing the chatbot. This consists of several steps such as tokenisation, stemming and lemmatising. This phase integrates grammar into machine understanding. + +The third step involves deciding on the appropriate model of the chatbot. There are two prominent models — retrieval based and generative. Retrieval models apply the repository of predefined responses while generative models are advanced versions of the retrieval model that use deep learning concepts. + +The next step is to decide on the appropriate technique to handle client interactions efficiently. +Now you are ready to design and implement the chatbot. Use the appropriate programming language for the implementation. Once it is implemented successfully, test it to uncover any bugs or errors. + +**Deep learning based models for chatbots** +Generative models are based on deep learning. They are the smartest models for chatbots but are very complicated to build and operate. They give the best response for any query as they use semantic similarity, which identifies the terms that have common characteristics. + +The Recurrent Neural Network (RNN) encoder-decoder is the ultimate generative model for chatbots, and consists of two RNNs. As an input, the encoder takes a sentence and processes one word at a time. It translates the series of the words into a predetermined size feature vector. It takes only significant words and removes the unnecessary ones. The encoder consists of a number of hidden layers in which one layer influences the other. The final hidden layer acts as a summary layer for the entire sentence. +The decoder, on the other hand, generates another series, one word at a time. The decoder is influenced by the context and by previously generated words. + +Generally, this model is best suited to fixed length sequences; however, before applying the training to the model, padding concepts are used to convert variable length series into fixed length series. For example: + +``` +Query : [P P P P P P “What” “About” “Placement” “ ?” ] +// Assume that the fixed length is 10.P is Padding +Response : [ SD “ It” “is” “Almost” “100%” END P P P P ] +// SD means start decoding. END means response is over. P is Padding +``` + +Word embedding is another important aspect of deep learning based chatbots. It captures the context of the word in the sentence, the semantic and syntactic similarities, as well as the relationship with other words. Word2Vec is a famous method to construct word embedding. There are two main techniques in Word2Vec and both are based on neural networks — continuous bag-of-words (CBOW) and continuous skip-gram. + +The continuous bag-of-words method is generally used as a tool of feature generation. A sentence is first converted into a bag of words. After that, various measures are calculated to characterise the sentence. + +The frequency is the main measure of the CBOW. It provides better accuracy for frequent words. The skip-gram method achieves the reverse of the CBOW method. It tries to predict the source context words from the target. It works well for fewer training data sets. + +The logic for the chatbots that use deep learning is as follows: +_Step 1:_ Build the corpus vocabulary. +_Step 2:_ Map a unique numeric identifier with each word. +_Step 3:_ Padding is done to the context words to keep their size fixed. +_Step 4:_ Make a pair of target words and surround the context words. +_Step 5:_ Build the deep learning architecture for the CBOW model. This involves the following sequence: + + * Input as context words + * Initialised with random weights + * Arrange the word embeddings + * Create a dense softmax layer + * Predict target word + * Match with actual target word + * Compute the loss + * Perform back propagation to update embedding layer +_Step 6:_ Train the model. +_Step 7:_ Test the model. + + + +![Figure 2: Encoder layers][4] + +![Figure 3: Decoder functioning][5] + +**Deep learning tools for chatbots** +TensorFlow is a great tool that uses deep learning. It uses linear regression to achieve effective conversation. We first need to develop a TensorFlow model by using JSON to recognise patterns. The next step is loading this framework and contextualising the data. TensorFlow makes chatbots realistic and very effective. + +Microsoft conversational AI tools are another important resource to design effective chatbots. These tools can be used to design, link, install and accomplish intelligent bots. The Microsoft Bot Builder software development kit (SDK) is ideal for the quick, free and easy development of chatbots with intelligence. + +Pytorch is an excellent open source library based on Python for applications like chatbots. The Optim module implements various algorithms based on neural networks, which are essential for the designing of efficient chatbots. It also provides the power of Tensors and so has the same functionalities as TensorFlow. +Chatbots are essential if organisations aim to deal with customers without any human intervention. As discussed, deep learning based chatbots are the better option compared to the traditional variants, as the former handle abundant data efficiently. And generative models for building chatbots are more appropriate in the modern context. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/deep-learning-based-chatbots-are-smarter/ + +作者:[Dharmendra Patel][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/dharmendra-patel/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-20-16-23-04.png?resize=696%2C472&ssl=1 (Screenshot from 2019-09-20 16-23-04) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-20-16-23-04.png?fit=706%2C479&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/1DL.png?resize=350%2C248&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/2DL.png?resize=350%2C72&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/3DL.png?resize=350%2C67&ssl=1 diff --git a/sources/tech/20190920 Euler-s Identity Really is a Miracle, Too.md b/sources/tech/20190920 Euler-s Identity Really is a Miracle, Too.md new file mode 100644 index 0000000000..2340130aaa --- /dev/null +++ b/sources/tech/20190920 Euler-s Identity Really is a Miracle, Too.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Euler's Identity Really is a Miracle, Too) +[#]: via: (https://theartofmachinery.com/2019/09/20/euler_formula_miracle.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Euler's Identity Really is a Miracle, Too +====== + +[A post about the exponential function being a miracle][1] did the rounds recently, and [the Hacker News comment thread][2] brought up some debate about the miracle of Euler’s famous identity: + +[e^{\pi i} + 1 = 0] + +A while back I used to make a living teaching this stuff to high school students and university undergrads. Let me give my personal take on what’s so special about Euler’s identity. + +### Complex numbers are already a miracle + +Let’s start with complex numbers. + +The first introduction to complex numbers is usually something like, “We don’t know what (\sqrt{- 1}) is, so let’s try calling it (i).” As it turns out, it works. [It works unreasonably well.][3] To see what I mean, imagine we tried to do the same thing with (\frac{1}{0}). We’ll let’s just make up a value for it called, say, (v). Now consider this old teaser: + +[\begin{matrix} {x = 2} & {,y = 2} \ {\therefore x} & {= y} \ {\text{(multiply\ by\ y)}\therefore{xy}} & {= y^{2}} \ {\text{(subtract\ x\ squared)}\therefore{xy} - x^{2}} & {= y^{2} - x^{2}} \ {\text{(factorise)}\therefore x(y - x)} & {= (y + x)(y - x)} \ {\text{(divide\ common\ factor)}\therefore x} & {= y + x} \ {\text{(subtract\ x)}\therefore 0} & {= y} \ {\therefore 0} & {= 2} \ \end{matrix}] + +(If you’re not sure about the factorisation, try expanding it.) Obviously (0 \neq 2), so where does this “proof” go wrong? At the point it assumes dividing by the (y - x) factor obeys the normal rules of algebra — it doesn’t because (y - x = 0). We can’t just quietly add (v) to our number system and expect any of our existing maths to work with it. On the other hand, it turns out we _can_ (for example) write quadratic equations using (i) and treat them just like quadratic equations using real numbers (even solving them with the same old quadratic formula). + +It gets better. As anyone who’s studied complex numbers knows, after we take the plunge and say (\sqrt{- 1} = i), we don’t need to invent new numbers for, e.g., (\sqrt{i}) (it’s (\frac{\pm (1 + i)}{2})). In fact, instead of going “[turtles all the way down][4]” naming new numbers, we discover that complex numbers actually fill more gaps in the real number system. In many ways, complex numbers work better than real numbers. + +### (e^{\pi i}) isn’t just a made up thing + +I’ve met a few engineers who think that (e^{\pi i} = - 1) and its generalisation (e^{\theta i} = \cos\theta + i\sin\theta) are just notation made up by mathematicians for conveniently modelling things like rotations. I think that’s a shame because Euler’s formula is a lot more surprising than just notation. + +Let’s look at some ways to calculate (e^{x}) for real numbers. With a bit of calculus, you can figure out this Taylor series expansion around zero (also known as a Maclaurin series): + +[\begin{matrix} e^{x} & {= 1 + x + \frac{x^{2}}{2} + \frac{x^{3}}{2 \times 3} + \frac{x^{4}}{2 \times 3 \times 4} + \ldots} \ & {= \sum\limits_{n = 0}^{\infty}\frac{x^{n}}{n!}} \ \end{matrix}] + +A neat thing about this series is that it’s easy to compare with [the series for sin and cos][5]. If you assume they work just as well for complex numbers as real numbers, it only takes simple algebra to show (e^{\theta i} = \cos\theta + i\sin\theta), so it’s the classic textbook proof. + +Unfortunately, if you try evaluating the series on a computer, you hit numerical stability problems. Here’s another way to calculate (e^{x}): + +[e^{x} = \lim\limits_{n\rightarrow\infty}\left( 1 + \frac{x}{n} \right)^{n}] + +Or, translated naïvely into a stupid approximation algorithm in computer code [1][6]: + +``` +import std.algorithm; +import std.range; + +double approxExp(double x, int n) pure +{ + return (1 + x / n).repeat(n).reduce!"a * b"; +} +``` + +Try plugging some numbers into this function, and you’ll see it calculates approximate values for (e^{x}) (though you might need `n` in the thousands to get good results). + +Now for a little leap of faith: That function only uses addition, division and multiplication, which can all be defined and implemented for complex numbers without assuming Euler’s formula. So what if you replace `double` with [a complex number type][7], assume everything’s okay mathematically, and try plugging in some numbers like (3.141593i)? Try it for yourself. Somehow everything starts cancelling out as (n) gets bigger and (x) gets closer to (\pi i), and you get something closer and closer to (- 1 + 0i). + +### (e) and (\pi) are miracles, too + +Because mathematicians prefer to write these constants symbolically, it’s easy to forget what they really are. Imagine the real number line stretching from minus infinity to infinity. There’s one notch slightly below 3, and another notch just above 3, and for deeper reasons, these two notches are special and keep turning up in seemingly unrelated places in maths. + +For example, take the series sum (\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \ldots). It doesn’t converge, but the sum to (n) terms (called the Harmonic function, or (H(n))) approximates (\log_{e}n). If you square the terms, the series converges, but this time (\pi) appears instead of (e): (\frac{1}{1^{2}} + \frac{1}{2^{2}} + \frac{1}{3^{2}} + \ldots = \frac{\pi^{2}}{6}). + +Here’s some more context for why the ubiquity of (e) and (\pi) is special. “The ratio of a circle’s circumference to its diameter” and “the square root of 2” are both numbers that can’t be written down as exact decimals, but at least we can describe them well enough to _define_ them exactly. Imagine some immortal creature tried listing all the numbers that can be mathematically defined. The list could start with all numbers that can be defined in under 10 characters, then all the numbers that can be defined in 10-20 characters, and so on. Obviously, that list never ends, but every definable number will appear on it somewhere, at some finite position. That’s what Georg Cantor called countably infinite, and he went on to prove ([using a simple diagonalisation argument][8]) that the set of real numbers is somehow infinitely bigger than that. That means most real numbers aren’t even definable. + +In other words, you could say maths with numbers is based on a sea of literally indescribable chaos. Thinking of it that way, it’s amazing that the five constants in Euler’s formula get us as far as they do. + +### Yes, the exponential function is a miracle + +I hinted that we can’t just assume that the Taylor series expansion for (e^{x}) works for complex numbers. Here are some examples that show what I mean. First, take the series expansion of (e^{- x^{2}}), the shape of the bell curve famous in statistics: + +[e^{- x^{2}} = 1 - x^{2} + \frac{x^{4}}{2} - \frac{x^{6}}{3!} + \frac{x^{8}}{4!} - \ldots] + +Of course, we can’t calculate the whole infinite sum, but we can approximate it by taking the first (n) terms. Here’s a plot of approximations taking successively more terms. We can see the bell shape after a few dozen terms, and the more terms we add, the better it gets: + +![][9] + +Okay, that’s a Taylor series doing what it’s supposed to. How about we try the same thing with another hump-shaped curve, (\frac{1}{1 + x^{2}})? + +![][10] + +This time it’s like there’s an invisible brick wall at (x = \pm 1). By adding more terms, we can get as close to perfect an approximation as we like, until (x) hits (\pm 1), then the approximation stops converging. The series just won’t work beyond that. But if Taylor expansion doesn’t always work for the whole real number line, can we take it for granted that the series for (e^{x}), (\sin x) and (\cos x) work for complex numbers? + +To get some more insight, we can colour in the places in the complex plane where the Taylor series for (\frac{1}{1 + x^{2}}) converges. It turns out we get a perfect circle of radius 1 centred at 0: + +![][11] + +There are two special points on the plane: (i) and (- i). At these points, (\frac{1}{1 + x^{2}}) turns into a (\frac{1}{0}) singularity, and the series expansion simply can’t work. It’s as if the convergence region expands out from 0 until it hits these singularity points and gets stuck. The funny thing is, these singularities in the complex plane limit how far the Taylor series can work, even when if we derive it using nothing but real analysis. + +It turns out that (e^{x}), (\sin x) and (\cos x) don’t have any problematic points in the complex plane, and that’s why we can easily use Taylor series to explore them beyond real numbers. + +This is yet another example of things making more sense when analysed with complex numbers, which only makes “real” numbers look like the odd ones out. Which raises another question: if [complex numbers are apparently fundamental to explaining the universe][12][2][13], why do we only experience real values? Obviously, the world would be a very different place if we could eat (i) slices of pizza, or if the flow of time had real and imaginary parts. But why the heck _not_? + +### Provably true things can still be surprising + +Of course, philosophy about the physical world aside, none of this is just luck. Maths is maths and there’s no alternative universe where things work differently. That’s because there are logical reasons why all this is true. + +But I don’t think that makes it less special. Arthur C. Clarke famously said that any sufficiently advanced technology is indistinguishable from magic, and I don’t think it should lose all magic as soon as someone, somewhere is smart enough to figure out how to make it work. Likewise, I don’t think mathematical theory becomes less special just because someone figures out a proof. On the contrary, it’s thanks to people wondering about these miraculous patterns that we have the calculus and complex analysis needed to understand how it all works. + + 1. A less-stupid version uses squaring instead of naïve exponentiation: `return (1 + z / (1< “A bridge is a network connection that combines multiple network adapters.” + +One excellent example for a bridge is combining the physical NIC with a virtual interface, like the one created and used for KVM virtualization. [Leif Madsen’s blog][13] has an excellent article on how to achieve this in the CLI. This can also be accomplished in Cockpit with just a few clicks. The example below will accomplish the first part of Leif’s blog using the web UI. We’ll bridge the enp9s0 interface with the virbr0 virtual interface. + +Click the **Add Bridge** button to launch the settings box. Provide a name and select the interfaces you would like to bridge. To enable **Spanning Tree Protocol (STP)**, click the box to the right of the label. Click the **Apply** button to finalize the configuration. + +As is consistent with teaming and bonding, selecting the bridge from the main screen will display the details of the interface. As seen in the example below, the physical device takes control and the virtual interface will adopt that device’s IP address. + +Select the individual interface in the bridge’s detail screen for more options. And once again, click the **Delete** button to remove the bridge. + +![][14] + +#### Adding VLANs + +Cockpit allows admins to create VLANs, or virtual networks, using any of the interfaces on the system. Click the **Add VLAN** button and select an interface. Furthermore, in the **Parent** drop-down list, assign the VLAN ID, and if you like, give it a new name. By default the name will be the same as the parent followed by a dot and the ID. For example, interface _enp11s0_ with VLAN ID _9_ will result in _enp11s0.9_). Click **Apply** to save the settings and to return to the networking main screen. Click the VLAN interface for further configuration. As always, click the **Delete** button to remove the VLAN. + +![][15] + +As we can see, Cockpit can help admins with common network configurations when managing the system’s connectivity. In the next article, we’ll explore how Cockpit handles user management and peek into the add-on 389 Directory Servers. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-network-interfaces-and-firewalld-in-cockpit/ + +作者:[Shaun Assam][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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-networking-816x345.jpg +[2]: https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-network-main-screen-1024x687.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-add-zone.gif +[5]: https://github.com/cockpit-project/cockpit/wiki/Feature:-Firewall +[6]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-add_remove-services.gif +[7]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interfaces-overview-1.gif +[8]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-bonding.gif +[9]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/sec-comparison_of_network_teaming_to_bonding +[10]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/networking_guide/ch-configure_network_teaming +[11]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-teaming.gif +[12]: https://fedoramagazine.org/build-network-bridge-fedora +[13]: http://blog.leifmadsen.com/blog/2016/12/01/create-network-bridge-with-nmcli-for-libvirt/ +[14]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-bridging.gif +[15]: https://fedoramagazine.org/wp-content/uploads/2019/09/cockpit-interface-vlans.gif diff --git a/sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md b/sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md new file mode 100644 index 0000000000..8c3df6da7e --- /dev/null +++ b/sources/tech/20190921 How to Remove (Delete) Symbolic Links in Linux.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Remove (Delete) Symbolic Links in Linux) +[#]: via: (https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Remove (Delete) Symbolic Links in Linux +====== + +You may have the opportunity to create or remove symbolic links on Linux. + +If yes, do you know how to do it? + +Have you already done that? Are you aware of that? + +If yes then there is no problem. If not, don’t worry, we are here to help you with this. + +This can be done using the rm and unlink commands. + +### What is Symbolic Link? + +A symbolic link, also known as a symlink or soft link, is a special type of file that points to another file or directory in Linux. + +It’s similar to a shortcut in Windows. + +It can point to a file or a directory on the same or a different filesystem or partition. + +In general Symbolic links are used to link libraries. Also, used to link log files and folders on mounted NFS (Network File System) shares. + +### What is rm Command? + +The **[rm command][1]** is used to remove files or directories. This is very dangerous and be cautious every time you use the rm command. + +### What is unlink Command? + +The unlink command is used to remove the specified file. It is already installed as it is part of the GNU Gorutils. + +### 1) How to Remove Symbolic Link Files Using the rm Command + +The rm command is one of the most frequently used commands in Linux. Furthermore, it allows us to remove the symbolic links as described below. + +``` +# rm symlinkfile +``` + +Always use the rm command with the “-i” switch to understand what is being done. + +``` +# rm -i symlinkfile1 +rm: remove symbolic link ‘symlinkfile1’? y +``` + +It also allows us to remove multiple symbolic links at once. + +``` +# rm -i symlinkfile2 symlinkfile3 + +rm: remove symbolic link ‘symlinkfile2’? y +rm: remove symbolic link ‘symlinkfile3’? y +``` + +### 1a) How to Remove Symbolic Link Directories Using the rm Command + +This is like removing a symbolic link file. + +Use the below command to remove Symbolic Link directory. + +``` +# rm -i symlinkdir + +rm: remove symbolic link ‘symlinkdir’? y +``` + +Use the below command to remove multiple Symbolic Link directory. + +``` +# rm -i symlinkdir1 symlinkdir2 + +rm: remove symbolic link ‘symlinkdir1’? y +rm: remove symbolic link ‘symlinkdir2’? y +``` + +If you add _**“/”**_ trailing slash at the end, the symbolic link directory cannot be deleted. If you add, you get an error. + +``` +# rm -i symlinkdir/ + +rm: cannot remove ‘symlinkdir/’: Is a directory +``` + +You may need to add the **“-r”** switch to deal with the above problem. If you add this, it will delete the contents of the target directory, while it will not delete the symbolic link directory. + +``` +# rm -ri symlinkdir/ + +rm: descend into directory ‘symlinkdir/’? y +rm: remove regular file ‘symlinkdir/file4.txt’? y +rm: remove directory ‘symlinkdir/’? y +rm: cannot remove ‘symlinkdir/’: Not a directory +``` + +### 2) How to Remove Symbolic Links Using the unlink Command + +The unlink command deletes a given file. It accepts only a single file at a time. + +To delete symbolic link file + +``` +# unlink symlinkfile +``` + +To delete symbolic link directory + +``` +# unlink symlinkdir2 +``` + +If you append the _**“/”**_ trailing slash at the end, you cannot remove the symbolic link directory using the unlink command. + +``` +# unlink symlinkdir3/ + +unlink: cannot unlink ‘symlinkdir3/’: Not a directory +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/remove-delete-symbolic-link-softlink-linux/ + +作者:[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/linux-remove-files-directories-folders-rm-command/ diff --git a/sources/tech/20190921 Top Open Source Video Players for Linux.md b/sources/tech/20190921 Top Open Source Video Players for Linux.md new file mode 100644 index 0000000000..df23a92668 --- /dev/null +++ b/sources/tech/20190921 Top Open Source Video Players for Linux.md @@ -0,0 +1,295 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top Open Source Video Players for Linux) +[#]: via: (https://itsfoss.com/video-players-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Top Open Source Video Players for Linux +====== + +_**Wondering which video player should you use on Linux? Here’s a list of top open source video players available for Linux distributions.**_ + +You can watch Hulu, Prime Video and/or [Netflix on Linux][1]. You can also [download videos from YouTube][2] and watch them later or if you are in a country where you cannot get Netflix and other streaming services, you may have to rely on torrent services like [Popcorn Time in Linux][3]. + +Watching movies/TV series or other video contents on computers is not an ‘ancient tradition’ yet. Usually, you go with the default video player that comes baked in with your Linux distribution (that could be anything). + +You won’t have an issue utilizing the default player – however, if you specifically want more open-source video player choices (or alternatives to the default one), you should keep reading. + +### Best Linux video players + +![][4] + +I have included the installation steps for Ubuntu but that shouldn’t make it the list of Ubuntu video players. These open source software should be available in any Linux distribution you are using. + +Installing the software + +Another note for Ubuntu users. You should have [universe repository enabled][5] in order to find and install these video players from the software center or by using command line. I have mentioned the commands but if you like, you can also install them from the Software Center. + +_Please keep in mind that the list is in no particular order of ranking._ + +#### 1\. VLC Media Player + +![][6] + +Key Highlights: + + * Built-in codecs + * Customization options + * Cross-platform + * Every video file format supported + * Extensions available for added functionalities + + + +[VLC Media Player][7] is unquestionably the most popular open source video player. Not just limited to Linux – but it’s a must-have video player for every platform (including Windows). + +It is a quite powerful video player capable of handling a variety of file formats and codecs. You can customize the look of it by using skins and enhance the functionalities with the help of certain extensions. Other features like [subtitle synchronization][8], audio/video filters, etc, exist as well. + +[VLC Media Player][7] + +#### How to install VLC? + +You can easily [install VLC in Ubuntu][9] from the Software Center or download it from the [official website][7]. + +If you’re utilizing the terminal, you will have to separately install the components as per your requirements by following the [official resource][10]. To install the player, just type in: + +``` +sudo apt install vlc +``` + +#### 2\. MPlayer + +![][11] + +Key Highlights: + + * Wide range of output drivers supported + * Major file formats supported + * Cross-platform + * Command-line based + + + +Yet another impressive open-source video player (technically, a video player engine). [MPlayer][12] may not offer you an intuitive user experience but it supports a wide range of output drivers and subtitle files. + +Unlike others, MPlayer does not offer a working GUI (it has one, but it doesn’t work as expected). So, you will have to utilize the terminal in order to play a video. Even though this isn’t a popular choice – it works and a couple of video players that I’ll be listing below are inspired (or based) from MPlayer but with a GUI. + +[MPlayer][12] + +#### How to install MPlayer? + +We already have an article on [installing MPlayer on Ubuntu and other Linux distros][13]. If you’re interested to install this, you should check it out. + +``` +sudo apt install mplayer mplayer-gui +``` + +#### 3\. SMPlayer + +![][14] + +Key Highlights: + + * Supports all major video formats + * Built-in codecs + * Cross-platform (Windows & Linux) + * Play ad-free YouTube video + * Opensubtitles integration + * UI Customization available + * Based on MPlayer + + + +As mentioned, SMPlayer uses MPlayer as the playback engine. So, it supports a wide range of file formats. In addition to all the basic features, it also lets you play YouTube videos from within the video player (by getting rid of the annoying ads). + +If you want to know about SMPlayer a bit more – we have a separate article here: [SMPlayer in Linux][15]. + +Similar to VLC, it also comes baked in with codecs, so you don’t have to worry about finding codecs and installing them to make it work unless there’s something specific you need. + +[SMPlayer][16] + +#### How to install SMPlayer? + +SMPlayer should be available in your Software Center. However, if you want to utilize the terminal, type in this: + +``` +sudo apt install smplayer +``` + +#### 4\. MPV Player + +![][17] + +Key Highlights: + + * Minimalist GUI + * Video codecs built in + * High-quality video output by video scaling + * Cross-platform + * YouTube Videos supported via CLI + + + +If you are looking for a video player with a streamlined/minimal UI, this is for you. Similar to the above-mentioned video players, we also have a separate article on [MPV Player][18] with installation instructions (if you’re interested to know more about it). + +Keeping that aside, it offers what you would expect from a standard video player. You can even try it on your Windows/Mac systems. + +[MPV Player][19] + +#### How to install MPV Player? + +You will find it listed in the Software Center or Package Manager. In either case, you can download the required package for your distro from the [official download page][20]. + +If you’re on Ubuntu, you can type in this in the terminal: + +``` +sudo apt install mpv +``` + +#### 5\. Dragon Player + +![][21] + +Key Highlights: + + * Simple UI + * Tailored for KDE + * Supports playing CDs and DVDs + + + +This has been specifically tailored for KDE desktop users. It is a dead-simple video player with all the basic features needed. You shouldn’t expect anything fancy out of it – but it does support the major file formats. + +[Dragon Player][22] + +#### How to install Dragon Player? + +You will find it listed in the official repo. In either case, you can type in the following command to install it via terminal: + +``` +sudo apt install dragonplayer +``` + +#### 6\. GNOME Videos + +![Totem Video Player][23] + +Key Highlights: + + * A simple video player for GNOME Desktop + * Plugins supported + * Ability to sort/access separate video channels + + + +The default video player for distros with GNOME desktop environment (previously known as Totem). It supports all the major file formats and also lets you take a snap while playing a video. Similar to some of the others, it is a very simple and useful video player. You can try it out if you want. + +[Gnome Videos][24] + +#### How to install Totem (GNOME Videos)? + +You can just type in “totem” to find the video player for GNOME listed in the software center. If not, you can also try utilizing the terminal with the following command: + +``` +sudo apt install totem +``` + +#### 7\. Deepin Movie + +![][25] + +If you are using [Deepin OS][26], you will find this as your default video player for Deepin Desktop Environment. It features all the basic functionalities that you would normally look in a video player. You can try compiling the source to install it if you aren’t using Deepin. + +[Deepin Movie][27] + +#### How to Install Deepin? + +You can find it in the Software Center. If you’d want to compile, the source code is available at [GitHub][28]. In either case, type in the following command in the terminal: + +``` +sudo apt install deepin-movie +``` + +#### 8\. Xine Multimedia Engine + +![][29] + +Key Higlights: + + * Customization available + * Subtitles supported + * Major file formats supported + * Streaming playback support + + + +Xine is an interesting portable media player. You can either choose to utilize the GUI or call the xine library from other applications to make use of the features available. + +It supports a wide range of file formats. You can customize the skin of the GUI. It supports all kinds of subtitles (even from the DVDs). In addition to this, you can take a snapshot while playing the video, which comes handy. + +[Xine Multimedia][30] + +#### How to install Xine Multimedia? + +You probably won’t find this in your Software Center. So, you can try typing this in your terminal to get it installed: + +``` +sudo apt install xine-ui +``` + +In addition to that, you can also check for available binary packages on their [official website][31]. + +**Wrapping Up** + +We would recommend you to try out these open source video players over anything else. In addition to all these, you can also try [Miro Player][32] which is no more being actively maintained but works – so you can give it a try, if nothing else works for you. + +However, if you think we missed one of your favorite Linux video player that deserves a mentioned, let us know about it in the comments down below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/video-players-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ +[2]: https://itsfoss.com/download-youtube-linux/ +[3]: https://itsfoss.com/popcorn-time-ubuntu-linux/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/Video-Players-for-Linux.png?ssl=1 +[5]: https://itsfoss.com/ubuntu-repositories/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/vlc-media-player.jpg?ssl=1 +[7]: https://www.videolan.org/vlc/ +[8]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/ +[9]: https://itsfoss.com/install-latest-vlc/ +[10]: https://wiki.videolan.org/Debian/#Debian +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2015/10/mplayer-video.jpg?ssl=1 +[12]: http://www.mplayerhq.hu/design7/news.html +[13]: https://itsfoss.com/mplayer/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/11/SMPlayer-coco.jpg?ssl=1 +[15]: https://itsfoss.com/smplayer/ +[16]: https://www.smplayer.info/en/info +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/08/mpv-player-interface.png?ssl=1 +[18]: https://itsfoss.com/mpv-video-player/ +[19]: https://mpv.io/ +[20]: https://mpv.io/installation/ +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/dragon-player.jpg?ssl=1 +[22]: https://kde.org/applications/multimedia/org.kde.dragonplayer +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/totem-video-player.png?ssl=1 +[24]: https://wiki.gnome.org/Apps/Videos +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/deepin-movie.jpg?ssl=1 +[26]: https://www.deepin.org/en/ +[27]: https://www.deepin.org/en/original/deepin-movie/ +[28]: https://github.com/linuxdeepin/deepin-movie-reborn +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/xine-multilmedia.jpg?ssl=1 +[30]: https://www.xine-project.org/home +[31]: https://www.xine-project.org/releases +[32]: http://www.getmiro.com/ diff --git a/translated/talk/20180117 How technology changes the rules for doing agile.md b/translated/talk/20180117 How technology changes the rules for doing agile.md new file mode 100644 index 0000000000..4c5b66f133 --- /dev/null +++ b/translated/talk/20180117 How technology changes the rules for doing agile.md @@ -0,0 +1,97 @@ +技术如何改变敏捷的规则 +====== + +![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO%20Containers%20Ecosystem.png?itok=lDTaYXzk) + +越来越多的企业正因为一个非常明显的原因开始尝试敏捷和[DevOps][1]: 企业需要通过更快的速度和更多的实验为创新和竞争性提供优势。而DevOps将帮助我们得到所需的创新速度。但是,在小团队或初创企业中实践DevOps与进行大规模实践完全是两码事。我们都明白这样的一个事实,那就是在10人的跨职能团队中能够很好地解决问题的方案,当将相同的模式应用到100人的团队中时就可能无法奏效。这条道路是如此艰难,以至于IT领导者很容易将敏捷方法的推行再推迟一年。 + +但那样的时代已经结束了。如果你已经尝试过,但是没有成功,那么现在是时候重新开始了。 + +直到现在,DevOps需要为许多组织提供个性化的解决方案,因此往往需要进行大量的调整以及付出额外的工作。但在今天,[Linux容器][2]和Kubernetes正在推动DevOps工具和过程的标准化。而这样的标准化将会加速整个软件开发过程。因此,我们用来实践DevOps工作方式的技术最终能够满足我们加快软件开发速度的愿望。 + +Linux容器和[Kubernetes][3]正在改变团队交互的方式。此外,你可以在Kubernetes平台上运行任何能够在Linux运行的应用程序。这意味着什么呢?你可以运行大量的企业及应用程序(甚至可以解决以前令人烦恼的Windows和Linux之间的协调问题)。最后,容器和Kubernetes将能够满足未来所有运行内容的需求。它们正在经受着未来的考验,以应对机器学习、人工智能和分析工作等下一代解决问题工具。 + +**[ 参考相关文章,[4 container adoption patterns: What you need to know. ] ][4]** + +让我们以机器学习为例来思考一下。今天,人们可以在大量的企业数据中找到一些模式。当机器发现这些模式时(想想机器学习),你的员工就能更快地采取行动。随着人工智能的加入,机器不仅可以发现模式,还可以对模式进行操作。如今,三个星期已经成为了一个积极的软件开发冲刺周期。有了人工智能,机器每秒可以多次修改代码。创业公司会利用这种能力来“打扰你”。 + +考虑一下你需要多快才能参与到竞争当中。如果你对于无法对于DevOps和每周一个迭代周期充满信心,那么考虑一下当那个创业公司将AI驱动的过程指向你时会发生什么?现在是时候转向DevOps的工作方式了,否认就会像你的竞争对手一样被甩在后面。 + +### 容器技术如何改变团队的工作? + +DevOps使得许多试图将这种工作方式扩展到更大范围的团队感到沮丧。即使许多IT(和业务)人员之前都听说过敏捷相关的语言、框架、模型(如DevOps)等承诺将会彻底应用程序开发和IT过程的全部相关内容,但他们还是对此持怀疑态度。 + +**[ 想要获取来自其他CIO们的建议吗?不放参考下我们的综述性资源, [DevOps: The IT Leader's Guide][5]. ]** + +向你的涉众“推销”快速开发冲刺也不是一件容易的事情。想象一下,如果你以这种方式买了一栋房子:你将不再需要向开发商支付固定的金额,而是会得到这样的信息:“我们将在4周内浇筑完地基,其成本是X,之后再搭建房屋框架和铺设电路,但是我们现在只能够知道地基完成的时间表。”人们已经习惯了买房子的时候有一个预先的价格和交付时间表。 + +挑战在于构建软件与构建房屋不同。同一个建筑商往往建造了成千上万个完全相同的房子,而软件项目从来都各不相同。这是你要克服的第一个障碍。 + +开发和运维团队的工作方式确实不同,我之所以知道这一点是因为我曾经从事过这两方面的工作。企业往往会用不同的方式来激励他们,开发人员会因为更改和创建而获得奖励,而运维专家则会因降低成本和确保安全性而获得奖励。我们会把他们分成不同的小组,并且尽量减少互动。而这些角色通常会吸引那些思维方式完全不同的技术人员。但是这样的解决方案注定会失败,你必须打破横亘在开发和运维之间的藩篱。 + +想想传统情况下会发生什么。业务会把需求扔过墙,这是因为他们在“买房”模式下运作,并且说上一句“我们9个月后见。”开发人员根据这些需求进行开发,并根据技术约束的需要进行更改。然后,他们把它扔过墙传递给运维人员,并说一句“搞清楚如何运行这个软件”。然后,运维人员勤就会奋地进行大量更改,使软件与基础设施保持一致。然而,最终的结果是什么呢? + +通常情况下,当业务人员看到需求实现的最终结果时甚至根本辨认不出。在过去20年的大部分时间里,我们一次又一次地目睹了这种模式在软件行业中上演。而现在,是时候改变了。 + +Linux容器能够真正地解决这样的问题,这是因为容器缩小了开发和运维之间的间隙。容器技术允许两个团队共同理解和设计所有的关键需求,但仍然独立地履行各自团队的职责。基本上,我们去掉了开发人员和运维人员之间的电话游戏。 + +因为容器技术,我们可以使得运维团队的规模更小,但依旧能够承担起数百万应用程序的运维工作,并且能够使得开发团队可以更加快速地根据需要更改软件。(在较大的组织中,所需的速度可能比运维人员的响应速度更快。) + +使用容器,您可以将所需要交付的内容与它运行的位置分开。你的运维团队只需要负责运行容器的主机和安全的内存占用,仅此而已。这意味着什么呢? + +首先,这意味着你现在可以和团队一起实践DevOps了。没错,只需要让团队专注于他们已经拥有的专业知识,而对于容器,只需让团队了解所需集成依赖关系的必要知识即可。 + +如果你想要重新训练每个人,往往会收效甚微。容器技术允许团队之间进行交互,但同时也会为每个团队提供一个围绕该团队优势而构建的强大边界。开发人员会知道需要消耗什么,但不需要知道如何使其大规模运行。运维团队了解核心基础设施,但不需要了解应用程序的细节。此外,运维团队也可以通过更新应用程序来解决新的安全问题,以免你成为下一个数据泄露的热门话题。 + +想要为一个大型IT组织,比如30000人的团队教授运维和开发技能?那或许需要花费你十年的时间,而你可能并没有那么多时间。 + +当人们谈论“构建新的云原生应用程序将帮助我们摆脱这个问题”时,请批判性地进行思考。你可以在10个人的团队中构建云原生应用程序,但这对《财富》杂志前1000强的企业而言或许并不适用。除非你不再需要依赖现有的团队,否则你无法一个接一个地构建新的微服务:你最终将得到一个竖井式的组织。这是一个诱人的想法,但你不能指望这些应用程序来重新定义你的业务。我还没见过哪家公司能在如此大规模的并行开发中获得成功。IT预算已经受到限制;在很长一段时间内将预算翻倍甚至三倍是不现实的。 + +### 当奇迹发生时: 你好, 速度 + +Linux容器就是为扩容而生的。一旦你开始这样做,[Kubernetes之类的编制工具就会发挥作用][6],这是因为你将需要运行数千个容器。应用程序将不仅仅由一个容器组成,它们将依赖于许多不同的部分,所有的部分都会作为一个单元运行在容器上。如果不这样做,你的应用程序将无法在生产环境中很好地运行。 + +思考一下有多少小滑轮和杠杆组合在一起来支撑你的业务,对于任何应用程序都是如此。开发人员负责应用程序中的所有滑轮和杠杆。(如果开发人员没有这些组件,您可能会在集成时做噩梦。)与此同时,无论是在线下还是在云上,运维团队都会负责构成基础设施的所有滑轮和杠杆。做一个较为抽象的比喻,使用Kubernetes,你的运维团队就可以为应用程序提供运行所需的燃料,但又不必成为所有方面的专家。 + +开发人员进行实验,运维团队则保持基础设施的安全和可靠。这样的组合使得企业敢于承担小风险,从而实现创新。不同于打几个孤注一掷的赌,公司中真正的实验往往是循序渐进的和快速的。 + +从个人经验来看,这就是组织内部发生的显著变化:因为人们说:“我们如何通过改变计划来真正地利用这种能力进行实验?”它强制执行敏捷计划。 + +举个例子,使用DevOps模型、容器和Kubernetes的KeyBank如今每天都会部署代码。(观看视频[7],其中主导了KeyBank持续交付和反馈的John Rzeszotarski将解释这一变化。)类似地,Macquarie银行也借助DevOps和容器技术每天将一些东西投入生产环境。 + +一旦你每天都推出软件,它就会改变你计划的每一个方面,并且会[加速业务的变化速度][8]。Macquarie银行和金融服务集团的CDO,Luis Uguina表示:“创意可以在一天内触达客户。”(参见[9]对Red Hat与Macquarie银行合作的案例研究)。 + +### 是时候去创造一些伟大的东西了 + +Macquarie的例子说明了速度的力量。这将如何改变你的经营方式?记住,Macquarie不是一家初创企业。这是CIO们所面临的颠覆性力量,它不仅来自新的市场进入者,也来自老牌同行。 + +开发人员的自由还改变了运营敏捷商店的CIO们的人才方程式。突然之间,大公司里的个体(即使不是在最热门的行业或地区)也可以产生巨大的影响。Macquarie利用这一变动作为招聘工具,并向开发人员承诺,所有新招聘的员工将会在第一周内推出新产品。 + +与此同时,在这个基于云的计算和存储能力的时代,我们比以往任何时候都拥有更多可用的基础设施。考虑到[机器学习和人工智能工具将很快实现的飞跃][10],这是幸运的。 + +所有这些都说明现在正是打造伟大事业的好时机。考虑到市场创新的速度,你需要不断地创造伟大的东西来保持客户的忠诚度。因此,如果你一直在等待将赌注押在DevOps上,那么现在就是正确的时机。容器技术和Kubernetes改变了规则,并且对你有利。 + +**想要获取更多这样的智慧吗, IT领导者? [订阅每周邮件][11].** + +-------------------------------------------------------------------------------- + +via: https://enterprisersproject.com/article/2018/1/how-technology-changes-rules-doing-agile + +作者:[Matt Hicks][a] +译者:[JayFrank](https://github.com/JayFrank) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://enterprisersproject.com/user/matt-hicks +[1]:https://enterprisersproject.com/tags/devops +[2]:https://www.redhat.com/en/topics/containers?intcmp=701f2000000tjyaAAA +[3]:https://www.redhat.com/en/topics/containers/what-is-kubernetes?intcmp=701f2000000tjyaAAA +[4]:https://enterprisersproject.com/article/2017/8/4-container-adoption-patterns-what-you-need-know?sc_cid=70160000000h0aXAAQ +[5]:https://enterprisersproject.com/devops?sc_cid=70160000000h0aXAAQ +[6]:https://enterprisersproject.com/article/2017/11/how-enterprise-it-uses-kubernetes-tame-container-complexity +[7]:https://www.redhat.com/en/about/videos/john-rzeszotarski-keybank-red-hat-summit-2017?intcmp=701f2000000tjyaAAA +[8]:https://enterprisersproject.com/article/2017/11/dear-cios-stop-beating-yourselves-being-behind-transformation +[9]:https://www.redhat.com/en/resources/macquarie-bank-case-study?intcmp=701f2000000tjyaAAA +[10]:https://enterprisersproject.com/article/2018/1/4-ai-trends-watch +[11]:https://enterprisersproject.com/email-newsletter?intcmp=701f2000000tsjPAAQ diff --git a/translated/talk/20190918 Microsoft brings IBM iron to Azure for on-premises migrations.md b/translated/talk/20190918 Microsoft brings IBM iron to Azure for on-premises migrations.md new file mode 100644 index 0000000000..fc37558b69 --- /dev/null +++ b/translated/talk/20190918 Microsoft brings IBM iron to Azure for on-premises migrations.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Microsoft brings IBM iron to Azure for on-premises migrations) +[#]: via: (https://www.networkworld.com/article/3438904/microsoft-brings-ibm-iron-to-azure-for-on-premises-migrations.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +微软将 IBM 大型机迁移至 Azure +====== +微软再次证明了其摒弃“非我发明”这一态度来支持客户。 +微软/ Just_Super / 盖蒂图片社 + +当微软将 Azure 作为其 Windows 操作系统基于云计算的版本发布时,它并没有使其成为仅支持 Windows 系统的版本。 它还支持 Linux 系统,并且在短短几年内 [Linux 实例的数量现在已经超过了Windows 实例的数量][1]. + +很高兴看到微软终于摆脱了这种长期以来非常有害的“非我发明”态度,该公司的最新举动确实令人惊讶。 + +微软与一家名为 Skytap 的公司合作,为 Azure 上的 IBM Power9 处理器提供在 Azure 内部运行的基于 Power的系统,该系统将与其已经提供的 Xeon 和 Epy c服务器共同作为 Azure 的虚拟机(VM)。 + + +**推荐阅读: [如何使混合云工作][2]** + +Skytap 是一家有趣的公司。它由华盛顿大学的三位教授创立,专门研究旧式本地硬件的云迁移,如 IBM I 或 Sparc处理器的云迁移。该公司在其家乡西雅图拥有一个数据中心,以 IBM 的硬件运行IBM 的 Power 虚拟机管理程序,并且对在美国和英格兰的IBM 数据中心提供主机托管。 + +该公司的座右铭是快速迁移,然后按照自己的节奏进行现代化。因此,它专注于帮助一些企业将数据源系统迁移到云,然后实现应用程序的现代化,这也是它与微软合作的目的。 Azure 将通过为企业提供平台来提高传统应用程序的价值,而无需花费巨额费用重写一个新平台。 + +Skytap 可以预览在 Skytap 上使用 DB2 提升和扩展原有 IBM i 应用程序以及通过 Azure 的物联网中心进行扩充时可能发生的情况。该应用程序无缝衔接新旧架构,并正明了不需要完全重写可靠的 IBM i 应用程序即可从现代云功能中受益。 + + +### 迁移到 Azure + +根据协议,微软将把IBM 的Power S922 服务器部署在未声明的 Azure 区域。 这些机器可以运行 Power 虚拟机的管理程序,这些管理程序支持原有IBM 操作系统以及 Linux 系统。 + +Skytap 首席执行官布拉德•希克(Brad Schick)在一份声明中说道:“ 通过先替换旧技术到云上既耗时又冒险。” “ Skytap的愿景一直是通过一些小小的改变和较低的风险实现企业系统到云平台的迁移。与微软合作,我们将为各种旧版应用程序迁移到 Azure 提供本地支持,包括那些在 IBM i,AIX 和 Linux Power 上运行的程序。这将使企业能够通过使用 Azure 服务进行现代化来延长传统系统的寿命并增加其价值。” + +随着基于 Power 应用程序的现代化,Skytap 随后将引入开发运维持续集成/持续交付工具链来加快软件的交付。 迁移到 Azure 上后,客户将能够集成 Azure 的开发运维,以及 Power 的持续集成/持续交付工具链,例如 Eradani 和 UrbanCode。 + +这些听起来像是迈出了第一步,但这意味着以后将会实现更多,尤其是在应用程序迁移方面。如果仅在一个 Azure 区域中,听起来好像它们正在对该项目进行测试和验证,并可能在今年晚些时候或明年进行扩展。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3438904/microsoft-brings-ibm-iron-to-azure-for-on-premises-migrations.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[Morisun029](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.openwall.com/lists/oss-security/2019/06/27/7 +[2]: https://www.networkworld.com/article/3119362/hybrid-cloud/how-to-make-hybrid-cloud-work.html#tk.nww-fsb +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/translated/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md new file mode 100644 index 0000000000..8455eb1d6d --- /dev/null +++ b/translated/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md @@ -0,0 +1,611 @@ + + + + +数码文件与文件夹收纳术(以照片为例) +====== +更新 2014-05-14:增加了一些具体实例 + +更新 2015-03-16:根据照片的 GPS 坐标过滤图片 + +更新 2016-08-29:以新的 `filetags--filter` (LCTT译注:文件标签过滤器)替换已经过时的 `show-sel.sh` 脚本(LCTT译注:show-sel 为 show firmware System Event Log records 即硬件系统事件及日志显示) + +更新 2017-08-28: geeqier 视频缩略图的邮件评论 + +每当度假或去哪游玩时我就会化身为一个富有激情的摄影师。所以,过去的几年中我积累了许多的 [JPEG][1] 文件。这篇文章中我会介绍我是如何避免[vendor lock-in][2](LCTT译注:vendor lock-in 供应商锁定,原为经济学术语,这里引申为避免过于依赖某一服务平台)造成受限于那些临时性的解决方案及数据丢失。相反,我更倾向于使用那些可以让我投入时间和精力打理并能长久使用的解决方案。 + +这一(相当长的)攻略 **并不仅仅适用于图像文件** :我将进一步阐述像是文件夹结构,文件的命名规则,等等许多领域的事情。因此,这些规范适用于我所能接触到的所以类型的文件。 + +在我开始传授我的方法之前,我们应该先就我将要介绍方法的达成一个共识,那就是我们是否有相同的需求。如果你对[raw 图像格式][3]十分推崇,将照片存储在云端或其他你信赖的地方(对我而言可能不会),那么你可能不会认同这篇文章将要描述的方式了。请根据你的情况来灵活做出选择。 + +### 我的需求 + +对于 **将照片(或视频)从我的数码相机中导出到电脑里**,我仅仅将 SD 卡茶道我的电脑里并调用 fetch-workflow 软件。这一步也完成了 **图像软件的预处理** 适用于我提出的文件命名规范(下文会具体论述)同时也可以将图片旋转至正常的方向(而不是横着)。 + +这些文件将会被存入到我的摄影收藏文件夹 `$HOME/tmp/digicam/`。 在这一文件夹中我希望能完成以下的操作 **浏览图像和视频文件** 以便于 **整理排序/删除,重命名,添加/移除标签,以及将一系列相关的文件移动到相应的文件夹中**。 + +在完成这些以后,我将会**浏览包含图像/电影文件集的文件夹**。在极少数情况下,我希望**在独立的图像处理工具**中打开一个图像文件,比如[GIMP][4]。如果仅是为了**旋转JPEG文件**,我想找到一个快速的方法,不需要图像处理工具,这是旋转JPEG图像[无损的方式][5]。 + +我的数码相机支持用[GPS][6]坐标标记图像。因此,我需要一个方法来**可视化GPS坐标的单个文件以及一组文件**显示我走过的路径。 + +我想安利的另一个好功能是:假设你在威尼斯度假时拍了几百张照片。每一个都很漂亮,所以你每张都舍不得删除。另一方面,你可能想要一组更小的照片,送给家里的朋友。而且,为了不让他们过于嫉妒,他们可能只希望看到20多张照片。因此,我希望能够**定义并显示一组特定的照片**。 + +就独立性和**避免锁定效应**而言,我不想使用那种一旦公司停止产品或服务就无法使用的工具。出于同样的原因,由于我是一个注重隐私的人,**我不想使用任何基于云的服务**。为了让自己对新的可能性保持开放的心态,我不希望仅在一个特定的操作系统平台上倾注全部的精力。**基本的东西必须在任何平台上可用**(查看、导航、……)。但是**全套需求必须在GNU/Linux上运行**且我选择Debian GNU/Linux。 + +在我传授当前针对上述大量需求的解决方案之前,我必须解释一下我的一般文件夹结构和文件命名约定,我也使用它来命名数码照片。但首先,你必须考虑一个重要的事实: + +#### iPhoto, Picasa, 诸如此类应被认为是有害的 + +管理照片集合的软件工具确实提供了相当酷的功能。他们提供了一个良好的用户界面,并试图为你提供各种需求的舒适的工作流程。 + +这些软件的功能和我的个人需求之间的差异很大。它们几乎对所有东西都使用专有的存储格式:图像文件、元数据等等。这是一个大问题,当你打算在几年内换一个不同的软件。相信我:总有一天你会因为多种原因而改变。 + +如果你现在正打算更换 相应的工具,你将会意识到iPhoto或Picasa确实分别存储原始图像文件和你对它们所做的所有操作。旋转图像,向图像文件添加描述,标签,裁剪,等等,如果你不能导出并重新导入到新工具,那么**所有的东西都将永远丢失**。而无损的进行转换和迁移几乎是不可能的。 + +我不想在一个锁住我工作的工具上投入任何精力。**我也拒绝把自己锁在任何专有工具上**。我是一个过来人,希望你们吸取我的经验。 + +这就是我在文件名中保留时间戳、图像描述或标记的原因。文件名是永久性的,除非我手动更改它们。当我把照片备份或复制到u盘或其他操作系统时,它们不会丢失。每个人都能读懂。任何未来的系统都能够处理它们。 + +### 我的文件命名约定 + +我所有的文件都与一个特定的日期或时间有关,根据所采用的[ISO 8601][7]规范,我采用的是**日期-标记**或**时间-标记** +带有日期戳和两个标签的示例文件名:`2014-05-09 42号项目的预算 -- 金融公司.csv` + +带有时间戳(甚至包括可选秒)和两个标签的示例文件名:`2014-05-09T22.19.58 Susan展示她的新鞋子 -- 家庭衣物.jpg` + +由于冒号不适用于Windows[文件系统NTFS][8],所以我必须使用已采用的ISO时间戳。因此,我用点代替冒号,以便将小时与分钟区别开来。 + +如果是**时间或日期持续时间**,我将两个日期或时间戳用两个负号分开:`2014-05-09—2014-05-13爵士音乐节Graz—folder 旅游音乐.pdf`。 + +文件名中的时间/日期戳的优点是,除非我手动更改它们,否则它们保持不变。当通过某些不处理这些元数据的软件进行处理时,包含在文件内容本身中的元数据(如[Exif][9])往往会丢失。此外,使用这样的日期/时间戳启动文件名可以确保文件按时间顺序显示,而不是按字母顺序显示。字母表是一种[完全人工的排序顺序][10],对于用户定位文件通常不太实用。 + +当我想将**tags**关联到文件名时,我将它们放在原始文件名和[文件名扩展名][11]之间,中间用空格、两个减号和一个额外的空格分隔"`--`"。我的标签是小写的英文单词,不包含空格或特殊字符。有时,我可能会使用`quantifiedself`或`usergenerated`等连接词。我[倾向于选择一般类别][12],而不是太过具体的描述标签。我用这一方式在Twitter [hashtags][13]上重用标记、文件名、文件夹名、书签、诸如此类的博客条目等等。 + +标签作为文件名的一部分有几个优点。通过使用常用的桌面搜索引擎,你可以在标签的帮助下定位文件。文件名称中的标签不能因为在不同的存储介质上复制而丢失。当系统使用与文件名不同的存储位置如:元数据数据库、[dot-files][14]、[备用数据流][15]等,通常会发生这种情况 + +当然,在一般的文件和文件夹名称中,**请避免使用特殊字符**,umlauts,冒号等。尤其是在不同操作系统平台之间同步文件时。 + +我的**文件夹名命名约定**与文件的相应规范相同。 + +注意:由于[Memacs][17]的[filenametimestamp][16]-module的聪明之处,所有带有日期/时间戳的文件和文件夹都在同一时间/天出现在我的组织模式日历(agenda)上。这样,我就能很好地了解当天发生了什么,包括我拍的所有照片。 + +### 我的一般文件夹结构 + +在本节中,我将描述主文件夹中最重要的文件夹。注意:这可能在将来的被移动到一个独立的页面。或许不是。让我们等着瞧:-) +很多东西只有在一定的时间内才会引起人们的兴趣。这些内容包括快速浏览其内容的下载、解压缩文件以检查包含的文件、一些有趣的小内容等等。对于**临时的东西**,我有 `$HOME/tmp/ ` 子层次结构。新照片放在`$HOME/tmp/digicam/`中。我从CD、DVD或USB记忆棒临时复制的东西放在`$HOME/tmp/fromcd/`中。每当软件工具需要用户文件夹层次结构中的临时数据时,我就使用` $HOME/tmp/Tools/ `作为起点。我经常使用的文件夹是`$HOME/tmp/2del/`:`2del`的意思是“随时可以删除”。例如,我所有的浏览器都使用这个文件夹作为默认的下载文件夹。如果我需要在机器上腾出空间,我首先查看这个`2del`-文件夹,用于删除内容。 + +与上面描述的临时文件相比,我当然也想将文件**保存更长的时间**。这些文件被移动到我的`$HOME/archive/`子层次结构中。它有几个子文件夹备份,web /下载我想保留,二进制文件我要存档,索引文件的可移动媒体(CD, DVD,记忆棒、外部硬盘驱动器),和一个文件夹用来存档(和寻找一个合适的的目标文件夹)在不久的将来。有时,我太忙或没有耐心的时候将文件妥善整理。是的,那就是我,我甚至有一个名为`现在不要整理我`的文件夹。这对你而言是否很怪?:-) + +我的归档中最重要的子层次结构是 `$HOME/archive/events_memories/ `及其子文件夹` 2014/ `、` 2013/ `、` 2012/ `等等。正如你可能已经猜到的,每个年份有一个**子文件夹**。其中每个文件中都有单个文件和文件夹。这些文件是根据我在前一节中描述的文件名约定命名的。文件夹名称符合“YYYY-MM-DD”[ISO 8601][7] 日期标签开头,后面跟着一个具有描述性的名称,如`$HOME/archive/events_memories/2014/2014-05-08 Business marathon with /`。在这些与日期相关的文件夹中,我保存着各种与特定事件相关的文件:照片、(扫描的)pdf文件、文本文件等等。 + +对于**共享数据**,我设置一个`$HOME/share/`子层次结构。这是我的Dropbox文件夹,我用各种各样的方法(比如[unison][18])来分享数据。我也在我的设备之间共享数据:家里的Mac Mini,家里的GNU/Linux笔记本,Android手机,root-server(我的个人云),工作时的windows笔记本。我不想在这里详细说明我的同步设置。如果你想了解相关的设置,可以参考另一篇相关的文章。:-) + +在我的` $HOME/ templates_tags / `子层次结构中,我保存了各种**模板文件** ([LaTeX][19], 脚本,…),剪辑和**logos**,等等。 + +我的**Org-mode**文件,主要是保存在`$ HOME /org/`。我练习保持记忆,并没有解释我有多喜欢 [Emacs/Org-mode][20]以及这我从中获益多少。你可能读过或听过我详细描述我用它做的很棒的事情。具体可以在我的博客上查找[我的' emacs '标签][21],在twitter上查找[hashtag ' #orgmode '][22]。 + +以上就是我最重要的文件夹子层次结构设置方式。 + +### 我的工作流程 + +Tataaaa,在你了解了我的文件夹结构和文件名约定之后,下面是我当前的工作流程和工具,我使用它们来满足我前面描述的需求。 +请注意,**你必须知道你在做什么**。我这里的示例及文件夹路径和更多只**适用我的机器或我的设置的文件夹路径。**你必须采用**相应的路径、文件名等**来满足你的需求! + +#### 工作流程:将文件从SD卡移动到笔记本电脑,旋转人像图像,并重命名文件 + +当我想把数据从我的数码相机移到我的GNU/Linux笔记本上时,我拿出它的mini sd存储卡,把它放在我的笔记本上。然后它会自动挂载在` /media/digicam `上。 + +然后,调用[getdigicamdata]。它做了如下几件事:它将文件从SD卡移动到一个临时文件夹中进行处理。原始文件名会转换为小写字符。使用[jhead][24]旋转所有人像照片。同样使用jhead,我从Exif头时间戳生成文件名称时间戳。使用[date2name][25],我将时间戳添加到电影文件中。处理完所有这些文件后,它们将被移动到新的digicam文件的目标文件夹:$HOME/tmp/digicam/tmp/~。 + +#### 工作流程:文件夹索引、查看、重命名、删除图像文件 + +为了快速浏览我的图像和电影文件,我更喜欢在GNU/Linux上使用[geeqie][26]。这是一个相当轻量级的图像浏览器,它具有其他文件浏览器所缺少的一大优势:我可以通过键盘快捷方式调用的外部脚本/工具。通过这种方式,我可以通过任意的外部命令扩展图像浏览器的特性。 + +基本的图像管理功能是内置在geeqie:索引我的文件夹层次结构,在窗口模式或全屏查看图像(快捷键' f '),重命名文件名,删除文件,显示Exif元数据(快捷键` Ctrl-e `)。 + +在OS X上,我使用[Xee][27]。与geeqie不同,它不能通过外部命令进行扩展。不过,基本的导航、查看和重命名功能也是可用的。 + +#### 工作流:添加和删除标签 + +我创建了一个名为[filetags][28]的Python脚本,用于向单个文件以及一组文件添加和删除标记。 + +对于数码照片,我使用标签,例如,`specialL`用于我认为适合桌面背景的风景图片,`specialP`用于我想展示给其他人的人像照片,`sel`用于筛选,等等。 + +##### 使用geeqie初始设置文件标签 + +向geeqie添加文件标签是一个手动步骤:`编辑>首选项>配置编辑器…`然后创建一个带有`New`的附加条目。在这里,你可以定义一个新的桌面文件,如下所示: + +add-tags.desktop +``` +[Desktop Entry] +Name=filetags +GenericName=filetags +Comment= +Exec=/home/vk/src/misc/vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; + +``` + +包装器脚本的`vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh `是必须的,因为我想要弹出一个新的终端,以便添加标签到我的文件: + +vk-filetags-interactive-adding-wrapper-with-gnome-terminal.sh +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=85x15+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/filetags/filetags.py --interactive "${@}" + +#end + +``` + +在geeqie中,你可以在` Edit > Preferences > Preferences…>键盘`。我将`t`与`filetags`命令相关联。 + +标签脚本还能够从单个文件或一组文件中删除标记。它基本上使用与上面相同的方法。唯一的区别是文件标签脚本额外的`--remove`参数: + +remove-tags.desktop +``` +[Desktop Entry] +Name=filetags-remove +GenericName=filetags-remove +Comment= +Exec=/home/vk/src/misc/vk-filetags-interactive-removing-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; + +``` + +vk-filetags-interactive-removing-wrapper-with-gnome-terminal.sh +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=85x15+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/filetags/filetags.py --interactive --remove "${@}" + +#end + +``` + +为了删除标签,我为`T`参数创建了一个键盘快捷方式。 + +##### 在geeqie中使用文件标签 + +当我在geeqie文件浏览器中浏览图像文件时,我选择要标记的文件(一到多个)并按`t`。然后,一个小窗口弹出,要求我提供一个或多个标签。在与` Return `确认后,这些标签被添加到文件名中。 + +删除标签也是一样:选择多个文件,按下`T`,输入要删除的标签,然后用`Return`确认。就是这样。几乎没有[更简单的方法来添加或删除标签到文件][29]。 + +#### 工作流:使用appendfilename重命名高级文件 + +##### 不使用 appendfilename + +重命名一组大型文件可能是一个冗长乏味的过程。对于`2014-04-20T17.09.11_p1100386.jpg`这样的原始文件名,在文件名中添加描述的过程相当烦人。你将按`Ctrl-r`(重命名)在geeqie打开文件重命名对话框。默认情况下,原始名称(没有文件扩展名的文件名称)被标记。因此,如果不希望删除/覆盖文件名(但要追加),则必须按下光标键` `。然后,光标放在基本名称和扩展名之间。输入你的描述(不要忘记初始空格字符),并用`Return`进行确认。 + +##### 在geeqie使中用appendfilename + +使用[appendfilename][30],我的过程得到了简化,可以获得将文本附加到文件名的最佳用户体验:当我在geeqie中按下` a ` (append)时,会弹出一个对话框窗口,询问文本。在`Return`确认后,输入的文本将放置在时间戳和可选标记之间。 + +例如,当我在`2014-04-20T17.09.11_p1100386.jpg`上按下`a`,然后在`Graz`中键入`Pick-nick in Graz`时,文件名变为`2014-04-20T17.09.11_p1100386 Pick-nick in Graz.jpg`。当我再次按下`a`并输入`with Susan`时,文件名变为`2014-04-20T17.09.11_p1100386 Pick-nick in Graz with Susan.jpg`。当文件名也获得标记时,附加的文本将附加在标记分隔符之前。 + +这样,我就不必担心覆盖时间戳或标记。重命名的过程对我来说变得更加有趣! + +最好的部分是:当我想要将相同的文本添加到多个选定的文件中时,也可以使用appendfilename。 + +##### 使用geeqie初始appendfilename + +添加一个额外的编辑器到geeqie: ` Edit > Preferences > Configure editor…>New`。然后输入桌面文件定义: + +appendfilename.desktop +``` +[Desktop Entry] +Name=appendfilename +GenericName=appendfilename +Comment= +Exec=/home/vk/src/misc/vk-appendfilename-interactive-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; + +``` + +同样,我也使用了一个包装脚本,它将为我打开一个新的终端: + +vk-appendfilename-interactive-wrapper-with-gnome-terminal.sh +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=90x5+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/appendfilename/appendfilename.py "${@}" + +#end + +``` + +#### 工作流程:播放电影文件 + +在GNU/Linux上,我使用[mplayer][31]回放视频文件。由于geeqie本身不播放电影文件,所以我必须创建一个设置,以便在mplayer中打开电影文件。 + +##### 在geeqie中初始化mplayer的设置 + +我已经使用[xdg-open][32]将电影文件扩展名关联到mplayer。因此,我只需要为geeqie创建一个通用的“open”命令,使用xdg-open打开任何文件及其关联的应用程序。 + +再次访问` Edit > Preferences > Configure editor…`在geeqie中添加`open`的条目: + +open.desktop +``` +[Desktop Entry] +Name=open +GenericName=open +Comment= +Exec=/usr/bin/xdg-open %F +Icon= +Terminal=true +Type=Application +hidden=false +NOMimeType=*; +MimeType=image/*;video/* +Categories=X-Geeqie; + +``` + +当你还将快捷方式`o`(见上文)与geeqie关联时,你就能够打开与其关联的应用程序的视频文件(和其他文件)。 + +##### 使用xdg-open打开电影文件(和其他文件) + +在上面的设置过程之后,当你的geeqie光标位于文件上方时,你只需按下`o`即可。就是如此简洁。 + +#### 工作流:在外部图像编辑器中打开 + +我不太希望能够在GIMP中快速编辑图像文件。因此,我添加了一个快捷方式`g`,并将其与外部编辑器“GNU图像处理程序”(GIMP)关联起来,geeqie已经默认创建了该程序 + +这样,只需按下`g`就可以打开GIMP中的当前图像。 + +#### 工作流程:移动到存档文件夹 + +现在我已经在我的文件名中添加了注释,我想将单个文件移动到`$HOME/archive/events_memories/2014/`,或者将一组文件移动到这个文件夹中的新文件夹中,如`$HOME/archive/events_memories/2014/2014-05-08 business marathon after show - party`。 + +通常的方法是选择一个或多个文件,并将它们移动到具有快捷方式`Ctrl-m`的文件夹中。 + +何等繁复无趣之至! + +因此,我(再次)编写了一个Python脚本,它为我完成了这项工作:[move2archive][33](简而言之:` m2a `需要一个或多个文件作为命令行参数。然后,出现一个对话框,我可以在其中输入一个可选文件夹名。当我不输入任何东西,但按`Return`,文件被移动到相应年份的文件夹。当我输入一个类似`business marathon after show - party`的文件夹名称时,第一个图像文件的日期戳被附加到该文件夹(`$HOME/archive/events_memories/2014/2014-05-08 business marathon after show - party`),得到的文件夹是(`$HOME/archive/events_memories/2014/2014-05-08 Business-Marathon After-Show-Party`),并移动文件。 + +再一次:我在geeqie中,选择一个或多个文件,按`m`(移动),或者只按`Return`(没有特殊的子文件夹),或者输入一个描述性文本,这是要创建的子文件夹的名称(可选不带日期戳)。 + +**没有一个图像管理工具像我的geeqie一样通过快捷键快速且有趣的使用 appendfilename和move2archive完成工作。** + +##### 在geeqie里初始化m2a的相关设置 + +同样,向geeqie添加`m2a`是一个手动步骤:“编辑>首选项>配置编辑器……”然后创建一个带有“New”的附加条目。在这里,你可以定义一个新的桌面文件,如下所示: + +m2a.desktop +``` +[Desktop Entry] +Name=move2archive +GenericName=move2archive +Comment=Moving one or more files to my archive folder +Exec=/home/vk/src/misc/vk-m2a-interactive-wrapper-with-gnome-terminal.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; + +``` +包装器脚本的`vk-m2a-interactive-wrapper-with-gnome-terminal.sh `是必要的,因为我想要弹出一个新的终端窗口,以便我的文件进入我指定的目标文件夹: + +vk-m2a-interactive-wrapper-with-gnome-terminal.sh +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=157x56+330+5 \ + --tab-with-profile=big \ + --hide-menubar \ + -x /home/vk/src/m2a/m2a.py --pauseonexit "${@}" + +#end + +``` + +在geeqie中,你可以在`Edit > Preferences > Preferences ... > Keyboard`将`m`与`m2a`命令相关联。 + +#### 工作流程:旋转图像(无损) + +通常,我的数码相机会自动将人像照片标记为人像照片。然而,在某些特定的情况下(比如从主题上方拍照),我的相机会出错。在那些**罕见的情况下**,我必须手动修正方向。 + +你必须知道,JPEG文件格式是一种有损格式,应该只用于照片,而不是计算机生成的东西,如屏幕截图或图表。以傻瓜方式旋转JPEG图像文件通常会解压/可视化图像文件,旋转生成新的图像,然后重新编码结果。这将导致生成的图像[比原始图像质量差得多][5]。 + +因此,你应该使用无损方法来旋转JPEG图像文件。 + +再一次,我添加了一个“外部编辑器”到geeqie:`Edit > Preferences > Configure Editors ... > New`。在这里,我添加了两个条目:一个用于旋转270度(即逆时针旋转90度),另一个用于使用[exiftran][34]旋转90度(逆时针旋转90度): + +rotate-270.desktop +``` +[Desktop Entry] +Version=1.0 +Type=Application +Name=Losslessly rotate JPEG image counterclockwise + +# call the helper script +TryExec=exiftran +Exec=exiftran -p -2 -i -g %f + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# Show in menu "Edit/Orientation" +X-Geeqie-Menu-Path=EditMenu/OrientationMenu + +MimeType=image/jpeg; + +``` + +rotate-90.desktop +``` +[Desktop Entry] +Version=1.0 +Type=Application +Name=Losslessly rotate JPEG image clockwise + +# call the helper script +TryExec=exiftran +Exec=exiftran -p -9 -i -g %f + +# Desktop files that are usable only in Geeqie should be marked like this: +Categories=X-Geeqie; +OnlyShowIn=X-Geeqie; + +# Show in menu "Edit/Orientation" +X-Geeqie-Menu-Path=EditMenu/OrientationMenu + +# It can be made verbose +# X-Geeqie-Verbose=true + +MimeType=image/jpeg; + +``` + +我为“[”(逆时针方向)和“]”(逆时针方向)创建了geeqie快捷键。 + +#### 工作流程:可视化GPS坐标 + +我的数码相机有一个GPS传感器,它在JPEG文件的Exif元数据中存储当前的地理位置。位置数据以[WGS 84][35]格式存储,如“47,58,26.73;16、23、55.51”(纬度;经度)。这一方式可读性较差,从我所期望的意义上讲:要么是地图,要么是位置名称。因此,我向geeqie添加了一些功能,这样我就可以在[OpenStreetMap][36]上看到单个图像文件的位置: `Edit > Preferences > Configure Editors ... > New` + +photolocation.desktop +``` +[Desktop Entry] +Name=vkphotolocation +GenericName=vkphotolocation +Comment= +Exec=/home/vk/src/misc/vkphotolocation.sh %F +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-gray;image/x-icb;image/x-ico;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/x-pcx;image/svg+xml;image/svg+xml-compressed;image/vnd.wap.wbmp; + +``` + +这就调用了我的名为`vkphotolocation.sh`的包装脚本,它使用[ExifTool][37]让[Marble][38]能够读取和可视化的适当格式并提取坐标: + +vkphotolocation.sh +``` +#!/bin/sh + +IMAGEFILE="${1}" +IMAGEFILEBASENAME=`basename ${IMAGEFILE}` + +COORDINATES=`exiftool -c %.6f "${IMAGEFILE}" | awk '/GPS Position/ { print $4 " " $6 }'` + +if [ "x${COORDINATES}" = "x" ]; then + zenity --info --title="${IMAGEFILEBASENAME}" --text="No GPS-location found in the image file." +else + /usr/bin/marble --latlon "${COORDINATES}" --distance 0.5 +fi + +#end + +``` + +映射到键盘快捷键“G”,我可以快速地得到**单个图像文件的映射位置位置**。 + +当我想将多个JPEG图像文件的**位置可视化为路径**时,我使用[GpsPrune][39]。我无法派生出GpsPrune将一组文件作为命令行参数的方法。正因为如此,我必须手动启动GpsPrune,`选择一组文件或一个文件夹>添加照片`。 + +通过这种方式,我可以为OpenStreetMap地图上的每个JPEG位置获得一个点(如果配置为这样)。通过单击这样一个点,我可以得到相应图像的详细信息。 + +如果你恰好在国外拍摄照片,可视化GPS位置对**在文件名中添加描述**大有帮助! + +#### 工作流程:根据GPS坐标过滤照片 + +这并非我的工作流程。为了完整起见,我列出该工作流对应工具的特性。我想做的就是从一大堆图片中寻找那些在一定区域内(范围或点+距离)的照片。 + +到目前为止,我只找到了[DigiKam][40],它能够[根据矩形区域进行过滤][41]。如果你知道其他工具,请将其添加到下面的评论或写一封电子邮件。 + +#### 工作流:显示给定集合的子集 + +如上面的需求所述,我希望能够在一个文件夹中定义一组子文件,以便将这个小集合呈现给其他人。 + +工作流程非常简单:我向选择的文件添加一个标记(通过` t ` /filetags)。为此,我使用标记`sel`,它是“selection”的缩写。在标记了一组文件之后,我可以按下` s `,它与一个脚本相关联,该脚本只显示标记为` sel `的文件。 + +当然,这也适用于任何标签或标签组合。因此,用同样的方法,你可以得到一个适当的概述,你的婚礼上的所有照片都标记着“教堂”和“戒指”。 + +很棒的功能,不是吗?:-) + +##### 根据标签和geeqie初始设置文件标签 + +你必须定义一个额外的“外部编辑器”:`Edit > Preferences > Configure Editors ... > New`: + +filter-tags.desktop +``` +[Desktop Entry] +Name=filetag-filter +GenericName=filetag-filter +Comment= +Exec=/home/vk/src/misc/vk-filetag-filter-wrapper-with-gnome-terminal.sh +Icon= +Terminal=true +Type=Application +Categories=Application;Graphics; +hidden=false +MimeType=image/*;video/*;image/mpo;image/thm +Categories=X-Geeqie; + +``` + +再次调用我编写的包装脚本: + +vk-filetag-filter-wrapper-with-gnome-terminal.sh +``` +#!/bin/sh + +/usr/bin/gnome-terminal \ + --geometry=85x15+330+5 \ + --hide-menubar \ + -x /home/vk/src/filetags/filetags.py --filter + +#end + +``` + +带参数`--filter`的`filetags`基本上完成的是:用户被要求输入一个或多个标签。然后,当前文件夹中所有匹配的文件都能使用[符号链接][42]都链接到` $HOME/.filetags_tagfilter/ `。然后,启动一个新的geeqie实例,显示链接的文件。 + +在退出这个新的geeqie实例之后,你将从该实例调用了选择过程中看到旧的geeqie实例。 + +#### 用一个真实的案例来总结 + +Wow, 这是一篇很长的博客文章。难怪你可能已经忘了之前的概述。总结一下我在geeqie(扩展了标准功能集)中可以做的事情,我有一个很酷的总结: + +快捷功能 `m` m2a `o` 打开(针对非图像文件) `a` 在文件名里添加字段 `t` 文件标签(添加) `T` 文件标签(删除) `s` 文件标签(排序) `g` gimp `G` 显示GPS信息 `[` 无损的逆时针旋转 `]` 无损的顺时针旋转 `Ctrl-e` EXIF图像信息 `f` 全屏显示 + +一些针对文件名的(包括它的路径)及我用来操作组件的示例: +``` + /this/is/a/folder/2014-04-20T17.09 Pick-nick in Graz -- food graz.jpg + [ m2a ] [ date2name ] [ appendfilename ] [filetags] + +``` +在示例中,我按照以下步骤将照片从相机保存到存档:我将SD存储卡放入计算机的SD卡读卡器中。然后我运行[getdigicamdata.sh][23]。完成之后,我在geeqie中打开`$HOME/tmp/digicam/tmp/`。我浏览了一下照片,把那些不成功的删除了。如果有一个图像的方向错误,我用`[`or`]`纠正它。 + +在第二步中,我向我认为值得评论的文件添加描述(` a `)。每当我想添加标签时,我也这样做:我快速地标记所有应该共享标签的文件(` Ctrl ` \+鼠标点击),并使用[filetags][28] (` t `)进行标记。 + +要组合来自给定事件的文件,我选中相应的文件,将它们移动到年度归档文件夹中的“event-folder”,并通过在[move2archive][33] (`m `)中键入事件描述,其余的(非特殊的文件夹)由move2archive (`m `)直接移动到年度归档中,而不需要声明事件描述。 + +为了完成我的工作流程,我删除了SD卡上的所有文件,把它从操作系统上弹出,然后把它放回我的数码相机里。 + +以上。 + +因为这种工作流程几乎不需要任何开销,所以评论、标记和归档照片不再是一项乏味的工作。 + +### 最后 + +所以,这是一个详细描述我关于照片和电影的工作流程的叙述。你可能已经发现了我可能感兴趣的其他东西。所以请不要犹豫,请使用下面的链接留下评论或电子邮件。 +我也希望得到反馈,如果我的工作流程适用于你。并且:如果你已经发布了你的工作流程或者找到了其他人工作流程的描述,也请留下评论! +及时行乐,莫让错误的工具或低效的方法浪费了我们的人生! + +### 其他工具 + +阅读关于[本文中关于 gThumb 的部分][43]. + +当你觉得你以上文中所叙述的符合你的需求时,请根据相关的建议来选择对应的工具。 + +### 邮件回复 + +> Date: Sat, 26 Aug 2017 22:05:09 +0200 + +> 你好卡尔, +我喜欢你的文章,喜欢和memacs一起工作,当然还有orgmode,但是我对python不是很熟悉……在你的博客文章“管理数码照片”,你写了关于打开视频与[Geeqie][26]。是的,但是我在浏览器里看不到任何视频缩略图。你有什么建议吗? + +> 谢谢你,托马斯 + + + +你好托马斯, + +谢谢你的美言。当有人发现我的工作对他/她的生活有用时,我总是感觉很棒。 +不幸的是,大多数时候,我从未听到过这些。 +是的,我有时使用Geeqie来可视化文件夹,这些文件夹不仅包含图像文件,还包含电影文件。在这些情况下,我没有看到任何视频的缩略图。你说得对,有很多文件浏览器可以显示视频的预览图像。 +坦白地说,我从来没有想过视频缩略图,我也不怀念它们。在我的首选项和搜索引擎上做了一个快速的研究,并没有发现在Geeqie中启用视频预览的相关方法。所以这里要说声抱歉。 + + + +-------------------------------------------------------------------------------- + +via: http://karl-voit.at/managing-digital-photographs/ + +作者:[Karl Voit][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://karl-voit.at +[1]:https://en.wikipedia.org/wiki/Jpeg +[2]:http://en.wikipedia.org/wiki/Vendor_lock-in +[3]:https://en.wikipedia.org/wiki/Raw_image_format +[4]:http://www.gimp.org/ +[5]:http://petapixel.com/2012/08/14/why-you-should-always-rotate-original-jpeg-photos-losslessly/ +[6]:https://en.wikipedia.org/wiki/Gps +[7]:https://en.wikipedia.org/wiki/Iso_date +[8]:https://en.wikipedia.org/wiki/Ntfs +[9]:https://en.wikipedia.org/wiki/Exif +[10]:http://www.isisinform.com/reinventing-knowledge-the-medieval-controversy-of-alphabetical-order/ +[11]:https://en.wikipedia.org/wiki/File_name_extension +[12]:http://karl-voit.at/tagstore/en/papers.shtml +[13]:https://en.wikipedia.org/wiki/Hashtag +[14]:https://en.wikipedia.org/wiki/Dot-file +[15]:https://en.wikipedia.org/wiki/NTFS#Alternate_data_streams_.28ADS.29 +[16]:https://github.com/novoid/Memacs/blob/master/docs/memacs_filenametimestamps.org +[17]:https://github.com/novoid/Memacs +[18]:http://www.cis.upenn.edu/~bcpierce/unison/ +[19]:https://github.com/novoid/LaTeX-KOMA-template +[20]:http://orgmode.org/ +[21]:http://karl-voit.at/tags/emacs +[22]:https://twitter.com/search?q%3D%2523orgmode&src%3Dtypd +[23]:https://github.com/novoid/getdigicamdata.sh +[24]:http://www.sentex.net/%3Ccode%3Emwandel/jhead/ +[25]:https://github.com/novoid/date2name +[26]:http://geeqie.sourceforge.net/ +[27]:http://xee.c3.cx/ +[28]:https://github.com/novoid/filetag +[29]:http://karl-voit.at/tagstore/ +[30]:https://github.com/novoid/appendfilename +[31]:http://www.mplayerhq.hu +[32]:https://wiki.archlinux.org/index.php/xdg-open +[33]:https://github.com/novoid/move2archive +[34]:http://manpages.ubuntu.com/manpages/raring/man1/exiftran.1.html +[35]:https://en.wikipedia.org/wiki/WGS84#A_new_World_Geodetic_System:_WGS_84 +[36]:http://www.openstreetmap.org/ +[37]:http://www.sno.phy.queensu.ca/~phil/exiftool/ +[38]:http://userbase.kde.org/Marble/Tracking +[39]:http://activityworkshop.net/software/gpsprune/ +[40]:https://en.wikipedia.org/wiki/DigiKam +[41]:https://docs.kde.org/development/en/extragear-graphics/digikam/using-kapp.html#idp7659904 +[42]:https://en.wikipedia.org/wiki/Symbolic_link +[43]:http://karl-voit.at/2017/02/19/gthumb diff --git a/translated/tech/20171226 Top 10 Microsoft Visio Alternatives for Linux.md b/translated/tech/20171226 Top 10 Microsoft Visio Alternatives for Linux.md deleted file mode 100644 index 575ab3045f..0000000000 --- a/translated/tech/20171226 Top 10 Microsoft Visio Alternatives for Linux.md +++ /dev/null @@ -1,240 +0,0 @@ -用于 Linux 中代替 Microsoft Visio 的十个最佳备选方案 -====== -**简介:如果您正在 Linux 中寻找一个好的 Visio 查看器,这里有一些可以在 Linux 中使用的 Microsoft Visio 的替代方案。** - -Microsoft Visio 是创建或生成关键任务图和矢量表示的绝佳工具。虽然它可能是制作平面图或其他类型图表的好工具 - 但它既不是免费的,也不是开源的 - -此外,Microsoft Visio 不是一个独立的产品。它与 Microsoft Office 捆绑在一起。我们过去已经看过 MS Office 的开源替代品。今天我们将看到您可以使用哪些工具代替 Linux 上的 Visio。 - -## 适用于 Linux 的最佳 Microsoft Visio 备选方案 - -![用于 Linux 的 Microsoft Visio 备选方案][4] - -此处为强制性免责声明。该列表不是排名。排名第三的产品并不比排名第六的好。 - -我还提到了一些可以从 Web 界面使用的非开源 Visio 软件。 - -| 软件| 输入| 许可证类型| -| LibreOffice Draw | 桌面软件| 免费和开源| -| OpenOffice Draw | 桌面软件| 免费和开源| -| Dia | 桌面软件| 免费和开源| -| yED图形编辑器| 桌面和基于网络| 免费增值| -| Inkscape | 桌面软件| 免费和开源| -| 铅笔| 桌面和基于网络| 免费和开源| -| Graphviz | 桌面软件| 免费和开源| -| darw.io | 桌面和基于网络| 免费和开源| -| Lucidchart | 基于网络| 免费增值| -| Calligra Flow | 桌面软件| 免费和开源| - - -### 1. LibreOffice Draw - -![][5] - -LibreOffice Draw 模块是 Microsoft Visio 的最佳开源替代方案之一。在它的帮助下,你可以选择制作一个想法的速写或一个复杂的专业平面布置图来展示。流程图,组织结构图,网络图,小册子,海报等等!所有这些都不需要花一分钱。 - -好的是它与 LibreOffice 捆绑在一起,默认情况下安装在大多数 Linux 发行版中。 - -#### 主要功能概述: - - * 用于制作宣传册/海报的样式和格式工具 - * Calc 数据可视化 - * PDF 文件编辑功能 - * 通过操作图库中的图片来创建相册 - * 灵活的绘图工具类似于 Microsoft Visio (智能连接器,尺寸线等)的工具 - * 支持 .VSD 文件(打开) - - - -[LibreOffice Draw][6] - -### 2. Apache OpenOffice Draw - -![][7] - -很多人都知道 OpenOffice ( LibreOffice 项目最初基于它),但他们并没有真正提到 Apache OpenOffice Draw 作为 Microsoft Visio 的替代方案。但事实上,它是另一个令人惊奇的开源图表软件工具。与 LibreOffice Draw 不同,它不支持编辑 PDF 文件,但它为任何类型的图表创建提供了绘图工具。 - -这只是个警告。仅当您的系统中已经有 OpenOffice 时才使用此工具。这是因为[安装 OpenOffice ][8] 是一件痛苦的事情,而且[不再继续开发][9]。 - -#### 主要功能概述: - - * 快速创建 3D 形状控制器 - * 创建(.swf)工作的 flash 版本 - * 样式和格式工具 - * 与M icrosoft Visio 类似的灵活绘图工具(智能连接器,尺寸线等) - - - -[Apache OpenOffice Draw][10] - -### 3. Dia - -![][11] - -Dia 是另一个有趣的开源工具。它可能不像前面提到的那样处于积极发展之中。但是,如果您正在寻找一个免费的,开源的替代 Microsoft Visio 的简单而体面的图表,那么 Dia 可能是您的选择。这个工具唯一让你失望的地方就是它的用户界面。除此之外,它还允许您为复杂的图使用强大的工具(但它看起来可能不太好——所以我们建议您使用更简单的图)。 - -#### 主要功能概述: - - * 它可以通过命令行使用 - * 样式和格式工具 - * 用于自定义形状的形状存储库 - * 与 Microsoft Visio 类似的绘图工具(特殊对象,网格线,图层等) - * 跨平台 - - - -[Dia][12] - -### 4. yED Graph Editor - -是最受欢迎的免费 Microsoft Visio 替代方案之一。如果你担心它是一个免费软件而不是开源项目,您仍然可以通过 web 浏览器免费使用 yED 的实时编辑器。如果您想用一个非常易于使用的界面快速绘制图表,这是最好的建议之一。 - -#### 主要功能概述: - - * 拖放功能,方便图表制作 - * 支持导入外部数据进行链接 - - - -[yED Graph Editor][14] - -### 5. Inkscape - -![][15] - -Inkscape 是一个免费的开源矢量图形编辑器。您将了解创建流程图或数据流程图的基本功能。它不提供高级的图表绘制工具,而是提供创建更简单图表的基本工具。因此,Inkscape 可能是您的 Visio 替代品,只有当您希望通过使用图库中的可用符号,在图库连接器工具的帮助下生成基本图时,才可以使用它。 - -#### 主要功能概述: - - * 连接器工具 - * 灵活的绘图工具 - * 广泛的文件格式兼容性 - - - -[Inkscape][16] - -### 6. Pencil Project - -![][17] - -Pencil Project 是一个令人印象深刻的开源项目,适用于 Windows 和 Mac 以及 Linux。它具有易于使用的 GUI,使绘图更容易和方便。一个很好的内建形状和符号的集合,使您的图表看起来很棒。它还内置了 Android 和 iOS UI 模板,可以让你在需要时创建应用程序原型。 - -您也可以将其安装为 Firefox 扩展,但该扩展不能使用项目的最新版本。 - -#### 主要功能概述: - - * 轻松浏览剪贴画(使用 openclipart.org) - * 导出为 ODT 文件/PDF 文件 - * 图表连接工具 - * 跨平台 - - -[Pencil Project][18] - -### 7. Graphviz - - -![][19] - -Graphviz 略有不同。它不是绘图工具,而是专用的图形可视化工具。如果您在网络图中需要多个设计来表示一个节点,那么一定要使用这个工具。当然,你不能用这个工具做平面布置图(至少这不容易)。因此,它最适合于网络图,生物信息学,数据库连接和类似的东西。 - -#### 主要功能概述: - - * 支持命令行使用 - * 支持自定义形状和表格节点布局 - * 基本样式和格式设置工具 - - - -[Graphviz][20] - -### 8. Draw.io - -Draw.io 主要是一个免费的基于 Web 的图表工具,它有强大的工具几乎可以制作任何类型的图表。您只需要拖放然后连接它们以创建流程图,ER 图或任何相关的。此外,如果您喜欢该工具,则可以尝试[离线桌面版本][21]。 - -**主要功能概述:** - - * 直接上传到云存储服务 - * 自定义形状 - * 样式和格式工具 - * 跨平台 - - - -[Draw.io][22] - -### 9. Lucidchart - -![][23] - -Lucidchart 是一个高级的基于 Web 的图表工具,它提供了一个具有有限功能的免费订阅。您可以使用免费订阅创建几种类型的图表,并将其导出为图像或 PDF。但是,免费版本不支持数据链接和 Visio 导入/导出功能。如果您不需要数据链接 Lucidchart 可以说是一个非常好的工具,同时可以生成漂亮的图表。 - -####主要功能概述: - - * 集成到 Slack,Jira 核心,Confluence - * 能够制作产品模型 - * 导入 Visio 文件 - - - -[Lucidchart][24] - -### 10. Calligra Flow - -![calligra flow][25] - -Calligra Flow 是[Calligra Project][26]的一部分,宗旨市提供免费和开源的软件工具。使用 Calligra flow 您可以轻松地创建网络图,实体关系图,流程图等 - -#### 主要功能概述: - - * 各种模具盒 - * 样式和格式工具 - - - -[Calligra Flow][27] - -### 总结 - -既然你已经知道了最好的免费和开源的 Visio 替代方案,你对它们有什么看法? - -在您任何方面的需求中,它们是否优于 Microsoft Visio?另外,如果我们错过了您最喜欢的基于 Linux 替代 Microsoft Visio 的绘图工具,请在下面的评论中告诉我们。 --------------------------------------------------------------------------------- - -via: https://itsfoss.com/visio-alternatives-linux/ - -作者:[Ankush Das][a] -译者:[ZhiW5217](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/ -[1]:https://products.office.com/en/visio/flowchart-software -[2]:https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ -[3]:data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs= -[4]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/visio-alternatives-linux-featured.png -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/libreoffice-draw-microsoft-visio-alternatives.jpg -[6]:https://www.libreoffice.org/discover/draw/ -[7]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/apache-open-office-draw.jpg -[8]:https://itsfoss.com/install-openoffice-ubuntu-linux/ -[9]:https://itsfoss.com/openoffice-shutdown/ -[10]:https://www.openoffice.org/product/draw.html -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/dia-screenshot.jpg -[12]:http://dia-installer.de/ -[13]:https://www.yworks.com/products/yed-live -[14]:https://www.yworks.com/products/yed -[15]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/inkscape-screenshot.jpg -[16]:https://inkscape.org/en/ -[17]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/pencil-project.jpg -[18]:http://pencil.evolus.vn/Downloads.html -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/graphviz.jpg -[20]:http://graphviz.org/ -[21]:https://about.draw.io/integrations/#integrations_offline -[22]:https://about.draw.io/ -[23]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/lucidchart-visio-alternative.jpg -[24]:https://www.lucidchart.com/ -[25]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/12/calligra-flow.jpg -[26]:https://www.calligra.org/ -[27]:https://www.calligra.org/flow/ diff --git a/sources/tech/20181227 Linux commands for measuring disk activity.md b/translated/tech/20181227 Linux commands for measuring disk activity.md similarity index 62% rename from sources/tech/20181227 Linux commands for measuring disk activity.md rename to translated/tech/20181227 Linux commands for measuring disk activity.md index badda327dd..1c93b212c4 100644 --- a/sources/tech/20181227 Linux commands for measuring disk activity.md +++ b/translated/tech/20181227 Linux commands for measuring disk activity.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,16 +7,16 @@ [#]: via: (https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -Linux commands for measuring disk activity +用于测量磁盘活动的 Linux 命令 ====== ![](https://images.idgesg.net/images/article/2018/12/tape-measure-100782593-large.jpg) -Linux systems provide a handy suite of commands for helping you see how busy your disks are, not just how full. In this post, we examine five very useful commands for looking into disk activity. Two of the commands (iostat and ioping) may have to be added to your system, and these same two commands require you to use sudo privileges, but all five commands provide useful ways to view disk activity. +Linux 系统提供了一套方便的命令,帮助您查看磁盘有多忙,而不仅仅是磁盘有多满。在本文中,我们将研究五个非常有用的命令,用于查看磁盘活动。其中两个命令(iostat 和 ioping)可能必须添加到您的系统中,这两个相同的命令要求您使用 sudo 特权,但是这五个命令都提供了查看磁盘活动的有用方法。 -Probably one of the easiest and most obvious of these commands is **dstat**. +这些命令中最简单、最明显的一个可能是 **dstat** 了。 ### dtstat -In spite of the fact that the **dstat** command begins with the letter "d", it provides stats on a lot more than just disk activity. If you want to view just disk activity, you can use the **-d** option. As shown below, you’ll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that after the first report, each subsequent row in the display will report disk activity in the following time interval, and the default is only one second. +尽管 **dstat** 命令以字母 "d" 开头,但它提供的统计信息远远不止磁盘活动。如果您只想查看磁盘活动,可以使用 **-d** 选项。如下所示,您将得到一个磁盘读/写测量值的连续列表,直到使用 a ^c 停止显示为止。注意,在第一个报告之后,显示中的每个后续行将在接下来的时间间隔内报告磁盘活动,缺省值仅为一秒。 ``` $ dstat -d @@ -29,7 +29,7 @@ $ dstat -d 0 0 ^C ``` -Including a number after the -d option will set the interval to that number of seconds. +在 -d 选项后面包含一个数字将把间隔设置为其秒数。 ``` $ dstat -d 10 @@ -41,9 +41,9 @@ $ dstat -d 10 0 9011B ^C ``` -Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes), and B (bytes). +请注意,报告的数据可能以许多不同的单位显示——例如,M (megabytes), k (kilobytes), and B (bytes). -Without options, the dstat command is going to show you a lot of other information as well — indicating how the CPU is spending its time, displaying network and paging activity, and reporting on interrupts and context switches. +如果没有选项,dstat 命令还将显示许多其他信息——指示 CPU 如何使用时间、显示网络和分页活动、报告中断和上下文切换。 ``` $ dstat @@ -55,11 +55,11 @@ usr sys idl wai stl| read writ| recv send| in out | int csw 0 1 99 0 0| 0 16k| 64B 468B| 0 0 | 64 81 ^C ``` -The dstat command provides valuable insights into overall Linux system performance, pretty much replacing a collection of older tools, such as vmstat, netstat, iostat, and ifstat, with a flexible and powerful command that combines their features. For more insight into the other information that the dstat command can provide, refer to this post on the [dstat][1] command. +dstat 命令提供了关于整个 Linux 系统性能的有价值的见解,几乎可以用它灵活而功能强大的命令来代替 vmstat,netstat,iostat 和 ifstat 等较旧的工具集合,该命令结合了这些旧工具的功能。要深入了解 dstat 命令可以提供的其它信息,请参阅这篇关于 [dstat][1] 命令的文章。 ### iostat -The iostat command helps monitor system input/output device loading by observing the time the devices are active in relation to their average transfer rates. It's sometimes used to evaluate the balance of activity between disks. +iostat 命令通过观察设备活动的时间与其平均传输速率之间的关系,帮助监视系统输入/输出设备的加载情况。它有时用于评估磁盘之间的活动平衡。 ``` $ iostat @@ -90,7 +90,7 @@ loop15 0.01 0.01 0.00 20026 0 loop16 0.00 0.00 0.00 24 0 ``` -Of course, all the stats provided on Linux loop devices can clutter the display when you want to focus solely on your disks. The command, however, does provide the **-p** option, which allows you to just look at your disks — as shown in the commands below. +当然,当您只想关注磁盘时,Linux loop 设备上提供的所有统计信息都会使结果显得杂乱无章。但是,该命令也确实提供了 **-p** 选项,该选项使您可以仅查看磁盘——如以下命令所示。 ``` $ iostat -p sda @@ -104,9 +104,9 @@ sda 1.06 0.89 72.54 2843737 232815784 sda1 1.04 0.88 72.54 2821733 232815784 ``` -Note that **tps** refers to transfers per second. +请注意 **tps** 是指每秒的传输量。 -You can also get iostat to provide repeated reports. In the example below, we're getting measurements every five seconds by using the **-d** option. +您还可以让 iostat 提供重复的报告。在下面的示例中,我们使用 **-d** 选项每五秒钟进行一次测量。 ``` $ iostat -p sda -d 5 @@ -121,7 +121,7 @@ sda 0.80 0.00 11.20 0 56 sda1 0.80 0.00 11.20 0 56 ``` -If you prefer to omit the first (stats since boot) report, add a **-y** to your command. +如果您希望省略第一个(自启动以来的统计信息)报告,请在命令中添加 **-y**。 ``` $ iostat -p sda -d 5 -y @@ -132,7 +132,7 @@ sda 0.80 0.00 11.20 0 56 sda1 0.80 0.00 11.20 0 56 ``` -Next, we look at our second disk drive. +接下来,我们看第二个磁盘驱动器。 ``` $ iostat -p sdb @@ -149,7 +149,7 @@ sdb1 0.00 0.01 0.00 35344 0 ### iotop -The **iotop** command is top-like utility for looking at disk I/O. It gathers I/O usage information provided by the Linux kernel so that you can get an idea which processes are most demanding in terms in disk I/O. In the example below, the loop time has been set to 5 seconds. The display will update itself, overwriting the previous output. +**iotop** 命令是类似 top 的实用程序,用于查看磁盘 I/O。它收集 Linux 内核提供的 I/O 使用信息,以便您了解哪些进程在磁盘 I/O 方面的要求最高。在下面的示例中,循环时间被设置为5秒。显示将自动更新,覆盖前面的输出。 ``` $ sudo iotop -d 5 @@ -167,7 +167,7 @@ Current DISK READ: 0.00 B/s | Current DISK WRITE: 12.39 K/s ### ioping -The **ioping** command is an altogether different type of tool, but it can report disk latency — how long it takes a disk to respond to requests — and can be helpful in diagnosing disk problems. +**ioping** 命令是一种完全不同的工具,但是它可以报告磁盘延迟——也就是磁盘响应请求需要多长时间,而这有助于诊断磁盘问题。 ``` $ sudo ioping /dev/sda1 @@ -184,7 +184,7 @@ min/avg/max/mdev = 831.0 us / 947.9 us / 1.17 ms / 158.0 us ### atop -The **atop** command, like **top** provides a lot of information on system performance, including some stats on disk activity. +**atop** 命令,像 **top** 一样提供了大量有关系统性能的信息,包括有关磁盘活动的一些统计信息。 ``` ATOP - butterfly 2018/12/26 17:24:19 37d3h13m------ 10ed @@ -212,7 +212,7 @@ NET | enp0s25 0% | pcki 10 | pcko 8 | si 1 Kbps | so 3 Kbp0.73 ms | 3362 0.00s 0.00s 0K 0K NE 0 0 E - 0% ``` -If you want to look at _just_ the disk stats, you can easily manage that with a command like this: +如果您 _只_ 想查看磁盘统计信息,则可以使用以下命令轻松进行管理: ``` $ atop | grep DSK @@ -228,11 +228,11 @@ DSK | sda | busy 2% | read 0 | write 92 | avio 2.43 ms | ^C ``` -### Being in the know with disk I/O +### 了解磁盘 I/O -Linux provides enough commands to give you good insights into how hard your disks are working and help you focus on potential problems or slowdowns. Hopefully, one of these commands will tell you just what you need to know when it's time to question disk performance. Occasional use of these commands will help ensure that especially busy or slow disks will be obvious when you need to check them. +Linux 提供了足够的命令,可以让您很好地了解磁盘的工作强度,并帮助您关注潜在的问题或慢速。希望这些命令中的一个可以告诉您何时需要质疑磁盘性能。偶尔使用这些命令将有助于确保当您需要检查磁盘,特别是忙碌或缓慢的磁盘时可以显而易见地发现它们。 -Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. +加入 [Facebook][2] 和 [LinkedIn][3] 上的 Network World 社区,对最重要的话题发表评论。 -------------------------------------------------------------------------------- @@ -240,7 +240,7 @@ via: https://www.networkworld.com/article/3330497/linux/linux-commands-for-measu 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md b/translated/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md new file mode 100644 index 0000000000..b80271af21 --- /dev/null +++ b/translated/tech/20190505 Blockchain 2.0 - What Is Ethereum -Part 9.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0 – What Is Ethereum [Part 9]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/) +[#]: author: (editor https://www.ostechnix.com/author/editor/) + +区块链 2.0 :以太坊(九) +====== + +![Ethereum][1] + +在本系列的上一指南中,我们讨论了 [Hyperledger 项目(HLP)][2],这是一个由 Linux 基金会开发的增长最快的产品。在本指南中,我们将详细讨论什么是“以太坊Ethereum”及其功能。许多研究人员认为,互联网的未来将基于去中心化计算decentralized computing的原理。实际上,去中心化计算是互联网放在首位的更广泛目标之一。但是,由于可用的计算能力不同,互联网发生了另一次变化。尽管现代服务器功能使服务器端处理和执行成为可能,但在世界上大部分地区缺乏像样的移动网络使客户端也是如此。现在,现代智能手机具有 SoC(片上系统),在客户端本身上也能够处理许多此类操作,但是,由于安全地检索和存储数据而受到的限制仍然迫使开发人员进行服务器端计算和数据管理。因此,当前可以观察到数据传输能力的瓶颈。 + +由于分布式数据存储和程序执行平台的进步,所有这些可能很快就会改变。[区块链][3]允许在分布式用户网络(而不是中央服务器)上进行安全的数据管理和程序执行,这在互联网历史上基本上是第一次。 + +以太坊就是一个这样的区块链平台,使开发人员可以访问用于在这样的去中心化网络上构建和运行应用程序的框架和工具。尽管它以其加密货币而广为人知,以太坊不只是以太币ether(加密货币)。这是一种完整的图灵完备Turing complete编程语言,旨在开发和部署 DApp(即分布式应用Distributed APPlication) [^1]。我们会在接下来的一篇文章中详细介绍 DApp。 + +以太坊是开源的,默认情况下是一个公共(非许可)区块链,并具有一个大范围的智能合约平台底层(Solidity)。以太坊提供了一个称为“以太坊虚拟机(EVM)”的虚拟计算环境,以运行应用程序和[智能合约][4] [^2]。 以太坊虚拟机在世界各地成千上万个参与节点上运行,这意味着应用程序数据在保证安全的同时,几乎不可能被篡改或丢失。 + +### 以太坊的背后:什么使之不同 + +在 2017 年,为了推广以太坊区块链的功能的利用,30 多个技术和金融领域的名人聚集在一起。因此,“以太坊企业联盟Ethereum Enterprise Alliance”(EEA)由众多支持成员组成,包括微软、摩根大通、思科、德勤和埃森哲。摩根大通已经拥有 Quorum,这是一个基于以太坊的去中心化金融服务计算平台,目前正在运营中;而微软拥有通过其 Azure 云业务销售的基于以太坊的云服务[^3]。 + +### 什么是以太币,它和以太坊有什么关系 + +以太坊的创建者维塔利克·布特林Vitalik Buterin深谙去中心化处理平台的真正价值以及为比特币提供动力的底层区块链技术。他提议比特币应该开发以支持运行分布式应用程序(DApp)和程序(现在称为智能合约)的想法,未能获得多数同意。 + +因此,他在 2013 年发表的白皮书中提出了以太坊的想法。原始白皮书仍在维护中,读者可从[此处][5]获得。这个想法是开发一个基于区块链的平台来运行智能合约和应用程序,这些合约和应用程序设计为在节点和用户设备而非服务器上运行。 + +以太坊系统经常被误认为就是加密货币以太币,但是,必须重申,以太坊是一个用于开发和执行应用程序的全栈平台,自成立以来一直如此,而比特币并非如此。**以太网目前是按市值计算的第二大加密货币**,在撰写本文时,其平均交易价格为每个以太币 170 美元 [^4]。 + +### 该平台的功能和技术特性 [^5] + +* 正如我们已经提到的,称为以太币的加密货币只是该平台功能之一。该系统的目的不仅仅是处理金融交易。 实际上,以太坊平台和比特币之间的主要区别在于它们的脚本功能。以太坊是以图灵完备的编程语言开发的,这意味着它具有类似于其他主要编程语言的脚本和应用程序功能。开发人员需要此功能才能在平台上创建 DApp 和复杂的智能合约,而该功能是比特币缺失的。 +* 以太币的“挖矿”过程更加严格和复杂。尽管可以使用专用的 ASIC 来开采比特币,但以太坊使用的基本哈希算法(EThash)降低了 ASIC 在这方面的优势。 +* 为激励矿工和节点运营者运行网络而支付的交易费用本身是使用称为 “燃料Gas”的计算令牌来计算的。通过要求交易的发起者支付与执行交易所需的计算资源数量成比例的以太币,燃料提高了系统的弹性以及对外部黑客和攻击的抵抗力。这与其他平台(例如比特币)相反,在该平台上,交易费用与交易规模一并衡量。因此,以太坊的平均交易成本从根本上低于比特币。这也意味着在以太坊虚拟机上运行的应用程序需要付费,具体取决于应用程序要解决的计算问题。基本上,执行越复杂,费用就越高。 +* 以太坊的出块时间估计约为 10 - 15 秒。出块时间是在区块链网络上打时间戳和创建区块所需的平均时间。与将在比特币网络上进行同样的交易要花费 10 分钟以上的时间相比,很明显,就交易和区块验证而言,以太坊要快得多。 +* *有趣的是,对可开采的以太币数量或开采速度没有硬性限制,这导致其系统设计不像比特币那么激进*。 + +### 总结 + +尽管与以太坊相比,它远远超过了类似的平台,但在以太坊企业联盟开始推动之前,该平台本身尚缺乏明确的发展道路。虽然以太坊平台确实推动了企业发展,但必须注意,以太坊还可以满足小型开发商和个人的需求。 这样一来,为最终用户和企业开发的平台就为以太坊遗漏了许多特定功能。另外,以太坊基金会提出和开发的区块链模型是一种公共模型,而 Hyperledger 项目等项目提出的模型是私有的和需要许可的。 + +虽然只有时间才能证明以太坊、Hyperledger 和 R3 Corda 等平台中,哪一个平台会在现实场景中找到最多粉丝,但此类系统确实证明了以区块链为动力的未来主张的正确性。 + +[^1]: [Gabriel Nicholas, “Ethereum Is Coding’s New Wild West | WIRED,” Wired , 2017][6]. +[^2]: [What is Ethereum? — Ethereum Homestead 0.1 documentation][7]. +[^3]: [Ethereum, a Virtual Currency, Enables Transactions That Rival Bitcoin’s – The New York Times][8]. +[^4]: [Cryptocurrency Market Capitalizations | CoinMarketCap][9]. +[^5]: [Introduction — Ethereum Homestead 0.1 documentation][10]. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-what-is-ethereum/ + +作者:[editor][a] +选题:[lujun9972][b] +译者:[wxy](https://github.com/wxy) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/wp-content/uploads/2019/04/Ethereum-720x340.png +[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction-to-hyperledger-project-hlp/ +[3]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ +[4]: https://www.ostechnix.com/blockchain-2-0-explaining-smart-contracts-and-its-types/ +[5]: https://github.com/ethereum/wiki/wiki/White-Paper +[6]: https://www.wired.com/story/ethereum-is-codings-new-wild-west/ +[7]: http://www.ethdocs.org/en/latest/introduction/what-is-ethereum.html#ethereum-virtual-machine +[8]: https://www.nytimes.com/2016/03/28/business/dealbook/ethereum-a-virtual-currency-enables-transactions-that-rival-bitcoins.html +[9]: https://coinmarketcap.com/ +[10]: http://www.ethdocs.org/en/latest/introduction/index.html diff --git a/translated/tech/20190715 Understanding software design patterns.md b/translated/tech/20190715 Understanding software design patterns.md deleted file mode 100644 index 9767669658..0000000000 --- a/translated/tech/20190715 Understanding software design patterns.md +++ /dev/null @@ -1,360 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (arrowfeng) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Understanding software design patterns) -[#]: via: (https://opensource.com/article/19/7/understanding-software-design-patterns) -[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/erezhttps://opensource.com/users/brson) - -理解软件设计模式 -====== -设计模式可以帮助消除冗余代码。学习如何利用Java使用单例模式、工厂模式和观察者模式。 -![clouds in the sky with blue pattern][1] - -如果你是一名正在致力于计算机科学或者相关学科的程序员或者学生,很快,你将会遇到一条术语 “软件设计模式。” 根据维基百科,_" [软件设计模式][2]是在平常的软件设计工作中所遭遇的问题是一种通用的, 可重复使用的解决方案。“_ 这里是我对定义的理解:当你在编码项目上的同时,你经常会思考,“呵呵,这里貌似是冗余代码,我想是否我能改变代码使得更灵活并且这个改变是可接受的?”因此,你将开始思考怎样分割那些保持不变的内容和需要经常改变的内容。 - - -> 设计模式是一种通过分割那些保持不变的部分和经常变化的部分,让你的代码更容易修改的方法。 - -不出意外的话,每个从事编码工程的人都可能会有同样的思考。特别是那些工业级别的工程,在那里通常工作着数十甚至数百名开发者;协作过程表明必须有一些标准和规则来使代码更加优雅并适应变化。 这就是为什么我们有 [面向对象编程][3](OOP)和 [软件框架工具][4]。设计模式有点类似于OOP,但它通过将变化视为自然开发过程的一部分而进一步发展。基本上,设计模式利用了一些OOP的思想,比如抽象和接口,但是专注于改变的过程。 - - -当你开始开发项目时, 你经常会听到这样一个术语 _重构_,_意味着通过改变代码使它变得更优雅和可复用;_ 这就是设计模式耀眼的地方。 无论什么时候你处理现有代码时(无论是由其他人构建还是你自己过去构建的),了解设计模式可以帮助你以不同的方式看待事物,你将发现问题以及改进代码的方法。 - -那里有很多种设计模式,其中单例模式,工厂模式,和观察者模式三种最受欢迎,在这篇文章中我将会一一介绍它们。 - -### 如何遵循本指南 - -无论你是一位有经验的编程工作者还是一名刚刚接触的新手,我想让这篇教程很容易让每个人都可以理解。设计模式概念并不容易理解,减少开始旅程时的学习曲线始终是首要任务。因此,除了这篇带有图表和代码片段的文章外,我还创建了一个 [GitHub仓库][5],你可以克隆和在你的电脑上运行代码去实现这三种设计模式。你也可以观看我创建的 [YouTube视频][6]。 - - -#### 必要条件 - -如果你只是想了解一般的设计模式思想,则无需克隆示例项目或安装任何工具。但是,如果要运行示例代码,你需要安装以下工具: - - - * **Java Development Kit (JDK):** 我强烈建议 [OpenJDK][7]。 - * **Apache Maven:** 这个简单的工程使用 [Apache Maven][8] 构建; 幸好许多IDEs自带了Maven。 - * **Interactive development editor (IDE):** 我使用 [IntelliJ Community Edition][9], 但是你也可以使用 [Eclipse IDE][10] 或者其他你喜欢的 Java IDE。 - * **Git:** 如果你想克隆这个工程,你需要 [Git][11]客户端。 - - -安装好Git后运行下列命令克隆这个工程: - -``` -`git clone https://github.com/bryantson/OpensourceDotComDemos.git` -``` - -然后在你喜欢的IDE中,你可以将TopDesignPatterns仓库中的代码作为Apache Maven项目导入。 - -我正在使用Java,但你也可以使用支持 [抽象原理][12]的任何编程语言来实现设计模式。 - -### 单例模式:避免每次创建一个对象 - -[单例模式][13]是非常受欢迎的设计模式,它的实现相对来说很简单,因为你只需要一个类。然而,许多开发人员争论单例设计模式的是否利大于弊,因为它缺乏明显的好处并且容易被滥用。很少有开发人员直接实现单例;相反,像Spring Framework和Google Guice等编程框架内置了单例设计模式的特性。 - -但是了解单例模式仍然有巨大的用处。单例模式确保一个类仅创建一次且提供了一个对他的全局访问点。 - -> **Singleton pattern:** 确保仅有一个实例被创建且避免在同样的工程中创建多个实例。 - -下面这幅图展示了经典的类对象创建过程。当客户端请求创建一个对象时,构造函数会创建或者实例化一个对象并调用方法返回这个类。但是每次请求一个对象都会发生这样的情况——构造函数被调用,一个新的对象被创建并且它返回一个唯一的对象。我猜面向对象语言的创建者有每次都创建一个新对象的原因,但是单例过程的支持者说这是冗余的且浪费资源。 - -![Normal class instantiation][14] - -下面这幅图使用单例模式创建对象。这里,构造函数仅当对象首次通过调用预先设计好的 getInstance() 方法时才会被调用。这通常通过检查值是否为 null 来完成,并且这个对象被作为私有变量保存在单例类的内部。下次 getInstance() 被调用时,这个类会返回第一次被创建的对象。没有新的对象产生;它只是返回旧的那一个。 - -![Singleton pattern instantiation][15] - -下面这段代码展示了创建单例模式最简单的方法: - - -``` -package org.opensource.demo.singleton; - -public class OpensourceSingleton { - -    private static OpensourceSingleton uniqueInstance; - -    private OpensourceSingleton() { -    } - -    public static OpensourceSingleton getInstance() { -        if (uniqueInstance == null) { -            uniqueInstance = new OpensourceSingleton(); -        } -        return uniqueInstance; -    } - -} -``` - -在调用方, 这里展示了如何调用单例类来获取对象: - -``` -Opensource newObject = Opensource.getInstance(); -``` - -这段代码很好的验证了单例模式的思想: - - 1. 当 getInstance() 被调用时,它通过检查 null 值来见检查对象是否已经被创建。 - 2. 如果值为空,它会创建一个新对象并把它保存到私有域,返回这个对象给调用者。否则直接返回之前被创建的对象。 - - -单例模式实现的主要问题是它忽略了并行进程。当多个进程使用线程同时访问资源时,这个问题就产生了。对于这种情况有对应的解决方案,它被称为 _双重检查锁_ 用于多线程安全,如下所示: - -``` -package org.opensource.demo.singleton; - -public class ImprovedOpensourceSingleton { - -    private volatile static ImprovedOpensourceSingleton uniqueInstance; - -    private ImprovedOpensourceSingleton() {} - -    public static ImprovedOpensourceSingleton getInstance() { -        if (uniqueInstance == null) { -            synchronized (ImprovedOpensourceSingleton.class) { -                if (uniqueInstance == null) { -                    uniqueInstance = new ImprovedOpensourceSingleton(); -                } -            } -        } -        return uniqueInstance; -    } - -} -``` - -只是为了强调前一点,确保只有在你认为这是一个安全的选项时才能直接实现你的单例模式。最好的方法是通过使用一个制作精良的编程框架来利用单例功能。 - -### 工厂模式:将对象创建委派给工厂类以隐藏创建逻辑 - -[工厂模式][16] 是另一种众所周知的设计模式,但是有一小点复杂。实现工厂模式的方法有很多,而下列的代码示例为最简单的实现方式。为了创建对象,工厂模式定义了一个接口,让它的子类去决定哪一个子类实例化。 - -> **Factory pattern:** 将对象创建委派给工厂类,因此它能隐藏创建逻辑。 - -下列的图片展示了最简单的工厂模式是如何实现的? - -![Factory pattern][17] - -客户端请求工厂类创建某个对象,类型 x,而不是客户端直接调用对象创建。根据类型,工厂模式决定要创建和返回的对象。 - -在下列代码示例中,OpensourceFactory 是工厂类实现,它从调用者那里获取 _类型_ 并根据该输入值决定要创建和返回的对象: - -``` -package org.opensource.demo.factory; - -public class OpensourceFactory { - -    public OpensourceJVMServers getServerByVendor([String][18] name) { -        if(name.equals("Apache")) { -            return new Tomcat(); -        } -        else if(name.equals("Eclipse")) { -            return new Jetty(); -        } -        else if (name.equals("RedHat")) { -            return new WildFly(); -        } -        else { -            return null; -        } -    } -} -``` - -OpenSourceJVMServer 是一个100%的抽象类(或者一个接口类),它指示要实现的是什么,而不是怎样实现: - - -``` -package org.opensource.demo.factory; - -public interface OpensourceJVMServers { -    public void startServer(); -    public void stopServer(); -    public [String][18] getName(); -} -``` - -这是一个 OpensourceJVMServers 实现类示例。当 “RedHat” 被作为类型传递给工厂类,WildFly 服务器将被创建: - - -``` -package org.opensource.demo.factory; - -public class WildFly implements OpensourceJVMServers { -    public void startServer() { -        [System][19].out.println("Starting WildFly Server..."); -    } - -    public void stopServer() { -        [System][19].out.println("Shutting Down WildFly Server..."); -    } - -    public [String][18] getName() { -        return "WildFly"; -    } -} -``` - -### 观察者模式:订阅主题并获取相关更新的通知 - -最后是[观察者模式][20]。像单例模式那样,很少有专业的程序员直接实现观察者模式。但是,许多消息队列和数据服务实现都借用了观察者模式的概念。观察者模式在对象之间定义了一对多的依赖关系,当一个对象的状态发生改变时,所有依赖它的对象都将被自动地通知和更新。 - -> **Observer pattern:** 如果有更新,那么订阅了该话题/主题的客户端将被通知。 - -思考观察者模式的最简单方法是想象一个邮件列表,你可以在其中订阅任何主题,无论是开源,技术,名人,烹饪还是您感兴趣的任何其他内容。每个主题维护者一个它的订阅者列表,在观察者模式中它们相当于观察者。当某一个主题更新时,它所有的订阅者(观察者)都将被通知这次改变。并且订阅者总是能取消某一个主题的订阅。 - -如下图所示,客户端可以订阅不同的主题并添加观察者以获得最新信息的通知。因为观察者不断的监听着这个主题,这个观察者会通知客户端任何发生的改变。 - -![Observer pattern][21] - -让我们呢来看看观察者模式的代码示例,从主题/话题类开始: - - -``` -package org.opensource.demo.observer; - -public interface Topic { - -    public void addObserver([Observer][22] observer); -    public void deleteObserver([Observer][22] observer); -    public void notifyObservers(); -} -``` -这段代码描述了一个接口为不同的主题去实现已定义的方法。注意一个观察者如何被添加、移除和通知。 - -这是一个主题的实现示例: - -``` -package org.opensource.demo.observer; - -import java.util.List; -import java.util.ArrayList; - -public class Conference implements Topic { -    private List<Observer> listObservers; -    private int totalAttendees; -    private int totalSpeakers; -    private [String][18] nameEvent; - -    public Conference() { -        listObservers = new ArrayList<Observer>(); -    } - -    public void addObserver([Observer][22] observer) { -        listObservers.add(observer); -    } - -    public void deleteObserver([Observer][22] observer) { -        int i = listObservers.indexOf(observer); -        if (i >= 0) { -            listObservers.remove(i); -        } -    } - -    public void notifyObservers() { -        for (int i=0, nObservers = listObservers.size(); i < nObservers; ++ i) { -            [Observer][22] observer = listObservers.get(i); -            observer.update(totalAttendees,totalSpeakers,nameEvent); -        } -    } - -    public void setConferenceDetails(int totalAttendees, int totalSpeakers, [String][18] nameEvent) { -        this.totalAttendees = totalAttendees; -        this.totalSpeakers = totalSpeakers; -        this.nameEvent = nameEvent; -        notifyObservers(); -    } -} -``` - -这段代码定义了一个特定主题的实现。当发生改变时,这个实现调用它自己的方法。 注意这将获取存储为列表的观察者的数量,并且可以通知和维护观察者。 - -这是一个观察者类: - -``` -package org.opensource.demo.observer; - -public interface [Observer][22] { -    public void update(int totalAttendees, int totalSpeakers, [String][18] nameEvent); -} -``` - -这个类定义了一个接口,不同的观察者可以实现该接口以执行特定的操作。 - -例如,实现了该接口的观察者可以在会议上打印出与会者和发言人的数量: - - -``` -package org.opensource.demo.observer; - -public class MonitorConferenceAttendees implements [Observer][22] { -    private int totalAttendees; -    private int totalSpeakers; -    private [String][18] nameEvent; -    private Topic topic; - -    public MonitorConferenceAttendees(Topic topic) { -        this.topic = topic; -        topic.addObserver(this); -    } - -    public void update(int totalAttendees, int totalSpeakers, [String][18] nameEvent) { -        this.totalAttendees = totalAttendees; -        this.totalSpeakers = totalSpeakers; -        this.nameEvent = nameEvent; -        printConferenceInfo(); -    } - -    public void printConferenceInfo() { -        [System][19].out.println(this.nameEvent + " has " + totalSpeakers + " speakers and " + totalAttendees + " attendees"); -    } -} -``` - -### 之后去哪? - -现在你已经阅读了这篇对于设计模式的介绍引导,你应该去一个好地方寻求其他设计模式,例如外观模式,模版模式和装饰器模式。也有一些并发和分布式系统的设计模式如断路器模式和锚定模式。 - -可是,我相信最好的磨砺你的技能首先是通过在你的边缘工程或者练习中实现这些设计模式。你甚至可以开始考虑如何在实际项目中应用这些设计模式。接下来,我强烈建议您查看OOP的 [SOLID原则][23]。之后,你将准备好了解其他设计模式。 - -However, I believe it's best to hone your skills first by implementing these design patterns in your side projects or just as practice. You can even begin to contemplate how you can apply these design patterns in your real projects. Next, I highly recommend checking out the [SOLID principles][23] of OOP. After that, you will be ready to look into the other design patterns. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/understanding-software-design-patterns - -作者:[Bryant Son][a] -选题:[lujun9972][b] -译者:[arrowfeng](https://github.com/arrowfeng) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/brsonhttps://opensource.com/users/erezhttps://opensource.com/users/brson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) -[2]: https://en.wikipedia.org/wiki/Software_design_pattern -[3]: https://en.wikipedia.org/wiki/Object-oriented_programming -[4]: https://en.wikipedia.org/wiki/Software_framework -[5]: https://github.com/bryantson/OpensourceDotComDemos/tree/master/TopDesignPatterns -[6]: https://www.youtube.com/watch?v=VlBXYtLI7kE&feature=youtu.be -[7]: https://openjdk.java.net/ -[8]: https://maven.apache.org/ -[9]: https://www.jetbrains.com/idea/download/#section=mac -[10]: https://www.eclipse.org/ide/ -[11]: https://git-scm.com/ -[12]: https://en.wikipedia.org/wiki/Abstraction_principle_(computer_programming) -[13]: https://en.wikipedia.org/wiki/Singleton_pattern -[14]: https://opensource.com/sites/default/files/uploads/designpatterns1_normalclassinstantiation.jpg (Normal class instantiation) -[15]: https://opensource.com/sites/default/files/uploads/designpatterns2_singletonpattern.jpg (Singleton pattern instantiation) -[16]: https://en.wikipedia.org/wiki/Factory_method_pattern -[17]: https://opensource.com/sites/default/files/uploads/designpatterns3_factorypattern.jpg (Factory pattern) -[18]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[19]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[20]: https://en.wikipedia.org/wiki/Observer_pattern -[21]: https://opensource.com/sites/default/files/uploads/designpatterns4_observerpattern.jpg (Observer pattern) -[22]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+observer -[23]: https://en.wikipedia.org/wiki/SOLID diff --git a/translated/tech/20190716 Become a lifelong learner and succeed at work.md b/translated/tech/20190716 Become a lifelong learner and succeed at work.md deleted file mode 100644 index 14945651d3..0000000000 --- a/translated/tech/20190716 Become a lifelong learner and succeed at work.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (heguangzhi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Become a lifelong learner and succeed at work) -[#]: via: (https://opensource.com/open-organization/19/7/informal-learning-adaptability) -[#]: author: (Colin Willis https://opensource.com/users/colinwillishttps://opensource.com/users/marcobravo) - - -成为终身学习者,并在工作中取得成功 -====== - -在具有适应性文化的开放组织中,学习应该一直持续——不会总是在正式场合发生。我们真的明白它是如何工作的吗? - -![Writing in a notebook][1] - -持续学习是指人们为发展自己而进行的持续的、职业驱动的、有意识的学习过程。对于那些认为自己是持续学习者的人来说,学习从未停止——这些人从日常经历中看到学习机会。与同事进行辩论、反思反馈、在互联网上寻找问题的解决方案、尝试新事物或冒险都是一个人在工作中可以进行的非正式学习活动的例子。 - - -持续学习是开放组织中任何人的核心能力。毕竟,开放的组织是建立在同行相互思考、争论和行动的基础上的。在开放组织的模棱两可、话语驱动的世界中茁壮成长,每天都需要员工具备这些技能。 - -不幸的是,科学文献在传播我们在工作中学习的知识方面,帮助个人欣赏和发展自己的学习能力方面,做得很差。因此,在本文系列中,我将向您介绍非正式学习,并帮助您理解将学习视为一种技能如何帮助您在任何组织中茁壮成长,尤其是在开源组织中。 - -### 为什么这么正式? - -迄今为止,对组织中学习的科学研究主要集中在正式学习而不是非正式学习的设计、实施和评估上。 - -投资于员工知识、技能和能力的发展是一个组织保持其相对于竞争对手优势的重要方式。组织通过创建或购买课程、在线课程、研讨会等来提供正式确定学习机会。意在指导个人学习与工作相关的内容,就像学校里的一节课。对于一个组织来说,提供一门课程是一种简单(如果昂贵的话)的方法,可以确保其员工的技能或知识保持最新。同样,教室环境是研究人员的天然实验室,使得基于培训的研究和工作不仅可能,而且强大。 - -最近的评估表明,70%到80%的工作相关知识不是在培训中学到的,而是非正式的在职学习中得到的。 - -当然,人们不需要训练来学习一些东西;通常,人们通过研究答案、与同事交谈、思考、实验或适应变化来学习。事实上,[最近的评估表明][2]70%到80%的与工作相关的知识不是在培训中学到的,而是在工作中非正式学到的。这并不是说正式培训无效;培训可能非常有效,但它是一种精确的干预方式。在工作的大部分方面正式培训一个人是不现实的,尤其是当这些工作变得更加复杂的时候。 - -因此,非正式学习,或者任何发生在结构化学习环境之外的学习,对工作场所来说是极其重要的。事实上,[最近的科学证据][3]表明,非正式学习比正式培训更能预测工作表现。 - -那么,为什么组织和科学界如此关注培训呢? - -### 循环过程 - -除了我前面提到的原因,研究非正式学习可能非常困难。与正式学习不同,非正式学习发生在非结构化环境中,高度依赖于个人,很难或不可能观察并研究。 - -直到最近,大多数关于非正式学习的研究都集中在定义非正式学习的合格特征和确定非正式学习在理论上是如何与工作经验联系在一起的。研究人员描述了一个[动态的周期性过程][4],通过这个过程,个人可以在组织中非正式地学习。 - -与正式学习一样,非正式学习发生在非结构化环境中,高度依赖于个人,很难或不可能观察。 - -在这个过程中,个人和组织都有创造学习机会的机构。例如,一个人可能对学习某样东西感兴趣,并为此表现出学习行为。组织以反馈的形式传递给个人,可能表明需要学习。这可能是一个糟糕的绩效评估,一个在项目中发表的评论,或者一个不是个人指导的组织环境的更广泛的变化。这些力量在组织环境中(例如,有人尝试了一个新想法,他或她的同事认识到并奖励了这种行为)或者通过在个人的头脑中反思(例如,有人反思了关于他或她的表现的,并决定在学习工作中付出更多的努力)。与培训不同,非正式学习不遵循正式的线性过程。一个人可以在任何时候体验过程的任何部分,同时体验过程的多个部分。 - -### 开放组织中的非正式学习 - -具体而言,在开放组织中,对等级制度的重视程度降低,对参与式文化的重视程度提高,这两者都推动了这种非正式的学习。简而言之,开放的组织只是为个人和组织环境提供了更多互动和激发学习的机会。此外,想法和变革需要开放组织中员工更广泛的认同——而认同需要对他人的适应性和洞察力的欣赏。 - -也就是说,仅仅增加学习机会并不能保证学习会发生或成功。有人甚至可能会说,开放组织中常见的模糊性和开放性话语可能会阻止不擅长持续学习的人——再一次,随着时间的推移学习的习惯和开放组织的核心能力——尽可能有效地为组织做出贡献。 - -解决这些问题需要一种以一致的方式跟踪非正式学习。最近,科学界呼吁创造衡量非正式学习的方法,这样就可以进行系统的研究来解决非正式学习的前因后果的问题。我自己的研究集中在这一呼吁上,我花了几年时间发展和完善我们对非正式学习行为的理解,以便对它们进行测量。 - -在本文系列的第二部分,我将重点介绍我最近在一个开放组织中进行的一项研究的结果,在该研究中,我测试了我对非正式学习行为的研究,并将它们与更广泛的工作环境和个人工作成果联系起来。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/open-organization/19/7/informal-learning-adaptability - -作者:[Colin Willis][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/colinwillishttps://opensource.com/users/marcobravo -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_ (Writing in a notebook) -[2]: https://www.groupoe.com/images/Accelerating_On-the-Job-Learning_-_White_Paper.pdf -[3]: https://www.researchgate.net/publication/316490244_Antecedents_and_Outcomes_of_Informal_Learning_Behaviors_a_Meta-Analysis -[4]: https://psycnet.apa.org/record/2008-13469-009